@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,467 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import {
|
|
3
|
+
bootstrapMeanConfidenceInterval,
|
|
4
|
+
type Candidate,
|
|
5
|
+
CandidateIdSchema,
|
|
6
|
+
CandidateSchema,
|
|
7
|
+
type ExperimentCampaign,
|
|
8
|
+
type ExperimentConstraint,
|
|
9
|
+
} from "../core/index.js";
|
|
10
|
+
import {
|
|
11
|
+
type ExperimentEvaluation,
|
|
12
|
+
type ExperimentSelection,
|
|
13
|
+
ExperimentSelectionSchema,
|
|
14
|
+
type OpenedExperimentRun,
|
|
15
|
+
} from "./experiment-runs.js";
|
|
16
|
+
|
|
17
|
+
type ExperimentSplit = "train" | "validation" | "test";
|
|
18
|
+
|
|
19
|
+
export const ExperimentDecisionCandidateSchema = CandidateSchema.pick({
|
|
20
|
+
id: true,
|
|
21
|
+
sourceBytes: true,
|
|
22
|
+
});
|
|
23
|
+
export type ExperimentDecisionCandidate = z.infer<typeof ExperimentDecisionCandidateSchema>;
|
|
24
|
+
|
|
25
|
+
export const candidateEvaluations = (
|
|
26
|
+
experiment: OpenedExperimentRun["manifest"],
|
|
27
|
+
candidateId: string,
|
|
28
|
+
): ExperimentEvaluation[] => {
|
|
29
|
+
const selected = new Map<string, ExperimentEvaluation>();
|
|
30
|
+
for (const evaluation of experiment.evaluations.filter(
|
|
31
|
+
(entry) => entry.candidateId === candidateId,
|
|
32
|
+
)) {
|
|
33
|
+
const key = `${evaluation.profileId}:${evaluation.split}`;
|
|
34
|
+
const current = selected.get(key);
|
|
35
|
+
if (!current || evaluation.repetitions > current.repetitions) selected.set(key, evaluation);
|
|
36
|
+
}
|
|
37
|
+
return [...selected.values()];
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const caseRegressions = (
|
|
41
|
+
candidate: ExperimentDecisionCandidate,
|
|
42
|
+
profile: string | undefined,
|
|
43
|
+
split: ExperimentSplit,
|
|
44
|
+
experiment: OpenedExperimentRun["manifest"],
|
|
45
|
+
): number => {
|
|
46
|
+
if (candidate.id === "baseline") return 0;
|
|
47
|
+
const baseline = candidateEvaluations(experiment, "baseline").filter(
|
|
48
|
+
(entry) => entry.split === split && (!profile || entry.profileId === profile),
|
|
49
|
+
);
|
|
50
|
+
const proposed = candidateEvaluations(experiment, candidate.id);
|
|
51
|
+
let regressions = 0;
|
|
52
|
+
for (const before of baseline) {
|
|
53
|
+
const after = proposed.find(
|
|
54
|
+
(entry) => entry.split === split && entry.profileId === before.profileId,
|
|
55
|
+
);
|
|
56
|
+
for (const [caseId, passRate] of Object.entries(before.casePassRates)) {
|
|
57
|
+
if (!after || (after.casePassRates[caseId] ?? 0) < passRate) regressions++;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return regressions;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const metricValues = (
|
|
64
|
+
candidate: ExperimentDecisionCandidate,
|
|
65
|
+
metric: string,
|
|
66
|
+
profile: string | undefined,
|
|
67
|
+
split: ExperimentSplit,
|
|
68
|
+
experiment: OpenedExperimentRun["manifest"],
|
|
69
|
+
): number[] => {
|
|
70
|
+
if (metric === "quality.caseRegressions") {
|
|
71
|
+
return [caseRegressions(candidate, profile, split, experiment)];
|
|
72
|
+
}
|
|
73
|
+
if (metric === "subject.bytes") return [candidate.sourceBytes];
|
|
74
|
+
return candidateEvaluations(experiment, candidate.id)
|
|
75
|
+
.filter((entry) => entry.split === split && (!profile || entry.profileId === profile))
|
|
76
|
+
.flatMap((entry) => {
|
|
77
|
+
const value = metric === "quality.passRate" ? entry.passRate : entry.metrics[metric];
|
|
78
|
+
return value === undefined ? [] : [value];
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
const metricSampleGroups = (
|
|
83
|
+
candidate: ExperimentDecisionCandidate,
|
|
84
|
+
metric: string,
|
|
85
|
+
profile: string | undefined,
|
|
86
|
+
split: ExperimentSplit,
|
|
87
|
+
experiment: OpenedExperimentRun["manifest"],
|
|
88
|
+
): number[][] => {
|
|
89
|
+
if (metric === "quality.caseRegressions" || metric === "subject.bytes") {
|
|
90
|
+
return metricValues(candidate, metric, profile, split, experiment).map((value) => [value]);
|
|
91
|
+
}
|
|
92
|
+
return candidateEvaluations(experiment, candidate.id)
|
|
93
|
+
.filter((entry) => entry.split === split && (!profile || entry.profileId === profile))
|
|
94
|
+
.flatMap((entry) => {
|
|
95
|
+
const samples = entry.samples?.[metric] ?? [];
|
|
96
|
+
return samples.length > 0 ? [samples] : [];
|
|
97
|
+
});
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
const satisfiesConstraint = (
|
|
101
|
+
campaign: ExperimentCampaign,
|
|
102
|
+
candidate: ExperimentDecisionCandidate,
|
|
103
|
+
constraint: ExperimentConstraint,
|
|
104
|
+
experiment: OpenedExperimentRun["manifest"],
|
|
105
|
+
): boolean => {
|
|
106
|
+
let profiles: (string | undefined)[];
|
|
107
|
+
if (constraint.metric === "subject.bytes" || constraint.profile) {
|
|
108
|
+
profiles = [constraint.profile];
|
|
109
|
+
} else {
|
|
110
|
+
profiles = campaign.profiles;
|
|
111
|
+
}
|
|
112
|
+
return profiles.every((profile) => {
|
|
113
|
+
const values = metricValues(
|
|
114
|
+
candidate,
|
|
115
|
+
constraint.metric,
|
|
116
|
+
profile,
|
|
117
|
+
constraint.split,
|
|
118
|
+
experiment,
|
|
119
|
+
);
|
|
120
|
+
if (values.length === 0) return false;
|
|
121
|
+
if (constraint.confidence) {
|
|
122
|
+
const sampleGroups = metricSampleGroups(
|
|
123
|
+
candidate,
|
|
124
|
+
constraint.metric,
|
|
125
|
+
profile,
|
|
126
|
+
constraint.split,
|
|
127
|
+
experiment,
|
|
128
|
+
);
|
|
129
|
+
if (sampleGroups.length === 0) {
|
|
130
|
+
throw new Error(
|
|
131
|
+
`metric '${constraint.metric}' does not expose raw samples for confidence gating` +
|
|
132
|
+
`${profile ? ` in profile '${profile}'` : ""}`,
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
return sampleGroups.every((samples) => {
|
|
136
|
+
try {
|
|
137
|
+
const interval = bootstrapMeanConfidenceInterval(samples, constraint.confidence);
|
|
138
|
+
return (
|
|
139
|
+
(constraint.min === undefined || interval.lower >= constraint.min) &&
|
|
140
|
+
(constraint.max === undefined || interval.upper <= constraint.max)
|
|
141
|
+
);
|
|
142
|
+
} catch (error) {
|
|
143
|
+
if (error instanceof Error && error.message.includes("independent samples")) return false;
|
|
144
|
+
throw error;
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
return values.every(
|
|
149
|
+
(value) =>
|
|
150
|
+
(constraint.min === undefined || value >= constraint.min) &&
|
|
151
|
+
(constraint.max === undefined || value <= constraint.max),
|
|
152
|
+
);
|
|
153
|
+
});
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
export const average = (values: readonly number[]): number =>
|
|
157
|
+
values.reduce((sum, value) => sum + value, 0) / Math.max(values.length, 1);
|
|
158
|
+
|
|
159
|
+
const normalizedConstraintViolation = (
|
|
160
|
+
campaign: ExperimentCampaign,
|
|
161
|
+
candidate: ExperimentDecisionCandidate,
|
|
162
|
+
constraint: ExperimentConstraint,
|
|
163
|
+
experiment: OpenedExperimentRun["manifest"],
|
|
164
|
+
): number => {
|
|
165
|
+
let profiles: Array<string | undefined> = campaign.profiles;
|
|
166
|
+
if (constraint.metric === "subject.bytes" || constraint.profile) {
|
|
167
|
+
profiles = [constraint.profile];
|
|
168
|
+
}
|
|
169
|
+
const violation = (lower: number, upper: number): number =>
|
|
170
|
+
Math.max(
|
|
171
|
+
constraint.min === undefined
|
|
172
|
+
? 0
|
|
173
|
+
: Math.max(0, constraint.min - lower) / Math.max(1, Math.abs(constraint.min)),
|
|
174
|
+
constraint.max === undefined
|
|
175
|
+
? 0
|
|
176
|
+
: Math.max(0, upper - constraint.max) / Math.max(1, Math.abs(constraint.max)),
|
|
177
|
+
);
|
|
178
|
+
let worst = 0;
|
|
179
|
+
for (const profile of profiles) {
|
|
180
|
+
if (constraint.confidence) {
|
|
181
|
+
const groups = metricSampleGroups(
|
|
182
|
+
candidate,
|
|
183
|
+
constraint.metric,
|
|
184
|
+
profile,
|
|
185
|
+
constraint.split,
|
|
186
|
+
experiment,
|
|
187
|
+
);
|
|
188
|
+
if (groups.length === 0) return Number.POSITIVE_INFINITY;
|
|
189
|
+
for (const samples of groups) {
|
|
190
|
+
try {
|
|
191
|
+
const interval = bootstrapMeanConfidenceInterval(samples, constraint.confidence);
|
|
192
|
+
worst = Math.max(worst, violation(interval.lower, interval.upper));
|
|
193
|
+
} catch {
|
|
194
|
+
return Number.POSITIVE_INFINITY;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
continue;
|
|
198
|
+
}
|
|
199
|
+
const values = metricValues(
|
|
200
|
+
candidate,
|
|
201
|
+
constraint.metric,
|
|
202
|
+
profile,
|
|
203
|
+
constraint.split,
|
|
204
|
+
experiment,
|
|
205
|
+
);
|
|
206
|
+
if (values.length === 0) return Number.POSITIVE_INFINITY;
|
|
207
|
+
for (const value of values) worst = Math.max(worst, violation(value, value));
|
|
208
|
+
}
|
|
209
|
+
return worst;
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
export const rankCandidates = <T extends ExperimentDecisionCandidate>(
|
|
213
|
+
campaign: ExperimentCampaign,
|
|
214
|
+
candidates: readonly T[],
|
|
215
|
+
experiment: OpenedExperimentRun["manifest"],
|
|
216
|
+
constraintSplits: readonly ExperimentSplit[] = ["train", "validation", "test"],
|
|
217
|
+
): T[] =>
|
|
218
|
+
[...candidates].sort((a, b) => {
|
|
219
|
+
const activeConstraints = campaign.objectives.constraints.filter((constraint) =>
|
|
220
|
+
constraintSplits.includes(constraint.split),
|
|
221
|
+
);
|
|
222
|
+
const aEligible = activeConstraints.every((constraint) =>
|
|
223
|
+
satisfiesConstraint(campaign, a, constraint, experiment),
|
|
224
|
+
);
|
|
225
|
+
const bEligible = activeConstraints.every((constraint) =>
|
|
226
|
+
satisfiesConstraint(campaign, b, constraint, experiment),
|
|
227
|
+
);
|
|
228
|
+
if (aEligible !== bEligible) return aEligible ? -1 : 1;
|
|
229
|
+
if (!aEligible) {
|
|
230
|
+
const aViolation = Math.max(
|
|
231
|
+
0,
|
|
232
|
+
...activeConstraints.map((constraint) =>
|
|
233
|
+
normalizedConstraintViolation(campaign, a, constraint, experiment),
|
|
234
|
+
),
|
|
235
|
+
);
|
|
236
|
+
const bViolation = Math.max(
|
|
237
|
+
0,
|
|
238
|
+
...activeConstraints.map((constraint) =>
|
|
239
|
+
normalizedConstraintViolation(campaign, b, constraint, experiment),
|
|
240
|
+
),
|
|
241
|
+
);
|
|
242
|
+
if (aViolation !== bViolation) return aViolation < bViolation ? -1 : 1;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
for (const objective of campaign.objectives.minimize.filter((entry) =>
|
|
246
|
+
constraintSplits.includes(entry.split),
|
|
247
|
+
)) {
|
|
248
|
+
const aValues = metricValues(
|
|
249
|
+
a,
|
|
250
|
+
objective.metric,
|
|
251
|
+
objective.profile,
|
|
252
|
+
objective.split,
|
|
253
|
+
experiment,
|
|
254
|
+
);
|
|
255
|
+
const bValues = metricValues(
|
|
256
|
+
b,
|
|
257
|
+
objective.metric,
|
|
258
|
+
objective.profile,
|
|
259
|
+
objective.split,
|
|
260
|
+
experiment,
|
|
261
|
+
);
|
|
262
|
+
if (aValues.length === 0 && bValues.length > 0) return 1;
|
|
263
|
+
if (bValues.length === 0 && aValues.length > 0) return -1;
|
|
264
|
+
if (aValues.length > 0 && bValues.length > 0) {
|
|
265
|
+
const delta = average(aValues) - average(bValues);
|
|
266
|
+
if (delta !== 0) return delta;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
const quality = (candidate: ExperimentDecisionCandidate): number => {
|
|
270
|
+
const values = metricValues(
|
|
271
|
+
candidate,
|
|
272
|
+
"quality.passRate",
|
|
273
|
+
undefined,
|
|
274
|
+
"validation",
|
|
275
|
+
experiment,
|
|
276
|
+
);
|
|
277
|
+
return values.length > 0 ? Math.min(...values) : -1;
|
|
278
|
+
};
|
|
279
|
+
const qualityDelta = quality(b) - quality(a);
|
|
280
|
+
if (qualityDelta !== 0) return qualityDelta;
|
|
281
|
+
if (a.sourceBytes !== b.sourceBytes) return a.sourceBytes - b.sourceBytes;
|
|
282
|
+
return a.id.localeCompare(b.id);
|
|
283
|
+
});
|
|
284
|
+
|
|
285
|
+
const candidateCaseVector = (
|
|
286
|
+
candidate: Candidate,
|
|
287
|
+
experiment: OpenedExperimentRun["manifest"],
|
|
288
|
+
preferredSplit: ExperimentSplit,
|
|
289
|
+
): Record<string, number> => {
|
|
290
|
+
const evaluations = candidateEvaluations(experiment, candidate.id);
|
|
291
|
+
const split = evaluations.some((entry) => entry.split === preferredSplit)
|
|
292
|
+
? preferredSplit
|
|
293
|
+
: "validation";
|
|
294
|
+
return Object.fromEntries(
|
|
295
|
+
evaluations
|
|
296
|
+
.filter((entry) => entry.split === split)
|
|
297
|
+
.flatMap((entry) =>
|
|
298
|
+
Object.entries(entry.casePassRates).map(([caseId, passRate]) => [
|
|
299
|
+
`${entry.profileId}:${caseId}`,
|
|
300
|
+
passRate,
|
|
301
|
+
]),
|
|
302
|
+
),
|
|
303
|
+
);
|
|
304
|
+
};
|
|
305
|
+
|
|
306
|
+
const dominates = (a: Record<string, number>, b: Record<string, number>): boolean => {
|
|
307
|
+
const keys = new Set([...Object.keys(a), ...Object.keys(b)]);
|
|
308
|
+
if (keys.size === 0) return false;
|
|
309
|
+
let strictlyBetter = false;
|
|
310
|
+
for (const key of keys) {
|
|
311
|
+
const av = a[key] ?? 0;
|
|
312
|
+
const bv = b[key] ?? 0;
|
|
313
|
+
if (av < bv) return false;
|
|
314
|
+
if (av > bv) strictlyBetter = true;
|
|
315
|
+
}
|
|
316
|
+
return strictlyBetter;
|
|
317
|
+
};
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* Per-case Pareto frontier used during reflective search. Quality constraints
|
|
321
|
+
* filter the population when at least one eligible candidate exists.
|
|
322
|
+
*/
|
|
323
|
+
export const paretoFrontier = (
|
|
324
|
+
campaign: ExperimentCampaign,
|
|
325
|
+
candidates: readonly Candidate[],
|
|
326
|
+
experiment: OpenedExperimentRun["manifest"],
|
|
327
|
+
split: ExperimentSplit = "train",
|
|
328
|
+
constraintSplits: readonly ExperimentSplit[] = ["train", "validation"],
|
|
329
|
+
): Candidate[] => {
|
|
330
|
+
const activeConstraints = campaign.objectives.constraints.filter((constraint) =>
|
|
331
|
+
constraintSplits.includes(constraint.split),
|
|
332
|
+
);
|
|
333
|
+
const eligible = candidates.filter((candidate) =>
|
|
334
|
+
activeConstraints.every((constraint) =>
|
|
335
|
+
satisfiesConstraint(campaign, candidate, constraint, experiment),
|
|
336
|
+
),
|
|
337
|
+
);
|
|
338
|
+
const population = eligible.length > 0 ? eligible : [...candidates];
|
|
339
|
+
const vectors = new Map(
|
|
340
|
+
population.map((candidate) => [
|
|
341
|
+
candidate.id,
|
|
342
|
+
candidateCaseVector(candidate, experiment, split),
|
|
343
|
+
]),
|
|
344
|
+
);
|
|
345
|
+
return population
|
|
346
|
+
.filter((candidate) => {
|
|
347
|
+
const vector = vectors.get(candidate.id) ?? {};
|
|
348
|
+
return !population.some(
|
|
349
|
+
(other) => other.id !== candidate.id && dominates(vectors.get(other.id) ?? {}, vector),
|
|
350
|
+
);
|
|
351
|
+
})
|
|
352
|
+
.sort((a, b) => a.id.localeCompare(b.id));
|
|
353
|
+
};
|
|
354
|
+
|
|
355
|
+
const frontierCoverage = (
|
|
356
|
+
candidate: Candidate,
|
|
357
|
+
frontier: readonly Candidate[],
|
|
358
|
+
experiment: OpenedExperimentRun["manifest"],
|
|
359
|
+
): number => {
|
|
360
|
+
const vectors = frontier.map((entry) => candidateCaseVector(entry, experiment, "train"));
|
|
361
|
+
const candidateVector = candidateCaseVector(candidate, experiment, "train");
|
|
362
|
+
const keys = new Set(vectors.flatMap((vector) => Object.keys(vector)));
|
|
363
|
+
return [...keys].filter((key) => {
|
|
364
|
+
const best = Math.max(...vectors.map((vector) => vector[key] ?? 0));
|
|
365
|
+
return (candidateVector[key] ?? 0) === best;
|
|
366
|
+
}).length;
|
|
367
|
+
};
|
|
368
|
+
|
|
369
|
+
export const searchFrontier = (
|
|
370
|
+
campaign: ExperimentCampaign,
|
|
371
|
+
candidates: readonly Candidate[],
|
|
372
|
+
experiment: OpenedExperimentRun["manifest"],
|
|
373
|
+
): Candidate[] => {
|
|
374
|
+
const frontier = paretoFrontier(campaign, candidates, experiment);
|
|
375
|
+
return frontier.sort((a, b) => {
|
|
376
|
+
const coverage =
|
|
377
|
+
frontierCoverage(b, frontier, experiment) - frontierCoverage(a, frontier, experiment);
|
|
378
|
+
return coverage || a.id.localeCompare(b.id);
|
|
379
|
+
});
|
|
380
|
+
};
|
|
381
|
+
|
|
382
|
+
export const deriveExperimentSelection = (
|
|
383
|
+
campaign: ExperimentCampaign,
|
|
384
|
+
candidates: readonly ExperimentDecisionCandidate[],
|
|
385
|
+
experiment: OpenedExperimentRun["manifest"],
|
|
386
|
+
rawOptions: z.input<typeof ExperimentSelectionDerivationOptionsSchema> = {},
|
|
387
|
+
): ExperimentSelection => {
|
|
388
|
+
const options = ExperimentSelectionDerivationOptionsSchema.parse(rawOptions);
|
|
389
|
+
const decisionCandidates = candidates.map((candidate) =>
|
|
390
|
+
ExperimentDecisionCandidateSchema.parse(candidate),
|
|
391
|
+
);
|
|
392
|
+
const ranked = rankCandidates(campaign, decisionCandidates, experiment);
|
|
393
|
+
const champion = ranked[0] ?? null;
|
|
394
|
+
const eligibleCandidates = ranked.filter((candidate) =>
|
|
395
|
+
campaign.objectives.constraints.every((constraint) =>
|
|
396
|
+
satisfiesConstraint(campaign, candidate, constraint, experiment),
|
|
397
|
+
),
|
|
398
|
+
);
|
|
399
|
+
const eligible =
|
|
400
|
+
champion !== null && eligibleCandidates.some((candidate) => candidate.id === champion.id);
|
|
401
|
+
const constraintReports = decisionCandidates.flatMap((candidate) =>
|
|
402
|
+
campaign.objectives.constraints.flatMap((constraint) => {
|
|
403
|
+
const profiles: Array<string | undefined> =
|
|
404
|
+
constraint.profile || constraint.metric === "subject.bytes"
|
|
405
|
+
? [constraint.profile]
|
|
406
|
+
: campaign.profiles;
|
|
407
|
+
return profiles.map((profile) => {
|
|
408
|
+
const values = metricValues(
|
|
409
|
+
candidate,
|
|
410
|
+
constraint.metric,
|
|
411
|
+
profile,
|
|
412
|
+
constraint.split,
|
|
413
|
+
experiment,
|
|
414
|
+
);
|
|
415
|
+
const scoped = { ...constraint, ...(profile ? { profile } : {}) };
|
|
416
|
+
let interval: ReturnType<typeof bootstrapMeanConfidenceInterval> | undefined;
|
|
417
|
+
let note: string | undefined;
|
|
418
|
+
if (constraint.confidence) {
|
|
419
|
+
const samples = metricSampleGroups(
|
|
420
|
+
candidate,
|
|
421
|
+
constraint.metric,
|
|
422
|
+
profile,
|
|
423
|
+
constraint.split,
|
|
424
|
+
experiment,
|
|
425
|
+
)[0];
|
|
426
|
+
if (samples) {
|
|
427
|
+
try {
|
|
428
|
+
interval = bootstrapMeanConfidenceInterval(samples, constraint.confidence);
|
|
429
|
+
} catch (error) {
|
|
430
|
+
note = error instanceof Error ? error.message : String(error);
|
|
431
|
+
}
|
|
432
|
+
} else {
|
|
433
|
+
note = "metric exposes no raw samples";
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
return {
|
|
437
|
+
candidateId: candidate.id,
|
|
438
|
+
metric: constraint.metric,
|
|
439
|
+
...(profile ? { profile } : {}),
|
|
440
|
+
split: constraint.split,
|
|
441
|
+
values,
|
|
442
|
+
passed: satisfiesConstraint(campaign, candidate, scoped, experiment),
|
|
443
|
+
...(interval ? { interval } : {}),
|
|
444
|
+
...(note ? { note } : {}),
|
|
445
|
+
};
|
|
446
|
+
});
|
|
447
|
+
}),
|
|
448
|
+
);
|
|
449
|
+
return ExperimentSelectionSchema.parse({
|
|
450
|
+
decidedAt: options.decidedAt ?? new Date().toISOString(),
|
|
451
|
+
decisionCandidateIds: decisionCandidates.map((candidate) => candidate.id),
|
|
452
|
+
...(options.promotionFinalistCandidateIds
|
|
453
|
+
? { promotionFinalistCandidateIds: options.promotionFinalistCandidateIds }
|
|
454
|
+
: {}),
|
|
455
|
+
rankedCandidateIds: ranked.map((candidate) => candidate.id),
|
|
456
|
+
eligibleCandidateIds: eligibleCandidates.map((candidate) => candidate.id),
|
|
457
|
+
...(eligible && champion ? { championCandidateId: champion.id } : {}),
|
|
458
|
+
constraints: constraintReports,
|
|
459
|
+
});
|
|
460
|
+
};
|
|
461
|
+
|
|
462
|
+
export const ExperimentSelectionDerivationOptionsSchema = z
|
|
463
|
+
.object({
|
|
464
|
+
decidedAt: z.string().optional(),
|
|
465
|
+
promotionFinalistCandidateIds: z.array(CandidateIdSchema).optional(),
|
|
466
|
+
})
|
|
467
|
+
.strict();
|