@attest-ai/vitest 1.0.0-rc.1 → 1.0.0-rc.3
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/fixtures.d.ts +16 -3
- package/dist/fixtures.d.ts.map +1 -1
- package/dist/fixtures.js +45 -47
- package/dist/fixtures.js.map +1 -1
- package/dist/index.d.ts +10 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/plugin.d.ts +6 -0
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +6 -0
- package/dist/plugin.js.map +1 -1
- package/dist/replay.d.ts +41 -0
- package/dist/replay.d.ts.map +1 -0
- package/dist/replay.js +98 -0
- package/dist/replay.js.map +1 -0
- package/dist/report.d.ts +38 -3
- package/dist/report.d.ts.map +1 -1
- package/dist/report.js +92 -5
- package/dist/report.js.map +1 -1
- package/dist/reporter.d.ts +9 -0
- package/dist/reporter.d.ts.map +1 -1
- package/dist/reporter.js +43 -9
- package/dist/reporter.js.map +1 -1
- package/dist/test-state.d.ts +100 -0
- package/dist/test-state.d.ts.map +1 -0
- package/dist/test-state.js +187 -0
- package/dist/test-state.js.map +1 -0
- package/dist/trials.d.ts +55 -0
- package/dist/trials.d.ts.map +1 -0
- package/dist/trials.js +184 -0
- package/dist/trials.js.map +1 -0
- package/dist/world.d.ts +11 -0
- package/dist/world.d.ts.map +1 -0
- package/dist/world.js +22 -0
- package/dist/world.js.map +1 -0
- package/package.json +4 -4
package/dist/fixtures.d.ts
CHANGED
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
import type { TestContext } from "vitest";
|
|
2
2
|
import { type ExpectChain, AgentResult, AttestClient } from "@attest-ai/core";
|
|
3
|
+
import { type TestBudget } from "./test-state.js";
|
|
3
4
|
export interface InspectOptions {
|
|
4
5
|
/** Throw when the cumulative session cost exceeds this USD amount. */
|
|
5
6
|
budget?: number;
|
|
7
|
+
/**
|
|
8
|
+
* Limits for this test's attest model calls. Each evaluation sends what is
|
|
9
|
+
* left: judge calls not yet used in the test, and `maxCostUsd` minus the
|
|
10
|
+
* test's attest cost and agent spend so far (trace `metadata.cost_usd`). A
|
|
11
|
+
* call that does not fit is not sent and its assertion is not_evaluated with
|
|
12
|
+
* reason "budget_exhausted". Inside trials(), defaults to the trials budget.
|
|
13
|
+
*/
|
|
14
|
+
testBudget?: TestBudget;
|
|
6
15
|
/**
|
|
7
16
|
* The running test's context (`it("…", async (context) => …)`). Used to
|
|
8
17
|
* attach results to the right test for AttestReporter and to skip it;
|
|
@@ -21,7 +30,8 @@ export interface EvaluateOptions extends InspectOptions {
|
|
|
21
30
|
* Fail or skip the running Vitest test according to the batch outcome:
|
|
22
31
|
* any hard_fail throws with rendered diagnostics; otherwise any
|
|
23
32
|
* not_evaluated skips with "not evaluated: <reasons>" (throws when strict);
|
|
24
|
-
* soft failures pass.
|
|
33
|
+
* soft failures pass. Inside a trial of trials() (N > 1) it does nothing and
|
|
34
|
+
* returns `result`: trials() enforces the aggregate outcome after the last trial.
|
|
25
35
|
*/
|
|
26
36
|
export declare function enforceOutcome(result: AgentResult, strict: boolean, context?: TestContext): AgentResult;
|
|
27
37
|
export declare class AttestEngineFixture {
|
|
@@ -48,8 +58,11 @@ export declare class AttestEngineFixture {
|
|
|
48
58
|
evaluate(chain: ExpectChain, options?: EvaluateOptions): Promise<AgentResult>;
|
|
49
59
|
}
|
|
50
60
|
export declare function useAttest(): AttestEngineFixture;
|
|
51
|
-
/**
|
|
61
|
+
/**
|
|
62
|
+
* Evaluate and enforce: hard_fail throws, not_evaluated skips (strict: throws).
|
|
63
|
+
* Inside a trial of trials() (N > 1) it does not enforce, like inspect().
|
|
64
|
+
*/
|
|
52
65
|
export declare function evaluate(chain: ExpectChain, options?: EvaluateOptions): Promise<AgentResult>;
|
|
53
|
-
/** Evaluate without enforcing; use for
|
|
66
|
+
/** Evaluate without enforcing; use for custom checks. For repeated runs use trials(). */
|
|
54
67
|
export declare function inspect(chain: ExpectChain, options?: InspectOptions): Promise<AgentResult>;
|
|
55
68
|
//# sourceMappingURL=fixtures.d.ts.map
|
package/dist/fixtures.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fixtures.d.ts","sourceRoot":"","sources":["../src/fixtures.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAC1C,OAAO,EACL,KAAK,WAAW,EAChB,WAAW,
|
|
1
|
+
{"version":3,"file":"fixtures.d.ts","sourceRoot":"","sources":["../src/fixtures.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAC1C,OAAO,EACL,KAAK,WAAW,EAChB,WAAW,EAEX,YAAY,EASb,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAYL,KAAK,UAAU,EAChB,MAAM,iBAAiB,CAAC;AAEzB,MAAM,WAAW,cAAc;IAC7B,sEAAsE;IACtE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB;;;;OAIG;IACH,OAAO,CAAC,EAAE,WAAW,CAAC;CACvB;AAED,MAAM,WAAW,eAAgB,SAAQ,cAAc;IACrD;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,WAAW,EACnB,MAAM,EAAE,OAAO,EACf,OAAO,CAAC,EAAE,WAAW,GACpB,WAAW,CAab;AAmBD,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,OAAO,CAA4B;IAC3C,OAAO,CAAC,OAAO,CAA2B;IAC1C,OAAO,CAAC,QAAQ,CAA4B;gBAEhC,OAAO,CAAC,EAAE;QAAE,UAAU,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,YAAY,CAAA;KAAE;IAWvF;;;;OAIG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAoBtB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAQ3B,IAAI,MAAM,IAAI,YAAY,CAKzB;YAEa,aAAa;IAM3B,wEAAwE;IAClE,OAAO,CAAC,KAAK,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,WAAW,CAAC;IA4EjF,kEAAkE;IAC5D,QAAQ,CAAC,KAAK,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,WAAW,CAAC;CAIpF;AAOD,wBAAgB,SAAS,IAAI,mBAAmB,CAO/C;AAED;;;GAGG;AACH,wBAAsB,QAAQ,CAC5B,KAAK,EAAE,WAAW,EAClB,OAAO,CAAC,EAAE,eAAe,GACxB,OAAO,CAAC,WAAW,CAAC,CAEtB;AAED,yFAAyF;AACzF,wBAAsB,OAAO,CAC3B,KAAK,EAAE,WAAW,EAClB,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,WAAW,CAAC,CAEtB"}
|
package/dist/fixtures.js
CHANGED
|
@@ -1,58 +1,23 @@
|
|
|
1
1
|
import * as vitest from "vitest";
|
|
2
|
-
import { AgentResult, AttestClient, EngineManager, isSimulationMode, renderDiagnostics, requireSimulationCapability, OUTCOME_FAIL, OUTCOME_SKIP,
|
|
3
|
-
|
|
4
|
-
* The running test: `TestRunner.getCurrentTest()` on Vitest 4.1+, `vitest/suite`
|
|
5
|
-
* before that (loaded only there, because Vitest 4.1 warns when it is imported).
|
|
6
|
-
*/
|
|
7
|
-
async function runningTest() {
|
|
8
|
-
const runner = vitest.TestRunner;
|
|
9
|
-
if (runner !== undefined)
|
|
10
|
-
return runner.getCurrentTest();
|
|
11
|
-
const suite = await import("vitest/suite");
|
|
12
|
-
return suite.getCurrentTest();
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Attach the results to the running test's meta so AttestReporter, in the main
|
|
16
|
-
* process, can write them with the test's file and line. Results from an earlier
|
|
17
|
-
* attempt of a retried test are dropped, so the report matches the outcome Vitest
|
|
18
|
-
* reports. Outside a test (e.g. in a beforeAll hook) there is no test to attach to.
|
|
19
|
-
*/
|
|
20
|
-
async function recordOnTest(result, context) {
|
|
21
|
-
const test = context?.task ?? (await runningTest());
|
|
22
|
-
if (test === undefined)
|
|
23
|
-
return;
|
|
24
|
-
if (context === undefined && test.concurrent === true) {
|
|
25
|
-
throw new Error("Attest results from a test.concurrent test — pass the test context: " +
|
|
26
|
-
"inspect(chain, { context }) or evaluate(chain, { context })");
|
|
27
|
-
}
|
|
28
|
-
const attempt = test.result?.retryCount ?? 0;
|
|
29
|
-
let meta = test.meta.attest;
|
|
30
|
-
if (meta === undefined || meta.attempt !== attempt) {
|
|
31
|
-
meta = { attempt, results: [], totalCost: 0, totalDurationMs: 0 };
|
|
32
|
-
test.meta.attest = meta;
|
|
33
|
-
}
|
|
34
|
-
meta.results.push(...result.assertionResults);
|
|
35
|
-
meta.totalCost += result.totalCost;
|
|
36
|
-
meta.totalDurationMs += result.totalDurationMs;
|
|
37
|
-
}
|
|
38
|
-
function strictFromEnv() {
|
|
39
|
-
const v = (process.env["ATTEST_STRICT"] ?? "").trim().toLowerCase();
|
|
40
|
-
return v === "1" || v === "true" || v === "yes";
|
|
41
|
-
}
|
|
2
|
+
import { AgentResult, STATUS_SOFT_FAIL, AttestClient, EngineManager, isSimulationMode, renderDiagnostics, requireSimulationCapability, OUTCOME_FAIL, OUTCOME_SKIP, zeroUsage, } from "@attest-ai/core";
|
|
3
|
+
import { assignAssertionIds, attemptState, inTrial, recordAgentSpend, recordOnTest, recordUnattachedUsage, remainingBudget, resolveTest, strictFromEnv, trialScope, validateBudget, } from "./test-state.js";
|
|
42
4
|
/**
|
|
43
5
|
* Fail or skip the running Vitest test according to the batch outcome:
|
|
44
6
|
* any hard_fail throws with rendered diagnostics; otherwise any
|
|
45
7
|
* not_evaluated skips with "not evaluated: <reasons>" (throws when strict);
|
|
46
|
-
* soft failures pass.
|
|
8
|
+
* soft failures pass. Inside a trial of trials() (N > 1) it does nothing and
|
|
9
|
+
* returns `result`: trials() enforces the aggregate outcome after the last trial.
|
|
47
10
|
*/
|
|
48
11
|
export function enforceOutcome(result, strict, context) {
|
|
12
|
+
if (inTrial())
|
|
13
|
+
return result;
|
|
49
14
|
const outcome = result.outcome({ strict });
|
|
50
15
|
if (outcome === OUTCOME_FAIL) {
|
|
51
16
|
const header = result.hardFailures.length === 0 ? `strict: ${result.skipReason()}\n` : "";
|
|
52
17
|
throw new Error(header + renderDiagnostics(result).replace(/^\n/, ""));
|
|
53
18
|
}
|
|
54
19
|
if (outcome === OUTCOME_SKIP) {
|
|
55
|
-
(context ?? currentTestContext(result)).skip(result.skipReason());
|
|
20
|
+
(context ?? trialScope.getStore()?.test.context ?? currentTestContext(result)).skip(result.skipReason());
|
|
56
21
|
}
|
|
57
22
|
return result;
|
|
58
23
|
}
|
|
@@ -131,14 +96,44 @@ export class AttestEngineFixture {
|
|
|
131
96
|
/** Evaluate collected assertions without enforcing the test outcome. */
|
|
132
97
|
async inspect(chain, options) {
|
|
133
98
|
await this.ensureStarted();
|
|
134
|
-
|
|
99
|
+
// Inside a test, assertion IDs are deterministic (the test's report test_id
|
|
100
|
+
// and the assertion's ordinal in the test, restarting each trial) so trials
|
|
101
|
+
// and baselines match rows by ID. Outside a test they stay random.
|
|
102
|
+
const test = await resolveTest(options?.context);
|
|
103
|
+
const scope = trialScope.getStore();
|
|
104
|
+
const trial = scope !== undefined && scope.test === test ? scope.trial : undefined;
|
|
105
|
+
const budget = options?.testBudget !== undefined
|
|
106
|
+
? validateBudget(options.testBudget)
|
|
107
|
+
: scope !== undefined && scope.test === test
|
|
108
|
+
? scope.budget
|
|
109
|
+
: undefined;
|
|
110
|
+
let assertions = chain.assertions;
|
|
111
|
+
let batchBudget;
|
|
112
|
+
if (test !== undefined) {
|
|
113
|
+
assertions = assignAssertionIds(test, assertions);
|
|
114
|
+
recordAgentSpend(test, chain.trace);
|
|
115
|
+
if (budget !== undefined) {
|
|
116
|
+
const state = attemptState(test);
|
|
117
|
+
batchBudget = remainingBudget(budget, state.usage, state.agentSpendUsd);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
else if (budget !== undefined) {
|
|
121
|
+
// Outside a test the budget covers this one evaluation.
|
|
122
|
+
batchBudget = remainingBudget(budget, zeroUsage(), chain.trace.metadata?.cost_usd ?? 0);
|
|
123
|
+
}
|
|
124
|
+
const result = await this.client.evaluateBatch(chain.trace, assertions, batchBudget === undefined ? undefined : { budget: batchBudget });
|
|
135
125
|
globalThis.__attest_session_cost__ =
|
|
136
126
|
(globalThis.__attest_session_cost__ ?? 0) + (result.total_cost ?? 0);
|
|
137
127
|
const softFailCount = (result.results ?? []).filter((r) => r.status === STATUS_SOFT_FAIL).length;
|
|
138
128
|
globalThis.__attest_session_soft_failures__ =
|
|
139
129
|
(globalThis.__attest_session_soft_failures__ ?? 0) + softFailCount;
|
|
140
|
-
const agentResult = new AgentResult(chain.trace, result.results ?? [], result.total_cost ?? 0, result.total_duration_ms ?? 0);
|
|
141
|
-
|
|
130
|
+
const agentResult = new AgentResult(chain.trace, result.results ?? [], result.total_cost ?? 0, result.total_duration_ms ?? 0, result.usage);
|
|
131
|
+
if (test !== undefined)
|
|
132
|
+
recordOnTest(test, agentResult, trial);
|
|
133
|
+
else
|
|
134
|
+
recordUnattachedUsage(agentResult.usage);
|
|
135
|
+
if (scope !== undefined && scope.test === test)
|
|
136
|
+
scope.results.push(agentResult);
|
|
142
137
|
// Track non-passing AgentResults so AttestCostReporter can render the
|
|
143
138
|
// diagnostic block at the end of the run. Bound size because long
|
|
144
139
|
// suites with many failures should not balloon RAM.
|
|
@@ -173,11 +168,14 @@ export function useAttest() {
|
|
|
173
168
|
workerFixture ??= new AttestEngineFixture();
|
|
174
169
|
return workerFixture;
|
|
175
170
|
}
|
|
176
|
-
/**
|
|
171
|
+
/**
|
|
172
|
+
* Evaluate and enforce: hard_fail throws, not_evaluated skips (strict: throws).
|
|
173
|
+
* Inside a trial of trials() (N > 1) it does not enforce, like inspect().
|
|
174
|
+
*/
|
|
177
175
|
export async function evaluate(chain, options) {
|
|
178
176
|
return useAttest().evaluate(chain, options);
|
|
179
177
|
}
|
|
180
|
-
/** Evaluate without enforcing; use for
|
|
178
|
+
/** Evaluate without enforcing; use for custom checks. For repeated runs use trials(). */
|
|
181
179
|
export async function inspect(chain, options) {
|
|
182
180
|
return useAttest().inspect(chain, options);
|
|
183
181
|
}
|
package/dist/fixtures.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fixtures.js","sourceRoot":"","sources":["../src/fixtures.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAEjC,OAAO,EAEL,WAAW,EACX,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,iBAAiB,EACjB,2BAA2B,EAC3B,YAAY,EACZ,YAAY,EACZ,
|
|
1
|
+
{"version":3,"file":"fixtures.js","sourceRoot":"","sources":["../src/fixtures.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAEjC,OAAO,EAEL,WAAW,EACX,gBAAgB,EAChB,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,iBAAiB,EACjB,2BAA2B,EAC3B,YAAY,EACZ,YAAY,EACZ,SAAS,GAEV,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,kBAAkB,EAClB,YAAY,EACZ,OAAO,EACP,gBAAgB,EAChB,YAAY,EACZ,qBAAqB,EACrB,eAAe,EACf,WAAW,EACX,aAAa,EACb,UAAU,EACV,cAAc,GAEf,MAAM,iBAAiB,CAAC;AA6BzB;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAC5B,MAAmB,EACnB,MAAe,EACf,OAAqB;IAErB,IAAI,OAAO,EAAE;QAAE,OA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MAAM,MAAM,GAAG,UAAU,CAAC,iBAAiB,CAAC;IAC5C,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,OAAO,IAAI,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;IAC7C,CAAC;IACD,aAAa,KAAK,IAAI,mBAAmB,EAAE,CAAC;IAC5C,OAAO,aAAa,CAAC;AACvB,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ,CAC5B,KAAkB,EAClB,OAAyB;IAEzB,OAAO,SAAS,EAAE,CAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AAC9C,CAAC;AAED,yFAAyF;AACzF,MAAM,CAAC,KAAK,UAAU,OAAO,CAC3B,KAAkB,EAClB,OAAwB;IAExB,OAAO,SAAS,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AAC7C,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,9 +2,17 @@ export { attestGlobalSetup } from "./plugin.js";
|
|
|
2
2
|
export type { AttestGlobalSetupOptions } from "./plugin.js";
|
|
3
3
|
export { AttestEngineFixture, useAttest, evaluate, inspect, enforceOutcome } from "./fixtures.js";
|
|
4
4
|
export type { EvaluateOptions, InspectOptions } from "./fixtures.js";
|
|
5
|
+
export { trials, MIN_PASS_RATE_ENV } from "./trials.js";
|
|
6
|
+
export type { TrialsOptions } from "./trials.js";
|
|
7
|
+
export type { TestBudget } from "./test-state.js";
|
|
5
8
|
export { AttestCostReporter, AttestReporter } from "./reporter.js";
|
|
6
9
|
export type { AttestReporterOptions } from "./reporter.js";
|
|
7
|
-
export { buildReport, REPORT_VERSION } from "./report.js";
|
|
8
|
-
export type { AttestTaskMeta, TestOutcome, TestRecord } from "./report.js";
|
|
10
|
+
export { buildReport, REPORT_VERSION, sessionUsage, summaryLines } from "./report.js";
|
|
11
|
+
export type { AttestTaskMeta, RecordedResult, TestOutcome, TestRecord, TrialsMeta } from "./report.js";
|
|
9
12
|
export { filterByTier } from "./tier-filter.js";
|
|
13
|
+
export { useWorld } from "./world.js";
|
|
14
|
+
export { useReplay } from "./replay.js";
|
|
15
|
+
export type { ReplayHandle, ReplayMeta, UseReplayOptions } from "./replay.js";
|
|
16
|
+
export { EgressBlockedError, REASON_REPLAY_MISS, ReplayError, ReplayMissError, ReplayNotEvaluatedError, egressBlockRequested, firstMiss, installEgressGuard, isProviderHost, liveLine, resolveMode, startReplay, startWorld, uninstallEgressGuard, WorldError, } from "@attest-ai/core";
|
|
17
|
+
export type { ReplaySession, ReplaySummary, WorldOptions, WorldSession, WorldSnapshot } from "@attest-ai/core";
|
|
10
18
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,YAAY,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAClG,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACnE,YAAY,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,YAAY,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAClG,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACrE,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACxD,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,YAAY,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACnE,YAAY,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACtF,YAAY,EAAE,cAAc,EAAE,cAAc,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACvG,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC9E,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,WAAW,EACX,eAAe,EACf,uBAAuB,EACvB,oBAAoB,EACpB,SAAS,EACT,kBAAkB,EAClB,cAAc,EACd,QAAQ,EACR,WAAW,EACX,WAAW,EACX,UAAU,EACV,oBAAoB,EACpB,UAAU,GACX,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
export { attestGlobalSetup } from "./plugin.js";
|
|
2
2
|
export { AttestEngineFixture, useAttest, evaluate, inspect, enforceOutcome } from "./fixtures.js";
|
|
3
|
+
export { trials, MIN_PASS_RATE_ENV } from "./trials.js";
|
|
3
4
|
export { AttestCostReporter, AttestReporter } from "./reporter.js";
|
|
4
|
-
export { buildReport, REPORT_VERSION } from "./report.js";
|
|
5
|
+
export { buildReport, REPORT_VERSION, sessionUsage, summaryLines } from "./report.js";
|
|
5
6
|
export { filterByTier } from "./tier-filter.js";
|
|
7
|
+
export { useWorld } from "./world.js";
|
|
8
|
+
export { useReplay } from "./replay.js";
|
|
9
|
+
export { EgressBlockedError, REASON_REPLAY_MISS, ReplayError, ReplayMissError, ReplayNotEvaluatedError, egressBlockRequested, firstMiss, installEgressGuard, isProviderHost, liveLine, resolveMode, startReplay, startWorld, uninstallEgressGuard, WorldError, } from "@attest-ai/core";
|
|
6
10
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,EAAE,mBAAmB,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAElG,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEnE,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,EAAE,mBAAmB,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAElG,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGxD,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEnE,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEtF,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,WAAW,EACX,eAAe,EACf,uBAAuB,EACvB,oBAAoB,EACpB,SAAS,EACT,kBAAkB,EAClB,cAAc,EACd,QAAQ,EACR,WAAW,EACX,WAAW,EACX,UAAU,EACV,oBAAoB,EACpB,UAAU,GACX,MAAM,iBAAiB,CAAC"}
|
package/dist/plugin.d.ts
CHANGED
|
@@ -2,6 +2,12 @@ import { EngineManager, AttestClient, type AgentResult } from "@attest-ai/core";
|
|
|
2
2
|
export interface AttestGlobalSetupOptions {
|
|
3
3
|
enginePath?: string;
|
|
4
4
|
logLevel?: string;
|
|
5
|
+
/**
|
|
6
|
+
* Minimum passed / evaluated trials for every trials() test of the run (0..1,
|
|
7
|
+
* default 1.0); trials(body, { minPassRate }) overrides it per test. Reaches
|
|
8
|
+
* the workers as the ATTEST_MIN_PASS_RATE environment variable.
|
|
9
|
+
*/
|
|
10
|
+
minPassRate?: number;
|
|
5
11
|
}
|
|
6
12
|
declare global {
|
|
7
13
|
var __attest_engine__: EngineManager | undefined;
|
package/dist/plugin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,YAAY,EAGZ,KAAK,WAAW,EACjB,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,YAAY,EAGZ,KAAK,WAAW,EACjB,MAAM,iBAAiB,CAAC;AAMzB,MAAM,WAAW,wBAAwB;IACvC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,OAAO,CAAC,MAAM,CAAC;IAEb,IAAI,iBAAiB,EAAE,aAAa,GAAG,SAAS,CAAC;IAEjD,IAAI,iBAAiB,EAAE,YAAY,GAAG,SAAS,CAAC;IAEhD,IAAI,uBAAuB,EAAE,MAAM,CAAC;IAEpC,IAAI,gCAAgC,EAAE,MAAM,CAAC;IAE7C,IAAI,2BAA2B,EAAE,WAAW,EAAE,GAAG,SAAS,CAAC;CAC5D;AAED,wBAAgB,iBAAiB,CAAC,OAAO,CAAC,EAAE,wBAAwB;;;EAmDnE"}
|
package/dist/plugin.js
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import { EngineManager, AttestClient, isSimulationMode, requireSimulationCapability, } from "@attest-ai/core";
|
|
2
|
+
import { MIN_PASS_RATE_ENV, validateMinPassRate } from "./trials.js";
|
|
2
3
|
let engineManager;
|
|
3
4
|
let attestClient;
|
|
4
5
|
export function attestGlobalSetup(options) {
|
|
6
|
+
const minPassRate = options?.minPassRate === undefined
|
|
7
|
+
? undefined
|
|
8
|
+
: validateMinPassRate(options.minPassRate, `minPassRate=${options.minPassRate}`);
|
|
5
9
|
return {
|
|
6
10
|
async setup() {
|
|
11
|
+
if (minPassRate !== undefined)
|
|
12
|
+
process.env[MIN_PASS_RATE_ENV] = String(minPassRate);
|
|
7
13
|
globalThis.__attest_session_cost__ = 0;
|
|
8
14
|
globalThis.__attest_session_soft_failures__ = 0;
|
|
9
15
|
globalThis.__attest_session_failures__ = [];
|
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"m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I,gBAAgB,EAAE,EAAE,CAAC;gBACvB,IAAI,CAAC;oBACH,2BAA2B,CAAC,IAAI,CAAC,CAAC;gBACpC,CAAC;gBAAC,OAAO,GAAG,EAAE,CAAC;oBACb,MAAM,aAAa,CAAC,IAAI,EAAE,CAAC;oBAC3B,aAAa,GAAG,SAAS,CAAC;oBAC1B,MAAM,GAAG,CAAC;gBACZ,CAAC;YACH,CAAC;YACD,YAAY,GAAG,IAAI,YAAY,CAAC,aAAa,CAAC,CAAC;YAE/C,UAAU,CAAC,iBAAiB,GAAG,aAAa,CAAC;YAC7C,UAAU,CAAC,iBAAiB,GAAG,YAAY,CAAC;QAC9C,CAAC;QAED,KAAK,CAAC,QAAQ;YACZ,IAAI,aAAa,EAAE,CAAC;gBAClB,MAAM,aAAa,CAAC,IAAI,EAAE,CAAC;gBAC3B,aAAa,GAAG,SAAS,CAAC;gBAC1B,YAAY,GAAG,SAAS,CAAC;YAC3B,CAAC;YAED,UAAU,CAAC,iBAAiB,GAAG,SAAS,CAAC;YACzC,UAAU,CAAC,iBAAiB,GAAG,SAAS,CAAC;YACzC,UAAU,CAAC,2BAA2B,GAAG,SAAS,CAAC;QACrD,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/dist/replay.d.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type ReplayModeSetting, type ReplayOptions, type ReplaySummary } from "@attest-ai/core";
|
|
2
|
+
/** Replay provenance of one test, carried from the worker in task meta. */
|
|
3
|
+
export interface ReplayMeta {
|
|
4
|
+
fixtures: string[];
|
|
5
|
+
mode: "strict" | "auto";
|
|
6
|
+
replayed: number;
|
|
7
|
+
live: number;
|
|
8
|
+
misses: number;
|
|
9
|
+
/** First miss message. */
|
|
10
|
+
miss?: string;
|
|
11
|
+
liveCostUsd: number;
|
|
12
|
+
unpricedLiveCalls: number;
|
|
13
|
+
/** The test was skipped as `not_evaluated: replay_miss`. */
|
|
14
|
+
notEvaluated: boolean;
|
|
15
|
+
}
|
|
16
|
+
export interface UseReplayOptions extends Omit<ReplayOptions, "mode" | "noLive"> {
|
|
17
|
+
/** `strict`, `auto` or `off`; default `ATTEST_REPLAY`, else `strict` when `CI` is set, else `auto`. */
|
|
18
|
+
mode?: ReplayModeSetting;
|
|
19
|
+
/** Block in-process connections to model-provider hosts (default: `ATTEST_EGRESS=block`). */
|
|
20
|
+
egress?: "block" | "allow";
|
|
21
|
+
/** Fail (instead of skip) when auto mode misses. Default: the ATTEST_STRICT variable. */
|
|
22
|
+
strict?: boolean;
|
|
23
|
+
}
|
|
24
|
+
export interface ReplayHandle {
|
|
25
|
+
/** `off` when replay is disabled and nothing was started. */
|
|
26
|
+
readonly mode: "strict" | "auto" | "off";
|
|
27
|
+
/** The session's environment (empty when off). */
|
|
28
|
+
readonly env: Record<string, string>;
|
|
29
|
+
/** Stop the replay now and return its summary (`undefined` when off). The test's outcome is still decided at its end. */
|
|
30
|
+
finish(): Promise<ReplaySummary | undefined>;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Start replaying fixture `name` for the running test. Call it before constructing the
|
|
34
|
+
* model client (clients read `OPENAI_BASE_URL` / `ANTHROPIC_BASE_URL` at construction).
|
|
35
|
+
* When the test ends the replay stops and the test's outcome follows the summary:
|
|
36
|
+
* - strict: any miss fails the test with the miss message, whatever the agent threw;
|
|
37
|
+
* - auto: a miss with no provider key skips the test as `not evaluated: replay_miss`
|
|
38
|
+
* (a failure under `strict: true` / `ATTEST_STRICT=1`); with a key the call went live.
|
|
39
|
+
*/
|
|
40
|
+
export declare function useReplay(name: string, opts?: UseReplayOptions): Promise<ReplayHandle>;
|
|
41
|
+
//# sourceMappingURL=replay.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"replay.d.ts","sourceRoot":"","sources":["../src/replay.ts"],"names":[],"mappings":"AAKA,OAAO,EAOL,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAElB,KAAK,aAAa,EACnB,MAAM,iBAAiB,CAAC;AAGzB,2EAA2E;AAC3E,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,IAAI,EAAE,QAAQ,GAAG,MAAM,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,0BAA0B;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,4DAA4D;IAC5D,YAAY,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAAC,aAAa,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC9E,uGAAuG;IACvG,IAAI,CAAC,EAAE,iBAAiB,CAAC;IACzB,6FAA6F;IAC7F,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC;IAC3B,yFAAyF;IACzF,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,YAAY;IAC3B,6DAA6D;IAC7D,QAAQ,CAAC,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,KAAK,CAAC;IACzC,kDAAkD;IAClD,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,yHAAyH;IACzH,MAAM,IAAI,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC,CAAC;CAC9C;AAUD;;;;;;;GAOG;AACH,wBAAsB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE,gBAAqB,GAAG,OAAO,CAAC,YAAY,CAAC,CA4BhG"}
|
package/dist/replay.js
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `useReplay(name)`: run the test's real agent code with model responses served from
|
|
3
|
+
* fixture `<name>` by the engine's replay proxy, and report how each request was served.
|
|
4
|
+
*/
|
|
5
|
+
import { onTestFinished } from "vitest";
|
|
6
|
+
import { ReplayNotEvaluatedError, egressBlockRequested, firstMiss, installEgressGuard, resolveMode, startReplay, } from "@attest-ai/core";
|
|
7
|
+
import { strictFromEnv } from "./test-state.js";
|
|
8
|
+
/**
|
|
9
|
+
* Start replaying fixture `name` for the running test. Call it before constructing the
|
|
10
|
+
* model client (clients read `OPENAI_BASE_URL` / `ANTHROPIC_BASE_URL` at construction).
|
|
11
|
+
* When the test ends the replay stops and the test's outcome follows the summary:
|
|
12
|
+
* - strict: any miss fails the test with the miss message, whatever the agent threw;
|
|
13
|
+
* - auto: a miss with no provider key skips the test as `not evaluated: replay_miss`
|
|
14
|
+
* (a failure under `strict: true` / `ATTEST_STRICT=1`); with a key the call went live.
|
|
15
|
+
*/
|
|
16
|
+
export async function useReplay(name, opts = {}) {
|
|
17
|
+
const mode = resolveMode(opts.mode);
|
|
18
|
+
if (mode === "off")
|
|
19
|
+
return { mode, env: {}, finish: () => Promise.resolve(undefined) };
|
|
20
|
+
const blocking = (opts.egress ?? (egressBlockRequested() ? "block" : "allow")) === "block";
|
|
21
|
+
const uninstallGuard = blocking ? installEgressGuard() : undefined;
|
|
22
|
+
let session;
|
|
23
|
+
try {
|
|
24
|
+
session = await startReplay(name, { ...opts, mode, noLive: blocking });
|
|
25
|
+
}
|
|
26
|
+
catch (err) {
|
|
27
|
+
uninstallGuard?.();
|
|
28
|
+
throw err;
|
|
29
|
+
}
|
|
30
|
+
let summary;
|
|
31
|
+
const finish = async () => {
|
|
32
|
+
try {
|
|
33
|
+
summary = (await session.finish()) ?? undefined;
|
|
34
|
+
if (summary === undefined)
|
|
35
|
+
throw new Error("replay session returned no summary");
|
|
36
|
+
return summary;
|
|
37
|
+
}
|
|
38
|
+
finally {
|
|
39
|
+
uninstallGuard?.();
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
onTestFinished(async ({ task }) => {
|
|
43
|
+
const done = await finish();
|
|
44
|
+
settle(task, name, mode, done, session, opts.strict ?? strictFromEnv());
|
|
45
|
+
});
|
|
46
|
+
return { mode, env: session.env, finish };
|
|
47
|
+
}
|
|
48
|
+
function settle(task, name, mode, s, session, strict) {
|
|
49
|
+
const miss = firstMiss(s) ?? undefined;
|
|
50
|
+
const skip = s.misses > 0 && mode === "auto" && !strict;
|
|
51
|
+
const meta = {
|
|
52
|
+
fixtures: [name],
|
|
53
|
+
mode,
|
|
54
|
+
replayed: s.replayed,
|
|
55
|
+
live: s.live,
|
|
56
|
+
misses: s.misses,
|
|
57
|
+
...(miss !== undefined ? { miss } : {}),
|
|
58
|
+
liveCostUsd: s.live_cost_usd,
|
|
59
|
+
unpricedLiveCalls: s.unpriced_live_calls,
|
|
60
|
+
// An auto miss is a not_evaluated row in the report even when --strict fails the test.
|
|
61
|
+
notEvaluated: mode === "auto" && s.misses > 0,
|
|
62
|
+
};
|
|
63
|
+
const prior = task.meta["attestReplay"];
|
|
64
|
+
task.meta["attestReplay"] = prior === undefined ? meta : mergeMeta(prior, meta);
|
|
65
|
+
if (miss === undefined)
|
|
66
|
+
return;
|
|
67
|
+
if (skip) {
|
|
68
|
+
// The agent's own error is a consequence of the miss; the test is not evaluated.
|
|
69
|
+
task.result = { ...task.result, state: "skip", errors: undefined };
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
const error = session.error() ?? new ReplayNotEvaluatedError(miss, s);
|
|
73
|
+
// The runner flips a failed `it.fails` test to a pass after the hooks run; a miss must stay a failure.
|
|
74
|
+
task.fails = false;
|
|
75
|
+
if (task.result?.errors !== undefined && task.result.errors.length > 0) {
|
|
76
|
+
// Whatever the agent threw, the user sees the miss.
|
|
77
|
+
task.result.errors = [error];
|
|
78
|
+
task.result.state = "fail";
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
throw error;
|
|
82
|
+
}
|
|
83
|
+
/** Fold a later session of the same test into the earlier one, as the Python report does. */
|
|
84
|
+
function mergeMeta(a, b) {
|
|
85
|
+
const miss = a.miss ?? b.miss;
|
|
86
|
+
return {
|
|
87
|
+
fixtures: [...new Set([...a.fixtures, ...b.fixtures])],
|
|
88
|
+
mode: a.mode === b.mode ? a.mode : "auto",
|
|
89
|
+
replayed: a.replayed + b.replayed,
|
|
90
|
+
live: a.live + b.live,
|
|
91
|
+
misses: a.misses + b.misses,
|
|
92
|
+
...(miss !== undefined ? { miss } : {}),
|
|
93
|
+
liveCostUsd: a.liveCostUsd + b.liveCostUsd,
|
|
94
|
+
unpricedLiveCalls: a.unpricedLiveCalls + b.unpricedLiveCalls,
|
|
95
|
+
notEvaluated: a.notEvaluated || b.notEvaluated,
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=replay.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"replay.js","sourceRoot":"","sources":["../src/replay.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EACL,uBAAuB,EACvB,oBAAoB,EACpB,SAAS,EACT,kBAAkB,EAClB,WAAW,EACX,WAAW,GAKZ,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AA2ChD;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,IAAY,EAAE,OAAyB,EAAE;IACvE,MAAM,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACpC,IAAI,IAAI,KAAK,KAAK;QAAE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;IAEvF,MAAM,QAAQ,GAAG,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,oBAAoB,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,OAAO,CAAC;IAC3F,MA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`results`; the pr-annotate action
|
|
7
7
|
* places inline comments with `file` and `line`.
|
|
8
8
|
*/
|
|
9
|
-
import { type AssertionResult } from "@attest-ai/core";
|
|
9
|
+
import { type AssertionResult, type Usage } from "@attest-ai/core";
|
|
10
|
+
import type { ReplayMeta } from "./replay.js";
|
|
10
11
|
export declare const REPORT_VERSION = 2;
|
|
11
12
|
export type TestOutcome = "passed" | "failed" | "skipped";
|
|
13
|
+
/** An assertion result as recorded for the report; `trial` is set under trials() with N > 1. */
|
|
14
|
+
export type RecordedResult = AssertionResult & {
|
|
15
|
+
readonly trial?: number;
|
|
16
|
+
};
|
|
17
|
+
/** How a trials() call with N > 1 went. */
|
|
18
|
+
export interface TrialsMeta {
|
|
19
|
+
/** N. */
|
|
20
|
+
requested: number;
|
|
21
|
+
/** Trials actually run; fewer than N when the test's cost budget was spent. */
|
|
22
|
+
run: number;
|
|
23
|
+
passed: number;
|
|
24
|
+
/** Trials that passed, failed or raised (not counting not-evaluated ones). */
|
|
25
|
+
evaluated: number;
|
|
26
|
+
notEvaluated: number;
|
|
27
|
+
stoppedByBudget: boolean;
|
|
28
|
+
}
|
|
12
29
|
/** Attest results a test recorded, carried from the worker in task meta. */
|
|
13
30
|
export interface AttestTaskMeta {
|
|
14
31
|
/** `retryCount` of the attempt that produced `results`. */
|
|
15
32
|
attempt: number;
|
|
16
|
-
results:
|
|
33
|
+
results: RecordedResult[];
|
|
17
34
|
totalCost: number;
|
|
18
35
|
totalDurationMs: number;
|
|
36
|
+
/** Attest model usage of every attempt of the test, including retried ones. */
|
|
37
|
+
usage: Usage;
|
|
38
|
+
trials?: TrialsMeta;
|
|
19
39
|
}
|
|
20
40
|
declare module "vitest" {
|
|
21
41
|
interface TaskMeta {
|
|
22
42
|
attest?: AttestTaskMeta;
|
|
43
|
+
attestReplay?: ReplayMeta;
|
|
23
44
|
}
|
|
24
45
|
}
|
|
25
46
|
export interface TestRecord {
|
|
@@ -32,6 +53,20 @@ export interface TestRecord {
|
|
|
32
53
|
outcome: TestOutcome;
|
|
33
54
|
durationMs: number;
|
|
34
55
|
attest: AttestTaskMeta | undefined;
|
|
56
|
+
replay?: ReplayMeta;
|
|
35
57
|
}
|
|
36
|
-
|
|
58
|
+
/**
|
|
59
|
+
* `unattached` is the usage of evaluations that belong to no test (beforeAll,
|
|
60
|
+
* scripts); it counts in `summary.usage`.
|
|
61
|
+
*/
|
|
62
|
+
export declare function buildReport(tests: readonly TestRecord[], simulated: boolean, unattached?: Usage): Record<string, unknown>;
|
|
63
|
+
/** Attest usage summed over every test of the run plus the evaluations that belong to no test. */
|
|
64
|
+
export declare function sessionUsage(tests: readonly TestRecord[], unattached?: Usage): Usage;
|
|
65
|
+
/**
|
|
66
|
+
* Lines for the end of the run: one per trials test
|
|
67
|
+
* ("<test_id>: <passed>/<evaluated> trials passed (<n> not evaluated)", plus a
|
|
68
|
+
* note when the test budget stopped it early), then the "attest usage: …" line
|
|
69
|
+
* when the session made or refused a model call.
|
|
70
|
+
*/
|
|
71
|
+
export declare function summaryLines(tests: readonly TestRecord[], unattached?: Usage): string[];
|
|
37
72
|
//# sourceMappingURL=report.d.ts.map
|
package/dist/report.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../src/report.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,
|
|
1
|
+
{"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../src/report.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EASL,KAAK,eAAe,EACpB,KAAK,KAAK,EACX,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAG9C,eAAO,MAAM,cAAc,IAAI,CAAC;AAEhC,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;AAE1D,gGAAgG;AAChG,MAAM,MAAM,cAAc,GAAG,eAAe,GAA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