@agentv/core 0.22.1 → 0.23.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/dist/index.d.cts CHANGED
@@ -75,7 +75,7 @@ declare function isJsonValue(value: unknown): value is JsonValue;
75
75
  * Guard validating raw test messages.
76
76
  */
77
77
  declare function isTestMessage(value: unknown): value is TestMessage;
78
- declare const EVALUATOR_KIND_VALUES: readonly ["code", "llm_judge", "rubric"];
78
+ declare const EVALUATOR_KIND_VALUES: readonly ["code_judge", "llm_judge", "rubric", "composite"];
79
79
  type EvaluatorKind = (typeof EVALUATOR_KIND_VALUES)[number];
80
80
  declare function isEvaluatorKind(value: unknown): value is EvaluatorKind;
81
81
  type CodeEvaluatorConfig = {
@@ -91,6 +91,7 @@ type LlmJudgeEvaluatorConfig = {
91
91
  readonly type: 'llm_judge';
92
92
  readonly prompt?: string;
93
93
  readonly promptPath?: string;
94
+ readonly rubrics?: readonly RubricItem[];
94
95
  };
95
96
  type RubricItem = {
96
97
  readonly id: string;
@@ -98,12 +99,26 @@ type RubricItem = {
98
99
  readonly weight: number;
99
100
  readonly required: boolean;
100
101
  };
101
- type RubricEvaluatorConfig = {
102
+ type CompositeAggregatorConfig = {
103
+ readonly type: 'weighted_average';
104
+ readonly weights?: Record<string, number>;
105
+ } | {
106
+ readonly type: 'code_judge';
107
+ readonly path: string;
108
+ readonly cwd?: string;
109
+ } | {
110
+ readonly type: 'llm_judge';
111
+ readonly prompt?: string;
112
+ readonly promptPath?: string;
113
+ readonly model?: string;
114
+ };
115
+ type CompositeEvaluatorConfig = {
102
116
  readonly name: string;
103
- readonly type: 'rubric';
104
- readonly rubrics: readonly RubricItem[];
117
+ readonly type: 'composite';
118
+ readonly evaluators: readonly EvaluatorConfig[];
119
+ readonly aggregator: CompositeAggregatorConfig;
105
120
  };
106
- type EvaluatorConfig = CodeEvaluatorConfig | LlmJudgeEvaluatorConfig | RubricEvaluatorConfig;
121
+ type EvaluatorConfig = CodeEvaluatorConfig | LlmJudgeEvaluatorConfig | CompositeEvaluatorConfig;
107
122
  /**
108
123
  * Eval case definition sourced from AgentV specs.
109
124
  */
@@ -150,12 +165,14 @@ interface EvaluatorResult {
150
165
  readonly name: string;
151
166
  readonly type: EvaluatorKind;
152
167
  readonly score: number;
168
+ readonly weight?: number;
153
169
  readonly verdict?: EvaluationVerdict;
154
170
  readonly hits: readonly string[];
155
171
  readonly misses: readonly string[];
156
172
  readonly reasoning?: string;
157
173
  readonly raw_request?: JsonObject;
158
174
  readonly evaluator_provider_request?: JsonObject;
175
+ readonly evaluator_results?: readonly EvaluatorResult[];
159
176
  }
160
177
  /**
161
178
  * Convenience accessor matching the Python hit_count property.
@@ -530,20 +547,6 @@ declare function subscribeToCodexLogEntries(listener: CodexLogListener): () => v
530
547
  declare function createProvider(target: ResolvedTarget): Provider;
531
548
  declare function resolveAndCreateProvider(definition: TargetDefinition, env?: EnvLookup): Provider;
532
549
 
533
- interface RubricEvaluatorOptions {
534
- readonly config: RubricEvaluatorConfig;
535
- readonly resolveJudgeProvider: (context: EvaluationContext) => Promise<Provider | undefined>;
536
- }
537
- declare class RubricEvaluator implements Evaluator {
538
- readonly kind = "rubric";
539
- private readonly config;
540
- private readonly resolveJudgeProvider;
541
- constructor(options: RubricEvaluatorOptions);
542
- evaluate(context: EvaluationContext): Promise<EvaluationScore>;
543
- private buildPrompt;
544
- private calculateScore;
545
- }
546
-
547
550
  interface EvaluationContext {
548
551
  readonly evalCase: EvalCase;
549
552
  readonly candidate: string;
@@ -563,13 +566,26 @@ interface EvaluationContext {
563
566
  }
564
567
  interface EvaluationScore {
565
568
  readonly score: number;
566
- readonly verdict?: EvaluationVerdict;
569
+ readonly verdict: EvaluationVerdict;
567
570
  readonly hits: readonly string[];
568
571
  readonly misses: readonly string[];
569
572
  readonly expectedAspectCount: number;
570
573
  readonly reasoning?: string;
571
574
  readonly rawAspects?: readonly string[];
572
575
  readonly evaluatorRawRequest?: JsonObject;
576
+ readonly evaluatorResults?: readonly ChildEvaluatorResult[];
577
+ }
578
+ interface ChildEvaluatorResult {
579
+ readonly name: string;
580
+ readonly type: string;
581
+ readonly score: number;
582
+ readonly weight?: number;
583
+ readonly verdict: EvaluationVerdict;
584
+ readonly hits: readonly string[];
585
+ readonly misses: readonly string[];
586
+ readonly reasoning?: string;
587
+ readonly evaluatorRawRequest?: JsonObject;
588
+ readonly evaluatorResults?: readonly ChildEvaluatorResult[];
573
589
  }
574
590
  interface Evaluator {
575
591
  readonly kind: string;
@@ -590,7 +606,10 @@ declare class LlmJudgeEvaluator implements Evaluator {
590
606
  private readonly evaluatorTemplate?;
591
607
  constructor(options: LlmJudgeEvaluatorOptions);
592
608
  evaluate(context: EvaluationContext): Promise<EvaluationScore>;
593
- private evaluateWithPrompt;
609
+ private evaluateFreeform;
610
+ private evaluateWithRubrics;
611
+ private buildRubricPrompt;
612
+ private runWithRetry;
594
613
  }
595
614
  interface CodeEvaluatorOptions {
596
615
  readonly script: string;
@@ -605,6 +624,26 @@ declare class CodeEvaluator implements Evaluator {
605
624
  constructor(options: CodeEvaluatorOptions);
606
625
  evaluate(context: EvaluationContext): Promise<EvaluationScore>;
607
626
  }
627
+ interface EvaluatorFactory {
628
+ create(config: EvaluatorConfig, context: EvaluationContext): Evaluator;
629
+ }
630
+ interface CompositeEvaluatorOptions {
631
+ readonly config: CompositeEvaluatorConfig;
632
+ readonly evaluatorFactory: EvaluatorFactory;
633
+ readonly cwd?: string;
634
+ }
635
+ declare class CompositeEvaluator implements Evaluator {
636
+ readonly kind = "composite";
637
+ private readonly config;
638
+ private readonly evaluatorFactory;
639
+ private readonly cwd?;
640
+ constructor(options: CompositeEvaluatorOptions);
641
+ evaluate(context: EvaluationContext): Promise<EvaluationScore>;
642
+ private aggregate;
643
+ private runWeightedAverage;
644
+ private runCodeAggregator;
645
+ private runLlmAggregator;
646
+ }
608
647
 
609
648
  type MaybePromise<T> = T | Promise<T>;
610
649
  interface EvaluationCache {
@@ -675,4 +714,4 @@ type AgentKernel = {
675
714
  };
676
715
  declare function createAgentKernel(): AgentKernel;
677
716
 
678
- export { type AgentKernel, type AnthropicResolvedConfig, type AssistantTestMessage, type AzureResolvedConfig, type CliResolvedConfig, CodeEvaluator, type CodeEvaluatorConfig, type CodeEvaluatorOptions, type EnsureSubagentsOptions, type EnsureSubagentsResult, type EnvLookup, type EvalCase, type EvaluationCache, type EvaluationContext, type EvaluationResult, type EvaluationScore, type EvaluationVerdict, type Evaluator, type EvaluatorConfig, type EvaluatorKind, type EvaluatorResult, type GeminiResolvedConfig, type GenerateRubricsOptions, type JsonObject, type JsonPrimitive, type JsonValue, LlmJudgeEvaluator, type LlmJudgeEvaluatorConfig, type LlmJudgeEvaluatorOptions, type MockResolvedConfig, type ProgressEvent, type PromptInputs, type Provider, type ProviderKind, type ProviderRequest, type ProviderResponse, type ResolvedTarget, RubricEvaluator, type RubricEvaluatorConfig, type RubricItem, type RunEvalCaseOptions, type RunEvaluationOptions, type SystemTestMessage, TEST_MESSAGE_ROLES, type TargetDefinition, type TestMessage, type TestMessageContent, type TestMessageRole, type ToolTestMessage, type UserTestMessage, type VSCodeResolvedConfig, buildDirectoryChain, buildPromptInputs, buildSearchRoots, consumeCodexLogEntries, createAgentKernel, createProvider, ensureVSCodeSubagents, extractCodeBlocks, fileExists, findGitRoot, generateRubrics, getHitCount, isEvaluatorKind, isGuidelineFile, isJsonObject, isJsonValue, isTestMessage, isTestMessageRole, listTargetNames, loadEvalCases, normalizeLineEndings, readTargetDefinitions, readTestSuiteMetadata, readTextFile, resolveAndCreateProvider, resolveFileReference, resolveTargetDefinition, runEvalCase, runEvaluation, subscribeToCodexLogEntries };
717
+ export { type AgentKernel, type AnthropicResolvedConfig, type AssistantTestMessage, type AzureResolvedConfig, type ChildEvaluatorResult, type CliResolvedConfig, CodeEvaluator, type CodeEvaluatorConfig, type CodeEvaluatorOptions, type CompositeAggregatorConfig, CompositeEvaluator, type CompositeEvaluatorConfig, type CompositeEvaluatorOptions, type EnsureSubagentsOptions, type EnsureSubagentsResult, type EnvLookup, type EvalCase, type EvaluationCache, type EvaluationContext, type EvaluationResult, type EvaluationScore, type EvaluationVerdict, type Evaluator, type EvaluatorConfig, type EvaluatorFactory, type EvaluatorKind, type EvaluatorResult, type GeminiResolvedConfig, type GenerateRubricsOptions, type JsonObject, type JsonPrimitive, type JsonValue, LlmJudgeEvaluator, type LlmJudgeEvaluatorConfig, type LlmJudgeEvaluatorOptions, type MockResolvedConfig, type ProgressEvent, type PromptInputs, type Provider, type ProviderKind, type ProviderRequest, type ProviderResponse, type ResolvedTarget, type RubricItem, type RunEvalCaseOptions, type RunEvaluationOptions, type SystemTestMessage, TEST_MESSAGE_ROLES, type TargetDefinition, type TestMessage, type TestMessageContent, type TestMessageRole, type ToolTestMessage, type UserTestMessage, type VSCodeResolvedConfig, buildDirectoryChain, buildPromptInputs, buildSearchRoots, consumeCodexLogEntries, createAgentKernel, createProvider, ensureVSCodeSubagents, extractCodeBlocks, fileExists, findGitRoot, generateRubrics, getHitCount, isEvaluatorKind, isGuidelineFile, isJsonObject, isJsonValue, isTestMessage, isTestMessageRole, listTargetNames, loadEvalCases, normalizeLineEndings, readTargetDefinitions, readTestSuiteMetadata, readTextFile, resolveAndCreateProvider, resolveFileReference, resolveTargetDefinition, runEvalCase, runEvaluation, subscribeToCodexLogEntries };
package/dist/index.d.ts CHANGED
@@ -75,7 +75,7 @@ declare function isJsonValue(value: unknown): value is JsonValue;
75
75
  * Guard validating raw test messages.
76
76
  */
77
77
  declare function isTestMessage(value: unknown): value is TestMessage;
78
- declare const EVALUATOR_KIND_VALUES: readonly ["code", "llm_judge", "rubric"];
78
+ declare const EVALUATOR_KIND_VALUES: readonly ["code_judge", "llm_judge", "rubric", "composite"];
79
79
  type EvaluatorKind = (typeof EVALUATOR_KIND_VALUES)[number];
80
80
  declare function isEvaluatorKind(value: unknown): value is EvaluatorKind;
81
81
  type CodeEvaluatorConfig = {
@@ -91,6 +91,7 @@ type LlmJudgeEvaluatorConfig = {
91
91
  readonly type: 'llm_judge';
92
92
  readonly prompt?: string;
93
93
  readonly promptPath?: string;
94
+ readonly rubrics?: readonly RubricItem[];
94
95
  };
95
96
  type RubricItem = {
96
97
  readonly id: string;
@@ -98,12 +99,26 @@ type RubricItem = {
98
99
  readonly weight: number;
99
100
  readonly required: boolean;
100
101
  };
101
- type RubricEvaluatorConfig = {
102
+ type CompositeAggregatorConfig = {
103
+ readonly type: 'weighted_average';
104
+ readonly weights?: Record<string, number>;
105
+ } | {
106
+ readonly type: 'code_judge';
107
+ readonly path: string;
108
+ readonly cwd?: string;
109
+ } | {
110
+ readonly type: 'llm_judge';
111
+ readonly prompt?: string;
112
+ readonly promptPath?: string;
113
+ readonly model?: string;
114
+ };
115
+ type CompositeEvaluatorConfig = {
102
116
  readonly name: string;
103
- readonly type: 'rubric';
104
- readonly rubrics: readonly RubricItem[];
117
+ readonly type: 'composite';
118
+ readonly evaluators: readonly EvaluatorConfig[];
119
+ readonly aggregator: CompositeAggregatorConfig;
105
120
  };
106
- type EvaluatorConfig = CodeEvaluatorConfig | LlmJudgeEvaluatorConfig | RubricEvaluatorConfig;
121
+ type EvaluatorConfig = CodeEvaluatorConfig | LlmJudgeEvaluatorConfig | CompositeEvaluatorConfig;
107
122
  /**
108
123
  * Eval case definition sourced from AgentV specs.
109
124
  */
@@ -150,12 +165,14 @@ interface EvaluatorResult {
150
165
  readonly name: string;
151
166
  readonly type: EvaluatorKind;
152
167
  readonly score: number;
168
+ readonly weight?: number;
153
169
  readonly verdict?: EvaluationVerdict;
154
170
  readonly hits: readonly string[];
155
171
  readonly misses: readonly string[];
156
172
  readonly reasoning?: string;
157
173
  readonly raw_request?: JsonObject;
158
174
  readonly evaluator_provider_request?: JsonObject;
175
+ readonly evaluator_results?: readonly EvaluatorResult[];
159
176
  }
160
177
  /**
161
178
  * Convenience accessor matching the Python hit_count property.
@@ -530,20 +547,6 @@ declare function subscribeToCodexLogEntries(listener: CodexLogListener): () => v
530
547
  declare function createProvider(target: ResolvedTarget): Provider;
531
548
  declare function resolveAndCreateProvider(definition: TargetDefinition, env?: EnvLookup): Provider;
532
549
 
533
- interface RubricEvaluatorOptions {
534
- readonly config: RubricEvaluatorConfig;
535
- readonly resolveJudgeProvider: (context: EvaluationContext) => Promise<Provider | undefined>;
536
- }
537
- declare class RubricEvaluator implements Evaluator {
538
- readonly kind = "rubric";
539
- private readonly config;
540
- private readonly resolveJudgeProvider;
541
- constructor(options: RubricEvaluatorOptions);
542
- evaluate(context: EvaluationContext): Promise<EvaluationScore>;
543
- private buildPrompt;
544
- private calculateScore;
545
- }
546
-
547
550
  interface EvaluationContext {
548
551
  readonly evalCase: EvalCase;
549
552
  readonly candidate: string;
@@ -563,13 +566,26 @@ interface EvaluationContext {
563
566
  }
564
567
  interface EvaluationScore {
565
568
  readonly score: number;
566
- readonly verdict?: EvaluationVerdict;
569
+ readonly verdict: EvaluationVerdict;
567
570
  readonly hits: readonly string[];
568
571
  readonly misses: readonly string[];
569
572
  readonly expectedAspectCount: number;
570
573
  readonly reasoning?: string;
571
574
  readonly rawAspects?: readonly string[];
572
575
  readonly evaluatorRawRequest?: JsonObject;
576
+ readonly evaluatorResults?: readonly ChildEvaluatorResult[];
577
+ }
578
+ interface ChildEvaluatorResult {
579
+ readonly name: string;
580
+ readonly type: string;
581
+ readonly score: number;
582
+ readonly weight?: number;
583
+ readonly verdict: EvaluationVerdict;
584
+ readonly hits: readonly string[];
585
+ readonly misses: readonly string[];
586
+ readonly reasoning?: string;
587
+ readonly evaluatorRawRequest?: JsonObject;
588
+ readonly evaluatorResults?: readonly ChildEvaluatorResult[];
573
589
  }
574
590
  interface Evaluator {
575
591
  readonly kind: string;
@@ -590,7 +606,10 @@ declare class LlmJudgeEvaluator implements Evaluator {
590
606
  private readonly evaluatorTemplate?;
591
607
  constructor(options: LlmJudgeEvaluatorOptions);
592
608
  evaluate(context: EvaluationContext): Promise<EvaluationScore>;
593
- private evaluateWithPrompt;
609
+ private evaluateFreeform;
610
+ private evaluateWithRubrics;
611
+ private buildRubricPrompt;
612
+ private runWithRetry;
594
613
  }
595
614
  interface CodeEvaluatorOptions {
596
615
  readonly script: string;
@@ -605,6 +624,26 @@ declare class CodeEvaluator implements Evaluator {
605
624
  constructor(options: CodeEvaluatorOptions);
606
625
  evaluate(context: EvaluationContext): Promise<EvaluationScore>;
607
626
  }
627
+ interface EvaluatorFactory {
628
+ create(config: EvaluatorConfig, context: EvaluationContext): Evaluator;
629
+ }
630
+ interface CompositeEvaluatorOptions {
631
+ readonly config: CompositeEvaluatorConfig;
632
+ readonly evaluatorFactory: EvaluatorFactory;
633
+ readonly cwd?: string;
634
+ }
635
+ declare class CompositeEvaluator implements Evaluator {
636
+ readonly kind = "composite";
637
+ private readonly config;
638
+ private readonly evaluatorFactory;
639
+ private readonly cwd?;
640
+ constructor(options: CompositeEvaluatorOptions);
641
+ evaluate(context: EvaluationContext): Promise<EvaluationScore>;
642
+ private aggregate;
643
+ private runWeightedAverage;
644
+ private runCodeAggregator;
645
+ private runLlmAggregator;
646
+ }
608
647
 
609
648
  type MaybePromise<T> = T | Promise<T>;
610
649
  interface EvaluationCache {
@@ -675,4 +714,4 @@ type AgentKernel = {
675
714
  };
676
715
  declare function createAgentKernel(): AgentKernel;
677
716
 
678
- export { type AgentKernel, type AnthropicResolvedConfig, type AssistantTestMessage, type AzureResolvedConfig, type CliResolvedConfig, CodeEvaluator, type CodeEvaluatorConfig, type CodeEvaluatorOptions, type EnsureSubagentsOptions, type EnsureSubagentsResult, type EnvLookup, type EvalCase, type EvaluationCache, type EvaluationContext, type EvaluationResult, type EvaluationScore, type EvaluationVerdict, type Evaluator, type EvaluatorConfig, type EvaluatorKind, type EvaluatorResult, type GeminiResolvedConfig, type GenerateRubricsOptions, type JsonObject, type JsonPrimitive, type JsonValue, LlmJudgeEvaluator, type LlmJudgeEvaluatorConfig, type LlmJudgeEvaluatorOptions, type MockResolvedConfig, type ProgressEvent, type PromptInputs, type Provider, type ProviderKind, type ProviderRequest, type ProviderResponse, type ResolvedTarget, RubricEvaluator, type RubricEvaluatorConfig, type RubricItem, type RunEvalCaseOptions, type RunEvaluationOptions, type SystemTestMessage, TEST_MESSAGE_ROLES, type TargetDefinition, type TestMessage, type TestMessageContent, type TestMessageRole, type ToolTestMessage, type UserTestMessage, type VSCodeResolvedConfig, buildDirectoryChain, buildPromptInputs, buildSearchRoots, consumeCodexLogEntries, createAgentKernel, createProvider, ensureVSCodeSubagents, extractCodeBlocks, fileExists, findGitRoot, generateRubrics, getHitCount, isEvaluatorKind, isGuidelineFile, isJsonObject, isJsonValue, isTestMessage, isTestMessageRole, listTargetNames, loadEvalCases, normalizeLineEndings, readTargetDefinitions, readTestSuiteMetadata, readTextFile, resolveAndCreateProvider, resolveFileReference, resolveTargetDefinition, runEvalCase, runEvaluation, subscribeToCodexLogEntries };
717
+ export { type AgentKernel, type AnthropicResolvedConfig, type AssistantTestMessage, type AzureResolvedConfig, type ChildEvaluatorResult, type CliResolvedConfig, CodeEvaluator, type CodeEvaluatorConfig, type CodeEvaluatorOptions, type CompositeAggregatorConfig, CompositeEvaluator, type CompositeEvaluatorConfig, type CompositeEvaluatorOptions, type EnsureSubagentsOptions, type EnsureSubagentsResult, type EnvLookup, type EvalCase, type EvaluationCache, type EvaluationContext, type EvaluationResult, type EvaluationScore, type EvaluationVerdict, type Evaluator, type EvaluatorConfig, type EvaluatorFactory, type EvaluatorKind, type EvaluatorResult, type GeminiResolvedConfig, type GenerateRubricsOptions, type JsonObject, type JsonPrimitive, type JsonValue, LlmJudgeEvaluator, type LlmJudgeEvaluatorConfig, type LlmJudgeEvaluatorOptions, type MockResolvedConfig, type ProgressEvent, type PromptInputs, type Provider, type ProviderKind, type ProviderRequest, type ProviderResponse, type ResolvedTarget, type RubricItem, type RunEvalCaseOptions, type RunEvaluationOptions, type SystemTestMessage, TEST_MESSAGE_ROLES, type TargetDefinition, type TestMessage, type TestMessageContent, type TestMessageRole, type ToolTestMessage, type UserTestMessage, type VSCodeResolvedConfig, buildDirectoryChain, buildPromptInputs, buildSearchRoots, consumeCodexLogEntries, createAgentKernel, createProvider, ensureVSCodeSubagents, extractCodeBlocks, fileExists, findGitRoot, generateRubrics, getHitCount, isEvaluatorKind, isGuidelineFile, isJsonObject, isJsonValue, isTestMessage, isTestMessageRole, listTargetNames, loadEvalCases, normalizeLineEndings, readTargetDefinitions, readTestSuiteMetadata, readTextFile, resolveAndCreateProvider, resolveFileReference, resolveTargetDefinition, runEvalCase, runEvaluation, subscribeToCodexLogEntries };