veryfront 0.1.874 → 0.1.876
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/esm/deno.d.ts +2 -0
- package/esm/deno.js +3 -1
- package/esm/src/agent/testing/agent-tester.d.ts +53 -0
- package/esm/src/agent/testing/agent-tester.d.ts.map +1 -0
- package/esm/src/agent/testing/agent-tester.js +132 -0
- package/esm/src/agent/testing/durable-run-canaries/cli-runner.d.ts +21 -0
- package/esm/src/agent/testing/durable-run-canaries/cli-runner.d.ts.map +1 -0
- package/esm/src/agent/testing/durable-run-canaries/cli-runner.js +66 -0
- package/esm/src/agent/testing/durable-run-canaries/environment.d.ts +14 -0
- package/esm/src/agent/testing/durable-run-canaries/environment.d.ts.map +1 -0
- package/esm/src/agent/testing/durable-run-canaries/environment.js +15 -0
- package/esm/src/agent/testing/durable-run-canaries/index.d.ts +5 -0
- package/esm/src/agent/testing/durable-run-canaries/index.d.ts.map +1 -0
- package/esm/src/agent/testing/durable-run-canaries/index.js +4 -0
- package/esm/src/agent/testing/durable-run-canaries/runner.d.ts +118 -0
- package/esm/src/agent/testing/durable-run-canaries/runner.d.ts.map +1 -0
- package/esm/src/agent/testing/durable-run-canaries/runner.js +391 -0
- package/esm/src/agent/testing/durable-run-canaries/validation.d.ts +12 -0
- package/esm/src/agent/testing/durable-run-canaries/validation.d.ts.map +1 -0
- package/esm/src/agent/testing/durable-run-canaries/validation.js +71 -0
- package/esm/src/agent/testing/index.d.ts +10 -0
- package/esm/src/agent/testing/index.d.ts.map +1 -0
- package/esm/src/agent/testing/index.js +9 -0
- package/esm/src/agent/testing/live-evals/api-client.d.ts +102 -0
- package/esm/src/agent/testing/live-evals/api-client.d.ts.map +1 -0
- package/esm/src/agent/testing/live-evals/api-client.js +313 -0
- package/esm/src/agent/testing/live-evals/cli-runner.d.ts +40 -0
- package/esm/src/agent/testing/live-evals/cli-runner.d.ts.map +1 -0
- package/esm/src/agent/testing/live-evals/cli-runner.js +144 -0
- package/esm/src/agent/testing/live-evals/environment.d.ts +15 -0
- package/esm/src/agent/testing/live-evals/environment.d.ts.map +1 -0
- package/esm/src/agent/testing/live-evals/environment.js +20 -0
- package/esm/src/agent/testing/live-evals/formatting.d.ts +15 -0
- package/esm/src/agent/testing/live-evals/formatting.d.ts.map +1 -0
- package/esm/src/agent/testing/live-evals/formatting.js +75 -0
- package/esm/src/agent/testing/live-evals/index.d.ts +12 -0
- package/esm/src/agent/testing/live-evals/index.d.ts.map +1 -0
- package/esm/src/agent/testing/live-evals/index.js +11 -0
- package/esm/src/agent/testing/live-evals/metadata.d.ts +34 -0
- package/esm/src/agent/testing/live-evals/metadata.d.ts.map +1 -0
- package/esm/src/agent/testing/live-evals/metadata.js +116 -0
- package/esm/src/agent/testing/live-evals/performance.d.ts +19 -0
- package/esm/src/agent/testing/live-evals/performance.d.ts.map +1 -0
- package/esm/src/agent/testing/live-evals/performance.js +22 -0
- package/esm/src/agent/testing/live-evals/preflight.d.ts +12 -0
- package/esm/src/agent/testing/live-evals/preflight.d.ts.map +1 -0
- package/esm/src/agent/testing/live-evals/preflight.js +27 -0
- package/esm/src/agent/testing/live-evals/report.d.ts +55 -0
- package/esm/src/agent/testing/live-evals/report.d.ts.map +1 -0
- package/esm/src/agent/testing/live-evals/report.js +79 -0
- package/esm/src/agent/testing/live-evals/request.d.ts +31 -0
- package/esm/src/agent/testing/live-evals/request.d.ts.map +1 -0
- package/esm/src/agent/testing/live-evals/request.js +48 -0
- package/esm/src/agent/testing/live-evals/result.d.ts +56 -0
- package/esm/src/agent/testing/live-evals/result.d.ts.map +1 -0
- package/esm/src/agent/testing/live-evals/result.js +36 -0
- package/esm/src/agent/testing/live-evals/runner.d.ts +135 -0
- package/esm/src/agent/testing/live-evals/runner.d.ts.map +1 -0
- package/esm/src/agent/testing/live-evals/runner.js +396 -0
- package/esm/src/chat/message-prep.d.ts.map +1 -1
- package/esm/src/chat/message-prep.js +37 -3
- package/esm/src/integrations/_data.d.ts.map +1 -1
- package/esm/src/integrations/_data.js +99 -22
- package/esm/src/integrations/_tool_summaries.d.ts.map +1 -1
- package/esm/src/integrations/_tool_summaries.js +76 -16
- package/esm/src/integrations/schema.d.ts +18 -0
- package/esm/src/integrations/schema.d.ts.map +1 -1
- package/esm/src/integrations/schema.js +3 -1
- package/esm/src/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/package.json +5 -1
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { type AgUiSseProgressSnapshot as EvalProgressSnapshot, type ParsedAgUiSseRun as ParsedRun } from "../../index.js";
|
|
2
|
+
import { type LiveEvalRuntime } from "./performance.js";
|
|
3
|
+
import { type LiveEvalCaseMetadata } from "./report.js";
|
|
4
|
+
import { type LiveEvalResultRecord } from "./result.js";
|
|
5
|
+
/** Input payload for prepared live eval. */
|
|
6
|
+
export interface PreparedLiveEvalInput {
|
|
7
|
+
prompt?: string;
|
|
8
|
+
metadata?: Record<string, string>;
|
|
9
|
+
verificationContext?: LiveEvalContext;
|
|
10
|
+
cleanup?: () => Promise<void>;
|
|
11
|
+
startSidecar?: () => Promise<(() => Promise<void>) | void>;
|
|
12
|
+
}
|
|
13
|
+
/** Context for live eval. */
|
|
14
|
+
export interface LiveEvalContext {
|
|
15
|
+
apiUrl: string;
|
|
16
|
+
authToken: string;
|
|
17
|
+
projectId: string | null;
|
|
18
|
+
}
|
|
19
|
+
/** Public API contract for live eval case. */
|
|
20
|
+
export interface LiveEvalCase {
|
|
21
|
+
readonly id: string;
|
|
22
|
+
readonly label: string;
|
|
23
|
+
readonly prompt?: string;
|
|
24
|
+
allowedTools?: string[];
|
|
25
|
+
forceRuntimeOverrides?: boolean;
|
|
26
|
+
requireProject?: boolean;
|
|
27
|
+
maxSteps?: number;
|
|
28
|
+
expectedEventSubsequence?: string[];
|
|
29
|
+
metadata?: LiveEvalCaseMetadata;
|
|
30
|
+
prepare?: (context: LiveEvalContext) => Promise<PreparedLiveEvalInput>;
|
|
31
|
+
verify: (run: ParsedRun, prepared: PreparedLiveEvalInput | null) => string | null | Promise<string | null>;
|
|
32
|
+
}
|
|
33
|
+
interface FileCheckInput {
|
|
34
|
+
filePath: string;
|
|
35
|
+
requiredContent?: string[];
|
|
36
|
+
description?: string;
|
|
37
|
+
}
|
|
38
|
+
/** Public API contract for live eval project file. */
|
|
39
|
+
export interface LiveEvalProjectFile {
|
|
40
|
+
path: string;
|
|
41
|
+
content: string;
|
|
42
|
+
}
|
|
43
|
+
/** Input payload for live eval project file reader. */
|
|
44
|
+
export interface LiveEvalProjectFileReaderInput {
|
|
45
|
+
filePath: string;
|
|
46
|
+
requestTimeoutMs: number;
|
|
47
|
+
}
|
|
48
|
+
/** Configuration used by live eval runner. */
|
|
49
|
+
export interface LiveEvalRunnerConfig {
|
|
50
|
+
endpoint: string;
|
|
51
|
+
authToken: string;
|
|
52
|
+
apiUrl: string;
|
|
53
|
+
projectId: string | null;
|
|
54
|
+
branchId: string | null;
|
|
55
|
+
model: string | null;
|
|
56
|
+
requestTimeoutMs: number;
|
|
57
|
+
progressLogIntervalMs: number;
|
|
58
|
+
enableLlmJudge: boolean;
|
|
59
|
+
fetch?: (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
|
|
60
|
+
log?: (message: string) => void;
|
|
61
|
+
readProjectFile?: (input: LiveEvalProjectFileReaderInput) => Promise<LiveEvalProjectFile | null>;
|
|
62
|
+
}
|
|
63
|
+
interface LiveEvalJudgeInput {
|
|
64
|
+
question: string;
|
|
65
|
+
criteria: string;
|
|
66
|
+
}
|
|
67
|
+
interface LiveEvalJudgeRequest extends LiveEvalJudgeInput {
|
|
68
|
+
answer: string;
|
|
69
|
+
}
|
|
70
|
+
interface LiveEvalJudgeResult {
|
|
71
|
+
pass: boolean;
|
|
72
|
+
reason: string;
|
|
73
|
+
}
|
|
74
|
+
declare function collectPreparedArtifactPaths(prepared: PreparedLiveEvalInput | null): string[];
|
|
75
|
+
interface LiveEvalResultContext {
|
|
76
|
+
id: string;
|
|
77
|
+
label: string;
|
|
78
|
+
runtime: LiveEvalRuntime;
|
|
79
|
+
startedAt: number;
|
|
80
|
+
conversationId?: string | null;
|
|
81
|
+
artifactPaths?: string[];
|
|
82
|
+
}
|
|
83
|
+
interface LiveEvalRunArtifactsInput {
|
|
84
|
+
run: ParsedRun;
|
|
85
|
+
runId?: string;
|
|
86
|
+
traceSignature: string;
|
|
87
|
+
}
|
|
88
|
+
interface LiveEvalRunArtifacts {
|
|
89
|
+
runId?: string;
|
|
90
|
+
traceSignature: string;
|
|
91
|
+
toolStarts: string[];
|
|
92
|
+
toolArgsPreview: string;
|
|
93
|
+
textPreview: string;
|
|
94
|
+
}
|
|
95
|
+
declare function createLiveEvalRunArtifacts(input: LiveEvalRunArtifactsInput): LiveEvalRunArtifacts;
|
|
96
|
+
declare function createFailedRunEvalResult(input: {
|
|
97
|
+
details: string;
|
|
98
|
+
context: LiveEvalResultContext;
|
|
99
|
+
runArtifacts: LiveEvalRunArtifacts;
|
|
100
|
+
}): LiveEvalResultRecord;
|
|
101
|
+
declare function createPassedRunEvalResult(input: {
|
|
102
|
+
details: string;
|
|
103
|
+
context: LiveEvalResultContext;
|
|
104
|
+
runArtifacts: LiveEvalRunArtifacts;
|
|
105
|
+
}): LiveEvalResultRecord;
|
|
106
|
+
declare function createStreamingFailureEvalResult(input: {
|
|
107
|
+
details: string;
|
|
108
|
+
context: LiveEvalResultContext;
|
|
109
|
+
progress: EvalProgressSnapshot;
|
|
110
|
+
}): LiveEvalResultRecord;
|
|
111
|
+
declare function extractRunId(run: ParsedRun): string | null;
|
|
112
|
+
/** Check whether finished is present. */
|
|
113
|
+
export declare function hasFinished(run: ParsedRun): boolean;
|
|
114
|
+
/** Contains skill load helper. */
|
|
115
|
+
export declare function containsSkillLoad(run: ParsedRun, skillId: string): boolean;
|
|
116
|
+
/** Count step started events helper. */
|
|
117
|
+
export declare function countStepStartedEvents(run: ParsedRun): number;
|
|
118
|
+
/** Create live eval case support. */
|
|
119
|
+
export declare function createLiveEvalCaseSupport(config: LiveEvalRunnerConfig): {
|
|
120
|
+
runEval: (testCase: LiveEvalCase, runtime: LiveEvalRuntime) => Promise<LiveEvalResultRecord>;
|
|
121
|
+
verifyFileExists: (input: FileCheckInput) => Promise<string | null>;
|
|
122
|
+
withJudge: (structuralVerify: (run: ParsedRun) => string | null, judgeInput: LiveEvalJudgeInput) => (run: ParsedRun) => Promise<string | null>;
|
|
123
|
+
judgeLlm: (input: LiveEvalJudgeRequest) => Promise<LiveEvalJudgeResult>;
|
|
124
|
+
};
|
|
125
|
+
/** White-box helpers used by live eval runner tests. */
|
|
126
|
+
export declare const liveEvalRunnerInternals: {
|
|
127
|
+
collectPreparedArtifactPaths: typeof collectPreparedArtifactPaths;
|
|
128
|
+
createFailedRunEvalResult: typeof createFailedRunEvalResult;
|
|
129
|
+
createLiveEvalRunArtifacts: typeof createLiveEvalRunArtifacts;
|
|
130
|
+
createPassedRunEvalResult: typeof createPassedRunEvalResult;
|
|
131
|
+
createStreamingFailureEvalResult: typeof createStreamingFailureEvalResult;
|
|
132
|
+
extractRunId: typeof extractRunId;
|
|
133
|
+
};
|
|
134
|
+
export {};
|
|
135
|
+
//# sourceMappingURL=runner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../../../../src/src/agent/testing/live-evals/runner.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,uBAAuB,IAAI,oBAAoB,EAIpD,KAAK,gBAAgB,IAAI,SAAS,EACnC,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAExD,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAIL,KAAK,oBAAoB,EAC1B,MAAM,aAAa,CAAC;AAErB,4CAA4C;AAC5C,MAAM,WAAW,qBAAqB;IACpC,MAAM,CAAC,EAAE,MAAM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EnD;AAED,kCAAkC;AAClC,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAE1E;AAED,wCAAwC;AACxC,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,SAAS,GAAG,MAAM,CAE7D;AAED,qCAAqC;AACrC,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,oBAAoB,GAAG;IACvE,OAAO,EAAE,CAAC,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,eAAe,KAAK,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAC7F,gBAAgB,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACpE,SAAS,EAAE,CACT,gBAAgB,EAAE,CAAC,GAAG,EAAE,SAAS,KAAK,MAAM,GAAG,IAAI,EACnD,UAAU,EAAE,kBAAkB,KAC3B,CAAC,GAAG,EAAE,SAAS,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAChD,QAAQ,EAAE,CAAC,KAAK,EAAE,oBAAoB,KAAK,OAAO,CAAC,mBAAmB,CAAC,CAAC;CACzE,CAoIA;AAED,wDAAwD;AACxD,eAAO,MAAM,uBAAuB;;;;;;;CAOnC,CAAC"}
|
|
@@ -0,0 +1,396 @@
|
|
|
1
|
+
import * as dntShim from "../../../../_dnt.shims.js";
|
|
2
|
+
import { agUiSseEventTypes, buildAgUiSseTraceSignature as buildTraceSignature, getAgUiSseStringField as getStringField, parseAgUiSseResponse as parseSseResponse, } from "../../index.js";
|
|
3
|
+
import { buildFailureSuffix, buildProgressLine, containsOrderedSubsequence } from "./formatting.js";
|
|
4
|
+
import { buildLiveEvalRequestBody } from "./request.js";
|
|
5
|
+
import { createFailedEvalResult, createPassedEvalResult, createSkippedEvalResult, } from "./result.js";
|
|
6
|
+
function resolveFetch(config) {
|
|
7
|
+
return config.fetch ?? fetch;
|
|
8
|
+
}
|
|
9
|
+
function createLiveEvalJudgeSupport(config) {
|
|
10
|
+
async function judgeLlm(input) {
|
|
11
|
+
try {
|
|
12
|
+
const body = buildLiveEvalRequestBody({
|
|
13
|
+
testCaseId: "llm-judge",
|
|
14
|
+
prompt: `You are an eval judge. Grade the following answer.
|
|
15
|
+
|
|
16
|
+
QUESTION: ${input.question}
|
|
17
|
+
|
|
18
|
+
ANSWER: ${input.answer}
|
|
19
|
+
|
|
20
|
+
CRITERIA: ${input.criteria}
|
|
21
|
+
|
|
22
|
+
Respond with exactly one line: PASS or FAIL followed by a brief reason.
|
|
23
|
+
Example: "PASS — correctly explains the pattern with accurate details"
|
|
24
|
+
Example: "FAIL — mentions the wrong file convention"`,
|
|
25
|
+
projectId: null,
|
|
26
|
+
allowedTools: [],
|
|
27
|
+
forceRuntimeOverrides: true,
|
|
28
|
+
maxSteps: 2,
|
|
29
|
+
});
|
|
30
|
+
const response = await resolveFetch(config)(config.endpoint, {
|
|
31
|
+
method: "POST",
|
|
32
|
+
headers: {
|
|
33
|
+
"Content-Type": "application/json",
|
|
34
|
+
Authorization: `Bearer ${config.authToken}`,
|
|
35
|
+
},
|
|
36
|
+
body: JSON.stringify(body),
|
|
37
|
+
signal: AbortSignal.timeout(30_000),
|
|
38
|
+
});
|
|
39
|
+
const run = await parseSseResponse(response);
|
|
40
|
+
if (run.responseStatus !== 200) {
|
|
41
|
+
return { pass: false, reason: `judge returned HTTP ${run.responseStatus}` };
|
|
42
|
+
}
|
|
43
|
+
const line = run.text
|
|
44
|
+
.split("\n")
|
|
45
|
+
.map((value) => value.trim())
|
|
46
|
+
.find((value) => value.length > 0) ?? "";
|
|
47
|
+
if (line.toUpperCase().startsWith("PASS")) {
|
|
48
|
+
return { pass: true, reason: line };
|
|
49
|
+
}
|
|
50
|
+
return { pass: false, reason: line || "judge returned no decision" };
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
return {
|
|
54
|
+
pass: false,
|
|
55
|
+
reason: error instanceof Error ? error.message : String(error),
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
function withJudge(structuralVerify, judgeInput) {
|
|
60
|
+
return async (run) => {
|
|
61
|
+
const structuralFailure = structuralVerify(run);
|
|
62
|
+
if (structuralFailure) {
|
|
63
|
+
return structuralFailure;
|
|
64
|
+
}
|
|
65
|
+
if (!config.enableLlmJudge) {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
const judgment = await judgeLlm({
|
|
69
|
+
question: judgeInput.question,
|
|
70
|
+
answer: run.text,
|
|
71
|
+
criteria: judgeInput.criteria,
|
|
72
|
+
});
|
|
73
|
+
return judgment.pass ? null : `LLM judge: ${judgment.reason}`;
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
return {
|
|
77
|
+
judgeLlm,
|
|
78
|
+
withJudge,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
function createInitialProgressSnapshot() {
|
|
82
|
+
return {
|
|
83
|
+
eventCount: 0,
|
|
84
|
+
lastEventType: null,
|
|
85
|
+
lastToolCallName: null,
|
|
86
|
+
toolStarts: [],
|
|
87
|
+
textLength: 0,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
function isUnrefableTimer(value) {
|
|
91
|
+
return typeof value === "object" && value !== null && "unref" in value &&
|
|
92
|
+
typeof value.unref === "function";
|
|
93
|
+
}
|
|
94
|
+
function maybeUnrefTimer(timer) {
|
|
95
|
+
if (isUnrefableTimer(timer)) {
|
|
96
|
+
timer.unref();
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
function createLiveEvalProgressReporter(input) {
|
|
100
|
+
let latestProgress = createInitialProgressSnapshot();
|
|
101
|
+
const progressTimer = dntShim.setInterval(() => {
|
|
102
|
+
input.log(buildProgressLine({
|
|
103
|
+
caseId: input.caseId,
|
|
104
|
+
startedAt: input.startedAt,
|
|
105
|
+
progress: latestProgress,
|
|
106
|
+
}));
|
|
107
|
+
}, input.intervalMs);
|
|
108
|
+
maybeUnrefTimer(progressTimer);
|
|
109
|
+
return {
|
|
110
|
+
stop: () => {
|
|
111
|
+
clearInterval(progressTimer);
|
|
112
|
+
},
|
|
113
|
+
update: (snapshot) => {
|
|
114
|
+
latestProgress = snapshot;
|
|
115
|
+
},
|
|
116
|
+
getSnapshot: () => latestProgress,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
function collectPreparedArtifactPaths(prepared) {
|
|
120
|
+
if (!prepared?.metadata) {
|
|
121
|
+
return [];
|
|
122
|
+
}
|
|
123
|
+
return [
|
|
124
|
+
...new Set(Object.entries(prepared.metadata)
|
|
125
|
+
.filter(([key, value]) => key.toLowerCase().includes("path") && value.length > 0)
|
|
126
|
+
.map(([, value]) => value)),
|
|
127
|
+
].sort();
|
|
128
|
+
}
|
|
129
|
+
function extractPreparedConversationId(prepared) {
|
|
130
|
+
return typeof prepared?.metadata?.conversationId === "string" &&
|
|
131
|
+
prepared.metadata.conversationId.length > 0
|
|
132
|
+
? prepared.metadata.conversationId
|
|
133
|
+
: null;
|
|
134
|
+
}
|
|
135
|
+
function createLiveEvalRunArtifacts(input) {
|
|
136
|
+
return {
|
|
137
|
+
...(input.runId ? { runId: input.runId } : {}),
|
|
138
|
+
traceSignature: input.traceSignature,
|
|
139
|
+
toolStarts: input.run.toolStarts,
|
|
140
|
+
toolArgsPreview: input.run.toolArgs.join(" | ").slice(0, 1000),
|
|
141
|
+
textPreview: input.run.text.slice(0, 280),
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
function createFailedRunEvalResult(input) {
|
|
145
|
+
return createFailedEvalResult({
|
|
146
|
+
id: input.context.id,
|
|
147
|
+
label: input.context.label,
|
|
148
|
+
runtime: input.context.runtime,
|
|
149
|
+
details: input.details,
|
|
150
|
+
startedAt: input.context.startedAt,
|
|
151
|
+
...(input.context.conversationId ? { conversationId: input.context.conversationId } : {}),
|
|
152
|
+
...(input.runArtifacts.runId ? { runId: input.runArtifacts.runId } : {}),
|
|
153
|
+
...(input.context.artifactPaths?.length ? { artifactPaths: input.context.artifactPaths } : {}),
|
|
154
|
+
traceSignature: input.runArtifacts.traceSignature,
|
|
155
|
+
toolStarts: input.runArtifacts.toolStarts,
|
|
156
|
+
toolArgsPreview: input.runArtifacts.toolArgsPreview,
|
|
157
|
+
textPreview: input.runArtifacts.textPreview,
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
function createPassedRunEvalResult(input) {
|
|
161
|
+
return createPassedEvalResult({
|
|
162
|
+
id: input.context.id,
|
|
163
|
+
label: input.context.label,
|
|
164
|
+
runtime: input.context.runtime,
|
|
165
|
+
details: input.details,
|
|
166
|
+
startedAt: input.context.startedAt,
|
|
167
|
+
...(input.context.conversationId ? { conversationId: input.context.conversationId } : {}),
|
|
168
|
+
...(input.runArtifacts.runId ? { runId: input.runArtifacts.runId } : {}),
|
|
169
|
+
...(input.context.artifactPaths?.length ? { artifactPaths: input.context.artifactPaths } : {}),
|
|
170
|
+
traceSignature: input.runArtifacts.traceSignature,
|
|
171
|
+
toolStarts: input.runArtifacts.toolStarts,
|
|
172
|
+
toolArgsPreview: input.runArtifacts.toolArgsPreview,
|
|
173
|
+
textPreview: input.runArtifacts.textPreview,
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
function createStreamingFailureEvalResult(input) {
|
|
177
|
+
return createFailedEvalResult({
|
|
178
|
+
id: input.context.id,
|
|
179
|
+
label: input.context.label,
|
|
180
|
+
runtime: input.context.runtime,
|
|
181
|
+
details: `${input.details}${buildFailureSuffix(input.progress)}`,
|
|
182
|
+
startedAt: input.context.startedAt,
|
|
183
|
+
...(input.context.conversationId ? { conversationId: input.context.conversationId } : {}),
|
|
184
|
+
...(input.context.artifactPaths?.length ? { artifactPaths: input.context.artifactPaths } : {}),
|
|
185
|
+
toolStarts: input.progress.toolStarts,
|
|
186
|
+
textPreview: input.progress.textLength > 0
|
|
187
|
+
? `${input.progress.textLength} characters streamed`
|
|
188
|
+
: undefined,
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
function createLiveEvalResultContext(input) {
|
|
192
|
+
return {
|
|
193
|
+
id: input.testCase.id,
|
|
194
|
+
label: input.testCase.label,
|
|
195
|
+
runtime: input.runtime,
|
|
196
|
+
startedAt: input.startedAt,
|
|
197
|
+
...(input.conversationId ? { conversationId: input.conversationId } : {}),
|
|
198
|
+
...(input.artifactPaths.length > 0 ? { artifactPaths: input.artifactPaths } : {}),
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
function buildLiveEvalRunBody(input) {
|
|
202
|
+
const customBody = typeof input.prepared?.metadata?.customBody === "string"
|
|
203
|
+
? input.prepared.metadata.customBody
|
|
204
|
+
: null;
|
|
205
|
+
if (customBody) {
|
|
206
|
+
return JSON.parse(customBody);
|
|
207
|
+
}
|
|
208
|
+
return buildLiveEvalRequestBody({
|
|
209
|
+
testCaseId: input.testCase.id,
|
|
210
|
+
prompt: input.prepared?.prompt ?? input.testCase.prompt ?? "",
|
|
211
|
+
metadata: input.prepared?.metadata,
|
|
212
|
+
projectId: input.config.projectId && input.testCase.requireProject
|
|
213
|
+
? input.config.projectId
|
|
214
|
+
: null,
|
|
215
|
+
...(input.config.branchId ? { branchId: input.config.branchId } : {}),
|
|
216
|
+
...(input.config.model ? { model: input.config.model } : {}),
|
|
217
|
+
...(input.conversationId ? { conversationId: input.conversationId } : {}),
|
|
218
|
+
allowedTools: input.testCase.allowedTools,
|
|
219
|
+
forceRuntimeOverrides: input.testCase.forceRuntimeOverrides,
|
|
220
|
+
maxSteps: input.testCase.maxSteps,
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
async function resolveCompletedLiveEvalRun(input) {
|
|
224
|
+
const traceSignature = buildTraceSignature(input.run.eventTypes);
|
|
225
|
+
const runArtifacts = createLiveEvalRunArtifacts({
|
|
226
|
+
run: input.run,
|
|
227
|
+
runId: input.runId,
|
|
228
|
+
traceSignature,
|
|
229
|
+
});
|
|
230
|
+
const failure = await input.testCase.verify(input.run, input.prepared);
|
|
231
|
+
if (!failure && input.testCase.expectedEventSubsequence) {
|
|
232
|
+
if (!containsOrderedSubsequence(input.run.eventTypes, input.testCase.expectedEventSubsequence)) {
|
|
233
|
+
return createFailedRunEvalResult({
|
|
234
|
+
context: input.context,
|
|
235
|
+
details: `Expected AG-UI event subsequence ${input.testCase.expectedEventSubsequence.join(" -> ")}, got ${traceSignature}`,
|
|
236
|
+
runArtifacts,
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
if (failure) {
|
|
241
|
+
return createFailedRunEvalResult({
|
|
242
|
+
context: input.context,
|
|
243
|
+
details: failure,
|
|
244
|
+
runArtifacts,
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
return createPassedRunEvalResult({
|
|
248
|
+
context: input.context,
|
|
249
|
+
details: `OK: ${input.run.toolStarts.join(", ") || "no tools"} | ${input.run.text.slice(0, 140) || "no text"}`,
|
|
250
|
+
runArtifacts,
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
function extractRunId(run) {
|
|
254
|
+
for (const event of run.events) {
|
|
255
|
+
const runId = getStringField(event, "runId") ?? getStringField(event, "run_id");
|
|
256
|
+
if (runId) {
|
|
257
|
+
return runId;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
return null;
|
|
261
|
+
}
|
|
262
|
+
/** Check whether finished is present. */
|
|
263
|
+
export function hasFinished(run) {
|
|
264
|
+
return run.eventTypes.includes(agUiSseEventTypes.runFinished) && !run.runError;
|
|
265
|
+
}
|
|
266
|
+
/** Contains skill load helper. */
|
|
267
|
+
export function containsSkillLoad(run, skillId) {
|
|
268
|
+
return run.toolStarts.includes("load_skill") && run.toolArgs.join("").includes(skillId);
|
|
269
|
+
}
|
|
270
|
+
/** Count step started events helper. */
|
|
271
|
+
export function countStepStartedEvents(run) {
|
|
272
|
+
return run.eventTypes.filter((eventType) => eventType === agUiSseEventTypes.stepStarted).length;
|
|
273
|
+
}
|
|
274
|
+
/** Create live eval case support. */
|
|
275
|
+
export function createLiveEvalCaseSupport(config) {
|
|
276
|
+
const fetchImpl = resolveFetch(config);
|
|
277
|
+
const log = config.log ?? console.log;
|
|
278
|
+
const { judgeLlm, withJudge } = createLiveEvalJudgeSupport(config);
|
|
279
|
+
async function verifyFileExists(input) {
|
|
280
|
+
if (!config.projectId || !config.readProjectFile) {
|
|
281
|
+
return null;
|
|
282
|
+
}
|
|
283
|
+
const file = await config.readProjectFile({
|
|
284
|
+
filePath: input.filePath,
|
|
285
|
+
requestTimeoutMs: config.requestTimeoutMs,
|
|
286
|
+
});
|
|
287
|
+
if (!file) {
|
|
288
|
+
return `${input.description ?? input.filePath}: file not found in project after task completed`;
|
|
289
|
+
}
|
|
290
|
+
if (!file.content || file.content.trim().length === 0) {
|
|
291
|
+
return `${input.description ?? input.filePath}: file exists but is empty`;
|
|
292
|
+
}
|
|
293
|
+
if (input.requiredContent) {
|
|
294
|
+
const missing = input.requiredContent.filter((keyword) => !file.content.toLowerCase().includes(keyword.toLowerCase()));
|
|
295
|
+
if (missing.length > 0) {
|
|
296
|
+
return `${input.description ?? input.filePath}: missing required content: ${missing.join(", ")}. Got: ${file.content.slice(0, 200)}`;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
return null;
|
|
300
|
+
}
|
|
301
|
+
async function runEval(testCase, runtime) {
|
|
302
|
+
const startedAt = Date.now();
|
|
303
|
+
if (testCase.requireProject && !config.projectId) {
|
|
304
|
+
return createSkippedEvalResult({
|
|
305
|
+
id: testCase.id,
|
|
306
|
+
label: testCase.label,
|
|
307
|
+
runtime,
|
|
308
|
+
details: "Skipped because AG_UI_EVAL_PROJECT_ID is not set.",
|
|
309
|
+
startedAt,
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
const prepared = testCase.prepare
|
|
313
|
+
? await testCase.prepare({
|
|
314
|
+
apiUrl: config.apiUrl,
|
|
315
|
+
authToken: config.authToken,
|
|
316
|
+
projectId: config.projectId,
|
|
317
|
+
})
|
|
318
|
+
: null;
|
|
319
|
+
const preparedConversationId = extractPreparedConversationId(prepared);
|
|
320
|
+
const preparedArtifactPaths = collectPreparedArtifactPaths(prepared);
|
|
321
|
+
const resultContext = createLiveEvalResultContext({
|
|
322
|
+
testCase,
|
|
323
|
+
runtime,
|
|
324
|
+
startedAt,
|
|
325
|
+
conversationId: preparedConversationId,
|
|
326
|
+
artifactPaths: preparedArtifactPaths,
|
|
327
|
+
});
|
|
328
|
+
try {
|
|
329
|
+
const sidecarCleanup = prepared?.startSidecar ? await prepared.startSidecar() : undefined;
|
|
330
|
+
const progressReporter = createLiveEvalProgressReporter({
|
|
331
|
+
caseId: testCase.id,
|
|
332
|
+
startedAt,
|
|
333
|
+
intervalMs: config.progressLogIntervalMs,
|
|
334
|
+
log,
|
|
335
|
+
});
|
|
336
|
+
const body = buildLiveEvalRunBody({
|
|
337
|
+
config,
|
|
338
|
+
testCase,
|
|
339
|
+
prepared,
|
|
340
|
+
conversationId: preparedConversationId,
|
|
341
|
+
});
|
|
342
|
+
try {
|
|
343
|
+
const response = await fetchImpl(config.endpoint, {
|
|
344
|
+
method: "POST",
|
|
345
|
+
headers: {
|
|
346
|
+
"Content-Type": "application/json",
|
|
347
|
+
Authorization: `Bearer ${config.authToken}`,
|
|
348
|
+
},
|
|
349
|
+
body: JSON.stringify(body),
|
|
350
|
+
signal: AbortSignal.timeout(config.requestTimeoutMs),
|
|
351
|
+
});
|
|
352
|
+
log(`[stream] ${runtime}:${testCase.id} HTTP ${response.status}`);
|
|
353
|
+
const run = await parseSseResponse(response, {
|
|
354
|
+
onProgress: progressReporter.update,
|
|
355
|
+
});
|
|
356
|
+
return resolveCompletedLiveEvalRun({
|
|
357
|
+
testCase,
|
|
358
|
+
run,
|
|
359
|
+
prepared,
|
|
360
|
+
context: resultContext,
|
|
361
|
+
runId: extractRunId(run) ?? undefined,
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
catch (error) {
|
|
365
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
366
|
+
return createStreamingFailureEvalResult({
|
|
367
|
+
context: resultContext,
|
|
368
|
+
details: message,
|
|
369
|
+
progress: progressReporter.getSnapshot(),
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
finally {
|
|
373
|
+
progressReporter.stop();
|
|
374
|
+
await sidecarCleanup?.();
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
finally {
|
|
378
|
+
await prepared?.cleanup?.();
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
return {
|
|
382
|
+
judgeLlm,
|
|
383
|
+
runEval,
|
|
384
|
+
verifyFileExists,
|
|
385
|
+
withJudge,
|
|
386
|
+
};
|
|
387
|
+
}
|
|
388
|
+
/** White-box helpers used by live eval runner tests. */
|
|
389
|
+
export const liveEvalRunnerInternals = {
|
|
390
|
+
collectPreparedArtifactPaths,
|
|
391
|
+
createFailedRunEvalResult,
|
|
392
|
+
createLiveEvalRunArtifacts,
|
|
393
|
+
createPassedRunEvalResult,
|
|
394
|
+
createStreamingFailureEvalResult,
|
|
395
|
+
extractRunId,
|
|
396
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message-prep.d.ts","sourceRoot":"","sources":["../../../src/src/chat/message-prep.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC;AASjC,OAAO,EAKL,KAAK,aAAa,EAGlB,KAAK,oBAAoB,EAE1B,MAAM,YAAY,CAAC;AAMpB,4EAA4E;AAC5E,MAAM,WAAW,iDAAiD;IAChE,sBAAsB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC5C;AAED,uBAAuB;AACvB,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAErD;AAOD,qBAAqB;AACrB,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,oBAAoB,EAAE,EAChC,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,GACb,oBAAoB,EAAE,CAiCxB;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oB,EAAE,EAChC,QAAQ,GAAE,MAAU,GACnB,oBAAoB,EAAE,CAexB;AAED,2BAA2B;AAC3B,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,oBAAoB,EAAE,GAAG,oBAAoB,EAAE,CAgE1F;AAED,4BAA4B;AAC5B,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,oBAAoB,EAAE,EAChC,MAAM,GAAE,MAA6B,EACrC,QAAQ,GAAE,MAAU,GACnB,oBAAoB,EAAE,CAMxB"}
|
|
@@ -532,13 +532,27 @@ function compactContactValue(value) {
|
|
|
532
532
|
if (typeof emailAddress.address === "string")
|
|
533
533
|
compact.address = emailAddress.address;
|
|
534
534
|
}
|
|
535
|
-
for (const field of ["login", "name", "address", "email", "id"]) {
|
|
535
|
+
for (const field of ["login", "name", "displayName", "address", "email", "id", "accountId"]) {
|
|
536
536
|
if (typeof value[field] === "string" || typeof value[field] === "number") {
|
|
537
537
|
compact[field] = value[field];
|
|
538
538
|
}
|
|
539
539
|
}
|
|
540
540
|
return Object.keys(compact).length > 0 ? compact : null;
|
|
541
541
|
}
|
|
542
|
+
function compactNamedArrayValue(value) {
|
|
543
|
+
if (typeof value === "string")
|
|
544
|
+
return value;
|
|
545
|
+
if (!isRecord(value))
|
|
546
|
+
return null;
|
|
547
|
+
for (const field of ["name", "displayName", "login", "key", "id"]) {
|
|
548
|
+
const candidate = value[field];
|
|
549
|
+
if (typeof candidate === "string" && candidate.length > 0)
|
|
550
|
+
return candidate;
|
|
551
|
+
if (typeof candidate === "number")
|
|
552
|
+
return String(candidate);
|
|
553
|
+
}
|
|
554
|
+
return null;
|
|
555
|
+
}
|
|
542
556
|
function compactHistoricalField(field, fieldValue) {
|
|
543
557
|
if (field.kind === "contact") {
|
|
544
558
|
return compactContactValue(fieldValue);
|
|
@@ -557,6 +571,14 @@ function compactHistoricalField(field, fieldValue) {
|
|
|
557
571
|
const strings = fieldValue.filter((item) => typeof item === "string");
|
|
558
572
|
return strings.length > 0 ? strings : null;
|
|
559
573
|
}
|
|
574
|
+
if (field.kind === "named-array") {
|
|
575
|
+
if (!Array.isArray(fieldValue))
|
|
576
|
+
return null;
|
|
577
|
+
const names = fieldValue
|
|
578
|
+
.map((item) => compactNamedArrayValue(item))
|
|
579
|
+
.filter((item) => item !== null);
|
|
580
|
+
return names.length > 0 ? names : null;
|
|
581
|
+
}
|
|
560
582
|
if (field.kind === "object") {
|
|
561
583
|
if (!isRecord(fieldValue))
|
|
562
584
|
return null;
|
|
@@ -580,12 +602,24 @@ function compactHistoricalField(field, fieldValue) {
|
|
|
580
602
|
}
|
|
581
603
|
return null;
|
|
582
604
|
}
|
|
605
|
+
function getHistoricalFieldValue(source, field) {
|
|
606
|
+
if (!field.path || field.path.length === 0) {
|
|
607
|
+
return source[field.name];
|
|
608
|
+
}
|
|
609
|
+
let value = source;
|
|
610
|
+
for (const segment of field.path) {
|
|
611
|
+
if (!isRecord(value))
|
|
612
|
+
return undefined;
|
|
613
|
+
value = value[segment];
|
|
614
|
+
}
|
|
615
|
+
return value;
|
|
616
|
+
}
|
|
583
617
|
function compactHistoricalItemValue(value, fields) {
|
|
584
618
|
if (!isRecord(value))
|
|
585
619
|
return null;
|
|
586
620
|
const compact = {};
|
|
587
621
|
for (const field of fields) {
|
|
588
|
-
const fieldValue = compactHistoricalField(field, value
|
|
622
|
+
const fieldValue = compactHistoricalField(field, getHistoricalFieldValue(value, field));
|
|
589
623
|
if (fieldValue !== null)
|
|
590
624
|
compact[field.name] = fieldValue;
|
|
591
625
|
}
|
|
@@ -626,7 +660,7 @@ function compactHistoricalToolSummaryOutput(rawValue, contract) {
|
|
|
626
660
|
};
|
|
627
661
|
if (output && contract.outputFields) {
|
|
628
662
|
for (const field of contract.outputFields) {
|
|
629
|
-
const fieldValue = compactHistoricalField(field, output
|
|
663
|
+
const fieldValue = compactHistoricalField(field, getHistoricalFieldValue(output, field));
|
|
630
664
|
if (fieldValue !== null)
|
|
631
665
|
compacted[field.name] = fieldValue;
|
|
632
666
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_data.d.ts","sourceRoot":"","sources":["../../../src/src/integrations/_data.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,eAAO,MAAM,UAAU,EAAE,iBAAiB,
|
|
1
|
+
{"version":3,"file":"_data.d.ts","sourceRoot":"","sources":["../../../src/src/integrations/_data.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,eAAO,MAAM,UAAU,EAAE,iBAAiB,EAg/1DzC,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAyZxC,CAAC"}
|