agentv 5.3.1-next.1 → 5.3.2-next.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/README.md +52 -44
- package/dist/{artifact-writer-7NBCOAYC.js → artifact-writer-KJEOROKQ.js} +5 -5
- package/dist/{chunk-ELCJ23K4.js → chunk-6262OKXM.js} +2856 -2404
- package/dist/chunk-6262OKXM.js.map +1 -0
- package/dist/chunk-AQ5BIAXF.js +604 -0
- package/dist/chunk-AQ5BIAXF.js.map +1 -0
- package/dist/chunk-BV5VQLI2.js +2 -0
- package/dist/{chunk-LXBI3SPX.js → chunk-JGSRUJZQ.js} +46 -20
- package/dist/chunk-JGSRUJZQ.js.map +1 -0
- package/dist/chunk-MMDLXYBX.js +721 -0
- package/dist/chunk-MMDLXYBX.js.map +1 -0
- package/dist/{chunk-LKGARI3W.js → chunk-QSK3PC44.js} +812 -570
- package/dist/chunk-QSK3PC44.js.map +1 -0
- package/dist/chunk-TEEXVJWM.js +2 -0
- package/dist/{chunk-RKE7SSET.js → chunk-WIAJ7JAV.js} +186 -64
- package/dist/chunk-WIAJ7JAV.js.map +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +17517 -10
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +2 -0
- package/dist/config.js +14 -0
- package/dist/config.js.map +1 -0
- package/dist/contracts-DsZmZLl8.d.ts +742 -0
- package/dist/contracts.d.ts +2 -0
- package/dist/contracts.js +28 -0
- package/dist/contracts.js.map +1 -0
- package/dist/dashboard/assets/{index-CbEMiJSb.js → index-BfqOlLOF.js} +1 -1
- package/dist/dashboard/assets/index-Bh8lpGce.css +1 -0
- package/dist/dashboard/assets/index-oPR3ywQb.js +121 -0
- package/dist/dashboard/index.html +2 -2
- package/dist/{dist-NMXMI5SK.js → dist-A3SGR7TW.js} +16 -16
- package/dist/dist-A3SGR7TW.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +137 -18
- package/dist/{interactive-BN527UV3.js → interactive-DL7N2C7K.js} +24 -24
- package/dist/interactive-DL7N2C7K.js.map +1 -0
- package/dist/provider.d.ts +2 -0
- package/dist/provider.js +24 -0
- package/dist/provider.js.map +1 -0
- package/dist/sdk.d.ts +802 -0
- package/dist/sdk.js +145 -0
- package/dist/sdk.js.map +1 -0
- package/dist/skills/agentv-eval-migrations/references/breaking-changes.md +17 -18
- package/dist/skills/agentv-eval-writer/SKILL.md +27 -15
- package/dist/skills/agentv-eval-writer/references/custom-evaluators.md +5 -5
- package/dist/skills/agentv-eval-writer/references/eval.schema.json +5402 -4639
- package/dist/skills/agentv-eval-writer/references/python-helpers.md +2 -2
- package/dist/skills/agentv-eval-writer/references/rubric-evaluator.md +19 -2
- package/dist/templates/.agentv/providers.yaml +42 -0
- package/dist/templates/.env.example +2 -2
- package/dist/{ts-eval-loader-2RFVZHCT-7CZ3DCDD.js → ts-eval-loader-3G5GEAEC-6F52JLPP.js} +3 -3
- package/dist/ts-eval-loader-3G5GEAEC-6F52JLPP.js.map +1 -0
- package/package.json +29 -4
- package/dist/chunk-ASIGJIOJ.js +0 -17993
- package/dist/chunk-ASIGJIOJ.js.map +0 -1
- package/dist/chunk-ELCJ23K4.js.map +0 -1
- package/dist/chunk-LKGARI3W.js.map +0 -1
- package/dist/chunk-LXBI3SPX.js.map +0 -1
- package/dist/chunk-RKE7SSET.js.map +0 -1
- package/dist/dashboard/assets/index-DTA6-l7q.js +0 -121
- package/dist/dashboard/assets/index-D_bokML8.css +0 -1
- package/dist/interactive-BN527UV3.js.map +0 -1
- package/dist/templates/.agentv/targets.yaml +0 -97
- /package/dist/{artifact-writer-7NBCOAYC.js.map → artifact-writer-KJEOROKQ.js.map} +0 -0
- /package/dist/{dist-NMXMI5SK.js.map → chunk-BV5VQLI2.js.map} +0 -0
- /package/dist/{ts-eval-loader-2RFVZHCT-7CZ3DCDD.js.map → chunk-TEEXVJWM.js.map} +0 -0
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
toSnakeCaseDeep,
|
|
7
7
|
writeArtifactsFromResults,
|
|
8
8
|
writePerTestArtifacts
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-6262OKXM.js";
|
|
10
10
|
|
|
11
11
|
// src/commands/eval/artifact-writer.ts
|
|
12
12
|
import path2 from "node:path";
|
|
@@ -18,13 +18,15 @@ import path from "node:path";
|
|
|
18
18
|
import { stringify as stringifyYaml } from "yaml";
|
|
19
19
|
var TEST_BUNDLE_DIRNAME = "test";
|
|
20
20
|
var TASK_EVAL_FILENAME = "EVAL.yaml";
|
|
21
|
-
var
|
|
21
|
+
var TASK_PROVIDERS_FILENAME = "providers.yaml";
|
|
22
22
|
var TASK_FILES_DIRNAME = "files";
|
|
23
23
|
var TASK_GRADERS_DIRNAME = "graders";
|
|
24
24
|
var INPUT_PROMPT = "{{ input }}";
|
|
25
25
|
var BUNDLE_EVALS_DIRNAME = "evals";
|
|
26
26
|
var BUNDLE_MANIFEST_FILENAME = "agentv_bundle.json";
|
|
27
|
-
var
|
|
27
|
+
var BUNDLE_PROVIDERS_FILENAME = "providers.yaml";
|
|
28
|
+
var BUNDLE_CONFIG_DIRNAME = ".agentv";
|
|
29
|
+
var BUNDLE_CONFIG_FILENAME = "config.yaml";
|
|
28
30
|
var BUNDLE_WORKSPACES_DIRNAME = "workspaces";
|
|
29
31
|
var BUNDLE_SCRIPTS_DIRNAME = "scripts";
|
|
30
32
|
var REDACTED_SOURCE_VALUE = "[redacted]";
|
|
@@ -44,17 +46,20 @@ var SKIPPED_DIR_NAMES = /* @__PURE__ */ new Set([
|
|
|
44
46
|
var AUTHORING_TOP_LEVEL_TARGET_FIELDS = /* @__PURE__ */ new Set([
|
|
45
47
|
"label",
|
|
46
48
|
"provider",
|
|
49
|
+
"provider_spec",
|
|
50
|
+
"environment",
|
|
47
51
|
"prompts",
|
|
48
52
|
"transform",
|
|
49
53
|
"delay",
|
|
50
54
|
"env",
|
|
51
55
|
"model",
|
|
56
|
+
"runtime",
|
|
57
|
+
"hooks",
|
|
52
58
|
"use_target",
|
|
53
59
|
"fallback_targets",
|
|
54
60
|
"grader_target",
|
|
55
61
|
"max_budget_usd",
|
|
56
62
|
"workers",
|
|
57
|
-
"batch_requests",
|
|
58
63
|
"subagent_mode_allowed",
|
|
59
64
|
"max_retries",
|
|
60
65
|
"retry_initial_delay_ms",
|
|
@@ -420,7 +425,7 @@ function targetReferenceNames(target) {
|
|
|
420
425
|
}
|
|
421
426
|
return references;
|
|
422
427
|
}
|
|
423
|
-
function selectTargetDefinitions(
|
|
428
|
+
function selectTargetDefinitions(providerLabel, definitions) {
|
|
424
429
|
const byName = new Map(definitions.map((definition) => [definition.name, definition]));
|
|
425
430
|
const selected = [];
|
|
426
431
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -438,7 +443,7 @@ function selectTargetDefinitions(targetName, definitions) {
|
|
|
438
443
|
visit(referenceName);
|
|
439
444
|
}
|
|
440
445
|
}
|
|
441
|
-
visit(
|
|
446
|
+
visit(providerLabel);
|
|
442
447
|
return selected;
|
|
443
448
|
}
|
|
444
449
|
async function writeYamlFile(filePath, value) {
|
|
@@ -457,11 +462,62 @@ function bundledEvalFileName(evalFilePath) {
|
|
|
457
462
|
const safeName = withoutKnownExtension.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
458
463
|
return `${safeName || "bundle"}.eval.yaml`;
|
|
459
464
|
}
|
|
460
|
-
function uniqueTargetDefinitions(selections) {
|
|
465
|
+
function uniqueTargetDefinitions(selections, tests = []) {
|
|
461
466
|
const selected = [];
|
|
462
467
|
const seen = /* @__PURE__ */ new Set();
|
|
468
|
+
function addDefinitions(names, definitions) {
|
|
469
|
+
for (const name of names) {
|
|
470
|
+
for (const definition of selectTargetDefinitions(name, definitions)) {
|
|
471
|
+
if (seen.has(definition.name)) {
|
|
472
|
+
continue;
|
|
473
|
+
}
|
|
474
|
+
seen.add(definition.name);
|
|
475
|
+
selected.push(definition);
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
const graderTargetNames = collectGraderTargetNames(tests);
|
|
463
480
|
for (const selection of selections) {
|
|
464
|
-
|
|
481
|
+
addDefinitions([selection.providerLabel, ...graderTargetNames], selection.definitions);
|
|
482
|
+
}
|
|
483
|
+
return selected;
|
|
484
|
+
}
|
|
485
|
+
function collectGraderTargetNames(tests) {
|
|
486
|
+
const names = [];
|
|
487
|
+
const seen = /* @__PURE__ */ new Set();
|
|
488
|
+
function collect(value, key) {
|
|
489
|
+
if (key === "target" && typeof value === "string") {
|
|
490
|
+
const target = value.trim();
|
|
491
|
+
if (target.length > 0 && !target.includes("${{") && !seen.has(target)) {
|
|
492
|
+
seen.add(target);
|
|
493
|
+
names.push(target);
|
|
494
|
+
}
|
|
495
|
+
return;
|
|
496
|
+
}
|
|
497
|
+
if (Array.isArray(value)) {
|
|
498
|
+
for (const item of value) {
|
|
499
|
+
collect(item);
|
|
500
|
+
}
|
|
501
|
+
return;
|
|
502
|
+
}
|
|
503
|
+
if (isRecord(value)) {
|
|
504
|
+
for (const [childKey, childValue] of Object.entries(value)) {
|
|
505
|
+
collect(childValue, childKey);
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
for (const test of tests) {
|
|
510
|
+
for (const grader of test.source?.graderDefinitions ?? []) {
|
|
511
|
+
collect(grader.definition);
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
return names;
|
|
515
|
+
}
|
|
516
|
+
function selectTaskBundleTargetDefinitions(providerLabel, definitions, tests) {
|
|
517
|
+
const selected = [];
|
|
518
|
+
const seen = /* @__PURE__ */ new Set();
|
|
519
|
+
for (const name of [providerLabel, ...collectGraderTargetNames(tests)]) {
|
|
520
|
+
for (const definition of selectTargetDefinitions(name, definitions)) {
|
|
465
521
|
if (seen.has(definition.name)) {
|
|
466
522
|
continue;
|
|
467
523
|
}
|
|
@@ -471,18 +527,24 @@ function uniqueTargetDefinitions(selections) {
|
|
|
471
527
|
}
|
|
472
528
|
return selected;
|
|
473
529
|
}
|
|
474
|
-
function serializeTargetDefinition(definition) {
|
|
475
|
-
const
|
|
476
|
-
|
|
477
|
-
|
|
530
|
+
function serializeTargetDefinition(definition, rewrites) {
|
|
531
|
+
const providerSpec = typeof definition.provider_spec === "string" && definition.provider_spec.trim().length > 0 ? definition.provider_spec.trim() : typeof definition.provider === "string" && definition.provider.trim().length > 0 ? definition.provider.trim() : typeof definition.id === "string" && definition.id.trim().length > 0 ? definition.id.trim() : definition.name;
|
|
532
|
+
const provider = { id: providerSpec };
|
|
533
|
+
if (definition.name !== providerSpec) {
|
|
534
|
+
provider.label = definition.name;
|
|
478
535
|
}
|
|
479
536
|
const config = {};
|
|
480
537
|
for (const [key, value] of Object.entries(definition)) {
|
|
481
|
-
if (value === void 0 || key === "name" || key === "id" || key === "label" || key === "config") {
|
|
538
|
+
if (value === void 0 || key === "name" || key === "id" || key === "provider" || key === "provider_spec" || key === "label" || key === "config") {
|
|
482
539
|
continue;
|
|
483
540
|
}
|
|
484
|
-
if (
|
|
485
|
-
|
|
541
|
+
if (key === "environment" && definition.environment) {
|
|
542
|
+
provider.environment = serializeEnvironment(
|
|
543
|
+
definition.environment,
|
|
544
|
+
rewrites
|
|
545
|
+
);
|
|
546
|
+
} else if (AUTHORING_TOP_LEVEL_TARGET_FIELDS.has(key)) {
|
|
547
|
+
provider[key] = value;
|
|
486
548
|
} else {
|
|
487
549
|
config[key] = value;
|
|
488
550
|
}
|
|
@@ -495,22 +557,22 @@ function serializeTargetDefinition(definition) {
|
|
|
495
557
|
}
|
|
496
558
|
}
|
|
497
559
|
if (Object.keys(config).length > 0) {
|
|
498
|
-
|
|
560
|
+
provider.config = config;
|
|
499
561
|
}
|
|
500
|
-
return
|
|
562
|
+
return provider;
|
|
501
563
|
}
|
|
502
|
-
function serializeTargetDefinitions(definitions) {
|
|
503
|
-
return definitions.map((definition) => serializeTargetDefinition(definition));
|
|
564
|
+
function serializeTargetDefinitions(definitions, rewrites = /* @__PURE__ */ new Map()) {
|
|
565
|
+
return definitions.map((definition) => serializeTargetDefinition(definition, rewrites));
|
|
504
566
|
}
|
|
505
567
|
function uniqueTargetNames(selections) {
|
|
506
568
|
const names = [];
|
|
507
569
|
const seen = /* @__PURE__ */ new Set();
|
|
508
570
|
for (const selection of selections) {
|
|
509
|
-
if (seen.has(selection.
|
|
571
|
+
if (seen.has(selection.providerLabel)) {
|
|
510
572
|
continue;
|
|
511
573
|
}
|
|
512
|
-
seen.add(selection.
|
|
513
|
-
names.push(selection.
|
|
574
|
+
seen.add(selection.providerLabel);
|
|
575
|
+
names.push(selection.providerLabel);
|
|
514
576
|
}
|
|
515
577
|
return names;
|
|
516
578
|
}
|
|
@@ -710,6 +772,45 @@ async function collectEnvironmentReferences(tests, evalFileDir) {
|
|
|
710
772
|
}
|
|
711
773
|
return references;
|
|
712
774
|
}
|
|
775
|
+
async function collectProviderEnvironmentReferences(definitions, evalFileDir) {
|
|
776
|
+
const references = [];
|
|
777
|
+
for (const definition of definitions) {
|
|
778
|
+
const environment = definition.environment;
|
|
779
|
+
if (!environment) {
|
|
780
|
+
continue;
|
|
781
|
+
}
|
|
782
|
+
const label = `provider "${definition.name}"`;
|
|
783
|
+
if (environment.type === "host") {
|
|
784
|
+
references.push({
|
|
785
|
+
kind: "environment_workdir",
|
|
786
|
+
displayPath: environment.workdir,
|
|
787
|
+
resolvedPath: environment.workdir,
|
|
788
|
+
location: `${label}.environment.workdir`
|
|
789
|
+
});
|
|
790
|
+
}
|
|
791
|
+
const command = environment.setup?.command;
|
|
792
|
+
if (!command) {
|
|
793
|
+
continue;
|
|
794
|
+
}
|
|
795
|
+
const baseDir = environmentBaseDir(environment, evalFileDir);
|
|
796
|
+
for (const arg of command) {
|
|
797
|
+
const reference = await maybeWorkspaceHookCommandReference({
|
|
798
|
+
arg,
|
|
799
|
+
baseDir,
|
|
800
|
+
testId: definition.name,
|
|
801
|
+
hookName: "setup"
|
|
802
|
+
});
|
|
803
|
+
if (reference) {
|
|
804
|
+
references.push({
|
|
805
|
+
...reference,
|
|
806
|
+
kind: "environment_setup_command",
|
|
807
|
+
location: `${label}.environment.setup.command`
|
|
808
|
+
});
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
return references;
|
|
813
|
+
}
|
|
713
814
|
async function collectWorkspaceReferences(tests, evalFileDir) {
|
|
714
815
|
const references = [];
|
|
715
816
|
const errors = [];
|
|
@@ -793,7 +894,7 @@ function bundleManifest(options) {
|
|
|
793
894
|
created_at: options.createdAt,
|
|
794
895
|
source_eval: options.evalFilePath,
|
|
795
896
|
eval_path: relative(options.evalPath),
|
|
796
|
-
|
|
897
|
+
providers_path: relative(options.providersPath),
|
|
797
898
|
test_count: options.tests.length,
|
|
798
899
|
targets: options.targetNames,
|
|
799
900
|
...hasCopiedBucket(options.copiedReferences, "files") ? { files_path: "evals/files" } : {},
|
|
@@ -806,27 +907,41 @@ async function materializeTaskBundle(options) {
|
|
|
806
907
|
if (!options.test.source) {
|
|
807
908
|
return void 0;
|
|
808
909
|
}
|
|
809
|
-
const
|
|
810
|
-
|
|
910
|
+
const providerDefinitions = selectTaskBundleTargetDefinitions(
|
|
911
|
+
options.providerLabel,
|
|
912
|
+
options.providerDefinitions,
|
|
913
|
+
[options.test]
|
|
914
|
+
);
|
|
915
|
+
if (providerDefinitions.length === 0) {
|
|
811
916
|
return void 0;
|
|
812
917
|
}
|
|
813
918
|
const testDir = path.join(options.outputDir, TEST_BUNDLE_DIRNAME);
|
|
814
919
|
await mkdir(testDir, { recursive: true });
|
|
815
|
-
const
|
|
920
|
+
const providerEnvironmentReferences = await collectProviderEnvironmentReferences(
|
|
921
|
+
providerDefinitions,
|
|
922
|
+
path.dirname(options.test.source.evalFileAbsolutePath ?? options.test.source.evalFilePath)
|
|
923
|
+
);
|
|
924
|
+
const copiedReferences = await copyReferences(
|
|
925
|
+
[...options.test.source.references, ...providerEnvironmentReferences],
|
|
926
|
+
testDir,
|
|
927
|
+
options
|
|
928
|
+
);
|
|
816
929
|
const rewrites = buildPathRewrites(copiedReferences);
|
|
817
930
|
const evalCase = buildEvalCase(options.test, rewrites);
|
|
818
931
|
const evalPath = path.join(testDir, TASK_EVAL_FILENAME);
|
|
819
|
-
const
|
|
932
|
+
const providersPath = path.join(testDir, TASK_PROVIDERS_FILENAME);
|
|
820
933
|
await writeYamlFile(evalPath, {
|
|
821
|
-
|
|
934
|
+
providers: [options.providerLabel],
|
|
822
935
|
prompts: [INPUT_PROMPT],
|
|
823
936
|
tests: [evalCase]
|
|
824
937
|
});
|
|
825
|
-
await writeYamlFile(
|
|
938
|
+
await writeYamlFile(providersPath, {
|
|
939
|
+
providers: serializeTargetDefinitions(providerDefinitions, rewrites)
|
|
940
|
+
});
|
|
826
941
|
return {
|
|
827
942
|
testDir,
|
|
828
943
|
evalPath,
|
|
829
|
-
|
|
944
|
+
providersPath,
|
|
830
945
|
...hasCopiedBucket(copiedReferences, "files") ? { filesPath: path.join(testDir, TASK_FILES_DIRNAME) } : {},
|
|
831
946
|
...hasCopiedBucket(copiedReferences, "graders") ? { gradersPath: path.join(testDir, TASK_GRADERS_DIRNAME) } : {}
|
|
832
947
|
};
|
|
@@ -835,7 +950,7 @@ async function materializeEvalBundle(options) {
|
|
|
835
950
|
if (options.tests.length === 0) {
|
|
836
951
|
throw new Error("Cannot bundle eval with no runnable tests.");
|
|
837
952
|
}
|
|
838
|
-
if (options.
|
|
953
|
+
if (options.providerSelections.length === 0) {
|
|
839
954
|
throw new Error("Cannot bundle eval without a selected target.");
|
|
840
955
|
}
|
|
841
956
|
const missingSource = options.tests.find((test) => !test.source);
|
|
@@ -848,12 +963,18 @@ async function materializeEvalBundle(options) {
|
|
|
848
963
|
const evalsDir = path.join(outputDir, BUNDLE_EVALS_DIRNAME);
|
|
849
964
|
await mkdir(evalsDir, { recursive: true });
|
|
850
965
|
const evalFileDir = path.dirname(path.resolve(options.evalFilePath));
|
|
966
|
+
const providerDefinitions = uniqueTargetDefinitions(options.providerSelections, options.tests);
|
|
851
967
|
const workspaceReferences = await collectWorkspaceReferences(options.tests, evalFileDir);
|
|
852
968
|
const environmentReferences = await collectEnvironmentReferences(options.tests, evalFileDir);
|
|
969
|
+
const providerEnvironmentReferences = await collectProviderEnvironmentReferences(
|
|
970
|
+
providerDefinitions,
|
|
971
|
+
evalFileDir
|
|
972
|
+
);
|
|
853
973
|
const references = [
|
|
854
974
|
...options.tests.flatMap((test) => test.source?.references ?? []),
|
|
855
975
|
...collectExpectedOutputReferences(options.tests),
|
|
856
976
|
...environmentReferences,
|
|
977
|
+
...providerEnvironmentReferences,
|
|
857
978
|
...workspaceReferences.references
|
|
858
979
|
];
|
|
859
980
|
const { copied, failures } = await copyReferencesStrict(references, evalsDir, options);
|
|
@@ -863,24 +984,25 @@ async function materializeEvalBundle(options) {
|
|
|
863
984
|
${errors.map((error) => `- ${error}`).join("\n")}`);
|
|
864
985
|
}
|
|
865
986
|
const rewrites = buildPathRewrites(copied);
|
|
866
|
-
const targetNames = uniqueTargetNames(options.
|
|
987
|
+
const targetNames = uniqueTargetNames(options.providerSelections);
|
|
867
988
|
const evalPath = path.join(evalsDir, bundledEvalFileName(options.evalFilePath));
|
|
868
|
-
const
|
|
989
|
+
const providersPath = path.join(outputDir, BUNDLE_PROVIDERS_FILENAME);
|
|
990
|
+
const configPath = path.join(outputDir, BUNDLE_CONFIG_DIRNAME, BUNDLE_CONFIG_FILENAME);
|
|
869
991
|
const manifestPath = path.join(outputDir, BUNDLE_MANIFEST_FILENAME);
|
|
870
|
-
const runtime = options.runtime ?? (targetNames.length
|
|
992
|
+
const runtime = options.runtime ?? (targetNames.length > 0 ? { providers: targetNames } : void 0);
|
|
871
993
|
await writeYamlFile(evalPath, {
|
|
872
994
|
...runtime ?? {},
|
|
873
995
|
prompts: [INPUT_PROMPT],
|
|
874
996
|
tests: options.tests.map((test) => buildPortableEvalCase(test, rewrites))
|
|
875
997
|
});
|
|
876
|
-
await writeYamlFile(
|
|
877
|
-
|
|
878
|
-
});
|
|
998
|
+
await writeYamlFile(providersPath, serializeTargetDefinitions(providerDefinitions, rewrites));
|
|
999
|
+
await mkdir(path.dirname(configPath), { recursive: true });
|
|
1000
|
+
await writeYamlFile(configPath, { providers: `file://../${BUNDLE_PROVIDERS_FILENAME}` });
|
|
879
1001
|
const manifest = bundleManifest({
|
|
880
1002
|
outputDir,
|
|
881
1003
|
evalFilePath: path.resolve(options.evalFilePath),
|
|
882
1004
|
evalPath,
|
|
883
|
-
|
|
1005
|
+
providersPath,
|
|
884
1006
|
copiedReferences: copied,
|
|
885
1007
|
tests: options.tests,
|
|
886
1008
|
targetNames,
|
|
@@ -892,7 +1014,7 @@ ${errors.map((error) => `- ${error}`).join("\n")}`);
|
|
|
892
1014
|
bundleDir: outputDir,
|
|
893
1015
|
evalsDir,
|
|
894
1016
|
evalPath,
|
|
895
|
-
|
|
1017
|
+
providersPath,
|
|
896
1018
|
manifestPath,
|
|
897
1019
|
...hasCopiedBucket(copied, "files") ? { filesPath: path.join(evalsDir, TASK_FILES_DIRNAME) } : {},
|
|
898
1020
|
...hasCopiedBucket(copied, "graders") ? { gradersPath: path.join(evalsDir, TASK_GRADERS_DIRNAME) } : {},
|
|
@@ -912,7 +1034,7 @@ function buildTaskBundleIndexFields(outputDir, taskBundle) {
|
|
|
912
1034
|
return {
|
|
913
1035
|
test_dir: toRelativeArtifactPath(outputDir, taskBundle.testDir),
|
|
914
1036
|
eval_path: toRelativeArtifactPath(outputDir, taskBundle.evalPath),
|
|
915
|
-
|
|
1037
|
+
providers_path: toRelativeArtifactPath(outputDir, taskBundle.providersPath),
|
|
916
1038
|
...taskBundle.filesPath ? { files_path: toRelativeArtifactPath(outputDir, taskBundle.filesPath) } : {},
|
|
917
1039
|
...taskBundle.gradersPath ? { graders_path: toRelativeArtifactPath(outputDir, taskBundle.gradersPath) } : {}
|
|
918
1040
|
};
|
|
@@ -928,56 +1050,56 @@ function buildResultIndexArtifact2(result, taskBundle) {
|
|
|
928
1050
|
const extraIndexFields = taskBundle ? {
|
|
929
1051
|
test_dir: path2.posix.join(artifactSubdir, "test"),
|
|
930
1052
|
eval_path: path2.posix.join(artifactSubdir, "test", "EVAL.yaml"),
|
|
931
|
-
|
|
1053
|
+
providers_path: path2.posix.join(artifactSubdir, "test", "providers.yaml"),
|
|
932
1054
|
...taskBundle.filesPath ? { files_path: path2.posix.join(artifactSubdir, "test", "files") } : {},
|
|
933
1055
|
...taskBundle.gradersPath ? { graders_path: path2.posix.join(artifactSubdir, "test", "graders") } : {}
|
|
934
1056
|
} : void 0;
|
|
935
1057
|
return buildResultIndexArtifact(result, extraIndexFields);
|
|
936
1058
|
}
|
|
937
|
-
function
|
|
938
|
-
return `${evalFileAbsolutePath ? path2.resolve(evalFileAbsolutePath) : ""}::${
|
|
1059
|
+
function providerSelectionKey(evalFileAbsolutePath, providerLabel) {
|
|
1060
|
+
return `${evalFileAbsolutePath ? path2.resolve(evalFileAbsolutePath) : ""}::${providerLabel}`;
|
|
939
1061
|
}
|
|
940
|
-
function
|
|
941
|
-
const
|
|
1062
|
+
function buildProviderSelectionMap(selections) {
|
|
1063
|
+
const providers = /* @__PURE__ */ new Map();
|
|
942
1064
|
for (const selection of selections ?? []) {
|
|
943
|
-
|
|
944
|
-
|
|
1065
|
+
providers.set(
|
|
1066
|
+
providerSelectionKey(selection.evalFileAbsolutePath, selection.providerLabel),
|
|
945
1067
|
selection
|
|
946
1068
|
);
|
|
947
|
-
if (selection.
|
|
948
|
-
|
|
949
|
-
|
|
1069
|
+
if (selection.resolvedProviderName) {
|
|
1070
|
+
providers.set(
|
|
1071
|
+
providerSelectionKey(selection.evalFileAbsolutePath, selection.resolvedProviderName),
|
|
950
1072
|
selection
|
|
951
1073
|
);
|
|
952
1074
|
}
|
|
953
1075
|
if (!selection.evalFileAbsolutePath) {
|
|
954
|
-
|
|
955
|
-
if (selection.
|
|
956
|
-
|
|
1076
|
+
providers.set(providerSelectionKey(void 0, selection.providerLabel), selection);
|
|
1077
|
+
if (selection.resolvedProviderName) {
|
|
1078
|
+
providers.set(providerSelectionKey(void 0, selection.resolvedProviderName), selection);
|
|
957
1079
|
}
|
|
958
1080
|
}
|
|
959
1081
|
}
|
|
960
|
-
return
|
|
1082
|
+
return providers;
|
|
961
1083
|
}
|
|
962
|
-
function
|
|
963
|
-
const
|
|
1084
|
+
function findProviderSelection(result, test, providers) {
|
|
1085
|
+
const providerLabel = result.target ?? "unknown";
|
|
964
1086
|
const evalFileAbsolutePath = test?.source?.evalFileAbsolutePath;
|
|
965
|
-
return
|
|
1087
|
+
return providers.get(providerSelectionKey(evalFileAbsolutePath, providerLabel)) ?? providers.get(providerSelectionKey(void 0, providerLabel));
|
|
966
1088
|
}
|
|
967
1089
|
function createTaskBundleArtifactsWriter(options) {
|
|
968
|
-
const
|
|
969
|
-
if (
|
|
1090
|
+
const providerSelections = buildProviderSelectionMap(options?.taskBundleTargets);
|
|
1091
|
+
if (providerSelections.size === 0) {
|
|
970
1092
|
return void 0;
|
|
971
1093
|
}
|
|
972
1094
|
return async ({ outputDir, result, sourceTest, testDir }) => {
|
|
973
|
-
const
|
|
974
|
-
if (!sourceTest || !
|
|
1095
|
+
const providerSelection = findProviderSelection(result, sourceTest, providerSelections);
|
|
1096
|
+
if (!sourceTest || !providerSelection) {
|
|
975
1097
|
return void 0;
|
|
976
1098
|
}
|
|
977
1099
|
const taskBundle = await materializeTaskBundle({
|
|
978
1100
|
test: sourceTest,
|
|
979
|
-
|
|
980
|
-
|
|
1101
|
+
providerLabel: providerSelection.providerLabel,
|
|
1102
|
+
providerDefinitions: providerSelection.definitions,
|
|
981
1103
|
outputDir: testDir,
|
|
982
1104
|
cwd: options?.cwd,
|
|
983
1105
|
repoRoot: options?.repoRoot
|
|
@@ -1020,4 +1142,4 @@ export {
|
|
|
1020
1142
|
writePerTestArtifacts2 as writePerTestArtifacts,
|
|
1021
1143
|
writeArtifactsFromResults2 as writeArtifactsFromResults
|
|
1022
1144
|
};
|
|
1023
|
-
//# sourceMappingURL=chunk-
|
|
1145
|
+
//# sourceMappingURL=chunk-WIAJ7JAV.js.map
|