@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,507 @@
|
|
|
1
|
+
import { assign, createActor, fromPromise, setup, toPromise } from "xstate";
|
|
2
|
+
import {
|
|
3
|
+
type AgentDriver,
|
|
4
|
+
type Answer,
|
|
5
|
+
type Answerer,
|
|
6
|
+
type AnswererContext,
|
|
7
|
+
type AnswerHistoryEntry,
|
|
8
|
+
AnswerSchema,
|
|
9
|
+
type Done,
|
|
10
|
+
type ErrorEvent,
|
|
11
|
+
type Interrupt,
|
|
12
|
+
type Progress,
|
|
13
|
+
type RunEvent,
|
|
14
|
+
} from "../core/index.js";
|
|
15
|
+
import type { OpenedRunDir } from "./run-dir.js";
|
|
16
|
+
import type { RunTraceLimitFailure } from "./trace-limits.js";
|
|
17
|
+
|
|
18
|
+
export type DriverSessionOutcome =
|
|
19
|
+
| { kind: "done"; done: Done }
|
|
20
|
+
| {
|
|
21
|
+
kind: "error";
|
|
22
|
+
error: ErrorEvent;
|
|
23
|
+
operationalFailure?: {
|
|
24
|
+
phase: "answerer" | "driver-transport" | "trace" | "abort";
|
|
25
|
+
reason: string;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export type DriverSession = {
|
|
30
|
+
outcome: Promise<DriverSessionOutcome>;
|
|
31
|
+
fail: (reason: string) => void;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
type DeferredInterrupt = {
|
|
35
|
+
interrupt: Interrupt;
|
|
36
|
+
complete: () => void;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
type CompletedAnswer = {
|
|
40
|
+
answer: Answer;
|
|
41
|
+
durationMs: number;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export type DriverSessionEffects = {
|
|
45
|
+
answer: (interrupt: Interrupt) => Promise<CompletedAnswer>;
|
|
46
|
+
respond: (interrupt: Interrupt, completed: CompletedAnswer) => Promise<void>;
|
|
47
|
+
progress: (progress: Progress) => void;
|
|
48
|
+
terminal: (outcome: DriverSessionOutcome, alreadyRecorded: boolean) => void;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
type DriverSessionContext = {
|
|
52
|
+
effects: DriverSessionEffects;
|
|
53
|
+
current: DeferredInterrupt | null;
|
|
54
|
+
queued: DeferredInterrupt[];
|
|
55
|
+
terminal: DriverSessionOutcome | null;
|
|
56
|
+
completedAnswer: CompletedAnswer | null;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
type DriverSessionEvent =
|
|
60
|
+
| { type: "interrupt"; pending: DeferredInterrupt }
|
|
61
|
+
| { type: "progress"; progress: Progress }
|
|
62
|
+
| { type: "done"; done: Done; recorded?: boolean }
|
|
63
|
+
| { type: "error"; error: ErrorEvent; recorded?: boolean }
|
|
64
|
+
| { type: "abort"; recorded?: boolean }
|
|
65
|
+
| { type: "fail"; reason: string; recorded?: boolean }
|
|
66
|
+
| { type: "traceLimit"; failure: RunTraceLimitFailure };
|
|
67
|
+
type RecordableTerminalEvent = Extract<
|
|
68
|
+
DriverSessionEvent,
|
|
69
|
+
{ type: "done" | "error" | "abort" | "fail" }
|
|
70
|
+
>;
|
|
71
|
+
|
|
72
|
+
class InteractionFailure extends Error {
|
|
73
|
+
readonly outcome: DriverSessionOutcome;
|
|
74
|
+
readonly terminalRecorded: boolean;
|
|
75
|
+
|
|
76
|
+
constructor(outcome: DriverSessionOutcome, terminalRecorded = false) {
|
|
77
|
+
super(outcome.kind === "error" ? outcome.error.reason : "driver interaction failed");
|
|
78
|
+
this.outcome = outcome;
|
|
79
|
+
this.terminalRecorded = terminalRecorded;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const interactionFailure = (error: unknown): DriverSessionOutcome =>
|
|
84
|
+
error instanceof InteractionFailure
|
|
85
|
+
? error.outcome
|
|
86
|
+
: {
|
|
87
|
+
kind: "error",
|
|
88
|
+
error: { exitReason: "error", reason: "driver interaction failed" },
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
const doneOutcome = (event: DriverSessionEvent): DriverSessionOutcome =>
|
|
92
|
+
event.type === "done"
|
|
93
|
+
? { kind: "done", done: event.done }
|
|
94
|
+
: {
|
|
95
|
+
kind: "error",
|
|
96
|
+
error: { exitReason: "error", reason: "invalid driver completion event" },
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
const errorOutcome = (event: DriverSessionEvent): DriverSessionOutcome => {
|
|
100
|
+
if (event.type === "error") return { kind: "error", error: event.error };
|
|
101
|
+
const reason = event.type === "fail" ? event.reason : "run aborted";
|
|
102
|
+
return {
|
|
103
|
+
kind: "error",
|
|
104
|
+
error: { exitReason: "error", reason },
|
|
105
|
+
...(event.type === "abort" ? { operationalFailure: { phase: "abort" as const, reason } } : {}),
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
const traceLimitOutcome = (event: DriverSessionEvent): DriverSessionOutcome => {
|
|
110
|
+
const reason =
|
|
111
|
+
event.type === "traceLimit" ? event.failure.reason : "run trace exceeded its limit";
|
|
112
|
+
return {
|
|
113
|
+
kind: "error",
|
|
114
|
+
error: { exitReason: "error", reason },
|
|
115
|
+
operationalFailure: { phase: "trace", reason },
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
const driverSessionMachine = setup({
|
|
120
|
+
types: {
|
|
121
|
+
context: {} as DriverSessionContext,
|
|
122
|
+
input: {} as { effects: DriverSessionEffects },
|
|
123
|
+
events: {} as DriverSessionEvent,
|
|
124
|
+
output: {} as DriverSessionOutcome,
|
|
125
|
+
},
|
|
126
|
+
actors: {
|
|
127
|
+
answer: fromPromise<CompletedAnswer, { effects: DriverSessionEffects; interrupt: Interrupt }>(
|
|
128
|
+
({ input }) => input.effects.answer(input.interrupt),
|
|
129
|
+
),
|
|
130
|
+
respond: fromPromise<
|
|
131
|
+
void,
|
|
132
|
+
{
|
|
133
|
+
effects: DriverSessionEffects;
|
|
134
|
+
interrupt: Interrupt;
|
|
135
|
+
completed: CompletedAnswer;
|
|
136
|
+
}
|
|
137
|
+
>(({ input }) => input.effects.respond(input.interrupt, input.completed)),
|
|
138
|
+
},
|
|
139
|
+
guards: {
|
|
140
|
+
hasNoTerminal: ({ context }) => context.terminal === null,
|
|
141
|
+
hasDoneTerminal: ({ context }) => context.terminal?.kind === "done",
|
|
142
|
+
hasErrorTerminal: ({ context }) => context.terminal?.kind === "error",
|
|
143
|
+
hasTraceTerminal: ({ context }) =>
|
|
144
|
+
context.terminal?.kind === "error" && context.terminal.operationalFailure?.phase === "trace",
|
|
145
|
+
hasQueuedInterrupt: ({ context }) => context.queued.length > 0,
|
|
146
|
+
},
|
|
147
|
+
actions: {
|
|
148
|
+
beginInterrupt: assign({
|
|
149
|
+
current: ({ event }) => (event.type === "interrupt" ? event.pending : null),
|
|
150
|
+
}),
|
|
151
|
+
queueInterrupt: assign({
|
|
152
|
+
queued: ({ context, event }) =>
|
|
153
|
+
event.type === "interrupt" ? [...context.queued, event.pending] : context.queued,
|
|
154
|
+
}),
|
|
155
|
+
takeNextInterrupt: assign(({ context }) => ({
|
|
156
|
+
current: context.queued[0] ?? null,
|
|
157
|
+
queued: context.queued.slice(1),
|
|
158
|
+
})),
|
|
159
|
+
completeCurrentInterrupt: assign(({ context }) => {
|
|
160
|
+
context.current?.complete();
|
|
161
|
+
return { current: null, completedAnswer: null };
|
|
162
|
+
}),
|
|
163
|
+
releaseInterrupts: ({ context }) => {
|
|
164
|
+
context.current?.complete();
|
|
165
|
+
for (const pending of context.queued) pending.complete();
|
|
166
|
+
},
|
|
167
|
+
recordProgress: ({ context, event }) => {
|
|
168
|
+
if (event.type === "progress") context.effects.progress(event.progress);
|
|
169
|
+
},
|
|
170
|
+
recordDone: ({ context, event }) => {
|
|
171
|
+
context.effects.terminal(
|
|
172
|
+
doneOutcome(event),
|
|
173
|
+
event.type === "done" && event.recorded === true,
|
|
174
|
+
);
|
|
175
|
+
},
|
|
176
|
+
rememberDone: assign({
|
|
177
|
+
terminal: ({ event }) => doneOutcome(event),
|
|
178
|
+
}),
|
|
179
|
+
recordError: ({ context, event }) => {
|
|
180
|
+
context.effects.terminal(errorOutcome(event), "recorded" in event && event.recorded === true);
|
|
181
|
+
},
|
|
182
|
+
rememberError: assign({
|
|
183
|
+
terminal: ({ event }) => errorOutcome(event),
|
|
184
|
+
}),
|
|
185
|
+
recordTraceLimit: ({ context, event }) => {
|
|
186
|
+
context.effects.terminal(traceLimitOutcome(event), true);
|
|
187
|
+
},
|
|
188
|
+
rememberTraceLimit: assign({
|
|
189
|
+
terminal: ({ event }) => traceLimitOutcome(event),
|
|
190
|
+
}),
|
|
191
|
+
recordInteractionFailure: ({ context, event }) => {
|
|
192
|
+
if ("error" in event) {
|
|
193
|
+
context.effects.terminal(
|
|
194
|
+
interactionFailure(event.error),
|
|
195
|
+
event.error instanceof InteractionFailure && event.error.terminalRecorded,
|
|
196
|
+
);
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
rememberInteractionFailure: assign({
|
|
200
|
+
terminal: ({ event }) =>
|
|
201
|
+
"error" in event ? interactionFailure(event.error) : errorOutcome(event),
|
|
202
|
+
}),
|
|
203
|
+
rememberCompletedAnswer: assign({
|
|
204
|
+
completedAnswer: ({ event }) =>
|
|
205
|
+
"output" in event ? (event.output as CompletedAnswer) : null,
|
|
206
|
+
}),
|
|
207
|
+
},
|
|
208
|
+
}).createMachine({
|
|
209
|
+
id: "lux-driver-session",
|
|
210
|
+
context: ({ input }) => ({
|
|
211
|
+
effects: input.effects,
|
|
212
|
+
current: null,
|
|
213
|
+
queued: [],
|
|
214
|
+
terminal: null,
|
|
215
|
+
completedAnswer: null,
|
|
216
|
+
}),
|
|
217
|
+
initial: "waiting",
|
|
218
|
+
states: {
|
|
219
|
+
waiting: {
|
|
220
|
+
on: {
|
|
221
|
+
interrupt: { target: "answering", actions: "beginInterrupt" },
|
|
222
|
+
progress: { actions: "recordProgress" },
|
|
223
|
+
done: { target: "succeeded", actions: ["recordDone", "rememberDone"] },
|
|
224
|
+
error: { target: "failed", actions: ["recordError", "rememberError"] },
|
|
225
|
+
abort: { target: "failed", actions: ["recordError", "rememberError"] },
|
|
226
|
+
fail: { target: "failed", actions: ["recordError", "rememberError"] },
|
|
227
|
+
traceLimit: {
|
|
228
|
+
target: "failed",
|
|
229
|
+
actions: ["recordTraceLimit", "rememberTraceLimit"],
|
|
230
|
+
},
|
|
231
|
+
},
|
|
232
|
+
},
|
|
233
|
+
answering: {
|
|
234
|
+
invoke: {
|
|
235
|
+
src: "answer",
|
|
236
|
+
input: ({ context }) => {
|
|
237
|
+
if (!context.current) throw new Error("driver session has no current interrupt");
|
|
238
|
+
return { effects: context.effects, interrupt: context.current.interrupt };
|
|
239
|
+
},
|
|
240
|
+
onDone: [
|
|
241
|
+
{
|
|
242
|
+
guard: ({ context }) => context.terminal !== null,
|
|
243
|
+
target: "selecting",
|
|
244
|
+
actions: "completeCurrentInterrupt",
|
|
245
|
+
},
|
|
246
|
+
{ target: "responding", actions: "rememberCompletedAnswer" },
|
|
247
|
+
],
|
|
248
|
+
onError: [
|
|
249
|
+
{
|
|
250
|
+
guard: "hasTraceTerminal",
|
|
251
|
+
target: "selecting",
|
|
252
|
+
actions: "completeCurrentInterrupt",
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
target: "failed",
|
|
256
|
+
actions: ["recordInteractionFailure", "rememberInteractionFailure"],
|
|
257
|
+
},
|
|
258
|
+
],
|
|
259
|
+
},
|
|
260
|
+
on: {
|
|
261
|
+
interrupt: { actions: "queueInterrupt" },
|
|
262
|
+
progress: { actions: "recordProgress" },
|
|
263
|
+
done: {
|
|
264
|
+
guard: "hasNoTerminal",
|
|
265
|
+
actions: ["recordDone", "rememberDone"],
|
|
266
|
+
},
|
|
267
|
+
error: {
|
|
268
|
+
guard: "hasNoTerminal",
|
|
269
|
+
actions: ["recordError", "rememberError"],
|
|
270
|
+
},
|
|
271
|
+
abort: {
|
|
272
|
+
guard: "hasNoTerminal",
|
|
273
|
+
actions: ["recordError", "rememberError"],
|
|
274
|
+
},
|
|
275
|
+
fail: {
|
|
276
|
+
guard: "hasNoTerminal",
|
|
277
|
+
actions: ["recordError", "rememberError"],
|
|
278
|
+
},
|
|
279
|
+
traceLimit: {
|
|
280
|
+
actions: ["recordTraceLimit", "rememberTraceLimit"],
|
|
281
|
+
},
|
|
282
|
+
},
|
|
283
|
+
},
|
|
284
|
+
responding: {
|
|
285
|
+
invoke: {
|
|
286
|
+
src: "respond",
|
|
287
|
+
input: ({ context }) => {
|
|
288
|
+
if (!context.current || !context.completedAnswer) {
|
|
289
|
+
throw new Error("driver session has no completed answer to send");
|
|
290
|
+
}
|
|
291
|
+
return {
|
|
292
|
+
effects: context.effects,
|
|
293
|
+
interrupt: context.current.interrupt,
|
|
294
|
+
completed: context.completedAnswer,
|
|
295
|
+
};
|
|
296
|
+
},
|
|
297
|
+
onDone: { target: "selecting", actions: "completeCurrentInterrupt" },
|
|
298
|
+
onError: [
|
|
299
|
+
{
|
|
300
|
+
guard: "hasTraceTerminal",
|
|
301
|
+
target: "selecting",
|
|
302
|
+
actions: "completeCurrentInterrupt",
|
|
303
|
+
},
|
|
304
|
+
{
|
|
305
|
+
target: "failed",
|
|
306
|
+
actions: ["recordInteractionFailure", "rememberInteractionFailure"],
|
|
307
|
+
},
|
|
308
|
+
],
|
|
309
|
+
},
|
|
310
|
+
on: {
|
|
311
|
+
interrupt: { actions: "queueInterrupt" },
|
|
312
|
+
progress: { actions: "recordProgress" },
|
|
313
|
+
done: {
|
|
314
|
+
guard: "hasNoTerminal",
|
|
315
|
+
actions: ["recordDone", "rememberDone"],
|
|
316
|
+
},
|
|
317
|
+
error: {
|
|
318
|
+
guard: "hasNoTerminal",
|
|
319
|
+
actions: ["recordError", "rememberError"],
|
|
320
|
+
},
|
|
321
|
+
abort: {
|
|
322
|
+
guard: "hasNoTerminal",
|
|
323
|
+
actions: ["recordError", "rememberError"],
|
|
324
|
+
},
|
|
325
|
+
fail: {
|
|
326
|
+
guard: "hasNoTerminal",
|
|
327
|
+
actions: ["recordError", "rememberError"],
|
|
328
|
+
},
|
|
329
|
+
traceLimit: {
|
|
330
|
+
actions: ["recordTraceLimit", "rememberTraceLimit"],
|
|
331
|
+
},
|
|
332
|
+
},
|
|
333
|
+
},
|
|
334
|
+
selecting: {
|
|
335
|
+
always: [
|
|
336
|
+
{ guard: "hasDoneTerminal", target: "succeeded" },
|
|
337
|
+
{ guard: "hasErrorTerminal", target: "failed" },
|
|
338
|
+
{
|
|
339
|
+
guard: "hasQueuedInterrupt",
|
|
340
|
+
target: "answering",
|
|
341
|
+
actions: "takeNextInterrupt",
|
|
342
|
+
},
|
|
343
|
+
{ target: "waiting" },
|
|
344
|
+
],
|
|
345
|
+
},
|
|
346
|
+
succeeded: { type: "final", entry: "releaseInterrupts" },
|
|
347
|
+
failed: { type: "final", entry: "releaseInterrupts" },
|
|
348
|
+
},
|
|
349
|
+
output: ({ context }) =>
|
|
350
|
+
context.terminal ?? {
|
|
351
|
+
kind: "error",
|
|
352
|
+
error: { exitReason: "error", reason: "driver session ended without a terminal event" },
|
|
353
|
+
},
|
|
354
|
+
});
|
|
355
|
+
|
|
356
|
+
const messageOf = (error: unknown): string =>
|
|
357
|
+
error instanceof Error ? error.message : String(error);
|
|
358
|
+
|
|
359
|
+
const interactionError = (
|
|
360
|
+
phase: "answerer" | "driver-transport",
|
|
361
|
+
reason: string,
|
|
362
|
+
): DriverSessionOutcome => ({
|
|
363
|
+
kind: "error",
|
|
364
|
+
error: { exitReason: "error", reason },
|
|
365
|
+
operationalFailure: { phase, reason },
|
|
366
|
+
});
|
|
367
|
+
|
|
368
|
+
export const createDriverSession = (options: {
|
|
369
|
+
driver: AgentDriver;
|
|
370
|
+
answerer: Answerer;
|
|
371
|
+
context: AnswererContext;
|
|
372
|
+
runDir: OpenedRunDir;
|
|
373
|
+
interruptCounts: { ask: number; approve: number; custom: number };
|
|
374
|
+
history: AnswerHistoryEntry[];
|
|
375
|
+
abortSignal?: AbortSignal;
|
|
376
|
+
onToolCall: () => void;
|
|
377
|
+
}): DriverSession => {
|
|
378
|
+
const { driver, answerer, context, runDir, interruptCounts, history, abortSignal, onToolCall } =
|
|
379
|
+
options;
|
|
380
|
+
const recordedInteractionFailure = (
|
|
381
|
+
phase: "answerer" | "driver-transport",
|
|
382
|
+
reason: string,
|
|
383
|
+
): InteractionFailure => {
|
|
384
|
+
const outcome = interactionError(phase, reason);
|
|
385
|
+
const failure = runDir.events.append({
|
|
386
|
+
type: "error",
|
|
387
|
+
exitReason: "error",
|
|
388
|
+
reason,
|
|
389
|
+
ts: Date.now(),
|
|
390
|
+
});
|
|
391
|
+
return failure
|
|
392
|
+
? new InteractionFailure(traceLimitOutcome({ type: "traceLimit", failure }), true)
|
|
393
|
+
: new InteractionFailure(outcome, true);
|
|
394
|
+
};
|
|
395
|
+
const rejectedTraceEvent = (failure: RunTraceLimitFailure): InteractionFailure =>
|
|
396
|
+
new InteractionFailure(traceLimitOutcome({ type: "traceLimit", failure }), true);
|
|
397
|
+
const effects: DriverSessionEffects = {
|
|
398
|
+
answer: async (interrupt) => {
|
|
399
|
+
const failure = runDir.events.append({ type: "interrupt", ...interrupt, ts: Date.now() });
|
|
400
|
+
if (failure) throw rejectedTraceEvent(failure);
|
|
401
|
+
interruptCounts[interrupt.kind]++;
|
|
402
|
+
const startedAt = Date.now();
|
|
403
|
+
try {
|
|
404
|
+
const answer = AnswerSchema.parse(await answerer.answer(interrupt, context));
|
|
405
|
+
if (answer.kind !== interrupt.kind || answer.id !== interrupt.id) {
|
|
406
|
+
throw new Error(
|
|
407
|
+
`answer correlation mismatch: expected ${interrupt.kind} interrupt '${interrupt.id}', received ${answer.kind} answer '${answer.id}'`,
|
|
408
|
+
);
|
|
409
|
+
}
|
|
410
|
+
return { answer, durationMs: Date.now() - startedAt };
|
|
411
|
+
} catch (error) {
|
|
412
|
+
const reason = `answerer failed: ${messageOf(error)}`;
|
|
413
|
+
throw recordedInteractionFailure("answerer", reason);
|
|
414
|
+
}
|
|
415
|
+
},
|
|
416
|
+
respond: async (interrupt, completed) => {
|
|
417
|
+
const failure = runDir.events.append({
|
|
418
|
+
type: "responded",
|
|
419
|
+
...completed.answer,
|
|
420
|
+
ts: Date.now(),
|
|
421
|
+
});
|
|
422
|
+
if (failure) throw rejectedTraceEvent(failure);
|
|
423
|
+
history.push({ interrupt, ...completed });
|
|
424
|
+
try {
|
|
425
|
+
await driver.respond(completed.answer);
|
|
426
|
+
} catch (error) {
|
|
427
|
+
const reason = `driver respond failed: ${messageOf(error)}`;
|
|
428
|
+
throw recordedInteractionFailure("driver-transport", reason);
|
|
429
|
+
}
|
|
430
|
+
},
|
|
431
|
+
progress: (progress) => {
|
|
432
|
+
if (runDir.events.append({ type: "progress", ...progress })) return;
|
|
433
|
+
if (progress.kind === "tool-call") onToolCall();
|
|
434
|
+
},
|
|
435
|
+
terminal: (terminalOutcome, alreadyRecorded) => {
|
|
436
|
+
if (alreadyRecorded) return;
|
|
437
|
+
if (terminalOutcome.kind === "done") {
|
|
438
|
+
runDir.events.append({ type: "done", ...terminalOutcome.done, ts: Date.now() });
|
|
439
|
+
} else {
|
|
440
|
+
runDir.events.append({ type: "error", ...terminalOutcome.error, ts: Date.now() });
|
|
441
|
+
}
|
|
442
|
+
},
|
|
443
|
+
};
|
|
444
|
+
|
|
445
|
+
const actor = createActor(driverSessionMachine, { input: { effects } });
|
|
446
|
+
const onInterrupt = (interrupt: Interrupt): Promise<void> => {
|
|
447
|
+
if (actor.getSnapshot().status === "done") return Promise.resolve();
|
|
448
|
+
return new Promise((complete) => {
|
|
449
|
+
actor.send({ type: "interrupt", pending: { interrupt, complete } });
|
|
450
|
+
});
|
|
451
|
+
};
|
|
452
|
+
const onProgress = (progress: Progress): void => {
|
|
453
|
+
if (actor.getSnapshot().status === "active") actor.send({ type: "progress", progress });
|
|
454
|
+
};
|
|
455
|
+
const sendRecordedTerminal = (event: RunEvent, terminalEvent: RecordableTerminalEvent): void => {
|
|
456
|
+
if (actor.getSnapshot().status !== "active") return;
|
|
457
|
+
if (runDir.events.append(event)) return;
|
|
458
|
+
actor.send({ ...terminalEvent, recorded: true });
|
|
459
|
+
};
|
|
460
|
+
const onDone = (done: Done): void => {
|
|
461
|
+
sendRecordedTerminal({ type: "done", ...done, ts: Date.now() }, { type: "done", done });
|
|
462
|
+
};
|
|
463
|
+
const onError = (error: ErrorEvent): void => {
|
|
464
|
+
sendRecordedTerminal({ type: "error", ...error, ts: Date.now() }, { type: "error", error });
|
|
465
|
+
};
|
|
466
|
+
const onAbort = (): void => {
|
|
467
|
+
sendRecordedTerminal(
|
|
468
|
+
{ type: "error", exitReason: "error", reason: "run aborted", ts: Date.now() },
|
|
469
|
+
{ type: "abort" },
|
|
470
|
+
);
|
|
471
|
+
};
|
|
472
|
+
const onTraceLimit = (failure: RunTraceLimitFailure): void => {
|
|
473
|
+
if (actor.getSnapshot().status === "active") actor.send({ type: "traceLimit", failure });
|
|
474
|
+
};
|
|
475
|
+
let stopListeningForTraceLimit = (): void => {};
|
|
476
|
+
const unbind = (): void => {
|
|
477
|
+
driver.off("interrupt", onInterrupt);
|
|
478
|
+
driver.off("progress", onProgress);
|
|
479
|
+
driver.off("done", onDone);
|
|
480
|
+
driver.off("error", onError);
|
|
481
|
+
abortSignal?.removeEventListener("abort", onAbort);
|
|
482
|
+
stopListeningForTraceLimit();
|
|
483
|
+
};
|
|
484
|
+
|
|
485
|
+
driver.on("interrupt", onInterrupt);
|
|
486
|
+
driver.on("progress", onProgress);
|
|
487
|
+
driver.on("done", onDone);
|
|
488
|
+
driver.on("error", onError);
|
|
489
|
+
if (!abortSignal?.aborted) abortSignal?.addEventListener("abort", onAbort, { once: true });
|
|
490
|
+
|
|
491
|
+
actor.start();
|
|
492
|
+
stopListeningForTraceLimit = runDir.events.onLimitExceeded(onTraceLimit);
|
|
493
|
+
if (abortSignal?.aborted) onAbort();
|
|
494
|
+
const outcome = toPromise(actor).finally(unbind);
|
|
495
|
+
return {
|
|
496
|
+
outcome,
|
|
497
|
+
fail: (reason) => {
|
|
498
|
+
sendRecordedTerminal(
|
|
499
|
+
{ type: "error", exitReason: "error", reason, ts: Date.now() },
|
|
500
|
+
{ type: "fail", reason },
|
|
501
|
+
);
|
|
502
|
+
},
|
|
503
|
+
};
|
|
504
|
+
};
|
|
505
|
+
|
|
506
|
+
// Internal export for transition-level tests.
|
|
507
|
+
export { driverSessionMachine };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
2
|
+
import { dirname, extname, join, relative, resolve, sep } from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
import { contentHash, valueHash } from "../core/index.js";
|
|
5
|
+
import { walkAuthoredFiles } from "./fs-read.js";
|
|
6
|
+
|
|
7
|
+
const currentDistributionRoot = (): string => {
|
|
8
|
+
const modulePath = fileURLToPath(import.meta.url);
|
|
9
|
+
const parent = dirname(dirname(modulePath));
|
|
10
|
+
const leaf = parent.split(sep).at(-1);
|
|
11
|
+
if (leaf !== "src" && leaf !== "lib") {
|
|
12
|
+
throw new Error(`cannot locate Lux evaluator distribution from ${modulePath}`);
|
|
13
|
+
}
|
|
14
|
+
return parent;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const isRuntimeImplementation = (path: string): boolean => {
|
|
18
|
+
if (path.endsWith(".test.ts") || path.endsWith(".test.js")) return false;
|
|
19
|
+
if (path.endsWith("test-helpers.ts") || path.endsWith("test-helpers.js")) return false;
|
|
20
|
+
if (path.split(sep).includes("fixtures")) return false;
|
|
21
|
+
const extension = extname(path);
|
|
22
|
+
return extension === ".ts" || extension === ".js" || extension === ".json";
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Hash the exact Lux source/build tree executing the evaluation. Package
|
|
27
|
+
* versions alone are insufficient in development, where evaluator semantics
|
|
28
|
+
* can change without a release bump.
|
|
29
|
+
*/
|
|
30
|
+
export const evaluatorImplementationHash = async (
|
|
31
|
+
distributionRoot: string = currentDistributionRoot(),
|
|
32
|
+
): Promise<string> => {
|
|
33
|
+
const root = resolve(distributionRoot);
|
|
34
|
+
const files = (await walkAuthoredFiles(root)).filter(isRuntimeImplementation);
|
|
35
|
+
if (files.length === 0) {
|
|
36
|
+
throw new Error(`Lux evaluator distribution has no implementation files: ${root}`);
|
|
37
|
+
}
|
|
38
|
+
const evidence = await Promise.all(
|
|
39
|
+
files.map(async (path) => ({
|
|
40
|
+
path: relative(root, join(root, path)).split(sep).join("/"),
|
|
41
|
+
hash: contentHash(await readFile(join(root, path))),
|
|
42
|
+
})),
|
|
43
|
+
);
|
|
44
|
+
return valueHash(evidence);
|
|
45
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { type ExperimentCampaign, totalTokens } from "../core/index.js";
|
|
2
|
+
import type { CampaignExecutionOptions } from "./experiment-context.js";
|
|
3
|
+
import { experimentActiveElapsedMs, type OpenedExperimentRun } from "./experiment-runs.js";
|
|
4
|
+
|
|
5
|
+
export const throwIfAborted = (signal: AbortSignal | undefined): void => {
|
|
6
|
+
if (!signal?.aborted) return;
|
|
7
|
+
throw signal.reason instanceof Error ? signal.reason : new Error("experiment aborted");
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export const boundedExecutionSignal = (
|
|
11
|
+
execution: CampaignExecutionOptions,
|
|
12
|
+
experiment: OpenedExperimentRun,
|
|
13
|
+
): AbortSignal => {
|
|
14
|
+
const elapsed = experimentActiveElapsedMs(experiment.manifest);
|
|
15
|
+
const remaining = execution.loaded.campaign.budget.maxWallTimeMs - elapsed;
|
|
16
|
+
if (remaining <= 0) {
|
|
17
|
+
throw new Error(
|
|
18
|
+
`experiment exceeded its wall-time budget ${execution.loaded.campaign.budget.maxWallTimeMs}ms`,
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
const deadline = AbortSignal.timeout(Math.max(1, remaining));
|
|
22
|
+
return execution.abortSignal ? AbortSignal.any([execution.abortSignal, deadline]) : deadline;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export const ensureBudget = (
|
|
26
|
+
campaign: ExperimentCampaign,
|
|
27
|
+
experiment: OpenedExperimentRun,
|
|
28
|
+
additional: { metricCalls?: number; judgeCalls?: number; proposalCalls?: number } = {},
|
|
29
|
+
): void => {
|
|
30
|
+
const usage = experiment.manifest.budgetUsage;
|
|
31
|
+
const elapsed = experimentActiveElapsedMs(experiment.manifest);
|
|
32
|
+
const checks: [boolean, string][] = [
|
|
33
|
+
[
|
|
34
|
+
usage.metricCalls + (additional.metricCalls ?? 0) > campaign.budget.maxMetricCalls,
|
|
35
|
+
`metric-call budget ${campaign.budget.maxMetricCalls}`,
|
|
36
|
+
],
|
|
37
|
+
[
|
|
38
|
+
usage.judgeCalls + (additional.judgeCalls ?? 0) > campaign.budget.maxJudgeCalls,
|
|
39
|
+
`judge-call budget ${campaign.budget.maxJudgeCalls}`,
|
|
40
|
+
],
|
|
41
|
+
[
|
|
42
|
+
usage.proposalCalls + (additional.proposalCalls ?? 0) > campaign.budget.maxProposalCalls,
|
|
43
|
+
`proposal-call budget ${campaign.budget.maxProposalCalls}`,
|
|
44
|
+
],
|
|
45
|
+
[
|
|
46
|
+
totalTokens(usage.usage) > campaign.budget.maxTokens,
|
|
47
|
+
`token budget ${campaign.budget.maxTokens}`,
|
|
48
|
+
],
|
|
49
|
+
[usage.costUsd > campaign.budget.maxCostUsd, `cost budget $${campaign.budget.maxCostUsd}`],
|
|
50
|
+
[
|
|
51
|
+
(usage.unpricedModelCalls ?? 0) > campaign.budget.maxUnpricedModelCalls,
|
|
52
|
+
`unpriced-model-call budget ${campaign.budget.maxUnpricedModelCalls}`,
|
|
53
|
+
],
|
|
54
|
+
[
|
|
55
|
+
elapsed > campaign.budget.maxWallTimeMs,
|
|
56
|
+
`wall-time budget ${campaign.budget.maxWallTimeMs}ms`,
|
|
57
|
+
],
|
|
58
|
+
];
|
|
59
|
+
const exceeded = checks.find(([failed]) => failed);
|
|
60
|
+
if (exceeded) throw new Error(`experiment exceeded its ${exceeded[1]}`);
|
|
61
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { Registry } from "../core/index.js";
|
|
2
|
+
import type { ResolvedLuxConfig } from "./config.js";
|
|
3
|
+
import type { discoverCases } from "./discover.js";
|
|
4
|
+
import type { LoadedExperimentCampaign } from "./experiment-loader.js";
|
|
5
|
+
|
|
6
|
+
export type EvaluationCorpus =
|
|
7
|
+
| {
|
|
8
|
+
kind: "agent";
|
|
9
|
+
cases: Awaited<ReturnType<typeof discoverCases>>["cases"];
|
|
10
|
+
hash: string;
|
|
11
|
+
}
|
|
12
|
+
| {
|
|
13
|
+
kind: "grader";
|
|
14
|
+
hash: string;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export type CampaignExecutionOptions = {
|
|
18
|
+
config: ResolvedLuxConfig;
|
|
19
|
+
registry: Registry;
|
|
20
|
+
loaded: LoadedExperimentCampaign;
|
|
21
|
+
runsRoot?: string;
|
|
22
|
+
resumeFrom?: string;
|
|
23
|
+
abortSignal?: AbortSignal;
|
|
24
|
+
onEvaluationUnit?: (unit: {
|
|
25
|
+
unitId: string;
|
|
26
|
+
candidateId: string;
|
|
27
|
+
profileId: string;
|
|
28
|
+
split: "train" | "validation" | "test";
|
|
29
|
+
}) => void | Promise<void>;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const profileOrThrow = (config: ResolvedLuxConfig, profileId: string) => {
|
|
33
|
+
const profile = config.profiles?.[profileId];
|
|
34
|
+
if (!profile) {
|
|
35
|
+
const available = Object.keys(config.profiles ?? {}).sort();
|
|
36
|
+
throw new Error(
|
|
37
|
+
`experiment profile '${profileId}' is not configured${available.length > 0 ? `; available: ${available.join(", ")}` : ""}`,
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
return profile;
|
|
41
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { CandidateSchema, ExperimentBudgetSchema } from "../core/index.js";
|
|
3
|
+
import { ExperimentRunSchema } from "./experiment-runs.js";
|
|
4
|
+
|
|
5
|
+
export const CampaignExecutionResultSchema = z
|
|
6
|
+
.object({
|
|
7
|
+
experimentDir: z.string(),
|
|
8
|
+
champion: CandidateSchema.nullable(),
|
|
9
|
+
manifest: ExperimentRunSchema,
|
|
10
|
+
})
|
|
11
|
+
.strict();
|
|
12
|
+
export type CampaignExecutionResult = z.infer<typeof CampaignExecutionResultSchema>;
|
|
13
|
+
|
|
14
|
+
export const ExperimentCampaignPlanSchema = z
|
|
15
|
+
.object({
|
|
16
|
+
campaignId: z.string(),
|
|
17
|
+
mode: z.enum(["experiment", "optimize"]),
|
|
18
|
+
evaluationKind: z.enum(["agent", "grader"]),
|
|
19
|
+
subjectRoot: z.string(),
|
|
20
|
+
mutableComponents: z.array(z.string()),
|
|
21
|
+
profiles: z.array(z.string()),
|
|
22
|
+
splits: z.array(
|
|
23
|
+
z
|
|
24
|
+
.object({
|
|
25
|
+
split: z.enum(["train", "validation", "test"]),
|
|
26
|
+
examples: z.number().int().nonnegative(),
|
|
27
|
+
})
|
|
28
|
+
.strict(),
|
|
29
|
+
),
|
|
30
|
+
projected: z
|
|
31
|
+
.object({
|
|
32
|
+
candidates: z.number().int().nonnegative(),
|
|
33
|
+
metricCalls: z.number().int().nonnegative(),
|
|
34
|
+
judgeCalls: z.number().int().nonnegative(),
|
|
35
|
+
proposalCalls: z.number().int().nonnegative(),
|
|
36
|
+
})
|
|
37
|
+
.strict(),
|
|
38
|
+
budget: ExperimentBudgetSchema,
|
|
39
|
+
fitsProjectedCallBudgets: z.boolean(),
|
|
40
|
+
warnings: z.array(z.string()),
|
|
41
|
+
})
|
|
42
|
+
.strict();
|
|
43
|
+
export type ExperimentCampaignPlan = z.infer<typeof ExperimentCampaignPlanSchema>;
|