@prismatic-io/lux 0.0.1
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/LICENSE +21 -0
- package/lib/answerers/claude-code/index.d.ts +17 -0
- package/lib/answerers/claude-code/index.d.ts.map +1 -0
- package/lib/answerers/claude-code/index.js +280 -0
- package/lib/answerers/claude-code/index.js.map +1 -0
- package/lib/answerers/persona/index.d.ts +40 -0
- package/lib/answerers/persona/index.d.ts.map +1 -0
- package/lib/answerers/persona/index.js +265 -0
- package/lib/answerers/persona/index.js.map +1 -0
- package/lib/answerers/scripted/index.d.ts +8 -0
- package/lib/answerers/scripted/index.d.ts.map +1 -0
- package/lib/answerers/scripted/index.js +163 -0
- package/lib/answerers/scripted/index.js.map +1 -0
- package/lib/answerers/shared.d.ts +13 -0
- package/lib/answerers/shared.d.ts.map +1 -0
- package/lib/answerers/shared.js +17 -0
- package/lib/answerers/shared.js.map +1 -0
- package/lib/answerers/terminal/index.d.ts +9 -0
- package/lib/answerers/terminal/index.d.ts.map +1 -0
- package/lib/answerers/terminal/index.js +97 -0
- package/lib/answerers/terminal/index.js.map +1 -0
- package/lib/assertions/core/command-exits-zero.d.ts +21 -0
- package/lib/assertions/core/command-exits-zero.d.ts.map +1 -0
- package/lib/assertions/core/command-exits-zero.js +87 -0
- package/lib/assertions/core/command-exits-zero.js.map +1 -0
- package/lib/assertions/core/event-checks.d.ts +57 -0
- package/lib/assertions/core/event-checks.d.ts.map +1 -0
- package/lib/assertions/core/event-checks.js +123 -0
- package/lib/assertions/core/event-checks.js.map +1 -0
- package/lib/assertions/core/file-checks.d.ts +103 -0
- package/lib/assertions/core/file-checks.d.ts.map +1 -0
- package/lib/assertions/core/file-checks.js +288 -0
- package/lib/assertions/core/file-checks.js.map +1 -0
- package/lib/assertions/core/helpers.d.ts +66 -0
- package/lib/assertions/core/helpers.d.ts.map +1 -0
- package/lib/assertions/core/helpers.js +170 -0
- package/lib/assertions/core/helpers.js.map +1 -0
- package/lib/assertions/core/index.d.ts +15 -0
- package/lib/assertions/core/index.d.ts.map +1 -0
- package/lib/assertions/core/index.js +56 -0
- package/lib/assertions/core/index.js.map +1 -0
- package/lib/assertions/core/json-pointer-equals.d.ts +19 -0
- package/lib/assertions/core/json-pointer-equals.d.ts.map +1 -0
- package/lib/assertions/core/json-pointer-equals.js +71 -0
- package/lib/assertions/core/json-pointer-equals.js.map +1 -0
- package/lib/assertions/core/output-checks.d.ts +46 -0
- package/lib/assertions/core/output-checks.d.ts.map +1 -0
- package/lib/assertions/core/output-checks.js +121 -0
- package/lib/assertions/core/output-checks.js.map +1 -0
- package/lib/assertions/core/predicate.d.ts +14 -0
- package/lib/assertions/core/predicate.d.ts.map +1 -0
- package/lib/assertions/core/predicate.js +55 -0
- package/lib/assertions/core/predicate.js.map +1 -0
- package/lib/assertions/core/resource-checks.d.ts +71 -0
- package/lib/assertions/core/resource-checks.d.ts.map +1 -0
- package/lib/assertions/core/resource-checks.js +159 -0
- package/lib/assertions/core/resource-checks.js.map +1 -0
- package/lib/assertions/core/safe-regex.d.ts +23 -0
- package/lib/assertions/core/safe-regex.d.ts.map +1 -0
- package/lib/assertions/core/safe-regex.js +102 -0
- package/lib/assertions/core/safe-regex.js.map +1 -0
- package/lib/assertions/core/tool-called-with.d.ts +21 -0
- package/lib/assertions/core/tool-called-with.d.ts.map +1 -0
- package/lib/assertions/core/tool-called-with.js +69 -0
- package/lib/assertions/core/tool-called-with.js.map +1 -0
- package/lib/assertions/core/tool-calls.d.ts +22 -0
- package/lib/assertions/core/tool-calls.d.ts.map +1 -0
- package/lib/assertions/core/tool-calls.js +17 -0
- package/lib/assertions/core/tool-calls.js.map +1 -0
- package/lib/assertions/core/tool-invocation.d.ts +36 -0
- package/lib/assertions/core/tool-invocation.d.ts.map +1 -0
- package/lib/assertions/core/tool-invocation.js +170 -0
- package/lib/assertions/core/tool-invocation.js.map +1 -0
- package/lib/assertions/core/tool-result-checks.d.ts +59 -0
- package/lib/assertions/core/tool-result-checks.d.ts.map +1 -0
- package/lib/assertions/core/tool-result-checks.js +193 -0
- package/lib/assertions/core/tool-result-checks.js.map +1 -0
- package/lib/assertions/mcp/discovery-checks.d.ts +36 -0
- package/lib/assertions/mcp/discovery-checks.d.ts.map +1 -0
- package/lib/assertions/mcp/discovery-checks.js +122 -0
- package/lib/assertions/mcp/discovery-checks.js.map +1 -0
- package/lib/assertions/mcp/index.d.ts +10 -0
- package/lib/assertions/mcp/index.d.ts.map +1 -0
- package/lib/assertions/mcp/index.js +25 -0
- package/lib/assertions/mcp/index.js.map +1 -0
- package/lib/assertions/rubric/index.d.ts +104 -0
- package/lib/assertions/rubric/index.d.ts.map +1 -0
- package/lib/assertions/rubric/index.js +191 -0
- package/lib/assertions/rubric/index.js.map +1 -0
- package/lib/assertions/rubric/internal.d.ts +14 -0
- package/lib/assertions/rubric/internal.d.ts.map +1 -0
- package/lib/assertions/rubric/internal.js +335 -0
- package/lib/assertions/rubric/internal.js.map +1 -0
- package/lib/authoring.d.ts +3 -0
- package/lib/authoring.d.ts.map +1 -0
- package/lib/authoring.js +3 -0
- package/lib/authoring.js.map +1 -0
- package/lib/cli/bin.d.ts +3 -0
- package/lib/cli/bin.d.ts.map +1 -0
- package/lib/cli/bin.js +15 -0
- package/lib/cli/bin.js.map +1 -0
- package/lib/cli/command-runtime.d.ts +5 -0
- package/lib/cli/command-runtime.d.ts.map +1 -0
- package/lib/cli/command-runtime.js +30 -0
- package/lib/cli/command-runtime.js.map +1 -0
- package/lib/cli/init.d.ts +21 -0
- package/lib/cli/init.d.ts.map +1 -0
- package/lib/cli/init.js +340 -0
- package/lib/cli/init.js.map +1 -0
- package/lib/cli/program.d.ts +22 -0
- package/lib/cli/program.d.ts.map +1 -0
- package/lib/cli/program.js +757 -0
- package/lib/cli/program.js.map +1 -0
- package/lib/cli/render/format.d.ts +14 -0
- package/lib/cli/render/format.d.ts.map +1 -0
- package/lib/cli/render/format.js +71 -0
- package/lib/cli/render/format.js.map +1 -0
- package/lib/cli/render/reporter.d.ts +73 -0
- package/lib/cli/render/reporter.d.ts.map +1 -0
- package/lib/cli/render/reporter.js +519 -0
- package/lib/cli/render/reporter.js.map +1 -0
- package/lib/cli/render/tty.d.ts +77 -0
- package/lib/cli/render/tty.d.ts.map +1 -0
- package/lib/cli/render/tty.js +283 -0
- package/lib/cli/render/tty.js.map +1 -0
- package/lib/cli/run-options.d.ts +27 -0
- package/lib/cli/run-options.d.ts.map +1 -0
- package/lib/cli/run-options.js +58 -0
- package/lib/cli/run-options.js.map +1 -0
- package/lib/cli/skills.d.ts +38 -0
- package/lib/cli/skills.d.ts.map +1 -0
- package/lib/cli/skills.js +84 -0
- package/lib/cli/skills.js.map +1 -0
- package/lib/core/annotation.d.ts +56 -0
- package/lib/core/annotation.d.ts.map +1 -0
- package/lib/core/annotation.js +92 -0
- package/lib/core/annotation.js.map +1 -0
- package/lib/core/answerer.d.ts +68 -0
- package/lib/core/answerer.d.ts.map +1 -0
- package/lib/core/answerer.js +17 -0
- package/lib/core/answerer.js.map +1 -0
- package/lib/core/artifact-evidence.d.ts +50 -0
- package/lib/core/artifact-evidence.d.ts.map +1 -0
- package/lib/core/artifact-evidence.js +185 -0
- package/lib/core/artifact-evidence.js.map +1 -0
- package/lib/core/artifact-snapshot.d.ts +37 -0
- package/lib/core/artifact-snapshot.d.ts.map +1 -0
- package/lib/core/artifact-snapshot.js +339 -0
- package/lib/core/artifact-snapshot.js.map +1 -0
- package/lib/core/assertion.d.ts +129 -0
- package/lib/core/assertion.d.ts.map +1 -0
- package/lib/core/assertion.js +75 -0
- package/lib/core/assertion.js.map +1 -0
- package/lib/core/case.d.ts +79 -0
- package/lib/core/case.d.ts.map +1 -0
- package/lib/core/case.js +90 -0
- package/lib/core/case.js.map +1 -0
- package/lib/core/conversation-turn.d.ts +23 -0
- package/lib/core/conversation-turn.d.ts.map +1 -0
- package/lib/core/conversation-turn.js +31 -0
- package/lib/core/conversation-turn.js.map +1 -0
- package/lib/core/driver.d.ts +64 -0
- package/lib/core/driver.d.ts.map +1 -0
- package/lib/core/driver.js +18 -0
- package/lib/core/driver.js.map +1 -0
- package/lib/core/emitter.d.ts +20 -0
- package/lib/core/emitter.d.ts.map +1 -0
- package/lib/core/emitter.js +34 -0
- package/lib/core/emitter.js.map +1 -0
- package/lib/core/events.d.ts +202 -0
- package/lib/core/events.d.ts.map +1 -0
- package/lib/core/events.js +107 -0
- package/lib/core/events.js.map +1 -0
- package/lib/core/exec.d.ts +82 -0
- package/lib/core/exec.d.ts.map +1 -0
- package/lib/core/exec.js +168 -0
- package/lib/core/exec.js.map +1 -0
- package/lib/core/experiment.d.ts +285 -0
- package/lib/core/experiment.d.ts.map +1 -0
- package/lib/core/experiment.js +389 -0
- package/lib/core/experiment.js.map +1 -0
- package/lib/core/glob.d.ts +3 -0
- package/lib/core/glob.d.ts.map +1 -0
- package/lib/core/glob.js +32 -0
- package/lib/core/glob.js.map +1 -0
- package/lib/core/hash.d.ts +8 -0
- package/lib/core/hash.d.ts.map +1 -0
- package/lib/core/hash.js +214 -0
- package/lib/core/hash.js.map +1 -0
- package/lib/core/index.d.ts +29 -0
- package/lib/core/index.d.ts.map +1 -0
- package/lib/core/index.js +29 -0
- package/lib/core/index.js.map +1 -0
- package/lib/core/lifecycle-fixtures.d.ts +20 -0
- package/lib/core/lifecycle-fixtures.d.ts.map +1 -0
- package/lib/core/lifecycle-fixtures.js +109 -0
- package/lib/core/lifecycle-fixtures.js.map +1 -0
- package/lib/core/lifecycle-hooks.d.ts +52 -0
- package/lib/core/lifecycle-hooks.d.ts.map +1 -0
- package/lib/core/lifecycle-hooks.js +42 -0
- package/lib/core/lifecycle-hooks.js.map +1 -0
- package/lib/core/mcp-events.d.ts +44 -0
- package/lib/core/mcp-events.d.ts.map +1 -0
- package/lib/core/mcp-events.js +23 -0
- package/lib/core/mcp-events.js.map +1 -0
- package/lib/core/model-cli.d.ts +57 -0
- package/lib/core/model-cli.d.ts.map +1 -0
- package/lib/core/model-cli.js +237 -0
- package/lib/core/model-cli.js.map +1 -0
- package/lib/core/observer.d.ts +31 -0
- package/lib/core/observer.d.ts.map +1 -0
- package/lib/core/observer.js +25 -0
- package/lib/core/observer.js.map +1 -0
- package/lib/core/platform-process.d.ts +33 -0
- package/lib/core/platform-process.d.ts.map +1 -0
- package/lib/core/platform-process.js +214 -0
- package/lib/core/platform-process.js.map +1 -0
- package/lib/core/registry.d.ts +22 -0
- package/lib/core/registry.d.ts.map +1 -0
- package/lib/core/registry.js +45 -0
- package/lib/core/registry.js.map +1 -0
- package/lib/core/rubric.d.ts +18 -0
- package/lib/core/rubric.d.ts.map +1 -0
- package/lib/core/rubric.js +49 -0
- package/lib/core/rubric.js.map +1 -0
- package/lib/core/run.d.ts +419 -0
- package/lib/core/run.d.ts.map +1 -0
- package/lib/core/run.js +126 -0
- package/lib/core/run.js.map +1 -0
- package/lib/core/statistics.d.ts +39 -0
- package/lib/core/statistics.d.ts.map +1 -0
- package/lib/core/statistics.js +163 -0
- package/lib/core/statistics.js.map +1 -0
- package/lib/core/subject.d.ts +4 -0
- package/lib/core/subject.d.ts.map +1 -0
- package/lib/core/subject.js +46 -0
- package/lib/core/subject.js.map +1 -0
- package/lib/core/tool-events.d.ts +69 -0
- package/lib/core/tool-events.d.ts.map +1 -0
- package/lib/core/tool-events.js +242 -0
- package/lib/core/tool-events.js.map +1 -0
- package/lib/core/usage.d.ts +78 -0
- package/lib/core/usage.d.ts.map +1 -0
- package/lib/core/usage.js +104 -0
- package/lib/core/usage.js.map +1 -0
- package/lib/core/wire.d.ts +83 -0
- package/lib/core/wire.d.ts.map +1 -0
- package/lib/core/wire.js +101 -0
- package/lib/core/wire.js.map +1 -0
- package/lib/core/zod.d.ts +10 -0
- package/lib/core/zod.d.ts.map +1 -0
- package/lib/core/zod.js +18 -0
- package/lib/core/zod.js.map +1 -0
- package/lib/drivers/claude-code/index.d.ts +55 -0
- package/lib/drivers/claude-code/index.d.ts.map +1 -0
- package/lib/drivers/claude-code/index.js +779 -0
- package/lib/drivers/claude-code/index.js.map +1 -0
- package/lib/drivers/claude-code/parse-events.d.ts +46 -0
- package/lib/drivers/claude-code/parse-events.d.ts.map +1 -0
- package/lib/drivers/claude-code/parse-events.js +387 -0
- package/lib/drivers/claude-code/parse-events.js.map +1 -0
- package/lib/drivers/codex/app-events.d.ts +16 -0
- package/lib/drivers/codex/app-events.d.ts.map +1 -0
- package/lib/drivers/codex/app-events.js +184 -0
- package/lib/drivers/codex/app-events.js.map +1 -0
- package/lib/drivers/codex/config.d.ts +55 -0
- package/lib/drivers/codex/config.d.ts.map +1 -0
- package/lib/drivers/codex/config.js +125 -0
- package/lib/drivers/codex/config.js.map +1 -0
- package/lib/drivers/codex/index.d.ts +8 -0
- package/lib/drivers/codex/index.d.ts.map +1 -0
- package/lib/drivers/codex/index.js +904 -0
- package/lib/drivers/codex/index.js.map +1 -0
- package/lib/drivers/mcp/index.d.ts +52 -0
- package/lib/drivers/mcp/index.d.ts.map +1 -0
- package/lib/drivers/mcp/index.js +282 -0
- package/lib/drivers/mcp/index.js.map +1 -0
- package/lib/drivers/mcp/transport.d.ts +50 -0
- package/lib/drivers/mcp/transport.d.ts.map +1 -0
- package/lib/drivers/mcp/transport.js +190 -0
- package/lib/drivers/mcp/transport.js.map +1 -0
- package/lib/drivers/shared/artifacts.d.ts +4 -0
- package/lib/drivers/shared/artifacts.d.ts.map +1 -0
- package/lib/drivers/shared/artifacts.js +81 -0
- package/lib/drivers/shared/artifacts.js.map +1 -0
- package/lib/drivers/shared/secure-copy.d.ts +2 -0
- package/lib/drivers/shared/secure-copy.d.ts.map +1 -0
- package/lib/drivers/shared/secure-copy.js +35 -0
- package/lib/drivers/shared/secure-copy.js.map +1 -0
- package/lib/drivers/subprocess/index.d.ts +24 -0
- package/lib/drivers/subprocess/index.d.ts.map +1 -0
- package/lib/drivers/subprocess/index.js +451 -0
- package/lib/drivers/subprocess/index.js.map +1 -0
- package/lib/index.d.ts +40 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +48 -0
- package/lib/index.js.map +1 -0
- package/lib/optimization/reflective.d.ts +27 -0
- package/lib/optimization/reflective.d.ts.map +1 -0
- package/lib/optimization/reflective.js +257 -0
- package/lib/optimization/reflective.js.map +1 -0
- package/lib/orchestrator/annotation-loader.d.ts +65 -0
- package/lib/orchestrator/annotation-loader.d.ts.map +1 -0
- package/lib/orchestrator/annotation-loader.js +73 -0
- package/lib/orchestrator/annotation-loader.js.map +1 -0
- package/lib/orchestrator/annotation-store.d.ts +3 -0
- package/lib/orchestrator/annotation-store.d.ts.map +1 -0
- package/lib/orchestrator/annotation-store.js +100 -0
- package/lib/orchestrator/annotation-store.js.map +1 -0
- package/lib/orchestrator/authored-dependencies.d.ts +3 -0
- package/lib/orchestrator/authored-dependencies.d.ts.map +1 -0
- package/lib/orchestrator/authored-dependencies.js +146 -0
- package/lib/orchestrator/authored-dependencies.js.map +1 -0
- package/lib/orchestrator/campaign-lifecycle.d.ts +105 -0
- package/lib/orchestrator/campaign-lifecycle.d.ts.map +1 -0
- package/lib/orchestrator/campaign-lifecycle.js +141 -0
- package/lib/orchestrator/campaign-lifecycle.js.map +1 -0
- package/lib/orchestrator/candidate-integrity.d.ts +4 -0
- package/lib/orchestrator/candidate-integrity.d.ts.map +1 -0
- package/lib/orchestrator/candidate-integrity.js +14 -0
- package/lib/orchestrator/candidate-integrity.js.map +1 -0
- package/lib/orchestrator/candidates.d.ts +13 -0
- package/lib/orchestrator/candidates.d.ts.map +1 -0
- package/lib/orchestrator/candidates.js +577 -0
- package/lib/orchestrator/candidates.js.map +1 -0
- package/lib/orchestrator/compare.d.ts +80 -0
- package/lib/orchestrator/compare.d.ts.map +1 -0
- package/lib/orchestrator/compare.js +270 -0
- package/lib/orchestrator/compare.js.map +1 -0
- package/lib/orchestrator/comparison-identity.d.ts +10 -0
- package/lib/orchestrator/comparison-identity.d.ts.map +1 -0
- package/lib/orchestrator/comparison-identity.js +39 -0
- package/lib/orchestrator/comparison-identity.js.map +1 -0
- package/lib/orchestrator/config.d.ts +121 -0
- package/lib/orchestrator/config.d.ts.map +1 -0
- package/lib/orchestrator/config.js +176 -0
- package/lib/orchestrator/config.js.map +1 -0
- package/lib/orchestrator/content-bound-json.d.ts +5 -0
- package/lib/orchestrator/content-bound-json.d.ts.map +1 -0
- package/lib/orchestrator/content-bound-json.js +59 -0
- package/lib/orchestrator/content-bound-json.js.map +1 -0
- package/lib/orchestrator/discover.d.ts +45 -0
- package/lib/orchestrator/discover.d.ts.map +1 -0
- package/lib/orchestrator/discover.js +98 -0
- package/lib/orchestrator/discover.js.map +1 -0
- package/lib/orchestrator/doctor.d.ts +141 -0
- package/lib/orchestrator/doctor.d.ts.map +1 -0
- package/lib/orchestrator/doctor.js +525 -0
- package/lib/orchestrator/doctor.js.map +1 -0
- package/lib/orchestrator/driver-session.d.ts +177 -0
- package/lib/orchestrator/driver-session.d.ts.map +1 -0
- package/lib/orchestrator/driver-session.js +396 -0
- package/lib/orchestrator/driver-session.js.map +1 -0
- package/lib/orchestrator/evaluator-identity.d.ts +7 -0
- package/lib/orchestrator/evaluator-identity.d.ts.map +1 -0
- package/lib/orchestrator/evaluator-identity.js +42 -0
- package/lib/orchestrator/evaluator-identity.js.map +1 -0
- package/lib/orchestrator/experiment-budget.d.ts +11 -0
- package/lib/orchestrator/experiment-budget.d.ts.map +1 -0
- package/lib/orchestrator/experiment-budget.js +51 -0
- package/lib/orchestrator/experiment-budget.js.map +1 -0
- package/lib/orchestrator/experiment-context.d.ts +43 -0
- package/lib/orchestrator/experiment-context.d.ts.map +1 -0
- package/lib/orchestrator/experiment-context.js +9 -0
- package/lib/orchestrator/experiment-context.js.map +1 -0
- package/lib/orchestrator/experiment-contracts.d.ts +290 -0
- package/lib/orchestrator/experiment-contracts.d.ts.map +1 -0
- package/lib/orchestrator/experiment-contracts.js +38 -0
- package/lib/orchestrator/experiment-contracts.js.map +1 -0
- package/lib/orchestrator/experiment-corpus.d.ts +21 -0
- package/lib/orchestrator/experiment-corpus.d.ts.map +1 -0
- package/lib/orchestrator/experiment-corpus.js +276 -0
- package/lib/orchestrator/experiment-corpus.js.map +1 -0
- package/lib/orchestrator/experiment-evaluation.d.ts +44 -0
- package/lib/orchestrator/experiment-evaluation.d.ts.map +1 -0
- package/lib/orchestrator/experiment-evaluation.js +542 -0
- package/lib/orchestrator/experiment-evaluation.js.map +1 -0
- package/lib/orchestrator/experiment-finish.d.ts +6 -0
- package/lib/orchestrator/experiment-finish.d.ts.map +1 -0
- package/lib/orchestrator/experiment-finish.js +19 -0
- package/lib/orchestrator/experiment-finish.js.map +1 -0
- package/lib/orchestrator/experiment-identity.d.ts +6 -0
- package/lib/orchestrator/experiment-identity.d.ts.map +1 -0
- package/lib/orchestrator/experiment-identity.js +257 -0
- package/lib/orchestrator/experiment-identity.js.map +1 -0
- package/lib/orchestrator/experiment-loader.d.ts +175 -0
- package/lib/orchestrator/experiment-loader.d.ts.map +1 -0
- package/lib/orchestrator/experiment-loader.js +77 -0
- package/lib/orchestrator/experiment-loader.js.map +1 -0
- package/lib/orchestrator/experiment-report.d.ts +450 -0
- package/lib/orchestrator/experiment-report.d.ts.map +1 -0
- package/lib/orchestrator/experiment-report.js +570 -0
- package/lib/orchestrator/experiment-report.js.map +1 -0
- package/lib/orchestrator/experiment-runs.d.ts +379 -0
- package/lib/orchestrator/experiment-runs.d.ts.map +1 -0
- package/lib/orchestrator/experiment-runs.js +796 -0
- package/lib/orchestrator/experiment-runs.js.map +1 -0
- package/lib/orchestrator/experiment-runtime-identity.d.ts +41 -0
- package/lib/orchestrator/experiment-runtime-identity.d.ts.map +1 -0
- package/lib/orchestrator/experiment-runtime-identity.js +411 -0
- package/lib/orchestrator/experiment-runtime-identity.js.map +1 -0
- package/lib/orchestrator/experiment-selection.d.ts +25 -0
- package/lib/orchestrator/experiment-selection.d.ts.map +1 -0
- package/lib/orchestrator/experiment-selection.js +286 -0
- package/lib/orchestrator/experiment-selection.js.map +1 -0
- package/lib/orchestrator/experiment.d.ts +11 -0
- package/lib/orchestrator/experiment.d.ts.map +1 -0
- package/lib/orchestrator/experiment.js +639 -0
- package/lib/orchestrator/experiment.js.map +1 -0
- package/lib/orchestrator/fixture-identity.d.ts +7 -0
- package/lib/orchestrator/fixture-identity.d.ts.map +1 -0
- package/lib/orchestrator/fixture-identity.js +55 -0
- package/lib/orchestrator/fixture-identity.js.map +1 -0
- package/lib/orchestrator/fs-read.d.ts +19 -0
- package/lib/orchestrator/fs-read.d.ts.map +1 -0
- package/lib/orchestrator/fs-read.js +113 -0
- package/lib/orchestrator/fs-read.js.map +1 -0
- package/lib/orchestrator/grader-experiment.d.ts +190 -0
- package/lib/orchestrator/grader-experiment.d.ts.map +1 -0
- package/lib/orchestrator/grader-experiment.js +579 -0
- package/lib/orchestrator/grader-experiment.js.map +1 -0
- package/lib/orchestrator/grading.d.ts +31 -0
- package/lib/orchestrator/grading.d.ts.map +1 -0
- package/lib/orchestrator/grading.js +186 -0
- package/lib/orchestrator/grading.js.map +1 -0
- package/lib/orchestrator/index.d.ts +22 -0
- package/lib/orchestrator/index.d.ts.map +1 -0
- package/lib/orchestrator/index.js +30 -0
- package/lib/orchestrator/index.js.map +1 -0
- package/lib/orchestrator/lifecycle-hook-execution.d.ts +4 -0
- package/lib/orchestrator/lifecycle-hook-execution.d.ts.map +1 -0
- package/lib/orchestrator/lifecycle-hook-execution.js +67 -0
- package/lib/orchestrator/lifecycle-hook-execution.js.map +1 -0
- package/lib/orchestrator/list-runs.d.ts +33 -0
- package/lib/orchestrator/list-runs.d.ts.map +1 -0
- package/lib/orchestrator/list-runs.js +308 -0
- package/lib/orchestrator/list-runs.js.map +1 -0
- package/lib/orchestrator/loader.d.ts +3 -0
- package/lib/orchestrator/loader.d.ts.map +1 -0
- package/lib/orchestrator/loader.js +17 -0
- package/lib/orchestrator/loader.js.map +1 -0
- package/lib/orchestrator/optimization-lifecycle.d.ts +12 -0
- package/lib/orchestrator/optimization-lifecycle.d.ts.map +1 -0
- package/lib/orchestrator/optimization-lifecycle.js +92 -0
- package/lib/orchestrator/optimization-lifecycle.js.map +1 -0
- package/lib/orchestrator/orchestrator.d.ts +144 -0
- package/lib/orchestrator/orchestrator.d.ts.map +1 -0
- package/lib/orchestrator/orchestrator.js +632 -0
- package/lib/orchestrator/orchestrator.js.map +1 -0
- package/lib/orchestrator/owned-lock.d.ts +17 -0
- package/lib/orchestrator/owned-lock.d.ts.map +1 -0
- package/lib/orchestrator/owned-lock.js +149 -0
- package/lib/orchestrator/owned-lock.js.map +1 -0
- package/lib/orchestrator/package-version.d.ts +2 -0
- package/lib/orchestrator/package-version.d.ts.map +1 -0
- package/lib/orchestrator/package-version.js +4 -0
- package/lib/orchestrator/package-version.js.map +1 -0
- package/lib/orchestrator/provenance.d.ts +5 -0
- package/lib/orchestrator/provenance.d.ts.map +1 -0
- package/lib/orchestrator/provenance.js +137 -0
- package/lib/orchestrator/provenance.js.map +1 -0
- package/lib/orchestrator/regrade.d.ts +80 -0
- package/lib/orchestrator/regrade.d.ts.map +1 -0
- package/lib/orchestrator/regrade.js +433 -0
- package/lib/orchestrator/regrade.js.map +1 -0
- package/lib/orchestrator/rubric-loader.d.ts +7 -0
- package/lib/orchestrator/rubric-loader.d.ts.map +1 -0
- package/lib/orchestrator/rubric-loader.js +65 -0
- package/lib/orchestrator/rubric-loader.js.map +1 -0
- package/lib/orchestrator/run-dir.d.ts +40 -0
- package/lib/orchestrator/run-dir.d.ts.map +1 -0
- package/lib/orchestrator/run-dir.js +161 -0
- package/lib/orchestrator/run-dir.js.map +1 -0
- package/lib/orchestrator/run-execution.d.ts +30 -0
- package/lib/orchestrator/run-execution.d.ts.map +1 -0
- package/lib/orchestrator/run-execution.js +531 -0
- package/lib/orchestrator/run-execution.js.map +1 -0
- package/lib/orchestrator/run-lifecycle.d.ts +115 -0
- package/lib/orchestrator/run-lifecycle.d.ts.map +1 -0
- package/lib/orchestrator/run-lifecycle.js +136 -0
- package/lib/orchestrator/run-lifecycle.js.map +1 -0
- package/lib/orchestrator/suite-compare.d.ts +76 -0
- package/lib/orchestrator/suite-compare.d.ts.map +1 -0
- package/lib/orchestrator/suite-compare.js +159 -0
- package/lib/orchestrator/suite-compare.js.map +1 -0
- package/lib/orchestrator/suite-lifecycle.d.ts +157 -0
- package/lib/orchestrator/suite-lifecycle.d.ts.map +1 -0
- package/lib/orchestrator/suite-lifecycle.js +253 -0
- package/lib/orchestrator/suite-lifecycle.js.map +1 -0
- package/lib/orchestrator/suite-runs.d.ts +91 -0
- package/lib/orchestrator/suite-runs.d.ts.map +1 -0
- package/lib/orchestrator/suite-runs.js +157 -0
- package/lib/orchestrator/suite-runs.js.map +1 -0
- package/lib/orchestrator/suite-summary.d.ts +109 -0
- package/lib/orchestrator/suite-summary.d.ts.map +1 -0
- package/lib/orchestrator/suite-summary.js +213 -0
- package/lib/orchestrator/suite-summary.js.map +1 -0
- package/lib/orchestrator/trace-limits.d.ts +20 -0
- package/lib/orchestrator/trace-limits.d.ts.map +1 -0
- package/lib/orchestrator/trace-limits.js +28 -0
- package/lib/orchestrator/trace-limits.js.map +1 -0
- package/lib/orchestrator/validate-plugin-config.d.ts +10 -0
- package/lib/orchestrator/validate-plugin-config.d.ts.map +1 -0
- package/lib/orchestrator/validate-plugin-config.js +26 -0
- package/lib/orchestrator/validate-plugin-config.js.map +1 -0
- package/package.json +84 -0
- package/skills/lux/SKILL.md +85 -0
- package/skills/lux/references/cli.md +102 -0
- package/skills/lux/references/eval-authoring.md +105 -0
- package/skills/lux-answerer/SKILL.md +169 -0
- package/src/answerers/claude-code/index.ts +342 -0
- package/src/answerers/persona/index.ts +327 -0
- package/src/answerers/scripted/index.ts +186 -0
- package/src/answerers/shared.ts +23 -0
- package/src/answerers/terminal/index.ts +117 -0
- package/src/assertions/core/command-exits-zero.ts +94 -0
- package/src/assertions/core/event-checks.ts +138 -0
- package/src/assertions/core/file-checks.ts +336 -0
- package/src/assertions/core/helpers.ts +203 -0
- package/src/assertions/core/index.ts +80 -0
- package/src/assertions/core/json-pointer-equals.ts +84 -0
- package/src/assertions/core/output-checks.ts +134 -0
- package/src/assertions/core/predicate.ts +67 -0
- package/src/assertions/core/resource-checks.ts +180 -0
- package/src/assertions/core/safe-regex.ts +196 -0
- package/src/assertions/core/tool-called-with.ts +68 -0
- package/src/assertions/core/tool-calls.ts +28 -0
- package/src/assertions/core/tool-invocation.ts +198 -0
- package/src/assertions/core/tool-result-checks.ts +211 -0
- package/src/assertions/mcp/discovery-checks.ts +139 -0
- package/src/assertions/mcp/index.ts +37 -0
- package/src/assertions/rubric/index.ts +258 -0
- package/src/assertions/rubric/internal.ts +367 -0
- package/src/authoring.ts +2 -0
- package/src/cli/bin.ts +14 -0
- package/src/cli/command-runtime.ts +34 -0
- package/src/cli/init.ts +410 -0
- package/src/cli/program.ts +992 -0
- package/src/cli/render/format.ts +69 -0
- package/src/cli/render/reporter.ts +643 -0
- package/src/cli/render/tty.ts +314 -0
- package/src/cli/run-options.ts +82 -0
- package/src/cli/skills.ts +129 -0
- package/src/core/annotation.ts +104 -0
- package/src/core/answerer.ts +75 -0
- package/src/core/artifact-evidence.ts +249 -0
- package/src/core/artifact-snapshot.ts +429 -0
- package/src/core/assertion.ts +156 -0
- package/src/core/case.ts +103 -0
- package/src/core/conversation-turn.ts +47 -0
- package/src/core/driver.ts +75 -0
- package/src/core/emitter.ts +38 -0
- package/src/core/events.ts +135 -0
- package/src/core/exec.ts +263 -0
- package/src/core/experiment.ts +467 -0
- package/src/core/glob.ts +31 -0
- package/src/core/hash.ts +237 -0
- package/src/core/index.ts +28 -0
- package/src/core/lifecycle-fixtures.ts +145 -0
- package/src/core/lifecycle-hooks.ts +101 -0
- package/src/core/mcp-events.ts +57 -0
- package/src/core/model-cli.ts +271 -0
- package/src/core/observer.ts +50 -0
- package/src/core/platform-process.ts +284 -0
- package/src/core/registry.ts +57 -0
- package/src/core/rubric.ts +52 -0
- package/src/core/run.ts +144 -0
- package/src/core/statistics.ts +194 -0
- package/src/core/subject.ts +50 -0
- package/src/core/tool-events.ts +292 -0
- package/src/core/usage.ts +123 -0
- package/src/core/wire.ts +135 -0
- package/src/core/zod.ts +20 -0
- package/src/drivers/claude-code/index.ts +866 -0
- package/src/drivers/claude-code/parse-events.ts +464 -0
- package/src/drivers/codex/app-events.ts +218 -0
- package/src/drivers/codex/config.ts +128 -0
- package/src/drivers/codex/index.ts +995 -0
- package/src/drivers/mcp/index.ts +351 -0
- package/src/drivers/mcp/transport.ts +222 -0
- package/src/drivers/shared/artifacts.ts +86 -0
- package/src/drivers/shared/secure-copy.ts +40 -0
- package/src/drivers/subprocess/index.ts +490 -0
- package/src/index.ts +594 -0
- package/src/optimization/reflective.ts +319 -0
- package/src/orchestrator/annotation-loader.ts +97 -0
- package/src/orchestrator/annotation-store.ts +112 -0
- package/src/orchestrator/authored-dependencies.ts +193 -0
- package/src/orchestrator/campaign-lifecycle.ts +181 -0
- package/src/orchestrator/candidate-integrity.ts +18 -0
- package/src/orchestrator/candidates.ts +683 -0
- package/src/orchestrator/compare.ts +358 -0
- package/src/orchestrator/comparison-identity.ts +45 -0
- package/src/orchestrator/config.ts +205 -0
- package/src/orchestrator/content-bound-json.ts +71 -0
- package/src/orchestrator/discover.ts +132 -0
- package/src/orchestrator/doctor.ts +781 -0
- package/src/orchestrator/driver-session.ts +507 -0
- package/src/orchestrator/evaluator-identity.ts +45 -0
- package/src/orchestrator/experiment-budget.ts +61 -0
- package/src/orchestrator/experiment-context.ts +41 -0
- package/src/orchestrator/experiment-contracts.ts +43 -0
- package/src/orchestrator/experiment-corpus.ts +416 -0
- package/src/orchestrator/experiment-evaluation.ts +749 -0
- package/src/orchestrator/experiment-finish.ts +33 -0
- package/src/orchestrator/experiment-identity.ts +356 -0
- package/src/orchestrator/experiment-loader.ts +105 -0
- package/src/orchestrator/experiment-report.ts +788 -0
- package/src/orchestrator/experiment-runs.ts +960 -0
- package/src/orchestrator/experiment-runtime-identity.ts +465 -0
- package/src/orchestrator/experiment-selection.ts +467 -0
- package/src/orchestrator/experiment.ts +991 -0
- package/src/orchestrator/fixture-identity.ts +67 -0
- package/src/orchestrator/fs-read.ts +126 -0
- package/src/orchestrator/grader-experiment.ts +856 -0
- package/src/orchestrator/grading.ts +260 -0
- package/src/orchestrator/index.ts +186 -0
- package/src/orchestrator/lifecycle-hook-execution.ts +90 -0
- package/src/orchestrator/list-runs.ts +384 -0
- package/src/orchestrator/loader.ts +19 -0
- package/src/orchestrator/optimization-lifecycle.ts +126 -0
- package/src/orchestrator/orchestrator.ts +919 -0
- package/src/orchestrator/owned-lock.ts +147 -0
- package/src/orchestrator/package-version.ts +5 -0
- package/src/orchestrator/provenance.ts +140 -0
- package/src/orchestrator/regrade.ts +580 -0
- package/src/orchestrator/rubric-loader.ts +74 -0
- package/src/orchestrator/run-dir.ts +209 -0
- package/src/orchestrator/run-execution.ts +694 -0
- package/src/orchestrator/run-lifecycle.ts +174 -0
- package/src/orchestrator/suite-compare.ts +195 -0
- package/src/orchestrator/suite-lifecycle.ts +335 -0
- package/src/orchestrator/suite-runs.ts +202 -0
- package/src/orchestrator/suite-summary.ts +276 -0
- package/src/orchestrator/trace-limits.ts +65 -0
- package/src/orchestrator/validate-plugin-config.ts +34 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { type AssertionImpl } from "../../core/index.js";
|
|
3
|
+
export declare const LatencyUnderConfigSchema: z.ZodObject<{
|
|
4
|
+
id: z.ZodOptional<z.ZodString>;
|
|
5
|
+
weight: z.ZodOptional<z.ZodNumber>;
|
|
6
|
+
threshold: z.ZodOptional<z.ZodNumber>;
|
|
7
|
+
name: z.ZodOptional<z.ZodString>;
|
|
8
|
+
type: z.ZodLiteral<"latency-under">;
|
|
9
|
+
maxMs: z.ZodNumber;
|
|
10
|
+
}, z.core.$strict>;
|
|
11
|
+
export type LatencyUnderConfig = z.infer<typeof LatencyUnderConfigSchema>;
|
|
12
|
+
export declare const latencyUnderAssertion: AssertionImpl<LatencyUnderConfig>;
|
|
13
|
+
export declare const TokensUnderConfigSchema: z.ZodObject<{
|
|
14
|
+
id: z.ZodOptional<z.ZodString>;
|
|
15
|
+
weight: z.ZodOptional<z.ZodNumber>;
|
|
16
|
+
threshold: z.ZodOptional<z.ZodNumber>;
|
|
17
|
+
name: z.ZodOptional<z.ZodString>;
|
|
18
|
+
type: z.ZodLiteral<"tokens-under">;
|
|
19
|
+
max: z.ZodNumber;
|
|
20
|
+
component: z.ZodDefault<z.ZodEnum<{
|
|
21
|
+
cacheCreation: "cacheCreation";
|
|
22
|
+
cacheRead: "cacheRead";
|
|
23
|
+
input: "input";
|
|
24
|
+
output: "output";
|
|
25
|
+
total: "total";
|
|
26
|
+
}>>;
|
|
27
|
+
onUnavailable: z.ZodOptional<z.ZodEnum<{
|
|
28
|
+
fail: "fail";
|
|
29
|
+
pass: "pass";
|
|
30
|
+
}>>;
|
|
31
|
+
}, z.core.$strict>;
|
|
32
|
+
export type TokensUnderConfig = z.infer<typeof TokensUnderConfigSchema>;
|
|
33
|
+
export declare const tokensUnderAssertion: AssertionImpl<TokensUnderConfig>;
|
|
34
|
+
export declare const CostUnderConfigSchema: z.ZodObject<{
|
|
35
|
+
id: z.ZodOptional<z.ZodString>;
|
|
36
|
+
weight: z.ZodOptional<z.ZodNumber>;
|
|
37
|
+
threshold: z.ZodOptional<z.ZodNumber>;
|
|
38
|
+
name: z.ZodOptional<z.ZodString>;
|
|
39
|
+
type: z.ZodLiteral<"cost-under">;
|
|
40
|
+
maxUsd: z.ZodNumber;
|
|
41
|
+
onUnavailable: z.ZodOptional<z.ZodEnum<{
|
|
42
|
+
fail: "fail";
|
|
43
|
+
pass: "pass";
|
|
44
|
+
}>>;
|
|
45
|
+
}, z.core.$strict>;
|
|
46
|
+
export type CostUnderConfig = z.infer<typeof CostUnderConfigSchema>;
|
|
47
|
+
export declare const costUnderAssertion: AssertionImpl<CostUnderConfig>;
|
|
48
|
+
export declare const ArtifactBytesUnderConfigSchema: z.ZodObject<{
|
|
49
|
+
id: z.ZodOptional<z.ZodString>;
|
|
50
|
+
weight: z.ZodOptional<z.ZodNumber>;
|
|
51
|
+
threshold: z.ZodOptional<z.ZodNumber>;
|
|
52
|
+
name: z.ZodOptional<z.ZodString>;
|
|
53
|
+
type: z.ZodLiteral<"artifact-bytes-under">;
|
|
54
|
+
max: z.ZodNumber;
|
|
55
|
+
onUnavailable: z.ZodOptional<z.ZodEnum<{
|
|
56
|
+
fail: "fail";
|
|
57
|
+
pass: "pass";
|
|
58
|
+
}>>;
|
|
59
|
+
}, z.core.$strict>;
|
|
60
|
+
export type ArtifactBytesUnderConfig = z.infer<typeof ArtifactBytesUnderConfigSchema>;
|
|
61
|
+
export declare const artifactBytesUnderAssertion: AssertionImpl<ArtifactBytesUnderConfig>;
|
|
62
|
+
export declare const RunSucceededConfigSchema: z.ZodObject<{
|
|
63
|
+
id: z.ZodOptional<z.ZodString>;
|
|
64
|
+
weight: z.ZodOptional<z.ZodNumber>;
|
|
65
|
+
threshold: z.ZodOptional<z.ZodNumber>;
|
|
66
|
+
name: z.ZodOptional<z.ZodString>;
|
|
67
|
+
type: z.ZodLiteral<"run-succeeded">;
|
|
68
|
+
}, z.core.$strict>;
|
|
69
|
+
export type RunSucceededConfig = z.infer<typeof RunSucceededConfigSchema>;
|
|
70
|
+
export declare const runSucceededAssertion: AssertionImpl<RunSucceededConfig>;
|
|
71
|
+
//# sourceMappingURL=resource-checks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resource-checks.d.ts","sourceRoot":"","sources":["../../../src/assertions/core/resource-checks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,KAAK,aAAa,EAAoC,MAAM,qBAAqB,CAAC;AAY3F,eAAO,MAAM,wBAAwB;;;;;;;kBAM1B,CAAC;AACZ,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E,eAAO,MAAM,qBAAqB,EAAE,aAAa,CAAC,kBAAkB,CAsBnE,CAAC;AAEF,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;kBAczB,CAAC;AACZ,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAIxE,eAAO,MAAM,oBAAoB,EAAE,aAAa,CAAC,iBAAiB,CAqBjE,CAAC;AAEF,eAAO,MAAM,qBAAqB;;;;;;;;;;;kBAOvB,CAAC;AACZ,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE,eAAO,MAAM,kBAAkB,EAAE,aAAa,CAAC,eAAe,CAgB7D,CAAC;AAEF,eAAO,MAAM,8BAA8B;;;;;;;;;;;kBAOhC,CAAC;AACZ,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC;AAEtF,eAAO,MAAM,2BAA2B,EAAE,aAAa,CAAC,wBAAwB,CA0B/E,CAAC;AAMF,eAAO,MAAM,wBAAwB;;;;;;kBAK1B,CAAC;AACZ,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E,eAAO,MAAM,qBAAqB,EAAE,aAAa,CAAC,kBAAkB,CAanE,CAAC"}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { inspectRunArtifact, isUsageEmpty } from "../../core/index.js";
|
|
3
|
+
import { baseAssertionFields as baseFields } from "./helpers.js";
|
|
4
|
+
const UnavailablePolicySchema = z.enum(["pass", "fail"]);
|
|
5
|
+
const unavailable = (resource, policy) => ({
|
|
6
|
+
passed: policy === "pass",
|
|
7
|
+
score: policy === "pass" ? 1 : 0,
|
|
8
|
+
comment: `${resource} unavailable`,
|
|
9
|
+
detail: { unavailable: true },
|
|
10
|
+
});
|
|
11
|
+
export const LatencyUnderConfigSchema = z
|
|
12
|
+
.object({
|
|
13
|
+
type: z.literal("latency-under"),
|
|
14
|
+
maxMs: z.number().positive(),
|
|
15
|
+
...baseFields,
|
|
16
|
+
})
|
|
17
|
+
.strict();
|
|
18
|
+
export const latencyUnderAssertion = {
|
|
19
|
+
type: "latency-under",
|
|
20
|
+
configSchema: LatencyUnderConfigSchema,
|
|
21
|
+
evaluate: async (config, run) => {
|
|
22
|
+
const start = Date.parse(run.metadata.startedAt);
|
|
23
|
+
const end = Date.parse(run.metadata.endedAt);
|
|
24
|
+
if (Number.isNaN(start) || Number.isNaN(end)) {
|
|
25
|
+
return {
|
|
26
|
+
passed: false,
|
|
27
|
+
score: 0,
|
|
28
|
+
comment: "duration unavailable (missing timestamps)",
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
const ms = end - start;
|
|
32
|
+
const passed = ms <= config.maxMs;
|
|
33
|
+
return {
|
|
34
|
+
passed,
|
|
35
|
+
score: passed ? 1 : 0,
|
|
36
|
+
comment: `${ms}ms ${passed ? "<=" : ">"} ${config.maxMs}ms`,
|
|
37
|
+
detail: { durationMs: ms },
|
|
38
|
+
};
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
export const TokensUnderConfigSchema = z
|
|
42
|
+
.object({
|
|
43
|
+
type: z.literal("tokens-under"),
|
|
44
|
+
max: z.number().positive(),
|
|
45
|
+
/**
|
|
46
|
+
* `total` is uncached input + output, the historical meaning. Cache traffic
|
|
47
|
+
* is counted separately because it is billed differently and, on a warm
|
|
48
|
+
* session, dwarfs `input` by two orders of magnitude.
|
|
49
|
+
*/
|
|
50
|
+
component: z.enum(["input", "output", "total", "cacheRead", "cacheCreation"]).default("total"),
|
|
51
|
+
/** Compatibility defaults to pass; optimization campaigns should require fail. */
|
|
52
|
+
onUnavailable: UnavailablePolicySchema.optional(),
|
|
53
|
+
...baseFields,
|
|
54
|
+
})
|
|
55
|
+
.strict();
|
|
56
|
+
// Grades the agent under test, never the harness: an eval must not fail
|
|
57
|
+
// because the persona answerer or the LLM judge got chatty.
|
|
58
|
+
export const tokensUnderAssertion = {
|
|
59
|
+
type: "tokens-under",
|
|
60
|
+
configSchema: TokensUnderConfigSchema,
|
|
61
|
+
evaluate: async (config, run) => {
|
|
62
|
+
const agent = run.metadata.usage.agent;
|
|
63
|
+
// A driver that reports nothing arrives here as all-zeros. Treat that as
|
|
64
|
+
// "unknown", not as "the agent spent zero tokens" — no real agent spends
|
|
65
|
+
// zero.
|
|
66
|
+
if (isUsageEmpty(agent)) {
|
|
67
|
+
return unavailable("tokens (driver did not report)", config.onUnavailable ?? "pass");
|
|
68
|
+
}
|
|
69
|
+
const value = config.component === "total" ? agent.input + agent.output : agent[config.component];
|
|
70
|
+
const passed = value <= config.max;
|
|
71
|
+
return {
|
|
72
|
+
passed,
|
|
73
|
+
score: passed ? 1 : 0,
|
|
74
|
+
comment: `${config.component} tokens=${value} ${passed ? "<=" : ">"} ${config.max}`,
|
|
75
|
+
detail: { tokens: value },
|
|
76
|
+
};
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
export const CostUnderConfigSchema = z
|
|
80
|
+
.object({
|
|
81
|
+
type: z.literal("cost-under"),
|
|
82
|
+
maxUsd: z.number().positive(),
|
|
83
|
+
onUnavailable: UnavailablePolicySchema.optional(),
|
|
84
|
+
...baseFields,
|
|
85
|
+
})
|
|
86
|
+
.strict();
|
|
87
|
+
export const costUnderAssertion = {
|
|
88
|
+
type: "cost-under",
|
|
89
|
+
configSchema: CostUnderConfigSchema,
|
|
90
|
+
evaluate: async (config, run) => {
|
|
91
|
+
const usd = run.metadata.cost?.usd;
|
|
92
|
+
if (usd === undefined) {
|
|
93
|
+
return unavailable("cost (driver did not report)", config.onUnavailable ?? "pass");
|
|
94
|
+
}
|
|
95
|
+
const passed = usd <= config.maxUsd;
|
|
96
|
+
return {
|
|
97
|
+
passed,
|
|
98
|
+
score: passed ? 1 : 0,
|
|
99
|
+
comment: `$${usd.toFixed(4)} ${passed ? "<=" : ">"} $${config.maxUsd.toFixed(4)}`,
|
|
100
|
+
detail: { usd },
|
|
101
|
+
};
|
|
102
|
+
},
|
|
103
|
+
};
|
|
104
|
+
export const ArtifactBytesUnderConfigSchema = z
|
|
105
|
+
.object({
|
|
106
|
+
type: z.literal("artifact-bytes-under"),
|
|
107
|
+
max: z.number().int().nonnegative(),
|
|
108
|
+
onUnavailable: UnavailablePolicySchema.optional(),
|
|
109
|
+
...baseFields,
|
|
110
|
+
})
|
|
111
|
+
.strict();
|
|
112
|
+
export const artifactBytesUnderAssertion = {
|
|
113
|
+
type: "artifact-bytes-under",
|
|
114
|
+
configSchema: ArtifactBytesUnderConfigSchema,
|
|
115
|
+
evaluate: async (config, run) => {
|
|
116
|
+
const sizes = await Promise.all(run.artifacts.map(async (artifact) => {
|
|
117
|
+
if (artifact.size !== undefined)
|
|
118
|
+
return artifact.size;
|
|
119
|
+
const inspected = await inspectRunArtifact(run, artifact.path);
|
|
120
|
+
return inspected.stats?.isFile() ? inspected.stats.size : null;
|
|
121
|
+
}));
|
|
122
|
+
if (sizes.some((size) => size === null)) {
|
|
123
|
+
return unavailable("artifact bytes (one or more files could not be measured)", config.onUnavailable ?? "pass");
|
|
124
|
+
}
|
|
125
|
+
const bytes = sizes.reduce((sum, size) => sum + (size ?? 0), 0);
|
|
126
|
+
const passed = bytes <= config.max;
|
|
127
|
+
return {
|
|
128
|
+
passed,
|
|
129
|
+
score: passed ? 1 : 0,
|
|
130
|
+
comment: `artifact bytes=${bytes} ${passed ? "<=" : ">"} ${config.max}`,
|
|
131
|
+
detail: { bytes, files: sizes.length },
|
|
132
|
+
};
|
|
133
|
+
},
|
|
134
|
+
};
|
|
135
|
+
// A crashed or truncated run can still satisfy structural checks (a
|
|
136
|
+
// `file-exists` staged by a fixture, say). This lets a case require the
|
|
137
|
+
// agent to have finished cleanly as a first-class, graded expectation —
|
|
138
|
+
// complementing the automatic `casePassed` downgrade the orchestrator does.
|
|
139
|
+
export const RunSucceededConfigSchema = z
|
|
140
|
+
.object({
|
|
141
|
+
type: z.literal("run-succeeded"),
|
|
142
|
+
...baseFields,
|
|
143
|
+
})
|
|
144
|
+
.strict();
|
|
145
|
+
export const runSucceededAssertion = {
|
|
146
|
+
type: "run-succeeded",
|
|
147
|
+
configSchema: RunSucceededConfigSchema,
|
|
148
|
+
evaluate: async (_config, run) => {
|
|
149
|
+
const { exitReason } = run.metadata;
|
|
150
|
+
const passed = exitReason === "done";
|
|
151
|
+
return {
|
|
152
|
+
passed,
|
|
153
|
+
score: passed ? 1 : 0,
|
|
154
|
+
comment: passed ? "run completed cleanly" : `run ended with '${exitReason}'`,
|
|
155
|
+
detail: { exitReason },
|
|
156
|
+
};
|
|
157
|
+
},
|
|
158
|
+
};
|
|
159
|
+
//# sourceMappingURL=resource-checks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resource-checks.js","sourceRoot":"","sources":["../../../src/assertions/core/resource-checks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAsB,kBAAkB,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC3F,OAAO,EAAE,mBAAmB,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AAEjE,MAAM,uBAAuB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAEzD,MAAM,WAAW,GAAG,CAAC,QAAgB,EAAE,MAA+C,EAAE,EAAE,CAAC,CAAC;IAC1F,MAAM,EAAE,MAAM,KAAK,MAAM;IACzB,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAChC,OAAO,EAAE,GAAG,QAAQ,cAAc;IAClC,MAAM,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE;CAC9B,CAAC,CAAC;AAEH,MA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eoutMs?: number;
|
|
4
|
+
};
|
|
5
|
+
export type SafeRegexInspection = {
|
|
6
|
+
matchesEmpty: boolean;
|
|
7
|
+
} | {
|
|
8
|
+
error: string;
|
|
9
|
+
};
|
|
10
|
+
export type SafeRegexGroup = {
|
|
11
|
+
pattern: string;
|
|
12
|
+
flags: string;
|
|
13
|
+
texts: string[];
|
|
14
|
+
};
|
|
15
|
+
export declare const testSafeRegex: (pattern: string, flags: string, text: string, options?: RegexEvaluationOptions) => Promise<boolean>;
|
|
16
|
+
export declare const testSafeRegexSet: (patterns: string[], flags: string, text: string, options?: RegexEvaluationOptions) => Promise<boolean[]>;
|
|
17
|
+
export declare const inspectSafeRegexes: (patterns: string[], flags: string, options?: RegexEvaluationOptions) => Promise<SafeRegexInspection[]>;
|
|
18
|
+
export declare const testSafeRegexGroups: (groups: SafeRegexGroup[], options?: RegexEvaluationOptions) => Promise<boolean[][]>;
|
|
19
|
+
export declare const countSafeRegex: (pattern: string, flags: string, text: string, stopAfter: number, options?: RegexEvaluationOptions) => Promise<{
|
|
20
|
+
count: number;
|
|
21
|
+
exact: boolean;
|
|
22
|
+
}>;
|
|
23
|
+
//# sourceMappingURL=safe-regex.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"safe-regex.d.ts","sourceRoot":"","sources":["../../../src/assertions/core/safe-regex.ts"],"names":[],"mappings":"AAiGA,MAAM,MAAM,sBAAsB,GAAG;IACnC,WAAW,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;IACtC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAAE,YAAY,EAAE,OAAO,CAAA;CAAE,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEhF,MAAM,MAAM,cAAc,GAAG;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB,CAAC;AAgDF,eAAO,MAAM,aAAa,YACf,MAAM,SACR,MAAM,QACP,MAAM,YACF,sBAAsB,KAC/B,OAAO,CAAC,OAAO,CACkE,CAAC;AAErF,eAAO,MAAM,gBAAgB,aACjB,MAAM,EAAE,SACX,MAAM,QACP,MAAM,YACF,sBAAsB,KAC/B,OAAO,CAAC,OAAO,EAAE,CACkE,CAAC;AAEvF,eAAO,MAAM,kBAAkB,aACnB,MAAM,EAAE,SACX,MAAM,YACH,sBAAsB,KAC/B,OAAO,CAAC,mBAAmB,EAAE,CACgE,CAAC;AAEjG,eAAO,MAAM,mBAAmB,WACtB,cAAc,EAAE,YACd,sBAAsB,KAC/B,OAAO,CAAC,OAAO,EAAE,EAAE,CACsD,CAAC;AAE7E,eAAO,MAAM,cAAc,YAChB,MAAM,SACR,MAAM,QACP,MAAM,aACD,MAAM,YACP,sBAAsB,KAC/B,OAAO,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,CAIzC,CAAC"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { Worker } from "node:worker_threads";
|
|
2
|
+
const REGEX_TIMEOUT_MS = 2_000;
|
|
3
|
+
// An eval worker keeps source tests and the compiled package on the same
|
|
4
|
+
// loader-independent path while still making pathological V8 regexes killable.
|
|
5
|
+
const REGEX_WORKER_SOURCE = `
|
|
6
|
+
const { parentPort, workerData } = require("node:worker_threads");
|
|
7
|
+
|
|
8
|
+
const evaluate = () => {
|
|
9
|
+
if (workerData.operation === "test") {
|
|
10
|
+
return new RegExp(workerData.pattern, workerData.flags).test(workerData.text);
|
|
11
|
+
}
|
|
12
|
+
if (workerData.operation === "set") {
|
|
13
|
+
return workerData.patterns.map(
|
|
14
|
+
(pattern) => new RegExp(pattern, workerData.flags).test(workerData.text),
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
if (workerData.operation === "inspect") {
|
|
18
|
+
return workerData.patterns.map((pattern) => {
|
|
19
|
+
try {
|
|
20
|
+
return { matchesEmpty: new RegExp(pattern, workerData.flags).test("") };
|
|
21
|
+
} catch (error) {
|
|
22
|
+
return {
|
|
23
|
+
error: error instanceof Error ? error.message : String(error),
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
if (workerData.operation === "groups") {
|
|
29
|
+
return workerData.groups.map(({ pattern, flags, texts }) => {
|
|
30
|
+
const expression = new RegExp(pattern, flags);
|
|
31
|
+
return texts.map((text) => {
|
|
32
|
+
expression.lastIndex = 0;
|
|
33
|
+
return expression.test(text);
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
const flags = workerData.flags.includes("g")
|
|
38
|
+
? workerData.flags
|
|
39
|
+
: workerData.flags + "g";
|
|
40
|
+
const expression = new RegExp(workerData.pattern, flags);
|
|
41
|
+
let count = 0;
|
|
42
|
+
for (const _match of workerData.text.matchAll(expression)) {
|
|
43
|
+
count += 1;
|
|
44
|
+
if (count >= workerData.stopAfter) return { count, exact: false };
|
|
45
|
+
}
|
|
46
|
+
return { count, exact: true };
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
try {
|
|
50
|
+
parentPort.postMessage({ ok: true, value: evaluate() });
|
|
51
|
+
} catch (error) {
|
|
52
|
+
parentPort.postMessage({
|
|
53
|
+
ok: false,
|
|
54
|
+
errorName: error instanceof Error ? error.name : "Error",
|
|
55
|
+
error: error instanceof Error ? error.message : String(error),
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
`;
|
|
59
|
+
const evaluateRegex = async (task, options = {}) => await new Promise((resolve, reject) => {
|
|
60
|
+
const worker = new Worker(REGEX_WORKER_SOURCE, {
|
|
61
|
+
eval: true,
|
|
62
|
+
workerData: task,
|
|
63
|
+
});
|
|
64
|
+
let settled = false;
|
|
65
|
+
const finish = (settle) => {
|
|
66
|
+
if (settled)
|
|
67
|
+
return;
|
|
68
|
+
settled = true;
|
|
69
|
+
clearTimeout(timeout);
|
|
70
|
+
options.abortSignal?.removeEventListener("abort", abort);
|
|
71
|
+
settle();
|
|
72
|
+
void worker.terminate();
|
|
73
|
+
};
|
|
74
|
+
const abort = () => finish(() => reject(options.abortSignal?.reason ?? new Error("regex evaluation aborted")));
|
|
75
|
+
const timeout = setTimeout(() => finish(() => reject(new Error(`regex evaluation exceeded ${options.timeoutMs ?? REGEX_TIMEOUT_MS}ms`))), options.timeoutMs ?? REGEX_TIMEOUT_MS);
|
|
76
|
+
worker.once("message", (response) => {
|
|
77
|
+
finish(() => {
|
|
78
|
+
if (response.ok)
|
|
79
|
+
resolve(response.value);
|
|
80
|
+
else {
|
|
81
|
+
const ErrorConstructor = response.errorName === "SyntaxError" ? SyntaxError : Error;
|
|
82
|
+
reject(new ErrorConstructor(`regex evaluation failed: ${response.error}`));
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
worker.once("error", (error) => finish(() => reject(error)));
|
|
87
|
+
worker.once("exit", (code) => {
|
|
88
|
+
if (code !== 0 && !settled) {
|
|
89
|
+
finish(() => reject(new Error(`regex worker exited with code ${code}`)));
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
if (options.abortSignal?.aborted)
|
|
93
|
+
abort();
|
|
94
|
+
else
|
|
95
|
+
options.abortSignal?.addEventListener("abort", abort, { once: true });
|
|
96
|
+
});
|
|
97
|
+
export const testSafeRegex = async (pattern, flags, text, options) => await evaluateRegex({ operation: "test", pattern, flags, text }, options);
|
|
98
|
+
export const testSafeRegexSet = async (patterns, flags, text, options) => await evaluateRegex({ operation: "set", patterns, flags, text }, options);
|
|
99
|
+
export const inspectSafeRegexes = async (patterns, flags, options) => await evaluateRegex({ operation: "inspect", patterns, flags }, options);
|
|
100
|
+
export const testSafeRegexGroups = async (groups, options) => await evaluateRegex({ operation: "groups", groups }, options);
|
|
101
|
+
export const countSafeRegex = async (pattern, flags, text, stopAfter, options) => await evaluateRegex({ operation: "count", pattern, flags, text, stopAfter }, options);
|
|
102
|
+
//# sourceMappingURL=safe-regex.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"safe-regex.js","sourceRoot":"","sources":["../../../src/assertions/core/safe-regex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,MAAM,gBAAgB,GAAG,KAAK,CAAC;AAE/B,yEAAyE;AACzE,+EAA+E;AAC/E,MAAM,mBAAmB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqD3B,CAAC;AAmDF,MAAM,aAAa,GAAG,KAAK,EACzB,IAAe,EACf,OAAO,GAA2B,EAAE,EACxB,EAAE,CACd,MAAM,IAAI,OAAO,CAAI,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;IACvC,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,mBAAmB,EAAE;QAC7C,IAAI,EAAE,IAAI;QACV,UAAU,EAAE,IAAI;KACjB,CAAC,CAAC;IACH,IAAI,OAAO,GAAG,KAAK,CAAC;IACpB,MAAM,MAAM,GAAG,CAAC,MAAkB,EAAE,EAAE;QACpC,IAAI,OAAO;YAAE,OAAO;QACpB,OAAO,GAAG,IAAI,CAAC;QACf,YAAY,CAAC,OAAO,CAAC,CAAC;QACtB,OAAO,CAAC,WAAW,EAAE,mBAAmB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QACzD,MAAM,EAAE,CAAC;QACT,KAAK,MAAM,CAAC,SAAS,EAAE,CAAC;IAC1B,CAAC,CAAC;IACF,MAAM,KAAK,GAAG,GAAG,EAAE,CACjB,MAAM,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,WAAW,EAAE,MAAM,IAAI,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC,CAAC,CAAC;IAC7F,MAAM,OAAO,GAAG,UAAU,CACxB,GAAG,EAAE,CACH,MAAM,CAA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C,CAAC;AAEL,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,EAChC,OAAe,EACf,KAAa,EACb,IAAY,EACZ,OAAgC,EACd,EAAE,CACpB,MAAM,aAAa,CAAU,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,OAAO,CAAC,CAAC;AAErF,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,EACnC,QAAkB,EAClB,KAAa,EACb,IAAY,EACZ,OAAgC,EACZ,EAAE,CACtB,MAAM,aAAa,CAAY,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,OAAO,CAAC,CAAC;AAEvF,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,EACrC,QAAkB,EAClB,KAAa,EACb,OAAgC,EACA,EAAE,CAClC,MAAM,aAAa,CAAwB,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,OAAO,CAAC,CAAC;AAEjG,MAAM,CAAC,MAAM,mBAAmB,GAAG,KAAK,EACtC,MAAwB,EACxB,OAAgC,EACV,EAAE,CACxB,MAAM,aAAa,CAAc,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,CAAC;AAE7E,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,EACjC,OAAe,EACf,KAAa,EACb,IAAY,EACZ,SAAiB,EACjB,OAAgC,EACY,EAAE,CAC9C,MAAM,aAAa,CACjB,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,EACvD,OAAO,CACR,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { AssertionImpl } from "../../core/index.js";
|
|
3
|
+
export declare const ToolCalledWithConfigSchema: z.ZodObject<{
|
|
4
|
+
id: z.ZodOptional<z.ZodString>;
|
|
5
|
+
weight: z.ZodOptional<z.ZodNumber>;
|
|
6
|
+
threshold: z.ZodOptional<z.ZodNumber>;
|
|
7
|
+
type: z.ZodLiteral<"tool-called-with">;
|
|
8
|
+
name: z.ZodString;
|
|
9
|
+
argsJsonPointer: z.ZodDefault<z.ZodString>;
|
|
10
|
+
argsValue: z.ZodOptional<z.ZodUnknown>;
|
|
11
|
+
argsContains: z.ZodOptional<z.ZodString>;
|
|
12
|
+
minTimes: z.ZodOptional<z.ZodNumber>;
|
|
13
|
+
by: z.ZodDefault<z.ZodEnum<{
|
|
14
|
+
any: "any";
|
|
15
|
+
main: "main";
|
|
16
|
+
subagent: "subagent";
|
|
17
|
+
}>>;
|
|
18
|
+
}, z.core.$strict>;
|
|
19
|
+
export type ToolCalledWithConfig = z.infer<typeof ToolCalledWithConfigSchema>;
|
|
20
|
+
export declare const toolCalledWithAssertion: AssertionImpl<ToolCalledWithConfig>;
|
|
21
|
+
//# sourceMappingURL=tool-called-with.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-called-with.d.ts","sourceRoot":"","sources":["../../../src/assertions/core/tool-called-with.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAIzD,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;kBAmBnC,CAAC;AACL,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAiB9E,eAAO,MAAM,uBAAuB,EAAE,aAAa,CAAC,oBAAoB,CAyBvE,CAAC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { matchesAgentScope } from "./event-checks.js";
|
|
3
|
+
import { deepEquals, isToolCallEvent, resolvePointer, weightThresholdFields } from "./helpers.js";
|
|
4
|
+
export const ToolCalledWithConfigSchema = z
|
|
5
|
+
.object({
|
|
6
|
+
type: z.literal("tool-called-with"),
|
|
7
|
+
name: z.string(),
|
|
8
|
+
/** RFC 6901 JSON pointer into the tool's input. Defaults to "" (whole input). */
|
|
9
|
+
argsJsonPointer: z.string().default(""),
|
|
10
|
+
/** Structural (key-order-insensitive) equality against the value at the JSON pointer. */
|
|
11
|
+
argsValue: z.unknown().optional(),
|
|
12
|
+
/** Substring containment check (stringifies the value at the pointer). */
|
|
13
|
+
argsContains: z.string().optional(),
|
|
14
|
+
/** How many matching calls are required. Default 1. `minTimes: 0` would pass vacuously. */
|
|
15
|
+
minTimes: z.number().int().positive().optional(),
|
|
16
|
+
/** Whose calls count: "main" agent, "subagent", or "any". */
|
|
17
|
+
by: z.enum(["any", "main", "subagent"]).default("any"),
|
|
18
|
+
...weightThresholdFields,
|
|
19
|
+
})
|
|
20
|
+
.strict()
|
|
21
|
+
.refine((c) => c.argsValue === undefined || c.argsContains === undefined, {
|
|
22
|
+
message: "set only one of argsValue or argsContains",
|
|
23
|
+
});
|
|
24
|
+
const matches = (value, config) => {
|
|
25
|
+
if (config.argsValue !== undefined) {
|
|
26
|
+
return deepEquals(value, config.argsValue);
|
|
27
|
+
}
|
|
28
|
+
if (config.argsContains !== undefined) {
|
|
29
|
+
// An unresolved pointer is a non-match, not an error — a later event may
|
|
30
|
+
// still genuinely match.
|
|
31
|
+
if (value === undefined)
|
|
32
|
+
return false;
|
|
33
|
+
const stringified = typeof value === "string" ? value : JSON.stringify(value);
|
|
34
|
+
return stringified.includes(config.argsContains);
|
|
35
|
+
}
|
|
36
|
+
// Both unset — match any tool call with that name.
|
|
37
|
+
return true;
|
|
38
|
+
};
|
|
39
|
+
export const toolCalledWithAssertion = {
|
|
40
|
+
type: "tool-called-with",
|
|
41
|
+
configSchema: ToolCalledWithConfigSchema,
|
|
42
|
+
evaluate: async (config, run) => {
|
|
43
|
+
const min = config.minTimes ?? 1;
|
|
44
|
+
let hits = 0;
|
|
45
|
+
for (const e of run.events) {
|
|
46
|
+
if (!isToolCallEvent(e))
|
|
47
|
+
continue;
|
|
48
|
+
if (!matchesAgentScope(e, config.by))
|
|
49
|
+
continue;
|
|
50
|
+
const payload = e.payload;
|
|
51
|
+
if (payload?.name !== config.name)
|
|
52
|
+
continue;
|
|
53
|
+
const argsRoot = payload.input ?? null;
|
|
54
|
+
const value = resolvePointer(argsRoot, config.argsJsonPointer);
|
|
55
|
+
if (matches(value, config))
|
|
56
|
+
hits++;
|
|
57
|
+
}
|
|
58
|
+
const passed = hits >= min;
|
|
59
|
+
const bound = passed ? `>= ${min}` : `need ${min}`;
|
|
60
|
+
const scope = (config.by ?? "any") === "any" ? "" : ` by ${config.by}`;
|
|
61
|
+
return {
|
|
62
|
+
passed,
|
|
63
|
+
score: passed ? 1 : 0,
|
|
64
|
+
comment: `tool '${config.name}' called ${hits}×${scope} with matching args (${bound})`,
|
|
65
|
+
detail: { hits },
|
|
66
|
+
};
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
//# sourceMappingURL=tool-called-with.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-called-with.js","sourceRoot":"","sources":["../../../src/assertions/core/tool-called-with.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAElG,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC;KACxC,MAAM,CAAC;IACN,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,kBAAkB,CAAC;IACnC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,iFAAiF;IACjF,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;IACvC,yFAAyF;IACzF,SAAS,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AAwB,KAAK,GAAG;YACtF,MAAM,EAAE,EAAE,IAAI,EAAE;SACjB,CAAC;IACJ,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Run } from "../../core/index.js";
|
|
2
|
+
import { type AgentScope } from "./event-checks.js";
|
|
3
|
+
/**
|
|
4
|
+
* A tool call projected from a `tool-call` progress event's payload.
|
|
5
|
+
* `parentToolUseId` is set only when a spawned subagent made the call.
|
|
6
|
+
*/
|
|
7
|
+
export type ToolCall = {
|
|
8
|
+
name: string;
|
|
9
|
+
input: unknown;
|
|
10
|
+
parentToolUseId?: string;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Every tool call the run made, in order. Reach for it inside a `predicate`
|
|
14
|
+
* assertion to grade what the agent *did*, not what it said. Pass `by` to scope
|
|
15
|
+
* to the "main" agent or a "subagent" (default "any").
|
|
16
|
+
*/
|
|
17
|
+
export declare const toolCalls: (run: Run, by?: AgentScope) => ToolCall[];
|
|
18
|
+
/** Stringified inputs of every tool call, for substring checks in a predicate. */
|
|
19
|
+
export declare const toolCallInputs: (run: Run, by?: AgentScope) => string[];
|
|
20
|
+
/** Tool calls made by a spawned subagent (the driver tags these with `parentToolUseId`). */
|
|
21
|
+
export declare const subagentToolCalls: (run: Run) => ToolCall[];
|
|
22
|
+
//# sourceMappingURL=tool-calls.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-calls.d.ts","sourceRoot":"","sources":["../../../src/assertions/core/tool-calls.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,KAAK,UAAU,EAAqB,MAAM,mBAAmB,CAAC;AAGvE;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,OAAO,CAAC;IAAC,eAAe,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAElF;;;;GAIG;AACH,eAAO,MAAM,SAAS,QAAS,GAAG,OAAM,UAAU,KAAW,QAAQ,EAKP,CAAC;AAE/D,kFAAkF;AAClF,eAAO,MAAM,cAAc,QAAS,GAAG,OAAM,UAAU,KAAW,MAAM,EACV,CAAC;AAE/D,4FAA4F;AAC5F,eAAO,MAAM,iBAAiB,QAAS,GAAG,KAAG,QAAQ,EAAgC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { matchesAgentScope } from "./event-checks.js";
|
|
2
|
+
import { isToolCallEvent } from "./helpers.js";
|
|
3
|
+
/**
|
|
4
|
+
* Every tool call the run made, in order. Reach for it inside a `predicate`
|
|
5
|
+
* assertion to grade what the agent *did*, not what it said. Pass `by` to scope
|
|
6
|
+
* to the "main" agent or a "subagent" (default "any").
|
|
7
|
+
*/
|
|
8
|
+
export const toolCalls = (run, by = "any") => run.events
|
|
9
|
+
.filter(isToolCallEvent)
|
|
10
|
+
.filter((e) => matchesAgentScope(e, by))
|
|
11
|
+
.map((e) => e.payload)
|
|
12
|
+
.filter((p) => typeof p?.name === "string");
|
|
13
|
+
/** Stringified inputs of every tool call, for substring checks in a predicate. */
|
|
14
|
+
export const toolCallInputs = (run, by = "any") => toolCalls(run, by).map((c) => JSON.stringify(c.input ?? {}));
|
|
15
|
+
/** Tool calls made by a spawned subagent (the driver tags these with `parentToolUseId`). */
|
|
16
|
+
export const subagentToolCalls = (run) => toolCalls(run, "subagent");
|
|
17
|
+
//# sourceMappingURL=tool-calls.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-calls.js","sourceRoot":"","sources":["../../../src/assertions/core/tool-calls.ts"],"names":[],"mappings":"AACA,OAAO,EAAmB,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAQ/C;;;;GAIG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,GAAQ,EAAE,EAAE,GAAe,KAAK,EAAc,EAAE,CACxE,GAAG,CAAC,MAAM;KACP,MAAM,CAAC,eAAe,CAAC;KACvB,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;KACvC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAmB,CAAC;KACjC,MAAM,CAAC,CAAC,CAAC,EAAiB,EAAE,CAAC,OAAO,CAAC,EAAE,IAAI,KAAK,QAAQ,CAAC,CAAC;AAE/D,kFAAkF;AAClF,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,GAAQ,EAAE,EAAE,GAAe,KAAK,EAAY,EAAE,CAC3E,SAAS,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,CAAC;AAE/D,4FAA4F;AAC5F,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,GAAQ,EAAc,EAAE,CAAC,SAAS,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { type AssertionImpl } from "../../core/index.js";
|
|
3
|
+
export declare const ToolInvocationConfigSchema: z.ZodObject<{
|
|
4
|
+
id: z.ZodOptional<z.ZodString>;
|
|
5
|
+
weight: z.ZodOptional<z.ZodNumber>;
|
|
6
|
+
threshold: z.ZodOptional<z.ZodNumber>;
|
|
7
|
+
type: z.ZodLiteral<"tool-invocation">;
|
|
8
|
+
name: z.ZodString;
|
|
9
|
+
result: z.ZodDefault<z.ZodEnum<{
|
|
10
|
+
any: "any";
|
|
11
|
+
error: "error";
|
|
12
|
+
success: "success";
|
|
13
|
+
}>>;
|
|
14
|
+
occurrence: z.ZodDefault<z.ZodEnum<{
|
|
15
|
+
any: "any";
|
|
16
|
+
first: "first";
|
|
17
|
+
last: "last";
|
|
18
|
+
}>>;
|
|
19
|
+
input: z.ZodOptional<z.ZodObject<{
|
|
20
|
+
jsonPointer: z.ZodDefault<z.ZodString>;
|
|
21
|
+
equals: z.ZodOptional<z.ZodUnknown>;
|
|
22
|
+
contains: z.ZodOptional<z.ZodString>;
|
|
23
|
+
matches: z.ZodOptional<z.ZodString>;
|
|
24
|
+
flags: z.ZodOptional<z.ZodString>;
|
|
25
|
+
}, z.core.$strict>>;
|
|
26
|
+
output: z.ZodOptional<z.ZodObject<{
|
|
27
|
+
jsonPointer: z.ZodDefault<z.ZodString>;
|
|
28
|
+
equals: z.ZodOptional<z.ZodUnknown>;
|
|
29
|
+
contains: z.ZodOptional<z.ZodString>;
|
|
30
|
+
matches: z.ZodOptional<z.ZodString>;
|
|
31
|
+
flags: z.ZodOptional<z.ZodString>;
|
|
32
|
+
}, z.core.$strict>>;
|
|
33
|
+
}, z.core.$strict>;
|
|
34
|
+
export type ToolInvocationConfig = z.infer<typeof ToolInvocationConfigSchema>;
|
|
35
|
+
export declare const toolInvocationAssertion: AssertionImpl<ToolInvocationConfig>;
|
|
36
|
+
//# sourceMappingURL=tool-invocation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-invocation.d.ts","sourceRoot":"","sources":["../../../src/assertions/core/tool-invocation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,KAAK,aAAa,EAInB,MAAM,qBAAqB,CAAC;AA2C7B,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAW5B,CAAC;AACZ,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AA0C9E,eAAO,MAAM,uBAAuB,EAAE,aAAa,CAAC,oBAAoB,CA8FvE,CAAC"}
|