@wix/pathgrade 1.0.30 → 1.0.32
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/adapters/jest/invocation-adapter.d.ts +2 -2
- package/dist/adapters/jest/invocation-adapter.js +1 -1
- package/dist/adapters/jest/lifecycle.d.ts +3 -3
- package/dist/adapters/jest/lifecycle.js +1 -1
- package/dist/adapters/jest/metadata.d.ts +0 -1
- package/dist/adapters/jest/metadata.js +1 -1
- package/dist/adapters/jest/results.d.ts +4 -2
- package/dist/adapters/jest/results.js +6 -0
- package/dist/adapters/jest/runner-adapter.js +3 -0
- package/dist/adapters/node-test/index.js +2 -0
- package/dist/adapters/node-test/runner-adapter.js +6 -5
- package/dist/affected/format.d.ts +0 -23
- package/dist/affected/format.js +1 -1
- package/dist/affected/sidecar.d.ts +0 -1
- package/dist/affected/sidecar.js +1 -1
- package/dist/affected/types.d.ts +2 -17
- package/dist/agents/claude/ask-user-answer-store.d.ts +2 -1
- package/dist/agents/claude/tool-results.d.ts +1 -1
- package/dist/agents/claude/tool-results.js +1 -1
- package/dist/agents/claude.d.ts +2 -1
- package/dist/agents/codex-app-server/protocol/DynamicToolCallParams.d.ts +2 -1
- package/dist/agents/codex-app-server/protocol/GrantedPermissionProfile.d.ts +3 -2
- package/dist/agents/codex-app-server/protocol/McpElicitationRequestParams.d.ts +3 -2
- package/dist/agents/codex-app-server/protocol/PermissionsRequestApprovalParams.d.ts +3 -2
- package/dist/agents/codex-app-server/protocol/ThreadStartParams.d.ts +7 -6
- package/dist/agents/codex-app-server/protocol/TurnCompletedNotification.d.ts +2 -1
- package/dist/agents/codex-app-server/transport.d.ts +2 -2
- package/dist/commands/analyze.d.ts +0 -13
- package/dist/commands/report.d.ts +0 -7
- package/dist/commands/report.js +1 -1
- package/dist/core/generated-mcp-protocol.d.ts +0 -2
- package/dist/core/generated-mcp-protocol.js +2 -2
- package/dist/evals/discovery.d.ts +0 -1
- package/dist/evals/discovery.js +1 -1
- package/dist/internal/direct-mcp-v2/acp-client.d.ts +0 -8
- package/dist/internal/direct-mcp-v2/acp-direct-mcp.d.ts +2 -1
- package/dist/internal/direct-mcp-v2/claude-direct-mcp.d.ts +1 -1
- package/dist/internal/direct-mcp-v2/claude-profile.d.ts +0 -10
- package/dist/internal/direct-mcp-v2/claude-profile.js +3 -3
- package/dist/internal/direct-mcp-v2/codex-direct-mcp.d.ts +2 -1
- package/dist/internal/direct-mcp-v2/compiler.d.ts +0 -1
- package/dist/internal/direct-mcp-v2/compiler.js +1 -1
- package/dist/internal/direct-mcp-v2/json.d.ts +0 -2
- package/dist/internal/direct-mcp-v2/json.js +2 -2
- package/dist/internal/direct-mcp-v2/runtime-lock.d.ts +2 -1
- package/dist/internal/direct-mcp-v2/runtime-profile.d.ts +0 -1
- package/dist/internal/direct-mcp-v2/runtime-profile.js +1 -1
- package/dist/internal/direct-mcp-v2/types.d.ts +5 -4
- package/dist/providers/mcp-config.d.ts +0 -2
- package/dist/providers/mcp-config.js +2 -2
- package/dist/providers/mcp-runtime-mounting.d.ts +1 -9
- package/dist/providers/sandbox-lifecycle.d.ts +0 -2
- package/dist/providers/sandbox-lifecycle.js +2 -2
- package/dist/providers/scripted-mcp-mock-host.d.ts +1 -1
- package/dist/providers/workspace.d.ts +0 -1
- package/dist/reporters/github-comment.d.ts +0 -11
- package/dist/reporters/github-comment.js +1 -1
- package/dist/reporters/verbose-emitter.d.ts +7 -19
- package/dist/reporters/verbose-emitter.js +5 -5
- package/dist/reporting/comparison-contract.d.ts +10 -0
- package/dist/reporting/comparison-contract.js +127 -0
- package/dist/reporting/core.js +14 -1
- package/dist/reporting/report-parser.d.ts +2 -0
- package/dist/reporting/report-parser.js +112 -0
- package/dist/reporting/source-metadata.d.ts +5 -0
- package/dist/reporting/source-metadata.js +20 -0
- package/dist/reporting/types.d.ts +6 -1
- package/dist/runners/adapter-loader.d.ts +0 -3
- package/dist/runners/model-builders.d.ts +3 -1
- package/dist/runners/model-builders.js +19 -7
- package/dist/runners/model-validation.d.ts +2 -1
- package/dist/runners/model.d.ts +4 -0
- package/dist/runners/repeated-attempts.d.ts +0 -5
- package/dist/runners/repeated-attempts.js +1 -1
- package/dist/runners/report-projection.js +15 -1
- package/dist/runners/vitest-adapter.js +9 -3
- package/dist/runners/vitest-invocation.d.ts +2 -2
- package/dist/runners/vitest-invocation.js +1 -1
- package/dist/runners/vitest-lifecycle.d.ts +0 -2
- package/dist/runners/vitest-lifecycle.js +1 -1
- package/dist/sdk/ask-bus/handler.d.ts +3 -2
- package/dist/sdk/diagnostics.d.ts +4 -3
- package/dist/sdk/evaluate.js +5 -0
- package/dist/sdk/index.d.ts +2 -0
- package/dist/sdk/index.js +1 -0
- package/dist/sdk/judge-tool-runner.d.ts +1 -2
- package/dist/sdk/lifecycle.js +1 -0
- package/dist/sdk/mcp-mock-approvals.d.ts +3 -2
- package/dist/sdk/reaction-loader.d.ts +1 -2
- package/dist/sdk/reaction-preview.d.ts +1 -4
- package/dist/sdk/reaction-preview.js +3 -3
- package/dist/sdk/run-scorer.d.ts +1 -4
- package/dist/sdk/run-scorer.js +3 -3
- package/dist/sdk/runtime-policy.d.ts +0 -1
- package/dist/sdk/runtime-policy.js +1 -1
- package/dist/sdk/types.d.ts +3 -0
- package/dist/tool-events.d.ts +0 -1
- package/dist/tool-events.js +1 -1
- package/dist/types.d.ts +22 -26
- package/dist/types.js +1 -1
- package/dist/utils/cli.d.ts +0 -15
- package/dist/utils/cli.js +4 -4
- package/dist/utils/llm-mocks.d.ts +3 -2
- package/dist/utils/llm-providers/cli.d.ts +0 -1
- package/dist/utils/llm-providers/cli.js +1 -1
- package/dist/utils/llm-types.d.ts +4 -3
- package/dist/utils/llm.d.ts +2 -2
- package/dist/utils/llm.js +1 -1
- package/package.json +2 -2
|
@@ -2,9 +2,6 @@ import type { ResolvedPathgradeConfig } from '../config/pathgrade.js';
|
|
|
2
2
|
import { type SpawnVitest } from './vitest-invocation.js';
|
|
3
3
|
import type { RunnerAdapter } from './adapter.js';
|
|
4
4
|
import type { RunnerInvocationAdapter } from './invocation.js';
|
|
5
|
-
export interface ExternalAdapterFactoryInput {
|
|
6
|
-
config: ResolvedPathgradeConfig;
|
|
7
|
-
}
|
|
8
5
|
export declare function loadRunnerAdapter(input: {
|
|
9
6
|
adapterName?: string;
|
|
10
7
|
cwd?: string;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { ReportGroupInput } from '../reporting/types.js';
|
|
2
2
|
import type { AdapterRunHandle } from './adapter.js';
|
|
3
3
|
import type { NormalizedRunSnapshot } from './model.js';
|
|
4
|
-
export declare function buildNormalizedRunSnapshotFromReportGroups(run: AdapterRunHandle, groups: ReportGroupInput[]
|
|
4
|
+
export declare function buildNormalizedRunSnapshotFromReportGroups(run: AdapterRunHandle, groups: ReportGroupInput[], options?: {
|
|
5
|
+
cwd?: string;
|
|
6
|
+
}): NormalizedRunSnapshot;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { resolveSourceMetadata } from '../reporting/source-metadata.js';
|
|
2
|
+
export function buildNormalizedRunSnapshotFromReportGroups(run, groups, options = {}) {
|
|
3
|
+
const cwd = options.cwd ?? process.cwd();
|
|
2
4
|
return {
|
|
3
5
|
version: 1,
|
|
4
6
|
completeness: 'final',
|
|
@@ -12,12 +14,18 @@ export function buildNormalizedRunSnapshotFromReportGroups(run, groups) {
|
|
|
12
14
|
message: diagnostic.message,
|
|
13
15
|
})) } : {}),
|
|
14
16
|
},
|
|
15
|
-
units: groups.map((group, index) =>
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
units: groups.map((group, index) => {
|
|
18
|
+
const source = group.sourceFile && group.sourceRevision
|
|
19
|
+
? { sourceFile: group.sourceFile, sourceRevision: group.sourceRevision }
|
|
20
|
+
: resolveSourceMetadata(group.sourceFile ?? group.cases.map(testCase => testCase.filePath ?? testCase.sourceRef).find(Boolean), cwd);
|
|
21
|
+
return {
|
|
22
|
+
id: unitId(group.groupName, index),
|
|
23
|
+
runId: `${run.adapterName}:run`,
|
|
24
|
+
displayName: group.groupName,
|
|
25
|
+
...source,
|
|
26
|
+
groupingHints: [{ kind: 'suite', key: group.groupName, label: group.groupName, order: index }],
|
|
27
|
+
};
|
|
28
|
+
}),
|
|
21
29
|
cases: groups.flatMap((group, groupIndex) => group.cases.map((testCase, caseIndex) => {
|
|
22
30
|
const caseId = testCase.caseId ?? `${unitId(group.groupName, groupIndex)}:case-${caseIndex + 1}`;
|
|
23
31
|
const attemptId = `${caseId}:attempt-1`;
|
|
@@ -33,6 +41,10 @@ export function buildNormalizedRunSnapshotFromReportGroups(run, groups) {
|
|
|
33
41
|
: {}),
|
|
34
42
|
...(evaluation.recordedAt ? { recordedAt: evaluation.recordedAt } : {}),
|
|
35
43
|
...(evaluation.agent ? { agent: evaluation.agent } : {}),
|
|
44
|
+
...(evaluation.evaluationDefinitionKey
|
|
45
|
+
? { evaluationDefinitionKey: evaluation.evaluationDefinitionKey }
|
|
46
|
+
: {}),
|
|
47
|
+
...(evaluation.scorerRevision ? { scorerRevision: evaluation.scorerRevision } : {}),
|
|
36
48
|
}));
|
|
37
49
|
return {
|
|
38
50
|
id: caseId,
|
|
@@ -3,10 +3,11 @@ export interface NormalizedRunValidationResult {
|
|
|
3
3
|
ok: boolean;
|
|
4
4
|
errors: NormalizedRunValidationError[];
|
|
5
5
|
}
|
|
6
|
-
|
|
6
|
+
interface NormalizedRunValidationError {
|
|
7
7
|
path: string;
|
|
8
8
|
message: string;
|
|
9
9
|
}
|
|
10
10
|
export declare function validateNormalizedRunSnapshot(snapshot: NormalizedRunSnapshot, options: {
|
|
11
11
|
completeness: SnapshotCompleteness;
|
|
12
12
|
}): NormalizedRunValidationResult;
|
|
13
|
+
export {};
|
package/dist/runners/model.d.ts
CHANGED
|
@@ -25,6 +25,8 @@ export interface EvalUnitRecord {
|
|
|
25
25
|
id: string;
|
|
26
26
|
runId: string;
|
|
27
27
|
displayName: string;
|
|
28
|
+
sourceFile?: string;
|
|
29
|
+
sourceRevision?: string;
|
|
28
30
|
diagnostics?: Diagnostic[];
|
|
29
31
|
nativeReferences?: NativeReference[];
|
|
30
32
|
groupingHints?: GroupingHint[];
|
|
@@ -92,6 +94,8 @@ export interface EvaluationRecord {
|
|
|
92
94
|
scoringDurationMs?: number;
|
|
93
95
|
recordedAt?: string;
|
|
94
96
|
agent?: import('../sdk/types.js').AgentExecutionMetadata;
|
|
97
|
+
evaluationDefinitionKey?: string;
|
|
98
|
+
scorerRevision?: string;
|
|
95
99
|
}
|
|
96
100
|
export interface AssertionRecord {
|
|
97
101
|
id: string;
|
|
@@ -1,7 +1,2 @@
|
|
|
1
1
|
import type { NormalizedRunSnapshot } from './model.js';
|
|
2
|
-
export type RepeatAggregationFailure = 'incomplete_attempts' | 'case_identity_mismatch';
|
|
3
|
-
export declare class RepeatAggregationError extends Error {
|
|
4
|
-
readonly reason: RepeatAggregationFailure;
|
|
5
|
-
constructor(reason: RepeatAggregationFailure, message: string);
|
|
6
|
-
}
|
|
7
2
|
export declare function mergeRepeatedRunSnapshots(snapshots: readonly NormalizedRunSnapshot[]): NormalizedRunSnapshot;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createHash, randomUUID } from 'node:crypto';
|
|
2
2
|
import { validateNormalizedRunSnapshot } from './model-validation.js';
|
|
3
|
-
|
|
3
|
+
class RepeatAggregationError extends Error {
|
|
4
4
|
reason;
|
|
5
5
|
constructor(reason, message) {
|
|
6
6
|
super(message);
|
|
@@ -16,9 +16,15 @@ export function projectNormalizedRunSnapshotToReportInput(snapshot, options = {}
|
|
|
16
16
|
?? preferredGroupingLabel(unit?.groupingHints)
|
|
17
17
|
?? unit?.displayName;
|
|
18
18
|
const key = groupName ?? snapshot.model.run.adapterName;
|
|
19
|
-
const group = groups.get(key) ?? {
|
|
19
|
+
const group = groups.get(key) ?? {
|
|
20
|
+
groupName: key,
|
|
21
|
+
...(unit?.sourceFile ? { sourceFile: unit.sourceFile } : {}),
|
|
22
|
+
...(unit?.sourceRevision ? { sourceRevision: unit.sourceRevision } : {}),
|
|
23
|
+
cases: [],
|
|
24
|
+
};
|
|
20
25
|
group.cases.push({
|
|
21
26
|
caseId: runCase.id,
|
|
27
|
+
...(runCase.repeatKey ? { repeatKey: runCase.repeatKey } : {}),
|
|
22
28
|
name: runCase.name,
|
|
23
29
|
state: runCase.state,
|
|
24
30
|
...(runCase.state === 'skipped' || runCase.state === 'pending' ? { reportable: repeated || runCase.scoringPolicy.kind !== 'non-scoring' } : {}),
|
|
@@ -53,6 +59,10 @@ function projectedEvaluations(runCase, attemptEvaluations) {
|
|
|
53
59
|
...(evaluation.scoringDurationMs !== undefined ? { scoringDurationMs: evaluation.scoringDurationMs } : {}),
|
|
54
60
|
...(evaluation.recordedAt ? { recordedAt: evaluation.recordedAt } : {}),
|
|
55
61
|
...(evaluation.agent ? { agent: evaluation.agent } : {}),
|
|
62
|
+
...(evaluation.evaluationDefinitionKey
|
|
63
|
+
? { evaluationDefinitionKey: evaluation.evaluationDefinitionKey }
|
|
64
|
+
: {}),
|
|
65
|
+
...(evaluation.scorerRevision ? { scorerRevision: evaluation.scorerRevision } : {}),
|
|
56
66
|
}));
|
|
57
67
|
}
|
|
58
68
|
if (runCase.scoringPolicy.kind === 'score') {
|
|
@@ -70,6 +80,10 @@ function projectedEvaluations(runCase, attemptEvaluations) {
|
|
|
70
80
|
...(evaluation.scoringDurationMs !== undefined ? { scoringDurationMs: evaluation.scoringDurationMs } : {}),
|
|
71
81
|
...(evaluation.recordedAt ? { recordedAt: evaluation.recordedAt } : {}),
|
|
72
82
|
...(evaluation.agent ? { agent: evaluation.agent } : {}),
|
|
83
|
+
...(evaluation.evaluationDefinitionKey
|
|
84
|
+
? { evaluationDefinitionKey: evaluation.evaluationDefinitionKey }
|
|
85
|
+
: {}),
|
|
86
|
+
...(evaluation.scorerRevision ? { scorerRevision: evaluation.scorerRevision } : {}),
|
|
73
87
|
}];
|
|
74
88
|
}
|
|
75
89
|
function preferredGroupingLabel(hints) {
|
|
@@ -2,9 +2,11 @@ import { discoverPathgradeEvalFiles } from '../evals/discovery.js';
|
|
|
2
2
|
import { buildNormalizedRunSnapshotFromReportGroups } from './model-builders.js';
|
|
3
3
|
import { buildDiagnosticsReport } from '../sdk/diagnostics.js';
|
|
4
4
|
export function createVitestAdapter(options = {}) {
|
|
5
|
+
let discoveryCwd = process.cwd();
|
|
5
6
|
return {
|
|
6
7
|
name: 'vitest',
|
|
7
8
|
async discover(input) {
|
|
9
|
+
discoveryCwd = input.cwd;
|
|
8
10
|
const include = input.include ?? ['**/*.eval.ts'];
|
|
9
11
|
const exclude = input.exclude ?? [];
|
|
10
12
|
const files = discoverPathgradeEvalFiles({
|
|
@@ -28,11 +30,12 @@ export function createVitestAdapter(options = {}) {
|
|
|
28
30
|
exitCode: input.signal?.aborted ? 1 : 0,
|
|
29
31
|
native: {
|
|
30
32
|
testModules: options.testModules ?? [],
|
|
33
|
+
cwd: discoveryCwd,
|
|
31
34
|
},
|
|
32
35
|
};
|
|
33
36
|
},
|
|
34
37
|
async collectNormalizedRunSnapshot(run) {
|
|
35
|
-
return buildNormalizedRunSnapshotFromReportGroups(run, collectVitestReportGroups(readVitestRunNative(run).testModules));
|
|
38
|
+
return buildNormalizedRunSnapshotFromReportGroups(run, collectVitestReportGroups(readVitestRunNative(run).testModules), { cwd: readVitestRunNative(run).cwd });
|
|
36
39
|
},
|
|
37
40
|
};
|
|
38
41
|
}
|
|
@@ -56,12 +59,13 @@ export function collectVitestReportGroups(testModules) {
|
|
|
56
59
|
function readVitestRunNative(run) {
|
|
57
60
|
if (isVitestRunNative(run.native))
|
|
58
61
|
return run.native;
|
|
59
|
-
return { testModules: [] };
|
|
62
|
+
return { testModules: [], cwd: process.cwd() };
|
|
60
63
|
}
|
|
61
64
|
function isVitestRunNative(native) {
|
|
62
65
|
return typeof native === 'object'
|
|
63
66
|
&& native !== null
|
|
64
|
-
&& Array.isArray(native.testModules)
|
|
67
|
+
&& Array.isArray(native.testModules)
|
|
68
|
+
&& typeof native.cwd === 'string';
|
|
65
69
|
}
|
|
66
70
|
function getGroupName(testCase) {
|
|
67
71
|
const modulePath = testCase.module.relativeModuleId;
|
|
@@ -94,6 +98,8 @@ function toReportCaseInput(testCase, groupName) {
|
|
|
94
98
|
scoringDurationMs: entry.scoringDurationMs,
|
|
95
99
|
recordedAt: entry.recordedAt,
|
|
96
100
|
agent: entry.agent,
|
|
101
|
+
evaluationDefinitionKey: entry.evaluationDefinitionKey,
|
|
102
|
+
scorerRevision: entry.scorerRevision,
|
|
97
103
|
})),
|
|
98
104
|
diagnostics: normalized.diagnostics,
|
|
99
105
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { RunnerInvocationAdapter } from './invocation.js';
|
|
2
|
-
|
|
2
|
+
interface SpawnVitestRequest {
|
|
3
3
|
argv: string[];
|
|
4
4
|
env: NodeJS.ProcessEnv;
|
|
5
5
|
cwd: string;
|
|
@@ -8,4 +8,4 @@ export type SpawnVitest = (req: SpawnVitestRequest) => Promise<number> | number;
|
|
|
8
8
|
export declare function createVitestInvocationAdapter(input?: {
|
|
9
9
|
spawnVitest?: SpawnVitest;
|
|
10
10
|
}): RunnerInvocationAdapter;
|
|
11
|
-
export
|
|
11
|
+
export {};
|
|
@@ -47,7 +47,7 @@ async function defaultSpawnVitest(req) {
|
|
|
47
47
|
child.on('close', code => resolve(code ?? 0));
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
|
-
|
|
50
|
+
function resolveVitestCli(cwd) {
|
|
51
51
|
const requireFromCwd = createRequire(path.join(cwd, 'package.json'));
|
|
52
52
|
const packageJsonPath = requireFromCwd.resolve('vitest/package.json');
|
|
53
53
|
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { Agent, PathgradeTestMeta } from '../sdk/types.js';
|
|
2
2
|
import { type ResultObserverHandle } from '../sdk/result-capture.js';
|
|
3
3
|
import { type CaseContextProviderHandle } from '../sdk/case-context.js';
|
|
4
|
-
import { type LifecycleAgentOwner } from '../sdk/lifecycle.js';
|
|
5
4
|
import type { AdapterLifecycleHooks, EvalResultEvent } from './adapter.js';
|
|
6
5
|
export type VitestAfterEachFn = (fn: (ctx: {
|
|
7
6
|
task: {
|
|
@@ -31,7 +30,6 @@ export interface VitestLifecycleInstallHandle {
|
|
|
31
30
|
}
|
|
32
31
|
export declare function createVitestLifecycleHooks(): AdapterLifecycleHooks;
|
|
33
32
|
export declare function installVitestLifecycle(input: VitestLifecycleInstallInput): VitestLifecycleInstallHandle;
|
|
34
|
-
export declare function currentVitestAgentOwner(resultCaptureActive: boolean): LifecycleAgentOwner | null;
|
|
35
33
|
export declare function trackVitestAgent(agent: Agent, resultCaptureActive: boolean): void;
|
|
36
34
|
export declare function untrackVitestAgent(agent: Agent): void;
|
|
37
35
|
export declare function releaseVitestAgent(agent: Agent): void;
|
|
@@ -43,7 +43,7 @@ export function installVitestLifecycle(input) {
|
|
|
43
43
|
fileContextHandle.restore();
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
-
|
|
46
|
+
function currentVitestAgentOwner(resultCaptureActive) {
|
|
47
47
|
const current = getCurrentCaseContext();
|
|
48
48
|
if (current.status === 'active') {
|
|
49
49
|
return current.context.scope === 'runner-case'
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { AskHandler } from './types.js';
|
|
2
2
|
import type { AskUserReactionPreviewEntry, Reaction } from '../types.js';
|
|
3
|
-
|
|
3
|
+
type UnmatchedAskUserDisposition = 'error' | 'first-option' | 'decline';
|
|
4
4
|
export interface AskUserHandlerContext {
|
|
5
5
|
reactions: readonly Reaction[];
|
|
6
6
|
onUnmatchedAskUser: UnmatchedAskUserDisposition;
|
|
7
7
|
firedOnce: Set<number>;
|
|
8
8
|
}
|
|
9
|
-
|
|
9
|
+
interface AskUserUnmatchedSignal {
|
|
10
10
|
batchId: string;
|
|
11
11
|
turnNumber: number;
|
|
12
12
|
/**
|
|
@@ -29,3 +29,4 @@ export interface AskUserHandlerApi {
|
|
|
29
29
|
getUnmatchedError(): AskUserUnmatchedSignal | null;
|
|
30
30
|
}
|
|
31
31
|
export declare function createAskUserHandler(ctx: AskUserHandlerContext): AskUserHandlerApi;
|
|
32
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { LogEntry } from '../types.js';
|
|
2
2
|
import type { ReactionFiredEntry, TurnDetail } from './types.js';
|
|
3
3
|
import { type RuntimePolicyAuditEntry } from './runtime-policy.js';
|
|
4
|
-
|
|
4
|
+
interface DiagnosticsScorer {
|
|
5
5
|
name: string;
|
|
6
6
|
type: string;
|
|
7
7
|
score: number;
|
|
@@ -9,10 +9,10 @@ export interface DiagnosticsScorer {
|
|
|
9
9
|
details?: string;
|
|
10
10
|
status?: 'ok' | 'error' | 'skipped';
|
|
11
11
|
}
|
|
12
|
-
|
|
12
|
+
interface DiagnosticsTurnDetail extends TurnDetail {
|
|
13
13
|
apiRetries: number;
|
|
14
14
|
}
|
|
15
|
-
|
|
15
|
+
type DiagnosticsRuntimePolicyEntry = RuntimePolicyAuditEntry;
|
|
16
16
|
export interface DiagnosticsReport {
|
|
17
17
|
turns: number;
|
|
18
18
|
totalDurationMs: number;
|
|
@@ -39,3 +39,4 @@ export interface BuildDiagnosticsReportInput {
|
|
|
39
39
|
log: LogEntry[];
|
|
40
40
|
}
|
|
41
41
|
export declare function buildDiagnosticsReport(input: BuildDiagnosticsReportInput): DiagnosticsReport;
|
|
42
|
+
export {};
|
package/dist/sdk/evaluate.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { countShellCommandsFromLog, extractSkillsFromLog, extractToolEventsFromLog } from '../tool-events.js';
|
|
2
|
+
import { createScorerRevision } from '../reporting/comparison-contract.js';
|
|
2
3
|
import { getRuntime } from './eval-runtime.js';
|
|
3
4
|
import { emitEvalResult } from './result-capture.js';
|
|
4
5
|
import { runJudgePipeline } from './judge-pipeline.js';
|
|
@@ -73,6 +74,7 @@ function makeEvaluateAgent() {
|
|
|
73
74
|
: undefined;
|
|
74
75
|
if (isFirstEval)
|
|
75
76
|
conversationAttributed.add(agent);
|
|
77
|
+
const scorerRevision = createScorerRevision(scorers);
|
|
76
78
|
const recordedResult = {
|
|
77
79
|
...evalResult,
|
|
78
80
|
tokenUsage: deltaTokenUsage,
|
|
@@ -82,6 +84,7 @@ function makeEvaluateAgent() {
|
|
|
82
84
|
...(opts?.evaluationDefinitionKey
|
|
83
85
|
? { evaluationDefinitionKey: opts.evaluationDefinitionKey }
|
|
84
86
|
: {}),
|
|
87
|
+
...(scorerRevision ? { scorerRevision } : {}),
|
|
85
88
|
trial: buildTrialResult(agent.log, { ...evalResult, tokenUsage: deltaTokenUsage }, agent.scenarioEvidence, conversationTokens, conversationCost),
|
|
86
89
|
};
|
|
87
90
|
emitEvalResult({ result: recordedResult, agent });
|
|
@@ -120,6 +123,7 @@ async function fromSnapshot(snapshotPath, scorers, opts) {
|
|
|
120
123
|
};
|
|
121
124
|
const scoringStartedAt = performance.now();
|
|
122
125
|
const evalResult = await evaluateWithContext(ctx, scorers, { ...opts, llm: trackedLLM });
|
|
126
|
+
const scorerRevision = createScorerRevision(scorers);
|
|
123
127
|
const recordedResult = {
|
|
124
128
|
...evalResult,
|
|
125
129
|
resultKind: 'snapshot',
|
|
@@ -128,6 +132,7 @@ async function fromSnapshot(snapshotPath, scorers, opts) {
|
|
|
128
132
|
...(opts?.evaluationDefinitionKey
|
|
129
133
|
? { evaluationDefinitionKey: opts.evaluationDefinitionKey }
|
|
130
134
|
: {}),
|
|
135
|
+
...(scorerRevision ? { scorerRevision } : {}),
|
|
131
136
|
trial: buildTrialResult(snapshot.log, evalResult, snapshot.scenarioEvidence),
|
|
132
137
|
};
|
|
133
138
|
maybeThrowOnScorerErrors(recordedResult, opts?.onScorerError ?? 'skip');
|
package/dist/sdk/index.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ export { DEFAULT_COPY_IGNORE } from '../providers/copy-filter.js';
|
|
|
21
21
|
export { extractToolEventsFromLog } from '../tool-events.js';
|
|
22
22
|
export { collectSensitiveEnvValues, sanitizePersistenceValue, } from '../tool-event-results.js';
|
|
23
23
|
export { parseEnvFile } from '../utils/env.js';
|
|
24
|
+
export { parsePathgradeReport } from '../reporting/report-parser.js';
|
|
24
25
|
export { createAskBus, requireAskBusForLiveBatches, AskBusTimeoutError } from './ask-bus/bus.js';
|
|
25
26
|
export { toAskUserToolEvent } from './ask-bus/projection.js';
|
|
26
27
|
export type { AskUserToolEvent, AskUserToolEventArguments, AskUserToolEventQuestionArgument, } from './ask-bus/projection.js';
|
|
@@ -40,6 +41,7 @@ export type { DiagnosticsReport } from './diagnostics.js';
|
|
|
40
41
|
export type { ExpectedMcpStartupStatus, ExpectedMcpToolCall, McpStartupStatusEvidence, McpToolCallEvidence, McpApprovalEvidence, ExpectedMcpApproval, McpInvocationResult, } from './mcp-evidence.js';
|
|
41
42
|
export type { McpPolicyDenialReason, McpToolCallRequest, McpToolPolicyDecision, } from './mcp-safety.js';
|
|
42
43
|
export type { ToolEvent, McpToolCallClassification } from '../tool-events.js';
|
|
44
|
+
export type { ComparisonContract, ComparisonUnavailableReason, PathgradeGroupReport, PathgradeReport, StrippedTrialResult, } from '../types.js';
|
|
43
45
|
export type { LLMPort, EvalRuntime } from './eval-runtime.js';
|
|
44
46
|
export { createAgentLLM, createLLMClient, ProviderNotSupportedError } from '../utils/llm.js';
|
|
45
47
|
export type { CreateLLMClientOptions, LLMProviderAdapter, TokenUsage as LLMTokenUsage } from '../utils/llm.js';
|
package/dist/sdk/index.js
CHANGED
|
@@ -19,6 +19,7 @@ export { DEFAULT_COPY_IGNORE } from '../providers/copy-filter.js';
|
|
|
19
19
|
export { extractToolEventsFromLog } from '../tool-events.js';
|
|
20
20
|
export { collectSensitiveEnvValues, sanitizePersistenceValue, } from '../tool-event-results.js';
|
|
21
21
|
export { parseEnvFile } from '../utils/env.js';
|
|
22
|
+
export { parsePathgradeReport } from '../reporting/report-parser.js';
|
|
22
23
|
export { createAskBus, requireAskBusForLiveBatches, AskBusTimeoutError } from './ask-bus/bus.js';
|
|
23
24
|
export { toAskUserToolEvent } from './ask-bus/projection.js';
|
|
24
25
|
export { buildAskBatchLogEntries } from './agent-result-log.js';
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { ToolCapableLLMPort } from '../utils/llm-types.js';
|
|
2
2
|
import type { JudgeScorer, ScorerContext, ScorerResultEntry, TokenUsage } from './types.js';
|
|
3
|
-
import { type
|
|
4
|
-
export type { JudgeErrorCode, JudgeToolCallRecord };
|
|
3
|
+
import { type JudgeToolCallRecord, type ToolExecutor } from './judge-tool-session.js';
|
|
5
4
|
export interface RunJudgeWithToolsResult {
|
|
6
5
|
entry: ScorerResultEntry;
|
|
7
6
|
rounds: number;
|
package/dist/sdk/lifecycle.js
CHANGED
|
@@ -81,6 +81,7 @@ function recordResult(result, agent, attribution) {
|
|
|
81
81
|
...(result.evaluationDefinitionKey
|
|
82
82
|
? { evaluationDefinitionKey: result.evaluationDefinitionKey }
|
|
83
83
|
: {}),
|
|
84
|
+
...(result.scorerRevision ? { scorerRevision: result.scorerRevision } : {}),
|
|
84
85
|
trial: result.trial,
|
|
85
86
|
resultKind: result.resultKind ?? 'evaluated',
|
|
86
87
|
...(result.scoringDurationMs !== undefined
|
|
@@ -9,7 +9,7 @@ export interface McpMockApprovalRule {
|
|
|
9
9
|
decision: 'approve' | 'deny';
|
|
10
10
|
label?: string;
|
|
11
11
|
}
|
|
12
|
-
|
|
12
|
+
interface CompiledMcpTool {
|
|
13
13
|
name: string;
|
|
14
14
|
description?: string;
|
|
15
15
|
inputSchema: Record<string, unknown>;
|
|
@@ -19,7 +19,7 @@ export interface CompiledMcpTool {
|
|
|
19
19
|
response: McpMockJsonValue;
|
|
20
20
|
}>[];
|
|
21
21
|
}
|
|
22
|
-
|
|
22
|
+
interface CompiledMcpServer {
|
|
23
23
|
name: string;
|
|
24
24
|
instructions?: string;
|
|
25
25
|
tools: ReadonlyMap<string, CompiledMcpTool>;
|
|
@@ -38,3 +38,4 @@ export declare function matchesMcpApprovalArguments(actual: Record<string, McpMo
|
|
|
38
38
|
export declare function canonicalizeMcpArguments(value: McpMockJsonValue): string;
|
|
39
39
|
export declare function createMcpArgumentDigest(key: Buffer, value: McpMockJsonValue): string;
|
|
40
40
|
export declare function createMcpReceiptKey(): Buffer;
|
|
41
|
+
export {};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Message, Reaction } from './types.js';
|
|
2
2
|
export declare function loadReactionSnapshotMessages(snapshotPath: string): Promise<Message[]>;
|
|
3
3
|
export declare function loadReactionsFromFile(filePath: string): Promise<Reaction[]>;
|
|
4
|
-
export type { AskUserOption, AskUserQuestion, AskUserReaction, TextReaction };
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare function isAskUserReaction(reaction: Reaction): reaction is AskUserReaction;
|
|
3
|
-
export declare function isTextReaction(reaction: Reaction): reaction is TextReaction;
|
|
1
|
+
import type { Message, Reaction, ReactionPreviewEntry, ReactionPreviewResult } from './types.js';
|
|
4
2
|
export declare function inspectReactions(agentMessage: string, reactions: Reaction[], firedOnce: Set<number>): ReactionPreviewEntry[];
|
|
5
|
-
export declare function pickReactionReply(agentMessage: string, reactions: Reaction[], firedOnce: Set<number>): string | null;
|
|
6
3
|
export declare function previewReactions(messages: Message[], reactions: Reaction[]): ReactionPreviewResult;
|
|
@@ -20,10 +20,10 @@ function testUnless(pattern, input) {
|
|
|
20
20
|
return false;
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
-
|
|
23
|
+
function isAskUserReaction(reaction) {
|
|
24
24
|
return 'whenAsked' in reaction;
|
|
25
25
|
}
|
|
26
|
-
|
|
26
|
+
function isTextReaction(reaction) {
|
|
27
27
|
return 'when' in reaction;
|
|
28
28
|
}
|
|
29
29
|
export function inspectReactions(agentMessage, reactions, firedOnce) {
|
|
@@ -71,7 +71,7 @@ export function inspectReactions(agentMessage, reactions, firedOnce) {
|
|
|
71
71
|
};
|
|
72
72
|
});
|
|
73
73
|
}
|
|
74
|
-
|
|
74
|
+
function pickReactionReply(agentMessage, reactions, firedOnce) {
|
|
75
75
|
const evaluations = inspectReactions(agentMessage, reactions, firedOnce);
|
|
76
76
|
const match = evaluations.find((evaluation) => evaluation.fired && evaluation.kind === 'text');
|
|
77
77
|
return match && match.kind === 'text' ? match.reply ?? null : null;
|
package/dist/sdk/run-scorer.d.ts
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import type { LLMPort } from '../utils/llm-types.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { Scorer, ScorerContext, ScorerResultEntry } from './types.js';
|
|
3
3
|
export interface RunScorerOptions {
|
|
4
4
|
/** Required for `judge` scorers; ignored for other types. */
|
|
5
5
|
llm?: LLMPort;
|
|
6
6
|
}
|
|
7
7
|
export declare function runScorer(scorer: Scorer, ctx: ScorerContext, opts?: RunScorerOptions): Promise<ScorerResultEntry>;
|
|
8
|
-
export declare function runCheckScorer(scorer: CheckScorer, ctx: ScorerContext): Promise<ScorerResultEntry>;
|
|
9
|
-
export declare function runScoreScorer(scorer: ScoreScorer, ctx: ScorerContext): Promise<ScorerResultEntry>;
|
|
10
|
-
export declare function runToolUsageScorer(scorer: ToolUsageScorer, ctx: ScorerContext): Promise<ScorerResultEntry>;
|
package/dist/sdk/run-scorer.js
CHANGED
|
@@ -43,7 +43,7 @@ function buildEntryFromOutcome(scorer, outcome) {
|
|
|
43
43
|
errorCode: outcome.code,
|
|
44
44
|
};
|
|
45
45
|
}
|
|
46
|
-
|
|
46
|
+
async function runCheckScorer(scorer, ctx) {
|
|
47
47
|
try {
|
|
48
48
|
const passed = await scorer.fn(ctx);
|
|
49
49
|
return {
|
|
@@ -59,7 +59,7 @@ export async function runCheckScorer(scorer, ctx) {
|
|
|
59
59
|
return makeErroredResult('check', scorer.name, scorer.weight, error);
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
|
-
|
|
62
|
+
async function runScoreScorer(scorer, ctx) {
|
|
63
63
|
try {
|
|
64
64
|
const raw = await scorer.fn(ctx);
|
|
65
65
|
if (typeof raw === 'number') {
|
|
@@ -84,7 +84,7 @@ export async function runScoreScorer(scorer, ctx) {
|
|
|
84
84
|
return makeErroredResult('score', scorer.name, scorer.weight, error);
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
|
-
|
|
87
|
+
async function runToolUsageScorer(scorer, ctx) {
|
|
88
88
|
try {
|
|
89
89
|
const toolEvents = ctx.toolEvents;
|
|
90
90
|
if (toolEvents.length === 0) {
|
|
@@ -15,7 +15,6 @@ export interface RuntimePolicyAuditEntry {
|
|
|
15
15
|
export declare const NONINTERACTIVE_RUNTIME_POLICY: RuntimePolicyDescriptor;
|
|
16
16
|
export declare function planRuntimePolicies(agent: AgentName, transport?: AgentTransport): RuntimePolicyDescriptor[];
|
|
17
17
|
export declare function renderRuntimePolicy(policy: RuntimePolicyDescriptor, context: RuntimePolicyRenderContext): string;
|
|
18
|
-
export declare function renderRuntimePolicies(policies: RuntimePolicyDescriptor[], context: RuntimePolicyRenderContext): string;
|
|
19
18
|
export declare function prependRuntimePolicies(instruction: string, policies: RuntimePolicyDescriptor[], context: RuntimePolicyRenderContext): string;
|
|
20
19
|
export declare function getRuntimePolicyLogMetadata(turnResult: AgentTurnResult): Record<string, unknown>;
|
|
21
20
|
export declare function extractRuntimePolicyAuditEntries(log: LogEntry[]): RuntimePolicyAuditEntry[];
|
|
@@ -32,7 +32,7 @@ export function renderRuntimePolicy(policy, context) {
|
|
|
32
32
|
'Ask only the earliest outstanding approval checkpoint.',
|
|
33
33
|
].join('\n');
|
|
34
34
|
}
|
|
35
|
-
|
|
35
|
+
function renderRuntimePolicies(policies, context) {
|
|
36
36
|
return policies
|
|
37
37
|
.map((policy) => renderRuntimePolicy(policy, context))
|
|
38
38
|
.filter((policy) => policy.length > 0)
|
package/dist/sdk/types.d.ts
CHANGED
|
@@ -372,6 +372,8 @@ export interface RecordedEvalResult extends Omit<EvalResult, 'score'> {
|
|
|
372
372
|
scoringDurationMs?: number;
|
|
373
373
|
recordedAt?: string;
|
|
374
374
|
evaluationDefinitionKey?: string;
|
|
375
|
+
/** Privacy-safe revision of the declared scorers used by this evaluation. */
|
|
376
|
+
scorerRevision?: string;
|
|
375
377
|
}
|
|
376
378
|
export type EvaluationResultKind = 'evaluated' | 'synthetic_no_evaluation' | 'snapshot';
|
|
377
379
|
export interface ScorerResultEntry {
|
|
@@ -393,6 +395,7 @@ export interface PathgradeTestMeta {
|
|
|
393
395
|
scorers: ScorerResultEntry[];
|
|
394
396
|
/** Stable identity for this evaluation definition across separate runs. */
|
|
395
397
|
evaluationDefinitionKey?: string;
|
|
398
|
+
scorerRevision?: string;
|
|
396
399
|
trial?: TrialResult;
|
|
397
400
|
diagnostics?: DiagnosticsReport;
|
|
398
401
|
resultKind?: EvaluationResultKind;
|
package/dist/tool-events.d.ts
CHANGED
|
@@ -44,7 +44,6 @@ export interface ToolEventResult {
|
|
|
44
44
|
exitCode?: number;
|
|
45
45
|
truncated?: boolean;
|
|
46
46
|
}
|
|
47
|
-
export declare function summarizeToolEvents(events: ToolEvent[]): string;
|
|
48
47
|
/**
|
|
49
48
|
* Map from provider-specific tool names to normalized Pathgrade actions.
|
|
50
49
|
* Conservative: only map names we're confident about.
|
package/dist/tool-events.js
CHANGED