niceeval 0.17.1 → 0.19.0
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/INDEX.md +5 -2
- package/dist/adapter-usage.cjs.map +1 -1
- package/dist/adapter-usage.d.cts +1 -1
- package/dist/adapter-usage.d.mts +1 -1
- package/dist/adapter-usage.d.ts +1 -1
- package/dist/adapter.cjs +8 -3
- package/dist/adapter.cjs.map +1 -1
- package/dist/adapter.d.cts +26 -15
- package/dist/adapter.d.mts +26 -15
- package/dist/adapter.d.ts +26 -15
- package/dist/agents/{effect-runtime.cjs → agent-effects.cjs} +12 -18
- package/dist/agents/agent-effects.cjs.map +1 -0
- package/dist/agents/agent-effects.d.cts +23 -0
- package/dist/agents/agent-effects.d.mts +23 -0
- package/dist/agents/agent-effects.d.ts +23 -0
- package/dist/agents/agent-effects.js +16 -0
- package/dist/agents/agent-effects.js.map +1 -0
- package/dist/agents/ai-sdk.cjs +1 -1
- package/dist/agents/ai-sdk.cjs.map +1 -1
- package/dist/agents/bub.cjs +31 -18
- package/dist/agents/bub.cjs.map +1 -1
- package/dist/agents/bub.d.cts +9 -12
- package/dist/agents/bub.d.mts +9 -12
- package/dist/agents/bub.d.ts +9 -12
- package/dist/agents/claude-code-native.cjs +2 -2
- package/dist/agents/claude-code-native.cjs.map +1 -1
- package/dist/agents/claude-code.cjs +17 -11
- package/dist/agents/claude-code.cjs.map +1 -1
- package/dist/agents/claude-code.d.cts +11 -11
- package/dist/agents/claude-code.d.mts +11 -11
- package/dist/agents/claude-code.d.ts +11 -11
- package/dist/agents/codex-app-server.cjs +2 -2
- package/dist/agents/codex-app-server.cjs.map +1 -1
- package/dist/agents/codex.cjs +18 -12
- package/dist/agents/codex.cjs.map +1 -1
- package/dist/agents/codex.d.cts +12 -12
- package/dist/agents/codex.d.mts +12 -12
- package/dist/agents/codex.d.ts +12 -12
- package/dist/agents/deepseek-harness.cjs +2 -2
- package/dist/agents/deepseek-harness.cjs.map +1 -1
- package/dist/agents/hermes.cjs +3 -3
- package/dist/agents/hermes.cjs.map +1 -1
- package/dist/agents/index.cjs +3 -3
- package/dist/agents/index.cjs.map +1 -1
- package/dist/agents/index.d.cts +3 -3
- package/dist/agents/index.d.mts +3 -3
- package/dist/agents/index.d.ts +3 -3
- package/dist/agents/index.js +2 -2
- package/dist/agents/index.mjs +2 -2
- package/dist/agents/mcp.cjs.map +1 -1
- package/dist/agents/mcp.d.cts +2 -2
- package/dist/agents/mcp.d.mts +2 -2
- package/dist/agents/mcp.d.ts +2 -2
- package/dist/agents/omp.cjs +2 -2
- package/dist/agents/omp.cjs.map +1 -1
- package/dist/agents/openai-compat.cjs +2 -2
- package/dist/agents/openai-compat.cjs.map +1 -1
- package/dist/agents/openclaw.cjs +3 -3
- package/dist/agents/openclaw.cjs.map +1 -1
- package/dist/agents/opencode.cjs +16 -4
- package/dist/agents/opencode.cjs.map +1 -1
- package/dist/agents/plugin-extensions.cjs +71 -0
- package/dist/agents/plugin-extensions.cjs.map +1 -0
- package/dist/agents/plugin-extensions.d.cts +26 -0
- package/dist/agents/plugin-extensions.d.mts +26 -0
- package/dist/agents/plugin-extensions.d.ts +26 -0
- package/dist/agents/plugin-extensions.js +8 -0
- package/dist/agents/plugin-extensions.js.map +1 -0
- package/dist/agents/post-setup.cjs +14 -3
- package/dist/agents/post-setup.cjs.map +1 -1
- package/dist/agents/post-setup.d.cts +4 -2
- package/dist/agents/post-setup.d.mts +4 -2
- package/dist/agents/post-setup.d.ts +4 -2
- package/dist/agents/post-setup.js +8 -6
- package/dist/agents/sdk-streams.cjs +3 -3
- package/dist/agents/sdk-streams.cjs.map +1 -1
- package/dist/agents/{session-slot.cjs → session-key.cjs} +4 -4
- package/dist/agents/session-key.cjs.map +1 -0
- package/dist/agents/session-key.d.cts +12 -0
- package/dist/agents/session-key.d.mts +12 -0
- package/dist/agents/session-key.d.ts +12 -0
- package/dist/agents/session-key.js +6 -0
- package/dist/agents/session-key.js.map +1 -0
- package/dist/agents/shared.cjs +2 -2
- package/dist/agents/shared.cjs.map +1 -1
- package/dist/agents/shared.d.cts +4 -4
- package/dist/agents/shared.d.mts +4 -4
- package/dist/agents/shared.d.ts +4 -4
- package/dist/agents/skills.cjs.map +1 -1
- package/dist/agents/skills.d.cts +3 -3
- package/dist/agents/skills.d.mts +3 -3
- package/dist/agents/skills.d.ts +3 -3
- package/dist/agents/types.cjs.map +1 -1
- package/dist/agents/types.d.cts +55 -54
- package/dist/agents/types.d.mts +55 -54
- package/dist/agents/types.d.ts +55 -54
- package/dist/agents/ui-message-stream.cjs +4 -4
- package/dist/agents/ui-message-stream.cjs.map +1 -1
- package/dist/agents/unrecognized-events.cjs +32 -0
- package/dist/agents/unrecognized-events.cjs.map +1 -0
- package/dist/agents/unrecognized-events.d.cts +8 -0
- package/dist/agents/unrecognized-events.d.mts +8 -0
- package/dist/agents/unrecognized-events.d.ts +8 -0
- package/dist/agents/unrecognized-events.js +6 -0
- package/dist/agents/unrecognized-events.js.map +1 -0
- package/dist/assertions/api.cjs.map +1 -1
- package/dist/assertions/api.d.cts +3 -0
- package/dist/assertions/api.d.mts +3 -0
- package/dist/assertions/api.d.ts +3 -0
- package/dist/assertions/collection.cjs +1 -1
- package/dist/assertions/collection.cjs.map +1 -1
- package/dist/assertions/judge.cjs +1 -1
- package/dist/assertions/judge.cjs.map +1 -1
- package/dist/assertions/match.cjs +52 -21
- package/dist/assertions/match.cjs.map +1 -1
- package/dist/assertions/match.d.cts +16 -5
- package/dist/assertions/match.d.mts +16 -5
- package/dist/assertions/match.d.ts +16 -5
- package/dist/assertions/match.js +96 -94
- package/dist/assertions/measurements.cjs +61 -0
- package/dist/assertions/measurements.cjs.map +1 -0
- package/dist/assertions/measurements.d.cts +24 -0
- package/dist/assertions/measurements.d.mts +24 -0
- package/dist/assertions/measurements.d.ts +24 -0
- package/dist/assertions/measurements.js +8 -0
- package/dist/assertions/measurements.js.map +1 -0
- package/dist/assertions/numeric.cjs +2 -0
- package/dist/assertions/numeric.cjs.map +1 -1
- package/dist/assertions/numeric.d.cts +1 -1
- package/dist/assertions/numeric.d.mts +1 -1
- package/dist/assertions/numeric.d.ts +1 -1
- package/dist/assertions/quantity.cjs +42 -0
- package/dist/assertions/quantity.cjs.map +1 -0
- package/dist/assertions/quantity.d.cts +18 -0
- package/dist/assertions/quantity.d.mts +18 -0
- package/dist/assertions/quantity.d.ts +18 -0
- package/dist/assertions/quantity.js +22 -0
- package/dist/assertions/quantity.js.map +1 -0
- package/dist/assertions/record/attachment.cjs +2 -0
- package/dist/assertions/record/attachment.cjs.map +1 -1
- package/dist/assertions/record/codec.cjs +5 -1
- package/dist/assertions/record/codec.cjs.map +1 -1
- package/dist/assertions/record/model.cjs.map +1 -1
- package/dist/assertions/record/model.d.cts +3 -1
- package/dist/assertions/record/model.d.mts +3 -1
- package/dist/assertions/record/model.d.ts +3 -1
- package/dist/assertions/runtime.cjs +11 -6
- package/dist/assertions/runtime.cjs.map +1 -1
- package/dist/cli/program.cjs +3 -0
- package/dist/cli/program.cjs.map +1 -1
- package/dist/context/assert-first.cjs +6 -4
- package/dist/context/assert-first.cjs.map +1 -1
- package/dist/context/assert-first.d.cts +9 -3
- package/dist/context/assert-first.d.mts +9 -3
- package/dist/context/assert-first.d.ts +9 -3
- package/dist/context/notes.cjs +47 -0
- package/dist/context/notes.cjs.map +1 -0
- package/dist/context/notes.d.cts +10 -0
- package/dist/context/notes.d.mts +10 -0
- package/dist/context/notes.d.ts +10 -0
- package/dist/context/notes.js +6 -0
- package/dist/context/notes.js.map +1 -0
- package/dist/context/send-failures.cjs +1 -7
- package/dist/context/send-failures.cjs.map +1 -1
- package/dist/context/send-failures.d.cts +2 -3
- package/dist/context/send-failures.d.mts +2 -3
- package/dist/context/send-failures.d.ts +2 -3
- package/dist/context/send-retry.cjs +0 -1
- package/dist/context/send-retry.cjs.map +1 -1
- package/dist/context/send-retry.d.cts +1 -2
- package/dist/context/send-retry.d.mts +1 -2
- package/dist/context/send-retry.d.ts +1 -2
- package/dist/context/session.cjs +10 -17
- package/dist/context/session.cjs.map +1 -1
- package/dist/context/session.d.cts +4 -10
- package/dist/context/session.d.mts +4 -10
- package/dist/context/session.d.ts +4 -10
- package/dist/define.cjs +89 -64
- package/dist/define.cjs.map +1 -1
- package/dist/define.d.cts +3 -3
- package/dist/define.d.mts +3 -3
- package/dist/define.d.ts +3 -3
- package/dist/eval/cli/contribution.cjs +1 -1
- package/dist/eval/cli/contribution.cjs.map +1 -1
- package/dist/eval/host/index.cjs +1 -1
- package/dist/eval/host/index.cjs.map +1 -1
- package/dist/eval/record/evaluation.cjs +1 -1
- package/dist/eval/record/evaluation.cjs.map +1 -1
- package/dist/eval/record/membership-provenance.d.cts +3 -3
- package/dist/eval/record/membership-provenance.d.mts +3 -3
- package/dist/eval/record/membership-provenance.d.ts +3 -3
- package/dist/eval/record/score.cjs +2 -2
- package/dist/eval/record/score.cjs.map +1 -1
- package/dist/eval/record/sealed-assertion.cjs +1 -1
- package/dist/eval/record/sealed-assertion.cjs.map +1 -1
- package/dist/eval/record/verdict.cjs +2 -2
- package/dist/eval/record/verdict.cjs.map +1 -1
- package/dist/expect/index.cjs +13 -1
- package/dist/expect/index.cjs.map +1 -1
- package/dist/expect/index.d.cts +5 -1
- package/dist/expect/index.d.mts +5 -1
- package/dist/expect/index.d.ts +5 -1
- package/dist/expect/index.js +92 -72
- package/dist/expect/index.mjs +92 -72
- package/dist/experiment/host/cli/contribution.cjs +52 -39
- package/dist/experiment/host/cli/contribution.cjs.map +1 -1
- package/dist/experiment/host/cli/contribution.d.cts +18 -4
- package/dist/experiment/host/cli/contribution.d.mts +18 -4
- package/dist/experiment/host/cli/contribution.d.ts +18 -4
- package/dist/experiment/host/cli/contribution.js +2 -2
- package/dist/experiment/host/cli/debug-protocol.cjs +2 -2
- package/dist/experiment/host/cli/debug-protocol.cjs.map +1 -1
- package/dist/experiment/host/cli/debug-protocol.d.cts +2 -2
- package/dist/experiment/host/cli/debug-protocol.d.mts +2 -2
- package/dist/experiment/host/cli/debug-protocol.d.ts +2 -2
- package/dist/experiment/host/cli/output-protocol.cjs +1 -1
- package/dist/experiment/host/cli/output-protocol.cjs.map +1 -1
- package/dist/experiment/host/cli/output-protocol.d.cts +2 -2
- package/dist/experiment/host/cli/output-protocol.d.mts +2 -2
- package/dist/experiment/host/cli/output-protocol.d.ts +2 -2
- package/dist/experiment/host/current.cjs +2 -2
- package/dist/experiment/host/current.cjs.map +1 -1
- package/dist/experiment/host/index.cjs +1 -1
- package/dist/experiment/host/index.cjs.map +1 -1
- package/dist/experiment/host/operations.cjs +24 -23
- package/dist/experiment/host/operations.cjs.map +1 -1
- package/dist/experiment/host/runtime.cjs +11 -10
- package/dist/experiment/host/runtime.cjs.map +1 -1
- package/dist/experiment/host/runtime.d.cts +3 -3
- package/dist/experiment/host/runtime.d.mts +3 -3
- package/dist/experiment/host/runtime.d.ts +3 -3
- package/dist/experiment/host/teardown.cjs +4 -3
- package/dist/experiment/host/teardown.cjs.map +1 -1
- package/dist/experiment/host/teardown.d.cts +3 -3
- package/dist/experiment/host/teardown.d.mts +3 -3
- package/dist/experiment/host/teardown.d.ts +3 -3
- package/dist/experiment/host/types.cjs.map +1 -1
- package/dist/experiment/host/types.d.cts +19 -19
- package/dist/experiment/host/types.d.mts +19 -19
- package/dist/experiment/host/types.d.ts +19 -19
- package/dist/index.cjs +3 -19
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -8
- package/dist/index.d.mts +4 -8
- package/dist/index.d.ts +4 -8
- package/dist/index.js +12 -34
- package/dist/index.mjs +12 -34
- package/dist/inspection/assertions.cjs +1 -1
- package/dist/inspection/assertions.cjs.map +1 -1
- package/dist/inspection/cli/contribution.cjs +8 -7
- package/dist/inspection/cli/contribution.cjs.map +1 -1
- package/dist/inspection/facts.cjs +4 -4
- package/dist/inspection/facts.cjs.map +1 -1
- package/dist/inspection/index.cjs +1 -5
- package/dist/inspection/index.cjs.map +1 -1
- package/dist/inspection/index.d.cts +1 -2
- package/dist/inspection/index.d.mts +1 -2
- package/dist/inspection/index.d.ts +1 -2
- package/dist/inspection/index.js +20 -26
- package/dist/inspection/lifecycle.cjs +7 -0
- package/dist/inspection/lifecycle.cjs.map +1 -0
- package/dist/inspection/lifecycle.d.cts +4 -0
- package/dist/inspection/lifecycle.d.mts +4 -0
- package/dist/inspection/lifecycle.d.ts +4 -0
- package/dist/inspection/lifecycle.js +6 -0
- package/dist/inspection/lifecycle.js.map +1 -0
- package/dist/inspection/notes.cjs +40 -0
- package/dist/inspection/notes.cjs.map +1 -0
- package/dist/inspection/notes.d.cts +12 -0
- package/dist/inspection/notes.d.mts +12 -0
- package/dist/inspection/notes.d.ts +12 -0
- package/dist/inspection/notes.js +8 -0
- package/dist/inspection/notes.js.map +1 -0
- package/dist/inspection/overview.cjs +12 -15
- package/dist/inspection/overview.cjs.map +1 -1
- package/dist/inspection/overview.d.cts +8 -6
- package/dist/inspection/overview.d.mts +8 -6
- package/dist/inspection/overview.d.ts +8 -6
- package/dist/inspection/planned-attempt.cjs +45 -0
- package/dist/inspection/planned-attempt.cjs.map +1 -0
- package/dist/inspection/planned-attempt.d.cts +109 -0
- package/dist/inspection/planned-attempt.d.mts +109 -0
- package/dist/inspection/planned-attempt.d.ts +109 -0
- package/dist/inspection/planned-attempt.js +24 -0
- package/dist/inspection/planned-attempt.js.map +1 -0
- package/dist/inspection/project-result.cjs +5 -5
- package/dist/inspection/project-result.cjs.map +1 -1
- package/dist/inspection/project-result.d.cts +58 -57
- package/dist/inspection/project-result.d.mts +58 -57
- package/dist/inspection/project-result.d.ts +58 -57
- package/dist/inspection/project-result.js +4 -4
- package/dist/inspection/project.cjs +3 -3
- package/dist/inspection/project.cjs.map +1 -1
- package/dist/inspection/protocol-values.cjs +1 -1
- package/dist/inspection/protocol-values.cjs.map +1 -1
- package/dist/inspection/protocol-values.d.cts +1 -1
- package/dist/inspection/protocol-values.d.mts +1 -1
- package/dist/inspection/protocol-values.d.ts +1 -1
- package/dist/inspection/protocol.cjs +8 -8
- package/dist/inspection/protocol.cjs.map +1 -1
- package/dist/inspection/protocol.d.cts +237 -219
- package/dist/inspection/protocol.d.mts +237 -219
- package/dist/inspection/protocol.d.ts +237 -219
- package/dist/inspection/public.cjs +1 -5
- package/dist/inspection/public.cjs.map +1 -1
- package/dist/inspection/public.d.cts +1 -2
- package/dist/inspection/public.d.mts +1 -2
- package/dist/inspection/public.d.ts +1 -2
- package/dist/inspection/public.js +14 -20
- package/dist/inspection/public.mjs +166 -129
- package/dist/inspection/query.cjs +1 -1
- package/dist/inspection/query.cjs.map +1 -1
- package/dist/inspection/results.cjs +61 -52
- package/dist/inspection/results.cjs.map +1 -1
- package/dist/inspection/results.d.cts +157 -140
- package/dist/inspection/results.d.mts +157 -140
- package/dist/inspection/results.d.ts +157 -140
- package/dist/inspection/select.cjs +33 -28
- package/dist/inspection/select.cjs.map +1 -1
- package/dist/inspection/source.cjs +1 -1
- package/dist/inspection/source.cjs.map +1 -1
- package/dist/inspection/sources.cjs +2 -2
- package/dist/inspection/sources.cjs.map +1 -1
- package/dist/inspection/trace.cjs +9 -8
- package/dist/inspection/trace.cjs.map +1 -1
- package/dist/inspection/trace.d.cts +4 -4
- package/dist/inspection/trace.d.mts +4 -4
- package/dist/inspection/trace.d.ts +4 -4
- package/dist/loaders/index.cjs +7 -279
- package/dist/loaders/index.cjs.map +1 -1
- package/dist/loaders/index.d.cts +2 -95
- package/dist/loaders/index.d.mts +2 -95
- package/dist/loaders/index.d.ts +2 -95
- package/dist/loaders/index.js +10 -12
- package/dist/loaders/index.mjs +10 -12
- package/dist/loaders/runtime.cjs +283 -0
- package/dist/loaders/runtime.cjs.map +1 -0
- package/dist/loaders/runtime.d.cts +95 -0
- package/dist/loaders/runtime.d.mts +95 -0
- package/dist/loaders/runtime.d.ts +95 -0
- package/dist/loaders/runtime.js +16 -0
- package/dist/loaders/runtime.js.map +1 -0
- package/dist/migrations/judge-provider.md +6 -6
- package/dist/{model-slots.cjs → model-roles.cjs} +26 -7
- package/dist/model-roles.cjs.map +1 -0
- package/dist/model-roles.d.cts +26 -0
- package/dist/model-roles.d.mts +26 -0
- package/dist/model-roles.d.ts +26 -0
- package/dist/model-roles.js +14 -0
- package/dist/model-roles.js.map +1 -0
- package/dist/o11y/adapter-usage-projection.cjs +9 -8
- package/dist/o11y/adapter-usage-projection.cjs.map +1 -1
- package/dist/o11y/adapter-usage-projection.d.cts +23 -15
- package/dist/o11y/adapter-usage-projection.d.mts +23 -15
- package/dist/o11y/adapter-usage-projection.d.ts +23 -15
- package/dist/o11y/cache-read.cjs +14 -14
- package/dist/o11y/cache-read.cjs.map +1 -1
- package/dist/o11y/cache-read.d.cts +5 -5
- package/dist/o11y/cache-read.d.mts +5 -5
- package/dist/o11y/cache-read.d.ts +5 -5
- package/dist/o11y/derive.cjs.map +1 -1
- package/dist/o11y/derive.d.cts +2 -2
- package/dist/o11y/derive.d.mts +2 -2
- package/dist/o11y/derive.d.ts +2 -2
- package/dist/o11y/eval-usage.cjs +9 -9
- package/dist/o11y/eval-usage.cjs.map +1 -1
- package/dist/o11y/eval-usage.d.cts +7 -7
- package/dist/o11y/eval-usage.d.mts +7 -7
- package/dist/o11y/eval-usage.d.ts +7 -7
- package/dist/o11y/parsers/bub.cjs +57 -81
- package/dist/o11y/parsers/bub.cjs.map +1 -1
- package/dist/o11y/parsers/index.cjs.map +1 -1
- package/dist/o11y/parsers/index.d.cts +2 -0
- package/dist/o11y/parsers/index.d.mts +2 -0
- package/dist/o11y/parsers/index.d.ts +2 -0
- package/dist/o11y/parsers/opencode.cjs +129 -217
- package/dist/o11y/parsers/opencode.cjs.map +1 -1
- package/dist/o11y/parsers/opencode.d.cts +2 -5
- package/dist/o11y/parsers/opencode.d.mts +2 -5
- package/dist/o11y/parsers/opencode.d.ts +2 -5
- package/dist/o11y/types.cjs.map +1 -1
- package/dist/o11y/types.d.cts +1 -1
- package/dist/o11y/types.d.mts +1 -1
- package/dist/o11y/types.d.ts +1 -1
- package/dist/plugin/contracts.cjs +170 -120
- package/dist/plugin/contracts.cjs.map +1 -1
- package/dist/plugin/contracts.d.cts +102 -90
- package/dist/plugin/contracts.d.mts +102 -90
- package/dist/plugin/contracts.d.ts +102 -90
- package/dist/plugin/contracts.js +16 -12
- package/dist/plugin/index.cjs.map +1 -1
- package/dist/plugin/index.d.cts +1 -1
- package/dist/plugin/index.d.mts +1 -1
- package/dist/plugin/index.d.ts +1 -1
- package/dist/plugin/link.cjs +69 -64
- package/dist/plugin/link.cjs.map +1 -1
- package/dist/plugin/link.d.cts +5 -3
- package/dist/plugin/link.d.mts +5 -3
- package/dist/plugin/link.d.ts +5 -3
- package/dist/plugin/link.js +12 -8
- package/dist/record/codec/seal-manifest.d.cts +3 -3
- package/dist/record/codec/seal-manifest.d.mts +3 -3
- package/dist/record/codec/seal-manifest.d.ts +3 -3
- package/dist/record/family/attempt-note/definition.cjs +12 -0
- package/dist/record/family/attempt-note/definition.cjs.map +1 -0
- package/dist/record/family/attempt-note/definition.d.cts +6 -0
- package/dist/record/family/attempt-note/definition.d.mts +6 -0
- package/dist/record/family/attempt-note/definition.d.ts +6 -0
- package/dist/record/family/attempt-note/definition.js +6 -0
- package/dist/record/family/attempt-note/definition.js.map +1 -0
- package/dist/record/family/attempt-note/persistence.cjs +10 -0
- package/dist/record/family/attempt-note/persistence.cjs.map +1 -0
- package/dist/record/family/attempt-note/persistence.d.cts +6 -0
- package/dist/record/family/attempt-note/persistence.d.mts +6 -0
- package/dist/record/family/attempt-note/persistence.d.ts +6 -0
- package/dist/record/family/attempt-note/persistence.js +6 -0
- package/dist/record/family/attempt-note/persistence.js.map +1 -0
- package/dist/record/family/attempt-note/schema.cjs +20 -0
- package/dist/record/family/attempt-note/schema.cjs.map +1 -0
- package/dist/record/family/attempt-note/schema.d.cts +21 -0
- package/dist/record/family/attempt-note/schema.d.mts +21 -0
- package/dist/record/family/attempt-note/schema.d.ts +21 -0
- package/dist/record/family/attempt-note/schema.js +10 -0
- package/dist/record/family/attempt-note/schema.js.map +1 -0
- package/dist/record/family/catalog.cjs +32 -29
- package/dist/record/family/catalog.cjs.map +1 -1
- package/dist/record/family/catalog.d.cts +7 -2
- package/dist/record/family/catalog.d.mts +7 -2
- package/dist/record/family/catalog.d.ts +7 -2
- package/dist/record/family/current.cjs +48 -45
- package/dist/record/family/current.cjs.map +1 -1
- package/dist/record/family/current.d.cts +15 -0
- package/dist/record/family/current.d.mts +15 -0
- package/dist/record/family/current.d.ts +15 -0
- package/dist/record/model/index.js +66 -64
- package/dist/record/model/run-context.cjs +9 -3
- package/dist/record/model/run-context.cjs.map +1 -1
- package/dist/record/model/run-context.d.cts +9 -2
- package/dist/record/model/run-context.d.mts +9 -2
- package/dist/record/model/run-context.d.ts +9 -2
- package/dist/record/model/run-context.js +8 -6
- package/dist/record/model/seal-manifest.d.cts +1 -1
- package/dist/record/model/seal-manifest.d.mts +1 -1
- package/dist/record/model/seal-manifest.d.ts +1 -1
- package/dist/run/cli/contribution.cjs +6 -32
- package/dist/run/cli/contribution.cjs.map +1 -1
- package/dist/run/host/runtime.cjs +1 -1
- package/dist/run/host/runtime.cjs.map +1 -1
- package/dist/run/storage/sqlite.cjs +7 -7
- package/dist/run/storage/sqlite.cjs.map +1 -1
- package/dist/runner/adapter-usage.cjs +5 -3
- package/dist/runner/adapter-usage.cjs.map +1 -1
- package/dist/runner/adapter-usage.d.cts +2 -2
- package/dist/runner/adapter-usage.d.mts +2 -2
- package/dist/runner/adapter-usage.d.ts +2 -2
- package/dist/runner/adoption.cjs +10 -12
- package/dist/runner/adoption.cjs.map +1 -1
- package/dist/runner/attempt-notes.cjs +8 -0
- package/dist/runner/attempt-notes.cjs.map +1 -0
- package/dist/runner/attempt-notes.d.cts +4 -0
- package/dist/runner/attempt-notes.d.mts +4 -0
- package/dist/runner/attempt-notes.d.ts +4 -0
- package/dist/runner/attempt-notes.js +8 -0
- package/dist/runner/attempt-notes.js.map +1 -0
- package/dist/runner/attempt.cjs +61 -73
- package/dist/runner/attempt.cjs.map +1 -1
- package/dist/runner/attempt.d.cts +3 -3
- package/dist/runner/attempt.d.mts +3 -3
- package/dist/runner/attempt.d.ts +3 -3
- package/dist/runner/command-plan.cjs +21 -26
- package/dist/runner/command-plan.cjs.map +1 -1
- package/dist/runner/command-plan.d.cts +4 -4
- package/dist/runner/command-plan.d.mts +4 -4
- package/dist/runner/command-plan.d.ts +4 -4
- package/dist/runner/command-plan.js +4 -4
- package/dist/runner/config-identity.cjs.map +1 -1
- package/dist/runner/config-identity.d.cts +2 -2
- package/dist/runner/config-identity.d.mts +2 -2
- package/dist/runner/config-identity.d.ts +2 -2
- package/dist/runner/discover.cjs +6 -6
- package/dist/runner/discover.cjs.map +1 -1
- package/dist/runner/eval-selection.cjs +15 -1
- package/dist/runner/eval-selection.cjs.map +1 -1
- package/dist/runner/eval-selection.d.cts +4 -0
- package/dist/runner/eval-selection.d.mts +4 -0
- package/dist/runner/eval-selection.d.ts +4 -0
- package/dist/runner/feedback/human.cjs +1 -1
- package/dist/runner/feedback/human.cjs.map +1 -1
- package/dist/runner/feedback/json.cjs +4 -2
- package/dist/runner/feedback/json.cjs.map +1 -1
- package/dist/runner/feedback/json.d.cts +1 -1
- package/dist/runner/feedback/json.d.mts +1 -1
- package/dist/runner/feedback/json.d.ts +1 -1
- package/dist/runner/feedback/sink.cjs +1 -1
- package/dist/runner/feedback/sink.cjs.map +1 -1
- package/dist/runner/feedback/sink.d.cts +1 -1
- package/dist/runner/feedback/sink.d.mts +1 -1
- package/dist/runner/feedback/sink.d.ts +1 -1
- package/dist/runner/fingerprint.cjs +1 -1
- package/dist/runner/fingerprint.cjs.map +1 -1
- package/dist/runner/lock.cjs +1 -3
- package/dist/runner/lock.cjs.map +1 -1
- package/dist/runner/lock.d.cts +0 -2
- package/dist/runner/lock.d.mts +0 -2
- package/dist/runner/lock.d.ts +0 -2
- package/dist/runner/lock.js +14 -16
- package/dist/runner/project-target.cjs.map +1 -1
- package/dist/runner/project-target.d.cts +2 -2
- package/dist/runner/project-target.d.mts +2 -2
- package/dist/runner/project-target.d.ts +2 -2
- package/dist/runner/record/attachments.cjs +2 -2
- package/dist/runner/record/attachments.cjs.map +1 -1
- package/dist/runner/record/planning.cjs +8 -2
- package/dist/runner/record/planning.cjs.map +1 -1
- package/dist/runner/record.cjs +2 -0
- package/dist/runner/record.cjs.map +1 -1
- package/dist/runner/report.cjs +3 -3
- package/dist/runner/report.cjs.map +1 -1
- package/dist/runner/report.d.cts +1 -1
- package/dist/runner/report.d.mts +1 -1
- package/dist/runner/report.d.ts +1 -1
- package/dist/runner/reuse-plan.cjs +2 -2
- package/dist/runner/reuse-plan.cjs.map +1 -1
- package/dist/runner/run.cjs +10 -45
- package/dist/runner/run.cjs.map +1 -1
- package/dist/runner/sandbox-pool.cjs +1 -2
- package/dist/runner/sandbox-pool.cjs.map +1 -1
- package/dist/runner/setup-prefix-preparation.cjs +1 -1
- package/dist/runner/setup-prefix-preparation.cjs.map +1 -1
- package/dist/runner/teardown-registry.cjs +2 -2
- package/dist/runner/teardown-registry.cjs.map +1 -1
- package/dist/runner/teardown-registry.d.cts +1 -1
- package/dist/runner/teardown-registry.d.mts +1 -1
- package/dist/runner/teardown-registry.d.ts +1 -1
- package/dist/runner/types.cjs +4 -4
- package/dist/runner/types.cjs.map +1 -1
- package/dist/runner/types.d.cts +64 -92
- package/dist/runner/types.d.mts +64 -92
- package/dist/runner/types.d.ts +64 -92
- package/dist/runner/types.js +2 -2
- package/dist/sandbox/action.cjs +1 -1
- package/dist/sandbox/action.cjs.map +1 -1
- package/dist/sandbox/cli/contribution.cjs +17 -14
- package/dist/sandbox/cli/contribution.cjs.map +1 -1
- package/dist/sandbox/cli/contribution.d.cts +1 -1
- package/dist/sandbox/cli/contribution.d.mts +1 -1
- package/dist/sandbox/cli/contribution.d.ts +1 -1
- package/dist/sandbox/commands.cjs +1 -1
- package/dist/sandbox/commands.cjs.map +1 -1
- package/dist/sandbox/commands.d.cts +1 -1
- package/dist/sandbox/commands.d.mts +1 -1
- package/dist/sandbox/commands.d.ts +1 -1
- package/dist/sandbox/compose.cjs +2 -2
- package/dist/sandbox/compose.cjs.map +1 -1
- package/dist/sandbox/docker-profile/registry.cjs +5 -10
- package/dist/sandbox/docker-profile/registry.cjs.map +1 -1
- package/dist/sandbox/docker-profile/registry.d.cts +0 -4
- package/dist/sandbox/docker-profile/registry.d.mts +0 -4
- package/dist/sandbox/docker-profile/registry.d.ts +0 -4
- package/dist/sandbox/docker-profile/registry.js +6 -14
- package/dist/sandbox/docker-profile/runtime.cjs +1 -1
- package/dist/sandbox/docker-profile/runtime.cjs.map +1 -1
- package/dist/sandbox/docker-profile/schema.cjs +12 -16
- package/dist/sandbox/docker-profile/schema.cjs.map +1 -1
- package/dist/sandbox/docker-profile/schema.d.cts +2 -6
- package/dist/sandbox/docker-profile/schema.d.mts +2 -6
- package/dist/sandbox/docker-profile/schema.d.ts +2 -6
- package/dist/sandbox/docker-profile/schema.js +24 -32
- package/dist/sandbox/incus.cjs +2 -2
- package/dist/sandbox/incus.cjs.map +1 -1
- package/dist/sandbox/index.cjs +4 -36
- package/dist/sandbox/index.cjs.map +1 -1
- package/dist/sandbox/index.d.cts +4 -8
- package/dist/sandbox/index.d.mts +4 -8
- package/dist/sandbox/index.d.ts +4 -8
- package/dist/sandbox/index.js +116 -174
- package/dist/sandbox/index.mjs +116 -174
- package/dist/sandbox/layer.cjs +3 -3
- package/dist/sandbox/layer.cjs.map +1 -1
- package/dist/sandbox/link.cjs +5 -0
- package/dist/sandbox/link.cjs.map +1 -1
- package/dist/sandbox/link.d.cts +3 -0
- package/dist/sandbox/link.d.mts +3 -0
- package/dist/sandbox/link.d.ts +3 -0
- package/dist/sandbox/runtime.cjs +9 -4
- package/dist/sandbox/runtime.cjs.map +1 -1
- package/dist/shared/failure-class.cjs +5 -5
- package/dist/shared/failure-class.cjs.map +1 -1
- package/dist/shared/failure-class.d.cts +4 -10
- package/dist/shared/failure-class.d.mts +4 -10
- package/dist/shared/failure-class.d.ts +4 -10
- package/dist/shared/types.cjs.map +1 -1
- package/dist/shared/types.d.cts +1 -1
- package/dist/shared/types.d.mts +1 -1
- package/dist/shared/types.d.ts +1 -1
- package/dist/show/contribution.cjs +17 -2
- package/dist/show/contribution.cjs.map +1 -1
- package/dist/show/contribution.d.cts +14 -0
- package/dist/show/contribution.d.mts +14 -0
- package/dist/show/contribution.d.ts +14 -0
- package/dist/show/model.cjs +8 -5
- package/dist/show/model.cjs.map +1 -1
- package/dist/show/model.d.cts +11 -8
- package/dist/show/model.d.mts +11 -8
- package/dist/show/model.d.ts +11 -8
- package/dist/show/render.cjs +34 -22
- package/dist/show/render.cjs.map +1 -1
- package/dist/sources/projector.cjs +1 -1
- package/dist/sources/projector.cjs.map +1 -1
- package/dist/types.cjs +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +1 -1
- package/dist/types.d.mts +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.js +2 -2
- package/dist/view/app-dist/.vite/manifest.json +2 -2
- package/dist/view/app-dist/assets/{index-B3ijZRph.js → index-CxrOUvHC.js} +17 -17
- package/dist/view/app-dist/assets/{quality-cost-scatter-B--DfJ9s.js → quality-cost-scatter-B6Aiss7x.js} +1 -1
- package/dist/view/app-dist/index.html +1 -1
- package/dist/view/cli/contribution.cjs +1 -1
- package/dist/view/cli/contribution.cjs.map +1 -1
- package/dist/view/function-runtime.mjs +318 -121
- package/dist/view/http-protocol.d.cts +1 -1
- package/dist/view/http-protocol.d.mts +1 -1
- package/dist/view/http-protocol.d.ts +1 -1
- package/dist/view/inspection-host.cjs +2 -2
- package/dist/view/inspection-host.cjs.map +1 -1
- package/dist/view/inspection-host.d.cts +349 -331
- package/dist/view/inspection-host.d.mts +349 -331
- package/dist/view/inspection-host.d.ts +349 -331
- package/docs-site/zh/examples/integrations/ai-sdk-v7.mdx +9 -9
- package/docs-site/zh/examples/integrations/claude-sdk.mdx +8 -8
- package/docs-site/zh/examples/integrations/codex-sdk.mdx +4 -4
- package/docs-site/zh/examples/integrations/langgraph.mdx +6 -6
- package/docs-site/zh/examples/integrations/pi-sdk.mdx +8 -8
- package/docs-site/zh/explanation/adapter.mdx +6 -6
- package/docs-site/zh/explanation/assert.mdx +7 -7
- package/docs-site/zh/explanation/drive.mdx +4 -4
- package/docs-site/zh/explanation/hitl.mdx +2 -2
- package/docs-site/zh/explanation/judge.mdx +3 -3
- package/docs-site/zh/index.mdx +18 -0
- package/docs-site/zh/introduction.mdx +4 -3
- package/docs-site/zh/reference/builtin-agents.mdx +46 -49
- package/docs-site/zh/reference/cli.mdx +16 -14
- package/docs-site/zh/reference/define-agent.mdx +19 -19
- package/docs-site/zh/reference/define-config.mdx +7 -15
- package/docs-site/zh/reference/define-eval.mdx +20 -14
- package/docs-site/zh/reference/define-experiment.mdx +18 -39
- package/docs-site/zh/reference/events.mdx +1 -1
- package/docs-site/zh/reference/expect.mdx +21 -0
- package/docs-site/zh/reference/official-adapters.mdx +12 -5
- package/docs-site/zh/troubleshooting/debugging.mdx +2 -2
- package/docs-site/zh/troubleshooting/recover-after-kill.mdx +1 -1
- package/docs-site/zh/tutorials/agent-onboarding.mdx +2 -2
- package/docs-site/zh/tutorials/authoring.mdx +4 -3
- package/docs-site/zh/tutorials/compare-runs.mdx +1 -1
- package/docs-site/zh/tutorials/concurrency.mdx +8 -8
- package/docs-site/zh/tutorials/configuration.mdx +5 -5
- package/docs-site/zh/tutorials/control-run-cost.mdx +49 -9
- package/docs-site/zh/tutorials/eval-groups.mdx +1 -1
- package/docs-site/zh/tutorials/evaluation-kinds.mdx +5 -5
- package/docs-site/zh/tutorials/experiment-services.mdx +32 -32
- package/docs-site/zh/tutorials/handle-execution-failures.mdx +2 -28
- package/docs-site/zh/tutorials/plugins.mdx +49 -143
- package/docs-site/zh/tutorials/sandbox-agent.mdx +1 -1
- package/docs-site/zh/tutorials/sandbox-reuse.mdx +7 -7
- package/docs-site/zh/tutorials/upgrade-0-18.mdx +64 -0
- package/docs-site/zh/tutorials/upgrade-0-19.mdx +121 -0
- package/docs-site/zh/tutorials/upgrade-0-20.mdx +12 -0
- package/docs-site/zh/tutorials/verify-judge.mdx +4 -3
- package/docs-site/zh/tutorials/viewing-results.mdx +2 -2
- package/docs-site/zh/tutorials/write-experiment.mdx +1 -1
- package/docs-site/zh/tutorials/write-send.mdx +13 -13
- package/package.json +1 -1
- package/dist/agents/effect-runtime.cjs.map +0 -1
- package/dist/agents/effect-runtime.d.cts +0 -29
- package/dist/agents/effect-runtime.d.mts +0 -29
- package/dist/agents/effect-runtime.d.ts +0 -29
- package/dist/agents/effect-runtime.js +0 -16
- package/dist/agents/effect-runtime.js.map +0 -1
- package/dist/agents/session-slot.cjs.map +0 -1
- package/dist/agents/session-slot.d.cts +0 -12
- package/dist/agents/session-slot.d.mts +0 -12
- package/dist/agents/session-slot.d.ts +0 -12
- package/dist/agents/session-slot.js +0 -6
- package/dist/agents/session-slot.js.map +0 -1
- package/dist/model-slots.cjs.map +0 -1
- package/dist/model-slots.d.cts +0 -19
- package/dist/model-slots.d.mts +0 -19
- package/dist/model-slots.d.ts +0 -19
- package/dist/model-slots.js +0 -8
- package/dist/model-slots.js.map +0 -1
|
@@ -8,6 +8,7 @@ exports.previewRunnerRunId = previewRunnerRunId;
|
|
|
8
8
|
exports.targetForRunnerRecordRun = targetForRunnerRecordRun;
|
|
9
9
|
const node_crypto_1 = require("node:crypto");
|
|
10
10
|
const effect_1 = require("effect");
|
|
11
|
+
const contracts_ts_1 = require("../../plugin/contracts.cjs");
|
|
11
12
|
const adapter_ts_1 = require("../../adapter.cjs");
|
|
12
13
|
const execution_identity_ts_1 = require("../execution-identity.cjs");
|
|
13
14
|
const fingerprint_ts_1 = require("../fingerprint.cjs");
|
|
@@ -45,11 +46,16 @@ function runnerRecordUtcMillis(value) {
|
|
|
45
46
|
}))
|
|
46
47
|
: effect_1.Result.succeed(decoded.success);
|
|
47
48
|
}
|
|
48
|
-
function runContextFor(run, experimentId) {
|
|
49
|
+
function runContextFor(run, experimentId, evals) {
|
|
50
|
+
const plugins = [...(run.plugins ?? []), ...(0, eval_selection_ts_1.selectedEvalsForRun)(evals, run).flatMap((evalDef) => [
|
|
51
|
+
...(evalDef.evalGroup?.plugins ?? []), ...evalDef.plugins,
|
|
52
|
+
])].map(contracts_ts_1.pluginInstanceDataOf).map(({ name, key, identity }) => ({ name, key, identity }));
|
|
53
|
+
const uniquePlugins = [...new Map(plugins.map((plugin) => [JSON.stringify(plugin), plugin])).values()];
|
|
49
54
|
const context = (0, run_context_ts_1.canonicalizeRunContext)({
|
|
50
55
|
experimentId,
|
|
51
56
|
execution: {
|
|
52
57
|
adapter: (0, adapter_ts_1.adapterIdentity)(run.adapter),
|
|
58
|
+
...(uniquePlugins.length === 0 ? {} : { plugins: uniquePlugins }),
|
|
53
59
|
...(run.adapter.kind === "custom" ? { models: run.models ?? Object.freeze({}) } : {}),
|
|
54
60
|
model: run.model ?? null,
|
|
55
61
|
reasoningEffort: run.reasoningEffort ?? null,
|
|
@@ -131,7 +137,7 @@ function planRunnerRecordRun(input) {
|
|
|
131
137
|
});
|
|
132
138
|
if (effect_1.Result.isFailure(experimentId))
|
|
133
139
|
return effect_1.Effect.fail(experimentId.failure);
|
|
134
|
-
const context = runContextFor(input.run, experimentId.success);
|
|
140
|
+
const context = runContextFor(input.run, experimentId.success, input.evals);
|
|
135
141
|
if (effect_1.Result.isFailure(context))
|
|
136
142
|
return effect_1.Effect.fail(context.failure);
|
|
137
143
|
const slots = new Map();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"planning.js","sourceRoot":"","sources":["planning.ts"],"names":[],"mappings":";;AA+DA,kDAEC;AAeD,sDASC;AAwCD,4DA0CC;AACD,kDA0EC;AACD,gDAGC;AACD,4DA2BC;AAtRD,6CAAyC;AACzC,mCAAgD;AAChD,iDAAmD;AACnD,oEAA0E;AAC1E,sDAA6C;AAC7C,4DAA2D;AAC3D,8CAAsD;AACtD,qEAA6E;AAC7E,oDAAgL;A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AAG,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,KAAK,QAAQ;mBACxC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,gBAAgB,KAAK,IAAI;gBACtD,CAAC,CAAC,EAAE,gBAAgB,EAAE,oCAA6C,EAAE;gBACrE,CAAC,CAAC,EAAE,CAAC;SACS,CAAC,CAAC,CAAC;KAC5B,CAAC,CAAC;AACP,CAAC","sourcesContent":["import { createHash } from \"node:crypto\";\nimport { Effect, Result, Schema } from \"effect\";\nimport { adapterIdentity } from \"../../adapter.ts\";\nimport { slotExecutionIdentityDigestHex } from \"../execution-identity.ts\";\nimport { cacheKey } from \"../fingerprint.ts\";\nimport { selectedEvalsForRun } from \"../eval-selection.ts\";\nimport { resolveAttemptTimeout } from \"../timeout.ts\";\nimport { EXECUTION_DURATION_DOMAIN } from \"../../eval/record/eligibility.ts\";\nimport { projectTargetPolicyIdentity, type ExecutionDurationLimit, type ExecutionIdentity, type ProjectTargetPolicy, type TargetRun, type TargetSlot, } from \"../reuse-plan.ts\";\nimport type { AgentRun, Config, DiscoveredEval } from \"../types.ts\";\nimport { EvalIdSchema, ExecutionIdentityDigestSchema, ExperimentIdSchema, RunIdSchema, SlotIdSchema, UtcMillisSchema, } from \"../../record/codec/identifiers.ts\";\nimport type { RecordSlotIdentity } from \"../../record/model/core.ts\";\nimport { canonicalizeRunContext, type RunContext, } from \"../../record/model/run-context.ts\";\nimport { experimentHooksForRun } from \"./context.ts\";\nimport type { ExecutionIdentityDigest, ExperimentId, RunId, UtcMillis, } from \"../../record/model/identifiers.ts\";\n/** Current facts supplied by physical planning; Record never reconstructs them from history. */\nexport interface RunnerRecordReuseSlotInput {\n readonly renameFingerprint?: (experimentId: string) => string | undefined;\n readonly inputIdentity: ExecutionIdentity;\n readonly configIdentity: ExecutionIdentity;\n readonly timeout?: ExecutionDurationLimit;\n}\nexport interface RunnerRecordReuseInput {\n readonly policy: ProjectTargetPolicy;\n readonly slotsByKey: ReadonlyMap<string, RunnerRecordReuseSlotInput>;\n}\nexport interface RunnerRecordReusePreparationInput {\n readonly evals: readonly DiscoveredEval[];\n readonly runs: readonly AgentRun[];\n readonly config: Pick<Config, \"timeoutMs\">;\n readonly plannedFingerprints: ReadonlyMap<string, string>;\n readonly renameFingerprintsByKey?: ReadonlyMap<string, (experimentId: string) => string | undefined>;\n readonly plannedConfigHashes: ReadonlyMap<string, string>;\n readonly rerun?: \"failed\" | \"all\";\n readonly keepSandbox?: \"failed\" | \"all\";\n}\nexport interface RunnerRecordTargetInputMissing {\n readonly code: \"runner-record-target-input-missing\";\n readonly key: string;\n}\nexport interface RunnerRecordTargetIdentityInvalid {\n readonly code: \"runner-record-target-identity-invalid\";\n readonly kind: \"invocation\" | \"slot\" | \"experiment\" | \"eval\" | \"digest\" | \"context\";\n readonly value: string;\n}\nexport interface PlannedRunnerRecordSlot {\n readonly evalDef: DiscoveredEval;\n readonly attempt: number;\n readonly slot: RecordSlotIdentity;\n readonly reuse: RunnerRecordReuseSlotInput;\n}\nexport interface PlannedRunnerRecordRun {\n readonly run: AgentRun;\n readonly experimentId: ExperimentId;\n readonly context: RunContext;\n readonly expectedSlots: readonly RecordSlotIdentity[];\n readonly slots: ReadonlyMap<string, PlannedRunnerRecordSlot>;\n readonly slotEntries: readonly PlannedRunnerRecordSlot[];\n}\nconst runnerReuseContract = Object.freeze({\n domain: \"niceeval.reuse/base-v1\",\n value: \"project-target/v1\",\n});\nexport function runnerRecordSlotKey(evalId: string, attempt: number): string {\n return `${evalId}\\u0000${attempt}`;\n}\nfunction decodeId<Id>(input: {\n readonly schema: Schema.Codec<Id, string>;\n readonly value: string;\n readonly kind: RunnerRecordTargetIdentityInvalid[\"kind\"];\n}): Result.Result<Id, RunnerRecordTargetIdentityInvalid> {\n const decoded = Schema.decodeUnknownResult(input.schema)(input.value);\n return Result.isFailure(decoded)\n ? Result.fail(Object.freeze({\n code: \"runner-record-target-identity-invalid\" as const,\n kind: input.kind,\n value: input.value,\n }))\n : Result.succeed(decoded.success);\n}\nexport function runnerRecordUtcMillis(value: number): Result.Result<UtcMillis, RunnerRecordTargetIdentityInvalid> {\n const decoded = Schema.decodeUnknownResult(UtcMillisSchema)(value);\n return Result.isFailure(decoded)\n ? Result.fail(Object.freeze({\n code: \"runner-record-target-identity-invalid\" as const,\n kind: \"invocation\" as const,\n value: String(value),\n }))\n : Result.succeed(decoded.success);\n}\nfunction runContextFor(run: AgentRun, experimentId: ExperimentId): Result.Result<RunContext, RunnerRecordTargetIdentityInvalid> {\n const context = canonicalizeRunContext({\n experimentId,\n execution: {\n adapter: adapterIdentity(run.adapter),\n ...(run.adapter.kind === \"custom\" ? { models: run.models ?? Object.freeze({}) } : {}),\n model: run.model ?? null,\n reasoningEffort: run.reasoningEffort ?? null,\n flags: run.flags,\n experimentHooks: experimentHooksForRun(run),\n },\n labels: run.labels ?? {},\n });\n return Result.isFailure(context)\n ? Result.fail(Object.freeze({\n code: \"runner-record-target-identity-invalid\" as const,\n kind: \"context\" as const,\n value: `invalid Run context for ${run.experimentId}`,\n }))\n : Result.succeed(context.success);\n}\nfunction executionIdentityDigest(input: {\n readonly run: AgentRun;\n readonly eval: DiscoveredEval;\n readonly attempt: number;\n readonly reuse: RunnerRecordReuseSlotInput;\n}): Result.Result<ExecutionIdentityDigest, RunnerRecordTargetIdentityInvalid> {\n const value = slotExecutionIdentityDigestHex({\n experimentId: input.run.experimentId,\n evalId: input.eval.id,\n attempt: input.attempt,\n input: { domain: input.reuse.inputIdentity.domain, value: input.reuse.inputIdentity.value },\n config: { domain: input.reuse.configIdentity.domain, value: input.reuse.configIdentity.value },\n timeout: input.reuse.timeout === undefined\n ? null\n : { domain: input.reuse.timeout.domain, milliseconds: input.reuse.timeout.milliseconds },\n });\n return decodeId({ schema: ExecutionIdentityDigestSchema, value, kind: \"digest\" });\n}\nexport function prepareRunnerRecordReuse(input: RunnerRecordReusePreparationInput): Effect.Effect<RunnerRecordReuseInput, RunnerRecordTargetInputMissing> {\n return Effect.suspend(() => {\n const slotsByKey = new Map<string, RunnerRecordReuseSlotInput>();\n for (const run of input.runs) {\n for (const evalDef of selectedEvalsForRun(input.evals, run)) {\n const key = cacheKey(run, evalDef.id);\n const fingerprint = input.plannedFingerprints.get(key);\n const configHash = input.plannedConfigHashes.get(key);\n if (fingerprint === undefined || configHash === undefined) {\n return Effect.fail({ code: \"runner-record-target-input-missing\" as const, key });\n }\n const timeout = resolveAttemptTimeout(run, evalDef, input.config);\n const renameFingerprint = input.renameFingerprintsByKey?.get(key);\n slotsByKey.set(key, Object.freeze({\n ...(renameFingerprint === undefined ? {} : { renameFingerprint }),\n inputIdentity: Object.freeze({\n domain: \"niceeval.input/fingerprint-v1\",\n value: fingerprint,\n }),\n configIdentity: Object.freeze({\n domain: \"niceeval.config/identity-v1\",\n value: configHash,\n }),\n ...(timeout === undefined ? {} : {\n timeout: Object.freeze({\n domain: EXECUTION_DURATION_DOMAIN,\n milliseconds: timeout.timeoutMs,\n }),\n }),\n }));\n }\n }\n return Effect.succeed(Object.freeze({\n policy: Object.freeze({\n identity: projectTargetPolicyIdentity,\n reuseContract: Object.freeze({ ...runnerReuseContract }),\n rerun: input.rerun ?? \"none\",\n keepSandbox: input.keepSandbox !== undefined,\n }),\n slotsByKey: new Map(slotsByKey),\n }));\n });\n}\nexport function planRunnerRecordRun(input: {\n readonly run: AgentRun;\n readonly evals: readonly DiscoveredEval[];\n readonly reuse: RunnerRecordReuseInput;\n}): Effect.Effect<PlannedRunnerRecordRun, RunnerRecordTargetInputMissing | RunnerRecordTargetIdentityInvalid> {\n return Effect.suspend<PlannedRunnerRecordRun, RunnerRecordTargetInputMissing | RunnerRecordTargetIdentityInvalid, never>(() => {\n const experimentId = decodeId({\n schema: ExperimentIdSchema,\n value: input.run.experimentId,\n kind: \"experiment\",\n });\n if (Result.isFailure(experimentId))\n return Effect.fail(experimentId.failure);\n const context = runContextFor(input.run, experimentId.success);\n if (Result.isFailure(context))\n return Effect.fail(context.failure);\n const slots = new Map<string, PlannedRunnerRecordSlot>();\n const entries: PlannedRunnerRecordSlot[] = [];\n for (const evalDef of selectedEvalsForRun(input.evals, input.run)) {\n const reuse = input.reuse.slotsByKey.get(cacheKey(input.run, evalDef.id));\n if (reuse === undefined) {\n return Effect.fail({\n code: \"runner-record-target-input-missing\" as const,\n key: cacheKey(input.run, evalDef.id),\n });\n }\n const evalId = decodeId({ schema: EvalIdSchema, value: evalDef.id, kind: \"eval\" });\n if (Result.isFailure(evalId))\n return Effect.fail(evalId.failure);\n for (let attempt = 0; attempt < input.run.attempts; attempt += 1) {\n const digest = executionIdentityDigest({ run: input.run, eval: evalDef, attempt, reuse });\n if (Result.isFailure(digest))\n return Effect.fail(digest.failure);\n const slotId = decodeId({\n schema: SlotIdSchema,\n value: `slot-${digest.success}`,\n kind: \"slot\",\n });\n if (Result.isFailure(slotId))\n return Effect.fail(slotId.failure);\n const key = runnerRecordSlotKey(evalDef.id, attempt);\n if (slots.has(key)) {\n return Effect.fail({\n code: \"runner-record-target-identity-invalid\" as const,\n kind: \"slot\" as const,\n value: key,\n });\n }\n const entry = Object.freeze({\n evalDef,\n attempt,\n slot: Object.freeze({\n slotId: slotId.success,\n evalId: evalId.success,\n attemptOrdinal: attempt,\n executionIdentityDigest: digest.success,\n }),\n reuse,\n });\n slots.set(key, entry);\n entries.push(entry);\n }\n }\n return Effect.succeed(Object.freeze({\n run: input.run,\n experimentId: experimentId.success,\n context: context.success,\n expectedSlots: Object.freeze([...entries]\n .map((entry) => entry.slot)\n .sort((left, right) => left.slotId < right.slotId ? -1 : left.slotId > right.slotId ? 1 : 0)),\n slots,\n slotEntries: Object.freeze(entries),\n }));\n });\n}\nexport function previewRunnerRunId(run: AgentRun): Result.Result<RunId, RunnerRecordTargetIdentityInvalid> {\n const hash = createHash(\"sha256\").update(run.experimentId, \"utf8\").digest(\"hex\");\n return decodeId({ schema: RunIdSchema, value: `preview-${hash}`, kind: \"invocation\" });\n}\nexport function targetForRunnerRecordRun(input: {\n readonly planned: PlannedRunnerRecordRun;\n readonly runId: RunId;\n readonly startedAt: UtcMillis;\n}): TargetRun {\n return Object.freeze({\n runId: input.runId,\n experimentId: input.planned.run.experimentId,\n startedAt: input.startedAt,\n slots: Object.freeze(input.planned.slotEntries.map((entry) => Object.freeze({\n runId: input.runId,\n slotId: entry.slot.slotId,\n experimentId: input.planned.run.experimentId,\n evalId: entry.evalDef.id,\n attempt: entry.attempt,\n evaluationKind: entry.evalDef.evaluationKind,\n executionIdentityDigest: entry.slot.executionIdentityDigest,\n inputIdentity: entry.reuse.inputIdentity,\n configIdentity: entry.reuse.configIdentity,\n ...(entry.reuse.renameFingerprint === undefined ? {} : { renameFingerprint: entry.reuse.renameFingerprint }),\n ...(entry.reuse.timeout === undefined ? {} : { timeout: entry.reuse.timeout }),\n ...(input.planned.run.adapter.kind === \"custom\"\n && input.planned.run.adapter.behaviorRevision === null\n ? { reuseEligibility: \"adapter-behavior-revision-required\" as const }\n : {}),\n } satisfies TargetSlot))),\n });\n}\n"]}
|
|
1
|
+
{"version":3,"file":"planning.js","sourceRoot":"","sources":["planning.ts"],"names":[],"mappings":";;AAgEA,kDAEC;AAeD,sDASC;AA6CD,4DA0CC;AACD,kDA0EC;AACD,gDAGC;AACD,4DA2BC;AA5RD,6CAAyC;AACzC,mCAAgD;AAChD,4DAAiE;AACjE,iDAAmD;AACnD,oEAA0E;AAC1E,sDAA6C;AAC7C,4DAA2D;AAC3D,8CAAsD;AACtD,qEAA6E;AAC7E,oDAAgL;AAEhL,sEAAiK;AAEjK,sEAA6F;AAC7F,6CAAqD;AA8CrD,MAAM,mBAAmB,GAAG,MAAM,CAAC,MAAM,CAAC;IACtC,MAAM,EAAE,wBAAwB;IAChC,KAAK,EAAE,mBAAmB;CAC7B,CAAC,CAAC;AACH,SAAgB,mBAAmB,CAAC,MAAc,EAAE,OAAe;IAC/D,OAAO,GAAG,MAAM,SAAS,OAAO,EAAE,CAAC;AACvC,CAAC;A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E;YACxB,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,cAAc,EAAE,KAAK,CAAC,OAAO,CAAC,cAAc;YAC5C,uBAAuB,EAAE,KAAK,CAAC,IAAI,CAAC,uBAAuB;YAC3D,aAAa,EAAE,KAAK,CAAC,KAAK,CAAC,aAAa;YACxC,cAAc,EAAE,KAAK,CAAC,KAAK,CAAC,cAAc;YAC1C,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,iBAAiB,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,iBAAiB,EAAE,KAAK,CAAC,KAAK,CAAC,iBAAiB,EAAE,CAAC;YAC5G,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;YAC9E,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,KAAK,QAAQ;mBACxC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,gBAAgB,KAAK,IAAI;gBACtD,CAAC,CAAC,EAAE,gBAAgB,EAAE,oCAA6C,EAAE;gBACrE,CAAC,CAAC,EAAE,CAAC;SACS,CAAC,CAAC,CAAC;KAC5B,CAAC,CAAC;AACP,CAAC","sourcesContent":["import { createHash } from \"node:crypto\";\nimport { Effect, Result, Schema } from \"effect\";\nimport { pluginInstanceDataOf } from \"../../plugin/contracts.ts\";\nimport { adapterIdentity } from \"../../adapter.ts\";\nimport { slotExecutionIdentityDigestHex } from \"../execution-identity.ts\";\nimport { cacheKey } from \"../fingerprint.ts\";\nimport { selectedEvalsForRun } from \"../eval-selection.ts\";\nimport { resolveAttemptTimeout } from \"../timeout.ts\";\nimport { EXECUTION_DURATION_DOMAIN } from \"../../eval/record/eligibility.ts\";\nimport { projectTargetPolicyIdentity, type ExecutionDurationLimit, type ExecutionIdentity, type ProjectTargetPolicy, type TargetRun, type TargetSlot, } from \"../reuse-plan.ts\";\nimport type { AgentRun, Config, DiscoveredEval } from \"../types.ts\";\nimport { EvalIdSchema, ExecutionIdentityDigestSchema, ExperimentIdSchema, RunIdSchema, SlotIdSchema, UtcMillisSchema, } from \"../../record/codec/identifiers.ts\";\nimport type { RecordSlotIdentity } from \"../../record/model/core.ts\";\nimport { canonicalizeRunContext, type RunContext, } from \"../../record/model/run-context.ts\";\nimport { experimentHooksForRun } from \"./context.ts\";\nimport type { ExecutionIdentityDigest, ExperimentId, RunId, UtcMillis, } from \"../../record/model/identifiers.ts\";\n/** Current facts supplied by physical planning; Record never reconstructs them from history. */\nexport interface RunnerRecordReuseSlotInput {\n readonly renameFingerprint?: (experimentId: string) => string | undefined;\n readonly inputIdentity: ExecutionIdentity;\n readonly configIdentity: ExecutionIdentity;\n readonly timeout?: ExecutionDurationLimit;\n}\nexport interface RunnerRecordReuseInput {\n readonly policy: ProjectTargetPolicy;\n readonly slotsByKey: ReadonlyMap<string, RunnerRecordReuseSlotInput>;\n}\nexport interface RunnerRecordReusePreparationInput {\n readonly evals: readonly DiscoveredEval[];\n readonly runs: readonly AgentRun[];\n readonly config: Pick<Config, \"timeoutMs\">;\n readonly plannedFingerprints: ReadonlyMap<string, string>;\n readonly renameFingerprintsByKey?: ReadonlyMap<string, (experimentId: string) => string | undefined>;\n readonly plannedConfigHashes: ReadonlyMap<string, string>;\n readonly rerun?: \"failed\" | \"all\";\n readonly keepSandbox?: \"failed\" | \"all\";\n}\nexport interface RunnerRecordTargetInputMissing {\n readonly code: \"runner-record-target-input-missing\";\n readonly key: string;\n}\nexport interface RunnerRecordTargetIdentityInvalid {\n readonly code: \"runner-record-target-identity-invalid\";\n readonly kind: \"invocation\" | \"slot\" | \"experiment\" | \"eval\" | \"digest\" | \"context\";\n readonly value: string;\n}\nexport interface PlannedRunnerRecordSlot {\n readonly evalDef: DiscoveredEval;\n readonly attempt: number;\n readonly slot: RecordSlotIdentity;\n readonly reuse: RunnerRecordReuseSlotInput;\n}\nexport interface PlannedRunnerRecordRun {\n readonly run: AgentRun;\n readonly experimentId: ExperimentId;\n readonly context: RunContext;\n readonly expectedSlots: readonly RecordSlotIdentity[];\n readonly slots: ReadonlyMap<string, PlannedRunnerRecordSlot>;\n readonly slotEntries: readonly PlannedRunnerRecordSlot[];\n}\nconst runnerReuseContract = Object.freeze({\n domain: \"niceeval.reuse/base-v1\",\n value: \"project-target/v1\",\n});\nexport function runnerRecordSlotKey(evalId: string, attempt: number): string {\n return `${evalId}\\u0000${attempt}`;\n}\nfunction decodeId<Id>(input: {\n readonly schema: Schema.Codec<Id, string>;\n readonly value: string;\n readonly kind: RunnerRecordTargetIdentityInvalid[\"kind\"];\n}): Result.Result<Id, RunnerRecordTargetIdentityInvalid> {\n const decoded = Schema.decodeUnknownResult(input.schema)(input.value);\n return Result.isFailure(decoded)\n ? Result.fail(Object.freeze({\n code: \"runner-record-target-identity-invalid\" as const,\n kind: input.kind,\n value: input.value,\n }))\n : Result.succeed(decoded.success);\n}\nexport function runnerRecordUtcMillis(value: number): Result.Result<UtcMillis, RunnerRecordTargetIdentityInvalid> {\n const decoded = Schema.decodeUnknownResult(UtcMillisSchema)(value);\n return Result.isFailure(decoded)\n ? Result.fail(Object.freeze({\n code: \"runner-record-target-identity-invalid\" as const,\n kind: \"invocation\" as const,\n value: String(value),\n }))\n : Result.succeed(decoded.success);\n}\nfunction runContextFor(run: AgentRun, experimentId: ExperimentId, evals: readonly DiscoveredEval[]): Result.Result<RunContext, RunnerRecordTargetIdentityInvalid> {\n const plugins = [...(run.plugins ?? []), ...selectedEvalsForRun(evals, run).flatMap((evalDef) => [\n ...(evalDef.evalGroup?.plugins ?? []), ...evalDef.plugins,\n ])].map(pluginInstanceDataOf).map(({ name, key, identity }) => ({ name, key, identity }));\n const uniquePlugins = [...new Map(plugins.map((plugin) => [JSON.stringify(plugin), plugin])).values()];\n const context = canonicalizeRunContext({\n experimentId,\n execution: {\n adapter: adapterIdentity(run.adapter),\n ...(uniquePlugins.length === 0 ? {} : { plugins: uniquePlugins }),\n ...(run.adapter.kind === \"custom\" ? { models: run.models ?? Object.freeze({}) } : {}),\n model: run.model ?? null,\n reasoningEffort: run.reasoningEffort ?? null,\n flags: run.flags,\n experimentHooks: experimentHooksForRun(run),\n },\n labels: run.labels ?? {},\n });\n return Result.isFailure(context)\n ? Result.fail(Object.freeze({\n code: \"runner-record-target-identity-invalid\" as const,\n kind: \"context\" as const,\n value: `invalid Run context for ${run.experimentId}`,\n }))\n : Result.succeed(context.success);\n}\nfunction executionIdentityDigest(input: {\n readonly run: AgentRun;\n readonly eval: DiscoveredEval;\n readonly attempt: number;\n readonly reuse: RunnerRecordReuseSlotInput;\n}): Result.Result<ExecutionIdentityDigest, RunnerRecordTargetIdentityInvalid> {\n const value = slotExecutionIdentityDigestHex({\n experimentId: input.run.experimentId,\n evalId: input.eval.id,\n attempt: input.attempt,\n input: { domain: input.reuse.inputIdentity.domain, value: input.reuse.inputIdentity.value },\n config: { domain: input.reuse.configIdentity.domain, value: input.reuse.configIdentity.value },\n timeout: input.reuse.timeout === undefined\n ? null\n : { domain: input.reuse.timeout.domain, milliseconds: input.reuse.timeout.milliseconds },\n });\n return decodeId({ schema: ExecutionIdentityDigestSchema, value, kind: \"digest\" });\n}\nexport function prepareRunnerRecordReuse(input: RunnerRecordReusePreparationInput): Effect.Effect<RunnerRecordReuseInput, RunnerRecordTargetInputMissing> {\n return Effect.suspend(() => {\n const slotsByKey = new Map<string, RunnerRecordReuseSlotInput>();\n for (const run of input.runs) {\n for (const evalDef of selectedEvalsForRun(input.evals, run)) {\n const key = cacheKey(run, evalDef.id);\n const fingerprint = input.plannedFingerprints.get(key);\n const configHash = input.plannedConfigHashes.get(key);\n if (fingerprint === undefined || configHash === undefined) {\n return Effect.fail({ code: \"runner-record-target-input-missing\" as const, key });\n }\n const timeout = resolveAttemptTimeout(run, evalDef, input.config);\n const renameFingerprint = input.renameFingerprintsByKey?.get(key);\n slotsByKey.set(key, Object.freeze({\n ...(renameFingerprint === undefined ? {} : { renameFingerprint }),\n inputIdentity: Object.freeze({\n domain: \"niceeval.input/fingerprint-v1\",\n value: fingerprint,\n }),\n configIdentity: Object.freeze({\n domain: \"niceeval.config/identity-v1\",\n value: configHash,\n }),\n ...(timeout === undefined ? {} : {\n timeout: Object.freeze({\n domain: EXECUTION_DURATION_DOMAIN,\n milliseconds: timeout.timeoutMs,\n }),\n }),\n }));\n }\n }\n return Effect.succeed(Object.freeze({\n policy: Object.freeze({\n identity: projectTargetPolicyIdentity,\n reuseContract: Object.freeze({ ...runnerReuseContract }),\n rerun: input.rerun ?? \"none\",\n keepSandbox: input.keepSandbox !== undefined,\n }),\n slotsByKey: new Map(slotsByKey),\n }));\n });\n}\nexport function planRunnerRecordRun(input: {\n readonly run: AgentRun;\n readonly evals: readonly DiscoveredEval[];\n readonly reuse: RunnerRecordReuseInput;\n}): Effect.Effect<PlannedRunnerRecordRun, RunnerRecordTargetInputMissing | RunnerRecordTargetIdentityInvalid> {\n return Effect.suspend<PlannedRunnerRecordRun, RunnerRecordTargetInputMissing | RunnerRecordTargetIdentityInvalid, never>(() => {\n const experimentId = decodeId({\n schema: ExperimentIdSchema,\n value: input.run.experimentId,\n kind: \"experiment\",\n });\n if (Result.isFailure(experimentId))\n return Effect.fail(experimentId.failure);\n const context = runContextFor(input.run, experimentId.success, input.evals);\n if (Result.isFailure(context))\n return Effect.fail(context.failure);\n const slots = new Map<string, PlannedRunnerRecordSlot>();\n const entries: PlannedRunnerRecordSlot[] = [];\n for (const evalDef of selectedEvalsForRun(input.evals, input.run)) {\n const reuse = input.reuse.slotsByKey.get(cacheKey(input.run, evalDef.id));\n if (reuse === undefined) {\n return Effect.fail({\n code: \"runner-record-target-input-missing\" as const,\n key: cacheKey(input.run, evalDef.id),\n });\n }\n const evalId = decodeId({ schema: EvalIdSchema, value: evalDef.id, kind: \"eval\" });\n if (Result.isFailure(evalId))\n return Effect.fail(evalId.failure);\n for (let attempt = 0; attempt < input.run.attempts; attempt += 1) {\n const digest = executionIdentityDigest({ run: input.run, eval: evalDef, attempt, reuse });\n if (Result.isFailure(digest))\n return Effect.fail(digest.failure);\n const slotId = decodeId({\n schema: SlotIdSchema,\n value: `slot-${digest.success}`,\n kind: \"slot\",\n });\n if (Result.isFailure(slotId))\n return Effect.fail(slotId.failure);\n const key = runnerRecordSlotKey(evalDef.id, attempt);\n if (slots.has(key)) {\n return Effect.fail({\n code: \"runner-record-target-identity-invalid\" as const,\n kind: \"slot\" as const,\n value: key,\n });\n }\n const entry = Object.freeze({\n evalDef,\n attempt,\n slot: Object.freeze({\n slotId: slotId.success,\n evalId: evalId.success,\n attemptOrdinal: attempt,\n executionIdentityDigest: digest.success,\n }),\n reuse,\n });\n slots.set(key, entry);\n entries.push(entry);\n }\n }\n return Effect.succeed(Object.freeze({\n run: input.run,\n experimentId: experimentId.success,\n context: context.success,\n expectedSlots: Object.freeze([...entries]\n .map((entry) => entry.slot)\n .sort((left, right) => left.slotId < right.slotId ? -1 : left.slotId > right.slotId ? 1 : 0)),\n slots,\n slotEntries: Object.freeze(entries),\n }));\n });\n}\nexport function previewRunnerRunId(run: AgentRun): Result.Result<RunId, RunnerRecordTargetIdentityInvalid> {\n const hash = createHash(\"sha256\").update(run.experimentId, \"utf8\").digest(\"hex\");\n return decodeId({ schema: RunIdSchema, value: `preview-${hash}`, kind: \"invocation\" });\n}\nexport function targetForRunnerRecordRun(input: {\n readonly planned: PlannedRunnerRecordRun;\n readonly runId: RunId;\n readonly startedAt: UtcMillis;\n}): TargetRun {\n return Object.freeze({\n runId: input.runId,\n experimentId: input.planned.run.experimentId,\n startedAt: input.startedAt,\n slots: Object.freeze(input.planned.slotEntries.map((entry) => Object.freeze({\n runId: input.runId,\n slotId: entry.slot.slotId,\n experimentId: input.planned.run.experimentId,\n evalId: entry.evalDef.id,\n attempt: entry.attempt,\n evaluationKind: entry.evalDef.evaluationKind,\n executionIdentityDigest: entry.slot.executionIdentityDigest,\n inputIdentity: entry.reuse.inputIdentity,\n configIdentity: entry.reuse.configIdentity,\n ...(entry.reuse.renameFingerprint === undefined ? {} : { renameFingerprint: entry.reuse.renameFingerprint }),\n ...(entry.reuse.timeout === undefined ? {} : { timeout: entry.reuse.timeout }),\n ...(input.planned.run.adapter.kind === \"custom\"\n && input.planned.run.adapter.behaviorRevision === null\n ? { reuseEligibility: \"adapter-behavior-revision-required\" as const }\n : {}),\n } satisfies TargetSlot))),\n });\n}\n"]}
|
package/dist/runner/record.cjs
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.prepareRunnerRecordReuse = void 0;
|
|
4
4
|
exports.withRunnerCurrentReusePreview = withRunnerCurrentReusePreview;
|
|
5
5
|
exports.openRunnerRecordCoordinator = openRunnerRecordCoordinator;
|
|
6
|
+
const attempt_notes_ts_1 = require("./attempt-notes.cjs");
|
|
6
7
|
const judge_usage_ts_1 = require("./judge-usage.cjs");
|
|
7
8
|
const node_crypto_1 = require("node:crypto");
|
|
8
9
|
const node_fs_1 = require("node:fs");
|
|
@@ -412,6 +413,7 @@ function openRunnerRecordCoordinator(input) {
|
|
|
412
413
|
const judgeUsage = (0, judge_usage_ts_1.judgeUsageForResult)(result, closedAssertions.success.entryIds);
|
|
413
414
|
if (judgeUsage !== undefined)
|
|
414
415
|
yield* active.session.records.write(catalog_ts_1.NiceEvalRecordAttachments.judgeUsage, judgeUsage);
|
|
416
|
+
yield* active.session.records.write(catalog_ts_1.NiceEvalRecordAttachments.attemptNotes, (0, attempt_notes_ts_1.attemptNotesForResult)(result));
|
|
415
417
|
const adapterUsage = (0, adapter_usage_ts_1.adapterUsageForResult)(result);
|
|
416
418
|
const executionTraces = (0, adapter_execution_trace_ts_1.adapterExecutionTracesForResult)(result);
|
|
417
419
|
if (adapterUsage !== undefined) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"record.js","sour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AAI,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC;oBACvD,IAAI,aAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;wBACvB,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;oBAC9B,CAAC;yBACI,CAAC;wBACF,MAAM,OAAO,GAAG,cAAK,CAAC,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;wBAClD,IAAI,eAAM,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;4BACzB,WAAW,CAAC,OAAO,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;wBAC1C,CAAC;6BACI,CAAC;4BACF,WAAW,CAAC,mBAAmB,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC,CAAC;wBACzE,CAAC;oBACL,CAAC;gBACL,CAAC;gBACD,OAAO,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YACnC,CAAC,CAAC;SACL,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC","sourcesContent":["import { judgeUsageForResult } from \"./judge-usage.ts\";\nimport { createHash } from \"node:crypto\";\nimport { existsSync } from \"node:fs\";\nimport { Cause, Effect, Result, Exit, Option, Semaphore, Stream } from \"effect\";\nimport { encodeAttemptLocator, type AttemptLocator } from \"../attempt-locator.ts\";\nimport type { SealedAttemptAssertions } from \"../assertions/api.ts\";\nimport type { AssertionsProducerError } from \"../assertions/record/producer.ts\";\nimport { NiceEvalRecordAttachments } from \"../record/family/catalog.ts\";\nimport { recordHost } from \"../record/host/runtime.ts\";\nimport { discardAttemptWriteSession, stagePlanningReference, writerGenerationForRunSession } from \"../record/host/sqlite-host.ts\";\nimport type { AttemptWriteSession, RecordSealReceipt, RunWriteSession, } from \"../record/host/types.ts\";\nimport type { RunId, SlotId, } from \"../record/model/identifiers.ts\";\nimport type { AssertionEntryId } from \"../assertions/identity.ts\";\nimport { recordRootPaths, type RecordRoot } from \"../record/platform/root.ts\";\nimport { attemptPublicationClosure } from \"../record/codec/core.ts\";\nimport { RecordRootInvalid } from \"../record/platform/errors.ts\";\nimport { recordSqlitePath } from \"../record/sqlite/index.ts\";\nimport type { ProjectStateDatabase } from \"../record/sqlite/project-state-database.ts\";\nimport type { RecordReaderOpenError, RecordReaderReadError, } from \"../record/reader/errors.ts\";\nimport type { RecordWriteError } from \"../record/writer/types.ts\";\nimport { bindAttemptReference, closeRunResource, currentPublicationCutoff, publishOriginAttempt, createRunWriterGeneration, type PublicationCutoff, type RunAbsenceReason, } from \"../run/storage/index.ts\";\nimport { cacheKey } from \"./fingerprint.ts\";\nimport { planProjectTargetReuse, planProjectTargetReuseWithoutSources, type ExecutionReusePlan, type ExecutionReusePlanSlot, type ProjectTargetReusePlanInvalid, type TargetRun, } from \"./reuse-plan.ts\";\nimport { readCurrentExecutionReusePlanReadbacks, readCurrentExecutionReusePlanResults, type CurrentReusedAttemptReadback, type CurrentReuseReadback, type CurrentReuseReadbackPlanInvalid, } from \"./reuse-readback.ts\";\nimport { createRunnerTurnContextsAttachment, createRunnerSourceWritePlan, type RunnerSourceProducerInvalid, } from \"./source-producer.ts\";\nimport { createAttemptArtifactsAttachment, createAttemptFileChangesAttachment, createAttemptObservabilityAttachments, createRunArtifactsAttachment, createRunnerAssertionsAttachment, createRunObservabilityAttachments, recordAttemptOutcome, } from \"./record/attachments.ts\";\nimport { adapterUsageForResult } from \"./adapter-usage.ts\";\nimport { adapterAttachmentsForResult, releaseAdapterAttachments } from \"./adapter-attachments.ts\";\nimport { adapterExecutionTracesForResult, validateExecutionTracePublication, } from \"./adapter-execution-trace.ts\";\nimport { executionTracesRecordCollection } from \"../record/family/execution-traces/definition.ts\";\nimport { planRunnerRecordRun, previewRunnerRunId, runnerRecordSlotKey, runnerRecordUtcMillis, targetForRunnerRecordRun, type PlannedRunnerRecordRun, type RunnerRecordReuseInput, type RunnerRecordTargetIdentityInvalid, type RunnerRecordTargetInputMissing, } from \"./record/planning.ts\";\nimport type { AgentRun, Attempt, DiscoveredEval, EvalResult, } from \"./types.ts\";\nimport type { AttemptCostAttachment } from \"../record/family/attempt-cost/definition.ts\";\nimport { getPricingEstimateReceipt } from \"./pricing-estimate-receipt.ts\";\nimport type { SessionTracker } from \"./session.ts\";\nexport { prepareRunnerRecordReuse, type RunnerRecordReuseInput, type RunnerRecordReusePreparationInput, type RunnerRecordReuseSlotInput, type RunnerRecordTargetIdentityInvalid, type RunnerRecordTargetInputMissing, } from \"./record/planning.ts\";\ntype GapActionState = \"pending\" | \"reserved\" | \"executed\" | \"not-dispatched\" | \"interrupted\";\ninterface ActiveRunnerRecordAttempt {\n readonly attempt: Attempt;\n readonly session: AttemptWriteSession;\n readonly public: RunnerRecordAttempt;\n sealed?: SealedAttemptAssertions;\n result?: EvalResult;\n assertionEntryIds?: readonly AssertionEntryId[];\n completed: boolean;\n}\ninterface RunnerRecordRun extends PlannedRunnerRecordRun {\n readonly session: RunWriteSession;\n readonly target: TargetRun;\n readonly attempts: Map<SlotId, ActiveRunnerRecordAttempt>;\n readonly planSlots: Map<SlotId, ExecutionReusePlanSlot>;\n readonly gapActions: Map<SlotId, GapActionState>;\n readonly writerGeneration: string;\n}\nexport interface RunnerRecordAttempt {\n readonly slotId: SlotId;\n readonly attemptId: import(\"../record/model/identifiers.ts\").AttemptId;\n readonly locator: AttemptLocator;\n}\nexport type RecordAttemptLocator = AttemptLocator;\nfunction createAttemptCostAttachment(result: EvalResult): AttemptCostAttachment {\n const receipt = getPricingEstimateReceipt(result);\n return Object.freeze({\n ...(result.usage?.costUSD === undefined ? {} : {\n observed: Object.freeze({ kind: \"observed\" as const, amountUSD: result.usage.costUSD }),\n }),\n ...(receipt === undefined ? {} : {\n estimated: Object.freeze({\n kind: \"estimated\" as const,\n amountUSD: receipt.amountUSD,\n model: receipt.model,\n priceSource: receipt.priceSource,\n charges: receipt.charges,\n }),\n }),\n });\n}\nexport interface RunnerRecordAttemptInvalid {\n readonly code: \"runner-record-attempt-invalid\";\n}\nexport interface RunnerRecordUnsealedAttempt {\n readonly code: \"runner-record-attempt-unsealed\";\n readonly slotId: SlotId;\n}\nexport interface RunnerRecordMembershipStateInvalid {\n readonly code: \"runner-record-membership-state-invalid\";\n readonly slotId: SlotId;\n}\nexport interface RunnerRecordAttemptPublicationFailed {\n readonly code: \"runner-record-attempt-publication-failed\";\n readonly locator: AttemptLocator;\n readonly cause: unknown;\n readonly message: string;\n}\n/** A seal return without its durable marker is never a publish receipt. */\nexport interface RunnerRecordPublishStateInvalid {\n readonly code: \"runner-record-publish-state-invalid\";\n readonly runId: RunId;\n}\nexport interface RunnerRecordAssertionsInvalid {\n readonly code: \"runner-record-assertions-invalid\";\n readonly issue: AssertionsProducerError;\n}\nexport interface RunnerRecordObservabilityInvalid {\n readonly code: \"runner-record-observability-invalid\";\n readonly owner: \"attempt\" | \"run\";\n readonly stage: \"capture\" | \"attachment\";\n}\nexport interface RunnerRecordSourcesInvalid {\n readonly code: \"runner-record-sources-invalid\";\n readonly issue: RunnerSourceProducerInvalid;\n}\nexport interface RunnerRecordArtifactsInvalid {\n readonly code: \"runner-record-artifacts-invalid\";\n readonly owner: \"attempt\" | \"run\";\n readonly reason: \"trace-serialization-failed\" | \"attachment-closure-invalid\";\n}\nexport type RunnerRecordWriteError = RecordWriteError | RunnerRecordAttemptInvalid | RunnerRecordUnsealedAttempt | RunnerRecordMembershipStateInvalid | RunnerRecordAttemptPublicationFailed | RunnerRecordPublishStateInvalid | RunnerRecordTargetIdentityInvalid | RunnerRecordAssertionsInvalid | RunnerRecordObservabilityInvalid | RunnerRecordSourcesInvalid | RunnerRecordArtifactsInvalid;\nexport type RunnerRecordOpenError = RecordReaderOpenError | RecordWriteError | RecordReaderReadError | ProjectTargetReusePlanInvalid | RunnerRecordTargetInputMissing | RunnerRecordTargetIdentityInvalid | RunnerRecordMembershipStateInvalid | RunnerSessionOpenFailed;\nexport interface RunnerSessionOpenFailed {\n readonly code: \"runner-session-open-failed\";\n readonly cause: unknown;\n}\nexport interface RunnerRecordCoordinator {\n readonly reusePlan: ExecutionReusePlan;\n readonly readCarriedResults: () => Effect.Effect<readonly CurrentReusedAttemptReadback[], RecordReaderReadError | CurrentReuseReadbackPlanInvalid>;\n readonly runIdsByExperiment: ReadonlyMap<string, string>;\n readonly publicationCutoff: () => Effect.Effect<PublicationCutoff, unknown, ProjectStateDatabase>;\n readonly carriedAttemptsByKey: ReadonlyMap<string, ReadonlySet<number>>;\n readonly adoptLatePublishedAttempt: (attempt: Attempt) => Effect.Effect<boolean, RecordReaderOpenError | RecordReaderReadError | ProjectTargetReusePlanInvalid | RunnerRecordWriteError, import(\"effect\").Scope.Scope | import(\"../coordination/record-leases.ts\").RecordCoordination | ProjectStateDatabase>;\n readonly reserveAttempt: (attempt: Attempt) => Effect.Effect<RunnerRecordAttempt, RunnerRecordWriteError, ProjectStateDatabase>;\n readonly noteSealedOrMarkIncomplete: (attempt: Attempt, sealed: SealedAttemptAssertions) => Effect.Effect<void, never>;\n readonly completeAttemptOrMarkIncomplete: (attempt: Attempt, result: EvalResult) => Effect.Effect<RunnerRecordAttempt | undefined, never, ProjectStateDatabase>;\n readonly markNotDispatched: (attempt: Attempt) => void;\n readonly publish: (completedAt: number, mode: \"normal\" | \"interrupted\") => Effect.Effect<readonly RecordSealReceipt[], RunnerRecordWriteError, ProjectStateDatabase>;\n}\n/** Current preview preserves the read Scope and never creates a Run row. */\nexport function withRunnerCurrentReusePreview<A, E, R>(input: {\n readonly recordRoot: RecordRoot;\n readonly startedAt: number;\n readonly evals: readonly DiscoveredEval[];\n readonly runs: readonly AgentRun[];\n readonly reuse: RunnerRecordReuseInput;\n readonly use: (preview: {\n readonly reusePlan: ExecutionReusePlan;\n readonly readReadbacks: () => Effect.Effect<readonly CurrentReuseReadback[], RecordReaderReadError | CurrentReuseReadbackPlanInvalid>;\n }) => Effect.Effect<A, E, R>;\n}): Effect.Effect<A, E | RunnerRecordOpenError, R | import(\"effect\").Scope.Scope | import(\"../coordination/record-leases.ts\").RecordCoordination | ProjectStateDatabase> {\n return Effect.scoped(Effect.gen(function* () {\n const startedAt = runnerRecordUtcMillis(input.startedAt);\n if (Result.isFailure(startedAt))\n return yield* Effect.fail(startedAt.failure);\n const planned = yield* Effect.forEach(input.runs, (run) => planRunnerRecordRun({\n run,\n evals: input.evals,\n reuse: input.reuse,\n }), { concurrency: 1 });\n const previewRuns: TargetRun[] = [];\n for (const plan of planned) {\n const runId = previewRunnerRunId(plan.run);\n if (Result.isFailure(runId))\n return yield* Effect.fail(runId.failure);\n previewRuns.push(targetForRunnerRecordRun({ planned: plan, runId: runId.success, startedAt: startedAt.success }));\n }\n const target = Object.freeze({\n invocationId: `preview-${createHash(\"sha256\").update(String(input.startedAt), \"utf8\").digest(\"hex\")}`,\n runs: Object.freeze(previewRuns),\n });\n const rootPath = recordRootPaths(input.recordRoot)?.portableRoot;\n if (rootPath === undefined)\n return yield* Effect.fail(new RecordRootInvalid({ code: \"record-root-invalid\" }));\n const recordDatabase = recordSqlitePath(rootPath);\n if (!existsSync(recordDatabase)) {\n const reusePlan = yield* planProjectTargetReuseWithoutSources({ target, policy: input.reuse.policy });\n return yield* input.use({\n reusePlan,\n readReadbacks: () => Effect.succeed(Object.freeze([])),\n });\n }\n const { reusePlan, readbacks } = yield* Effect.scoped(Effect.gen(function* () {\n const reader = yield* recordHost.openRead({ root: input.recordRoot });\n const reusePlan = yield* planProjectTargetReuse({ reader, target, policy: input.reuse.policy });\n const readbacks = yield* readCurrentExecutionReusePlanReadbacks({ reader, plan: reusePlan }).pipe(Effect.mapError((cause): RunnerSessionOpenFailed => ({ code: \"runner-session-open-failed\", cause })));\n return { reusePlan, readbacks };\n }));\n return yield* input.use({\n reusePlan,\n readReadbacks: () => Effect.succeed(readbacks),\n });\n }));\n}\nfunction attemptInvalid(): RunnerRecordAttemptInvalid {\n return Object.freeze({ code: \"runner-record-attempt-invalid\" as const });\n}\nfunction unsealedAttempt(slotId: SlotId): RunnerRecordUnsealedAttempt {\n return Object.freeze({ code: \"runner-record-attempt-unsealed\" as const, slotId });\n}\nfunction membershipStateInvalid(slotId: SlotId): RunnerRecordMembershipStateInvalid {\n return Object.freeze({ code: \"runner-record-membership-state-invalid\" as const, slotId });\n}\nfunction attemptPublicationFailed(locator: AttemptLocator, cause: unknown): RunnerRecordAttemptPublicationFailed {\n const detail = cause instanceof Error\n ? cause.message\n : typeof cause === \"object\" && cause !== null && typeof Reflect.get(cause, \"message\") === \"string\"\n ? String(Reflect.get(cause, \"message\"))\n : typeof cause === \"object\" && cause !== null && typeof Reflect.get(cause, \"code\") === \"string\"\n ? String(Reflect.get(cause, \"code\"))\n : String(cause);\n return Object.freeze({\n code: \"runner-record-attempt-publication-failed\" as const,\n locator,\n cause,\n message: `Attempt publication failed for ${locator}: ${detail}`,\n });\n}\nfunction publishStateInvalid(runId: RunId): RunnerRecordPublishStateInvalid {\n return Object.freeze({ code: \"runner-record-publish-state-invalid\" as const, runId });\n}\n/**\n * Opens one new per-Experiment Run session, selects only sealed historical\n * Runs, and writes carry references before dispatch. No global Record writer\n * lock or superseded draft/attachment contract participates in this boundary.\n */\nexport function openRunnerRecordCoordinator(input: {\n readonly recordRoot: RecordRoot;\n readonly startedAt: number;\n readonly evals: readonly DiscoveredEval[];\n readonly runs: readonly AgentRun[];\n readonly reuse: RunnerRecordReuseInput;\n readonly session?: SessionTracker;\n}): Effect.Effect<RunnerRecordCoordinator, RunnerRecordOpenError, import(\"effect\").Scope.Scope | import(\"../record/platform/services.ts\").RecordEntropy | import(\"../coordination/record-leases.ts\").RecordCoordination | ProjectStateDatabase> {\n return Effect.gen(function* () {\n const rootPath = recordRootPaths(input.recordRoot)?.portableRoot;\n if (rootPath === undefined)\n return yield* Effect.fail(new RecordRootInvalid({ code: \"record-root-invalid\" }));\n const seenExperiments = new Set<string>();\n for (const run of input.runs) {\n if (seenExperiments.has(run.experimentId)) {\n return yield* Effect.fail({\n code: \"runner-record-target-identity-invalid\" as const,\n kind: \"invocation\" as const,\n value: `duplicate experimentId ${JSON.stringify(run.experimentId)}`,\n });\n }\n seenExperiments.add(run.experimentId);\n }\n const startedAt = runnerRecordUtcMillis(input.startedAt);\n if (Result.isFailure(startedAt))\n return yield* Effect.fail(startedAt.failure);\n const planned = yield* Effect.forEach(input.runs, (run) => planRunnerRecordRun({\n run,\n evals: input.evals,\n reuse: input.reuse,\n }), { concurrency: 1 });\n const invocationId = input.session?.sessionId ?? createHash(\"sha256\")\n .update(`${input.startedAt}\\u0000${planned.map((entry) => entry.run.experimentId).join(\"\\u0000\")}`, \"utf8\")\n .digest(\"hex\");\n const openedRuns = yield* Effect.forEach(planned, (plan) => recordHost.createRun({\n root: input.recordRoot,\n experimentId: plan.experimentId,\n context: plan.context,\n startedAt: startedAt.success,\n expectedSlots: plan.expectedSlots,\n writerGeneration: createRunWriterGeneration(`${invocationId}:${plan.experimentId}`),\n }).pipe(Effect.map((session) => {\n const writerGeneration = writerGenerationForRunSession(session);\n if (writerGeneration === undefined)\n throw new Error(\"Run writer generation is unavailable\");\n return Object.freeze({ plan, session, writerGeneration });\n })), { concurrency: 1 });\n if (input.session !== undefined) {\n const startedAtIso = new Date(input.startedAt).toISOString();\n yield* input.session.start({\n runIds: new Map(openedRuns.map(({ plan, session }) => [plan.experimentId, String(session.runId)])),\n agentRuns: input.runs,\n startedAt: startedAtIso,\n invocationRuns: openedRuns.map(({ plan, session, writerGeneration }) => ({\n runId: String(session.runId),\n experimentId: plan.experimentId,\n writerGeneration,\n startedAt: startedAtIso,\n expectedSlots: plan.expectedSlots.map((slot) => ({\n slotId: String(slot.slotId), evalId: String(slot.evalId), attemptOrdinal: slot.attemptOrdinal,\n executionIdentityDigest: String(slot.executionIdentityDigest),\n })),\n })),\n }).pipe(Effect.mapError((cause): RunnerSessionOpenFailed => ({ code: \"runner-session-open-failed\", cause })));\n }\n const byRun = new Map<AgentRun, RunnerRecordRun>();\n const byRecordRunId = new Map<RunId, RunnerRecordRun>();\n const runIdsByExperiment = new Map<string, string>();\n const targetRuns: TargetRun[] = [];\n for (const { plan, session, writerGeneration } of openedRuns) {\n const target = targetForRunnerRecordRun({\n planned: plan,\n runId: session.runId,\n startedAt: startedAt.success,\n });\n const recordRun: RunnerRecordRun = {\n ...plan,\n session,\n target,\n attempts: new Map(),\n planSlots: new Map(),\n gapActions: new Map(),\n writerGeneration,\n };\n byRun.set(plan.run, recordRun);\n byRecordRunId.set(session.runId, recordRun);\n runIdsByExperiment.set(plan.run.experimentId, session.runId);\n targetRuns.push(target);\n }\n const target = Object.freeze({\n invocationId,\n runs: Object.freeze(targetRuns),\n });\n const { reusePlan, carriedResults } = yield* Effect.scoped(Effect.gen(function* () {\n const reader = yield* recordHost.openRead({ root: input.recordRoot });\n const reusePlan = yield* planProjectTargetReuse({ reader, target, policy: input.reuse.policy });\n const carriedResults = yield* readCurrentExecutionReusePlanResults({ reader, plan: reusePlan }).pipe(Effect.mapError((cause): RunnerSessionOpenFailed => ({ code: \"runner-session-open-failed\", cause })));\n return { reusePlan, carriedResults };\n }));\n const carriedAttemptsByKey = new Map<string, Set<number>>();\n for (const slot of reusePlan.slots) {\n const recordRun = byRecordRunId.get(slot.runId);\n if (recordRun === undefined)\n return yield* Effect.fail(membershipStateInvalid(slot.slotId));\n recordRun.planSlots.set(slot.slotId, slot);\n if (slot.state === \"reuse\") {\n yield* stagePlanningReference(recordRun.session, {\n slotId: slot.slotId,\n action: \"carried\",\n reference: slot.source.reference,\n });\n yield* bindAttemptReference(rootPath, {\n runId: String(recordRun.session.runId),\n writerGeneration: recordRun.writerGeneration,\n slotId: String(slot.slotId),\n action: \"carried\",\n publicationIdentity: slot.source.reference.publicationIdentity,\n deadlineEpochMs: Date.now() + 30000,\n }).pipe(Effect.mapError((cause): RunnerSessionOpenFailed => ({ code: \"runner-session-open-failed\", cause })));\n const entry = recordRun.slots.get(runnerRecordSlotKey(slot.evalId, slot.attempt));\n if (entry === undefined)\n return yield* Effect.fail(membershipStateInvalid(slot.slotId));\n const key = cacheKey(recordRun.run, entry.evalDef.id);\n const carried = carriedAttemptsByKey.get(key) ?? new Set<number>();\n carried.add(entry.attempt);\n carriedAttemptsByKey.set(key, carried);\n }\n else {\n recordRun.gapActions.set(slot.slotId, \"pending\");\n }\n }\n if (input.session !== undefined) {\n yield* input.session.applyCarriedAttempts(input.runs, carriedAttemptsByKey).pipe(Effect.mapError((cause): RunnerSessionOpenFailed => ({ code: \"runner-session-open-failed\", cause })));\n }\n let invocationWriteFailure: RunnerRecordWriteError | undefined;\n const writeFailuresByRun = new Map<RunnerRecordRun, RunnerRecordWriteError>();\n const noteFailure = (error: RunnerRecordWriteError, recordRun?: RunnerRecordRun): void => {\n if (recordRun === undefined) {\n if (invocationWriteFailure === undefined)\n invocationWriteFailure = error;\n return;\n }\n if (!writeFailuresByRun.has(recordRun))\n writeFailuresByRun.set(recordRun, error);\n };\n const lock = yield* Semaphore.make(1);\n const runForAttempt = (attempt: Attempt): RunnerRecordRun | undefined => byRun.get(attempt.run);\n const targetForAttempt = (attempt: Attempt): {\n readonly recordRun: RunnerRecordRun;\n readonly slotId: SlotId;\n readonly plan: ExecutionReusePlanSlot;\n } | undefined => {\n const recordRun = runForAttempt(attempt);\n if (recordRun === undefined)\n return undefined;\n const entry = recordRun.slots.get(runnerRecordSlotKey(attempt.evalDef.id, attempt.attempt));\n if (entry === undefined)\n return undefined;\n const plan = recordRun.planSlots.get(entry.slot.slotId);\n return plan === undefined ? undefined : { recordRun, slotId: entry.slot.slotId, plan };\n };\n const adoptLatePublishedAttempt = (attempt: Attempt) => lock.withPermits(1)(Effect.gen(function* () {\n const current = targetForAttempt(attempt);\n if (current === undefined\n || current.plan.state !== \"gap\"\n || current.recordRun.gapActions.get(current.slotId) !== \"pending\")\n return false;\n const refreshed = yield* Effect.scoped(Effect.gen(function* () {\n const freshReader = yield* recordHost.openRead({ root: input.recordRoot });\n return yield* planProjectTargetReuse({ reader: freshReader, target, policy: input.reuse.policy });\n }));\n const replacement = refreshed.slots.find((slot) => slot.runId === current.recordRun.target.runId && slot.slotId === current.slotId);\n if (replacement?.state !== \"reuse\")\n return false;\n yield* stagePlanningReference(current.recordRun.session, {\n slotId: current.slotId,\n action: \"carried\",\n reference: replacement.source.reference,\n });\n yield* bindAttemptReference(rootPath, {\n runId: String(current.recordRun.session.runId),\n writerGeneration: current.recordRun.writerGeneration,\n slotId: String(current.slotId),\n action: \"carried\",\n publicationIdentity: replacement.source.reference.publicationIdentity,\n deadlineEpochMs: Date.now() + 30000,\n }).pipe(Effect.mapError(() => publishStateInvalid(current.recordRun.session.runId)));\n current.recordRun.planSlots.set(current.slotId, replacement);\n current.recordRun.gapActions.delete(current.slotId);\n return true;\n }));\n const reserveAttempt = (attempt: Attempt): Effect.Effect<RunnerRecordAttempt, RunnerRecordWriteError, ProjectStateDatabase> => {\n const targetSlot = targetForAttempt(attempt);\n return lock.withPermits(1)(Effect.gen(function* () {\n if (targetSlot === undefined\n || targetSlot.plan.state !== \"gap\"\n || targetSlot.recordRun.gapActions.get(targetSlot.slotId) !== \"pending\") {\n return yield* Effect.fail(attemptInvalid());\n }\n const session = yield* targetSlot.recordRun.session.createAttempt({ slotId: targetSlot.slotId });\n const publicAttempt = Object.freeze({\n slotId: targetSlot.slotId,\n attemptId: session.attemptId,\n locator: encodeAttemptLocator(session.attemptId),\n });\n targetSlot.recordRun.attempts.set(targetSlot.slotId, {\n attempt,\n session,\n public: publicAttempt,\n completed: false,\n });\n targetSlot.recordRun.gapActions.set(targetSlot.slotId, \"reserved\");\n return publicAttempt;\n })).pipe(Effect.tapError((error) => Effect.sync(() => noteFailure(error, targetSlot?.recordRun ?? runForAttempt(attempt)))));\n };\n const noteSealedOrMarkIncomplete = (attempt: Attempt, sealed: SealedAttemptAssertions): Effect.Effect<void, never> => Effect.sync(() => {\n const targetSlot = targetForAttempt(attempt);\n const active = targetSlot === undefined\n ? undefined\n : targetSlot.recordRun.attempts.get(targetSlot.slotId);\n if (targetSlot === undefined\n || targetSlot.plan.state !== \"gap\"\n || targetSlot.recordRun.gapActions.get(targetSlot.slotId) !== \"reserved\"\n || active === undefined\n || active.attempt !== attempt\n || active.sealed !== undefined) {\n noteFailure(attemptInvalid(), targetSlot?.recordRun ?? runForAttempt(attempt));\n return;\n }\n active.sealed = sealed;\n });\n const completeAttempt = (attempt: Attempt, result: EvalResult): Effect.Effect<RunnerRecordAttempt, RunnerRecordWriteError, ProjectStateDatabase> => Effect.suspend<RunnerRecordAttempt, RunnerRecordWriteError, ProjectStateDatabase>(() => {\n const targetSlot = targetForAttempt(attempt);\n const active = targetSlot === undefined\n ? undefined\n : targetSlot.recordRun.attempts.get(targetSlot.slotId);\n if (targetSlot === undefined\n || targetSlot.plan.state !== \"gap\"\n || targetSlot.recordRun.gapActions.get(targetSlot.slotId) !== \"reserved\"\n || active === undefined\n || active.attempt !== attempt\n || active.completed) {\n return Effect.fail(attemptInvalid());\n }\n const assertions = active.sealed === undefined\n ? undefined\n : createRunnerAssertionsAttachment(active.sealed);\n if (assertions !== undefined && Result.isFailure(assertions))\n return Effect.fail(assertions.failure);\n if (active.sealed === undefined || assertions === undefined || Result.isFailure(assertions)) {\n return Effect.fail(membershipStateInvalid(targetSlot.slotId));\n }\n return Effect.gen(function* () {\n const sourcePlan = createRunnerSourceWritePlan([Object.freeze({\n slotId: targetSlot.slotId,\n result,\n assertionEntryIds: assertions.success.entryIds,\n })]);\n if (Result.isFailure(sourcePlan)) {\n return yield* Effect.fail(Object.freeze({\n code: \"runner-record-sources-invalid\" as const,\n issue: sourcePlan.failure,\n }));\n }\n const closedAssertions = createRunnerAssertionsAttachment(active.sealed!, {\n entryIds: assertions.success.entryIds,\n sourceSites: sourcePlan.success.sourceSitesBySlot.get(targetSlot.slotId),\n });\n if (Result.isFailure(closedAssertions))\n return yield* Effect.fail(closedAssertions.failure);\n yield* active.session.records.write(NiceEvalRecordAttachments.assertions, closedAssertions.success.attachment);\n yield* active.session.records.write(NiceEvalRecordAttachments.attemptCost, createAttemptCostAttachment(result));\n const sourceReceipts = yield* createAttemptObservabilityAttachments({ result, sealed: active.sealed! });\n if (sourceReceipts.agentTurns !== undefined) {\n yield* active.session.records.write(NiceEvalRecordAttachments.agentTurns, sourceReceipts.agentTurns);\n }\n if (sourceReceipts.sandboxCommands !== undefined) {\n yield* active.session.records.write(NiceEvalRecordAttachments.sandboxCommands, sourceReceipts.sandboxCommands);\n }\n yield* active.session.records.write(NiceEvalRecordAttachments.runnerActivities.attempt, sourceReceipts.runnerActivities);\n yield* active.session.records.write(NiceEvalRecordAttachments.runnerDiagnostics.attempt, sourceReceipts.runnerDiagnostics);\n const turnContexts = createRunnerTurnContextsAttachment({ result, sourcePlan: sourcePlan.success });\n if (Result.isFailure(turnContexts)) {\n return yield* Effect.fail(Object.freeze({\n code: \"runner-record-sources-invalid\" as const,\n issue: turnContexts.failure,\n }));\n }\n if (turnContexts.success !== undefined) {\n yield* active.session.records.write(NiceEvalRecordAttachments.turnContexts, turnContexts.success);\n }\n const fileChanges = createAttemptFileChangesAttachment(result);\n if (fileChanges !== undefined) {\n yield* active.session.records.write(NiceEvalRecordAttachments.fileChanges, fileChanges);\n }\n const attachmentSnapshot = adapterAttachmentsForResult(result);\n const artifacts = createAttemptArtifactsAttachment(result, attachmentSnapshot);\n const judgeUsage = judgeUsageForResult(result, closedAssertions.success.entryIds);\n if (judgeUsage !== undefined)\n yield* active.session.records.write(NiceEvalRecordAttachments.judgeUsage, judgeUsage);\n const adapterUsage = adapterUsageForResult(result);\n const executionTraces = adapterExecutionTracesForResult(result);\n if (adapterUsage !== undefined) {\n yield* active.session.records.write(NiceEvalRecordAttachments.adapterUsage, adapterUsage);\n }\n if (artifacts !== undefined) {\n yield* active.session.records.write(NiceEvalRecordAttachments.artifacts.attempt, artifacts);\n }\n if (executionTraces !== undefined && executionTraces.traces.length > 0) {\n validateExecutionTracePublication(executionTraces, attachmentSnapshot?.artifacts ?? []);\n yield* active.session.records.appendAll(executionTracesRecordCollection, Stream.fromIterable(executionTraces.traces.flatMap((trace) => trace.records)));\n yield* active.session.records.close(executionTracesRecordCollection, executionTraces.failure === undefined\n ? { state: \"complete\" }\n : {\n state: \"partial\",\n limitations: [{ code: \"capture-failed\", stage: \"adapter\" }],\n });\n }\n yield* active.session.complete(recordAttemptOutcome(result));\n const closureBytes = new TextEncoder().encode(JSON.stringify(attemptPublicationClosure(Object.freeze({\n runId: String(targetSlot.recordRun.session.runId),\n experimentId: targetSlot.recordRun.experimentId,\n context: targetSlot.recordRun.context,\n startedAt: targetSlot.recordRun.target.startedAt,\n completedAt: Date.now(),\n expectedSlots: targetSlot.recordRun.expectedSlots,\n }))));\n yield* publishOriginAttempt(rootPath, {\n runId: String(targetSlot.recordRun.session.runId),\n writerGeneration: targetSlot.recordRun.writerGeneration,\n slotId: String(targetSlot.slotId),\n attemptId: String(active.public.attemptId),\n attemptLocator: String(active.public.locator),\n closureBytes,\n closureDigest: createHash(\"sha256\").update(closureBytes).digest(\"hex\"),\n deadlineEpochMs: Date.now() + 30000,\n }).pipe(Effect.mapError((cause) => attemptPublicationFailed(active.public.locator, cause)));\n active.result = result;\n active.assertionEntryIds = assertions.success.entryIds;\n active.completed = true;\n targetSlot.recordRun.gapActions.set(targetSlot.slotId, \"executed\");\n return active.public;\n });\n });\n const attachRunFacts = (recordRun: RunnerRecordRun, mode: \"normal\" | \"interrupted\"): Effect.Effect<void, RunnerRecordWriteError> => Effect.gen(function* () {\n const writeRecord = (effect: Effect.Effect<void, RecordWriteError, never>): Effect.Effect<void, RecordWriteError, never> => effect;\n const origins = [] as {\n readonly slotId: SlotId;\n readonly active: ActiveRunnerRecordAttempt;\n readonly result: EvalResult;\n readonly sealed: SealedAttemptAssertions;\n readonly assertionEntryIds: readonly AssertionEntryId[];\n }[];\n for (const [slotId, state] of recordRun.gapActions) {\n if (state !== \"executed\")\n continue;\n const active = recordRun.attempts.get(slotId);\n if (active === undefined)\n return yield* Effect.fail(membershipStateInvalid(slotId));\n const result = active.result;\n const sealed = active?.sealed;\n const assertionEntryIds = active?.assertionEntryIds;\n if (result === undefined || sealed === undefined || assertionEntryIds === undefined)\n continue;\n origins.push(Object.freeze({ slotId, active, result, sealed, assertionEntryIds }));\n }\n const sources = createRunnerSourceWritePlan(origins.map(({ slotId, result, assertionEntryIds }) => Object.freeze({\n slotId,\n result,\n assertionEntryIds,\n })));\n if (Result.isFailure(sources)) {\n return yield* Effect.fail(Object.freeze({\n code: \"runner-record-sources-invalid\" as const,\n issue: sources.failure,\n }));\n }\n yield* writeRecord(recordRun.session.records.write(NiceEvalRecordAttachments.sources, sources.success.sources));\n const sourceReceipts = yield* createRunObservabilityAttachments(recordRun.run);\n if (sourceReceipts.runnerActivities !== undefined) {\n yield* writeRecord(recordRun.session.records.write(NiceEvalRecordAttachments.runnerActivities.run, sourceReceipts.runnerActivities));\n }\n if (sourceReceipts.runnerDiagnostics !== undefined) {\n yield* writeRecord(recordRun.session.records.write(NiceEvalRecordAttachments.runnerDiagnostics.run, sourceReceipts.runnerDiagnostics));\n }\n yield* writeRecord(recordRun.session.records.write(NiceEvalRecordAttachments.artifacts.run, createRunArtifactsAttachment()));\n });\n const pendingGap = (recordRun: RunnerRecordRun): SlotId | undefined => {\n for (const [slotId, state] of recordRun.gapActions) {\n if (state === \"pending\")\n return slotId;\n }\n return undefined;\n };\n return Object.freeze({\n reusePlan,\n readCarriedResults: () => Effect.succeed(carriedResults),\n runIdsByExperiment: new Map(runIdsByExperiment),\n publicationCutoff: () => currentPublicationCutoff(rootPath),\n carriedAttemptsByKey: new Map([...carriedAttemptsByKey].map(([key, attempts]) => [key, new Set(attempts)] as const)),\n adoptLatePublishedAttempt,\n reserveAttempt,\n noteSealedOrMarkIncomplete,\n completeAttemptOrMarkIncomplete: (attempt: Attempt, result: EvalResult) => completeAttempt(attempt, result).pipe(Effect.catch((error) => Effect.sync(() => {\n const target = targetForAttempt(attempt);\n const active = target === undefined ? undefined : target.recordRun.attempts.get(target.slotId);\n noteFailure(error.code === \"runner-record-assertions-invalid\" ||\n error.code === \"runner-record-attempt-publication-failed\" ||\n active === undefined\n ? error\n : attemptPublicationFailed(active.public.locator, error), target?.recordRun ?? runForAttempt(attempt));\n return undefined;\n })), Effect.ensuring(Effect.promise(() => releaseAdapterAttachments(result)))),\n markNotDispatched: (attempt: Attempt) => {\n const targetSlot = targetForAttempt(attempt);\n if (targetSlot !== undefined\n && targetSlot.plan.state === \"gap\"\n && targetSlot.recordRun.gapActions.get(targetSlot.slotId) === \"pending\") {\n targetSlot.recordRun.gapActions.set(targetSlot.slotId, \"not-dispatched\");\n }\n },\n publish: (completedAt: number, mode: \"normal\" | \"interrupted\") => Effect.gen(function* () {\n const recordRuns = [...byRun.values()];\n if (invocationWriteFailure !== undefined)\n return yield* Effect.fail(invocationWriteFailure);\n if (mode === \"normal\") {\n // A normal finish remains invocation-strict: a failure which can be\n // attributed to one Run still fails the call rather than allowing a\n // partial receipt to disguise it as ordinary completion.\n for (const recordRun of recordRuns) {\n const failure = writeFailuresByRun.get(recordRun);\n if (failure !== undefined)\n return yield* Effect.fail(failure);\n }\n }\n const completion = runnerRecordUtcMillis(completedAt);\n if (Result.isFailure(completion))\n return yield* Effect.fail(completion.failure);\n // A controlled interruption closes every reserved Attempt as\n // `interrupted` and every never-started gap as an interrupted terminal\n // Member. Only a Run-local writer failure remains non-publishable.\n // Abrupt process loss still has no opportunity to create `complete`.\n const incompleteRuns = mode === \"interrupted\"\n ? new Set(recordRuns.filter((recordRun) => writeFailuresByRun.has(recordRun)))\n : new Set<RunnerRecordRun>();\n if (mode === \"normal\") {\n // Normal completion is deliberately invocation-strict. A pending\n // gap means the scheduler failed to account for a Slot; a reserved\n // or otherwise unsettled Attempt is likewise not publishable.\n for (const recordRun of recordRuns) {\n const unsettledSlot = [...recordRun.gapActions.keys()].find((slotId) => {\n const active = recordRun.attempts.get(slotId);\n return recordRun.gapActions.get(slotId) === \"reserved\"\n || (active !== undefined && !active.completed);\n });\n if (unsettledSlot !== undefined)\n return yield* Effect.fail(unsealedAttempt(unsettledSlot));\n const unaccountedSlot = pendingGap(recordRun);\n if (unaccountedSlot !== undefined)\n return yield* Effect.fail(unsealedAttempt(unaccountedSlot));\n }\n }\n else {\n for (const recordRun of recordRuns) {\n if (incompleteRuns.has(recordRun))\n continue;\n for (const [slotId, state] of recordRun.gapActions) {\n if (state === \"pending\")\n recordRun.gapActions.set(slotId, \"interrupted\");\n if (state === \"reserved\") {\n const active = recordRun.attempts.get(slotId);\n if (active === undefined)\n return yield* Effect.fail(membershipStateInvalid(slotId));\n yield* discardAttemptWriteSession(active.session);\n recordRun.attempts.delete(slotId);\n recordRun.gapActions.set(slotId, \"interrupted\");\n }\n }\n }\n }\n const publishableRuns = recordRuns.filter((recordRun) => !incompleteRuns.has(recordRun));\n const publishOne = (recordRun: RunnerRecordRun): Effect.Effect<RecordSealReceipt, RunnerRecordWriteError, ProjectStateDatabase> => Effect.gen(function* () {\n yield* attachRunFacts(recordRun, mode);\n for (const [slotId, state] of recordRun.gapActions) {\n if (state === \"not-dispatched\" || state === \"interrupted\") {\n const absenceReason: RunAbsenceReason = mode === \"interrupted\"\n ? \"interrupted-before-publication\"\n : state === \"not-dispatched\"\n ? \"early-exit-satisfied\"\n : \"dispatch-failed\";\n yield* recordRun.session.recordTerminalMember({ slotId, action: state, absenceReason });\n }\n }\n const sealed = yield* recordRun.session.seal({ completedAt: completion.success });\n const absences = [...recordRun.gapActions].flatMap(([slotId, state]) => {\n if (state === \"executed\" && recordRun.attempts.get(slotId)?.completed === true)\n return [];\n const reason: RunAbsenceReason = mode === \"interrupted\"\n ? \"interrupted-before-publication\"\n : state === \"not-dispatched\"\n ? \"early-exit-satisfied\"\n : \"dispatch-failed\";\n return [{ slotId: String(slotId), reason }];\n });\n yield* closeRunResource(rootPath, {\n runId: String(recordRun.session.runId),\n writerGeneration: recordRun.writerGeneration,\n state: mode === \"interrupted\" ? \"interrupted\" : \"completed\",\n completedAt: new Date(completedAt).toISOString(),\n absences,\n deadlineEpochMs: Date.now() + 30000,\n }).pipe(Effect.mapError(() => publishStateInvalid(recordRun.session.runId)));\n return sealed;\n });\n if (mode === \"normal\") {\n // Normal completion remains typed and strict: the first Run failure\n // is an invocation failure, never a partial success receipt.\n return yield* Effect.forEach(publishableRuns, publishOne, { concurrency: 1 });\n }\n // SIGINT is different: each clean sibling receives its own complete\n // attempt. We deliberately observe an Exit per Run so one Attachment\n // or seal error cannot short-circuit subsequent safe siblings.\n const receipts: RecordSealReceipt[] = [];\n for (const recordRun of publishableRuns) {\n const exit = yield* Effect.exit(publishOne(recordRun));\n if (Exit.isSuccess(exit)) {\n receipts.push(exit.value);\n }\n else {\n const failure = Cause.findErrorOption(exit.cause);\n if (Option.isSome(failure)) {\n noteFailure(failure.value, recordRun);\n }\n else {\n noteFailure(publishStateInvalid(recordRun.session.runId), recordRun);\n }\n }\n }\n return Object.freeze(receipts);\n }),\n });\n });\n}\n"]}
|
|
1
|
+
{"version":3,"file":"record.js","sourceRoot":"","sources":["record.ts"],"names":[],"mappings":";;;AA0IA,sEAqDC;AAiCD,kEA+hBC;AA/vBD,yDAA2D;AAC3D,qDAAuD;AACvD,6CAAyC;AACzC,qCAAqC;AACrC,mCAAgF;AAChF,8DAAkF;AAGlF,4DAAwE;AACxE,0DAAuD;AACvD,kEAAkI;AAIlI,wDAA8E;AAC9E,qDAAoE;AACpE,4DAAiE;AACjE,wDAA6D;AAI7D,sDAA4M;AAC5M,qDAA4C;AAC5C,mDAA0M;AAC1M,2DAAwN;AACxN,6DAA0I;AAC1I,4DAAgR;AAChR,yDAA2D;AAC3D,qEAAkG;AAClG,6EAAmH;AACnH,mFAAkG;AAClG,sDAA6R;AAG7R,+EAA0E;AAE1E,oDAAoP;AAA3O,uHAAA,wBAAwB,OAAA;AAyBjC,SAAS,2BAA2B,CAAC,MAAkB;IACnD,MAAM,OAAO,GAAG,IAAA,uDAAyB,EAAC,MAAM,CAAC,CAAC;IAClD,OAAO,MAAM,CAAC,MAAM,CAAC;QACjB,GAAG,CAAC,MAAM,CAAC,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EAAE,SAAS,CAAC,CAAC;wBACzE,CAAC;oBACL,CAAC;gBACL,CAAC;gBACD,OAAO,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YACnC,CAAC,CAAC;SACL,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC","sourcesContent":["import { attemptNotesForResult } from \"./attempt-notes.ts\";\nimport { judgeUsageForResult } from \"./judge-usage.ts\";\nimport { createHash } from \"node:crypto\";\nimport { existsSync } from \"node:fs\";\nimport { Cause, Effect, Result, Exit, Option, Semaphore, Stream } from \"effect\";\nimport { encodeAttemptLocator, type AttemptLocator } from \"../attempt-locator.ts\";\nimport type { SealedAttemptAssertions } from \"../assertions/api.ts\";\nimport type { AssertionsProducerError } from \"../assertions/record/producer.ts\";\nimport { NiceEvalRecordAttachments } from \"../record/family/catalog.ts\";\nimport { recordHost } from \"../record/host/runtime.ts\";\nimport { discardAttemptWriteSession, stagePlanningReference, writerGenerationForRunSession } from \"../record/host/sqlite-host.ts\";\nimport type { AttemptWriteSession, RecordSealReceipt, RunWriteSession, } from \"../record/host/types.ts\";\nimport type { RunId, SlotId, } from \"../record/model/identifiers.ts\";\nimport type { AssertionEntryId } from \"../assertions/identity.ts\";\nimport { recordRootPaths, type RecordRoot } from \"../record/platform/root.ts\";\nimport { attemptPublicationClosure } from \"../record/codec/core.ts\";\nimport { RecordRootInvalid } from \"../record/platform/errors.ts\";\nimport { recordSqlitePath } from \"../record/sqlite/index.ts\";\nimport type { ProjectStateDatabase } from \"../record/sqlite/project-state-database.ts\";\nimport type { RecordReaderOpenError, RecordReaderReadError, } from \"../record/reader/errors.ts\";\nimport type { RecordWriteError } from \"../record/writer/types.ts\";\nimport { bindAttemptReference, closeRunResource, currentPublicationCutoff, publishOriginAttempt, createRunWriterGeneration, type PublicationCutoff, type RunAbsenceReason, } from \"../run/storage/index.ts\";\nimport { cacheKey } from \"./fingerprint.ts\";\nimport { planProjectTargetReuse, planProjectTargetReuseWithoutSources, type ExecutionReusePlan, type ExecutionReusePlanSlot, type ProjectTargetReusePlanInvalid, type TargetRun, } from \"./reuse-plan.ts\";\nimport { readCurrentExecutionReusePlanReadbacks, readCurrentExecutionReusePlanResults, type CurrentReusedAttemptReadback, type CurrentReuseReadback, type CurrentReuseReadbackPlanInvalid, } from \"./reuse-readback.ts\";\nimport { createRunnerTurnContextsAttachment, createRunnerSourceWritePlan, type RunnerSourceProducerInvalid, } from \"./source-producer.ts\";\nimport { createAttemptArtifactsAttachment, createAttemptFileChangesAttachment, createAttemptObservabilityAttachments, createRunArtifactsAttachment, createRunnerAssertionsAttachment, createRunObservabilityAttachments, recordAttemptOutcome, } from \"./record/attachments.ts\";\nimport { adapterUsageForResult } from \"./adapter-usage.ts\";\nimport { adapterAttachmentsForResult, releaseAdapterAttachments } from \"./adapter-attachments.ts\";\nimport { adapterExecutionTracesForResult, validateExecutionTracePublication, } from \"./adapter-execution-trace.ts\";\nimport { executionTracesRecordCollection } from \"../record/family/execution-traces/definition.ts\";\nimport { planRunnerRecordRun, previewRunnerRunId, runnerRecordSlotKey, runnerRecordUtcMillis, targetForRunnerRecordRun, type PlannedRunnerRecordRun, type RunnerRecordReuseInput, type RunnerRecordTargetIdentityInvalid, type RunnerRecordTargetInputMissing, } from \"./record/planning.ts\";\nimport type { AgentRun, Attempt, DiscoveredEval, EvalResult, } from \"./types.ts\";\nimport type { AttemptCostAttachment } from \"../record/family/attempt-cost/definition.ts\";\nimport { getPricingEstimateReceipt } from \"./pricing-estimate-receipt.ts\";\nimport type { SessionTracker } from \"./session.ts\";\nexport { prepareRunnerRecordReuse, type RunnerRecordReuseInput, type RunnerRecordReusePreparationInput, type RunnerRecordReuseSlotInput, type RunnerRecordTargetIdentityInvalid, type RunnerRecordTargetInputMissing, } from \"./record/planning.ts\";\ntype GapActionState = \"pending\" | \"reserved\" | \"executed\" | \"not-dispatched\" | \"interrupted\";\ninterface ActiveRunnerRecordAttempt {\n readonly attempt: Attempt;\n readonly session: AttemptWriteSession;\n readonly public: RunnerRecordAttempt;\n sealed?: SealedAttemptAssertions;\n result?: EvalResult;\n assertionEntryIds?: readonly AssertionEntryId[];\n completed: boolean;\n}\ninterface RunnerRecordRun extends PlannedRunnerRecordRun {\n readonly session: RunWriteSession;\n readonly target: TargetRun;\n readonly attempts: Map<SlotId, ActiveRunnerRecordAttempt>;\n readonly planSlots: Map<SlotId, ExecutionReusePlanSlot>;\n readonly gapActions: Map<SlotId, GapActionState>;\n readonly writerGeneration: string;\n}\nexport interface RunnerRecordAttempt {\n readonly slotId: SlotId;\n readonly attemptId: import(\"../record/model/identifiers.ts\").AttemptId;\n readonly locator: AttemptLocator;\n}\nexport type RecordAttemptLocator = AttemptLocator;\nfunction createAttemptCostAttachment(result: EvalResult): AttemptCostAttachment {\n const receipt = getPricingEstimateReceipt(result);\n return Object.freeze({\n ...(result.usage?.costUSD === undefined ? {} : {\n observed: Object.freeze({ kind: \"observed\" as const, amountUSD: result.usage.costUSD }),\n }),\n ...(receipt === undefined ? {} : {\n estimated: Object.freeze({\n kind: \"estimated\" as const,\n amountUSD: receipt.amountUSD,\n model: receipt.model,\n priceSource: receipt.priceSource,\n charges: receipt.charges,\n }),\n }),\n });\n}\nexport interface RunnerRecordAttemptInvalid {\n readonly code: \"runner-record-attempt-invalid\";\n}\nexport interface RunnerRecordUnsealedAttempt {\n readonly code: \"runner-record-attempt-unsealed\";\n readonly slotId: SlotId;\n}\nexport interface RunnerRecordMembershipStateInvalid {\n readonly code: \"runner-record-membership-state-invalid\";\n readonly slotId: SlotId;\n}\nexport interface RunnerRecordAttemptPublicationFailed {\n readonly code: \"runner-record-attempt-publication-failed\";\n readonly locator: AttemptLocator;\n readonly cause: unknown;\n readonly message: string;\n}\n/** A seal return without its durable marker is never a publish receipt. */\nexport interface RunnerRecordPublishStateInvalid {\n readonly code: \"runner-record-publish-state-invalid\";\n readonly runId: RunId;\n}\nexport interface RunnerRecordAssertionsInvalid {\n readonly code: \"runner-record-assertions-invalid\";\n readonly issue: AssertionsProducerError;\n}\nexport interface RunnerRecordObservabilityInvalid {\n readonly code: \"runner-record-observability-invalid\";\n readonly owner: \"attempt\" | \"run\";\n readonly stage: \"capture\" | \"attachment\";\n}\nexport interface RunnerRecordSourcesInvalid {\n readonly code: \"runner-record-sources-invalid\";\n readonly issue: RunnerSourceProducerInvalid;\n}\nexport interface RunnerRecordArtifactsInvalid {\n readonly code: \"runner-record-artifacts-invalid\";\n readonly owner: \"attempt\" | \"run\";\n readonly reason: \"trace-serialization-failed\" | \"attachment-closure-invalid\";\n}\nexport type RunnerRecordWriteError = RecordWriteError | RunnerRecordAttemptInvalid | RunnerRecordUnsealedAttempt | RunnerRecordMembershipStateInvalid | RunnerRecordAttemptPublicationFailed | RunnerRecordPublishStateInvalid | RunnerRecordTargetIdentityInvalid | RunnerRecordAssertionsInvalid | RunnerRecordObservabilityInvalid | RunnerRecordSourcesInvalid | RunnerRecordArtifactsInvalid;\nexport type RunnerRecordOpenError = RecordReaderOpenError | RecordWriteError | RecordReaderReadError | ProjectTargetReusePlanInvalid | RunnerRecordTargetInputMissing | RunnerRecordTargetIdentityInvalid | RunnerRecordMembershipStateInvalid | RunnerSessionOpenFailed;\nexport interface RunnerSessionOpenFailed {\n readonly code: \"runner-session-open-failed\";\n readonly cause: unknown;\n}\nexport interface RunnerRecordCoordinator {\n readonly reusePlan: ExecutionReusePlan;\n readonly readCarriedResults: () => Effect.Effect<readonly CurrentReusedAttemptReadback[], RecordReaderReadError | CurrentReuseReadbackPlanInvalid>;\n readonly runIdsByExperiment: ReadonlyMap<string, string>;\n readonly publicationCutoff: () => Effect.Effect<PublicationCutoff, unknown, ProjectStateDatabase>;\n readonly carriedAttemptsByKey: ReadonlyMap<string, ReadonlySet<number>>;\n readonly adoptLatePublishedAttempt: (attempt: Attempt) => Effect.Effect<boolean, RecordReaderOpenError | RecordReaderReadError | ProjectTargetReusePlanInvalid | RunnerRecordWriteError, import(\"effect\").Scope.Scope | import(\"../coordination/record-leases.ts\").RecordCoordination | ProjectStateDatabase>;\n readonly reserveAttempt: (attempt: Attempt) => Effect.Effect<RunnerRecordAttempt, RunnerRecordWriteError, ProjectStateDatabase>;\n readonly noteSealedOrMarkIncomplete: (attempt: Attempt, sealed: SealedAttemptAssertions) => Effect.Effect<void, never>;\n readonly completeAttemptOrMarkIncomplete: (attempt: Attempt, result: EvalResult) => Effect.Effect<RunnerRecordAttempt | undefined, never, ProjectStateDatabase>;\n readonly markNotDispatched: (attempt: Attempt) => void;\n readonly publish: (completedAt: number, mode: \"normal\" | \"interrupted\") => Effect.Effect<readonly RecordSealReceipt[], RunnerRecordWriteError, ProjectStateDatabase>;\n}\n/** Current preview preserves the read Scope and never creates a Run row. */\nexport function withRunnerCurrentReusePreview<A, E, R>(input: {\n readonly recordRoot: RecordRoot;\n readonly startedAt: number;\n readonly evals: readonly DiscoveredEval[];\n readonly runs: readonly AgentRun[];\n readonly reuse: RunnerRecordReuseInput;\n readonly use: (preview: {\n readonly reusePlan: ExecutionReusePlan;\n readonly readReadbacks: () => Effect.Effect<readonly CurrentReuseReadback[], RecordReaderReadError | CurrentReuseReadbackPlanInvalid>;\n }) => Effect.Effect<A, E, R>;\n}): Effect.Effect<A, E | RunnerRecordOpenError, R | import(\"effect\").Scope.Scope | import(\"../coordination/record-leases.ts\").RecordCoordination | ProjectStateDatabase> {\n return Effect.scoped(Effect.gen(function* () {\n const startedAt = runnerRecordUtcMillis(input.startedAt);\n if (Result.isFailure(startedAt))\n return yield* Effect.fail(startedAt.failure);\n const planned = yield* Effect.forEach(input.runs, (run) => planRunnerRecordRun({\n run,\n evals: input.evals,\n reuse: input.reuse,\n }), { concurrency: 1 });\n const previewRuns: TargetRun[] = [];\n for (const plan of planned) {\n const runId = previewRunnerRunId(plan.run);\n if (Result.isFailure(runId))\n return yield* Effect.fail(runId.failure);\n previewRuns.push(targetForRunnerRecordRun({ planned: plan, runId: runId.success, startedAt: startedAt.success }));\n }\n const target = Object.freeze({\n invocationId: `preview-${createHash(\"sha256\").update(String(input.startedAt), \"utf8\").digest(\"hex\")}`,\n runs: Object.freeze(previewRuns),\n });\n const rootPath = recordRootPaths(input.recordRoot)?.portableRoot;\n if (rootPath === undefined)\n return yield* Effect.fail(new RecordRootInvalid({ code: \"record-root-invalid\" }));\n const recordDatabase = recordSqlitePath(rootPath);\n if (!existsSync(recordDatabase)) {\n const reusePlan = yield* planProjectTargetReuseWithoutSources({ target, policy: input.reuse.policy });\n return yield* input.use({\n reusePlan,\n readReadbacks: () => Effect.succeed(Object.freeze([])),\n });\n }\n const { reusePlan, readbacks } = yield* Effect.scoped(Effect.gen(function* () {\n const reader = yield* recordHost.openRead({ root: input.recordRoot });\n const reusePlan = yield* planProjectTargetReuse({ reader, target, policy: input.reuse.policy });\n const readbacks = yield* readCurrentExecutionReusePlanReadbacks({ reader, plan: reusePlan }).pipe(Effect.mapError((cause): RunnerSessionOpenFailed => ({ code: \"runner-session-open-failed\", cause })));\n return { reusePlan, readbacks };\n }));\n return yield* input.use({\n reusePlan,\n readReadbacks: () => Effect.succeed(readbacks),\n });\n }));\n}\nfunction attemptInvalid(): RunnerRecordAttemptInvalid {\n return Object.freeze({ code: \"runner-record-attempt-invalid\" as const });\n}\nfunction unsealedAttempt(slotId: SlotId): RunnerRecordUnsealedAttempt {\n return Object.freeze({ code: \"runner-record-attempt-unsealed\" as const, slotId });\n}\nfunction membershipStateInvalid(slotId: SlotId): RunnerRecordMembershipStateInvalid {\n return Object.freeze({ code: \"runner-record-membership-state-invalid\" as const, slotId });\n}\nfunction attemptPublicationFailed(locator: AttemptLocator, cause: unknown): RunnerRecordAttemptPublicationFailed {\n const detail = cause instanceof Error\n ? cause.message\n : typeof cause === \"object\" && cause !== null && typeof Reflect.get(cause, \"message\") === \"string\"\n ? String(Reflect.get(cause, \"message\"))\n : typeof cause === \"object\" && cause !== null && typeof Reflect.get(cause, \"code\") === \"string\"\n ? String(Reflect.get(cause, \"code\"))\n : String(cause);\n return Object.freeze({\n code: \"runner-record-attempt-publication-failed\" as const,\n locator,\n cause,\n message: `Attempt publication failed for ${locator}: ${detail}`,\n });\n}\nfunction publishStateInvalid(runId: RunId): RunnerRecordPublishStateInvalid {\n return Object.freeze({ code: \"runner-record-publish-state-invalid\" as const, runId });\n}\n/**\n * Opens one new per-Experiment Run session, selects only sealed historical\n * Runs, and writes carry references before dispatch. No global Record writer\n * lock or superseded draft/attachment contract participates in this boundary.\n */\nexport function openRunnerRecordCoordinator(input: {\n readonly recordRoot: RecordRoot;\n readonly startedAt: number;\n readonly evals: readonly DiscoveredEval[];\n readonly runs: readonly AgentRun[];\n readonly reuse: RunnerRecordReuseInput;\n readonly session?: SessionTracker;\n}): Effect.Effect<RunnerRecordCoordinator, RunnerRecordOpenError, import(\"effect\").Scope.Scope | import(\"../record/platform/services.ts\").RecordEntropy | import(\"../coordination/record-leases.ts\").RecordCoordination | ProjectStateDatabase> {\n return Effect.gen(function* () {\n const rootPath = recordRootPaths(input.recordRoot)?.portableRoot;\n if (rootPath === undefined)\n return yield* Effect.fail(new RecordRootInvalid({ code: \"record-root-invalid\" }));\n const seenExperiments = new Set<string>();\n for (const run of input.runs) {\n if (seenExperiments.has(run.experimentId)) {\n return yield* Effect.fail({\n code: \"runner-record-target-identity-invalid\" as const,\n kind: \"invocation\" as const,\n value: `duplicate experimentId ${JSON.stringify(run.experimentId)}`,\n });\n }\n seenExperiments.add(run.experimentId);\n }\n const startedAt = runnerRecordUtcMillis(input.startedAt);\n if (Result.isFailure(startedAt))\n return yield* Effect.fail(startedAt.failure);\n const planned = yield* Effect.forEach(input.runs, (run) => planRunnerRecordRun({\n run,\n evals: input.evals,\n reuse: input.reuse,\n }), { concurrency: 1 });\n const invocationId = input.session?.sessionId ?? createHash(\"sha256\")\n .update(`${input.startedAt}\\u0000${planned.map((entry) => entry.run.experimentId).join(\"\\u0000\")}`, \"utf8\")\n .digest(\"hex\");\n const openedRuns = yield* Effect.forEach(planned, (plan) => recordHost.createRun({\n root: input.recordRoot,\n experimentId: plan.experimentId,\n context: plan.context,\n startedAt: startedAt.success,\n expectedSlots: plan.expectedSlots,\n writerGeneration: createRunWriterGeneration(`${invocationId}:${plan.experimentId}`),\n }).pipe(Effect.map((session) => {\n const writerGeneration = writerGenerationForRunSession(session);\n if (writerGeneration === undefined)\n throw new Error(\"Run writer generation is unavailable\");\n return Object.freeze({ plan, session, writerGeneration });\n })), { concurrency: 1 });\n if (input.session !== undefined) {\n const startedAtIso = new Date(input.startedAt).toISOString();\n yield* input.session.start({\n runIds: new Map(openedRuns.map(({ plan, session }) => [plan.experimentId, String(session.runId)])),\n agentRuns: input.runs,\n startedAt: startedAtIso,\n invocationRuns: openedRuns.map(({ plan, session, writerGeneration }) => ({\n runId: String(session.runId),\n experimentId: plan.experimentId,\n writerGeneration,\n startedAt: startedAtIso,\n expectedSlots: plan.expectedSlots.map((slot) => ({\n slotId: String(slot.slotId), evalId: String(slot.evalId), attemptOrdinal: slot.attemptOrdinal,\n executionIdentityDigest: String(slot.executionIdentityDigest),\n })),\n })),\n }).pipe(Effect.mapError((cause): RunnerSessionOpenFailed => ({ code: \"runner-session-open-failed\", cause })));\n }\n const byRun = new Map<AgentRun, RunnerRecordRun>();\n const byRecordRunId = new Map<RunId, RunnerRecordRun>();\n const runIdsByExperiment = new Map<string, string>();\n const targetRuns: TargetRun[] = [];\n for (const { plan, session, writerGeneration } of openedRuns) {\n const target = targetForRunnerRecordRun({\n planned: plan,\n runId: session.runId,\n startedAt: startedAt.success,\n });\n const recordRun: RunnerRecordRun = {\n ...plan,\n session,\n target,\n attempts: new Map(),\n planSlots: new Map(),\n gapActions: new Map(),\n writerGeneration,\n };\n byRun.set(plan.run, recordRun);\n byRecordRunId.set(session.runId, recordRun);\n runIdsByExperiment.set(plan.run.experimentId, session.runId);\n targetRuns.push(target);\n }\n const target = Object.freeze({\n invocationId,\n runs: Object.freeze(targetRuns),\n });\n const { reusePlan, carriedResults } = yield* Effect.scoped(Effect.gen(function* () {\n const reader = yield* recordHost.openRead({ root: input.recordRoot });\n const reusePlan = yield* planProjectTargetReuse({ reader, target, policy: input.reuse.policy });\n const carriedResults = yield* readCurrentExecutionReusePlanResults({ reader, plan: reusePlan }).pipe(Effect.mapError((cause): RunnerSessionOpenFailed => ({ code: \"runner-session-open-failed\", cause })));\n return { reusePlan, carriedResults };\n }));\n const carriedAttemptsByKey = new Map<string, Set<number>>();\n for (const slot of reusePlan.slots) {\n const recordRun = byRecordRunId.get(slot.runId);\n if (recordRun === undefined)\n return yield* Effect.fail(membershipStateInvalid(slot.slotId));\n recordRun.planSlots.set(slot.slotId, slot);\n if (slot.state === \"reuse\") {\n yield* stagePlanningReference(recordRun.session, {\n slotId: slot.slotId,\n action: \"carried\",\n reference: slot.source.reference,\n });\n yield* bindAttemptReference(rootPath, {\n runId: String(recordRun.session.runId),\n writerGeneration: recordRun.writerGeneration,\n slotId: String(slot.slotId),\n action: \"carried\",\n publicationIdentity: slot.source.reference.publicationIdentity,\n deadlineEpochMs: Date.now() + 30000,\n }).pipe(Effect.mapError((cause): RunnerSessionOpenFailed => ({ code: \"runner-session-open-failed\", cause })));\n const entry = recordRun.slots.get(runnerRecordSlotKey(slot.evalId, slot.attempt));\n if (entry === undefined)\n return yield* Effect.fail(membershipStateInvalid(slot.slotId));\n const key = cacheKey(recordRun.run, entry.evalDef.id);\n const carried = carriedAttemptsByKey.get(key) ?? new Set<number>();\n carried.add(entry.attempt);\n carriedAttemptsByKey.set(key, carried);\n }\n else {\n recordRun.gapActions.set(slot.slotId, \"pending\");\n }\n }\n if (input.session !== undefined) {\n yield* input.session.applyCarriedAttempts(input.runs, carriedAttemptsByKey).pipe(Effect.mapError((cause): RunnerSessionOpenFailed => ({ code: \"runner-session-open-failed\", cause })));\n }\n let invocationWriteFailure: RunnerRecordWriteError | undefined;\n const writeFailuresByRun = new Map<RunnerRecordRun, RunnerRecordWriteError>();\n const noteFailure = (error: RunnerRecordWriteError, recordRun?: RunnerRecordRun): void => {\n if (recordRun === undefined) {\n if (invocationWriteFailure === undefined)\n invocationWriteFailure = error;\n return;\n }\n if (!writeFailuresByRun.has(recordRun))\n writeFailuresByRun.set(recordRun, error);\n };\n const lock = yield* Semaphore.make(1);\n const runForAttempt = (attempt: Attempt): RunnerRecordRun | undefined => byRun.get(attempt.run);\n const targetForAttempt = (attempt: Attempt): {\n readonly recordRun: RunnerRecordRun;\n readonly slotId: SlotId;\n readonly plan: ExecutionReusePlanSlot;\n } | undefined => {\n const recordRun = runForAttempt(attempt);\n if (recordRun === undefined)\n return undefined;\n const entry = recordRun.slots.get(runnerRecordSlotKey(attempt.evalDef.id, attempt.attempt));\n if (entry === undefined)\n return undefined;\n const plan = recordRun.planSlots.get(entry.slot.slotId);\n return plan === undefined ? undefined : { recordRun, slotId: entry.slot.slotId, plan };\n };\n const adoptLatePublishedAttempt = (attempt: Attempt) => lock.withPermits(1)(Effect.gen(function* () {\n const current = targetForAttempt(attempt);\n if (current === undefined\n || current.plan.state !== \"gap\"\n || current.recordRun.gapActions.get(current.slotId) !== \"pending\")\n return false;\n const refreshed = yield* Effect.scoped(Effect.gen(function* () {\n const freshReader = yield* recordHost.openRead({ root: input.recordRoot });\n return yield* planProjectTargetReuse({ reader: freshReader, target, policy: input.reuse.policy });\n }));\n const replacement = refreshed.slots.find((slot) => slot.runId === current.recordRun.target.runId && slot.slotId === current.slotId);\n if (replacement?.state !== \"reuse\")\n return false;\n yield* stagePlanningReference(current.recordRun.session, {\n slotId: current.slotId,\n action: \"carried\",\n reference: replacement.source.reference,\n });\n yield* bindAttemptReference(rootPath, {\n runId: String(current.recordRun.session.runId),\n writerGeneration: current.recordRun.writerGeneration,\n slotId: String(current.slotId),\n action: \"carried\",\n publicationIdentity: replacement.source.reference.publicationIdentity,\n deadlineEpochMs: Date.now() + 30000,\n }).pipe(Effect.mapError(() => publishStateInvalid(current.recordRun.session.runId)));\n current.recordRun.planSlots.set(current.slotId, replacement);\n current.recordRun.gapActions.delete(current.slotId);\n return true;\n }));\n const reserveAttempt = (attempt: Attempt): Effect.Effect<RunnerRecordAttempt, RunnerRecordWriteError, ProjectStateDatabase> => {\n const targetSlot = targetForAttempt(attempt);\n return lock.withPermits(1)(Effect.gen(function* () {\n if (targetSlot === undefined\n || targetSlot.plan.state !== \"gap\"\n || targetSlot.recordRun.gapActions.get(targetSlot.slotId) !== \"pending\") {\n return yield* Effect.fail(attemptInvalid());\n }\n const session = yield* targetSlot.recordRun.session.createAttempt({ slotId: targetSlot.slotId });\n const publicAttempt = Object.freeze({\n slotId: targetSlot.slotId,\n attemptId: session.attemptId,\n locator: encodeAttemptLocator(session.attemptId),\n });\n targetSlot.recordRun.attempts.set(targetSlot.slotId, {\n attempt,\n session,\n public: publicAttempt,\n completed: false,\n });\n targetSlot.recordRun.gapActions.set(targetSlot.slotId, \"reserved\");\n return publicAttempt;\n })).pipe(Effect.tapError((error) => Effect.sync(() => noteFailure(error, targetSlot?.recordRun ?? runForAttempt(attempt)))));\n };\n const noteSealedOrMarkIncomplete = (attempt: Attempt, sealed: SealedAttemptAssertions): Effect.Effect<void, never> => Effect.sync(() => {\n const targetSlot = targetForAttempt(attempt);\n const active = targetSlot === undefined\n ? undefined\n : targetSlot.recordRun.attempts.get(targetSlot.slotId);\n if (targetSlot === undefined\n || targetSlot.plan.state !== \"gap\"\n || targetSlot.recordRun.gapActions.get(targetSlot.slotId) !== \"reserved\"\n || active === undefined\n || active.attempt !== attempt\n || active.sealed !== undefined) {\n noteFailure(attemptInvalid(), targetSlot?.recordRun ?? runForAttempt(attempt));\n return;\n }\n active.sealed = sealed;\n });\n const completeAttempt = (attempt: Attempt, result: EvalResult): Effect.Effect<RunnerRecordAttempt, RunnerRecordWriteError, ProjectStateDatabase> => Effect.suspend<RunnerRecordAttempt, RunnerRecordWriteError, ProjectStateDatabase>(() => {\n const targetSlot = targetForAttempt(attempt);\n const active = targetSlot === undefined\n ? undefined\n : targetSlot.recordRun.attempts.get(targetSlot.slotId);\n if (targetSlot === undefined\n || targetSlot.plan.state !== \"gap\"\n || targetSlot.recordRun.gapActions.get(targetSlot.slotId) !== \"reserved\"\n || active === undefined\n || active.attempt !== attempt\n || active.completed) {\n return Effect.fail(attemptInvalid());\n }\n const assertions = active.sealed === undefined\n ? undefined\n : createRunnerAssertionsAttachment(active.sealed);\n if (assertions !== undefined && Result.isFailure(assertions))\n return Effect.fail(assertions.failure);\n if (active.sealed === undefined || assertions === undefined || Result.isFailure(assertions)) {\n return Effect.fail(membershipStateInvalid(targetSlot.slotId));\n }\n return Effect.gen(function* () {\n const sourcePlan = createRunnerSourceWritePlan([Object.freeze({\n slotId: targetSlot.slotId,\n result,\n assertionEntryIds: assertions.success.entryIds,\n })]);\n if (Result.isFailure(sourcePlan)) {\n return yield* Effect.fail(Object.freeze({\n code: \"runner-record-sources-invalid\" as const,\n issue: sourcePlan.failure,\n }));\n }\n const closedAssertions = createRunnerAssertionsAttachment(active.sealed!, {\n entryIds: assertions.success.entryIds,\n sourceSites: sourcePlan.success.sourceSitesBySlot.get(targetSlot.slotId),\n });\n if (Result.isFailure(closedAssertions))\n return yield* Effect.fail(closedAssertions.failure);\n yield* active.session.records.write(NiceEvalRecordAttachments.assertions, closedAssertions.success.attachment);\n yield* active.session.records.write(NiceEvalRecordAttachments.attemptCost, createAttemptCostAttachment(result));\n const sourceReceipts = yield* createAttemptObservabilityAttachments({ result, sealed: active.sealed! });\n if (sourceReceipts.agentTurns !== undefined) {\n yield* active.session.records.write(NiceEvalRecordAttachments.agentTurns, sourceReceipts.agentTurns);\n }\n if (sourceReceipts.sandboxCommands !== undefined) {\n yield* active.session.records.write(NiceEvalRecordAttachments.sandboxCommands, sourceReceipts.sandboxCommands);\n }\n yield* active.session.records.write(NiceEvalRecordAttachments.runnerActivities.attempt, sourceReceipts.runnerActivities);\n yield* active.session.records.write(NiceEvalRecordAttachments.runnerDiagnostics.attempt, sourceReceipts.runnerDiagnostics);\n const turnContexts = createRunnerTurnContextsAttachment({ result, sourcePlan: sourcePlan.success });\n if (Result.isFailure(turnContexts)) {\n return yield* Effect.fail(Object.freeze({\n code: \"runner-record-sources-invalid\" as const,\n issue: turnContexts.failure,\n }));\n }\n if (turnContexts.success !== undefined) {\n yield* active.session.records.write(NiceEvalRecordAttachments.turnContexts, turnContexts.success);\n }\n const fileChanges = createAttemptFileChangesAttachment(result);\n if (fileChanges !== undefined) {\n yield* active.session.records.write(NiceEvalRecordAttachments.fileChanges, fileChanges);\n }\n const attachmentSnapshot = adapterAttachmentsForResult(result);\n const artifacts = createAttemptArtifactsAttachment(result, attachmentSnapshot);\n const judgeUsage = judgeUsageForResult(result, closedAssertions.success.entryIds);\n if (judgeUsage !== undefined)\n yield* active.session.records.write(NiceEvalRecordAttachments.judgeUsage, judgeUsage);\n yield* active.session.records.write(NiceEvalRecordAttachments.attemptNotes, attemptNotesForResult(result));\n const adapterUsage = adapterUsageForResult(result);\n const executionTraces = adapterExecutionTracesForResult(result);\n if (adapterUsage !== undefined) {\n yield* active.session.records.write(NiceEvalRecordAttachments.adapterUsage, adapterUsage);\n }\n if (artifacts !== undefined) {\n yield* active.session.records.write(NiceEvalRecordAttachments.artifacts.attempt, artifacts);\n }\n if (executionTraces !== undefined && executionTraces.traces.length > 0) {\n validateExecutionTracePublication(executionTraces, attachmentSnapshot?.artifacts ?? []);\n yield* active.session.records.appendAll(executionTracesRecordCollection, Stream.fromIterable(executionTraces.traces.flatMap((trace) => trace.records)));\n yield* active.session.records.close(executionTracesRecordCollection, executionTraces.failure === undefined\n ? { state: \"complete\" }\n : {\n state: \"partial\",\n limitations: [{ code: \"capture-failed\", stage: \"adapter\" }],\n });\n }\n yield* active.session.complete(recordAttemptOutcome(result));\n const closureBytes = new TextEncoder().encode(JSON.stringify(attemptPublicationClosure(Object.freeze({\n runId: String(targetSlot.recordRun.session.runId),\n experimentId: targetSlot.recordRun.experimentId,\n context: targetSlot.recordRun.context,\n startedAt: targetSlot.recordRun.target.startedAt,\n completedAt: Date.now(),\n expectedSlots: targetSlot.recordRun.expectedSlots,\n }))));\n yield* publishOriginAttempt(rootPath, {\n runId: String(targetSlot.recordRun.session.runId),\n writerGeneration: targetSlot.recordRun.writerGeneration,\n slotId: String(targetSlot.slotId),\n attemptId: String(active.public.attemptId),\n attemptLocator: String(active.public.locator),\n closureBytes,\n closureDigest: createHash(\"sha256\").update(closureBytes).digest(\"hex\"),\n deadlineEpochMs: Date.now() + 30000,\n }).pipe(Effect.mapError((cause) => attemptPublicationFailed(active.public.locator, cause)));\n active.result = result;\n active.assertionEntryIds = assertions.success.entryIds;\n active.completed = true;\n targetSlot.recordRun.gapActions.set(targetSlot.slotId, \"executed\");\n return active.public;\n });\n });\n const attachRunFacts = (recordRun: RunnerRecordRun, mode: \"normal\" | \"interrupted\"): Effect.Effect<void, RunnerRecordWriteError> => Effect.gen(function* () {\n const writeRecord = (effect: Effect.Effect<void, RecordWriteError, never>): Effect.Effect<void, RecordWriteError, never> => effect;\n const origins = [] as {\n readonly slotId: SlotId;\n readonly active: ActiveRunnerRecordAttempt;\n readonly result: EvalResult;\n readonly sealed: SealedAttemptAssertions;\n readonly assertionEntryIds: readonly AssertionEntryId[];\n }[];\n for (const [slotId, state] of recordRun.gapActions) {\n if (state !== \"executed\")\n continue;\n const active = recordRun.attempts.get(slotId);\n if (active === undefined)\n return yield* Effect.fail(membershipStateInvalid(slotId));\n const result = active.result;\n const sealed = active?.sealed;\n const assertionEntryIds = active?.assertionEntryIds;\n if (result === undefined || sealed === undefined || assertionEntryIds === undefined)\n continue;\n origins.push(Object.freeze({ slotId, active, result, sealed, assertionEntryIds }));\n }\n const sources = createRunnerSourceWritePlan(origins.map(({ slotId, result, assertionEntryIds }) => Object.freeze({\n slotId,\n result,\n assertionEntryIds,\n })));\n if (Result.isFailure(sources)) {\n return yield* Effect.fail(Object.freeze({\n code: \"runner-record-sources-invalid\" as const,\n issue: sources.failure,\n }));\n }\n yield* writeRecord(recordRun.session.records.write(NiceEvalRecordAttachments.sources, sources.success.sources));\n const sourceReceipts = yield* createRunObservabilityAttachments(recordRun.run);\n if (sourceReceipts.runnerActivities !== undefined) {\n yield* writeRecord(recordRun.session.records.write(NiceEvalRecordAttachments.runnerActivities.run, sourceReceipts.runnerActivities));\n }\n if (sourceReceipts.runnerDiagnostics !== undefined) {\n yield* writeRecord(recordRun.session.records.write(NiceEvalRecordAttachments.runnerDiagnostics.run, sourceReceipts.runnerDiagnostics));\n }\n yield* writeRecord(recordRun.session.records.write(NiceEvalRecordAttachments.artifacts.run, createRunArtifactsAttachment()));\n });\n const pendingGap = (recordRun: RunnerRecordRun): SlotId | undefined => {\n for (const [slotId, state] of recordRun.gapActions) {\n if (state === \"pending\")\n return slotId;\n }\n return undefined;\n };\n return Object.freeze({\n reusePlan,\n readCarriedResults: () => Effect.succeed(carriedResults),\n runIdsByExperiment: new Map(runIdsByExperiment),\n publicationCutoff: () => currentPublicationCutoff(rootPath),\n carriedAttemptsByKey: new Map([...carriedAttemptsByKey].map(([key, attempts]) => [key, new Set(attempts)] as const)),\n adoptLatePublishedAttempt,\n reserveAttempt,\n noteSealedOrMarkIncomplete,\n completeAttemptOrMarkIncomplete: (attempt: Attempt, result: EvalResult) => completeAttempt(attempt, result).pipe(Effect.catch((error) => Effect.sync(() => {\n const target = targetForAttempt(attempt);\n const active = target === undefined ? undefined : target.recordRun.attempts.get(target.slotId);\n noteFailure(error.code === \"runner-record-assertions-invalid\" ||\n error.code === \"runner-record-attempt-publication-failed\" ||\n active === undefined\n ? error\n : attemptPublicationFailed(active.public.locator, error), target?.recordRun ?? runForAttempt(attempt));\n return undefined;\n })), Effect.ensuring(Effect.promise(() => releaseAdapterAttachments(result)))),\n markNotDispatched: (attempt: Attempt) => {\n const targetSlot = targetForAttempt(attempt);\n if (targetSlot !== undefined\n && targetSlot.plan.state === \"gap\"\n && targetSlot.recordRun.gapActions.get(targetSlot.slotId) === \"pending\") {\n targetSlot.recordRun.gapActions.set(targetSlot.slotId, \"not-dispatched\");\n }\n },\n publish: (completedAt: number, mode: \"normal\" | \"interrupted\") => Effect.gen(function* () {\n const recordRuns = [...byRun.values()];\n if (invocationWriteFailure !== undefined)\n return yield* Effect.fail(invocationWriteFailure);\n if (mode === \"normal\") {\n // A normal finish remains invocation-strict: a failure which can be\n // attributed to one Run still fails the call rather than allowing a\n // partial receipt to disguise it as ordinary completion.\n for (const recordRun of recordRuns) {\n const failure = writeFailuresByRun.get(recordRun);\n if (failure !== undefined)\n return yield* Effect.fail(failure);\n }\n }\n const completion = runnerRecordUtcMillis(completedAt);\n if (Result.isFailure(completion))\n return yield* Effect.fail(completion.failure);\n // A controlled interruption closes every reserved Attempt as\n // `interrupted` and every never-started gap as an interrupted terminal\n // Member. Only a Run-local writer failure remains non-publishable.\n // Abrupt process loss still has no opportunity to create `complete`.\n const incompleteRuns = mode === \"interrupted\"\n ? new Set(recordRuns.filter((recordRun) => writeFailuresByRun.has(recordRun)))\n : new Set<RunnerRecordRun>();\n if (mode === \"normal\") {\n // Normal completion is deliberately invocation-strict. A pending\n // gap means the scheduler failed to account for a Slot; a reserved\n // or otherwise unsettled Attempt is likewise not publishable.\n for (const recordRun of recordRuns) {\n const unsettledSlot = [...recordRun.gapActions.keys()].find((slotId) => {\n const active = recordRun.attempts.get(slotId);\n return recordRun.gapActions.get(slotId) === \"reserved\"\n || (active !== undefined && !active.completed);\n });\n if (unsettledSlot !== undefined)\n return yield* Effect.fail(unsealedAttempt(unsettledSlot));\n const unaccountedSlot = pendingGap(recordRun);\n if (unaccountedSlot !== undefined)\n return yield* Effect.fail(unsealedAttempt(unaccountedSlot));\n }\n }\n else {\n for (const recordRun of recordRuns) {\n if (incompleteRuns.has(recordRun))\n continue;\n for (const [slotId, state] of recordRun.gapActions) {\n if (state === \"pending\")\n recordRun.gapActions.set(slotId, \"interrupted\");\n if (state === \"reserved\") {\n const active = recordRun.attempts.get(slotId);\n if (active === undefined)\n return yield* Effect.fail(membershipStateInvalid(slotId));\n yield* discardAttemptWriteSession(active.session);\n recordRun.attempts.delete(slotId);\n recordRun.gapActions.set(slotId, \"interrupted\");\n }\n }\n }\n }\n const publishableRuns = recordRuns.filter((recordRun) => !incompleteRuns.has(recordRun));\n const publishOne = (recordRun: RunnerRecordRun): Effect.Effect<RecordSealReceipt, RunnerRecordWriteError, ProjectStateDatabase> => Effect.gen(function* () {\n yield* attachRunFacts(recordRun, mode);\n for (const [slotId, state] of recordRun.gapActions) {\n if (state === \"not-dispatched\" || state === \"interrupted\") {\n const absenceReason: RunAbsenceReason = mode === \"interrupted\"\n ? \"interrupted-before-publication\"\n : state === \"not-dispatched\"\n ? \"early-exit-satisfied\"\n : \"dispatch-failed\";\n yield* recordRun.session.recordTerminalMember({ slotId, action: state, absenceReason });\n }\n }\n const sealed = yield* recordRun.session.seal({ completedAt: completion.success });\n const absences = [...recordRun.gapActions].flatMap(([slotId, state]) => {\n if (state === \"executed\" && recordRun.attempts.get(slotId)?.completed === true)\n return [];\n const reason: RunAbsenceReason = mode === \"interrupted\"\n ? \"interrupted-before-publication\"\n : state === \"not-dispatched\"\n ? \"early-exit-satisfied\"\n : \"dispatch-failed\";\n return [{ slotId: String(slotId), reason }];\n });\n yield* closeRunResource(rootPath, {\n runId: String(recordRun.session.runId),\n writerGeneration: recordRun.writerGeneration,\n state: mode === \"interrupted\" ? \"interrupted\" : \"completed\",\n completedAt: new Date(completedAt).toISOString(),\n absences,\n deadlineEpochMs: Date.now() + 30000,\n }).pipe(Effect.mapError(() => publishStateInvalid(recordRun.session.runId)));\n return sealed;\n });\n if (mode === \"normal\") {\n // Normal completion remains typed and strict: the first Run failure\n // is an invocation failure, never a partial success receipt.\n return yield* Effect.forEach(publishableRuns, publishOne, { concurrency: 1 });\n }\n // SIGINT is different: each clean sibling receives its own complete\n // attempt. We deliberately observe an Exit per Run so one Attachment\n // or seal error cannot short-circuit subsequent safe siblings.\n const receipts: RecordSealReceipt[] = [];\n for (const recordRun of publishableRuns) {\n const exit = yield* Effect.exit(publishOne(recordRun));\n if (Exit.isSuccess(exit)) {\n receipts.push(exit.value);\n }\n else {\n const failure = Cause.findErrorOption(exit.cause);\n if (Option.isSome(failure)) {\n noteFailure(failure.value, recordRun);\n }\n else {\n noteFailure(publishStateInvalid(recordRun.session.runId), recordRun);\n }\n }\n }\n return Object.freeze(receipts);\n }),\n });\n });\n}\n"]}
|
package/dist/runner/report.cjs
CHANGED
|
@@ -45,7 +45,7 @@ function emitReporterEvent(registrations, event) {
|
|
|
45
45
|
function filterSummary(summary, ids) {
|
|
46
46
|
const results = summary.results.filter((r) => ids.has(r.id));
|
|
47
47
|
const reusedAttempts = summary.reusedAttempts.filter((attempt) => ids.has(attempt.target.evalId));
|
|
48
|
-
const sub = summarize(results, reusedAttempts, summary.startedAt, summary.durationMs, summary.name, summary.
|
|
48
|
+
const sub = summarize(results, reusedAttempts, summary.startedAt, summary.durationMs, summary.name, summary.beforeCaches);
|
|
49
49
|
// completedAt 用原值(summarize 会重新取 now);name 等其余字段原样保留。
|
|
50
50
|
return { ...summary, ...sub, completedAt: summary.completedAt };
|
|
51
51
|
}
|
|
@@ -91,7 +91,7 @@ function scopeReporter(r, ids, shape) {
|
|
|
91
91
|
return scoped;
|
|
92
92
|
}
|
|
93
93
|
/** 全局汇总:verdict 计数 + token / cost 折叠。按 attempt 计(eval 级折叠见 shared/verdict.ts)。不接收 agent/model —— 一次 Invocation 可能横跨多个配置,身份从逐条 `EvalResult` 读取。 */
|
|
94
|
-
function summarize(results, reusedAttempts, startedAt, durationMs, name,
|
|
94
|
+
function summarize(results, reusedAttempts, startedAt, durationMs, name, beforeCaches = Object.freeze({ total: 0, hit: 0, prepared: 0, failed: 0 })) {
|
|
95
95
|
const counts = { passed: 0, failed: 0, skipped: 0, errored: 0 };
|
|
96
96
|
let inTok = 0;
|
|
97
97
|
let outTok = 0;
|
|
@@ -123,7 +123,7 @@ function summarize(results, reusedAttempts, startedAt, durationMs, name, setupPr
|
|
|
123
123
|
estimatedCostUSD: hasEstimatedCost ? cost : undefined,
|
|
124
124
|
reusedAttempts: Object.freeze([...reusedAttempts]),
|
|
125
125
|
results,
|
|
126
|
-
|
|
126
|
+
beforeCaches,
|
|
127
127
|
};
|
|
128
128
|
}
|
|
129
129
|
//# sourceMappingURL=report.cjs.map
|