@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,465 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { access, constants, lstat, open, readFile, realpath } from "node:fs/promises";
|
|
3
|
+
import { homedir } from "node:os";
|
|
4
|
+
import { delimiter, isAbsolute, join, resolve } from "node:path";
|
|
5
|
+
import { z } from "zod";
|
|
6
|
+
import { contentHash, discoverCliVersion, valueHash } from "../core/index.js";
|
|
7
|
+
import { walkAuthoredFiles } from "./fs-read.js";
|
|
8
|
+
import { boundExperimentDriverConfig } from "./orchestrator.js";
|
|
9
|
+
|
|
10
|
+
export { LUX_VERSION } from "./package-version.js";
|
|
11
|
+
|
|
12
|
+
const ClaudeSettingsFileSchema = z.looseObject({
|
|
13
|
+
enabledPlugins: z.record(z.string(), z.boolean()).optional(),
|
|
14
|
+
});
|
|
15
|
+
const ClaudeInstalledPluginRecordSchema = z.looseObject({
|
|
16
|
+
installPath: z.string(),
|
|
17
|
+
});
|
|
18
|
+
const ClaudeInstalledPluginsFileSchema = z.looseObject({
|
|
19
|
+
plugins: z.record(z.string(), z.array(ClaudeInstalledPluginRecordSchema)),
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
export const referencedCli = (
|
|
23
|
+
reference: unknown,
|
|
24
|
+
): { name: string; command: string } | undefined => {
|
|
25
|
+
let name: string | undefined;
|
|
26
|
+
if (typeof reference === "string") {
|
|
27
|
+
name = reference;
|
|
28
|
+
} else if (
|
|
29
|
+
typeof reference === "object" &&
|
|
30
|
+
reference !== null &&
|
|
31
|
+
typeof (reference as { name?: unknown }).name === "string"
|
|
32
|
+
) {
|
|
33
|
+
name = (reference as { name: string }).name;
|
|
34
|
+
}
|
|
35
|
+
const config =
|
|
36
|
+
typeof reference === "object" && reference !== null
|
|
37
|
+
? (reference as { config?: unknown }).config
|
|
38
|
+
: undefined;
|
|
39
|
+
if (name === "subprocess") {
|
|
40
|
+
if (
|
|
41
|
+
typeof config !== "object" ||
|
|
42
|
+
config === null ||
|
|
43
|
+
typeof (config as { command?: unknown }).command !== "string"
|
|
44
|
+
) {
|
|
45
|
+
return undefined;
|
|
46
|
+
}
|
|
47
|
+
return { name, command: (config as { command: string }).command };
|
|
48
|
+
}
|
|
49
|
+
if (name !== "claude-code" && name !== "codex") return undefined;
|
|
50
|
+
let command = name === "codex" ? "codex" : "claude";
|
|
51
|
+
if (
|
|
52
|
+
typeof config === "object" &&
|
|
53
|
+
config !== null &&
|
|
54
|
+
typeof (config as { command?: unknown }).command === "string"
|
|
55
|
+
) {
|
|
56
|
+
command = (config as { command: string }).command;
|
|
57
|
+
}
|
|
58
|
+
return { name, command };
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export const referencedAnswererCli = (
|
|
62
|
+
reference: unknown,
|
|
63
|
+
): { provider: "claude-code" | "codex"; command: string } | undefined => {
|
|
64
|
+
if (reference === "persona" || reference === "claude-code") {
|
|
65
|
+
return { provider: "claude-code", command: "claude" };
|
|
66
|
+
}
|
|
67
|
+
if (!reference || typeof reference !== "object") return undefined;
|
|
68
|
+
const name = (reference as { name?: unknown }).name;
|
|
69
|
+
const config = driverConfigRecord(reference);
|
|
70
|
+
if (name === "persona") {
|
|
71
|
+
const provider = config.provider === "codex" ? "codex" : "claude-code";
|
|
72
|
+
let command = provider === "codex" ? "codex" : "claude";
|
|
73
|
+
if (typeof config.command === "string") command = config.command;
|
|
74
|
+
return {
|
|
75
|
+
provider,
|
|
76
|
+
command,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
if (name === "claude-code") {
|
|
80
|
+
return {
|
|
81
|
+
provider: "claude-code",
|
|
82
|
+
command: typeof config.command === "string" ? config.command : "claude",
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
return undefined;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
const CliExecutableIdentitySchema = z
|
|
89
|
+
.object({
|
|
90
|
+
path: z.string(),
|
|
91
|
+
hash: z.string(),
|
|
92
|
+
mode: z.number().int().nonnegative(),
|
|
93
|
+
bytes: z.number().int().nonnegative(),
|
|
94
|
+
})
|
|
95
|
+
.strict();
|
|
96
|
+
|
|
97
|
+
const CliIdentitySchema = z
|
|
98
|
+
.object({
|
|
99
|
+
command: z.string(),
|
|
100
|
+
version: z.string().nullable(),
|
|
101
|
+
executable: CliExecutableIdentitySchema.optional(),
|
|
102
|
+
})
|
|
103
|
+
.strict();
|
|
104
|
+
type CliIdentity = z.infer<typeof CliIdentitySchema>;
|
|
105
|
+
|
|
106
|
+
export const RuntimeCliReferenceSchema = z
|
|
107
|
+
.object({
|
|
108
|
+
command: z.string().min(1),
|
|
109
|
+
baseRoot: z.string().min(1),
|
|
110
|
+
})
|
|
111
|
+
.strict();
|
|
112
|
+
export type RuntimeCliReference = z.infer<typeof RuntimeCliReferenceSchema>;
|
|
113
|
+
|
|
114
|
+
const cliExecutableIdentityCache = new Map<
|
|
115
|
+
string,
|
|
116
|
+
Promise<z.infer<typeof CliExecutableIdentitySchema>>
|
|
117
|
+
>();
|
|
118
|
+
const cliVersionCache = new Map<string, Promise<string | null>>();
|
|
119
|
+
|
|
120
|
+
const sameExecutableStat = (
|
|
121
|
+
left: Awaited<ReturnType<typeof lstat>>,
|
|
122
|
+
right: Awaited<ReturnType<typeof lstat>>,
|
|
123
|
+
): boolean =>
|
|
124
|
+
left.dev === right.dev &&
|
|
125
|
+
left.ino === right.ino &&
|
|
126
|
+
left.mode === right.mode &&
|
|
127
|
+
left.size === right.size &&
|
|
128
|
+
left.mtimeMs === right.mtimeMs &&
|
|
129
|
+
left.ctimeMs === right.ctimeMs;
|
|
130
|
+
|
|
131
|
+
const fingerprintCliExecutable = async (
|
|
132
|
+
path: string,
|
|
133
|
+
maximumBytes: number,
|
|
134
|
+
): Promise<z.infer<typeof CliExecutableIdentitySchema>> => {
|
|
135
|
+
const initial = await lstat(path);
|
|
136
|
+
if (initial.isSymbolicLink() || !initial.isFile()) {
|
|
137
|
+
throw new Error(`experiment CLI command must be a regular file: ${path}`);
|
|
138
|
+
}
|
|
139
|
+
if (initial.size > maximumBytes) {
|
|
140
|
+
throw new Error(`experiment CLI command exceeds ${maximumBytes / 1024 / 1024} MiB: ${path}`);
|
|
141
|
+
}
|
|
142
|
+
const canonicalPath = await realpath(path);
|
|
143
|
+
const cacheKey = [
|
|
144
|
+
canonicalPath,
|
|
145
|
+
initial.dev,
|
|
146
|
+
initial.ino,
|
|
147
|
+
initial.mode,
|
|
148
|
+
initial.size,
|
|
149
|
+
initial.mtimeMs,
|
|
150
|
+
initial.ctimeMs,
|
|
151
|
+
].join("\u0000");
|
|
152
|
+
const cached = cliExecutableIdentityCache.get(cacheKey);
|
|
153
|
+
if (cached) return cached;
|
|
154
|
+
|
|
155
|
+
const pending = (async () => {
|
|
156
|
+
const handle = await open(path, constants.O_RDONLY | constants.O_NOFOLLOW);
|
|
157
|
+
try {
|
|
158
|
+
const before = await handle.stat();
|
|
159
|
+
if (!sameExecutableStat(initial, before)) {
|
|
160
|
+
throw new Error(`experiment CLI command changed before fingerprinting: ${path}`);
|
|
161
|
+
}
|
|
162
|
+
const digest = createHash("sha256");
|
|
163
|
+
const buffer = Buffer.allocUnsafe(1024 * 1024);
|
|
164
|
+
let offset = 0;
|
|
165
|
+
while (offset < before.size) {
|
|
166
|
+
const length = Math.min(buffer.length, before.size - offset);
|
|
167
|
+
const { bytesRead } = await handle.read(buffer, 0, length, offset);
|
|
168
|
+
if (bytesRead === 0) {
|
|
169
|
+
throw new Error(`experiment CLI command changed while fingerprinting: ${path}`);
|
|
170
|
+
}
|
|
171
|
+
digest.update(buffer.subarray(0, bytesRead));
|
|
172
|
+
offset += bytesRead;
|
|
173
|
+
}
|
|
174
|
+
const after = await handle.stat();
|
|
175
|
+
const current = await lstat(path);
|
|
176
|
+
const currentCanonicalPath = await realpath(path);
|
|
177
|
+
if (
|
|
178
|
+
offset !== before.size ||
|
|
179
|
+
!sameExecutableStat(before, after) ||
|
|
180
|
+
!sameExecutableStat(after, current) ||
|
|
181
|
+
currentCanonicalPath !== canonicalPath
|
|
182
|
+
) {
|
|
183
|
+
throw new Error(`experiment CLI command changed while fingerprinting: ${path}`);
|
|
184
|
+
}
|
|
185
|
+
return CliExecutableIdentitySchema.parse({
|
|
186
|
+
path: canonicalPath,
|
|
187
|
+
hash: digest.digest("hex"),
|
|
188
|
+
mode: after.mode,
|
|
189
|
+
bytes: after.size,
|
|
190
|
+
});
|
|
191
|
+
} finally {
|
|
192
|
+
await handle.close();
|
|
193
|
+
}
|
|
194
|
+
})();
|
|
195
|
+
cliExecutableIdentityCache.set(cacheKey, pending);
|
|
196
|
+
try {
|
|
197
|
+
return await pending;
|
|
198
|
+
} catch (error) {
|
|
199
|
+
if (cliExecutableIdentityCache.get(cacheKey) === pending) {
|
|
200
|
+
cliExecutableIdentityCache.delete(cacheKey);
|
|
201
|
+
}
|
|
202
|
+
throw error;
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
export const cliIdentity = async (command: string, baseRoot: string): Promise<CliIdentity> => {
|
|
207
|
+
const pathLike =
|
|
208
|
+
isAbsolute(command) ||
|
|
209
|
+
command.startsWith(".") ||
|
|
210
|
+
command.includes("/") ||
|
|
211
|
+
command.includes("\\");
|
|
212
|
+
if (pathLike && !isAbsolute(command)) {
|
|
213
|
+
throw new Error(
|
|
214
|
+
`custom experiment CLI command must be absolute for reproducible identity: ${resolve(baseRoot, command)}`,
|
|
215
|
+
);
|
|
216
|
+
}
|
|
217
|
+
let path: string;
|
|
218
|
+
if (pathLike) {
|
|
219
|
+
path = resolve(command);
|
|
220
|
+
} else {
|
|
221
|
+
const extensions =
|
|
222
|
+
process.platform === "win32"
|
|
223
|
+
? (process.env.PATHEXT ?? ".EXE;.CMD;.BAT;.COM").split(";")
|
|
224
|
+
: [""];
|
|
225
|
+
let found: string | undefined;
|
|
226
|
+
for (const directory of (process.env.PATH ?? "").split(delimiter)) {
|
|
227
|
+
if (!directory || !isAbsolute(directory)) {
|
|
228
|
+
throw new Error(
|
|
229
|
+
`experiment PATH entries must be absolute and non-empty for reproducible command resolution: ${directory || "<empty>"}`,
|
|
230
|
+
);
|
|
231
|
+
}
|
|
232
|
+
for (const extension of extensions) {
|
|
233
|
+
const candidate = join(directory, `${command}${extension}`);
|
|
234
|
+
try {
|
|
235
|
+
await access(candidate, constants.X_OK);
|
|
236
|
+
found = await realpath(candidate);
|
|
237
|
+
break;
|
|
238
|
+
} catch {
|
|
239
|
+
// Try the next PATH entry.
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
if (found) break;
|
|
243
|
+
}
|
|
244
|
+
if (!found) throw new Error(`experiment CLI command was not found on PATH: ${command}`);
|
|
245
|
+
path = found;
|
|
246
|
+
}
|
|
247
|
+
// Current signed CLI bundles can exceed 256 MiB. Keep explicit paths
|
|
248
|
+
// tightly bounded while allowing installed single-file binaries.
|
|
249
|
+
const maximumBytes = pathLike ? 32 * 1024 * 1024 : 512 * 1024 * 1024;
|
|
250
|
+
const executable = await fingerprintCliExecutable(path, maximumBytes);
|
|
251
|
+
const versionKey = `${command}\u0000${executable.path}\u0000${executable.hash}`;
|
|
252
|
+
let version = cliVersionCache.get(versionKey);
|
|
253
|
+
if (!version) {
|
|
254
|
+
version = discoverCliVersion(executable.path).then((value) => value ?? null);
|
|
255
|
+
cliVersionCache.set(versionKey, version);
|
|
256
|
+
}
|
|
257
|
+
return CliIdentitySchema.parse({
|
|
258
|
+
command,
|
|
259
|
+
version: await version,
|
|
260
|
+
executable,
|
|
261
|
+
});
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
const optionalRegularFileHash = async (path: string): Promise<string | null> => {
|
|
265
|
+
try {
|
|
266
|
+
const info = await lstat(path);
|
|
267
|
+
if (info.isSymbolicLink() || !info.isFile()) {
|
|
268
|
+
throw new Error(`behavior-affecting settings must be a regular file: ${path}`);
|
|
269
|
+
}
|
|
270
|
+
return contentHash(await readFile(path));
|
|
271
|
+
} catch (error) {
|
|
272
|
+
if ((error as NodeJS.ErrnoException).code === "ENOENT") return null;
|
|
273
|
+
throw error;
|
|
274
|
+
}
|
|
275
|
+
};
|
|
276
|
+
|
|
277
|
+
const driverConfigRecord = (driver: unknown): Record<string, unknown> => {
|
|
278
|
+
if (!driver || typeof driver !== "object") return {};
|
|
279
|
+
const config = (driver as { config?: unknown }).config;
|
|
280
|
+
return config && typeof config === "object" ? (config as Record<string, unknown>) : {};
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
export const claudeConfigRoot = (driver: unknown): string => {
|
|
284
|
+
const config = driverConfigRecord(driver);
|
|
285
|
+
const env =
|
|
286
|
+
config.env && typeof config.env === "object"
|
|
287
|
+
? (config.env as Record<string, unknown>)
|
|
288
|
+
: undefined;
|
|
289
|
+
const configured = env?.CLAUDE_CONFIG_DIR;
|
|
290
|
+
const root =
|
|
291
|
+
typeof configured === "string"
|
|
292
|
+
? configured
|
|
293
|
+
: (process.env.CLAUDE_CONFIG_DIR ?? join(homedir(), ".claude"));
|
|
294
|
+
if (!isAbsolute(root)) {
|
|
295
|
+
throw new Error("CLAUDE_CONFIG_DIR must be absolute for reproducible experiment identity");
|
|
296
|
+
}
|
|
297
|
+
return resolve(root);
|
|
298
|
+
};
|
|
299
|
+
|
|
300
|
+
const hashBehaviorDirectory = async (
|
|
301
|
+
root: string,
|
|
302
|
+
label: string,
|
|
303
|
+
): Promise<Array<{ path: string; hash: string }>> => {
|
|
304
|
+
try {
|
|
305
|
+
const info = await lstat(root);
|
|
306
|
+
if (info.isSymbolicLink() || !info.isDirectory()) {
|
|
307
|
+
throw new Error(`behavior-affecting Claude source must be a real directory: ${root}`);
|
|
308
|
+
}
|
|
309
|
+
} catch (error) {
|
|
310
|
+
if ((error as NodeJS.ErrnoException).code === "ENOENT") return [];
|
|
311
|
+
throw error;
|
|
312
|
+
}
|
|
313
|
+
const paths = await walkAuthoredFiles(root);
|
|
314
|
+
if (paths.length > 5_000) {
|
|
315
|
+
throw new Error(`behavior-affecting Claude source '${label}' exceeds 5000 files`);
|
|
316
|
+
}
|
|
317
|
+
let bytes = 0;
|
|
318
|
+
const hashes: Array<{ path: string; hash: string }> = [];
|
|
319
|
+
for (const path of paths) {
|
|
320
|
+
const content = await readFile(join(root, path));
|
|
321
|
+
bytes += content.length;
|
|
322
|
+
if (bytes > 256 * 1024 * 1024) {
|
|
323
|
+
throw new Error(`behavior-affecting Claude source '${label}' exceeds 256 MiB`);
|
|
324
|
+
}
|
|
325
|
+
hashes.push({ path: `${label}/${path}`, hash: contentHash(content) });
|
|
326
|
+
}
|
|
327
|
+
return hashes;
|
|
328
|
+
};
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* Hash every intentionally loaded user behavior source without persisting its
|
|
332
|
+
* contents. This covers user instructions/rules/output styles and the exact
|
|
333
|
+
* installed contents of plugins enabled by settings.json.
|
|
334
|
+
*/
|
|
335
|
+
export const claudeUserBehaviorHash = async (configRoot: string): Promise<string | null> => {
|
|
336
|
+
const settingsPath = join(configRoot, "settings.json");
|
|
337
|
+
const settingsHash = await optionalRegularFileHash(settingsPath);
|
|
338
|
+
const sources: Array<{ path: string; hash: string }> = [];
|
|
339
|
+
if (settingsHash) sources.push({ path: "settings.json", hash: settingsHash });
|
|
340
|
+
const claudeMdHash = await optionalRegularFileHash(join(configRoot, "CLAUDE.md"));
|
|
341
|
+
if (claudeMdHash) sources.push({ path: "CLAUDE.md", hash: claudeMdHash });
|
|
342
|
+
for (const directory of ["rules", "output-styles", "agents", "commands", "skills"]) {
|
|
343
|
+
sources.push(...(await hashBehaviorDirectory(join(configRoot, directory), directory)));
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
let settings: unknown;
|
|
347
|
+
try {
|
|
348
|
+
const contents = await readFile(settingsPath, "utf8");
|
|
349
|
+
try {
|
|
350
|
+
settings = JSON.parse(contents);
|
|
351
|
+
} catch {
|
|
352
|
+
throw new Error("Claude settings.json contains invalid JSON");
|
|
353
|
+
}
|
|
354
|
+
} catch (error) {
|
|
355
|
+
if ((error as NodeJS.ErrnoException).code === "ENOENT") {
|
|
356
|
+
settings = undefined;
|
|
357
|
+
} else {
|
|
358
|
+
throw error;
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
const parsedSettings = ClaudeSettingsFileSchema.safeParse(settings);
|
|
362
|
+
if (settings !== undefined && !parsedSettings.success) {
|
|
363
|
+
throw new Error("Claude settings.json has an invalid enabledPlugins map");
|
|
364
|
+
}
|
|
365
|
+
const enabledPlugins = parsedSettings.success ? parsedSettings.data.enabledPlugins : undefined;
|
|
366
|
+
const enabledIds = Object.entries(enabledPlugins ?? {})
|
|
367
|
+
.filter(([, value]) => value === true)
|
|
368
|
+
.map(([id]) => id)
|
|
369
|
+
.sort();
|
|
370
|
+
if (enabledIds.length > 0) {
|
|
371
|
+
const installedPath = join(configRoot, "plugins", "installed_plugins.json");
|
|
372
|
+
const installedHash = await optionalRegularFileHash(installedPath);
|
|
373
|
+
if (installedHash) {
|
|
374
|
+
sources.push({ path: "plugins/installed_plugins.json", hash: installedHash });
|
|
375
|
+
}
|
|
376
|
+
let installed: unknown;
|
|
377
|
+
try {
|
|
378
|
+
installed = JSON.parse(await readFile(installedPath, "utf8"));
|
|
379
|
+
} catch {
|
|
380
|
+
installed = undefined;
|
|
381
|
+
}
|
|
382
|
+
const parsedInstalled = ClaudeInstalledPluginsFileSchema.safeParse(installed);
|
|
383
|
+
if (!parsedInstalled.success) {
|
|
384
|
+
throw new Error("enabled Claude plugins have invalid installed metadata");
|
|
385
|
+
}
|
|
386
|
+
const plugins = parsedInstalled.data.plugins;
|
|
387
|
+
for (const id of enabledIds) {
|
|
388
|
+
const records = plugins[id];
|
|
389
|
+
if (!records || records.length === 0) {
|
|
390
|
+
throw new Error(`enabled Claude plugin '${id}' has no installed content to hash`);
|
|
391
|
+
}
|
|
392
|
+
for (const [index, record] of records.entries()) {
|
|
393
|
+
const installPath = record.installPath;
|
|
394
|
+
sources.push(
|
|
395
|
+
...(await hashBehaviorDirectory(resolve(installPath), `plugins/enabled/${id}/${index}`)),
|
|
396
|
+
);
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
return sources.length === 0 ? null : valueHash(sources);
|
|
401
|
+
};
|
|
402
|
+
|
|
403
|
+
export const configuredClaudeSourceHashes = async (
|
|
404
|
+
driver: unknown,
|
|
405
|
+
baseRoot: string,
|
|
406
|
+
cache: Map<string, Promise<string>> = new Map(),
|
|
407
|
+
): Promise<Array<{ kind: "plugin" | "read"; path: string; hash: string }>> => {
|
|
408
|
+
const driverCli = referencedCli(driver);
|
|
409
|
+
if (!driverCli) return [];
|
|
410
|
+
const config = driverConfigRecord(driver);
|
|
411
|
+
// This also rejects path-bearing extraArgs that would evade the source
|
|
412
|
+
// hashes below. Runtime applies the same guard before driver creation.
|
|
413
|
+
boundExperimentDriverConfig(driverCli.name, config, "identity-check");
|
|
414
|
+
const isolation =
|
|
415
|
+
config.isolation && typeof config.isolation === "object"
|
|
416
|
+
? (config.isolation as Record<string, unknown>)
|
|
417
|
+
: undefined;
|
|
418
|
+
const configured = [
|
|
419
|
+
...(driverCli.name === "claude-code" && Array.isArray(config.pluginDirs)
|
|
420
|
+
? config.pluginDirs.map((path) => ({ kind: "plugin" as const, path }))
|
|
421
|
+
: []),
|
|
422
|
+
...(Array.isArray(config.addDirs)
|
|
423
|
+
? config.addDirs.map((path) => ({ kind: "read" as const, path }))
|
|
424
|
+
: []),
|
|
425
|
+
...(driverCli.name === "claude-code" && isolation && Array.isArray(isolation.allowRead)
|
|
426
|
+
? isolation.allowRead.map((path) => ({ kind: "read" as const, path }))
|
|
427
|
+
: []),
|
|
428
|
+
].filter(
|
|
429
|
+
(entry): entry is { kind: "plugin" | "read"; path: string } =>
|
|
430
|
+
typeof entry.path === "string" && entry.path.length > 0,
|
|
431
|
+
);
|
|
432
|
+
return Promise.all(
|
|
433
|
+
configured
|
|
434
|
+
.sort((a, b) => `${a.kind}:${a.path}`.localeCompare(`${b.kind}:${b.path}`))
|
|
435
|
+
.map(async ({ kind, path }) => {
|
|
436
|
+
const absolute = resolve(baseRoot, path);
|
|
437
|
+
const key = `${kind}:${absolute}`;
|
|
438
|
+
let hash = cache.get(key);
|
|
439
|
+
if (!hash) {
|
|
440
|
+
hash = hashBehaviorDirectory(
|
|
441
|
+
absolute,
|
|
442
|
+
`driver/${kind}/${contentHash(absolute).slice(0, 12)}`,
|
|
443
|
+
).then(valueHash);
|
|
444
|
+
cache.set(key, hash);
|
|
445
|
+
}
|
|
446
|
+
return {
|
|
447
|
+
kind,
|
|
448
|
+
path: absolute,
|
|
449
|
+
hash: await hash,
|
|
450
|
+
};
|
|
451
|
+
}),
|
|
452
|
+
);
|
|
453
|
+
};
|
|
454
|
+
|
|
455
|
+
export const runtimeCliIdentityHashForReferences = async (
|
|
456
|
+
references: readonly RuntimeCliReference[],
|
|
457
|
+
): Promise<string> =>
|
|
458
|
+
valueHash(
|
|
459
|
+
await Promise.all(
|
|
460
|
+
references.map(async (reference) => ({
|
|
461
|
+
...reference,
|
|
462
|
+
identity: await cliIdentity(reference.command, reference.baseRoot),
|
|
463
|
+
})),
|
|
464
|
+
),
|
|
465
|
+
);
|