@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,198 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import {
|
|
3
|
+
type AssertionImpl,
|
|
4
|
+
malformedToolEventCount,
|
|
5
|
+
toolInvocations,
|
|
6
|
+
toolResultValue,
|
|
7
|
+
} from "../../core/index.js";
|
|
8
|
+
import { deepEquals, resolvePointer, weightThresholdFields } from "./helpers.js";
|
|
9
|
+
import { inspectSafeRegexes, type SafeRegexGroup, testSafeRegexGroups } from "./safe-regex.js";
|
|
10
|
+
|
|
11
|
+
const ValueMatchSchema = z
|
|
12
|
+
.object({
|
|
13
|
+
jsonPointer: z.string().default(""),
|
|
14
|
+
equals: z.unknown().optional(),
|
|
15
|
+
contains: z.string().min(1).optional(),
|
|
16
|
+
matches: z.string().max(2_000).optional(),
|
|
17
|
+
flags: z.string().max(16).optional(),
|
|
18
|
+
})
|
|
19
|
+
.strict()
|
|
20
|
+
.refine(
|
|
21
|
+
(config) =>
|
|
22
|
+
[config.equals, config.contains, config.matches].filter((value) => value !== undefined)
|
|
23
|
+
.length === 1,
|
|
24
|
+
{ message: "set exactly one of equals, contains, or matches" },
|
|
25
|
+
)
|
|
26
|
+
.superRefine(async (config, ctx) => {
|
|
27
|
+
if (config.matches === undefined) {
|
|
28
|
+
if (config.flags !== undefined) {
|
|
29
|
+
ctx.addIssue({
|
|
30
|
+
code: "custom",
|
|
31
|
+
path: ["flags"],
|
|
32
|
+
message: "flags requires matches",
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
const [inspection] = await inspectSafeRegexes([config.matches], config.flags ?? "");
|
|
38
|
+
if (inspection && "error" in inspection) {
|
|
39
|
+
ctx.addIssue({
|
|
40
|
+
code: "custom",
|
|
41
|
+
path: ["matches"],
|
|
42
|
+
message: inspection.error,
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
type ValueMatch = z.infer<typeof ValueMatchSchema>;
|
|
47
|
+
const MAX_TOOL_MATCH_CHARS = 1024 * 1024;
|
|
48
|
+
const MAX_TOOL_MATCH_TOTAL_CHARS = 8 * 1024 * 1024;
|
|
49
|
+
|
|
50
|
+
export const ToolInvocationConfigSchema = z
|
|
51
|
+
.object({
|
|
52
|
+
type: z.literal("tool-invocation"),
|
|
53
|
+
name: z.string(),
|
|
54
|
+
/** Filter paired results before choosing first, last, or any. */
|
|
55
|
+
result: z.enum(["success", "error", "any"]).default("success"),
|
|
56
|
+
occurrence: z.enum(["first", "last", "any"]).default("any"),
|
|
57
|
+
input: ValueMatchSchema.optional(),
|
|
58
|
+
output: ValueMatchSchema.optional(),
|
|
59
|
+
...weightThresholdFields,
|
|
60
|
+
})
|
|
61
|
+
.strict();
|
|
62
|
+
export type ToolInvocationConfig = z.infer<typeof ToolInvocationConfigSchema>;
|
|
63
|
+
|
|
64
|
+
const valueText = (value: unknown): string | null => {
|
|
65
|
+
let text: string;
|
|
66
|
+
if (typeof value === "string") {
|
|
67
|
+
text = value;
|
|
68
|
+
} else {
|
|
69
|
+
try {
|
|
70
|
+
text = JSON.stringify(value) ?? String(value);
|
|
71
|
+
} catch {
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return text.length <= MAX_TOOL_MATCH_CHARS ? text : null;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
type PreparedValueMatch = {
|
|
79
|
+
matched: boolean;
|
|
80
|
+
regexText?: string;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
const prepareValueMatch = (root: unknown, match: ValueMatch): PreparedValueMatch => {
|
|
84
|
+
const value = resolvePointer(root, match.jsonPointer);
|
|
85
|
+
if (match.equals !== undefined) return { matched: deepEquals(value, match.equals) };
|
|
86
|
+
if (match.contains !== undefined) {
|
|
87
|
+
if (value === undefined) return { matched: false };
|
|
88
|
+
return { matched: valueText(value)?.includes(match.contains) ?? false };
|
|
89
|
+
}
|
|
90
|
+
if (match.matches !== undefined) {
|
|
91
|
+
if (value === undefined) return { matched: false };
|
|
92
|
+
const text = valueText(value);
|
|
93
|
+
return text === null ? { matched: false } : { matched: true, regexText: text };
|
|
94
|
+
}
|
|
95
|
+
return { matched: false };
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
const selectOccurrences = <T>(values: T[], occurrence: ToolInvocationConfig["occurrence"]): T[] => {
|
|
99
|
+
if (occurrence === "first") return values.slice(0, 1);
|
|
100
|
+
if (occurrence === "last") return values.slice(-1);
|
|
101
|
+
return values;
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
export const toolInvocationAssertion: AssertionImpl<ToolInvocationConfig> = {
|
|
105
|
+
type: "tool-invocation",
|
|
106
|
+
configSchema: ToolInvocationConfigSchema,
|
|
107
|
+
evaluate: async (config, run, ctx) => {
|
|
108
|
+
const malformed = malformedToolEventCount(run.events, ["tool-call", "tool-result"]);
|
|
109
|
+
if (malformed > 0) {
|
|
110
|
+
const errorMessage = `${malformed} malformed standardized tool event${malformed === 1 ? "" : "s"} captured`;
|
|
111
|
+
return {
|
|
112
|
+
passed: false,
|
|
113
|
+
score: 0,
|
|
114
|
+
comment: errorMessage,
|
|
115
|
+
errorMessage,
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
const invocations = toolInvocations(run.events, config.name);
|
|
119
|
+
const selected = selectOccurrences(invocations, config.occurrence);
|
|
120
|
+
const paired = selected.filter(
|
|
121
|
+
(
|
|
122
|
+
invocation,
|
|
123
|
+
): invocation is typeof invocation & {
|
|
124
|
+
result: NonNullable<typeof invocation.result>;
|
|
125
|
+
} => invocation.result !== undefined,
|
|
126
|
+
);
|
|
127
|
+
const relevant = paired.filter(({ result }) => {
|
|
128
|
+
if (config.result === "any") return true;
|
|
129
|
+
return result.isError === (config.result === "error");
|
|
130
|
+
});
|
|
131
|
+
const candidates: Array<{
|
|
132
|
+
inputRegexText?: string;
|
|
133
|
+
outputRegexText?: string;
|
|
134
|
+
}> = [];
|
|
135
|
+
let regexTextChars = 0;
|
|
136
|
+
for (const invocation of relevant) {
|
|
137
|
+
const input = config.input
|
|
138
|
+
? prepareValueMatch(invocation.call.input, config.input)
|
|
139
|
+
: { matched: true };
|
|
140
|
+
if (!input.matched) continue;
|
|
141
|
+
const output = config.output
|
|
142
|
+
? prepareValueMatch(toolResultValue(invocation.result), config.output)
|
|
143
|
+
: { matched: true };
|
|
144
|
+
if (!output.matched) continue;
|
|
145
|
+
regexTextChars += (input.regexText?.length ?? 0) + (output.regexText?.length ?? 0);
|
|
146
|
+
if (regexTextChars > MAX_TOOL_MATCH_TOTAL_CHARS) {
|
|
147
|
+
throw new RangeError(
|
|
148
|
+
`tool invocation regex evidence exceeds the ${MAX_TOOL_MATCH_TOTAL_CHARS}-character assertion limit`,
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
candidates.push({
|
|
152
|
+
...(input.regexText !== undefined ? { inputRegexText: input.regexText } : {}),
|
|
153
|
+
...(output.regexText !== undefined ? { outputRegexText: output.regexText } : {}),
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
const groups: SafeRegexGroup[] = [];
|
|
158
|
+
if (config.input?.matches !== undefined) {
|
|
159
|
+
groups.push({
|
|
160
|
+
pattern: config.input.matches,
|
|
161
|
+
flags: config.input.flags ?? "",
|
|
162
|
+
texts: candidates.map(({ inputRegexText }) => inputRegexText ?? ""),
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
if (config.output?.matches !== undefined) {
|
|
166
|
+
groups.push({
|
|
167
|
+
pattern: config.output.matches,
|
|
168
|
+
flags: config.output.flags ?? "",
|
|
169
|
+
texts: candidates.map(({ outputRegexText }) => outputRegexText ?? ""),
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
const regexResults =
|
|
173
|
+
groups.length > 0 ? await testSafeRegexGroups(groups, { abortSignal: ctx?.abortSignal }) : [];
|
|
174
|
+
let groupIndex = 0;
|
|
175
|
+
const inputResults =
|
|
176
|
+
config.input?.matches !== undefined ? regexResults[groupIndex++] : undefined;
|
|
177
|
+
const outputResults =
|
|
178
|
+
config.output?.matches !== undefined ? regexResults[groupIndex] : undefined;
|
|
179
|
+
const matches = candidates.filter(
|
|
180
|
+
(_candidate, index) => (inputResults?.[index] ?? true) && (outputResults?.[index] ?? true),
|
|
181
|
+
);
|
|
182
|
+
const passed = matches.length > 0;
|
|
183
|
+
return {
|
|
184
|
+
passed,
|
|
185
|
+
score: passed ? 1 : 0,
|
|
186
|
+
comment: passed
|
|
187
|
+
? `'${config.name}' has a matching ${config.result} invocation`
|
|
188
|
+
: `'${config.name}' has no matching ${config.result} invocation`,
|
|
189
|
+
detail: {
|
|
190
|
+
calls: invocations.length,
|
|
191
|
+
selected: selected.length,
|
|
192
|
+
paired: paired.length,
|
|
193
|
+
resultMatches: relevant.length,
|
|
194
|
+
matches: matches.length,
|
|
195
|
+
},
|
|
196
|
+
};
|
|
197
|
+
},
|
|
198
|
+
};
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import {
|
|
3
|
+
type AssertionImpl,
|
|
4
|
+
malformedToolEventCount,
|
|
5
|
+
type ToolResultPayload,
|
|
6
|
+
toolResults,
|
|
7
|
+
toolResultValue,
|
|
8
|
+
} from "../../core/index.js";
|
|
9
|
+
import { deepEquals, resolvePointer, weightThresholdFields } from "./helpers.js";
|
|
10
|
+
|
|
11
|
+
const OccurrenceSchema = z.enum(["first", "last", "any"]);
|
|
12
|
+
type Occurrence = z.infer<typeof OccurrenceSchema>;
|
|
13
|
+
|
|
14
|
+
const select = (results: ToolResultPayload[], occurrence: Occurrence): ToolResultPayload[] => {
|
|
15
|
+
if (occurrence === "first") return results.slice(0, 1);
|
|
16
|
+
if (occurrence === "last") return results.slice(-1);
|
|
17
|
+
return results;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const malformedResultEvidence = (run: Parameters<AssertionImpl["evaluate"]>[1]) => {
|
|
21
|
+
const malformed = malformedToolEventCount(run.events, ["tool-result"]);
|
|
22
|
+
if (malformed === 0) return null;
|
|
23
|
+
const errorMessage = `${malformed} malformed tool result event${malformed === 1 ? "" : "s"} captured`;
|
|
24
|
+
return {
|
|
25
|
+
passed: false as const,
|
|
26
|
+
score: 0 as const,
|
|
27
|
+
comment: errorMessage,
|
|
28
|
+
errorMessage,
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const ToolResultIsErrorConfigSchema = z
|
|
33
|
+
.object({
|
|
34
|
+
type: z.literal("tool-result-is-error"),
|
|
35
|
+
/** Tool whose result to inspect; omit to consider every result. */
|
|
36
|
+
name: z.string().optional(),
|
|
37
|
+
/** The `isError` value to require. Default true (assert the tool DID error). */
|
|
38
|
+
expected: z.boolean().default(true),
|
|
39
|
+
/** Which matching result(s) to require it of. Default "last". */
|
|
40
|
+
occurrence: OccurrenceSchema.default("last"),
|
|
41
|
+
...weightThresholdFields,
|
|
42
|
+
})
|
|
43
|
+
.strict();
|
|
44
|
+
export type ToolResultIsErrorConfig = z.infer<typeof ToolResultIsErrorConfigSchema>;
|
|
45
|
+
|
|
46
|
+
export const toolResultIsErrorAssertion: AssertionImpl<ToolResultIsErrorConfig> = {
|
|
47
|
+
type: "tool-result-is-error",
|
|
48
|
+
configSchema: ToolResultIsErrorConfigSchema,
|
|
49
|
+
evaluate: async (config, run) => {
|
|
50
|
+
const malformed = malformedResultEvidence(run);
|
|
51
|
+
if (malformed) return malformed;
|
|
52
|
+
const results = toolResults(run.events, config.name);
|
|
53
|
+
const label = config.name ? `'${config.name}'` : "any tool";
|
|
54
|
+
if (results.length === 0) {
|
|
55
|
+
return {
|
|
56
|
+
passed: false,
|
|
57
|
+
score: 0,
|
|
58
|
+
comment: `no result captured for ${label}`,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
const relevant = config.occurrence === "any" ? results : select(results, config.occurrence);
|
|
62
|
+
const passed =
|
|
63
|
+
config.occurrence === "any"
|
|
64
|
+
? relevant.some((result) => result.isError === config.expected)
|
|
65
|
+
: relevant.every((result) => result.isError === config.expected);
|
|
66
|
+
return {
|
|
67
|
+
passed,
|
|
68
|
+
score: passed ? 1 : 0,
|
|
69
|
+
comment: `${label} isError expected ${config.expected} (${config.occurrence})`,
|
|
70
|
+
detail: { isError: relevant.map((result) => result.isError) },
|
|
71
|
+
};
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export const ToolResultContainsConfigSchema = z
|
|
76
|
+
.object({
|
|
77
|
+
type: z.literal("tool-result-contains"),
|
|
78
|
+
name: z.string().optional(),
|
|
79
|
+
/** Substring the result's text (or stringified content) must contain. */
|
|
80
|
+
text: z.string().min(1),
|
|
81
|
+
occurrence: OccurrenceSchema.default("any"),
|
|
82
|
+
...weightThresholdFields,
|
|
83
|
+
})
|
|
84
|
+
.strict();
|
|
85
|
+
export type ToolResultContainsConfig = z.infer<typeof ToolResultContainsConfigSchema>;
|
|
86
|
+
|
|
87
|
+
const resultText = (result: ToolResultPayload): string =>
|
|
88
|
+
result.text ||
|
|
89
|
+
(typeof result.content === "string" ? result.content : JSON.stringify(result.content ?? ""));
|
|
90
|
+
|
|
91
|
+
export const toolResultContainsAssertion: AssertionImpl<ToolResultContainsConfig> = {
|
|
92
|
+
type: "tool-result-contains",
|
|
93
|
+
configSchema: ToolResultContainsConfigSchema,
|
|
94
|
+
evaluate: async (config, run) => {
|
|
95
|
+
const malformed = malformedResultEvidence(run);
|
|
96
|
+
if (malformed) return malformed;
|
|
97
|
+
const results = toolResults(run.events, config.name);
|
|
98
|
+
const label = config.name ? `'${config.name}'` : "any tool";
|
|
99
|
+
if (results.length === 0) {
|
|
100
|
+
return {
|
|
101
|
+
passed: false,
|
|
102
|
+
score: 0,
|
|
103
|
+
comment: `no result captured for ${label}`,
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
const relevant = config.occurrence === "any" ? results : select(results, config.occurrence);
|
|
107
|
+
const hit = relevant.filter((result) => resultText(result).includes(config.text));
|
|
108
|
+
const passed = hit.length > 0;
|
|
109
|
+
return {
|
|
110
|
+
passed,
|
|
111
|
+
score: passed ? 1 : 0,
|
|
112
|
+
comment: `${label} result ${passed ? "contains" : "does not contain"} ${JSON.stringify(config.text)}`,
|
|
113
|
+
detail: { matches: hit.length },
|
|
114
|
+
};
|
|
115
|
+
},
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
export const ToolResultJsonPointerEqualsConfigSchema = z
|
|
119
|
+
.object({
|
|
120
|
+
type: z.literal("tool-result-json-pointer-equals"),
|
|
121
|
+
name: z.string(),
|
|
122
|
+
/**
|
|
123
|
+
* RFC 6901 pointer into the result's `structuredContent`, falling back to
|
|
124
|
+
* the result text parsed as JSON. Defaults to "" (the whole value).
|
|
125
|
+
*/
|
|
126
|
+
jsonPointer: z.string().default(""),
|
|
127
|
+
/** Structural (key-order-insensitive) equality against the value. */
|
|
128
|
+
value: z.unknown().optional(),
|
|
129
|
+
/** Substring containment against the stringified value. */
|
|
130
|
+
contains: z.string().min(1).optional(),
|
|
131
|
+
occurrence: OccurrenceSchema.default("last"),
|
|
132
|
+
...weightThresholdFields,
|
|
133
|
+
})
|
|
134
|
+
.strict()
|
|
135
|
+
.refine((config) => (config.value === undefined) !== (config.contains === undefined), {
|
|
136
|
+
message: "set exactly one of value or contains",
|
|
137
|
+
});
|
|
138
|
+
export type ToolResultJsonPointerEqualsConfig = z.infer<
|
|
139
|
+
typeof ToolResultJsonPointerEqualsConfigSchema
|
|
140
|
+
>;
|
|
141
|
+
|
|
142
|
+
export const toolResultJsonPointerEqualsAssertion: AssertionImpl<ToolResultJsonPointerEqualsConfig> =
|
|
143
|
+
{
|
|
144
|
+
type: "tool-result-json-pointer-equals",
|
|
145
|
+
configSchema: ToolResultJsonPointerEqualsConfigSchema,
|
|
146
|
+
evaluate: async (config, run) => {
|
|
147
|
+
const malformed = malformedResultEvidence(run);
|
|
148
|
+
if (malformed) return malformed;
|
|
149
|
+
const results = toolResults(run.events, config.name);
|
|
150
|
+
if (results.length === 0) {
|
|
151
|
+
return {
|
|
152
|
+
passed: false,
|
|
153
|
+
score: 0,
|
|
154
|
+
comment: `no result captured for '${config.name}'`,
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
const relevant = config.occurrence === "any" ? results : select(results, config.occurrence);
|
|
158
|
+
const matched = relevant.some((result) => {
|
|
159
|
+
const value = resolvePointer(toolResultValue(result), config.jsonPointer);
|
|
160
|
+
if (config.value !== undefined) return deepEquals(value, config.value);
|
|
161
|
+
if (config.contains !== undefined) {
|
|
162
|
+
if (value === undefined) return false;
|
|
163
|
+
const stringified = typeof value === "string" ? value : JSON.stringify(value);
|
|
164
|
+
return stringified.includes(config.contains);
|
|
165
|
+
}
|
|
166
|
+
return value !== undefined;
|
|
167
|
+
});
|
|
168
|
+
return {
|
|
169
|
+
passed: matched,
|
|
170
|
+
score: matched ? 1 : 0,
|
|
171
|
+
comment: `'${config.name}' result at '${config.jsonPointer || "/"}' ${matched ? "matched" : "did not match"}`,
|
|
172
|
+
};
|
|
173
|
+
},
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
export const NoErrorResultsConfigSchema = z
|
|
177
|
+
.object({
|
|
178
|
+
type: z.literal("no-error-results"),
|
|
179
|
+
/** Permit a run with no captured calls/results. Defaults false to prevent vacuous passes. */
|
|
180
|
+
allowEmpty: z.boolean().default(false),
|
|
181
|
+
...weightThresholdFields,
|
|
182
|
+
})
|
|
183
|
+
.strict();
|
|
184
|
+
export type NoErrorResultsConfig = z.infer<typeof NoErrorResultsConfigSchema>;
|
|
185
|
+
|
|
186
|
+
export const noErrorResultsAssertion: AssertionImpl<NoErrorResultsConfig> = {
|
|
187
|
+
type: "no-error-results",
|
|
188
|
+
configSchema: NoErrorResultsConfigSchema,
|
|
189
|
+
evaluate: async (config, run) => {
|
|
190
|
+
const malformed = malformedResultEvidence(run);
|
|
191
|
+
if (malformed) return malformed;
|
|
192
|
+
const results = toolResults(run.events);
|
|
193
|
+
if (results.length === 0 && !config.allowEmpty) {
|
|
194
|
+
return {
|
|
195
|
+
passed: false,
|
|
196
|
+
score: 0,
|
|
197
|
+
comment: "no tool results captured",
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
const offenders = results.filter((result) => result.isError);
|
|
201
|
+
const passed = offenders.length === 0;
|
|
202
|
+
return {
|
|
203
|
+
passed,
|
|
204
|
+
score: passed ? 1 : 0,
|
|
205
|
+
comment: passed
|
|
206
|
+
? "no tool returned an error result"
|
|
207
|
+
: `error results from: ${offenders.map((result) => result.name).join(", ")}`,
|
|
208
|
+
detail: { offenders: offenders.map((result) => result.name) },
|
|
209
|
+
};
|
|
210
|
+
},
|
|
211
|
+
};
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import {
|
|
3
|
+
type AssertionImpl,
|
|
4
|
+
hasMcpInit,
|
|
5
|
+
hasMcpToolsList,
|
|
6
|
+
listedTools,
|
|
7
|
+
mcpInit,
|
|
8
|
+
} from "../../core/index.js";
|
|
9
|
+
import { inRange } from "../core/helpers.js";
|
|
10
|
+
|
|
11
|
+
export const ServerInfoEqualsConfigSchema = z
|
|
12
|
+
.object({
|
|
13
|
+
type: z.literal("server-info-equals"),
|
|
14
|
+
/** Expected `serverInfo.name` from `initialize`. */
|
|
15
|
+
name: z.string().optional(),
|
|
16
|
+
/** Expected `serverInfo.version` from `initialize`. */
|
|
17
|
+
version: z.string().optional(),
|
|
18
|
+
})
|
|
19
|
+
.strict()
|
|
20
|
+
.refine((c) => c.name !== undefined || c.version !== undefined, {
|
|
21
|
+
message: "set at least one of name or version",
|
|
22
|
+
});
|
|
23
|
+
export type ServerInfoEqualsConfig = z.infer<typeof ServerInfoEqualsConfigSchema>;
|
|
24
|
+
|
|
25
|
+
export const serverInfoEqualsAssertion: AssertionImpl<ServerInfoEqualsConfig> = {
|
|
26
|
+
type: "server-info-equals",
|
|
27
|
+
configSchema: ServerInfoEqualsConfigSchema,
|
|
28
|
+
evaluate: async (config, run) => {
|
|
29
|
+
const info = mcpInit(run.events)?.serverInfo;
|
|
30
|
+
if (!info) {
|
|
31
|
+
return { passed: false, score: 0, comment: "no initialize metadata captured" };
|
|
32
|
+
}
|
|
33
|
+
const mismatches: string[] = [];
|
|
34
|
+
if (config.name !== undefined && info.name !== config.name) {
|
|
35
|
+
mismatches.push(`name '${info.name}' != '${config.name}'`);
|
|
36
|
+
}
|
|
37
|
+
if (config.version !== undefined && info.version !== config.version) {
|
|
38
|
+
mismatches.push(`version '${info.version}' != '${config.version}'`);
|
|
39
|
+
}
|
|
40
|
+
const passed = mismatches.length === 0;
|
|
41
|
+
return {
|
|
42
|
+
passed,
|
|
43
|
+
score: passed ? 1 : 0,
|
|
44
|
+
comment: passed ? `serverInfo ${info.name}@${info.version} matched` : mismatches.join("; "),
|
|
45
|
+
detail: { serverInfo: info },
|
|
46
|
+
};
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export const ToolListedConfigSchema = z
|
|
51
|
+
.object({
|
|
52
|
+
type: z.literal("tool-listed"),
|
|
53
|
+
/** Tool name whose presence is checked. */
|
|
54
|
+
name: z.string(),
|
|
55
|
+
/** Whether `tools/list` should include the tool. Default true. */
|
|
56
|
+
expected: z.boolean().default(true),
|
|
57
|
+
})
|
|
58
|
+
.strict();
|
|
59
|
+
export type ToolListedConfig = z.infer<typeof ToolListedConfigSchema>;
|
|
60
|
+
|
|
61
|
+
export const toolListedAssertion: AssertionImpl<ToolListedConfig> = {
|
|
62
|
+
type: "tool-listed",
|
|
63
|
+
configSchema: ToolListedConfigSchema,
|
|
64
|
+
evaluate: async (config, run) => {
|
|
65
|
+
if (!hasMcpToolsList(run.events)) {
|
|
66
|
+
return { passed: false, score: 0, comment: "no tools/list result captured" };
|
|
67
|
+
}
|
|
68
|
+
const tools = listedTools(run.events);
|
|
69
|
+
const listed = tools.some((t) => t.name === config.name);
|
|
70
|
+
const passed = listed === config.expected;
|
|
71
|
+
return {
|
|
72
|
+
passed,
|
|
73
|
+
score: passed ? 1 : 0,
|
|
74
|
+
comment: `tool '${config.name}' is ${listed ? "listed" : `not among ${tools.length} listed tools`}`,
|
|
75
|
+
};
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export const ToolsListedCountConfigSchema = z
|
|
80
|
+
.object({
|
|
81
|
+
type: z.literal("tools-listed-count"),
|
|
82
|
+
min: z.number().int().nonnegative().optional(),
|
|
83
|
+
max: z.number().int().nonnegative().optional(),
|
|
84
|
+
})
|
|
85
|
+
.strict()
|
|
86
|
+
.refine((c) => c.min !== undefined || c.max !== undefined, {
|
|
87
|
+
message: "set at least one of min or max",
|
|
88
|
+
})
|
|
89
|
+
.refine((c) => c.min === undefined || c.max === undefined || c.min <= c.max, {
|
|
90
|
+
message: "min must be <= max",
|
|
91
|
+
});
|
|
92
|
+
export type ToolsListedCountConfig = z.infer<typeof ToolsListedCountConfigSchema>;
|
|
93
|
+
|
|
94
|
+
export const toolsListedCountAssertion: AssertionImpl<ToolsListedCountConfig> = {
|
|
95
|
+
type: "tools-listed-count",
|
|
96
|
+
configSchema: ToolsListedCountConfigSchema,
|
|
97
|
+
evaluate: async (config, run) => {
|
|
98
|
+
if (!hasMcpToolsList(run.events)) {
|
|
99
|
+
return { passed: false, score: 0, comment: "no tools/list result captured" };
|
|
100
|
+
}
|
|
101
|
+
const count = listedTools(run.events).length;
|
|
102
|
+
const { passed, comment } = inRange(count, config.min, config.max);
|
|
103
|
+
return {
|
|
104
|
+
passed,
|
|
105
|
+
score: passed ? 1 : 0,
|
|
106
|
+
comment: `${count} tool${count === 1 ? "" : "s"} listed (${comment})`,
|
|
107
|
+
detail: { count },
|
|
108
|
+
};
|
|
109
|
+
},
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
export const CapabilityAbsentConfigSchema = z
|
|
113
|
+
.object({
|
|
114
|
+
type: z.literal("capability-absent"),
|
|
115
|
+
/** Server capability that must NOT be advertised. */
|
|
116
|
+
capability: z.enum(["resources", "prompts", "logging", "completions", "tools"]),
|
|
117
|
+
})
|
|
118
|
+
.strict();
|
|
119
|
+
export type CapabilityAbsentConfig = z.infer<typeof CapabilityAbsentConfigSchema>;
|
|
120
|
+
|
|
121
|
+
export const capabilityAbsentAssertion: AssertionImpl<CapabilityAbsentConfig> = {
|
|
122
|
+
type: "capability-absent",
|
|
123
|
+
configSchema: CapabilityAbsentConfigSchema,
|
|
124
|
+
evaluate: async (config, run) => {
|
|
125
|
+
if (!hasMcpInit(run.events)) {
|
|
126
|
+
return { passed: false, score: 0, comment: "no initialize metadata captured" };
|
|
127
|
+
}
|
|
128
|
+
const caps = mcpInit(run.events)?.capabilities ?? {};
|
|
129
|
+
const value = (caps as Record<string, unknown>)[config.capability];
|
|
130
|
+
const present = value !== undefined && value !== false && value !== null;
|
|
131
|
+
return {
|
|
132
|
+
passed: !present,
|
|
133
|
+
score: present ? 0 : 1,
|
|
134
|
+
comment: present
|
|
135
|
+
? `server advertises '${config.capability}'`
|
|
136
|
+
: `server does not advertise '${config.capability}'`,
|
|
137
|
+
};
|
|
138
|
+
},
|
|
139
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { AssertionImpl, Registry } from "../../core/index.js";
|
|
2
|
+
import {
|
|
3
|
+
noErrorResultsAssertion,
|
|
4
|
+
toolResultContainsAssertion,
|
|
5
|
+
toolResultIsErrorAssertion,
|
|
6
|
+
toolResultJsonPointerEqualsAssertion,
|
|
7
|
+
} from "../core/tool-result-checks.js";
|
|
8
|
+
import {
|
|
9
|
+
capabilityAbsentAssertion,
|
|
10
|
+
serverInfoEqualsAssertion,
|
|
11
|
+
toolListedAssertion,
|
|
12
|
+
toolsListedCountAssertion,
|
|
13
|
+
} from "./discovery-checks.js";
|
|
14
|
+
|
|
15
|
+
export * from "./discovery-checks.js";
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The result assertions remain in this compatibility collection for
|
|
19
|
+
* embedders that historically registered only the MCP assertion bundle.
|
|
20
|
+
* Their implementations are generic and also ship in `allCoreAssertions`.
|
|
21
|
+
*/
|
|
22
|
+
export const allMcpAssertions: AssertionImpl[] = [
|
|
23
|
+
toolResultIsErrorAssertion,
|
|
24
|
+
toolResultContainsAssertion,
|
|
25
|
+
toolResultJsonPointerEqualsAssertion,
|
|
26
|
+
noErrorResultsAssertion,
|
|
27
|
+
serverInfoEqualsAssertion,
|
|
28
|
+
toolListedAssertion,
|
|
29
|
+
toolsListedCountAssertion,
|
|
30
|
+
capabilityAbsentAssertion,
|
|
31
|
+
];
|
|
32
|
+
|
|
33
|
+
export const registerMcpAssertions = (registry: Registry): void => {
|
|
34
|
+
for (const a of allMcpAssertions) {
|
|
35
|
+
if (!registry.getAssertion(a.type)) registry.registerAssertion(a);
|
|
36
|
+
}
|
|
37
|
+
};
|