agentv 0.7.5 → 0.9.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 +82 -37
- package/dist/{chunk-J3LVKRRT.js → chunk-X2VVUCIB.js} +260 -161
- package/dist/chunk-X2VVUCIB.js.map +1 -0
- package/dist/cli.js +1 -1
- package/dist/index.js +1 -1
- package/dist/templates/agentv/targets.yaml +35 -43
- package/package.json +2 -2
- package/dist/chunk-J3LVKRRT.js.map +0 -1
|
@@ -590,7 +590,7 @@ import fg from "fast-glob";
|
|
|
590
590
|
import { stat as stat3 } from "node:fs/promises";
|
|
591
591
|
import path15 from "node:path";
|
|
592
592
|
|
|
593
|
-
// ../../packages/core/dist/chunk-
|
|
593
|
+
// ../../packages/core/dist/chunk-SNTZFB24.js
|
|
594
594
|
import { constants } from "node:fs";
|
|
595
595
|
import { access, readFile } from "node:fs/promises";
|
|
596
596
|
import path from "node:path";
|
|
@@ -4636,7 +4636,7 @@ var coerce = {
|
|
|
4636
4636
|
};
|
|
4637
4637
|
var NEVER = INVALID;
|
|
4638
4638
|
|
|
4639
|
-
// ../../packages/core/dist/chunk-
|
|
4639
|
+
// ../../packages/core/dist/chunk-SNTZFB24.js
|
|
4640
4640
|
async function fileExists(filePath) {
|
|
4641
4641
|
try {
|
|
4642
4642
|
await access(filePath, constants.F_OK);
|
|
@@ -4747,10 +4747,9 @@ var CLI_PLACEHOLDERS = /* @__PURE__ */ new Set(["PROMPT", "GUIDELINES", "EVAL_ID
|
|
|
4747
4747
|
var BASE_TARGET_SCHEMA = external_exports.object({
|
|
4748
4748
|
name: external_exports.string().min(1, "target name is required"),
|
|
4749
4749
|
provider: external_exports.string().min(1, "provider is required"),
|
|
4750
|
-
settings: external_exports.record(external_exports.unknown()).optional(),
|
|
4751
4750
|
judge_target: external_exports.string().optional(),
|
|
4752
4751
|
workers: external_exports.number().int().min(1).optional()
|
|
4753
|
-
});
|
|
4752
|
+
}).passthrough();
|
|
4754
4753
|
var DEFAULT_AZURE_API_VERSION = "2024-10-01-preview";
|
|
4755
4754
|
function normalizeAzureApiVersion(value) {
|
|
4756
4755
|
if (!value) {
|
|
@@ -4763,11 +4762,43 @@ function normalizeAzureApiVersion(value) {
|
|
|
4763
4762
|
const withoutPrefix = trimmed.replace(/^api[-_]?version\s*=\s*/i, "").trim();
|
|
4764
4763
|
return withoutPrefix.length > 0 ? withoutPrefix : DEFAULT_AZURE_API_VERSION;
|
|
4765
4764
|
}
|
|
4765
|
+
function resolveRetryConfig(target) {
|
|
4766
|
+
const maxRetries = resolveOptionalNumber(
|
|
4767
|
+
target.max_retries ?? target.maxRetries,
|
|
4768
|
+
`${target.name} max retries`
|
|
4769
|
+
);
|
|
4770
|
+
const initialDelayMs = resolveOptionalNumber(
|
|
4771
|
+
target.retry_initial_delay_ms ?? target.retryInitialDelayMs,
|
|
4772
|
+
`${target.name} retry initial delay`
|
|
4773
|
+
);
|
|
4774
|
+
const maxDelayMs = resolveOptionalNumber(
|
|
4775
|
+
target.retry_max_delay_ms ?? target.retryMaxDelayMs,
|
|
4776
|
+
`${target.name} retry max delay`
|
|
4777
|
+
);
|
|
4778
|
+
const backoffFactor = resolveOptionalNumber(
|
|
4779
|
+
target.retry_backoff_factor ?? target.retryBackoffFactor,
|
|
4780
|
+
`${target.name} retry backoff factor`
|
|
4781
|
+
);
|
|
4782
|
+
const retryableStatusCodes = resolveOptionalNumberArray(
|
|
4783
|
+
target.retry_status_codes ?? target.retryStatusCodes,
|
|
4784
|
+
`${target.name} retry status codes`
|
|
4785
|
+
);
|
|
4786
|
+
if (maxRetries === void 0 && initialDelayMs === void 0 && maxDelayMs === void 0 && backoffFactor === void 0 && retryableStatusCodes === void 0) {
|
|
4787
|
+
return void 0;
|
|
4788
|
+
}
|
|
4789
|
+
return {
|
|
4790
|
+
maxRetries,
|
|
4791
|
+
initialDelayMs,
|
|
4792
|
+
maxDelayMs,
|
|
4793
|
+
backoffFactor,
|
|
4794
|
+
retryableStatusCodes
|
|
4795
|
+
};
|
|
4796
|
+
}
|
|
4766
4797
|
function resolveTargetDefinition(definition, env = process.env) {
|
|
4767
4798
|
const parsed = BASE_TARGET_SCHEMA.parse(definition);
|
|
4768
4799
|
const provider = parsed.provider.toLowerCase();
|
|
4769
4800
|
const providerBatching = resolveOptionalBoolean(
|
|
4770
|
-
parsed.
|
|
4801
|
+
parsed.provider_batching ?? parsed.providerBatching
|
|
4771
4802
|
);
|
|
4772
4803
|
switch (provider) {
|
|
4773
4804
|
case "azure":
|
|
@@ -4843,13 +4874,12 @@ function resolveTargetDefinition(definition, env = process.env) {
|
|
|
4843
4874
|
}
|
|
4844
4875
|
}
|
|
4845
4876
|
function resolveAzureConfig(target, env) {
|
|
4846
|
-
const
|
|
4847
|
-
const
|
|
4848
|
-
const
|
|
4849
|
-
const
|
|
4850
|
-
const
|
|
4851
|
-
const
|
|
4852
|
-
const maxTokensSource = settings.max_output_tokens ?? settings.maxTokens;
|
|
4877
|
+
const endpointSource = target.endpoint ?? target.resource ?? target.resourceName;
|
|
4878
|
+
const apiKeySource = target.api_key ?? target.apiKey;
|
|
4879
|
+
const deploymentSource = target.deployment ?? target.deploymentName ?? target.model;
|
|
4880
|
+
const versionSource = target.version ?? target.api_version;
|
|
4881
|
+
const temperatureSource = target.temperature;
|
|
4882
|
+
const maxTokensSource = target.max_output_tokens ?? target.maxTokens;
|
|
4853
4883
|
const resourceName = resolveString(endpointSource, env, `${target.name} endpoint`);
|
|
4854
4884
|
const apiKey = resolveString(apiKeySource, env, `${target.name} api key`);
|
|
4855
4885
|
const deploymentName = resolveString(deploymentSource, env, `${target.name} deployment`);
|
|
@@ -4861,58 +4891,61 @@ function resolveAzureConfig(target, env) {
|
|
|
4861
4891
|
maxTokensSource,
|
|
4862
4892
|
`${target.name} max output tokens`
|
|
4863
4893
|
);
|
|
4894
|
+
const retry = resolveRetryConfig(target);
|
|
4864
4895
|
return {
|
|
4865
4896
|
resourceName,
|
|
4866
4897
|
deploymentName,
|
|
4867
4898
|
apiKey,
|
|
4868
4899
|
version,
|
|
4869
4900
|
temperature,
|
|
4870
|
-
maxOutputTokens
|
|
4901
|
+
maxOutputTokens,
|
|
4902
|
+
retry
|
|
4871
4903
|
};
|
|
4872
4904
|
}
|
|
4873
4905
|
function resolveAnthropicConfig(target, env) {
|
|
4874
|
-
const
|
|
4875
|
-
const
|
|
4876
|
-
const
|
|
4877
|
-
const
|
|
4878
|
-
const
|
|
4879
|
-
const thinkingBudgetSource = settings.thinking_budget ?? settings.thinkingBudget;
|
|
4906
|
+
const apiKeySource = target.api_key ?? target.apiKey;
|
|
4907
|
+
const modelSource = target.model ?? target.deployment ?? target.variant;
|
|
4908
|
+
const temperatureSource = target.temperature;
|
|
4909
|
+
const maxTokensSource = target.max_output_tokens ?? target.maxTokens;
|
|
4910
|
+
const thinkingBudgetSource = target.thinking_budget ?? target.thinkingBudget;
|
|
4880
4911
|
const apiKey = resolveString(apiKeySource, env, `${target.name} Anthropic api key`);
|
|
4881
4912
|
const model = resolveString(modelSource, env, `${target.name} Anthropic model`);
|
|
4913
|
+
const retry = resolveRetryConfig(target);
|
|
4882
4914
|
return {
|
|
4883
4915
|
apiKey,
|
|
4884
4916
|
model,
|
|
4885
4917
|
temperature: resolveOptionalNumber(temperatureSource, `${target.name} temperature`),
|
|
4886
4918
|
maxOutputTokens: resolveOptionalNumber(maxTokensSource, `${target.name} max output tokens`),
|
|
4887
|
-
thinkingBudget: resolveOptionalNumber(thinkingBudgetSource, `${target.name} thinking budget`)
|
|
4919
|
+
thinkingBudget: resolveOptionalNumber(thinkingBudgetSource, `${target.name} thinking budget`),
|
|
4920
|
+
retry
|
|
4888
4921
|
};
|
|
4889
4922
|
}
|
|
4890
4923
|
function resolveGeminiConfig(target, env) {
|
|
4891
|
-
const
|
|
4892
|
-
const
|
|
4893
|
-
const
|
|
4894
|
-
const
|
|
4895
|
-
const maxTokensSource = settings.max_output_tokens ?? settings.maxTokens;
|
|
4924
|
+
const apiKeySource = target.api_key ?? target.apiKey;
|
|
4925
|
+
const modelSource = target.model ?? target.deployment ?? target.variant;
|
|
4926
|
+
const temperatureSource = target.temperature;
|
|
4927
|
+
const maxTokensSource = target.max_output_tokens ?? target.maxTokens;
|
|
4896
4928
|
const apiKey = resolveString(apiKeySource, env, `${target.name} Google API key`);
|
|
4897
4929
|
const model = resolveOptionalString(modelSource, env, `${target.name} Gemini model`, {
|
|
4898
4930
|
allowLiteral: true,
|
|
4899
4931
|
optionalEnv: true
|
|
4900
4932
|
}) ?? "gemini-2.5-flash";
|
|
4933
|
+
const retry = resolveRetryConfig(target);
|
|
4901
4934
|
return {
|
|
4902
4935
|
apiKey,
|
|
4903
4936
|
model,
|
|
4904
4937
|
temperature: resolveOptionalNumber(temperatureSource, `${target.name} temperature`),
|
|
4905
|
-
maxOutputTokens: resolveOptionalNumber(maxTokensSource, `${target.name} max output tokens`)
|
|
4938
|
+
maxOutputTokens: resolveOptionalNumber(maxTokensSource, `${target.name} max output tokens`),
|
|
4939
|
+
retry
|
|
4906
4940
|
};
|
|
4907
4941
|
}
|
|
4908
4942
|
function resolveCodexConfig(target, env) {
|
|
4909
|
-
const
|
|
4910
|
-
const
|
|
4911
|
-
const
|
|
4912
|
-
const
|
|
4913
|
-
const
|
|
4914
|
-
const
|
|
4915
|
-
const logFormatSource = settings.log_format ?? settings.logFormat ?? settings.log_output_format ?? settings.logOutputFormat ?? env.AGENTV_CODEX_LOG_FORMAT;
|
|
4943
|
+
const executableSource = target.executable ?? target.command ?? target.binary;
|
|
4944
|
+
const argsSource = target.args ?? target.arguments;
|
|
4945
|
+
const cwdSource = target.cwd;
|
|
4946
|
+
const timeoutSource = target.timeout_seconds ?? target.timeoutSeconds;
|
|
4947
|
+
const logDirSource = target.log_dir ?? target.logDir ?? target.log_directory ?? target.logDirectory;
|
|
4948
|
+
const logFormatSource = target.log_format ?? target.logFormat ?? target.log_output_format ?? target.logOutputFormat ?? env.AGENTV_CODEX_LOG_FORMAT;
|
|
4916
4949
|
const executable = resolveOptionalString(executableSource, env, `${target.name} codex executable`, {
|
|
4917
4950
|
allowLiteral: true,
|
|
4918
4951
|
optionalEnv: true
|
|
@@ -4951,21 +4984,19 @@ function normalizeCodexLogFormat(value) {
|
|
|
4951
4984
|
throw new Error("codex log format must be 'summary' or 'json'");
|
|
4952
4985
|
}
|
|
4953
4986
|
function resolveMockConfig(target) {
|
|
4954
|
-
const
|
|
4955
|
-
const response = typeof settings.response === "string" ? settings.response : void 0;
|
|
4987
|
+
const response = typeof target.response === "string" ? target.response : void 0;
|
|
4956
4988
|
return { response };
|
|
4957
4989
|
}
|
|
4958
4990
|
function resolveVSCodeConfig(target, env, insiders) {
|
|
4959
|
-
const
|
|
4960
|
-
const workspaceTemplateEnvVar = resolveOptionalLiteralString(settings.workspace_template ?? settings.workspaceTemplate);
|
|
4991
|
+
const workspaceTemplateEnvVar = resolveOptionalLiteralString(target.workspace_template ?? target.workspaceTemplate);
|
|
4961
4992
|
const workspaceTemplate = workspaceTemplateEnvVar ? resolveOptionalString(workspaceTemplateEnvVar, env, `${target.name} workspace template path`, {
|
|
4962
4993
|
allowLiteral: false,
|
|
4963
4994
|
optionalEnv: true
|
|
4964
4995
|
}) : void 0;
|
|
4965
|
-
const commandSource =
|
|
4966
|
-
const waitSource =
|
|
4967
|
-
const dryRunSource =
|
|
4968
|
-
const subagentRootSource =
|
|
4996
|
+
const commandSource = target.vscode_cmd ?? target.command;
|
|
4997
|
+
const waitSource = target.wait;
|
|
4998
|
+
const dryRunSource = target.dry_run ?? target.dryRun;
|
|
4999
|
+
const subagentRootSource = target.subagent_root ?? target.subagentRoot;
|
|
4969
5000
|
const defaultCommand = insiders ? "code-insiders" : "code";
|
|
4970
5001
|
const command = resolveOptionalLiteralString(commandSource) ?? defaultCommand;
|
|
4971
5002
|
return {
|
|
@@ -4980,18 +5011,16 @@ function resolveVSCodeConfig(target, env, insiders) {
|
|
|
4980
5011
|
};
|
|
4981
5012
|
}
|
|
4982
5013
|
function resolveCliConfig(target, env) {
|
|
4983
|
-
const
|
|
4984
|
-
const commandTemplateSource = settings.command_template ?? settings.commandTemplate;
|
|
5014
|
+
const commandTemplateSource = target.command_template ?? target.commandTemplate;
|
|
4985
5015
|
const filesFormat = resolveOptionalLiteralString(
|
|
4986
|
-
|
|
5016
|
+
target.files_format ?? target.filesFormat ?? target.attachments_format ?? target.attachmentsFormat
|
|
4987
5017
|
);
|
|
4988
|
-
const cwd = resolveOptionalString(
|
|
5018
|
+
const cwd = resolveOptionalString(target.cwd, env, `${target.name} working directory`, {
|
|
4989
5019
|
allowLiteral: true,
|
|
4990
5020
|
optionalEnv: true
|
|
4991
5021
|
});
|
|
4992
|
-
const
|
|
4993
|
-
const
|
|
4994
|
-
const healthcheck = resolveCliHealthcheck(settings.healthcheck, env, target.name);
|
|
5022
|
+
const timeoutMs = resolveTimeoutMs(target.timeout_seconds ?? target.timeoutSeconds, `${target.name} timeout`);
|
|
5023
|
+
const healthcheck = resolveCliHealthcheck(target.healthcheck, env, target.name);
|
|
4995
5024
|
const commandTemplate = resolveString(
|
|
4996
5025
|
commandTemplateSource,
|
|
4997
5026
|
env,
|
|
@@ -5003,29 +5032,10 @@ function resolveCliConfig(target, env) {
|
|
|
5003
5032
|
commandTemplate,
|
|
5004
5033
|
filesFormat,
|
|
5005
5034
|
cwd,
|
|
5006
|
-
env: envOverrides,
|
|
5007
5035
|
timeoutMs,
|
|
5008
5036
|
healthcheck
|
|
5009
5037
|
};
|
|
5010
5038
|
}
|
|
5011
|
-
function resolveEnvOverrides(source2, env, targetName) {
|
|
5012
|
-
if (source2 === void 0 || source2 === null) {
|
|
5013
|
-
return void 0;
|
|
5014
|
-
}
|
|
5015
|
-
if (typeof source2 !== "object" || Array.isArray(source2)) {
|
|
5016
|
-
throw new Error(`${targetName} env overrides must be an object map of strings`);
|
|
5017
|
-
}
|
|
5018
|
-
const entries = Object.entries(source2);
|
|
5019
|
-
const resolved = {};
|
|
5020
|
-
for (const [key2, value] of entries) {
|
|
5021
|
-
if (typeof value !== "string") {
|
|
5022
|
-
throw new Error(`${targetName} env override '${key2}' must be a string`);
|
|
5023
|
-
}
|
|
5024
|
-
const resolvedValue = resolveString(value, env, `${targetName} env override '${key2}'`);
|
|
5025
|
-
resolved[key2] = resolvedValue;
|
|
5026
|
-
}
|
|
5027
|
-
return Object.keys(resolved).length > 0 ? resolved : void 0;
|
|
5028
|
-
}
|
|
5029
5039
|
function resolveTimeoutMs(source2, description) {
|
|
5030
5040
|
const seconds = resolveOptionalNumber(source2, `${description} (seconds)`);
|
|
5031
5041
|
if (seconds === void 0) {
|
|
@@ -5221,6 +5231,26 @@ function resolveOptionalStringArray(source2, env, description) {
|
|
|
5221
5231
|
}
|
|
5222
5232
|
return resolved.length > 0 ? resolved : void 0;
|
|
5223
5233
|
}
|
|
5234
|
+
function resolveOptionalNumberArray(source2, description) {
|
|
5235
|
+
if (source2 === void 0 || source2 === null) {
|
|
5236
|
+
return void 0;
|
|
5237
|
+
}
|
|
5238
|
+
if (!Array.isArray(source2)) {
|
|
5239
|
+
throw new Error(`${description} must be an array of numbers`);
|
|
5240
|
+
}
|
|
5241
|
+
if (source2.length === 0) {
|
|
5242
|
+
return void 0;
|
|
5243
|
+
}
|
|
5244
|
+
const resolved = [];
|
|
5245
|
+
for (let i6 = 0; i6 < source2.length; i6++) {
|
|
5246
|
+
const item = source2[i6];
|
|
5247
|
+
if (typeof item !== "number" || !Number.isFinite(item)) {
|
|
5248
|
+
throw new Error(`${description}[${i6}] must be a number`);
|
|
5249
|
+
}
|
|
5250
|
+
resolved.push(item);
|
|
5251
|
+
}
|
|
5252
|
+
return resolved.length > 0 ? resolved : void 0;
|
|
5253
|
+
}
|
|
5224
5254
|
var AGENT_PROVIDER_KINDS = [
|
|
5225
5255
|
"codex",
|
|
5226
5256
|
"vscode",
|
|
@@ -5252,7 +5282,7 @@ var PROVIDER_ALIASES = [
|
|
|
5252
5282
|
"vertex"
|
|
5253
5283
|
// legacy/future support
|
|
5254
5284
|
];
|
|
5255
|
-
var TARGETS_SCHEMA_V2 = "agentv-targets-v2.
|
|
5285
|
+
var TARGETS_SCHEMA_V2 = "agentv-targets-v2.2";
|
|
5256
5286
|
function isAgentProvider(provider) {
|
|
5257
5287
|
return provider ? AGENT_PROVIDER_KINDS.includes(provider.kind) : false;
|
|
5258
5288
|
}
|
|
@@ -12308,6 +12338,67 @@ function ensureChatResponse(result) {
|
|
|
12308
12338
|
}
|
|
12309
12339
|
return result;
|
|
12310
12340
|
}
|
|
12341
|
+
function isRetryableError(error, retryableStatusCodes) {
|
|
12342
|
+
if (!error || typeof error !== "object") {
|
|
12343
|
+
return false;
|
|
12344
|
+
}
|
|
12345
|
+
if ("status" in error && typeof error.status === "number") {
|
|
12346
|
+
return retryableStatusCodes.includes(error.status);
|
|
12347
|
+
}
|
|
12348
|
+
if ("message" in error && typeof error.message === "string") {
|
|
12349
|
+
const match = error.message.match(/HTTP (\d{3})/);
|
|
12350
|
+
if (match) {
|
|
12351
|
+
const status = Number.parseInt(match[1], 10);
|
|
12352
|
+
return retryableStatusCodes.includes(status);
|
|
12353
|
+
}
|
|
12354
|
+
}
|
|
12355
|
+
if ("name" in error && error.name === "AxAIServiceNetworkError") {
|
|
12356
|
+
return true;
|
|
12357
|
+
}
|
|
12358
|
+
return false;
|
|
12359
|
+
}
|
|
12360
|
+
function calculateRetryDelay(attempt, config) {
|
|
12361
|
+
const delay = Math.min(
|
|
12362
|
+
config.maxDelayMs,
|
|
12363
|
+
config.initialDelayMs * config.backoffFactor ** attempt
|
|
12364
|
+
);
|
|
12365
|
+
return delay * (0.75 + Math.random() * 0.5);
|
|
12366
|
+
}
|
|
12367
|
+
async function sleep2(ms) {
|
|
12368
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
12369
|
+
}
|
|
12370
|
+
async function withRetry(fn, retryConfig, signal) {
|
|
12371
|
+
const config = {
|
|
12372
|
+
maxRetries: retryConfig?.maxRetries ?? 3,
|
|
12373
|
+
initialDelayMs: retryConfig?.initialDelayMs ?? 1e3,
|
|
12374
|
+
maxDelayMs: retryConfig?.maxDelayMs ?? 6e4,
|
|
12375
|
+
backoffFactor: retryConfig?.backoffFactor ?? 2,
|
|
12376
|
+
retryableStatusCodes: retryConfig?.retryableStatusCodes ?? [500, 408, 429, 502, 503, 504]
|
|
12377
|
+
};
|
|
12378
|
+
let lastError;
|
|
12379
|
+
for (let attempt = 0; attempt <= config.maxRetries; attempt++) {
|
|
12380
|
+
if (signal?.aborted) {
|
|
12381
|
+
throw new Error(`Request aborted: ${signal.reason ?? "Unknown reason"}`);
|
|
12382
|
+
}
|
|
12383
|
+
try {
|
|
12384
|
+
return await fn();
|
|
12385
|
+
} catch (error) {
|
|
12386
|
+
lastError = error;
|
|
12387
|
+
if (attempt >= config.maxRetries) {
|
|
12388
|
+
break;
|
|
12389
|
+
}
|
|
12390
|
+
if (!isRetryableError(error, config.retryableStatusCodes)) {
|
|
12391
|
+
throw error;
|
|
12392
|
+
}
|
|
12393
|
+
const delay = calculateRetryDelay(attempt, config);
|
|
12394
|
+
await sleep2(delay);
|
|
12395
|
+
if (signal?.aborted) {
|
|
12396
|
+
throw new Error(`Request aborted: ${signal.reason ?? "Unknown reason"}`);
|
|
12397
|
+
}
|
|
12398
|
+
}
|
|
12399
|
+
}
|
|
12400
|
+
throw lastError;
|
|
12401
|
+
}
|
|
12311
12402
|
var AzureProvider = class {
|
|
12312
12403
|
constructor(targetName, config) {
|
|
12313
12404
|
this.config = config;
|
|
@@ -12317,6 +12408,7 @@ var AzureProvider = class {
|
|
|
12317
12408
|
temperature: config.temperature,
|
|
12318
12409
|
maxOutputTokens: config.maxOutputTokens
|
|
12319
12410
|
};
|
|
12411
|
+
this.retryConfig = config.retry;
|
|
12320
12412
|
this.ai = Wn.create({
|
|
12321
12413
|
name: "azure-openai",
|
|
12322
12414
|
apiKey: config.apiKey,
|
|
@@ -12333,16 +12425,21 @@ var AzureProvider = class {
|
|
|
12333
12425
|
targetName;
|
|
12334
12426
|
ai;
|
|
12335
12427
|
defaults;
|
|
12428
|
+
retryConfig;
|
|
12336
12429
|
async invoke(request) {
|
|
12337
12430
|
const chatPrompt = buildChatPrompt(request);
|
|
12338
12431
|
const modelConfig = extractModelConfig(request, this.defaults);
|
|
12339
|
-
const response = await
|
|
12340
|
-
|
|
12341
|
-
|
|
12342
|
-
|
|
12343
|
-
|
|
12344
|
-
|
|
12345
|
-
|
|
12432
|
+
const response = await withRetry(
|
|
12433
|
+
async () => await this.ai.chat(
|
|
12434
|
+
{
|
|
12435
|
+
chatPrompt,
|
|
12436
|
+
model: this.config.deploymentName,
|
|
12437
|
+
...modelConfig ? { modelConfig } : {}
|
|
12438
|
+
},
|
|
12439
|
+
request.signal ? { abortSignal: request.signal } : void 0
|
|
12440
|
+
),
|
|
12441
|
+
this.retryConfig,
|
|
12442
|
+
request.signal
|
|
12346
12443
|
);
|
|
12347
12444
|
return mapResponse(ensureChatResponse(response));
|
|
12348
12445
|
}
|
|
@@ -12360,6 +12457,7 @@ var AnthropicProvider = class {
|
|
|
12360
12457
|
maxOutputTokens: config.maxOutputTokens,
|
|
12361
12458
|
thinkingBudget: config.thinkingBudget
|
|
12362
12459
|
};
|
|
12460
|
+
this.retryConfig = config.retry;
|
|
12363
12461
|
this.ai = Wn.create({
|
|
12364
12462
|
name: "anthropic",
|
|
12365
12463
|
apiKey: config.apiKey
|
|
@@ -12370,16 +12468,21 @@ var AnthropicProvider = class {
|
|
|
12370
12468
|
targetName;
|
|
12371
12469
|
ai;
|
|
12372
12470
|
defaults;
|
|
12471
|
+
retryConfig;
|
|
12373
12472
|
async invoke(request) {
|
|
12374
12473
|
const chatPrompt = buildChatPrompt(request);
|
|
12375
12474
|
const modelConfig = extractModelConfig(request, this.defaults);
|
|
12376
|
-
const response = await
|
|
12377
|
-
|
|
12378
|
-
|
|
12379
|
-
|
|
12380
|
-
|
|
12381
|
-
|
|
12382
|
-
|
|
12475
|
+
const response = await withRetry(
|
|
12476
|
+
async () => await this.ai.chat(
|
|
12477
|
+
{
|
|
12478
|
+
chatPrompt,
|
|
12479
|
+
model: this.config.model,
|
|
12480
|
+
...modelConfig ? { modelConfig } : {}
|
|
12481
|
+
},
|
|
12482
|
+
request.signal ? { abortSignal: request.signal } : void 0
|
|
12483
|
+
),
|
|
12484
|
+
this.retryConfig,
|
|
12485
|
+
request.signal
|
|
12383
12486
|
);
|
|
12384
12487
|
return mapResponse(ensureChatResponse(response));
|
|
12385
12488
|
}
|
|
@@ -12396,6 +12499,7 @@ var GeminiProvider = class {
|
|
|
12396
12499
|
temperature: config.temperature,
|
|
12397
12500
|
maxOutputTokens: config.maxOutputTokens
|
|
12398
12501
|
};
|
|
12502
|
+
this.retryConfig = config.retry;
|
|
12399
12503
|
this.ai = Wn.create({
|
|
12400
12504
|
name: "google-gemini",
|
|
12401
12505
|
apiKey: config.apiKey
|
|
@@ -12406,16 +12510,21 @@ var GeminiProvider = class {
|
|
|
12406
12510
|
targetName;
|
|
12407
12511
|
ai;
|
|
12408
12512
|
defaults;
|
|
12513
|
+
retryConfig;
|
|
12409
12514
|
async invoke(request) {
|
|
12410
12515
|
const chatPrompt = buildChatPrompt(request);
|
|
12411
12516
|
const modelConfig = extractModelConfig(request, this.defaults);
|
|
12412
|
-
const response = await
|
|
12413
|
-
|
|
12414
|
-
|
|
12415
|
-
|
|
12416
|
-
|
|
12417
|
-
|
|
12418
|
-
|
|
12517
|
+
const response = await withRetry(
|
|
12518
|
+
async () => await this.ai.chat(
|
|
12519
|
+
{
|
|
12520
|
+
chatPrompt,
|
|
12521
|
+
model: this.config.model,
|
|
12522
|
+
...modelConfig ? { modelConfig } : {}
|
|
12523
|
+
},
|
|
12524
|
+
request.signal ? { abortSignal: request.signal } : void 0
|
|
12525
|
+
),
|
|
12526
|
+
this.retryConfig,
|
|
12527
|
+
request.signal
|
|
12419
12528
|
);
|
|
12420
12529
|
return mapResponse(ensureChatResponse(response));
|
|
12421
12530
|
}
|
|
@@ -12478,10 +12587,9 @@ var CliProvider = class {
|
|
|
12478
12587
|
const outputFilePath = generateOutputFilePath(request.evalCaseId);
|
|
12479
12588
|
const templateValues = buildTemplateValues(request, this.config, outputFilePath);
|
|
12480
12589
|
const renderedCommand = renderTemplate(this.config.commandTemplate, templateValues);
|
|
12481
|
-
const env = this.config.env ? { ...process.env, ...this.config.env } : process.env;
|
|
12482
12590
|
const result = await this.runCommand(renderedCommand, {
|
|
12483
12591
|
cwd: this.config.cwd,
|
|
12484
|
-
env,
|
|
12592
|
+
env: process.env,
|
|
12485
12593
|
timeoutMs: this.config.timeoutMs,
|
|
12486
12594
|
signal: request.signal
|
|
12487
12595
|
});
|
|
@@ -12570,10 +12678,9 @@ var CliProvider = class {
|
|
|
12570
12678
|
generateOutputFilePath("healthcheck")
|
|
12571
12679
|
)
|
|
12572
12680
|
);
|
|
12573
|
-
const env = this.config.env ? { ...process.env, ...this.config.env } : process.env;
|
|
12574
12681
|
const result = await this.runCommand(renderedCommand, {
|
|
12575
12682
|
cwd: healthcheck.cwd ?? this.config.cwd,
|
|
12576
|
-
env,
|
|
12683
|
+
env: process.env,
|
|
12577
12684
|
timeoutMs,
|
|
12578
12685
|
signal
|
|
12579
12686
|
});
|
|
@@ -13771,20 +13878,13 @@ function assertTargetDefinition(value, index, filePath) {
|
|
|
13771
13878
|
}
|
|
13772
13879
|
const name = value.name;
|
|
13773
13880
|
const provider = value.provider;
|
|
13774
|
-
const settings = value.settings;
|
|
13775
|
-
const judgeTarget = value.judge_target;
|
|
13776
13881
|
if (typeof name !== "string" || name.trim().length === 0) {
|
|
13777
13882
|
throw new Error(`targets.yaml entry at index ${index} in ${filePath} is missing a valid 'name'`);
|
|
13778
13883
|
}
|
|
13779
13884
|
if (typeof provider !== "string" || provider.trim().length === 0) {
|
|
13780
13885
|
throw new Error(`targets.yaml entry '${name}' in ${filePath} is missing a valid 'provider'`);
|
|
13781
13886
|
}
|
|
13782
|
-
return
|
|
13783
|
-
name,
|
|
13784
|
-
provider,
|
|
13785
|
-
settings: isRecord(settings) ? settings : void 0,
|
|
13786
|
-
judge_target: typeof judgeTarget === "string" ? judgeTarget : void 0
|
|
13787
|
-
};
|
|
13887
|
+
return value;
|
|
13788
13888
|
}
|
|
13789
13889
|
async function fileExists3(filePath) {
|
|
13790
13890
|
try {
|
|
@@ -14405,10 +14505,11 @@ async function runEvaluation(options) {
|
|
|
14405
14505
|
await onProgress({
|
|
14406
14506
|
workerId,
|
|
14407
14507
|
evalId: evalCase.id,
|
|
14408
|
-
status: "completed",
|
|
14508
|
+
status: result.error ? "failed" : "completed",
|
|
14409
14509
|
startedAt: 0,
|
|
14410
14510
|
// Not used for completed status
|
|
14411
|
-
completedAt: Date.now()
|
|
14511
|
+
completedAt: Date.now(),
|
|
14512
|
+
error: result.error
|
|
14412
14513
|
});
|
|
14413
14514
|
}
|
|
14414
14515
|
if (onResult) {
|
|
@@ -14946,7 +15047,8 @@ function buildErrorResult(evalCase, targetName, timestamp, error, promptInputs,
|
|
|
14946
15047
|
target: targetName,
|
|
14947
15048
|
timestamp: timestamp.toISOString(),
|
|
14948
15049
|
raw_aspects: [],
|
|
14949
|
-
raw_request: rawRequest
|
|
15050
|
+
raw_request: rawRequest,
|
|
15051
|
+
error: message
|
|
14950
15052
|
};
|
|
14951
15053
|
}
|
|
14952
15054
|
function createCacheKey(provider, target, evalCase, promptInputs) {
|
|
@@ -15624,6 +15726,8 @@ function buildHistogram(values) {
|
|
|
15624
15726
|
function calculateEvaluationSummary(results) {
|
|
15625
15727
|
const scores = results.map((result) => result.score);
|
|
15626
15728
|
const total = results.length;
|
|
15729
|
+
const errors = results.filter((result) => result.error !== void 0).map((result) => ({ evalId: result.eval_id, error: result.error }));
|
|
15730
|
+
const errorCount = errors.length;
|
|
15627
15731
|
if (total === 0) {
|
|
15628
15732
|
return {
|
|
15629
15733
|
total: 0,
|
|
@@ -15634,7 +15738,9 @@ function calculateEvaluationSummary(results) {
|
|
|
15634
15738
|
standardDeviation: void 0,
|
|
15635
15739
|
histogram: buildHistogram([]),
|
|
15636
15740
|
topResults: [],
|
|
15637
|
-
bottomResults: []
|
|
15741
|
+
bottomResults: [],
|
|
15742
|
+
errorCount: 0,
|
|
15743
|
+
errors: []
|
|
15638
15744
|
};
|
|
15639
15745
|
}
|
|
15640
15746
|
const mean = computeMean(scores);
|
|
@@ -15655,7 +15761,9 @@ function calculateEvaluationSummary(results) {
|
|
|
15655
15761
|
standardDeviation,
|
|
15656
15762
|
histogram,
|
|
15657
15763
|
topResults,
|
|
15658
|
-
bottomResults
|
|
15764
|
+
bottomResults,
|
|
15765
|
+
errorCount,
|
|
15766
|
+
errors
|
|
15659
15767
|
};
|
|
15660
15768
|
}
|
|
15661
15769
|
function formatScore(value) {
|
|
@@ -15666,10 +15774,25 @@ function formatEvaluationSummary(summary) {
|
|
|
15666
15774
|
return "\nNo results to summarize";
|
|
15667
15775
|
}
|
|
15668
15776
|
const lines = [];
|
|
15777
|
+
if (summary.errorCount > 0) {
|
|
15778
|
+
lines.push("\n==================================================");
|
|
15779
|
+
lines.push("ERRORS");
|
|
15780
|
+
lines.push("==================================================");
|
|
15781
|
+
summary.errors.forEach((error) => {
|
|
15782
|
+
lines.push(`
|
|
15783
|
+
\u274C ${error.evalId}`);
|
|
15784
|
+
lines.push(` ${error.error}`);
|
|
15785
|
+
});
|
|
15786
|
+
lines.push("");
|
|
15787
|
+
}
|
|
15669
15788
|
lines.push("\n==================================================");
|
|
15670
15789
|
lines.push("EVALUATION SUMMARY");
|
|
15671
15790
|
lines.push("==================================================");
|
|
15672
15791
|
lines.push(`Total eval cases: ${summary.total}`);
|
|
15792
|
+
if (summary.errorCount > 0) {
|
|
15793
|
+
lines.push(`Failed: ${summary.errorCount}`);
|
|
15794
|
+
lines.push(`Passed: ${summary.total - summary.errorCount}`);
|
|
15795
|
+
}
|
|
15673
15796
|
lines.push(`Mean score: ${formatScore(summary.mean)}`);
|
|
15674
15797
|
lines.push(`Median score: ${formatScore(summary.median)}`);
|
|
15675
15798
|
lines.push(`Min score: ${formatScore(summary.min)}`);
|
|
@@ -15708,7 +15831,7 @@ import { readFile as readFile5 } from "node:fs/promises";
|
|
|
15708
15831
|
import path33 from "node:path";
|
|
15709
15832
|
import { parse as parse5 } from "yaml";
|
|
15710
15833
|
var SCHEMA_EVAL_V22 = "agentv-eval-v2";
|
|
15711
|
-
var SCHEMA_TARGETS_V2 = "agentv-targets-v2.
|
|
15834
|
+
var SCHEMA_TARGETS_V2 = "agentv-targets-v2.2";
|
|
15712
15835
|
var SCHEMA_CONFIG_V22 = "agentv-config-v2";
|
|
15713
15836
|
async function detectFileType(filePath) {
|
|
15714
15837
|
try {
|
|
@@ -15935,8 +16058,21 @@ var COMMON_SETTINGS = /* @__PURE__ */ new Set([
|
|
|
15935
16058
|
"provider_batching",
|
|
15936
16059
|
"providerBatching"
|
|
15937
16060
|
]);
|
|
16061
|
+
var RETRY_SETTINGS = /* @__PURE__ */ new Set([
|
|
16062
|
+
"max_retries",
|
|
16063
|
+
"maxRetries",
|
|
16064
|
+
"retry_initial_delay_ms",
|
|
16065
|
+
"retryInitialDelayMs",
|
|
16066
|
+
"retry_max_delay_ms",
|
|
16067
|
+
"retryMaxDelayMs",
|
|
16068
|
+
"retry_backoff_factor",
|
|
16069
|
+
"retryBackoffFactor",
|
|
16070
|
+
"retry_status_codes",
|
|
16071
|
+
"retryStatusCodes"
|
|
16072
|
+
]);
|
|
15938
16073
|
var AZURE_SETTINGS = /* @__PURE__ */ new Set([
|
|
15939
16074
|
...COMMON_SETTINGS,
|
|
16075
|
+
...RETRY_SETTINGS,
|
|
15940
16076
|
"endpoint",
|
|
15941
16077
|
"resource",
|
|
15942
16078
|
"resourceName",
|
|
@@ -15953,6 +16089,7 @@ var AZURE_SETTINGS = /* @__PURE__ */ new Set([
|
|
|
15953
16089
|
]);
|
|
15954
16090
|
var ANTHROPIC_SETTINGS = /* @__PURE__ */ new Set([
|
|
15955
16091
|
...COMMON_SETTINGS,
|
|
16092
|
+
...RETRY_SETTINGS,
|
|
15956
16093
|
"api_key",
|
|
15957
16094
|
"apiKey",
|
|
15958
16095
|
"model",
|
|
@@ -15966,6 +16103,7 @@ var ANTHROPIC_SETTINGS = /* @__PURE__ */ new Set([
|
|
|
15966
16103
|
]);
|
|
15967
16104
|
var GEMINI_SETTINGS = /* @__PURE__ */ new Set([
|
|
15968
16105
|
...COMMON_SETTINGS,
|
|
16106
|
+
...RETRY_SETTINGS,
|
|
15969
16107
|
"api_key",
|
|
15970
16108
|
"apiKey",
|
|
15971
16109
|
"model",
|
|
@@ -16053,13 +16191,14 @@ function getKnownSettings(provider) {
|
|
|
16053
16191
|
return null;
|
|
16054
16192
|
}
|
|
16055
16193
|
}
|
|
16056
|
-
function validateUnknownSettings(
|
|
16194
|
+
function validateUnknownSettings(target, provider, absolutePath, location, errors) {
|
|
16057
16195
|
const knownSettings = getKnownSettings(provider);
|
|
16058
16196
|
if (!knownSettings) {
|
|
16059
16197
|
return;
|
|
16060
16198
|
}
|
|
16061
|
-
|
|
16062
|
-
|
|
16199
|
+
const baseFields = /* @__PURE__ */ new Set(["name", "provider", "judge_target", "workers", "$schema", "targets"]);
|
|
16200
|
+
for (const key2 of Object.keys(target)) {
|
|
16201
|
+
if (!baseFields.has(key2) && !knownSettings.has(key2)) {
|
|
16063
16202
|
errors.push({
|
|
16064
16203
|
severity: "warning",
|
|
16065
16204
|
filePath: absolutePath,
|
|
@@ -16089,17 +16228,8 @@ async function validateTargetsFile(filePath) {
|
|
|
16089
16228
|
errors
|
|
16090
16229
|
};
|
|
16091
16230
|
}
|
|
16092
|
-
function validateCliSettings(
|
|
16093
|
-
|
|
16094
|
-
errors2.push({
|
|
16095
|
-
severity: "error",
|
|
16096
|
-
filePath: absolutePath2,
|
|
16097
|
-
location,
|
|
16098
|
-
message: "CLI provider requires a 'settings' object"
|
|
16099
|
-
});
|
|
16100
|
-
return;
|
|
16101
|
-
}
|
|
16102
|
-
const commandTemplate = settings["command_template"] ?? settings["commandTemplate"];
|
|
16231
|
+
function validateCliSettings(target, absolutePath2, location, errors2) {
|
|
16232
|
+
const commandTemplate = target["command_template"] ?? target["commandTemplate"];
|
|
16103
16233
|
if (typeof commandTemplate !== "string" || commandTemplate.trim().length === 0) {
|
|
16104
16234
|
errors2.push({
|
|
16105
16235
|
severity: "error",
|
|
@@ -16110,7 +16240,7 @@ async function validateTargetsFile(filePath) {
|
|
|
16110
16240
|
} else {
|
|
16111
16241
|
recordUnknownPlaceholders(commandTemplate, absolutePath2, `${location}.commandTemplate`, errors2);
|
|
16112
16242
|
}
|
|
16113
|
-
const attachmentsFormat =
|
|
16243
|
+
const attachmentsFormat = target["attachments_format"] ?? target["attachmentsFormat"];
|
|
16114
16244
|
if (attachmentsFormat !== void 0 && typeof attachmentsFormat !== "string") {
|
|
16115
16245
|
errors2.push({
|
|
16116
16246
|
severity: "error",
|
|
@@ -16119,7 +16249,7 @@ async function validateTargetsFile(filePath) {
|
|
|
16119
16249
|
message: "'attachmentsFormat' must be a string when provided"
|
|
16120
16250
|
});
|
|
16121
16251
|
}
|
|
16122
|
-
const filesFormat =
|
|
16252
|
+
const filesFormat = target["files_format"] ?? target["filesFormat"];
|
|
16123
16253
|
if (filesFormat !== void 0 && typeof filesFormat !== "string") {
|
|
16124
16254
|
errors2.push({
|
|
16125
16255
|
severity: "error",
|
|
@@ -16128,7 +16258,7 @@ async function validateTargetsFile(filePath) {
|
|
|
16128
16258
|
message: "'filesFormat' must be a string when provided"
|
|
16129
16259
|
});
|
|
16130
16260
|
}
|
|
16131
|
-
const cwd =
|
|
16261
|
+
const cwd = target["cwd"];
|
|
16132
16262
|
if (cwd !== void 0 && typeof cwd !== "string") {
|
|
16133
16263
|
errors2.push({
|
|
16134
16264
|
severity: "error",
|
|
@@ -16137,7 +16267,7 @@ async function validateTargetsFile(filePath) {
|
|
|
16137
16267
|
message: "'cwd' must be a string when provided"
|
|
16138
16268
|
});
|
|
16139
16269
|
}
|
|
16140
|
-
const timeoutSeconds =
|
|
16270
|
+
const timeoutSeconds = target["timeout_seconds"] ?? target["timeoutSeconds"];
|
|
16141
16271
|
if (timeoutSeconds !== void 0) {
|
|
16142
16272
|
const numericTimeout = Number(timeoutSeconds);
|
|
16143
16273
|
if (!Number.isFinite(numericTimeout) || numericTimeout <= 0) {
|
|
@@ -16149,29 +16279,7 @@ async function validateTargetsFile(filePath) {
|
|
|
16149
16279
|
});
|
|
16150
16280
|
}
|
|
16151
16281
|
}
|
|
16152
|
-
const
|
|
16153
|
-
if (envOverrides !== void 0) {
|
|
16154
|
-
if (!isObject2(envOverrides)) {
|
|
16155
|
-
errors2.push({
|
|
16156
|
-
severity: "error",
|
|
16157
|
-
filePath: absolutePath2,
|
|
16158
|
-
location: `${location}.env`,
|
|
16159
|
-
message: "'env' must be an object with string values"
|
|
16160
|
-
});
|
|
16161
|
-
} else {
|
|
16162
|
-
for (const [key2, value] of Object.entries(envOverrides)) {
|
|
16163
|
-
if (typeof value !== "string" || value.trim().length === 0) {
|
|
16164
|
-
errors2.push({
|
|
16165
|
-
severity: "error",
|
|
16166
|
-
filePath: absolutePath2,
|
|
16167
|
-
location: `${location}.env.${key2}`,
|
|
16168
|
-
message: `Environment override '${key2}' must be a non-empty string`
|
|
16169
|
-
});
|
|
16170
|
-
}
|
|
16171
|
-
}
|
|
16172
|
-
}
|
|
16173
|
-
}
|
|
16174
|
-
const healthcheck = settings["healthcheck"];
|
|
16282
|
+
const healthcheck = target["healthcheck"];
|
|
16175
16283
|
if (healthcheck !== void 0) {
|
|
16176
16284
|
validateCliHealthcheck(healthcheck, absolutePath2, `${location}.healthcheck`, errors2);
|
|
16177
16285
|
}
|
|
@@ -16342,20 +16450,11 @@ async function validateTargetsFile(filePath) {
|
|
|
16342
16450
|
message: `Unknown provider '${provider}'. Known providers: ${knownProviders.join(", ")}`
|
|
16343
16451
|
});
|
|
16344
16452
|
}
|
|
16345
|
-
const settings = target["settings"];
|
|
16346
|
-
if (providerValue !== "cli" && settings !== void 0 && !isObject2(settings)) {
|
|
16347
|
-
errors.push({
|
|
16348
|
-
severity: "error",
|
|
16349
|
-
filePath: absolutePath,
|
|
16350
|
-
location: `${location}.settings`,
|
|
16351
|
-
message: "Invalid 'settings' field (must be an object)"
|
|
16352
|
-
});
|
|
16353
|
-
}
|
|
16354
16453
|
if (providerValue === "cli") {
|
|
16355
|
-
validateCliSettings(
|
|
16454
|
+
validateCliSettings(target, absolutePath, location, errors);
|
|
16356
16455
|
}
|
|
16357
|
-
if (
|
|
16358
|
-
validateUnknownSettings(
|
|
16456
|
+
if (typeof provider === "string") {
|
|
16457
|
+
validateUnknownSettings(target, provider, absolutePath, location, errors);
|
|
16359
16458
|
}
|
|
16360
16459
|
const judgeTarget = target["judge_target"];
|
|
16361
16460
|
if (judgeTarget !== void 0 && typeof judgeTarget !== "string") {
|
|
@@ -17566,4 +17665,4 @@ export {
|
|
|
17566
17665
|
createProgram,
|
|
17567
17666
|
runCli
|
|
17568
17667
|
};
|
|
17569
|
-
//# sourceMappingURL=chunk-
|
|
17668
|
+
//# sourceMappingURL=chunk-X2VVUCIB.js.map
|