veryfront 0.1.877 → 0.1.878

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.
Files changed (58) hide show
  1. package/esm/deno.js +1 -1
  2. package/esm/src/eval/agent-service/durable-run-canaries/cli-runner.d.ts +21 -0
  3. package/esm/src/eval/agent-service/durable-run-canaries/cli-runner.d.ts.map +1 -0
  4. package/esm/src/eval/agent-service/durable-run-canaries/cli-runner.js +66 -0
  5. package/esm/src/eval/agent-service/durable-run-canaries/environment.d.ts +14 -0
  6. package/esm/src/eval/agent-service/durable-run-canaries/environment.d.ts.map +1 -0
  7. package/esm/src/eval/agent-service/durable-run-canaries/environment.js +15 -0
  8. package/esm/src/eval/agent-service/durable-run-canaries/index.d.ts +5 -0
  9. package/esm/src/eval/agent-service/durable-run-canaries/index.d.ts.map +1 -0
  10. package/esm/src/eval/agent-service/durable-run-canaries/index.js +4 -0
  11. package/esm/src/eval/agent-service/durable-run-canaries/runner.d.ts +118 -0
  12. package/esm/src/eval/agent-service/durable-run-canaries/runner.d.ts.map +1 -0
  13. package/esm/src/eval/agent-service/durable-run-canaries/runner.js +391 -0
  14. package/esm/src/eval/agent-service/durable-run-canaries/validation.d.ts +12 -0
  15. package/esm/src/eval/agent-service/durable-run-canaries/validation.d.ts.map +1 -0
  16. package/esm/src/eval/agent-service/durable-run-canaries/validation.js +71 -0
  17. package/esm/src/eval/agent-service/live-evals/api-client.d.ts +102 -0
  18. package/esm/src/eval/agent-service/live-evals/api-client.d.ts.map +1 -0
  19. package/esm/src/eval/agent-service/live-evals/api-client.js +313 -0
  20. package/esm/src/eval/agent-service/live-evals/cli-runner.d.ts +40 -0
  21. package/esm/src/eval/agent-service/live-evals/cli-runner.d.ts.map +1 -0
  22. package/esm/src/eval/agent-service/live-evals/cli-runner.js +144 -0
  23. package/esm/src/eval/agent-service/live-evals/environment.d.ts +15 -0
  24. package/esm/src/eval/agent-service/live-evals/environment.d.ts.map +1 -0
  25. package/esm/src/eval/agent-service/live-evals/environment.js +20 -0
  26. package/esm/src/eval/agent-service/live-evals/formatting.d.ts +15 -0
  27. package/esm/src/eval/agent-service/live-evals/formatting.d.ts.map +1 -0
  28. package/esm/src/eval/agent-service/live-evals/formatting.js +75 -0
  29. package/esm/src/eval/agent-service/live-evals/index.d.ts +12 -0
  30. package/esm/src/eval/agent-service/live-evals/index.d.ts.map +1 -0
  31. package/esm/src/eval/agent-service/live-evals/index.js +11 -0
  32. package/esm/src/eval/agent-service/live-evals/metadata.d.ts +34 -0
  33. package/esm/src/eval/agent-service/live-evals/metadata.d.ts.map +1 -0
  34. package/esm/src/eval/agent-service/live-evals/metadata.js +116 -0
  35. package/esm/src/eval/agent-service/live-evals/performance.d.ts +19 -0
  36. package/esm/src/eval/agent-service/live-evals/performance.d.ts.map +1 -0
  37. package/esm/src/eval/agent-service/live-evals/performance.js +22 -0
  38. package/esm/src/eval/agent-service/live-evals/preflight.d.ts +12 -0
  39. package/esm/src/eval/agent-service/live-evals/preflight.d.ts.map +1 -0
  40. package/esm/src/eval/agent-service/live-evals/preflight.js +27 -0
  41. package/esm/src/eval/agent-service/live-evals/report.d.ts +55 -0
  42. package/esm/src/eval/agent-service/live-evals/report.d.ts.map +1 -0
  43. package/esm/src/eval/agent-service/live-evals/report.js +79 -0
  44. package/esm/src/eval/agent-service/live-evals/request.d.ts +31 -0
  45. package/esm/src/eval/agent-service/live-evals/request.d.ts.map +1 -0
  46. package/esm/src/eval/agent-service/live-evals/request.js +48 -0
  47. package/esm/src/eval/agent-service/live-evals/result.d.ts +56 -0
  48. package/esm/src/eval/agent-service/live-evals/result.d.ts.map +1 -0
  49. package/esm/src/eval/agent-service/live-evals/result.js +36 -0
  50. package/esm/src/eval/agent-service/live-evals/runner.d.ts +135 -0
  51. package/esm/src/eval/agent-service/live-evals/runner.d.ts.map +1 -0
  52. package/esm/src/eval/agent-service/live-evals/runner.js +396 -0
  53. package/esm/src/eval/agent-service.d.ts +2 -0
  54. package/esm/src/eval/agent-service.d.ts.map +1 -1
  55. package/esm/src/eval/agent-service.js +2 -0
  56. package/esm/src/utils/version-constant.d.ts +1 -1
  57. package/esm/src/utils/version-constant.js +1 -1
  58. package/package.json +1 -1
@@ -0,0 +1,12 @@
1
+ import type { DurableRunCanaryMessage, DurableRunCanaryRunSummary } from "./runner.js";
2
+ /** Assert that a durable run canary completed successfully. */
3
+ export declare function assertCompleted(run: DurableRunCanaryRunSummary): void;
4
+ /** Message shape for find assistant. */
5
+ export declare function findAssistantMessage(messages: DurableRunCanaryMessage[], messageId: string): DurableRunCanaryMessage;
6
+ /** Stringify unknown helper. */
7
+ export declare function stringifyUnknown(value: unknown): string;
8
+ /** Collect assistant text helper. */
9
+ export declare function collectAssistantText(message: DurableRunCanaryMessage): string;
10
+ /** Assert no malformed create file tool calls helper. */
11
+ export declare function assertNoMalformedCreateFileToolCalls(messages: DurableRunCanaryMessage[]): void;
12
+ //# sourceMappingURL=validation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../../../../src/src/eval/agent-service/durable-run-canaries/validation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC;AA8BvF,+DAA+D;AAC/D,wBAAgB,eAAe,CAAC,GAAG,EAAE,0BAA0B,GAAG,IAAI,CAQrE;AAED,wCAAwC;AACxC,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,uBAAuB,EAAE,EACnC,SAAS,EAAE,MAAM,GAChB,uBAAuB,CASzB;AAED,gCAAgC;AAChC,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAUvD;AAED,qCAAqC;AACrC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,uBAAuB,GAAG,MAAM,CAK7E;AAED,yDAAyD;AACzD,wBAAgB,oCAAoC,CAAC,QAAQ,EAAE,uBAAuB,EAAE,GAAG,IAAI,CAY9F"}
@@ -0,0 +1,71 @@
1
+ function isRecord(value) {
2
+ return value !== null && typeof value === "object" && !Array.isArray(value);
3
+ }
4
+ function getStringProperty(record, key) {
5
+ const value = record[key];
6
+ return typeof value === "string" ? value : null;
7
+ }
8
+ function getToolCallName(part) {
9
+ if (part.type === "tool_call") {
10
+ return getStringProperty(part, "name");
11
+ }
12
+ if (part.type === "tool-call") {
13
+ return getStringProperty(part, "toolName");
14
+ }
15
+ return null;
16
+ }
17
+ function hasCreateFileInput(value) {
18
+ if (!isRecord(value)) {
19
+ return false;
20
+ }
21
+ return getStringProperty(value, "path") !== null && getStringProperty(value, "content") !== null;
22
+ }
23
+ /** Assert that a durable run canary completed successfully. */
24
+ export function assertCompleted(run) {
25
+ if (run.status !== "completed") {
26
+ throw new Error(`Expected completed run, got ${run.status} (${run.terminalErrorCode ?? "no-code"}: ${run.terminalErrorMessage ?? "no message"})`);
27
+ }
28
+ }
29
+ /** Message shape for find assistant. */
30
+ export function findAssistantMessage(messages, messageId) {
31
+ const message = messages.find((candidate) => candidate.id === messageId);
32
+ if (!message) {
33
+ throw new Error(`Assistant message ${messageId} was not persisted`);
34
+ }
35
+ if (message.role !== "assistant") {
36
+ throw new Error(`Expected assistant message ${messageId}, got role ${message.role}`);
37
+ }
38
+ return message;
39
+ }
40
+ /** Stringify unknown helper. */
41
+ export function stringifyUnknown(value) {
42
+ if (typeof value === "string") {
43
+ return value;
44
+ }
45
+ try {
46
+ return JSON.stringify(value);
47
+ }
48
+ catch {
49
+ return String(value);
50
+ }
51
+ }
52
+ /** Collect assistant text helper. */
53
+ export function collectAssistantText(message) {
54
+ return message.parts
55
+ .filter((part) => part.type === "text" && typeof part.text === "string")
56
+ .map((part) => part.text)
57
+ .join("\n");
58
+ }
59
+ /** Assert no malformed create file tool calls helper. */
60
+ export function assertNoMalformedCreateFileToolCalls(messages) {
61
+ for (const message of messages) {
62
+ for (const part of message.parts) {
63
+ if (!isRecord(part) || getToolCallName(part) !== "create_file") {
64
+ continue;
65
+ }
66
+ if (!hasCreateFileInput(part.input)) {
67
+ throw new Error("Expected create_file tool_call input to include a path and content");
68
+ }
69
+ }
70
+ }
71
+ }
@@ -0,0 +1,102 @@
1
+ import type { InferSchema } from "../../../extensions/schema/index.js";
2
+ import type { LiveEvalProjectFile } from "./runner.js";
3
+ /** Context for live eval API. */
4
+ export interface LiveEvalApiContext {
5
+ apiUrl: string;
6
+ authToken: string;
7
+ projectId: string | null;
8
+ fetch?: (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
9
+ }
10
+ /** Input payload for live eval request timeout. */
11
+ export interface LiveEvalRequestTimeoutInput {
12
+ requestTimeoutMs: number;
13
+ }
14
+ /** Input payload for live eval create conversation. */
15
+ export interface LiveEvalCreateConversationInput extends LiveEvalRequestTimeoutInput {
16
+ title: string;
17
+ }
18
+ /** Input payload for live eval conversation. */
19
+ export interface LiveEvalConversationInput extends LiveEvalRequestTimeoutInput {
20
+ conversationId: string;
21
+ }
22
+ /** Input payload for live eval project upload fixture. */
23
+ export interface LiveEvalProjectUploadFixtureInput extends LiveEvalRequestTimeoutInput {
24
+ filePath: string;
25
+ contentType: string;
26
+ body: BodyInit | Uint8Array;
27
+ size?: number;
28
+ pollIntervalMs?: number;
29
+ maxAttempts?: number;
30
+ }
31
+ /** Input payload for live eval project file. */
32
+ export interface LiveEvalProjectFileInput extends LiveEvalRequestTimeoutInput {
33
+ filePath: string;
34
+ }
35
+ /** Input payload for live eval create release. */
36
+ export interface LiveEvalCreateReleaseInput extends LiveEvalRequestTimeoutInput {
37
+ description?: string;
38
+ }
39
+ /** Input payload for live eval wait for open input request. */
40
+ export interface LiveEvalWaitForOpenInputRequestInput extends LiveEvalConversationInput {
41
+ abortSignal: AbortSignal;
42
+ pollIntervalMs?: number;
43
+ timeoutMs?: number;
44
+ }
45
+ /** Public API contract for live eval input response values. */
46
+ export interface LiveEvalInputResponseValues {
47
+ [key: string]: string | boolean | number | null;
48
+ }
49
+ /** Input payload for live eval submit input response. */
50
+ export interface LiveEvalSubmitInputResponseInput extends LiveEvalRequestTimeoutInput {
51
+ conversationId: string;
52
+ inputRequestId: string;
53
+ values: LiveEvalInputResponseValues;
54
+ }
55
+ /** Input payload for live eval input request. */
56
+ export interface LiveEvalInputRequestInput extends LiveEvalRequestTimeoutInput {
57
+ conversationId: string;
58
+ inputRequestId: string;
59
+ }
60
+ declare const getInputRequestRecordSchema: () => import("../../../internal-agents/schema.js").Schema<import("../../../extensions/schema/schema-validator.js").InferShape<{
61
+ id: import("../../../internal-agents/schema.js").Schema<string>;
62
+ status: import("../../../internal-agents/schema.js").Schema<string>;
63
+ }>>;
64
+ /** Record shape for live eval input request. */
65
+ export type LiveEvalInputRequestRecord = InferSchema<ReturnType<typeof getInputRequestRecordSchema>>;
66
+ /** Public API contract for live eval API client. */
67
+ export interface LiveEvalApiClient {
68
+ createConversation(input: LiveEvalCreateConversationInput): Promise<string>;
69
+ deleteConversation(input: LiveEvalConversationInput): Promise<void>;
70
+ createProjectUploadFixture(input: LiveEvalProjectUploadFixtureInput): Promise<string>;
71
+ getProjectFile(input: LiveEvalProjectFileInput): Promise<LiveEvalProjectFile | null>;
72
+ createRelease(input: LiveEvalCreateReleaseInput): Promise<string>;
73
+ deleteProjectFile(input: LiveEvalProjectFileInput): Promise<void>;
74
+ listOpenInputRequests(input: LiveEvalConversationInput): Promise<LiveEvalInputRequestRecord[]>;
75
+ waitForOpenInputRequest(input: LiveEvalWaitForOpenInputRequestInput): Promise<string>;
76
+ submitInputResponse(input: LiveEvalSubmitInputResponseInput): Promise<void>;
77
+ cancelInputRequest(input: LiveEvalInputRequestInput): Promise<void>;
78
+ }
79
+ /** Create live eval API client. */
80
+ export declare function createLiveEvalApiClient(context: LiveEvalApiContext): LiveEvalApiClient;
81
+ /** Create live eval conversation. */
82
+ export declare function createLiveEvalConversation(context: LiveEvalApiContext, input: LiveEvalCreateConversationInput): Promise<string>;
83
+ /** Delete live eval conversation helper. */
84
+ export declare function deleteLiveEvalConversation(context: LiveEvalApiContext, input: LiveEvalConversationInput): Promise<void>;
85
+ /** Create live eval project upload fixture. */
86
+ export declare function createLiveEvalProjectUploadFixture(context: LiveEvalApiContext, input: LiveEvalProjectUploadFixtureInput): Promise<string>;
87
+ /** Return live eval project file. */
88
+ export declare function getLiveEvalProjectFile(context: LiveEvalApiContext, input: LiveEvalProjectFileInput): Promise<LiveEvalProjectFile | null>;
89
+ /** Create live eval release. */
90
+ export declare function createLiveEvalRelease(context: LiveEvalApiContext, input: LiveEvalCreateReleaseInput): Promise<string>;
91
+ /** Delete live eval project file helper. */
92
+ export declare function deleteLiveEvalProjectFile(context: LiveEvalApiContext, input: LiveEvalProjectFileInput): Promise<void>;
93
+ /** List open live eval input requests. */
94
+ export declare function listOpenLiveEvalInputRequests(context: LiveEvalApiContext, input: LiveEvalConversationInput): Promise<LiveEvalInputRequestRecord[]>;
95
+ /** Request payload for wait for open live eval input. */
96
+ export declare function waitForOpenLiveEvalInputRequest(context: LiveEvalApiContext, input: LiveEvalWaitForOpenInputRequestInput): Promise<string>;
97
+ /** Response payload for submit live eval input. */
98
+ export declare function submitLiveEvalInputResponse(context: LiveEvalApiContext, input: LiveEvalSubmitInputResponseInput): Promise<void>;
99
+ /** Request payload for cancel live eval input. */
100
+ export declare function cancelLiveEvalInputRequest(context: LiveEvalApiContext, input: LiveEvalInputRequestInput): Promise<void>;
101
+ export {};
102
+ //# sourceMappingURL=api-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-client.d.ts","sourceRoot":"","sources":["../../../../../src/src/eval/agent-service/live-evals/api-client.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAEvE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAIvD,iCAAiC;AACjC,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,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,GACtC,OAAO,CAAC,IAAI,CAAC,CAmBf;AAED,kDAAkD;AAClD,wBAAsB,0BAA0B,CAC9C,OAAO,EAAE,kBAAkB,EAC3B,KAAK,EAAE,yBAAyB,GAC/B,OAAO,CAAC,IAAI,CAAC,CAkBf"}
@@ -0,0 +1,313 @@
1
+ import * as dntShim from "../../../../_dnt.shims.js";
2
+ import { ensureBuiltinSchemaValidator } from "../../../extensions/builtin-extensions.js";
3
+ import { defineSchema } from "../../../schemas/index.js";
4
+ ensureBuiltinSchemaValidator();
5
+ const getLiveEvalIdResponseSchema = defineSchema((v) => v.object({
6
+ id: v.string().optional(),
7
+ }));
8
+ const getProjectUploadResponseSchema = defineSchema((v) => v.object({
9
+ file_upload_url: v.string().optional(),
10
+ required_headers: v.record(v.string(), v.string()).optional(),
11
+ }));
12
+ const getProjectUploadListResponseSchema = defineSchema((v) => v.object({
13
+ data: v.array(v.object({ path: v.string().optional() }).passthrough()).optional(),
14
+ }));
15
+ const getProjectFileResponseSchema = defineSchema((v) => v.object({
16
+ path: v.string().optional(),
17
+ content: v.string().optional(),
18
+ }));
19
+ const getInputRequestRecordSchema = defineSchema((v) => v.object({
20
+ id: v.string(),
21
+ status: v.string(),
22
+ }));
23
+ const getInputRequestListResponseSchema = defineSchema((v) => v.object({
24
+ data: v.array(v.unknown()).optional(),
25
+ }));
26
+ function createLiveEvalAuthHeaders(context) {
27
+ const headers = new Headers();
28
+ headers.set("Authorization", `Bearer ${context.authToken}`);
29
+ return headers;
30
+ }
31
+ function createLiveEvalJsonHeaders(context) {
32
+ const headers = createLiveEvalAuthHeaders(context);
33
+ headers.set("Content-Type", "application/json");
34
+ return headers;
35
+ }
36
+ function requireLiveEvalProjectId(projectId, errorMessage) {
37
+ if (!projectId) {
38
+ throw new Error(errorMessage);
39
+ }
40
+ return projectId;
41
+ }
42
+ function createFetch(context) {
43
+ return context.fetch ?? fetch;
44
+ }
45
+ function createApiUrl(context, path) {
46
+ const baseHref = context.apiUrl.endsWith("/") ? context.apiUrl : `${context.apiUrl}/`;
47
+ const relativePath = path.startsWith("/") ? path.slice(1) : path;
48
+ return new URL(relativePath, baseHref);
49
+ }
50
+ function createProjectUploadHeaders(requiredHeaders, contentType) {
51
+ const uploadHeaders = new Headers(requiredHeaders);
52
+ if (!uploadHeaders.has("Content-Type")) {
53
+ uploadHeaders.set("Content-Type", contentType);
54
+ }
55
+ return uploadHeaders;
56
+ }
57
+ function getProjectUploadBodySize(body, explicitSize) {
58
+ if (typeof explicitSize === "number") {
59
+ return explicitSize;
60
+ }
61
+ if (typeof body === "string") {
62
+ return new TextEncoder().encode(body).byteLength;
63
+ }
64
+ if (body instanceof Blob) {
65
+ return body.size;
66
+ }
67
+ if (body instanceof URLSearchParams) {
68
+ return new TextEncoder().encode(body.toString()).byteLength;
69
+ }
70
+ if (body instanceof ArrayBuffer) {
71
+ return body.byteLength;
72
+ }
73
+ if (ArrayBuffer.isView(body)) {
74
+ return body.byteLength;
75
+ }
76
+ throw new Error("Project upload fixtures require size when body length cannot be inferred");
77
+ }
78
+ function createProjectUploadBody(body, contentType) {
79
+ if (body instanceof Blob) {
80
+ return body;
81
+ }
82
+ if (typeof body === "string") {
83
+ return new Blob([body], { type: contentType });
84
+ }
85
+ if (body instanceof Uint8Array) {
86
+ return new Blob([body.slice()], { type: contentType });
87
+ }
88
+ return body;
89
+ }
90
+ function getResponseText(response) {
91
+ return response.text();
92
+ }
93
+ async function wait(input) {
94
+ await new Promise((resolve) => {
95
+ dntShim.setTimeout(resolve, input.ms);
96
+ });
97
+ }
98
+ async function waitForProjectUploadFixture(context, input) {
99
+ const listUrl = createApiUrl(context, `/projects/${input.projectId}/uploads`);
100
+ const requestFetch = createFetch(context);
101
+ const maxAttempts = input.maxAttempts ?? 12;
102
+ const pollIntervalMs = input.pollIntervalMs ?? 2_000;
103
+ for (let attempt = 0; attempt < maxAttempts; attempt += 1) {
104
+ const listResponse = await requestFetch(listUrl, {
105
+ headers: createLiveEvalAuthHeaders(context),
106
+ signal: AbortSignal.timeout(input.requestTimeoutMs),
107
+ });
108
+ if (!listResponse.ok) {
109
+ throw new Error(`Failed to confirm project upload fixture: ${listResponse.status} ${await getResponseText(listResponse)}`);
110
+ }
111
+ const payload = getProjectUploadListResponseSchema().parse(await listResponse.json());
112
+ if (payload.data?.some((upload) => upload.path === input.filePath)) {
113
+ return input.filePath;
114
+ }
115
+ if (attempt + 1 < maxAttempts) {
116
+ await wait({ ms: pollIntervalMs });
117
+ }
118
+ }
119
+ throw new Error(`Project upload fixture did not appear in time: ${input.filePath}`);
120
+ }
121
+ /** Create live eval API client. */
122
+ export function createLiveEvalApiClient(context) {
123
+ return {
124
+ createConversation: (input) => createLiveEvalConversation(context, input),
125
+ deleteConversation: (input) => deleteLiveEvalConversation(context, input),
126
+ createProjectUploadFixture: (input) => createLiveEvalProjectUploadFixture(context, input),
127
+ getProjectFile: (input) => getLiveEvalProjectFile(context, input),
128
+ createRelease: (input) => createLiveEvalRelease(context, input),
129
+ deleteProjectFile: (input) => deleteLiveEvalProjectFile(context, input),
130
+ listOpenInputRequests: (input) => listOpenLiveEvalInputRequests(context, input),
131
+ waitForOpenInputRequest: (input) => waitForOpenLiveEvalInputRequest(context, input),
132
+ submitInputResponse: (input) => submitLiveEvalInputResponse(context, input),
133
+ cancelInputRequest: (input) => cancelLiveEvalInputRequest(context, input),
134
+ };
135
+ }
136
+ /** Create live eval conversation. */
137
+ export async function createLiveEvalConversation(context, input) {
138
+ const response = await createFetch(context)(createApiUrl(context, "/conversations"), {
139
+ method: "POST",
140
+ headers: createLiveEvalJsonHeaders(context),
141
+ body: JSON.stringify({
142
+ ...(context.projectId ? { project_id: context.projectId } : {}),
143
+ title: input.title,
144
+ }),
145
+ signal: AbortSignal.timeout(input.requestTimeoutMs),
146
+ });
147
+ if (!response.ok) {
148
+ throw new Error(`Failed to create eval conversation: ${response.status} ${await getResponseText(response)}`);
149
+ }
150
+ const payload = getLiveEvalIdResponseSchema().parse(await response.json());
151
+ if (!payload.id) {
152
+ throw new Error("Conversation creation response did not include id");
153
+ }
154
+ return payload.id;
155
+ }
156
+ /** Delete live eval conversation helper. */
157
+ export async function deleteLiveEvalConversation(context, input) {
158
+ const response = await createFetch(context)(createApiUrl(context, `/conversations/${input.conversationId}`), {
159
+ method: "DELETE",
160
+ headers: createLiveEvalAuthHeaders(context),
161
+ signal: AbortSignal.timeout(input.requestTimeoutMs),
162
+ });
163
+ if (!response.ok && response.status !== 404) {
164
+ throw new Error(`Failed to delete eval conversation ${input.conversationId}: ${response.status} ${await getResponseText(response)}`);
165
+ }
166
+ }
167
+ /** Create live eval project upload fixture. */
168
+ export async function createLiveEvalProjectUploadFixture(context, input) {
169
+ const projectId = requireLiveEvalProjectId(context.projectId, "Project upload fixtures require a live-eval project id");
170
+ const createResponse = await createFetch(context)(createApiUrl(context, `/projects/${projectId}/uploads`), {
171
+ method: "POST",
172
+ headers: createLiveEvalJsonHeaders(context),
173
+ body: JSON.stringify({
174
+ file_path: input.filePath,
175
+ content_type: input.contentType,
176
+ size: getProjectUploadBodySize(input.body, input.size),
177
+ }),
178
+ signal: AbortSignal.timeout(input.requestTimeoutMs),
179
+ });
180
+ if (!createResponse.ok) {
181
+ throw new Error(`Failed to create project upload URL: ${createResponse.status} ${await getResponseText(createResponse)}`);
182
+ }
183
+ const createPayload = getProjectUploadResponseSchema().parse(await createResponse.json());
184
+ if (!createPayload.file_upload_url) {
185
+ throw new Error("Project upload response did not include file_upload_url");
186
+ }
187
+ const uploadResponse = await createFetch(context)(createPayload.file_upload_url, {
188
+ method: "PUT",
189
+ headers: createProjectUploadHeaders(createPayload.required_headers, input.contentType),
190
+ body: createProjectUploadBody(input.body, input.contentType),
191
+ signal: AbortSignal.timeout(input.requestTimeoutMs),
192
+ });
193
+ if (!uploadResponse.ok) {
194
+ throw new Error(`Failed to upload project fixture: ${uploadResponse.status} ${await getResponseText(uploadResponse)}`);
195
+ }
196
+ return waitForProjectUploadFixture(context, {
197
+ projectId,
198
+ filePath: input.filePath,
199
+ requestTimeoutMs: input.requestTimeoutMs,
200
+ pollIntervalMs: input.pollIntervalMs,
201
+ maxAttempts: input.maxAttempts,
202
+ });
203
+ }
204
+ /** Return live eval project file. */
205
+ export async function getLiveEvalProjectFile(context, input) {
206
+ const projectId = requireLiveEvalProjectId(context.projectId, "getLiveEvalProjectFile requires a live-eval project id");
207
+ const response = await createFetch(context)(createApiUrl(context, `/projects/${projectId}/files/${encodeURIComponent(input.filePath)}`), {
208
+ headers: createLiveEvalAuthHeaders(context),
209
+ signal: AbortSignal.timeout(input.requestTimeoutMs),
210
+ });
211
+ if (response.status === 404) {
212
+ return null;
213
+ }
214
+ if (!response.ok) {
215
+ throw new Error(`Failed to read project file: ${response.status} ${await getResponseText(response)}`);
216
+ }
217
+ const payload = getProjectFileResponseSchema().parse(await response.json());
218
+ return {
219
+ path: payload.path ?? input.filePath,
220
+ content: payload.content ?? "",
221
+ };
222
+ }
223
+ /** Create live eval release. */
224
+ export async function createLiveEvalRelease(context, input) {
225
+ const projectId = requireLiveEvalProjectId(context.projectId, "createLiveEvalRelease requires a live-eval project id");
226
+ const response = await createFetch(context)(createApiUrl(context, `/projects/${projectId}/releases`), {
227
+ method: "POST",
228
+ headers: createLiveEvalJsonHeaders(context),
229
+ body: JSON.stringify({
230
+ description: input.description ?? "eval platform capability release",
231
+ }),
232
+ signal: AbortSignal.timeout(input.requestTimeoutMs),
233
+ });
234
+ if (!response.ok) {
235
+ throw new Error(`Failed to create release: ${response.status} ${await getResponseText(response)}`);
236
+ }
237
+ const payload = getLiveEvalIdResponseSchema().parse(await response.json());
238
+ if (!payload.id) {
239
+ throw new Error("Release creation response did not include id");
240
+ }
241
+ return payload.id;
242
+ }
243
+ /** Delete live eval project file helper. */
244
+ export async function deleteLiveEvalProjectFile(context, input) {
245
+ const projectId = context.projectId;
246
+ if (!projectId) {
247
+ return;
248
+ }
249
+ const response = await createFetch(context)(createApiUrl(context, `/projects/${projectId}/files/${encodeURIComponent(input.filePath)}`), {
250
+ method: "DELETE",
251
+ headers: createLiveEvalAuthHeaders(context),
252
+ signal: AbortSignal.timeout(input.requestTimeoutMs),
253
+ });
254
+ if (!response.ok && response.status !== 404) {
255
+ throw new Error(`Failed to delete project file: ${response.status} ${await getResponseText(response)}`);
256
+ }
257
+ }
258
+ /** List open live eval input requests. */
259
+ export async function listOpenLiveEvalInputRequests(context, input) {
260
+ const response = await createFetch(context)(createApiUrl(context, `/conversations/${input.conversationId}/input-requests?status=open`), {
261
+ headers: createLiveEvalAuthHeaders(context),
262
+ signal: AbortSignal.timeout(input.requestTimeoutMs),
263
+ });
264
+ if (!response.ok) {
265
+ throw new Error(`Failed to list eval input requests: ${response.status} ${await getResponseText(response)}`);
266
+ }
267
+ const payload = getInputRequestListResponseSchema().parse(await response.json());
268
+ return (payload.data ?? []).flatMap((item) => {
269
+ const parsed = getInputRequestRecordSchema().safeParse(item);
270
+ return parsed.success ? [parsed.data] : [];
271
+ });
272
+ }
273
+ /** Request payload for wait for open live eval input. */
274
+ export async function waitForOpenLiveEvalInputRequest(context, input) {
275
+ const timeoutMs = input.timeoutMs ?? 30_000;
276
+ const pollIntervalMs = input.pollIntervalMs ?? 500;
277
+ const deadline = Date.now() + timeoutMs;
278
+ while (Date.now() < deadline) {
279
+ if (input.abortSignal.aborted) {
280
+ throw new Error("Eval sidecar aborted before an input request appeared");
281
+ }
282
+ const requests = await listOpenLiveEvalInputRequests(context, input);
283
+ const request = requests[0];
284
+ if (request) {
285
+ return request.id;
286
+ }
287
+ await wait({ ms: pollIntervalMs });
288
+ }
289
+ throw new Error(`Timed out while waiting for an open input request in conversation ${input.conversationId}`);
290
+ }
291
+ /** Response payload for submit live eval input. */
292
+ export async function submitLiveEvalInputResponse(context, input) {
293
+ const response = await createFetch(context)(createApiUrl(context, `/conversations/${input.conversationId}/input-requests/${input.inputRequestId}/responses`), {
294
+ method: "POST",
295
+ headers: createLiveEvalJsonHeaders(context),
296
+ body: JSON.stringify({ values: input.values }),
297
+ signal: AbortSignal.timeout(input.requestTimeoutMs),
298
+ });
299
+ if (!response.ok) {
300
+ throw new Error(`Failed to submit eval input response: ${response.status} ${await getResponseText(response)}`);
301
+ }
302
+ }
303
+ /** Request payload for cancel live eval input. */
304
+ export async function cancelLiveEvalInputRequest(context, input) {
305
+ const response = await createFetch(context)(createApiUrl(context, `/conversations/${input.conversationId}/input-requests/${input.inputRequestId}/cancel`), {
306
+ method: "POST",
307
+ headers: createLiveEvalAuthHeaders(context),
308
+ signal: AbortSignal.timeout(input.requestTimeoutMs),
309
+ });
310
+ if (!response.ok) {
311
+ throw new Error(`Failed to cancel eval input request: ${response.status} ${await getResponseText(response)}`);
312
+ }
313
+ }
@@ -0,0 +1,40 @@
1
+ import { type LiveEvalRuntime } from "./performance.js";
2
+ import { containsSkillLoad, countStepStartedEvents, createLiveEvalCaseSupport, hasFinished, type LiveEvalCase, type LiveEvalRunnerConfig } from "./runner.js";
3
+ type EnvRecord = Record<string, string | undefined>;
4
+ /** Public API contract for live eval cli case groups. */
5
+ export interface LiveEvalCliCaseGroups {
6
+ readOnlyCases: LiveEvalCase[];
7
+ writeCases: LiveEvalCase[];
8
+ experimentalWriteCases: LiveEvalCase[];
9
+ }
10
+ /** Input payload for live eval cli case factory. */
11
+ export interface LiveEvalCliCaseFactoryInput {
12
+ authToken: string;
13
+ endpoint: string;
14
+ projectId: string | null;
15
+ branchId: string | null;
16
+ model: string | null;
17
+ requestTimeoutMs: number;
18
+ enableLlmJudge: boolean;
19
+ hasFinished: typeof hasFinished;
20
+ containsSkillLoad: typeof containsSkillLoad;
21
+ countStepStartedEvents: typeof countStepStartedEvents;
22
+ verifyFileExists: ReturnType<typeof createLiveEvalCaseSupport>["verifyFileExists"];
23
+ withJudge: ReturnType<typeof createLiveEvalCaseSupport>["withJudge"];
24
+ judgeLlm: ReturnType<typeof createLiveEvalCaseSupport>["judgeLlm"];
25
+ }
26
+ /** Input payload for run live eval cli. */
27
+ export interface RunLiveEvalCliInput {
28
+ env: EnvRecord;
29
+ caseSets: Record<string, readonly string[]>;
30
+ createCases: (input: LiveEvalCliCaseFactoryInput) => LiveEvalCliCaseGroups;
31
+ runtimes?: readonly LiveEvalRuntime[];
32
+ cwd?: string;
33
+ log?: (message: string) => void;
34
+ error?: (message: string) => void;
35
+ createCaseSupport?: (config: LiveEvalRunnerConfig) => ReturnType<typeof createLiveEvalCaseSupport>;
36
+ }
37
+ /** Run live eval cli. */
38
+ export declare function runLiveEvalCli(input: RunLiveEvalCliInput): Promise<number>;
39
+ export {};
40
+ //# sourceMappingURL=cli-runner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli-runner.d.ts","sourceRoot":"","sources":["../../../../../src/src/eval/agent-service/live-evals/cli-runner.ts"],"names":[],"mappings":"AAGA,OAAO,EAAkC,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAQxF,OAAO,EACL,iBAAiB,EACjB,sBAAsB,EACtB,yBAAyB,EACzB,WAAW,EACX,KAAK,YAAY,EACjB,KAAK,oBAAoB,EAC1B,MAAM,aAAa,CAAC;AAKrB,KAAK,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;AAEpD,yDAAyD;AACzD,MAAM,WAAW,qBAAqB;IACpC,aAAa,EAAE,YAAY,EAAE,CAAC;IAC9B,UAAU,EAAE,YAAY,EAAE,CAAC;IAC3B,sBAAsB,EAAE,YAAY,EAAE,CAAC;CACxC;AAED,oDAAoD;AACpD,MAAM,WAAW,2BAA2B;IAC1C,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,cAAc,EAAE,OAAO,CAAC;IACxB,WAAW,EAAE,OAAO,WAAW,CAAC;IAChC,i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