@plune-ai/cli 0.39.16 → 0.40.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 +47 -5
- package/dist/cli.cjs +3754 -1252
- package/dist/{execute-DLNnhkEM.d.cts → execute-CD55D0di.d.cts} +6 -0
- package/dist/{execute-DLNnhkEM.d.ts → execute-CD55D0di.d.ts} +6 -0
- package/dist/index.cjs +1737 -269
- package/dist/index.d.cts +168 -6
- package/dist/index.d.ts +168 -6
- package/dist/index.js +1736 -268
- package/dist/mcp-http.cjs +4 -4
- package/dist/mcp-http.d.cts +1 -1
- package/dist/mcp-http.d.ts +1 -1
- package/dist/mcp-http.js +4 -4
- package/dist/mcp-tools.cjs +4 -4
- package/dist/mcp-tools.d.cts +1 -1
- package/dist/mcp-tools.d.ts +1 -1
- package/dist/mcp-tools.js +4 -4
- package/dist/reporter-core.cjs +28 -5
- package/dist/reporter-core.d.cts +1 -1
- package/dist/reporter-core.d.ts +1 -1
- package/dist/reporter-core.js +28 -5
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -26,8 +26,16 @@ interface CacheSummary {
|
|
|
26
26
|
from_cache: number;
|
|
27
27
|
from_model: number;
|
|
28
28
|
missed: number;
|
|
29
|
-
/**
|
|
29
|
+
/**
|
|
30
|
+
* Rows the provider failed on: answered by neither, so the four counts add up to `total` (dry-run rows and
|
|
31
|
+
* `stubbed` rows aside).
|
|
32
|
+
*/
|
|
30
33
|
errored: number;
|
|
34
|
+
/**
|
|
35
|
+
* Rows of evals with `stubs`: answered by the stub server, or errored there. They are in none of the four
|
|
36
|
+
* counts above. Optional and additive: written only when there are such rows.
|
|
37
|
+
*/
|
|
38
|
+
stubbed?: number;
|
|
31
39
|
saved: {
|
|
32
40
|
input_tokens: number;
|
|
33
41
|
output_tokens: number;
|
|
@@ -112,6 +120,11 @@ interface RowResult {
|
|
|
112
120
|
vars: Record<string, unknown>;
|
|
113
121
|
output: string | null;
|
|
114
122
|
cached: boolean;
|
|
123
|
+
/**
|
|
124
|
+
* `true` on a row of an eval with `stubs`: its answer, if it has one, came from the stub server and not from
|
|
125
|
+
* a model, and the model call in its `usage` costs 0. Optional and additive.
|
|
126
|
+
*/
|
|
127
|
+
stubbed?: boolean;
|
|
115
128
|
usage?: Usage;
|
|
116
129
|
latency_ms?: number;
|
|
117
130
|
error?: RunError;
|
|
@@ -251,6 +264,18 @@ interface EvalResult {
|
|
|
251
264
|
type: string;
|
|
252
265
|
model: string;
|
|
253
266
|
};
|
|
267
|
+
/**
|
|
268
|
+
* Only on an eval with `stubs` that ran. `never_called`: the places in the stub file (from 0) of the stubs
|
|
269
|
+
* no request of this eval reached. `unmatched`: one entry per request no stub answered, with the scope it
|
|
270
|
+
* was sent in (`<eval id>.row<n>`, and `.run<k>` with repeats) and its method. Optional and additive.
|
|
271
|
+
*/
|
|
272
|
+
stubs?: {
|
|
273
|
+
never_called: number[];
|
|
274
|
+
unmatched: {
|
|
275
|
+
scope: string;
|
|
276
|
+
method: string;
|
|
277
|
+
}[];
|
|
278
|
+
};
|
|
254
279
|
}
|
|
255
280
|
interface RunResult {
|
|
256
281
|
schemaVersion: 1;
|
|
@@ -317,6 +342,15 @@ interface JsonSchemaAssertion {
|
|
|
317
342
|
schema: object;
|
|
318
343
|
extract?: 'auto' | 'strict';
|
|
319
344
|
}
|
|
345
|
+
/** The answer's JSON against an expected JSON value; the rules of `expected` are in src/json-verify. */
|
|
346
|
+
interface JsonVerifyAssertion {
|
|
347
|
+
type: 'json-verify';
|
|
348
|
+
/** Any JSON value. A string in it may be a check (`@isString()`), an object a `$mode` or `$literal` marker. */
|
|
349
|
+
expected: unknown;
|
|
350
|
+
/** Default `exact`. */
|
|
351
|
+
mode?: 'exact' | 'unordered' | 'contains';
|
|
352
|
+
extract?: 'auto' | 'strict';
|
|
353
|
+
}
|
|
320
354
|
/**
|
|
321
355
|
* The experimental Jev judge of an `llm-judge` check. A decision model, not a text model: it cannot be an eval's
|
|
322
356
|
* provider, takes none of the eval provider's fields, and its model is always named.
|
|
@@ -428,7 +462,7 @@ interface NoDestructiveToolAssertion {
|
|
|
428
462
|
type: 'no-destructive-tool';
|
|
429
463
|
}
|
|
430
464
|
type ToolCallAssertion = ToolCalledAssertion | ToolNotCalledAssertion | ToolArgsAssertion | ToolOrderAssertion | OnlyToolsAssertion | FirstToolAssertion | NoToolErrorsAssertion | ToolCallCountAssertion | NoRepeatedCallAssertion | TokenBudgetAssertion | ToolLatencyAssertion | ToolResultSizeAssertion | ToolResultSchemaAssertion | NoDestructiveToolAssertion;
|
|
431
|
-
type AssertionConfig = ExactMatchAssertion | ContainsAssertion | ContainsAnyAssertion | ContainsAllAssertion | JsonSchemaAssertion | LlmJudgeAssertion | SemanticSimilarityAssertion | FaithfulnessAssertion | AnswerRelevanceAssertion | ContextPrecisionAssertion | ToolCallAssertion;
|
|
465
|
+
type AssertionConfig = ExactMatchAssertion | ContainsAssertion | ContainsAnyAssertion | ContainsAllAssertion | JsonSchemaAssertion | JsonVerifyAssertion | LlmJudgeAssertion | SemanticSimilarityAssertion | FaithfulnessAssertion | AnswerRelevanceAssertion | ContextPrecisionAssertion | ToolCallAssertion;
|
|
432
466
|
interface EvalConfig {
|
|
433
467
|
id: string;
|
|
434
468
|
description?: string;
|
|
@@ -444,6 +478,11 @@ interface EvalConfig {
|
|
|
444
478
|
pass_threshold?: number;
|
|
445
479
|
/** The MCP server this eval's model may use, from the root `mcp.servers`. */
|
|
446
480
|
mcp?: EvalMcpConfig;
|
|
481
|
+
/**
|
|
482
|
+
* A stub file, relative to the folder of the config: during the run a local server answers this eval's
|
|
483
|
+
* model calls from it, in place of the provider. Not with `mcp`.
|
|
484
|
+
*/
|
|
485
|
+
stubs?: string;
|
|
447
486
|
}
|
|
448
487
|
/** Every limit is a whole number above 0; one left out takes its default (`MCP_LIMIT_DEFAULTS`). */
|
|
449
488
|
interface McpLimits {
|
|
@@ -671,12 +710,108 @@ interface AgentServer {
|
|
|
671
710
|
/** Opens a session with the server named in `mcp.servers`; a failure rejects with a message already masked. */
|
|
672
711
|
type AgentConnect = (server: string, timeoutMs: number) => Promise<AgentServer>;
|
|
673
712
|
|
|
713
|
+
declare const stubSchema: z.ZodObject<{
|
|
714
|
+
method: z.ZodPipe<z.ZodDefault<z.ZodString>, z.ZodTransform<string, string>>;
|
|
715
|
+
path: z.ZodString;
|
|
716
|
+
body: z.ZodOptional<z.ZodUnknown>;
|
|
717
|
+
match: z.ZodOptional<z.ZodEnum<{
|
|
718
|
+
exact: "exact";
|
|
719
|
+
subset: "subset";
|
|
720
|
+
}>>;
|
|
721
|
+
times: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<"always">, z.ZodLiteral<"once">, z.ZodNumber]>>;
|
|
722
|
+
response: z.ZodOptional<z.ZodObject<{
|
|
723
|
+
status: z.ZodDefault<z.ZodNumber>;
|
|
724
|
+
headers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
725
|
+
json: z.ZodOptional<z.ZodUnknown>;
|
|
726
|
+
text: z.ZodOptional<z.ZodString>;
|
|
727
|
+
sse: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
728
|
+
event: z.ZodOptional<z.ZodString>;
|
|
729
|
+
data: z.ZodUnknown;
|
|
730
|
+
}, z.core.$strict>]>>>;
|
|
731
|
+
}, z.core.$strict>>;
|
|
732
|
+
failure: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
733
|
+
type: z.ZodLiteral<"timeout">;
|
|
734
|
+
first: z.ZodOptional<z.ZodNumber>;
|
|
735
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
736
|
+
type: z.ZodLiteral<"reset">;
|
|
737
|
+
first: z.ZodOptional<z.ZodNumber>;
|
|
738
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
739
|
+
type: z.ZodLiteral<"http_429">;
|
|
740
|
+
first: z.ZodOptional<z.ZodNumber>;
|
|
741
|
+
retry_after_seconds: z.ZodDefault<z.ZodNumber>;
|
|
742
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
743
|
+
type: z.ZodLiteral<"http_500">;
|
|
744
|
+
first: z.ZodOptional<z.ZodNumber>;
|
|
745
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
746
|
+
type: z.ZodLiteral<"slow_stream">;
|
|
747
|
+
first: z.ZodOptional<z.ZodNumber>;
|
|
748
|
+
bytes_per_sec: z.ZodNumber;
|
|
749
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
750
|
+
type: z.ZodLiteral<"truncated_json">;
|
|
751
|
+
first: z.ZodOptional<z.ZodNumber>;
|
|
752
|
+
content_length: z.ZodDefault<z.ZodEnum<{
|
|
753
|
+
full: "full";
|
|
754
|
+
cut: "cut";
|
|
755
|
+
}>>;
|
|
756
|
+
}, z.core.$strict>], "type">>;
|
|
757
|
+
}, z.core.$strict>;
|
|
758
|
+
type Stub = z.output<typeof stubSchema>;
|
|
759
|
+
type StubInput = z.input<typeof stubSchema>;
|
|
760
|
+
|
|
761
|
+
interface JournalEntry {
|
|
762
|
+
scope: string;
|
|
763
|
+
method: string;
|
|
764
|
+
/** Without the scope segment and without the query string. */
|
|
765
|
+
path: string;
|
|
766
|
+
/** Without the leading `?`; values of secret-looking parameters are masked. */
|
|
767
|
+
query: string;
|
|
768
|
+
/** Lower-case names; values of secret-looking headers are masked. */
|
|
769
|
+
headers: Record<string, string>;
|
|
770
|
+
/** The first `journalBodyCap` bytes. */
|
|
771
|
+
body: string;
|
|
772
|
+
bodyTruncated: boolean;
|
|
773
|
+
/** Whether a stub answered. */
|
|
774
|
+
matched: boolean;
|
|
775
|
+
}
|
|
776
|
+
interface MockScope {
|
|
777
|
+
readonly name: string;
|
|
778
|
+
/** `<server.url>/<name>`: what a provider SDK's base URL starts with. */
|
|
779
|
+
readonly url: string;
|
|
780
|
+
/** The newest `JOURNAL_MAX_ENTRIES` requests that named this scope, in arrival order. */
|
|
781
|
+
readonly journal: readonly JournalEntry[];
|
|
782
|
+
/** How many older entries the journal has let go. */
|
|
783
|
+
readonly dropped: number;
|
|
784
|
+
add(...stubs: StubInput[]): void;
|
|
785
|
+
/**
|
|
786
|
+
* Removes the scope and its stubs, ends the requests it still holds (a `timeout`, a `slow_stream`) by
|
|
787
|
+
* destroying their sockets, and returns the stubs that were never called.
|
|
788
|
+
*/
|
|
789
|
+
close(): Stub[];
|
|
790
|
+
}
|
|
791
|
+
interface MockServer {
|
|
792
|
+
readonly url: string;
|
|
793
|
+
readonly port: number;
|
|
794
|
+
/** The newest `JOURNAL_MAX_ENTRIES` requests whose target named no open scope or was refused. */
|
|
795
|
+
readonly unrouted: readonly JournalEntry[];
|
|
796
|
+
/** How many older entries `unrouted` has let go. */
|
|
797
|
+
readonly unroutedDropped: number;
|
|
798
|
+
/** Throws on a name that is taken or cannot be a path segment, and once the server is closed. */
|
|
799
|
+
scope(name: string, stubs?: StubInput[]): MockScope;
|
|
800
|
+
/** Always resolves, destroys open sockets, safe to call twice. */
|
|
801
|
+
close(): Promise<void>;
|
|
802
|
+
}
|
|
803
|
+
|
|
674
804
|
interface RowParams {
|
|
675
805
|
template: string;
|
|
676
806
|
assertions: AssertionConfig[];
|
|
677
807
|
row: DatasetRow;
|
|
678
808
|
providerConfig: ProviderConfig;
|
|
679
809
|
provider: Provider;
|
|
810
|
+
/**
|
|
811
|
+
* The provider a judge asks where `provider` is not the one to ask: on an eval with stubs `provider` is
|
|
812
|
+
* pointed at the stub server, and a judge call is not the eval's own call.
|
|
813
|
+
*/
|
|
814
|
+
judgeProvider?: Provider;
|
|
680
815
|
embedder: Embedder;
|
|
681
816
|
cache: Cache;
|
|
682
817
|
now: () => number;
|
|
@@ -707,7 +842,13 @@ interface RowParams {
|
|
|
707
842
|
};
|
|
708
843
|
}
|
|
709
844
|
interface RunDeps {
|
|
710
|
-
|
|
845
|
+
/** With `stubOrigin` (a scope of the stub server), the provider's client is pointed there, not at the provider. */
|
|
846
|
+
resolveProvider(cfg: ProviderConfig, stubOrigin?: string): Provider;
|
|
847
|
+
/**
|
|
848
|
+
* The stub server of the run, started on the first call and the same one on every call after it; whoever
|
|
849
|
+
* gives it closes it. Called only when a row of an eval with `stubs` runs, so never on a dry run.
|
|
850
|
+
*/
|
|
851
|
+
stubServer?: () => Promise<MockServer>;
|
|
711
852
|
embedder: Embedder;
|
|
712
853
|
cache: Cache;
|
|
713
854
|
now: () => number;
|
|
@@ -744,7 +885,7 @@ declare class NotLoggedInError extends Error {
|
|
|
744
885
|
}
|
|
745
886
|
/** The token was present but the server rejected it (401 — revoked or invalid). (exit 2) */
|
|
746
887
|
declare class TokenRejectedError extends Error {
|
|
747
|
-
constructor();
|
|
888
|
+
constructor(apiUrl?: string);
|
|
748
889
|
}
|
|
749
890
|
/** No run to sync, or the run file is unreadable / not a valid RunResult. (exit 2) */
|
|
750
891
|
declare class SyncFileError extends Error {
|
|
@@ -764,7 +905,7 @@ interface SyncDeps {
|
|
|
764
905
|
cwd?: string;
|
|
765
906
|
/** Explicit run JSON to sync instead of `<cwd>/.plune/last-run.json`. */
|
|
766
907
|
file?: string;
|
|
767
|
-
/** Override the API base URL. Falls back to `PLUNE_API_URL`, then the
|
|
908
|
+
/** Override the API base URL. Falls back to `PLUNE_API_URL`, then the production default. */
|
|
768
909
|
apiUrl?: string;
|
|
769
910
|
/** Token source (injected in tests). Defaults to the real credentials store. */
|
|
770
911
|
loadToken?: () => string | null;
|
|
@@ -825,6 +966,18 @@ declare const assertionConfigSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
825
966
|
strict: "strict";
|
|
826
967
|
}>>;
|
|
827
968
|
}, z.core.$strip>, z.ZodObject<{
|
|
969
|
+
type: z.ZodLiteral<"json-verify">;
|
|
970
|
+
expected: z.ZodOptional<z.ZodAny>;
|
|
971
|
+
mode: z.ZodOptional<z.ZodEnum<{
|
|
972
|
+
exact: "exact";
|
|
973
|
+
unordered: "unordered";
|
|
974
|
+
contains: "contains";
|
|
975
|
+
}>>;
|
|
976
|
+
extract: z.ZodOptional<z.ZodEnum<{
|
|
977
|
+
auto: "auto";
|
|
978
|
+
strict: "strict";
|
|
979
|
+
}>>;
|
|
980
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
828
981
|
type: z.ZodLiteral<"llm-judge">;
|
|
829
982
|
criteria: z.ZodString;
|
|
830
983
|
provider: z.ZodOptional<z.ZodPipe<z.ZodAny, z.ZodTransform<{
|
|
@@ -871,8 +1024,8 @@ declare const assertionConfigSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
871
1024
|
tool: z.ZodString;
|
|
872
1025
|
args: z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>]>;
|
|
873
1026
|
match: z.ZodOptional<z.ZodEnum<{
|
|
874
|
-
partial: "partial";
|
|
875
1027
|
exact: "exact";
|
|
1028
|
+
partial: "partial";
|
|
876
1029
|
ignore: "ignore";
|
|
877
1030
|
}>>;
|
|
878
1031
|
min_count: z.ZodOptional<z.ZodNumber>;
|
|
@@ -974,6 +1127,7 @@ declare const runResultSchema: z.ZodObject<{
|
|
|
974
1127
|
from_model: z.ZodNumber;
|
|
975
1128
|
missed: z.ZodNumber;
|
|
976
1129
|
errored: z.ZodNumber;
|
|
1130
|
+
stubbed: z.ZodOptional<z.ZodNumber>;
|
|
977
1131
|
saved: z.ZodObject<{
|
|
978
1132
|
input_tokens: z.ZodNumber;
|
|
979
1133
|
output_tokens: z.ZodNumber;
|
|
@@ -988,6 +1142,7 @@ declare const runResultSchema: z.ZodObject<{
|
|
|
988
1142
|
vars: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
989
1143
|
output: z.ZodNullable<z.ZodString>;
|
|
990
1144
|
cached: z.ZodBoolean;
|
|
1145
|
+
stubbed: z.ZodOptional<z.ZodBoolean>;
|
|
991
1146
|
usage: z.ZodOptional<z.ZodObject<{
|
|
992
1147
|
input_tokens: z.ZodNumber;
|
|
993
1148
|
output_tokens: z.ZodNumber;
|
|
@@ -1143,6 +1298,13 @@ declare const runResultSchema: z.ZodObject<{
|
|
|
1143
1298
|
type: z.ZodString;
|
|
1144
1299
|
model: z.ZodString;
|
|
1145
1300
|
}, z.core.$strip>>;
|
|
1301
|
+
stubs: z.ZodOptional<z.ZodObject<{
|
|
1302
|
+
never_called: z.ZodArray<z.ZodNumber>;
|
|
1303
|
+
unmatched: z.ZodArray<z.ZodObject<{
|
|
1304
|
+
scope: z.ZodString;
|
|
1305
|
+
method: z.ZodString;
|
|
1306
|
+
}, z.core.$strip>>;
|
|
1307
|
+
}, z.core.$strip>>;
|
|
1146
1308
|
traceUrl: z.ZodOptional<z.ZodString>;
|
|
1147
1309
|
}, z.core.$strip>>;
|
|
1148
1310
|
}, z.core.$strip>;
|
package/dist/index.d.ts
CHANGED
|
@@ -26,8 +26,16 @@ interface CacheSummary {
|
|
|
26
26
|
from_cache: number;
|
|
27
27
|
from_model: number;
|
|
28
28
|
missed: number;
|
|
29
|
-
/**
|
|
29
|
+
/**
|
|
30
|
+
* Rows the provider failed on: answered by neither, so the four counts add up to `total` (dry-run rows and
|
|
31
|
+
* `stubbed` rows aside).
|
|
32
|
+
*/
|
|
30
33
|
errored: number;
|
|
34
|
+
/**
|
|
35
|
+
* Rows of evals with `stubs`: answered by the stub server, or errored there. They are in none of the four
|
|
36
|
+
* counts above. Optional and additive: written only when there are such rows.
|
|
37
|
+
*/
|
|
38
|
+
stubbed?: number;
|
|
31
39
|
saved: {
|
|
32
40
|
input_tokens: number;
|
|
33
41
|
output_tokens: number;
|
|
@@ -112,6 +120,11 @@ interface RowResult {
|
|
|
112
120
|
vars: Record<string, unknown>;
|
|
113
121
|
output: string | null;
|
|
114
122
|
cached: boolean;
|
|
123
|
+
/**
|
|
124
|
+
* `true` on a row of an eval with `stubs`: its answer, if it has one, came from the stub server and not from
|
|
125
|
+
* a model, and the model call in its `usage` costs 0. Optional and additive.
|
|
126
|
+
*/
|
|
127
|
+
stubbed?: boolean;
|
|
115
128
|
usage?: Usage;
|
|
116
129
|
latency_ms?: number;
|
|
117
130
|
error?: RunError;
|
|
@@ -251,6 +264,18 @@ interface EvalResult {
|
|
|
251
264
|
type: string;
|
|
252
265
|
model: string;
|
|
253
266
|
};
|
|
267
|
+
/**
|
|
268
|
+
* Only on an eval with `stubs` that ran. `never_called`: the places in the stub file (from 0) of the stubs
|
|
269
|
+
* no request of this eval reached. `unmatched`: one entry per request no stub answered, with the scope it
|
|
270
|
+
* was sent in (`<eval id>.row<n>`, and `.run<k>` with repeats) and its method. Optional and additive.
|
|
271
|
+
*/
|
|
272
|
+
stubs?: {
|
|
273
|
+
never_called: number[];
|
|
274
|
+
unmatched: {
|
|
275
|
+
scope: string;
|
|
276
|
+
method: string;
|
|
277
|
+
}[];
|
|
278
|
+
};
|
|
254
279
|
}
|
|
255
280
|
interface RunResult {
|
|
256
281
|
schemaVersion: 1;
|
|
@@ -317,6 +342,15 @@ interface JsonSchemaAssertion {
|
|
|
317
342
|
schema: object;
|
|
318
343
|
extract?: 'auto' | 'strict';
|
|
319
344
|
}
|
|
345
|
+
/** The answer's JSON against an expected JSON value; the rules of `expected` are in src/json-verify. */
|
|
346
|
+
interface JsonVerifyAssertion {
|
|
347
|
+
type: 'json-verify';
|
|
348
|
+
/** Any JSON value. A string in it may be a check (`@isString()`), an object a `$mode` or `$literal` marker. */
|
|
349
|
+
expected: unknown;
|
|
350
|
+
/** Default `exact`. */
|
|
351
|
+
mode?: 'exact' | 'unordered' | 'contains';
|
|
352
|
+
extract?: 'auto' | 'strict';
|
|
353
|
+
}
|
|
320
354
|
/**
|
|
321
355
|
* The experimental Jev judge of an `llm-judge` check. A decision model, not a text model: it cannot be an eval's
|
|
322
356
|
* provider, takes none of the eval provider's fields, and its model is always named.
|
|
@@ -428,7 +462,7 @@ interface NoDestructiveToolAssertion {
|
|
|
428
462
|
type: 'no-destructive-tool';
|
|
429
463
|
}
|
|
430
464
|
type ToolCallAssertion = ToolCalledAssertion | ToolNotCalledAssertion | ToolArgsAssertion | ToolOrderAssertion | OnlyToolsAssertion | FirstToolAssertion | NoToolErrorsAssertion | ToolCallCountAssertion | NoRepeatedCallAssertion | TokenBudgetAssertion | ToolLatencyAssertion | ToolResultSizeAssertion | ToolResultSchemaAssertion | NoDestructiveToolAssertion;
|
|
431
|
-
type AssertionConfig = ExactMatchAssertion | ContainsAssertion | ContainsAnyAssertion | ContainsAllAssertion | JsonSchemaAssertion | LlmJudgeAssertion | SemanticSimilarityAssertion | FaithfulnessAssertion | AnswerRelevanceAssertion | ContextPrecisionAssertion | ToolCallAssertion;
|
|
465
|
+
type AssertionConfig = ExactMatchAssertion | ContainsAssertion | ContainsAnyAssertion | ContainsAllAssertion | JsonSchemaAssertion | JsonVerifyAssertion | LlmJudgeAssertion | SemanticSimilarityAssertion | FaithfulnessAssertion | AnswerRelevanceAssertion | ContextPrecisionAssertion | ToolCallAssertion;
|
|
432
466
|
interface EvalConfig {
|
|
433
467
|
id: string;
|
|
434
468
|
description?: string;
|
|
@@ -444,6 +478,11 @@ interface EvalConfig {
|
|
|
444
478
|
pass_threshold?: number;
|
|
445
479
|
/** The MCP server this eval's model may use, from the root `mcp.servers`. */
|
|
446
480
|
mcp?: EvalMcpConfig;
|
|
481
|
+
/**
|
|
482
|
+
* A stub file, relative to the folder of the config: during the run a local server answers this eval's
|
|
483
|
+
* model calls from it, in place of the provider. Not with `mcp`.
|
|
484
|
+
*/
|
|
485
|
+
stubs?: string;
|
|
447
486
|
}
|
|
448
487
|
/** Every limit is a whole number above 0; one left out takes its default (`MCP_LIMIT_DEFAULTS`). */
|
|
449
488
|
interface McpLimits {
|
|
@@ -671,12 +710,108 @@ interface AgentServer {
|
|
|
671
710
|
/** Opens a session with the server named in `mcp.servers`; a failure rejects with a message already masked. */
|
|
672
711
|
type AgentConnect = (server: string, timeoutMs: number) => Promise<AgentServer>;
|
|
673
712
|
|
|
713
|
+
declare const stubSchema: z.ZodObject<{
|
|
714
|
+
method: z.ZodPipe<z.ZodDefault<z.ZodString>, z.ZodTransform<string, string>>;
|
|
715
|
+
path: z.ZodString;
|
|
716
|
+
body: z.ZodOptional<z.ZodUnknown>;
|
|
717
|
+
match: z.ZodOptional<z.ZodEnum<{
|
|
718
|
+
exact: "exact";
|
|
719
|
+
subset: "subset";
|
|
720
|
+
}>>;
|
|
721
|
+
times: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<"always">, z.ZodLiteral<"once">, z.ZodNumber]>>;
|
|
722
|
+
response: z.ZodOptional<z.ZodObject<{
|
|
723
|
+
status: z.ZodDefault<z.ZodNumber>;
|
|
724
|
+
headers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
725
|
+
json: z.ZodOptional<z.ZodUnknown>;
|
|
726
|
+
text: z.ZodOptional<z.ZodString>;
|
|
727
|
+
sse: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
728
|
+
event: z.ZodOptional<z.ZodString>;
|
|
729
|
+
data: z.ZodUnknown;
|
|
730
|
+
}, z.core.$strict>]>>>;
|
|
731
|
+
}, z.core.$strict>>;
|
|
732
|
+
failure: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
733
|
+
type: z.ZodLiteral<"timeout">;
|
|
734
|
+
first: z.ZodOptional<z.ZodNumber>;
|
|
735
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
736
|
+
type: z.ZodLiteral<"reset">;
|
|
737
|
+
first: z.ZodOptional<z.ZodNumber>;
|
|
738
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
739
|
+
type: z.ZodLiteral<"http_429">;
|
|
740
|
+
first: z.ZodOptional<z.ZodNumber>;
|
|
741
|
+
retry_after_seconds: z.ZodDefault<z.ZodNumber>;
|
|
742
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
743
|
+
type: z.ZodLiteral<"http_500">;
|
|
744
|
+
first: z.ZodOptional<z.ZodNumber>;
|
|
745
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
746
|
+
type: z.ZodLiteral<"slow_stream">;
|
|
747
|
+
first: z.ZodOptional<z.ZodNumber>;
|
|
748
|
+
bytes_per_sec: z.ZodNumber;
|
|
749
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
750
|
+
type: z.ZodLiteral<"truncated_json">;
|
|
751
|
+
first: z.ZodOptional<z.ZodNumber>;
|
|
752
|
+
content_length: z.ZodDefault<z.ZodEnum<{
|
|
753
|
+
full: "full";
|
|
754
|
+
cut: "cut";
|
|
755
|
+
}>>;
|
|
756
|
+
}, z.core.$strict>], "type">>;
|
|
757
|
+
}, z.core.$strict>;
|
|
758
|
+
type Stub = z.output<typeof stubSchema>;
|
|
759
|
+
type StubInput = z.input<typeof stubSchema>;
|
|
760
|
+
|
|
761
|
+
interface JournalEntry {
|
|
762
|
+
scope: string;
|
|
763
|
+
method: string;
|
|
764
|
+
/** Without the scope segment and without the query string. */
|
|
765
|
+
path: string;
|
|
766
|
+
/** Without the leading `?`; values of secret-looking parameters are masked. */
|
|
767
|
+
query: string;
|
|
768
|
+
/** Lower-case names; values of secret-looking headers are masked. */
|
|
769
|
+
headers: Record<string, string>;
|
|
770
|
+
/** The first `journalBodyCap` bytes. */
|
|
771
|
+
body: string;
|
|
772
|
+
bodyTruncated: boolean;
|
|
773
|
+
/** Whether a stub answered. */
|
|
774
|
+
matched: boolean;
|
|
775
|
+
}
|
|
776
|
+
interface MockScope {
|
|
777
|
+
readonly name: string;
|
|
778
|
+
/** `<server.url>/<name>`: what a provider SDK's base URL starts with. */
|
|
779
|
+
readonly url: string;
|
|
780
|
+
/** The newest `JOURNAL_MAX_ENTRIES` requests that named this scope, in arrival order. */
|
|
781
|
+
readonly journal: readonly JournalEntry[];
|
|
782
|
+
/** How many older entries the journal has let go. */
|
|
783
|
+
readonly dropped: number;
|
|
784
|
+
add(...stubs: StubInput[]): void;
|
|
785
|
+
/**
|
|
786
|
+
* Removes the scope and its stubs, ends the requests it still holds (a `timeout`, a `slow_stream`) by
|
|
787
|
+
* destroying their sockets, and returns the stubs that were never called.
|
|
788
|
+
*/
|
|
789
|
+
close(): Stub[];
|
|
790
|
+
}
|
|
791
|
+
interface MockServer {
|
|
792
|
+
readonly url: string;
|
|
793
|
+
readonly port: number;
|
|
794
|
+
/** The newest `JOURNAL_MAX_ENTRIES` requests whose target named no open scope or was refused. */
|
|
795
|
+
readonly unrouted: readonly JournalEntry[];
|
|
796
|
+
/** How many older entries `unrouted` has let go. */
|
|
797
|
+
readonly unroutedDropped: number;
|
|
798
|
+
/** Throws on a name that is taken or cannot be a path segment, and once the server is closed. */
|
|
799
|
+
scope(name: string, stubs?: StubInput[]): MockScope;
|
|
800
|
+
/** Always resolves, destroys open sockets, safe to call twice. */
|
|
801
|
+
close(): Promise<void>;
|
|
802
|
+
}
|
|
803
|
+
|
|
674
804
|
interface RowParams {
|
|
675
805
|
template: string;
|
|
676
806
|
assertions: AssertionConfig[];
|
|
677
807
|
row: DatasetRow;
|
|
678
808
|
providerConfig: ProviderConfig;
|
|
679
809
|
provider: Provider;
|
|
810
|
+
/**
|
|
811
|
+
* The provider a judge asks where `provider` is not the one to ask: on an eval with stubs `provider` is
|
|
812
|
+
* pointed at the stub server, and a judge call is not the eval's own call.
|
|
813
|
+
*/
|
|
814
|
+
judgeProvider?: Provider;
|
|
680
815
|
embedder: Embedder;
|
|
681
816
|
cache: Cache;
|
|
682
817
|
now: () => number;
|
|
@@ -707,7 +842,13 @@ interface RowParams {
|
|
|
707
842
|
};
|
|
708
843
|
}
|
|
709
844
|
interface RunDeps {
|
|
710
|
-
|
|
845
|
+
/** With `stubOrigin` (a scope of the stub server), the provider's client is pointed there, not at the provider. */
|
|
846
|
+
resolveProvider(cfg: ProviderConfig, stubOrigin?: string): Provider;
|
|
847
|
+
/**
|
|
848
|
+
* The stub server of the run, started on the first call and the same one on every call after it; whoever
|
|
849
|
+
* gives it closes it. Called only when a row of an eval with `stubs` runs, so never on a dry run.
|
|
850
|
+
*/
|
|
851
|
+
stubServer?: () => Promise<MockServer>;
|
|
711
852
|
embedder: Embedder;
|
|
712
853
|
cache: Cache;
|
|
713
854
|
now: () => number;
|
|
@@ -744,7 +885,7 @@ declare class NotLoggedInError extends Error {
|
|
|
744
885
|
}
|
|
745
886
|
/** The token was present but the server rejected it (401 — revoked or invalid). (exit 2) */
|
|
746
887
|
declare class TokenRejectedError extends Error {
|
|
747
|
-
constructor();
|
|
888
|
+
constructor(apiUrl?: string);
|
|
748
889
|
}
|
|
749
890
|
/** No run to sync, or the run file is unreadable / not a valid RunResult. (exit 2) */
|
|
750
891
|
declare class SyncFileError extends Error {
|
|
@@ -764,7 +905,7 @@ interface SyncDeps {
|
|
|
764
905
|
cwd?: string;
|
|
765
906
|
/** Explicit run JSON to sync instead of `<cwd>/.plune/last-run.json`. */
|
|
766
907
|
file?: string;
|
|
767
|
-
/** Override the API base URL. Falls back to `PLUNE_API_URL`, then the
|
|
908
|
+
/** Override the API base URL. Falls back to `PLUNE_API_URL`, then the production default. */
|
|
768
909
|
apiUrl?: string;
|
|
769
910
|
/** Token source (injected in tests). Defaults to the real credentials store. */
|
|
770
911
|
loadToken?: () => string | null;
|
|
@@ -825,6 +966,18 @@ declare const assertionConfigSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
825
966
|
strict: "strict";
|
|
826
967
|
}>>;
|
|
827
968
|
}, z.core.$strip>, z.ZodObject<{
|
|
969
|
+
type: z.ZodLiteral<"json-verify">;
|
|
970
|
+
expected: z.ZodOptional<z.ZodAny>;
|
|
971
|
+
mode: z.ZodOptional<z.ZodEnum<{
|
|
972
|
+
exact: "exact";
|
|
973
|
+
unordered: "unordered";
|
|
974
|
+
contains: "contains";
|
|
975
|
+
}>>;
|
|
976
|
+
extract: z.ZodOptional<z.ZodEnum<{
|
|
977
|
+
auto: "auto";
|
|
978
|
+
strict: "strict";
|
|
979
|
+
}>>;
|
|
980
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
828
981
|
type: z.ZodLiteral<"llm-judge">;
|
|
829
982
|
criteria: z.ZodString;
|
|
830
983
|
provider: z.ZodOptional<z.ZodPipe<z.ZodAny, z.ZodTransform<{
|
|
@@ -871,8 +1024,8 @@ declare const assertionConfigSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
871
1024
|
tool: z.ZodString;
|
|
872
1025
|
args: z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>]>;
|
|
873
1026
|
match: z.ZodOptional<z.ZodEnum<{
|
|
874
|
-
partial: "partial";
|
|
875
1027
|
exact: "exact";
|
|
1028
|
+
partial: "partial";
|
|
876
1029
|
ignore: "ignore";
|
|
877
1030
|
}>>;
|
|
878
1031
|
min_count: z.ZodOptional<z.ZodNumber>;
|
|
@@ -974,6 +1127,7 @@ declare const runResultSchema: z.ZodObject<{
|
|
|
974
1127
|
from_model: z.ZodNumber;
|
|
975
1128
|
missed: z.ZodNumber;
|
|
976
1129
|
errored: z.ZodNumber;
|
|
1130
|
+
stubbed: z.ZodOptional<z.ZodNumber>;
|
|
977
1131
|
saved: z.ZodObject<{
|
|
978
1132
|
input_tokens: z.ZodNumber;
|
|
979
1133
|
output_tokens: z.ZodNumber;
|
|
@@ -988,6 +1142,7 @@ declare const runResultSchema: z.ZodObject<{
|
|
|
988
1142
|
vars: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
989
1143
|
output: z.ZodNullable<z.ZodString>;
|
|
990
1144
|
cached: z.ZodBoolean;
|
|
1145
|
+
stubbed: z.ZodOptional<z.ZodBoolean>;
|
|
991
1146
|
usage: z.ZodOptional<z.ZodObject<{
|
|
992
1147
|
input_tokens: z.ZodNumber;
|
|
993
1148
|
output_tokens: z.ZodNumber;
|
|
@@ -1143,6 +1298,13 @@ declare const runResultSchema: z.ZodObject<{
|
|
|
1143
1298
|
type: z.ZodString;
|
|
1144
1299
|
model: z.ZodString;
|
|
1145
1300
|
}, z.core.$strip>>;
|
|
1301
|
+
stubs: z.ZodOptional<z.ZodObject<{
|
|
1302
|
+
never_called: z.ZodArray<z.ZodNumber>;
|
|
1303
|
+
unmatched: z.ZodArray<z.ZodObject<{
|
|
1304
|
+
scope: z.ZodString;
|
|
1305
|
+
method: z.ZodString;
|
|
1306
|
+
}, z.core.$strip>>;
|
|
1307
|
+
}, z.core.$strip>>;
|
|
1146
1308
|
traceUrl: z.ZodOptional<z.ZodString>;
|
|
1147
1309
|
}, z.core.$strip>>;
|
|
1148
1310
|
}, z.core.$strip>;
|