agentv 5.3.1-next.1 → 5.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +52 -44
- package/dist/{artifact-writer-7NBCOAYC.js → artifact-writer-KJEOROKQ.js} +5 -5
- package/dist/{chunk-ELCJ23K4.js → chunk-6262OKXM.js} +2856 -2404
- package/dist/chunk-6262OKXM.js.map +1 -0
- package/dist/{chunk-LKGARI3W.js → chunk-6RFRY7X2.js} +812 -570
- package/dist/chunk-6RFRY7X2.js.map +1 -0
- package/dist/chunk-AQ5BIAXF.js +604 -0
- package/dist/chunk-AQ5BIAXF.js.map +1 -0
- package/dist/chunk-BV5VQLI2.js +2 -0
- package/dist/{chunk-LXBI3SPX.js → chunk-JGSRUJZQ.js} +46 -20
- package/dist/chunk-JGSRUJZQ.js.map +1 -0
- package/dist/chunk-MMDLXYBX.js +721 -0
- package/dist/chunk-MMDLXYBX.js.map +1 -0
- package/dist/chunk-TEEXVJWM.js +2 -0
- package/dist/{chunk-RKE7SSET.js → chunk-WIAJ7JAV.js} +186 -64
- package/dist/chunk-WIAJ7JAV.js.map +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +17517 -10
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +2 -0
- package/dist/config.js +14 -0
- package/dist/config.js.map +1 -0
- package/dist/contracts-DsZmZLl8.d.ts +742 -0
- package/dist/contracts.d.ts +2 -0
- package/dist/contracts.js +28 -0
- package/dist/contracts.js.map +1 -0
- package/dist/dashboard/assets/{index-CbEMiJSb.js → index-BfqOlLOF.js} +1 -1
- package/dist/dashboard/assets/index-Bh8lpGce.css +1 -0
- package/dist/dashboard/assets/index-oPR3ywQb.js +121 -0
- package/dist/dashboard/index.html +2 -2
- package/dist/{dist-NMXMI5SK.js → dist-A3SGR7TW.js} +16 -16
- package/dist/dist-A3SGR7TW.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +137 -18
- package/dist/{interactive-BN527UV3.js → interactive-WPQJDJKZ.js} +24 -24
- package/dist/interactive-WPQJDJKZ.js.map +1 -0
- package/dist/provider.d.ts +2 -0
- package/dist/provider.js +24 -0
- package/dist/provider.js.map +1 -0
- package/dist/sdk.d.ts +802 -0
- package/dist/sdk.js +145 -0
- package/dist/sdk.js.map +1 -0
- package/dist/skills/agentv-eval-migrations/references/breaking-changes.md +17 -18
- package/dist/skills/agentv-eval-writer/SKILL.md +27 -15
- package/dist/skills/agentv-eval-writer/references/custom-evaluators.md +5 -5
- package/dist/skills/agentv-eval-writer/references/eval.schema.json +5402 -4639
- package/dist/skills/agentv-eval-writer/references/python-helpers.md +2 -2
- package/dist/skills/agentv-eval-writer/references/rubric-evaluator.md +19 -2
- package/dist/templates/.agentv/providers.yaml +42 -0
- package/dist/templates/.env.example +2 -2
- package/dist/{ts-eval-loader-2RFVZHCT-7CZ3DCDD.js → ts-eval-loader-3G5GEAEC-6F52JLPP.js} +3 -3
- package/dist/ts-eval-loader-3G5GEAEC-6F52JLPP.js.map +1 -0
- package/package.json +29 -4
- package/dist/chunk-ASIGJIOJ.js +0 -17993
- package/dist/chunk-ASIGJIOJ.js.map +0 -1
- package/dist/chunk-ELCJ23K4.js.map +0 -1
- package/dist/chunk-LKGARI3W.js.map +0 -1
- package/dist/chunk-LXBI3SPX.js.map +0 -1
- package/dist/chunk-RKE7SSET.js.map +0 -1
- package/dist/dashboard/assets/index-DTA6-l7q.js +0 -121
- package/dist/dashboard/assets/index-D_bokML8.css +0 -1
- package/dist/interactive-BN527UV3.js.map +0 -1
- package/dist/templates/.agentv/targets.yaml +0 -97
- /package/dist/{artifact-writer-7NBCOAYC.js.map → artifact-writer-KJEOROKQ.js.map} +0 -0
- /package/dist/{dist-NMXMI5SK.js.map → chunk-BV5VQLI2.js.map} +0 -0
- /package/dist/{ts-eval-loader-2RFVZHCT-7CZ3DCDD.js.map → chunk-TEEXVJWM.js.map} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../packages/core/src/evaluation/script-grader-runtime.ts","../../../packages/core/src/evaluation/script-grader-schemas.ts","../../../packages/core/src/evaluation/vitest-workspace-grader.ts"],"sourcesContent":["/**\n * Runtime for script grader evaluators.\n * Handles stdin parsing, validation, error handling, and output formatting.\n */\nimport { readFileSync } from 'node:fs';\nimport { toCamelCaseDeep } from './case-conversion.js';\n\nimport {\n type ScriptGraderInput,\n ScriptGraderInputSchema,\n type ScriptGraderResult,\n ScriptGraderResultSchema,\n} from './script-grader-schemas.js';\n\n/**\n * Handler function type for script graders.\n */\nexport type ScriptGraderHandler = (\n input: ScriptGraderInput,\n) => ScriptGraderResult | Promise<ScriptGraderResult>;\n\n/**\n * Read stdin synchronously (works in both Node.js and Bun).\n */\nfunction readStdin(): string {\n return readFileSync(0, 'utf8');\n}\n\n/**\n * Clamp a value to the range [0, 1].\n */\nfunction clampScore(value: number): number {\n if (Number.isNaN(value) || !Number.isFinite(value)) {\n return 0;\n }\n return Math.max(0, Math.min(1, value));\n}\n\n/**\n * Format an error for output.\n */\nfunction formatError(error: unknown): string {\n if (error instanceof Error) {\n return error.message;\n }\n return String(error);\n}\n\n/**\n * Run a script grader handler with full stdin/stdout handling.\n * This is the internal implementation called by defineScriptGrader.\n */\nexport async function runScriptGrader(handler: ScriptGraderHandler): Promise<void> {\n try {\n // 1. Read stdin\n const stdin = readStdin();\n\n // 2. Parse JSON\n const rawInput = JSON.parse(stdin) as Record<string, unknown>;\n\n // 3. Convert snake_case to camelCase\n const camelInput = toCamelCaseDeep(rawInput);\n\n // 4. Validate input with Zod\n const input = ScriptGraderInputSchema.parse(camelInput);\n\n // 5. Set up lazy file-backed output loading if applicable\n if (input.outputPath && (input.output === null || input.output === undefined)) {\n let cachedOutput: ScriptGraderInput['output'] | undefined;\n const filePath = input.outputPath;\n Object.defineProperty(input, 'output', {\n get() {\n if (cachedOutput === undefined) {\n cachedOutput = JSON.parse(readFileSync(filePath, 'utf8'));\n }\n return cachedOutput;\n },\n configurable: true,\n enumerable: true,\n });\n }\n\n // 6. Run handler\n const rawResult = await handler(input);\n\n // 7. Validate and normalize output\n const result = ScriptGraderResultSchema.parse({\n ...rawResult,\n score: clampScore(rawResult.score),\n checks: rawResult.checks?.map((check) => ({\n ...check,\n ...(check.score !== undefined ? { score: clampScore(check.score) } : {}),\n })),\n });\n\n // 8. Output JSON\n console.log(JSON.stringify(result, null, 2));\n } catch (error) {\n // Output failure result\n const errorMessage = formatError(error);\n const errorResult: ScriptGraderResult = {\n pass: false,\n score: 0,\n reason: `Evaluation failed: ${errorMessage}`,\n checks: [\n {\n text: 'Script grader execution',\n pass: false,\n reason: errorMessage,\n },\n ],\n };\n console.log(JSON.stringify(errorResult, null, 2));\n process.exit(1);\n }\n}\n\n/** @deprecated Use ScriptGraderHandler. */\nexport type CodeGraderHandler = ScriptGraderHandler;\n\n/** @deprecated Use runScriptGrader. */\nexport const runCodeGrader = runScriptGrader;\n","/**\n * Zod schemas for script grader input/output validation.\n * Provides both compile-time types and runtime validation.\n *\n * ## Content model\n *\n * `Message.content` accepts `string | object[] | object`:\n * - `string` — backward-compatible plain text (most common case)\n * - `object[]` — typed content blocks for multimodal messages, plus AgentV\n * eval input blocks such as `{ type: \"file\", value, path, text }`\n * - `object` — structured YAML/JSON content such as expected outputs\n *\n * Content variants:\n * - `ContentText` — `{ type: 'text', text: string }`\n * - `ContentImage` — `{ type: 'image', media_type: string, path: string }` (file path, not base64)\n * - `ContentFile` — `{ type: 'file', media_type: string, path: string }`\n *\n * To add a new content variant:\n * 1. Define a new Zod schema with a unique `type` literal\n * 2. Add it to `ContentSchema` discriminated union\n * 3. Re-export from `index.ts`\n */\nimport { z } from 'zod';\n\n/**\n * Token usage metrics schema.\n */\nexport const TokenUsageSchema = z.object({\n input: z.number(),\n output: z.number(),\n cached: z.number().optional(),\n reasoning: z.number().optional(),\n});\n\n/**\n * Derived trace summary schema (camelCase for TypeScript ergonomics).\n *\n * This is a compact read model for metric-style graders. Full transcript/tool\n * evidence lives in the canonical `Trace` under `messages` and `events`.\n */\nexport const TraceSummarySchema = z.object({\n eventCount: z.number(),\n toolCalls: z.record(z.string(), z.number()),\n errorCount: z.number(),\n toolDurations: z.record(z.string(), z.array(z.number())).optional(),\n llmCallCount: z.number().optional(),\n});\n\nexport const TRACE_SOURCE_KINDS = [\n 'agentv_run',\n 'otlp',\n 'phoenix',\n 'langfuse',\n 'pi_session',\n 'imported_transcript',\n 'compact_transcript',\n] as const;\n\nexport const TRACE_EVENT_TYPES = [\n 'message',\n 'model_turn',\n 'tool_call',\n 'tool_result',\n 'final_response',\n 'error',\n] as const;\n\nexport const TRACE_TOOL_STATUSES = ['ok', 'error', 'timeout', 'cancelled', 'unknown'] as const;\n\nexport const TRACE_REDACTION_LEVELS = ['none', 'partial', 'full'] as const;\n\nconst MetadataSchema = z.record(z.string(), z.unknown());\n\nexport const TraceRedactionStateSchema = z.object({\n level: z.enum(TRACE_REDACTION_LEVELS),\n fields: z.array(z.string()).optional(),\n reason: z.string().optional(),\n});\n\nexport const TraceErrorSchema = z.object({\n message: z.string(),\n name: z.string().optional(),\n code: z.string().optional(),\n stack: z.string().optional(),\n metadata: MetadataSchema.optional(),\n});\n\nexport const TraceSourceSchema = z.object({\n kind: z.enum(TRACE_SOURCE_KINDS),\n path: z.string().optional(),\n url: z.string().optional(),\n provider: z.string().optional(),\n format: z.string().optional(),\n version: z.string().optional(),\n metadata: MetadataSchema.optional(),\n});\n\nexport const TraceSessionSchema = z.object({\n sessionId: z.string().optional(),\n conversationId: z.string().optional(),\n cwd: z.string().optional(),\n startedAt: z.string().optional(),\n endedAt: z.string().optional(),\n metadata: MetadataSchema.optional(),\n});\n\nexport const TraceBranchSchema = z.object({\n selectedLeafId: z.string().optional(),\n selectedPathIds: z.array(z.string()).optional(),\n includedEventIds: z.array(z.string()).optional(),\n omittedEventIds: z.array(z.string()).optional(),\n selectionReason: z.string().optional(),\n});\n\nexport const TraceSourceRefSchema = z.object({\n eventId: z.string().optional(),\n messageId: z.string().optional(),\n spanId: z.string().optional(),\n traceId: z.string().optional(),\n rawKind: z.string().optional(),\n path: z.string().optional(),\n line: z.number().int().nonnegative().optional(),\n metadata: MetadataSchema.optional(),\n});\n\nexport const TraceRawEvidenceSchema = z.object({\n kind: z.string(),\n ref: z.string().optional(),\n mediaType: z.string().optional(),\n content: z.unknown().optional(),\n redacted: z.boolean().optional(),\n metadata: MetadataSchema.optional(),\n});\n\nexport const TraceMessageSchema = z.object({\n role: z.string(),\n name: z.string().optional(),\n content: z.unknown().optional(),\n redaction: TraceRedactionStateSchema.optional(),\n tokenUsage: TokenUsageSchema.optional(),\n metadata: MetadataSchema.optional(),\n});\n\nexport const TraceModelSchema = z.object({\n provider: z.string().optional(),\n name: z.string().optional(),\n invocationId: z.string().optional(),\n tokenUsage: TokenUsageSchema.optional(),\n metadata: MetadataSchema.optional(),\n});\n\nexport const TraceToolSchema = z.object({\n name: z.string(),\n callId: z.string().optional(),\n input: z.unknown().optional(),\n output: z.unknown().optional(),\n status: z.enum(TRACE_TOOL_STATUSES).optional(),\n error: TraceErrorSchema.optional(),\n redaction: TraceRedactionStateSchema.optional(),\n metadata: MetadataSchema.optional(),\n});\n\nexport const TraceEventSchema = z.object({\n eventId: z.string(),\n parentEventId: z.string().optional(),\n ordinal: z.number().int().nonnegative(),\n type: z.enum(TRACE_EVENT_TYPES),\n timestamp: z.string().optional(),\n durationMs: z.number().nonnegative().optional(),\n durationInferred: z.boolean().optional(),\n turnIndex: z.number().int().nonnegative().optional(),\n message: TraceMessageSchema.optional(),\n model: TraceModelSchema.optional(),\n tool: TraceToolSchema.optional(),\n error: TraceErrorSchema.optional(),\n sourceRef: TraceSourceRefSchema.optional(),\n rawEvidence: z.array(TraceRawEvidenceSchema).optional(),\n redaction: TraceRedactionStateSchema.optional(),\n metadata: MetadataSchema.optional(),\n});\n\n/**\n * Derived trace artifact shape used by import/replay helpers.\n *\n * This is not a persisted public trace contract. Grader authors normally\n * receive the result-local `Trace` shape below.\n */\nexport const TraceArtifactSchema = z.object({\n source: TraceSourceSchema,\n session: TraceSessionSchema,\n branch: TraceBranchSchema.optional(),\n events: z.array(TraceEventSchema),\n tokenUsage: TokenUsageSchema.optional(),\n costUsd: z.number().optional(),\n durationMs: z.number().optional(),\n startedAt: z.string().optional(),\n endedAt: z.string().optional(),\n metadata: MetadataSchema.optional(),\n});\n\n/**\n * Tool call schema.\n */\nexport const ToolCallSchema = z.object({\n tool: z.string(),\n input: z.unknown().optional(),\n output: z.unknown().optional(),\n id: z.string().optional(),\n startTime: z.string().optional(),\n endTime: z.string().optional(),\n durationMs: z.number().optional(),\n});\n\n// ---------------------------------------------------------------------------\n// Content block schemas (discriminated union on `type`)\n// ---------------------------------------------------------------------------\n\n/** Text content block. */\nexport const ContentTextSchema = z.object({\n type: z.literal('text'),\n text: z.string(),\n});\n\n/**\n * Image content block.\n * `path` is a filesystem path — never inline base64.\n */\nexport const ContentImageSchema = z.object({\n type: z.literal('image'),\n media_type: z.string(),\n path: z.string(),\n});\n\n/** File content block. */\nexport const ContentFileSchema = z.object({\n type: z.literal('file'),\n media_type: z.string(),\n path: z.string(),\n});\n\n/** Discriminated union of all content block types. */\nexport const ContentSchema = z.discriminatedUnion('type', [\n ContentTextSchema,\n ContentImageSchema,\n ContentFileSchema,\n]);\n\nconst MessageContentBlockSchema = z.union([ContentSchema, z.record(z.unknown())]);\n\n/**\n * Unified message schema for input, expected, and output messages.\n *\n * `content` is a plain string, an array of structured blocks, or a\n * structured object from YAML/JSON eval files. Use `getTextContent()` from\n * `agentv/contracts` to extract plain text when the content is textual.\n */\nexport const MessageSchema = z.object({\n role: z.enum(['assistant', 'user', 'system', 'tool']),\n content: z\n .union([z.string(), z.array(MessageContentBlockSchema), z.record(z.unknown())])\n .optional(),\n toolCalls: z.array(ToolCallSchema).optional(),\n name: z.string().optional(),\n startTime: z.string().optional(),\n endTime: z.string().optional(),\n durationMs: z.number().optional(),\n metadata: z.record(z.unknown()).optional(),\n});\n\n/**\n * Derived evaluation trace read model exposed to custom assertions and script graders.\n *\n * Top-level summary fields (`eventCount`, `toolCalls`, `errorCount`) remain\n * available for existing metric graders; full transcript/tool evidence is under\n * `messages` and structured execution events under `events`.\n */\nexport const TraceSchema = TraceSummarySchema.extend({\n messages: z.array(MessageSchema),\n events: z.array(TraceEventSchema),\n tokenUsage: TokenUsageSchema.optional(),\n costUsd: z.number().optional(),\n durationMs: z.number().optional(),\n startTime: z.string().optional(),\n endTime: z.string().optional(),\n metadata: MetadataSchema.optional(),\n});\n\n/**\n * Script grader input schema (camelCase, converted from snake_case wire format).\n *\n * `output` is the final answer/scored result only. Transcript-aware graders\n * should inspect `messages`, `trace.messages`, or `trace.events`.\n */\nexport const ScriptGraderInputSchema = z.object({\n criteria: z.string(),\n expectedOutput: z.array(MessageSchema),\n output: z.string().nullable().optional(),\n messages: z.array(MessageSchema).optional().default([]),\n /** Path to a temp file containing the output JSON (used for large payloads). */\n outputPath: z.string().optional(),\n inputFiles: z.array(z.string()),\n input: z.array(MessageSchema),\n metadata: z.record(z.unknown()).nullable().optional(),\n trace: TraceSchema.nullable().optional(),\n traceSummary: TraceSummarySchema.nullable().optional(),\n tokenUsage: TokenUsageSchema.nullable().optional(),\n costUsd: z.number().nullable().optional(),\n durationMs: z.number().nullable().optional(),\n startTime: z.string().nullable().optional(),\n endTime: z.string().nullable().optional(),\n fileChanges: z.string().nullable().optional(),\n workspacePath: z.string().nullable().optional(),\n config: z.record(z.unknown()).nullable().optional(),\n});\n\nexport const ScriptGraderCheckSchema = z.object({\n id: z.string().optional(),\n text: z.string(),\n pass: z.boolean(),\n score: z.number().min(0).max(1).optional(),\n reason: z.string(),\n evidence: z.string().optional(),\n});\n\n/**\n * Script grader result schema (validated before output).\n */\nexport const ScriptGraderResultSchema = z.object({\n pass: z.boolean(),\n score: z.number().min(0).max(1),\n reason: z.string(),\n checks: z.array(ScriptGraderCheckSchema).optional().default([]),\n /** Optional structured details for domain-specific metrics (e.g., TP/TN/FP/FN counts, alignments). */\n details: z.record(z.unknown()).optional(),\n});\n\n/**\n * Inferred types from schemas.\n */\nexport type ScriptGraderInput = z.infer<typeof ScriptGraderInputSchema>;\nexport type ScriptGraderCheck = z.infer<typeof ScriptGraderCheckSchema>;\nexport type ScriptGraderResult = z.infer<typeof ScriptGraderResultSchema>;\n\nexport type TraceSummary = z.infer<typeof TraceSummarySchema>;\nexport type Trace = z.infer<typeof TraceSchema>;\nexport type TraceArtifact = z.infer<typeof TraceArtifactSchema>;\nexport type TraceSource = z.infer<typeof TraceSourceSchema>;\nexport type TraceSession = z.infer<typeof TraceSessionSchema>;\nexport type TraceBranch = z.infer<typeof TraceBranchSchema>;\nexport type TraceEvent = z.infer<typeof TraceEventSchema>;\nexport type TraceMessage = z.infer<typeof TraceMessageSchema>;\nexport type TraceModel = z.infer<typeof TraceModelSchema>;\nexport type TraceTool = z.infer<typeof TraceToolSchema>;\nexport type TraceError = z.infer<typeof TraceErrorSchema>;\nexport type TraceSourceRef = z.infer<typeof TraceSourceRefSchema>;\nexport type TraceRawEvidence = z.infer<typeof TraceRawEvidenceSchema>;\nexport type TraceRedactionState = z.infer<typeof TraceRedactionStateSchema>;\nexport type Message = z.infer<typeof MessageSchema>;\nexport type ToolCall = z.infer<typeof ToolCallSchema>;\nexport type TokenUsage = z.infer<typeof TokenUsageSchema>;\n\nexport type ContentText = z.infer<typeof ContentTextSchema>;\nexport type ContentImage = z.infer<typeof ContentImageSchema>;\nexport type ContentFile = z.infer<typeof ContentFileSchema>;\nexport type Content = z.infer<typeof ContentSchema>;\n\n/**\n * Prompt template input schema (camelCase, converted from snake_case wire format).\n * Uses the same schema as ScriptGraderInput since the orchestrator sends identical payloads.\n */\nexport const PromptTemplateInputSchema = ScriptGraderInputSchema;\n\nexport type PromptTemplateInput = ScriptGraderInput;\n\n// ── Backward-compat aliases (deprecated) ────────────────────────────────────────\n/** @deprecated Use ScriptGraderInputSchema */\nexport const CodeGraderInputSchema = ScriptGraderInputSchema;\n/** @deprecated Use ScriptGraderResultSchema */\nexport const CodeGraderResultSchema = ScriptGraderResultSchema;\n/** @deprecated Use ScriptGraderInput */\nexport type CodeGraderInput = ScriptGraderInput;\n/** @deprecated Use ScriptGraderResult */\nexport type CodeGraderResult = ScriptGraderResult;\n/** @deprecated Use ScriptGraderInputSchema */\nexport const CodeJudgeInputSchema = ScriptGraderInputSchema;\n/** @deprecated Use ScriptGraderResultSchema */\nexport const CodeJudgeResultSchema = ScriptGraderResultSchema;\n/** @deprecated Use ScriptGraderInput */\nexport type CodeJudgeInput = ScriptGraderInput;\n/** @deprecated Use ScriptGraderResult */\nexport type CodeJudgeResult = ScriptGraderResult;\n","/**\n * Vitest workspace verifier adapter.\n *\n * This module keeps deterministic workspace verification in familiar Vitest\n * tests while translating the JSON reporter output into AgentV's script-grader\n * result contract.\n */\nimport { spawn } from 'node:child_process';\nimport { copyFile, mkdtemp, readFile, rm } from 'node:fs/promises';\nimport { tmpdir } from 'node:os';\nimport nodePath from 'node:path';\n\nimport { runScriptGrader } from './script-grader-runtime.js';\nimport {\n type ScriptGraderInput,\n type ScriptGraderResult,\n ScriptGraderResultSchema,\n} from './script-grader-schemas.js';\n\nexport interface VitestWorkspaceGraderOptions {\n /**\n * Vitest verifier file(s). By default these are relative to the prepared\n * workspace. When `copyTestFilesToWorkspace` is true, relative paths resolve\n * from `testFileRoot` instead.\n *\n * When provided without `command`, the adapter runs\n * `bunx vitest run <testFile> --reporter=json --outputFile <tmp>`.\n */\n readonly testFile?: string | readonly string[];\n /**\n * Copy `testFile` entries into a temporary directory inside the workspace\n * before running Vitest. Use this for hidden verifier files that live beside\n * the eval instead of inside the prepared workspace.\n */\n readonly copyTestFilesToWorkspace?: boolean;\n /**\n * Base directory for copied `testFile` entries. Defaults to `process.cwd()`.\n */\n readonly testFileRoot?: string;\n /**\n * Full command to run. Use this for package scripts such as\n * `[\"bun\", \"run\", \"verify:workspace\"]`.\n */\n readonly command?: readonly string[];\n /**\n * Base Vitest command used with `testFile`. Defaults to\n * `[\"bunx\", \"vitest\", \"run\"]`.\n */\n readonly vitestCommand?: readonly string[];\n /** Workspace-relative directory to run the command in. Defaults to workspace root. */\n readonly cwd?: string;\n /** Append `--reporter=json --outputFile <tmp>` to the command. Defaults to true for testFile mode. */\n readonly appendReporterArgs?: boolean;\n /** Read Vitest JSON from this path instead of stdout. Relative paths resolve under `cwd`. */\n readonly outputFile?: string;\n readonly timeoutMs?: number;\n readonly env?: Readonly<Record<string, string>>;\n readonly passWithNoTests?: boolean;\n}\n\ninterface CommandResult {\n readonly exitCode: number | null;\n readonly stdout: string;\n readonly stderr: string;\n}\n\ninterface VitestAssertionResult {\n readonly ancestorTitles?: readonly string[];\n readonly fullName?: string;\n readonly title?: string;\n readonly status?: string;\n readonly failureMessages?: readonly string[];\n readonly duration?: number;\n}\n\ninterface VitestFileResult {\n readonly name?: string;\n readonly assertionResults?: readonly VitestAssertionResult[];\n}\n\ninterface VitestJsonReport {\n readonly success?: boolean;\n readonly numTotalTests?: number;\n readonly numPassedTests?: number;\n readonly numFailedTests?: number;\n readonly numPendingTests?: number;\n readonly numTodoTests?: number;\n readonly testResults?: readonly VitestFileResult[];\n}\n\nfunction workspacePathFrom(input: ScriptGraderInput): string | undefined {\n const workspacePath = input.workspacePath ?? process.env.AGENTV_WORKSPACE_PATH;\n return workspacePath?.trim() ? workspacePath : undefined;\n}\n\nfunction truncate(value: string, maxLength = 2000): string {\n if (value.length <= maxLength) {\n return value;\n }\n return `${value.slice(0, maxLength)}\\n...(truncated)`;\n}\n\nfunction resolveInsideWorkspace(\n workspacePath: string,\n relativePath: string,\n label: string,\n options: { readonly allowRoot?: boolean } = {},\n): string {\n if (!relativePath.trim()) {\n throw new Error(`${label} must not be empty.`);\n }\n\n if (nodePath.isAbsolute(relativePath)) {\n throw new Error(`${label} must be relative to the workspace: ${relativePath}`);\n }\n\n const root = nodePath.resolve(workspacePath);\n const resolvedPath = nodePath.resolve(root, relativePath);\n const relativeToRoot = nodePath.relative(root, resolvedPath);\n if (relativeToRoot === '' && options.allowRoot === true) {\n return resolvedPath;\n }\n\n if (\n relativeToRoot === '' ||\n relativeToRoot.startsWith('..') ||\n nodePath.isAbsolute(relativeToRoot)\n ) {\n throw new Error(`${label} must stay inside the workspace: ${relativePath}`);\n }\n\n return resolvedPath;\n}\n\nfunction normalizeTestFiles(testFile: string | readonly string[] | undefined): readonly string[] {\n if (testFile === undefined) {\n return [];\n }\n return typeof testFile === 'string' ? [testFile] : [...testFile];\n}\n\nfunction buildCommand(\n options: VitestWorkspaceGraderOptions,\n testFiles: readonly string[] = normalizeTestFiles(options.testFile),\n) {\n if (options.command && options.command.length > 0) {\n return [...options.command];\n }\n\n const command = [...(options.vitestCommand ?? ['bunx', 'vitest', 'run'])];\n command.push(...testFiles);\n return command;\n}\n\nfunction parseJsonObjectFromText(text: string): unknown {\n const trimmed = text.trim();\n if (!trimmed) {\n return undefined;\n }\n\n try {\n return JSON.parse(trimmed);\n } catch {\n const start = trimmed.indexOf('{');\n const end = trimmed.lastIndexOf('}');\n if (start >= 0 && end > start) {\n return JSON.parse(trimmed.slice(start, end + 1));\n }\n throw new Error('Vitest output did not contain a JSON object.');\n }\n}\n\nfunction isVitestJsonReport(value: unknown): value is VitestJsonReport {\n return (\n typeof value === 'object' &&\n value !== null &&\n Array.isArray((value as VitestJsonReport).testResults)\n );\n}\n\nfunction assertionText(file: VitestFileResult, assertion: VitestAssertionResult): string {\n const title =\n assertion.fullName ??\n [...(assertion.ancestorTitles ?? []), assertion.title].filter(Boolean).join(' ');\n return title || file.name || 'Vitest assertion';\n}\n\nexport function vitestReportToScriptGraderResult(\n report: VitestJsonReport,\n options: Pick<VitestWorkspaceGraderOptions, 'passWithNoTests'> = {},\n): ScriptGraderResult {\n const checks = (report.testResults ?? []).flatMap((file) =>\n (file.assertionResults ?? []).map((item) => {\n const pass = item.status === 'passed';\n const evidence =\n item.failureMessages && item.failureMessages.length > 0\n ? truncate(item.failureMessages.join('\\n\\n'))\n : undefined;\n return {\n text: assertionText(file, item),\n pass,\n reason: pass ? 'Vitest test passed.' : 'Vitest test failed.',\n ...(evidence !== undefined ? { evidence } : {}),\n };\n }),\n );\n\n if (checks.length === 0) {\n const pass = options.passWithNoTests === true;\n return ScriptGraderResultSchema.parse({\n pass,\n score: pass ? 1 : 0,\n reason: pass ? 'Vitest reported no tests; configured to pass.' : 'Vitest reported no tests.',\n checks: [\n {\n text: 'Vitest reported no tests',\n pass,\n reason: pass ? 'passWithNoTests is enabled.' : 'No Vitest tests were discovered.',\n },\n ],\n details: {\n vitest_success: report.success ?? false,\n num_total_tests: report.numTotalTests ?? 0,\n num_passed_tests: report.numPassedTests ?? 0,\n num_failed_tests: report.numFailedTests ?? 0,\n num_pending_tests: report.numPendingTests ?? 0,\n num_todo_tests: report.numTodoTests ?? 0,\n },\n });\n }\n\n const passedCount = checks.filter((item) => item.pass).length;\n const pass = passedCount === checks.length;\n return ScriptGraderResultSchema.parse({\n pass,\n score: passedCount / checks.length,\n reason: `${passedCount}/${checks.length} Vitest tests passed.`,\n checks,\n details: {\n vitest_success: report.success ?? pass,\n num_total_tests: report.numTotalTests ?? checks.length,\n num_passed_tests: report.numPassedTests ?? passedCount,\n num_failed_tests: report.numFailedTests ?? checks.length - passedCount,\n num_pending_tests: report.numPendingTests ?? 0,\n num_todo_tests: report.numTodoTests ?? 0,\n },\n });\n}\n\n/** @deprecated Use vitestReportToScriptGraderResult. */\nexport const vitestReportToCodeGraderResult = vitestReportToScriptGraderResult;\n\nfunction runCommand(\n command: readonly string[],\n options: {\n readonly cwd: string;\n readonly timeoutMs?: number;\n readonly env?: Readonly<Record<string, string>>;\n },\n): Promise<CommandResult> {\n if (command.length === 0) {\n return Promise.reject(new Error('Vitest command must not be empty.'));\n }\n\n return new Promise((resolve, reject) => {\n const child = spawn(command[0], command.slice(1), {\n cwd: options.cwd,\n env: { ...process.env, ...options.env },\n stdio: ['ignore', 'pipe', 'pipe'],\n });\n\n let stdout = '';\n let stderr = '';\n let timedOut = false;\n const timeout =\n options.timeoutMs !== undefined\n ? setTimeout(() => {\n timedOut = true;\n child.kill('SIGTERM');\n }, options.timeoutMs)\n : undefined;\n\n child.stdout.setEncoding('utf8');\n child.stderr.setEncoding('utf8');\n child.stdout.on('data', (chunk) => {\n stdout += chunk;\n });\n child.stderr.on('data', (chunk) => {\n stderr += chunk;\n });\n child.on('error', reject);\n child.on('close', (exitCode) => {\n if (timeout) {\n clearTimeout(timeout);\n }\n if (timedOut) {\n reject(new Error(`Vitest command timed out after ${options.timeoutMs}ms.`));\n return;\n }\n resolve({ exitCode, stdout, stderr });\n });\n });\n}\n\nfunction resolveSourceTestFile(testFileRoot: string, testFile: string): string {\n if (!testFile.trim()) {\n throw new Error('testFile entries must not be empty.');\n }\n\n return nodePath.isAbsolute(testFile)\n ? nodePath.resolve(testFile)\n : nodePath.resolve(testFileRoot, testFile);\n}\n\nasync function copyTestFilesIntoWorkspace(\n testFiles: readonly string[],\n options: Pick<VitestWorkspaceGraderOptions, 'testFileRoot'>,\n cwd: string,\n): Promise<{ readonly testFiles: readonly string[]; readonly tempDir?: string }> {\n if (testFiles.length === 0) {\n return { testFiles };\n }\n\n const tempDir = await mkdtemp(nodePath.join(cwd, '.agentv-vitest-'));\n const testFileRoot = nodePath.resolve(options.testFileRoot ?? process.cwd());\n const copiedFiles = await Promise.all(\n testFiles.map(async (testFile, index) => {\n const sourcePath = resolveSourceTestFile(testFileRoot, testFile);\n const destinationPath = nodePath.join(tempDir, `${index}-${nodePath.basename(testFile)}`);\n await copyFile(sourcePath, destinationPath);\n return nodePath.relative(cwd, destinationPath);\n }),\n );\n return { testFiles: copiedFiles, tempDir };\n}\n\nasync function readVitestReport(\n commandResult: CommandResult,\n outputFile: string | undefined,\n): Promise<VitestJsonReport> {\n const rawReport =\n outputFile !== undefined ? await readFile(outputFile, 'utf8') : commandResult.stdout;\n const parsed = parseJsonObjectFromText(rawReport);\n if (!isVitestJsonReport(parsed)) {\n throw new Error('Vitest JSON report did not include testResults[].');\n }\n return parsed;\n}\n\nexport async function runVitestWorkspaceGrader(\n options: VitestWorkspaceGraderOptions,\n input: ScriptGraderInput,\n): Promise<ScriptGraderResult> {\n const workspacePath = workspacePathFrom(input);\n if (!workspacePath) {\n return {\n pass: false,\n score: 0,\n reason: 'Vitest workspace verifier requires workspace_path.',\n checks: [\n {\n text: 'Vitest workspace verifier requires workspace_path',\n pass: false,\n reason:\n 'Configure an environment recipe in the eval YAML so AgentV can pass workspace_path.',\n },\n ],\n };\n }\n\n const tempDirs: string[] = [];\n try {\n const cwd = options.cwd\n ? resolveInsideWorkspace(workspacePath, options.cwd, 'cwd', { allowRoot: true })\n : workspacePath;\n const testFiles = normalizeTestFiles(options.testFile);\n const preparedTestFiles =\n options.copyTestFilesToWorkspace === true\n ? await copyTestFilesIntoWorkspace(testFiles, options, cwd)\n : { testFiles };\n if (preparedTestFiles.tempDir) {\n tempDirs.push(preparedTestFiles.tempDir);\n }\n\n const command = buildCommand(options, preparedTestFiles.testFiles);\n const appendReporterArgs = options.appendReporterArgs ?? options.command === undefined;\n let outputFile = options.outputFile\n ? resolveInsideWorkspace(cwd, options.outputFile, 'outputFile')\n : undefined;\n\n if (appendReporterArgs) {\n const tempDir = await mkdtemp(nodePath.join(tmpdir(), 'agentv-vitest-'));\n tempDirs.push(tempDir);\n outputFile = nodePath.join(tempDir, 'results.json');\n command.push('--reporter=json', `--outputFile=${outputFile}`);\n }\n\n const result = await runCommand(command, {\n cwd,\n timeoutMs: options.timeoutMs,\n env: {\n AGENTV_WORKSPACE_PATH: workspacePath,\n ...(outputFile !== undefined ? { AGENTV_VITEST_JSON_PATH: outputFile } : {}),\n ...options.env,\n },\n });\n\n const report = await readVitestReport(result, outputFile);\n return vitestReportToScriptGraderResult(report, options);\n } catch (error) {\n const reason = error instanceof Error ? error.message : String(error);\n return {\n pass: false,\n score: 0,\n reason: 'Vitest workspace verifier failed to run.',\n checks: [\n {\n text: 'Vitest workspace verifier failed to run',\n pass: false,\n reason,\n },\n ],\n };\n } finally {\n for (const tempDir of tempDirs.reverse()) {\n await rm(tempDir, { recursive: true, force: true }).catch(() => {});\n }\n }\n}\n\nexport function defineVitestWorkspaceGrader(options: VitestWorkspaceGraderOptions): void {\n runScriptGrader((input) => runVitestWorkspaceGrader(options, input));\n}\n"],"mappings":";;;;;;;AAIA,SAAS,oBAAoB;AEG7B,SAAS,aAAa;AACtB,SAAS,UAAU,SAAS,UAAU,UAAU;AAChD,SAAS,cAAc;AACvB,OAAO,cAAc;ADiBd,IAAM,mBAAmB,iBAAE,OAAO;EACvC,OAAO,iBAAE,OAAO;EAChB,QAAQ,iBAAE,OAAO;EACjB,QAAQ,iBAAE,OAAO,EAAE,SAAS;EAC5B,WAAW,iBAAE,OAAO,EAAE,SAAS;AACjC,CAAC;AAQM,IAAM,qBAAqB,iBAAE,OAAO;EACzC,YAAY,iBAAE,OAAO;EACrB,WAAW,iBAAE,OAAO,iBAAE,OAAO,GAAG,iBAAE,OAAO,CAAC;EAC1C,YAAY,iBAAE,OAAO;EACrB,eAAe,iBAAE,OAAO,iBAAE,OAAO,GAAG,iBAAE,MAAM,iBAAE,OAAO,CAAC,CAAC,EAAE,SAAS;EAClE,cAAc,iBAAE,OAAO,EAAE,SAAS;AACpC,CAAC;AAEM,IAAM,qBAAqB;EAChC;EACA;EACA;EACA;EACA;EACA;EACA;AACF;AAEO,IAAM,oBAAoB;EAC/B;EACA;EACA;EACA;EACA;EACA;AACF;AAEO,IAAM,sBAAsB,CAAC,MAAM,SAAS,WAAW,aAAa,SAAS;AAE7E,IAAM,yBAAyB,CAAC,QAAQ,WAAW,MAAM;AAEhE,IAAM,iBAAiB,iBAAE,OAAO,iBAAE,OAAO,GAAG,iBAAE,QAAQ,CAAC;AAEhD,IAAM,4BAA4B,iBAAE,OAAO;EAChD,OAAO,iBAAE,KAAK,sBAAsB;EACpC,QAAQ,iBAAE,MAAM,iBAAE,OAAO,CAAC,EAAE,SAAS;EACrC,QAAQ,iBAAE,OAAO,EA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AAC,UAAU,yBAAyB,SAAS,KAAK,CAAC;AACrE;","names":["pass"]}
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
prepareSharedWorkspaceSetup,
|
|
17
17
|
readTranscriptJsonl,
|
|
18
18
|
releaseSharedWorkspaceSetup
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-6262OKXM.js";
|
|
20
20
|
|
|
21
21
|
// ../../packages/core/dist/index.js
|
|
22
22
|
import { readFileSync } from "node:fs";
|
|
@@ -1492,6 +1492,9 @@ function assertionToNaturalLanguage(entry) {
|
|
|
1492
1492
|
const type = entry.type;
|
|
1493
1493
|
switch (type) {
|
|
1494
1494
|
case "skill-trigger":
|
|
1495
|
+
throw new Error(staleSkillTriggerMessage(entry));
|
|
1496
|
+
case "skill-used":
|
|
1497
|
+
case "not-skill-used":
|
|
1495
1498
|
return null;
|
|
1496
1499
|
case "llm-rubric":
|
|
1497
1500
|
return typeof entry.value === "string" ? entry.value : null;
|
|
@@ -1518,10 +1521,9 @@ function assertionToNaturalLanguage(entry) {
|
|
|
1518
1521
|
case "ends-with":
|
|
1519
1522
|
return `Output ends with '${entry.value}'`;
|
|
1520
1523
|
case "llm-grader":
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
return typeof entry.prompt === "string" ? entry.prompt : null;
|
|
1524
|
+
throw new Error(
|
|
1525
|
+
"Authored assertion type 'llm-grader' has been removed. Use 'llm-rubric' for free-form rubric checks or 'agent-rubric' for agentic rubric checks."
|
|
1526
|
+
);
|
|
1525
1527
|
case "tool-trajectory": {
|
|
1526
1528
|
const expectedArr = Array.isArray(entry.expected) ? entry.expected : [];
|
|
1527
1529
|
const tools = expectedArr.map((e) => e.tool).filter(Boolean).join(", ");
|
|
@@ -1565,16 +1567,42 @@ function assertionToNaturalLanguageList(entry) {
|
|
|
1565
1567
|
}).filter((value) => typeof value === "string");
|
|
1566
1568
|
}
|
|
1567
1569
|
}
|
|
1568
|
-
if (entry.type === "llm-grader") {
|
|
1569
|
-
if (Array.isArray(entry.rubrics) && entry.rubrics.length > 0) {
|
|
1570
|
-
return entry.rubrics.map((r) => r.outcome ?? r.criteria ?? r.id).filter((s) => typeof s === "string");
|
|
1571
|
-
}
|
|
1572
|
-
}
|
|
1573
1570
|
const nl = assertionToNaturalLanguage(entry);
|
|
1574
1571
|
return nl !== null ? [nl] : [];
|
|
1575
1572
|
}
|
|
1576
|
-
function
|
|
1577
|
-
|
|
1573
|
+
function staleSkillTriggerMessage(entry) {
|
|
1574
|
+
const skill = typeof entry.skill === "string" ? entry.skill.trim() : "";
|
|
1575
|
+
const shouldTrigger = entry.should_trigger !== false;
|
|
1576
|
+
if (!skill) {
|
|
1577
|
+
return "Authored assertion type 'skill-trigger' has been removed. Use 'skill-used' with value: <skill> for expected skill use, or 'not-skill-used' with value: <skill> when the skill must not be used.";
|
|
1578
|
+
}
|
|
1579
|
+
const replacementType = shouldTrigger ? "skill-used" : "not-skill-used";
|
|
1580
|
+
return `Authored assertion type 'skill-trigger' has been removed. Replace skill: ${skill} with type: ${replacementType}, value: ${skill}.`;
|
|
1581
|
+
}
|
|
1582
|
+
function skillNameFromValue(value) {
|
|
1583
|
+
if (typeof value === "string" && value.trim()) {
|
|
1584
|
+
return value.trim();
|
|
1585
|
+
}
|
|
1586
|
+
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
1587
|
+
const name = value.name;
|
|
1588
|
+
return typeof name === "string" && name.trim() ? name.trim() : void 0;
|
|
1589
|
+
}
|
|
1590
|
+
return void 0;
|
|
1591
|
+
}
|
|
1592
|
+
function extractSkillUseAssertions(assertions) {
|
|
1593
|
+
return assertions.flatMap((entry) => {
|
|
1594
|
+
if (entry.type === "skill-trigger") {
|
|
1595
|
+
throw new Error(staleSkillTriggerMessage(entry));
|
|
1596
|
+
}
|
|
1597
|
+
if (entry.type !== "skill-used" && entry.type !== "not-skill-used") {
|
|
1598
|
+
return [];
|
|
1599
|
+
}
|
|
1600
|
+
const skill = skillNameFromValue(entry.value);
|
|
1601
|
+
if (!skill) {
|
|
1602
|
+
return [];
|
|
1603
|
+
}
|
|
1604
|
+
return [{ skill, shouldTrigger: entry.type === "skill-used" }];
|
|
1605
|
+
});
|
|
1578
1606
|
}
|
|
1579
1607
|
function extractInput(rawCase) {
|
|
1580
1608
|
const files = Array.isArray(rawCase.input_files) ? rawCase.input_files.filter((f) => typeof f === "string") : [];
|
|
@@ -1622,7 +1650,7 @@ function transpileEvalYaml(suite, source = "EVAL.yaml") {
|
|
|
1622
1650
|
throw new Error(`Invalid EVAL.yaml: missing 'tests' array in '${source}'`);
|
|
1623
1651
|
}
|
|
1624
1652
|
const suiteAssertions = rawSuite.assert ?? [];
|
|
1625
|
-
const suiteNlAssertions = suiteAssertions.
|
|
1653
|
+
const suiteNlAssertions = suiteAssertions.flatMap(assertionToNaturalLanguageList);
|
|
1626
1654
|
function getSkillFile(skillName) {
|
|
1627
1655
|
const existing = files.get(skillName);
|
|
1628
1656
|
if (existing) return existing;
|
|
@@ -1644,12 +1672,12 @@ function transpileEvalYaml(suite, source = "EVAL.yaml") {
|
|
|
1644
1672
|
nlAssertions.push(rawCase.criteria.trim());
|
|
1645
1673
|
}
|
|
1646
1674
|
for (const entry of caseAssertions) {
|
|
1647
|
-
if (entry.type !== "skill-
|
|
1675
|
+
if (entry.type !== "skill-used" && entry.type !== "not-skill-used") {
|
|
1648
1676
|
nlAssertions.push(...assertionToNaturalLanguageList(entry));
|
|
1649
1677
|
}
|
|
1650
1678
|
}
|
|
1651
1679
|
nlAssertions.push(...suiteNlAssertions);
|
|
1652
|
-
const triggerJudges =
|
|
1680
|
+
const triggerJudges = extractSkillUseAssertions(caseAssertions);
|
|
1653
1681
|
const { prompt, files: inputFiles } = extractInput(rawCase);
|
|
1654
1682
|
const expectedOutput = extractExpectedOutput(rawCase.expected_output);
|
|
1655
1683
|
const numericId = idx + 1;
|
|
@@ -1665,10 +1693,8 @@ function transpileEvalYaml(suite, source = "EVAL.yaml") {
|
|
|
1665
1693
|
noSkillFile2.evals.push({ ...baseCase });
|
|
1666
1694
|
} else {
|
|
1667
1695
|
for (const tj of triggerJudges) {
|
|
1668
|
-
const
|
|
1669
|
-
|
|
1670
|
-
const skillFile = getSkillFile(skillName);
|
|
1671
|
-
skillFile.evals.push({ ...baseCase, should_trigger: shouldTrigger });
|
|
1696
|
+
const skillFile = getSkillFile(tj.skill);
|
|
1697
|
+
skillFile.evals.push({ ...baseCase, should_trigger: tj.shouldTrigger });
|
|
1672
1698
|
}
|
|
1673
1699
|
}
|
|
1674
1700
|
}
|
|
@@ -6217,4 +6243,4 @@ export {
|
|
|
6217
6243
|
parseCopilotEvents,
|
|
6218
6244
|
createAgentKernel
|
|
6219
6245
|
};
|
|
6220
|
-
//# sourceMappingURL=chunk-
|
|
6246
|
+
//# sourceMappingURL=chunk-JGSRUJZQ.js.map
|