niceeval 0.15.1-canary.76 → 0.16.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/INDEX.md +45 -40
- package/dist/adapter-execution-trace.cjs.map +1 -1
- package/dist/adapter-execution-trace.d.cts +26 -0
- package/dist/adapter-execution-trace.d.mts +26 -0
- package/dist/adapter-execution-trace.d.ts +26 -0
- package/dist/adapter-usage.cjs.map +1 -1
- package/dist/adapter-usage.d.cts +9 -0
- package/dist/adapter-usage.d.mts +9 -0
- package/dist/adapter-usage.d.ts +9 -0
- package/dist/adapter.cjs +19 -4
- package/dist/adapter.cjs.map +1 -1
- package/dist/adapter.d.cts +37 -12
- package/dist/adapter.d.mts +37 -12
- package/dist/adapter.d.ts +37 -12
- package/dist/agents/ai-sdk.cjs +3 -0
- package/dist/agents/ai-sdk.cjs.map +1 -1
- package/dist/agents/bub.cjs +3 -0
- package/dist/agents/bub.cjs.map +1 -1
- package/dist/agents/claude-code-native.cjs +28 -2
- package/dist/agents/claude-code-native.cjs.map +1 -1
- package/dist/agents/claude-code.cjs +3 -0
- package/dist/agents/claude-code.cjs.map +1 -1
- package/dist/agents/codex.cjs +3 -0
- package/dist/agents/codex.cjs.map +1 -1
- package/dist/agents/coding-cli-versions.cjs +9 -10
- package/dist/agents/coding-cli-versions.cjs.map +1 -1
- package/dist/agents/coding-cli-versions.d.cts +1 -1
- package/dist/agents/coding-cli-versions.d.mts +1 -1
- package/dist/agents/coding-cli-versions.d.ts +1 -1
- package/dist/agents/deepseek-harness.cjs +3 -0
- package/dist/agents/deepseek-harness.cjs.map +1 -1
- package/dist/agents/hermes.cjs +3 -0
- package/dist/agents/hermes.cjs.map +1 -1
- package/dist/agents/index.cjs.map +1 -1
- package/dist/agents/index.d.cts +3 -2
- package/dist/agents/index.d.mts +3 -2
- package/dist/agents/index.d.ts +3 -2
- package/dist/agents/omp.cjs +3 -0
- package/dist/agents/omp.cjs.map +1 -1
- package/dist/agents/openai-compat.cjs +6 -0
- package/dist/agents/openai-compat.cjs.map +1 -1
- package/dist/agents/openclaw.cjs +3 -0
- package/dist/agents/openclaw.cjs.map +1 -1
- package/dist/agents/opencode.cjs +3 -0
- package/dist/agents/opencode.cjs.map +1 -1
- package/dist/agents/sdk-streams.cjs +9 -0
- package/dist/agents/sdk-streams.cjs.map +1 -1
- package/dist/agents/ui-message-stream.cjs +3 -0
- package/dist/agents/ui-message-stream.cjs.map +1 -1
- package/dist/assertions/api.cjs.map +1 -1
- package/dist/assertions/api.d.cts +27 -5
- package/dist/assertions/api.d.mts +27 -5
- package/dist/assertions/api.d.ts +27 -5
- package/dist/assertions/collection.cjs +6 -0
- package/dist/assertions/collection.cjs.map +1 -1
- package/dist/assertions/collection.d.cts +4 -2
- package/dist/assertions/collection.d.mts +4 -2
- package/dist/assertions/collection.d.ts +4 -2
- package/dist/assertions/collection.js +12 -8
- package/dist/assertions/context-match.cjs +70 -0
- package/dist/assertions/context-match.cjs.map +1 -0
- package/dist/assertions/context-match.d.cts +107 -0
- package/dist/assertions/context-match.d.mts +107 -0
- package/dist/assertions/context-match.d.ts +107 -0
- package/dist/assertions/context-match.js +12 -0
- package/dist/assertions/context-match.js.map +1 -0
- package/dist/assertions/full-content.cjs +109 -0
- package/dist/assertions/full-content.cjs.map +1 -0
- package/dist/assertions/full-content.d.cts +6 -0
- package/dist/assertions/full-content.d.mts +6 -0
- package/dist/assertions/full-content.d.ts +6 -0
- package/dist/assertions/full-content.js +12 -0
- package/dist/assertions/full-content.js.map +1 -0
- package/dist/assertions/judge-presets.cjs +2 -34
- package/dist/assertions/judge-presets.cjs.map +1 -1
- package/dist/assertions/judge-presets.d.cts +6 -9
- package/dist/assertions/judge-presets.d.mts +6 -9
- package/dist/assertions/judge-presets.d.ts +6 -9
- package/dist/assertions/judge-presets.js +8 -8
- package/dist/assertions/judge.cjs +107 -29
- package/dist/assertions/judge.cjs.map +1 -1
- package/dist/assertions/judge.d.cts +2 -0
- package/dist/assertions/judge.d.mts +2 -0
- package/dist/assertions/judge.d.ts +2 -0
- package/dist/assertions/match.cjs +244 -5
- package/dist/assertions/match.cjs.map +1 -1
- package/dist/assertions/match.d.cts +43 -3
- package/dist/assertions/match.d.mts +43 -3
- package/dist/assertions/match.d.ts +43 -3
- package/dist/assertions/match.js +88 -78
- package/dist/assertions/material.cjs +520 -0
- package/dist/assertions/material.cjs.map +1 -0
- package/dist/assertions/material.d.cts +56 -0
- package/dist/assertions/material.d.mts +56 -0
- package/dist/assertions/material.d.ts +56 -0
- package/dist/assertions/material.js +20 -0
- package/dist/assertions/material.js.map +1 -0
- package/dist/assertions/record/attachment.cjs +5 -2
- package/dist/assertions/record/attachment.cjs.map +1 -1
- package/dist/assertions/record/codec.cjs +2 -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 +6 -1
- package/dist/assertions/record/model.d.mts +6 -1
- package/dist/assertions/record/model.d.ts +6 -1
- package/dist/assertions/runtime.cjs +207 -14
- package/dist/assertions/runtime.cjs.map +1 -1
- package/dist/assertions/runtime.d.cts +9 -0
- package/dist/assertions/runtime.d.mts +9 -0
- package/dist/assertions/runtime.d.ts +9 -0
- package/dist/assertions/runtime.js +14 -8
- package/dist/assertions/score-match-audit.cjs +18 -8
- package/dist/assertions/score-match-audit.cjs.map +1 -1
- package/dist/assertions/score-match-gateway.cjs +83 -25
- package/dist/assertions/score-match-gateway.cjs.map +1 -1
- package/dist/assertions/score-match-gateway.d.cts +2 -0
- package/dist/assertions/score-match-gateway.d.mts +2 -0
- package/dist/assertions/score-match-gateway.d.ts +2 -0
- package/dist/assertions/value-composition.test-d.cjs +77 -0
- package/dist/assertions/value-composition.test-d.cjs.map +1 -0
- package/dist/assertions/value-composition.test-d.d.cts +1 -0
- package/dist/assertions/value-composition.test-d.d.mts +1 -0
- package/dist/assertions/value-composition.test-d.d.ts +1 -0
- package/dist/assertions/value-composition.test-d.js +4 -0
- package/dist/assertions/value-composition.test-d.js.map +1 -0
- package/dist/context/assert-first.cjs +207 -213
- package/dist/context/assert-first.cjs.map +1 -1
- package/dist/context/assert-first.d.cts +49 -23
- package/dist/context/assert-first.d.mts +49 -23
- package/dist/context/assert-first.d.ts +49 -23
- package/dist/context/session.cjs +111 -9
- package/dist/context/session.cjs.map +1 -1
- package/dist/context/session.d.cts +18 -0
- package/dist/context/session.d.mts +18 -0
- package/dist/context/session.d.ts +18 -0
- package/dist/define.cjs +17 -1
- package/dist/define.cjs.map +1 -1
- package/dist/eval/cli/contribution.cjs +2 -0
- package/dist/eval/cli/contribution.cjs.map +1 -1
- package/dist/eval/host/index.cjs +2 -0
- package/dist/eval/host/index.cjs.map +1 -1
- package/dist/eval/record/evaluation.cjs +3 -0
- package/dist/eval/record/evaluation.cjs.map +1 -1
- package/dist/eval/record/membership-provenance.d.cts +15 -15
- package/dist/eval/record/membership-provenance.d.mts +15 -15
- package/dist/eval/record/membership-provenance.d.ts +15 -15
- package/dist/eval/record/score.cjs +7 -0
- package/dist/eval/record/score.cjs.map +1 -1
- package/dist/eval/record/sealed-assertion.cjs +3 -0
- package/dist/eval/record/sealed-assertion.cjs.map +1 -1
- package/dist/eval/record/verdict.cjs +7 -0
- package/dist/eval/record/verdict.cjs.map +1 -1
- package/dist/expect/index.cjs +8 -2
- package/dist/expect/index.cjs.map +1 -1
- package/dist/expect/index.d.cts +9 -4
- package/dist/expect/index.d.mts +9 -4
- package/dist/expect/index.d.ts +9 -4
- package/dist/expect/index.js +72 -62
- package/dist/expect/index.mjs +72 -62
- package/dist/experiment/host/cli/contribution.cjs +37 -23
- package/dist/experiment/host/cli/contribution.cjs.map +1 -1
- package/dist/experiment/host/cli/contribution.d.cts +9 -1
- package/dist/experiment/host/cli/contribution.d.mts +9 -1
- package/dist/experiment/host/cli/contribution.d.ts +9 -1
- package/dist/experiment/host/current.cjs +74 -0
- package/dist/experiment/host/current.cjs.map +1 -0
- package/dist/experiment/host/current.d.cts +33 -0
- package/dist/experiment/host/current.d.mts +33 -0
- package/dist/experiment/host/current.d.ts +33 -0
- package/dist/experiment/host/current.js +10 -0
- package/dist/experiment/host/current.js.map +1 -0
- package/dist/experiment/host/index.cjs +17 -174
- package/dist/experiment/host/index.cjs.map +1 -1
- package/dist/experiment/host/index.d.cts +8 -54
- package/dist/experiment/host/index.d.mts +8 -54
- package/dist/experiment/host/index.d.ts +8 -54
- package/dist/experiment/host/operations.cjs +33 -10
- package/dist/experiment/host/operations.cjs.map +1 -1
- package/dist/experiment/host/operations.d.cts +29 -1
- package/dist/experiment/host/operations.d.mts +29 -1
- package/dist/experiment/host/operations.d.ts +29 -1
- package/dist/experiment/host/operations.js +6 -4
- package/dist/experiment/host/requirements.cjs +3 -0
- package/dist/experiment/host/requirements.cjs.map +1 -0
- package/dist/experiment/host/requirements.d.cts +3 -0
- package/dist/experiment/host/requirements.d.mts +3 -0
- package/dist/experiment/host/requirements.d.ts +3 -0
- package/dist/experiment/host/requirements.js +4 -0
- package/dist/experiment/host/requirements.js.map +1 -0
- package/dist/experiment/host/runtime.cjs +179 -0
- package/dist/experiment/host/runtime.cjs.map +1 -0
- package/dist/experiment/host/runtime.d.cts +79 -0
- package/dist/experiment/host/runtime.d.mts +79 -0
- package/dist/experiment/host/runtime.d.ts +79 -0
- package/dist/experiment/host/runtime.js +6 -0
- package/dist/experiment/host/runtime.js.map +1 -0
- package/dist/experiment/host/types.cjs.map +1 -1
- package/dist/experiment/host/types.d.cts +17 -16
- package/dist/experiment/host/types.d.mts +17 -16
- package/dist/experiment/host/types.d.ts +17 -16
- package/dist/fresh-import.cjs +2 -1
- package/dist/fresh-import.cjs.map +1 -1
- package/dist/index.cjs +4 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -6
- package/dist/index.d.mts +12 -6
- package/dist/index.d.ts +12 -6
- package/dist/index.js +32 -30
- package/dist/index.mjs +32 -30
- package/dist/inspection/artifacts.cjs +83 -54
- package/dist/inspection/artifacts.cjs.map +1 -1
- package/dist/inspection/artifacts.d.cts +8 -0
- package/dist/inspection/artifacts.d.mts +8 -0
- package/dist/inspection/artifacts.d.ts +8 -0
- package/dist/inspection/artifacts.js +2 -0
- package/dist/inspection/assertions.cjs +4 -1
- package/dist/inspection/assertions.cjs.map +1 -1
- package/dist/inspection/cli/contribution.cjs +27 -4
- package/dist/inspection/cli/contribution.cjs.map +1 -1
- package/dist/inspection/cli/contribution.d.cts +2 -1
- package/dist/inspection/cli/contribution.d.mts +2 -1
- package/dist/inspection/cli/contribution.d.ts +2 -1
- package/dist/inspection/execution-traces.cjs +114 -8
- package/dist/inspection/execution-traces.cjs.map +1 -1
- package/dist/inspection/execution-traces.d.cts +38 -0
- package/dist/inspection/execution-traces.d.mts +38 -0
- package/dist/inspection/execution-traces.d.ts +38 -0
- package/dist/inspection/facts.cjs +12 -0
- package/dist/inspection/facts.cjs.map +1 -1
- package/dist/inspection/limits.cjs +5 -1
- package/dist/inspection/limits.cjs.map +1 -1
- package/dist/inspection/limits.d.cts +4 -0
- package/dist/inspection/limits.d.mts +4 -0
- package/dist/inspection/limits.d.ts +4 -0
- package/dist/inspection/limits.js +6 -2
- package/dist/inspection/overview.cjs +74 -33
- package/dist/inspection/overview.cjs.map +1 -1
- package/dist/inspection/overview.d.cts +19 -1
- package/dist/inspection/overview.d.mts +19 -1
- package/dist/inspection/overview.d.ts +19 -1
- package/dist/inspection/overview.js +4 -2
- package/dist/inspection/project-input.cjs +9 -0
- package/dist/inspection/project-input.cjs.map +1 -0
- package/dist/inspection/project-input.d.cts +20 -0
- package/dist/inspection/project-input.d.mts +20 -0
- package/dist/inspection/project-input.d.ts +20 -0
- package/dist/inspection/project-input.js +8 -0
- package/dist/inspection/project-input.js.map +1 -0
- package/dist/inspection/project-result.cjs +60 -0
- package/dist/inspection/project-result.cjs.map +1 -0
- package/dist/inspection/project-result.d.cts +1264 -0
- package/dist/inspection/project-result.d.mts +1264 -0
- package/dist/inspection/project-result.d.ts +1264 -0
- package/dist/inspection/project-result.js +10 -0
- package/dist/inspection/project-result.js.map +1 -0
- package/dist/inspection/project-source.cjs +109 -0
- package/dist/inspection/project-source.cjs.map +1 -0
- package/dist/inspection/project-source.d.cts +10 -0
- package/dist/inspection/project-source.d.mts +10 -0
- package/dist/inspection/project-source.d.ts +10 -0
- package/dist/inspection/project-source.js +6 -0
- package/dist/inspection/project-source.js.map +1 -0
- package/dist/inspection/project.cjs +100 -0
- package/dist/inspection/project.cjs.map +1 -0
- package/dist/inspection/project.d.cts +3 -0
- package/dist/inspection/project.d.mts +3 -0
- package/dist/inspection/project.d.ts +3 -0
- package/dist/inspection/project.js +6 -0
- package/dist/inspection/project.js.map +1 -0
- package/dist/inspection/protocol.cjs +19 -9
- package/dist/inspection/protocol.cjs.map +1 -1
- package/dist/inspection/protocol.d.cts +5506 -38189
- package/dist/inspection/protocol.d.mts +5506 -38189
- package/dist/inspection/protocol.d.ts +5506 -38189
- package/dist/inspection/public.mjs +896 -84
- package/dist/inspection/query.cjs +2 -0
- package/dist/inspection/query.cjs.map +1 -1
- package/dist/inspection/results.cjs +234 -29
- package/dist/inspection/results.cjs.map +1 -1
- package/dist/inspection/results.d.cts +870 -13
- package/dist/inspection/results.d.mts +870 -13
- package/dist/inspection/results.d.ts +870 -13
- package/dist/inspection/results.js +36 -34
- package/dist/inspection/select.cjs +126 -14
- package/dist/inspection/select.cjs.map +1 -1
- package/dist/inspection/select.d.cts +1 -1
- package/dist/inspection/select.d.mts +1 -1
- package/dist/inspection/select.d.ts +1 -1
- package/dist/inspection/source.cjs +4 -0
- package/dist/inspection/source.cjs.map +1 -1
- package/dist/inspection/sources.cjs +5 -0
- package/dist/inspection/sources.cjs.map +1 -1
- package/dist/inspection/trace.cjs +82 -84
- package/dist/inspection/trace.cjs.map +1 -1
- package/dist/inspection/trace.d.cts +7 -2
- package/dist/inspection/trace.d.mts +7 -2
- package/dist/inspection/trace.d.ts +7 -2
- package/dist/model-slots.cjs +35 -0
- package/dist/model-slots.cjs.map +1 -0
- package/dist/model-slots.d.cts +19 -0
- package/dist/model-slots.d.mts +19 -0
- package/dist/model-slots.d.ts +19 -0
- package/dist/model-slots.js +8 -0
- package/dist/model-slots.js.map +1 -0
- package/dist/o11y/adapter-call-price.cjs +4 -0
- package/dist/o11y/adapter-call-price.cjs.map +1 -1
- package/dist/o11y/adapter-call-price.d.cts +24 -0
- package/dist/o11y/adapter-call-price.d.mts +24 -0
- package/dist/o11y/adapter-call-price.d.ts +24 -0
- package/dist/o11y/adapter-call-price.js +6 -2
- package/dist/o11y/adapter-usage-projection.cjs +158 -0
- package/dist/o11y/adapter-usage-projection.cjs.map +1 -0
- package/dist/o11y/adapter-usage-projection.d.cts +141 -0
- package/dist/o11y/adapter-usage-projection.d.mts +141 -0
- package/dist/o11y/adapter-usage-projection.d.ts +141 -0
- package/dist/o11y/adapter-usage-projection.js +20 -0
- package/dist/o11y/adapter-usage-projection.js.map +1 -0
- package/dist/o11y/eval-usage.cjs +149 -0
- package/dist/o11y/eval-usage.cjs.map +1 -0
- package/dist/o11y/eval-usage.d.cts +46 -0
- package/dist/o11y/eval-usage.d.mts +46 -0
- package/dist/o11y/eval-usage.d.ts +46 -0
- package/dist/o11y/eval-usage.js +8 -0
- package/dist/o11y/eval-usage.js.map +1 -0
- package/dist/o11y/judge-call-price.cjs +62 -0
- package/dist/o11y/judge-call-price.cjs.map +1 -0
- package/dist/o11y/judge-call-price.d.cts +3 -0
- package/dist/o11y/judge-call-price.d.mts +3 -0
- package/dist/o11y/judge-call-price.d.ts +3 -0
- package/dist/o11y/judge-call-price.js +6 -0
- package/dist/o11y/judge-call-price.js.map +1 -0
- package/dist/o11y/judge-usage-projection.cjs +134 -0
- package/dist/o11y/judge-usage-projection.cjs.map +1 -0
- package/dist/o11y/judge-usage-projection.d.cts +18 -0
- package/dist/o11y/judge-usage-projection.d.mts +18 -0
- package/dist/o11y/judge-usage-projection.d.ts +18 -0
- package/dist/o11y/judge-usage-projection.js +20 -0
- package/dist/o11y/judge-usage-projection.js.map +1 -0
- package/dist/o11y/judge-usage-receipt.cjs +135 -0
- package/dist/o11y/judge-usage-receipt.cjs.map +1 -0
- package/dist/o11y/judge-usage-receipt.d.cts +5 -0
- package/dist/o11y/judge-usage-receipt.d.mts +5 -0
- package/dist/o11y/judge-usage-receipt.d.ts +5 -0
- package/dist/o11y/judge-usage-receipt.js +6 -0
- package/dist/o11y/judge-usage-receipt.js.map +1 -0
- package/dist/o11y/judge-usage.cjs +171 -0
- package/dist/o11y/judge-usage.cjs.map +1 -0
- package/dist/o11y/judge-usage.d.cts +35 -0
- package/dist/o11y/judge-usage.d.mts +35 -0
- package/dist/o11y/judge-usage.d.ts +35 -0
- package/dist/o11y/judge-usage.js +6 -0
- package/dist/o11y/judge-usage.js.map +1 -0
- package/dist/plugin/contracts.cjs +2 -0
- package/dist/plugin/contracts.cjs.map +1 -1
- package/dist/plugin/link.cjs +7 -0
- package/dist/plugin/link.cjs.map +1 -1
- package/dist/record/attachment/protocol.cjs +8 -6
- package/dist/record/attachment/protocol.cjs.map +1 -1
- package/dist/record/attachment/protocol.d.cts +10 -0
- package/dist/record/attachment/protocol.d.mts +10 -0
- package/dist/record/attachment/protocol.d.ts +10 -0
- package/dist/record/attachment/protocol.js +38 -36
- 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/adapter-usage/definition.d.cts +1 -0
- package/dist/record/family/adapter-usage/definition.d.mts +1 -0
- package/dist/record/family/adapter-usage/definition.d.ts +1 -0
- package/dist/record/family/adapter-usage/persistence.cjs +1 -1
- package/dist/record/family/adapter-usage/persistence.cjs.map +1 -1
- package/dist/record/family/adapter-usage/persistence.d.cts +2 -1
- package/dist/record/family/adapter-usage/persistence.d.mts +2 -1
- package/dist/record/family/adapter-usage/persistence.d.ts +2 -1
- package/dist/record/family/adapter-usage/schema.cjs +21 -2
- package/dist/record/family/adapter-usage/schema.cjs.map +1 -1
- package/dist/record/family/adapter-usage/schema.d.cts +85 -0
- package/dist/record/family/adapter-usage/schema.d.mts +85 -0
- package/dist/record/family/adapter-usage/schema.d.ts +85 -0
- package/dist/record/family/adapter-usage/schema.js +18 -12
- package/dist/record/family/catalog.cjs +31 -27
- package/dist/record/family/catalog.cjs.map +1 -1
- package/dist/record/family/catalog.d.cts +94 -3
- package/dist/record/family/catalog.d.mts +94 -3
- package/dist/record/family/catalog.d.ts +94 -3
- package/dist/record/family/current.cjs +45 -42
- package/dist/record/family/current.cjs.map +1 -1
- package/dist/record/family/current.d.cts +240 -1
- package/dist/record/family/current.d.mts +240 -1
- package/dist/record/family/current.d.ts +240 -1
- package/dist/record/family/execution-traces/definition.d.cts +26 -0
- package/dist/record/family/execution-traces/definition.d.mts +26 -0
- package/dist/record/family/execution-traces/definition.d.ts +26 -0
- package/dist/record/family/execution-traces/definition.js +20 -14
- package/dist/record/family/execution-traces/schema.cjs +57 -1
- package/dist/record/family/execution-traces/schema.cjs.map +1 -1
- package/dist/record/family/execution-traces/schema.d.cts +114 -0
- package/dist/record/family/execution-traces/schema.d.mts +114 -0
- package/dist/record/family/execution-traces/schema.d.ts +114 -0
- package/dist/record/family/execution-traces/schema.js +18 -12
- package/dist/record/family/judge-usage/definition.cjs +12 -0
- package/dist/record/family/judge-usage/definition.cjs.map +1 -0
- package/dist/record/family/judge-usage/definition.d.cts +91 -0
- package/dist/record/family/judge-usage/definition.d.mts +91 -0
- package/dist/record/family/judge-usage/definition.d.ts +91 -0
- package/dist/record/family/judge-usage/definition.js +6 -0
- package/dist/record/family/judge-usage/definition.js.map +1 -0
- package/dist/record/family/judge-usage/persistence.cjs +10 -0
- package/dist/record/family/judge-usage/persistence.cjs.map +1 -0
- package/dist/record/family/judge-usage/persistence.d.cts +91 -0
- package/dist/record/family/judge-usage/persistence.d.mts +91 -0
- package/dist/record/family/judge-usage/persistence.d.ts +91 -0
- package/dist/record/family/judge-usage/persistence.js +6 -0
- package/dist/record/family/judge-usage/persistence.js.map +1 -0
- package/dist/record/family/judge-usage/schema.cjs +307 -0
- package/dist/record/family/judge-usage/schema.cjs.map +1 -0
- package/dist/record/family/judge-usage/schema.d.cts +351 -0
- package/dist/record/family/judge-usage/schema.d.mts +351 -0
- package/dist/record/family/judge-usage/schema.d.ts +351 -0
- package/dist/record/family/judge-usage/schema.js +18 -0
- package/dist/record/family/judge-usage/schema.js.map +1 -0
- package/dist/record/host/sqlite-host.cjs +55 -9
- package/dist/record/host/sqlite-host.cjs.map +1 -1
- package/dist/record/host/types.cjs.map +1 -1
- package/dist/record/host/types.d.cts +7 -0
- package/dist/record/host/types.d.mts +7 -0
- package/dist/record/host/types.d.ts +7 -0
- package/dist/record/model/run-context.cjs +7 -1
- package/dist/record/model/run-context.cjs.map +1 -1
- package/dist/record/model/run-context.d.cts +4 -0
- package/dist/record/model/run-context.d.mts +4 -0
- package/dist/record/model/run-context.d.ts +4 -0
- 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/record/sqlite/client.cjs +18 -5
- package/dist/record/sqlite/client.cjs.map +1 -1
- package/dist/record/sqlite/client.d.cts +1 -1
- package/dist/record/sqlite/client.d.mts +1 -1
- package/dist/record/sqlite/client.d.ts +1 -1
- package/dist/record/sqlite/project-state-database.cjs +29 -8
- package/dist/record/sqlite/project-state-database.cjs.map +1 -1
- package/dist/run/host/runtime.cjs +4 -0
- package/dist/run/host/runtime.cjs.map +1 -1
- package/dist/run/storage/sqlite.cjs +20 -0
- package/dist/run/storage/sqlite.cjs.map +1 -1
- package/dist/runner/adapter-execution-trace.cjs +125 -2
- package/dist/runner/adapter-execution-trace.cjs.map +1 -1
- package/dist/runner/adapter-execution-trace.d.cts +1 -1
- package/dist/runner/adapter-execution-trace.d.mts +1 -1
- package/dist/runner/adapter-execution-trace.d.ts +1 -1
- package/dist/runner/adapter-usage.cjs +55 -7
- package/dist/runner/adapter-usage.cjs.map +1 -1
- package/dist/runner/adapter-usage.d.cts +9 -2
- package/dist/runner/adapter-usage.d.mts +9 -2
- package/dist/runner/adapter-usage.d.ts +9 -2
- package/dist/runner/adoption.cjs +9 -0
- package/dist/runner/adoption.cjs.map +1 -1
- package/dist/runner/attempt-cancellation.cjs +12 -0
- package/dist/runner/attempt-cancellation.cjs.map +1 -0
- package/dist/runner/attempt-cancellation.d.cts +6 -0
- package/dist/runner/attempt-cancellation.d.mts +6 -0
- package/dist/runner/attempt-cancellation.d.ts +6 -0
- package/dist/runner/attempt-cancellation.js +6 -0
- package/dist/runner/attempt-cancellation.js.map +1 -0
- package/dist/runner/attempt-resources.cjs +10 -4
- package/dist/runner/attempt-resources.cjs.map +1 -1
- package/dist/runner/attempt-resources.d.cts +2 -1
- package/dist/runner/attempt-resources.d.mts +2 -1
- package/dist/runner/attempt-resources.d.ts +2 -1
- package/dist/runner/attempt.cjs +1177 -1139
- package/dist/runner/attempt.cjs.map +1 -1
- package/dist/runner/config-identity.cjs +20 -1
- package/dist/runner/config-identity.cjs.map +1 -1
- package/dist/runner/config-identity.d.cts +5 -0
- package/dist/runner/config-identity.d.mts +5 -0
- package/dist/runner/config-identity.d.ts +5 -0
- package/dist/runner/discover.cjs +14 -0
- package/dist/runner/discover.cjs.map +1 -1
- package/dist/runner/discover.d.cts +3 -0
- package/dist/runner/discover.d.mts +3 -0
- package/dist/runner/discover.d.ts +3 -0
- package/dist/runner/feedback/human.cjs +9 -4
- package/dist/runner/feedback/human.cjs.map +1 -1
- package/dist/runner/fingerprint.cjs +1 -0
- package/dist/runner/fingerprint.cjs.map +1 -1
- package/dist/runner/judge-usage.cjs +18 -0
- package/dist/runner/judge-usage.cjs.map +1 -0
- package/dist/runner/judge-usage.d.cts +5 -0
- package/dist/runner/judge-usage.d.mts +5 -0
- package/dist/runner/judge-usage.d.ts +5 -0
- package/dist/runner/judge-usage.js +8 -0
- package/dist/runner/judge-usage.js.map +1 -0
- package/dist/runner/project-target.cjs.map +1 -1
- package/dist/runner/project-target.d.cts +2 -0
- package/dist/runner/project-target.d.mts +2 -0
- package/dist/runner/project-target.d.ts +2 -0
- package/dist/runner/record/planning.cjs +1 -0
- package/dist/runner/record/planning.cjs.map +1 -1
- package/dist/runner/record.cjs +4 -0
- package/dist/runner/record.cjs.map +1 -1
- package/dist/runner/reporters/braintrust.cjs +2 -0
- package/dist/runner/reporters/braintrust.cjs.map +1 -1
- package/dist/runner/reuse-diagnostics.cjs +9 -10
- package/dist/runner/reuse-diagnostics.cjs.map +1 -1
- package/dist/runner/reuse-diagnostics.d.cts +5 -6
- package/dist/runner/reuse-diagnostics.d.mts +5 -6
- package/dist/runner/reuse-diagnostics.d.ts +5 -6
- package/dist/runner/reuse-diagnostics.js +4 -4
- package/dist/runner/reuse-plan.cjs +100 -48
- package/dist/runner/reuse-plan.cjs.map +1 -1
- package/dist/runner/reuse-plan.d.cts +60 -3
- package/dist/runner/reuse-plan.d.mts +60 -3
- package/dist/runner/reuse-plan.d.ts +60 -3
- package/dist/runner/reuse-plan.js +14 -10
- package/dist/runner/run.cjs +8 -6
- package/dist/runner/run.cjs.map +1 -1
- package/dist/runner/session.cjs +1 -1
- package/dist/runner/session.cjs.map +1 -1
- package/dist/runner/session.d.cts +1 -1
- package/dist/runner/session.d.mts +1 -1
- package/dist/runner/session.d.ts +1 -1
- package/dist/runner/source-producer.cjs +3 -1
- package/dist/runner/source-producer.cjs.map +1 -1
- package/dist/runner/types.cjs.map +1 -1
- package/dist/runner/types.d.cts +26 -5
- package/dist/runner/types.d.mts +26 -5
- package/dist/runner/types.d.ts +26 -5
- package/dist/sandbox/action.cjs +3 -0
- package/dist/sandbox/action.cjs.map +1 -1
- package/dist/sandbox/commands.cjs +3 -0
- package/dist/sandbox/commands.cjs.map +1 -1
- package/dist/sandbox/compose.cjs +6 -0
- package/dist/sandbox/compose.cjs.map +1 -1
- package/dist/sandbox/docker-profile/registry.cjs +7 -0
- package/dist/sandbox/docker-profile/registry.cjs.map +1 -1
- package/dist/sandbox/docker-profile/runtime.cjs +3 -0
- package/dist/sandbox/docker-profile/runtime.cjs.map +1 -1
- package/dist/sandbox/docker-profile/schema.cjs +7 -0
- package/dist/sandbox/docker-profile/schema.cjs.map +1 -1
- package/dist/sandbox/incus.cjs +7 -0
- package/dist/sandbox/incus.cjs.map +1 -1
- package/dist/sandbox/layer.cjs +12 -0
- package/dist/sandbox/layer.cjs.map +1 -1
- package/dist/shared/adapter-cleanup.cjs +18 -0
- package/dist/shared/adapter-cleanup.cjs.map +1 -0
- package/dist/shared/adapter-cleanup.d.cts +4 -0
- package/dist/shared/adapter-cleanup.d.mts +4 -0
- package/dist/shared/adapter-cleanup.d.ts +4 -0
- package/dist/shared/adapter-cleanup.js +10 -0
- package/dist/shared/adapter-cleanup.js.map +1 -0
- package/dist/shared/attempt-lifecycle.cjs +3 -0
- package/dist/shared/attempt-lifecycle.cjs.map +1 -0
- package/dist/shared/attempt-lifecycle.d.cts +13 -0
- package/dist/shared/attempt-lifecycle.d.mts +13 -0
- package/dist/shared/attempt-lifecycle.d.ts +13 -0
- package/dist/shared/attempt-lifecycle.js +4 -0
- package/dist/shared/attempt-lifecycle.js.map +1 -0
- package/dist/show/contribution.cjs +52 -14
- package/dist/show/contribution.cjs.map +1 -1
- package/dist/show/contribution.d.cts +23 -1
- package/dist/show/contribution.d.mts +23 -1
- package/dist/show/contribution.d.ts +23 -1
- package/dist/show/model.cjs +8 -1
- package/dist/show/model.cjs.map +1 -1
- package/dist/show/model.d.cts +10 -1
- package/dist/show/model.d.mts +10 -1
- package/dist/show/model.d.ts +10 -1
- package/dist/show/render.cjs +287 -49
- package/dist/show/render.cjs.map +1 -1
- package/dist/show/render.d.cts +3 -0
- package/dist/show/render.d.mts +3 -0
- package/dist/show/render.d.ts +3 -0
- package/dist/sources/projector.cjs +3 -0
- package/dist/sources/projector.cjs.map +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/view/app-dist/.vite/manifest.json +2 -2
- package/dist/view/app-dist/assets/index-CmVoXbwG.js +63 -0
- package/dist/view/app-dist/assets/{quality-cost-scatter-CFB3wnkN.js → quality-cost-scatter-BuLISaH4.js} +1 -1
- package/dist/view/app-dist/index.html +1 -1
- package/dist/view/cli/contribution.cjs +54 -21
- package/dist/view/cli/contribution.cjs.map +1 -1
- package/dist/view/cli/contribution.d.cts +2 -1
- package/dist/view/cli/contribution.d.mts +2 -1
- package/dist/view/cli/contribution.d.ts +2 -1
- package/dist/view/function-runtime.mjs +13231 -11647
- package/dist/view/http-protocol.cjs +3 -0
- package/dist/view/http-protocol.cjs.map +1 -1
- package/dist/view/http-protocol.d.cts +8 -0
- package/dist/view/http-protocol.d.mts +8 -0
- package/dist/view/http-protocol.d.ts +8 -0
- package/dist/view/inspection-host.cjs +17 -1
- package/dist/view/inspection-host.cjs.map +1 -1
- package/dist/view/render.cjs +1 -0
- package/dist/view/render.cjs.map +1 -1
- package/dist/view/render.d.cts +2 -1
- package/dist/view/render.d.mts +2 -1
- package/dist/view/render.d.ts +2 -1
- package/dist/view/revision.cjs.map +1 -1
- package/dist/view/revision.d.cts +12 -0
- package/dist/view/revision.d.mts +12 -0
- package/dist/view/revision.d.ts +12 -0
- package/dist/view/server.cjs +10 -9
- package/dist/view/server.cjs.map +1 -1
- package/docs-site/zh/examples/ai-agent-application.mdx +1 -1
- package/docs-site/zh/explanation/adapter.mdx +2 -2
- package/docs-site/zh/explanation/assert.mdx +60 -24
- package/docs-site/zh/explanation/drive.mdx +1 -1
- package/docs-site/zh/explanation/evals.mdx +31 -29
- package/docs-site/zh/explanation/experiment.mdx +15 -15
- package/docs-site/zh/explanation/judge.mdx +23 -15
- package/docs-site/zh/explanation/overview.mdx +44 -21
- package/docs-site/zh/explanation/record.mdx +28 -13
- package/docs-site/zh/explanation/results-flow.mdx +37 -0
- package/docs-site/zh/explanation/runner.mdx +27 -6
- package/docs-site/zh/index.mdx +22 -115
- package/docs-site/zh/introduction.mdx +89 -61
- package/docs-site/zh/reference/cli.mdx +50 -26
- package/docs-site/zh/reference/define-agent.mdx +37 -5
- package/docs-site/zh/reference/define-eval.mdx +130 -29
- package/docs-site/zh/reference/define-experiment.mdx +251 -0
- package/docs-site/zh/reference/events.mdx +34 -30
- package/docs-site/zh/reference/expect.mdx +77 -2
- package/docs-site/zh/reference/official-adapters.mdx +2 -2
- package/docs-site/zh/troubleshooting/debug-sandbox.mdx +43 -24
- package/docs-site/zh/troubleshooting/debugging.mdx +65 -42
- package/docs-site/zh/troubleshooting/recover-after-kill.mdx +35 -28
- package/docs-site/zh/tutorials/accept-results.mdx +34 -24
- package/docs-site/zh/tutorials/agent-feedback-loop.mdx +74 -43
- package/docs-site/zh/tutorials/agent-onboarding.mdx +27 -20
- package/docs-site/zh/tutorials/authoring.mdx +138 -121
- package/docs-site/zh/tutorials/ci-integration.mdx +46 -22
- package/docs-site/zh/tutorials/compare-runs.mdx +40 -13
- package/docs-site/zh/tutorials/concurrency.mdx +66 -62
- package/docs-site/zh/tutorials/configuration.mdx +17 -17
- package/docs-site/zh/tutorials/connect-otel.mdx +48 -37
- package/docs-site/zh/tutorials/connect-your-agent.mdx +80 -173
- package/docs-site/zh/tutorials/control-run-cost.mdx +63 -12
- package/docs-site/zh/tutorials/criteria-files.mdx +28 -21
- package/docs-site/zh/tutorials/custom-application.mdx +75 -55
- package/docs-site/zh/tutorials/dataset-fanout.mdx +32 -22
- package/docs-site/zh/tutorials/debug-lifecycle-plan.mdx +38 -31
- package/docs-site/zh/tutorials/docker-in-docker.mdx +83 -89
- package/docs-site/zh/tutorials/eval-groups.mdx +70 -89
- package/docs-site/zh/tutorials/evaluation-kinds.mdx +12 -5
- package/docs-site/zh/tutorials/experiment-services.mdx +243 -0
- package/docs-site/zh/tutorials/fixtures.mdx +42 -26
- package/docs-site/zh/tutorials/handle-execution-failures.mdx +41 -19
- package/docs-site/zh/tutorials/install-custom-sandbox-agent.mdx +21 -16
- package/docs-site/zh/tutorials/niceeval-taste-application.mdx +394 -0
- package/docs-site/zh/tutorials/niceeval-taste.mdx +190 -0
- package/docs-site/zh/tutorials/nixos-managed-dind.mdx +51 -39
- package/docs-site/zh/tutorials/plugins.mdx +55 -31
- package/docs-site/zh/tutorials/prebuilt-sandbox.mdx +204 -0
- package/docs-site/zh/tutorials/quickstart.mdx +91 -47
- package/docs-site/zh/tutorials/reporters.mdx +45 -30
- package/docs-site/zh/tutorials/rerun-and-cache.mdx +39 -40
- package/docs-site/zh/tutorials/sandbox-agent.mdx +65 -40
- package/docs-site/zh/tutorials/sandbox-providers.mdx +104 -282
- package/docs-site/zh/tutorials/sandbox-reuse.mdx +65 -97
- package/docs-site/zh/tutorials/select-and-preview.mdx +25 -20
- package/docs-site/zh/tutorials/verify-judge.mdx +49 -26
- package/docs-site/zh/tutorials/viewing-results.mdx +130 -80
- package/docs-site/zh/tutorials/write-experiment.mdx +116 -298
- package/docs-site/zh/tutorials/write-send.mdx +53 -52
- package/node_modules/undici/docs/docs/api/Agent.md +8 -8
- package/node_modules/undici/docs/docs/api/DiagnosticsChannel.md +9 -6
- package/node_modules/undici/docs/docs/api/Errors.md +25 -0
- package/node_modules/undici/docs/docs/api/Interceptors.md +4 -3
- package/node_modules/undici/docs/docs/api/Pool.md +5 -6
- package/node_modules/undici/lib/api/readable.js +1 -2
- package/node_modules/undici/lib/core/request.js +23 -2
- package/node_modules/undici/lib/core/util.js +0 -39
- package/node_modules/undici/lib/dispatcher/client-h1.js +11 -4
- package/node_modules/undici/lib/dispatcher/client-h2.js +52 -8
- package/node_modules/undici/lib/dispatcher/client.js +1 -1
- package/node_modules/undici/lib/dispatcher/dispatcher1-wrapper.js +3 -2
- package/node_modules/undici/lib/dispatcher/env-http-proxy-agent.js +21 -6
- package/node_modules/undici/lib/dispatcher/pool-base.js +63 -2
- package/node_modules/undici/lib/dispatcher/pool.js +90 -7
- package/node_modules/undici/lib/dispatcher/proxy-agent.js +16 -3
- package/node_modules/undici/lib/handler/deduplication-handler.js +24 -11
- package/node_modules/undici/lib/handler/redirect-handler.js +5 -0
- package/node_modules/undici/lib/handler/retry-handler.js +72 -13
- package/node_modules/undici/lib/interceptor/cache.js +4 -1
- package/node_modules/undici/lib/interceptor/decompress.js +236 -69
- package/node_modules/undici/lib/web/cache/cache.js +17 -8
- package/node_modules/undici/lib/web/cache/cachestorage.js +11 -5
- package/node_modules/undici/lib/web/cookies/index.js +19 -7
- package/node_modules/undici/lib/web/cookies/util.js +3 -1
- package/node_modules/undici/lib/web/eventsource/eventsource.js +25 -1
- package/node_modules/undici/lib/web/fetch/body.js +22 -15
- package/node_modules/undici/lib/web/fetch/data-url.js +6 -6
- package/node_modules/undici/lib/web/fetch/formdata.js +30 -36
- package/node_modules/undici/lib/web/fetch/headers.js +34 -31
- package/node_modules/undici/lib/web/fetch/index.js +38 -14
- package/node_modules/undici/lib/web/fetch/request.js +74 -79
- package/node_modules/undici/lib/web/fetch/response.js +43 -44
- package/node_modules/undici/lib/web/fetch/util.js +7 -7
- package/node_modules/undici/lib/web/infra/index.js +16 -1
- package/node_modules/undici/lib/web/webidl/index.js +2 -14
- package/node_modules/undici/lib/web/websocket/events.js +43 -26
- package/node_modules/undici/lib/web/websocket/receiver.js +5 -0
- package/node_modules/undici/lib/web/websocket/stream/websocketerror.js +13 -10
- package/node_modules/undici/lib/web/websocket/websocket.js +44 -41
- package/node_modules/undici/package.json +1 -1
- package/node_modules/undici/types/diagnostics-channel.d.ts +2 -1
- package/node_modules/undici/types/interceptors.d.ts +1 -1
- package/node_modules/undici/types/webidl.d.ts +13 -7
- package/package.json +4 -4
- package/dist/view/app-dist/assets/index-DFzw1L97.js +0 -63
- package/docs-site/zh/tutorials/experiments.mdx +0 -101
|
@@ -1,34 +1,26 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "Sandbox"
|
|
2
|
+
title: "选择并配置 Sandbox:Docker、Vercel 或 E2B"
|
|
3
3
|
sidebarTitle: "Sandbox"
|
|
4
|
-
description: "
|
|
4
|
+
description: "给 Coding Agent 选一个隔离运行环境:本地 Docker、Vercel 或 E2B。按顺序准备环境,并用预制镜像和缓存让每次评估更快开始。"
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Coding Agent 要在一个能随意改文件、跑命令的环境里工作,而且不能碰到你的机器。这个隔离环境就是 Sandbox,由 Provider 负责创建和销毁。
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
NiceEval 提供三种官方 Provider:本地 Docker、Vercel 和 E2B。本地调试用 Docker 最方便;需要大量并行,或者本机跑不动时,换成云端的 Vercel 或 E2B。
|
|
10
10
|
|
|
11
|
-
Adapter
|
|
11
|
+
不管用哪种 Provider,评估用例和 Adapter 看到的都是同一个 `Sandbox` 接口。换 Provider 只改 Experiment 里的一行,评估用例不用动。
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|---|---|
|
|
15
|
-
| `runCommand(cmd, args)` | 运行命令 |
|
|
16
|
-
| `runCommandOrThrow(cmd, args)` | 运行命令,非零退出时抛错 |
|
|
17
|
-
| `runShell(script)` | 运行 shell 脚本 |
|
|
18
|
-
| `runShellOrThrow(script)` | 运行 shell 脚本,非零退出时抛错 |
|
|
19
|
-
| `readText(path)` / `readBytes(path)` | 读取文本或二进制文件 |
|
|
20
|
-
| `writeText(path, content)` / `writeBytes(path, content)` | 写入文本或二进制文件 |
|
|
21
|
-
| `pathExists(path)` | 检查路径是否存在 |
|
|
22
|
-
| `uploadFile(source, target)` / `uploadDirectory(source, target?)` | 上传文件或目录 |
|
|
23
|
-
| `workdir` | provider 真实工作目录。省略的 `cwd` / `targetDir` 都解析到这里 |
|
|
24
|
-
| `runCommand(..., { cwd })` | 单条命令临时切换工作目录。相对路径按 `workdir` 解析 |
|
|
25
|
-
| `stop()` | 销毁环境 |
|
|
13
|
+
## 选择 Provider
|
|
26
14
|
|
|
27
|
-
|
|
15
|
+
先按你在哪里跑评估来选:
|
|
28
16
|
|
|
29
|
-
|
|
17
|
+
| Provider | 适合 | 需要准备 |
|
|
18
|
+
| --- | --- | --- |
|
|
19
|
+
| Docker | 本地开发和标准 CI。简单、可控,不依赖云端 | 本机 Docker。机器资源有限,冷启动和装依赖可能较慢 |
|
|
20
|
+
| Vercel Sandbox | 需要云端隔离、更多资源或更稳定的环境 | Vercel token 或 OIDC 配置 |
|
|
21
|
+
| E2B | 需要大量并行,或者想直接用现成的 Agent template | E2B 账号和 `e2b auth login` |
|
|
30
22
|
|
|
31
|
-
|
|
23
|
+
在 Experiment 的 `sandbox` 字段里选一个:
|
|
32
24
|
|
|
33
25
|
```ts
|
|
34
26
|
// experiments/local.ts
|
|
@@ -42,17 +34,17 @@ export default defineExperiment({
|
|
|
42
34
|
});
|
|
43
35
|
```
|
|
44
36
|
|
|
45
|
-
|
|
37
|
+
评估用例和 Experiment 都没有选择 Sandbox 时,运行会在创建任何 Sandbox 之前报错,NiceEval 不会替你猜一个 Provider。
|
|
46
38
|
|
|
47
|
-
三个内置
|
|
39
|
+
三个内置 Provider 的 SDK 不随 NiceEval 一起安装。用哪个就装哪个,用不到的依赖(以及它们的原生构建脚本)不会进入你的项目:
|
|
48
40
|
|
|
49
|
-
|
|
|
41
|
+
| Provider | 安装命令 |
|
|
50
42
|
|---|---|
|
|
51
43
|
| `dockerSandbox({ source: { type: "image", image: "node:24-slim" } })` | `pnpm add dockerode @types/dockerode` |
|
|
52
44
|
| `vercelSandbox({ snapshotId })` | `pnpm add @vercel/sandbox` |
|
|
53
45
|
| `e2bSandbox({ template })` | `pnpm add e2b` |
|
|
54
46
|
|
|
55
|
-
|
|
47
|
+
漏装时,创建 Sandbox 的那一刻会报错并给出安装命令,例如 `Docker sandbox requires 'dockerode'. Install it with: pnpm add dockerode @types/dockerode`。照着装好再运行即可。
|
|
56
48
|
|
|
57
49
|
### Docker Compose:`workspaceService` 指定主 Sandbox
|
|
58
50
|
|
|
@@ -67,17 +59,37 @@ sandbox: dockerComposeSandbox({
|
|
|
67
59
|
})
|
|
68
60
|
```
|
|
69
61
|
|
|
70
|
-
`workspaceService` 指定 Compose 文件里哪个 service 是主 Sandbox。Agent、`t.sandbox`
|
|
62
|
+
`workspaceService` 指定 Compose 文件里哪个 service 是主 Sandbox。Agent、`t.sandbox` 的命令和文件操作、`workdir`、文件改动记录,都只落在这一个容器上。
|
|
63
|
+
|
|
64
|
+
其它 service(数据库、mock server 之类)只是陪跑的资源:不能对它们 `runCommand`、上传或读写文件,也看不到它们的文件改动。要用到它们,只能靠网络访问,例如在 `client` 容器里通过 Compose 内置 DNS 访问 `db:5432`。
|
|
71
65
|
|
|
72
66
|
### 让 Agent 自己运行 Docker
|
|
73
67
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
68
|
+
Agent 需要执行 `docker build`、`docker run` 或 `docker compose` 时,可以挂载宿主机已有的 Unix socket,也可以选择 raw privileged 或 managed rootless Docker-in-Docker。三种模式的适用场景、Dockerfile 和完整配置见[让 Sandbox 使用 Docker](/zh/tutorials/docker-in-docker)。
|
|
69
|
+
|
|
70
|
+
## 在 Adapter 和评估用例里操作 Sandbox
|
|
71
|
+
|
|
72
|
+
不管用哪种 Provider,Adapter 和评估用例拿到的都是同一个 `Sandbox` 接口。常用操作:
|
|
73
|
+
|
|
74
|
+
| 方法 | 用途 |
|
|
75
|
+
|---|---|
|
|
76
|
+
| `runCommand(cmd, args)` | 运行命令 |
|
|
77
|
+
| `runCommandOrThrow(cmd, args)` | 运行命令,非零退出时抛错 |
|
|
78
|
+
| `runShell(script)` | 运行 shell 脚本 |
|
|
79
|
+
| `runShellOrThrow(script)` | 运行 shell 脚本,非零退出时抛错 |
|
|
80
|
+
| `readText(path)` / `readBytes(path)` | 读取文本或二进制文件 |
|
|
81
|
+
| `writeText(path, content)` / `writeBytes(path, content)` | 写入文本或二进制文件 |
|
|
82
|
+
| `pathExists(path)` | 检查路径是否存在 |
|
|
83
|
+
| `uploadFile(source, target)` / `uploadDirectory(source, target?)` | 上传文件或目录 |
|
|
84
|
+
| `workdir` | Provider 里真实的工作目录。省略的 `cwd` / `targetDir` 都指向这里 |
|
|
85
|
+
| `runCommand(..., { cwd })` | 让单条命令在别的目录运行。相对路径按 `workdir` 解析 |
|
|
86
|
+
| `stop()` | 销毁环境 |
|
|
87
|
+
|
|
88
|
+
两个 `OrThrow` 方法抛出的错误消息会附带 stderr 的末尾几行,已经清理、脱敏并截断。stderr 为空时改用 stdout。排查时先看这段摘要,需要完整输出时再读 `SandboxCommandExitError.result`。
|
|
77
89
|
|
|
78
90
|
## 按顺序准备 Sandbox
|
|
79
91
|
|
|
80
|
-
|
|
92
|
+
Agent 开始工作前,Sandbox 里通常要先装工具、写配置、放好素材。用 `.before()` 写这些准备步骤,用 `.after()` 写无论成败都要执行的收尾。每个 Provider 函数都返回一个可以继续追加步骤的 `SandboxLayer`,追加时不会修改原来的值:
|
|
81
93
|
|
|
82
94
|
```ts
|
|
83
95
|
import {
|
|
@@ -103,7 +115,7 @@ const sandbox = dockerSandbox({
|
|
|
103
115
|
}));
|
|
104
116
|
```
|
|
105
117
|
|
|
106
|
-
`changeFrequency`
|
|
118
|
+
`changeFrequency` 决定步骤的顺序:数值小、很少变的步骤排在前面,数值大、经常变的排在后面。这样只改了后面的步骤时,前面的步骤可以直接沿用上次的结果。它是一个普通的非负数,内置常量只是方便阅读:
|
|
107
119
|
|
|
108
120
|
```ts
|
|
109
121
|
changeFrequency.rare // 10
|
|
@@ -111,47 +123,46 @@ changeFrequency.normal // 100
|
|
|
111
123
|
changeFrequency.frequent // 1000
|
|
112
124
|
```
|
|
113
125
|
|
|
114
|
-
Experiment、评估组、评估用例和 Sandbox Agent
|
|
126
|
+
Experiment、评估组、评估用例和 Sandbox Agent 的准备步骤排进同一个顺序:先满足显式的 `dependsOn`,再按数值从小到大执行。所以评估组里很少变的步骤,可以排在 Experiment 里经常变的步骤前面。
|
|
115
127
|
|
|
116
|
-
|
|
117
|
-
`/bin/sh -lc` 包装;`command()` 和 `exec` 显示 executable 与 argv。`writeText()` / `writeBytes()` 只显示
|
|
118
|
-
目标路径、bytes 与 digest,不显示正文。upload / transfer 只显示 digest、目标路径与 bytes,不显示宿主 source path。
|
|
119
|
-
checkout locator 会去掉 userinfo、query 和 fragment;env 只列 keys。
|
|
128
|
+
运行时,每个准备步骤都会显示在进度里,但不会泄露内容:
|
|
120
129
|
|
|
121
|
-
|
|
122
|
-
|
|
130
|
+
- `shell()` 显示你写的 command,不显示外面包的 `/bin/sh -lc`;`command()` 和 `exec` 显示可执行文件和参数。
|
|
131
|
+
- `writeText()` / `writeBytes()` 只显示目标路径、字节数和摘要,不显示正文。
|
|
132
|
+
- 上传只显示摘要、目标路径和字节数,不显示宿主机上的源路径。
|
|
133
|
+
- Git checkout 的地址会去掉用户信息、query 和 fragment;环境变量只列出名字。
|
|
134
|
+
|
|
135
|
+
很短的进度更新可能被合并显示。想稳定看到一个长脚本的细粒度进度,把它拆成几个较小的步骤,并让每一步本身运行得足够久,或者自己报告进度。NiceEval 不追踪 shell 脚本内部的步骤。动态回调的进度由 `context.progress()` 自己报告。
|
|
123
136
|
|
|
124
137
|
### 声明准备缓存覆盖范围
|
|
125
138
|
|
|
126
|
-
|
|
127
|
-
|
|
139
|
+
在支持的 Provider 上,没变的准备步骤下次运行可以直接沿用,不重新执行。为此,每个 `.before(action)` 都要如实说明它会改动 Sandbox 的哪些部分:
|
|
140
|
+
|
|
141
|
+
- 不写 `cache.state` 等于 `sandboxState.all`:这个步骤的全部改动都要能被保存和恢复。它不是让 Provider 自己挑一部分目录缓存的开关。
|
|
142
|
+
- 只有步骤的全部改动都限于 Sandbox 里已经停止写入的 `/var/lib/docker` 时,才写 `sandboxState.dockerData`。完整的 Docker profile 示例见[让 Sandbox 使用 Docker](/zh/tutorials/docker-in-docker#managed-rootless-dind)。
|
|
128
143
|
|
|
129
|
-
|
|
130
|
-
`sandboxState.dockerData`。完整的 Docker Profile Action 示例见
|
|
131
|
-
[让 Sandbox 使用 Docker](/zh/tutorials/docker-in-docker#managed-rootless-dind)。
|
|
144
|
+
`cache.state` 写在步骤定义处或单次调用处都可以,但只能写一处,调用处也不能覆盖定义处。
|
|
132
145
|
|
|
133
|
-
|
|
134
|
-
也不能由 instance 覆盖 definition。family ID、输入、展开后的 steps、声明的 state 和内容摘要会自动进入
|
|
135
|
-
fingerprint。`cache.fingerprint` 只能补充 NiceEval 看不到的版本值,不能替代自动 fingerprint。
|
|
146
|
+
步骤的 ID、输入、展开后的命令、声明的范围和内容摘要都会被自动比较,任何一项变了,这一步就重新执行。`cache.fingerprint` 只用来补充 NiceEval 看不到的版本信息,不能代替自动比较。
|
|
136
147
|
|
|
137
|
-
Provider
|
|
148
|
+
各 Provider 能保存的范围不同:
|
|
138
149
|
|
|
139
|
-
| Provider 情况 |
|
|
150
|
+
| Provider 情况 | 能保存的范围 | 结果 |
|
|
140
151
|
| --- | --- | --- |
|
|
141
|
-
|
|
|
142
|
-
| Docker
|
|
143
|
-
|
|
|
144
|
-
| Docker Compose、E2B、Vercel 或自定义 Provider | 无 | `Unsupported
|
|
152
|
+
| 本地单容器 Docker,所有改动都在外层容器的可写文件系统里 | `all` | 从头开始最长的一段没变的步骤直接沿用 |
|
|
153
|
+
| Docker profile 配置了独立、预先分配好、固定大小的存储位和种子数据 | `dockerData` | 只沿用从头开始、连续声明了 `dockerData` 的那一段 |
|
|
154
|
+
| 共享 loop 或 project-quota 的 Docker profile | 无 | 显示 `Unsupported`,步骤真实执行 |
|
|
155
|
+
| Docker Compose、E2B、Vercel 或自定义 Provider | 无 | 显示 `Unsupported`,步骤真实执行 |
|
|
156
|
+
|
|
157
|
+
沿用只能从第一步开始连续往下。遇到第一个无法保存的步骤,比如默认 `all` 但 Provider 不支持、写了 `opaque` 的回调,或者 Provider 不支持的范围,这一步和它后面的所有步骤都会真实执行。后面的步骤即使声明了 `dockerData`,也不能跳过,因为它依赖的前面状态没有被保存。
|
|
145
158
|
|
|
146
|
-
|
|
147
|
-
以及它后面的所有 action 都会真实执行;后缀即使声明 `dockerData`,也不能跳过缺少祖先状态的步骤。
|
|
159
|
+
在本地单容器 Docker 上,只改了最后的 `.env` 步骤时,前面固定的 Git checkout、目录上传和工具安装都不会重跑。每个 Attempt 都从缓存结果的一份独立副本启动,不会继承上一个 Agent 留下的改动。
|
|
148
160
|
|
|
149
|
-
|
|
150
|
-
目录上传和工具安装不会重跑。每个 Attempt 都从缓存结果的私有副本启动,不会继承上一个 Agent 留下的改动。
|
|
161
|
+
想确认哪些步骤会沿用,运行 `pnpm exec niceeval debug <experiment> <eval>` 查看计划,见[运行前检查 Sandbox 计划](/zh/tutorials/debug-lifecycle-plan)。
|
|
151
162
|
|
|
152
|
-
###
|
|
163
|
+
### 定义可复用的准备步骤
|
|
153
164
|
|
|
154
|
-
内置的 `shell()`、`writeText()`、`uploadDirectory()` 和 `gitCheckout()` 都是 `SandboxAction
|
|
165
|
+
内置的 `shell()`、`writeText()`、`uploadDirectory()` 和 `gitCheckout()` 都是 `SandboxAction`。同一类准备步骤要在多处用时,可以用相同的机制定义自己的步骤:
|
|
155
166
|
|
|
156
167
|
```ts
|
|
157
168
|
import { Schema } from "effect";
|
|
@@ -179,29 +190,28 @@ const sandbox = e2bSandbox({ template: "niceeval-agents" })
|
|
|
179
190
|
));
|
|
180
191
|
```
|
|
181
192
|
|
|
182
|
-
|
|
183
|
-
规则同样适用于自定义 family。
|
|
193
|
+
自定义步骤只能组合 NiceEval 提供的固定操作,拿不到运行中的 `Sandbox`。上面关于缓存范围和自动比较的规则同样适用。
|
|
184
194
|
|
|
185
195
|
### 写入、上传与 Git checkout
|
|
186
196
|
|
|
187
|
-
|
|
197
|
+
这些内置函数可以直接传给 `.before()`:
|
|
188
198
|
|
|
189
|
-
| 内容来源 |
|
|
199
|
+
| 内容来源 | 使用 |
|
|
190
200
|
| --- | --- |
|
|
191
201
|
| 已有文本或字节 | `writeText()` / `writeBytes()` |
|
|
192
|
-
|
|
|
202
|
+
| 定义文件旁边的固定文件或目录 | `uploadFile()` / `uploadDirectory()` |
|
|
193
203
|
| 公开 Git 仓库的固定 commit | `gitCheckout()` |
|
|
194
|
-
| shell
|
|
204
|
+
| shell 或参数列表形式的命令 | `shell()` / `command()` |
|
|
195
205
|
|
|
196
|
-
`uploadFile()` 和 `uploadDirectory()` 接收 `new URL("fixture/", import.meta.url)
|
|
206
|
+
`uploadFile()` 和 `uploadDirectory()` 接收 `new URL("fixture/", import.meta.url)` 这样的地址,不接收会随当前目录变化的相对路径。文件内容、权限和目录结构都会被自动比较。`gitCheckout()` 只接受不含凭据的 HTTPS 地址和完整的 commit ID。
|
|
197
207
|
|
|
198
|
-
|
|
208
|
+
要等 Agent 返回后才给出的隐藏内容,不要放进 `.before()`。先用 `sandboxContent.file()` 或 `sandboxContent.directory()` 取得一个句柄,再在 `test(t)` 里调用 `t.sandbox.upload(handle, targetPath)`。句柄只带内容摘要,不暴露宿主机路径。
|
|
199
209
|
|
|
200
210
|
### 动态回调与收尾
|
|
201
211
|
|
|
202
|
-
|
|
212
|
+
只有运行时才能决定的分支,直接写 `.before(async (sandbox, context) => ...)`。回调每次都真实执行,它后面的步骤也不再沿用缓存。
|
|
203
213
|
|
|
204
|
-
|
|
214
|
+
成功取得资源后,立即用 `context.onCleanup()` 登记释放。闭包里可以直接保存这次拿到的句柄,不需要再写一个回调去猜资源状态:
|
|
205
215
|
|
|
206
216
|
```ts
|
|
207
217
|
const sandbox = e2bSandbox({ template: "niceeval-agents" })
|
|
@@ -216,9 +226,11 @@ const sandbox = e2bSandbox({ template: "niceeval-agents" })
|
|
|
216
226
|
});
|
|
217
227
|
```
|
|
218
228
|
|
|
219
|
-
|
|
229
|
+
回调里的 `sandbox.sandboxId` 是当前 Sandbox 在 Provider 那边的原生 ID。一般只把它当作关联用的值,不要解析它。只有这个 layer 明确绑定了某个 Provider 时,你自己的可信代码才应该把它交给对应 SDK,去创建这个 Attempt 用的辅助资源。
|
|
220
230
|
|
|
221
|
-
|
|
231
|
+
这些辅助资源不归 NiceEval 管理,也不会被缓存;创建成功后必须立即登记可重复执行的清理。第一个回调开始前,NiceEval 可能换掉底下的 Sandbox 实例;回调开始之后,这个 Attempt 的清理和 `.after()` 看到的都是同一个 ID。
|
|
232
|
+
|
|
233
|
+
无论成败都要执行、而且可以重复执行的收尾,写成 `.after()`。所有登记过的收尾按登记顺序的相反顺序执行,前面的收尾失败也会继续执行后面的:
|
|
222
234
|
|
|
223
235
|
```ts
|
|
224
236
|
const sandbox = dockerSandbox({
|
|
@@ -234,13 +246,13 @@ const sandbox = dockerSandbox({
|
|
|
234
246
|
}));
|
|
235
247
|
```
|
|
236
248
|
|
|
237
|
-
|
|
249
|
+
回调里的 `context.progress()` 只更新当前 Attempt 的临时状态,`context.diagnostic()` 保存事后需要回看的问题。环境没法继续时直接抛错,NiceEval 会把这个 Attempt 记为环境错误,而不是 Agent 做错了题。
|
|
238
250
|
|
|
239
|
-
不带 Sandbox 的 `defineAgent`
|
|
251
|
+
不带 Sandbox 的 `defineAgent` 没有准备步骤。Sandbox Agent 可以在自己的 `sandbox` 字段里加 `sandboxLayer()` 形式的命令步骤,但不能选择或替换 Provider 和 template。
|
|
240
252
|
|
|
241
|
-
##
|
|
253
|
+
## 预制环境
|
|
242
254
|
|
|
243
|
-
|
|
255
|
+
每个 Attempt 都要下载或安装的同一份内容,如果稳定、昂贵或体积大,就把它做进预制环境,让 Attempt 直接从装好的环境启动。三种 Provider 的写法统一:
|
|
244
256
|
|
|
245
257
|
```ts
|
|
246
258
|
dockerSandbox({ source: { type: "image", image: "my-evals:node24" } })
|
|
@@ -248,213 +260,21 @@ vercelSandbox({ snapshotId: "snap_abc123" })
|
|
|
248
260
|
e2bSandbox({ template: "my-evals" })
|
|
249
261
|
```
|
|
250
262
|
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
### 从官方基线继续构建以提速
|
|
254
|
-
|
|
255
|
-
稳定、体积大、每个 Attempt 都相同的内容——系统包、Agent CLI、编译好的二进制、大模型缓存——应在跑评估用例之前烘焙进 provider 的可发布构建输出,让每个 Attempt 从预制环境启动、跳过运行时安装。三个内置 provider 都能从官方基线继续派生,不必从空白环境装 Agent。但它们的构建工具、凭据和发布语义不同,NiceEval 只统一**消费**产物 ID(`image` / `snapshotId` / `template`),不伪造跨 provider 的构建 DSL。
|
|
256
|
-
|
|
257
|
-
Adapter 与 Sandbox 不互相猜配置:Adapter 负责检查所需 CLI,Sandbox spec 负责选择 provider 和构建输出。Claude Code 与 Codex 缺少 CLI 时会回退到运行时安装(构建输出在题面网络之外准备,经文件 API 送入),所以烘焙纯粹是提速。Codex 送进去的是该平台自带运行时的原生包,任务镜像不带 Node 也能装,Claude Code 仍要求镜像里有 npm。
|
|
258
|
-
|
|
259
|
-
默认 Bub 0.4.0 配方除 OTel 插件外,还固定 `any-llm-sdk==1.17.0` 和 `openai==2.31.0`。安装指纹同时覆盖 Bub requirement、这两个 client override、OTel 插件和规范化后的 Python 插件集,不能仅凭 `command -v bub` 跳过安装。旧 marker 的预制环境会重装一次;显式选择其它 Bub 版本时,传递依赖闭包仍由调用方负责。三个 Provider 的构建都只在环境依赖变化时跑一次,产物换一个版本化名字,不要放进每个 Attempt 都会执行的动态回调。
|
|
260
|
-
|
|
261
|
-
#### E2B:从官方与公共模板派生
|
|
262
|
-
|
|
263
|
-
E2B 已提供 Claude Code 的 `claude` template 和 Codex 的 `codex` template。NiceEval 提供一个 E2B 专属的薄封装,让你从这两个官方起点继续链原生 E2B API。E2B 暂无 Bub 官方 template,因此默认 Bub 分支与 `bubAgent()` 使用同一份完整 client 闭包和 OTel 插件:
|
|
264
|
-
|
|
265
|
-
NiceEval 同时发布了三份任何 E2B Team 都能引用的公共模板。完整 namespace 与版本由 NiceEval 自己维护,
|
|
266
|
-
下游直接取完整引用:
|
|
267
|
-
|
|
268
|
-
```ts
|
|
269
|
-
import {
|
|
270
|
-
NICEEVAL_CLAUDE_CODE_E2B_TEMPLATE,
|
|
271
|
-
NICEEVAL_CODEX_E2B_TEMPLATE,
|
|
272
|
-
NICEEVAL_BUB_E2B_TEMPLATE,
|
|
273
|
-
} from "niceeval/sandbox/e2b-template";
|
|
274
|
-
|
|
275
|
-
e2bSandbox({ template: NICEEVAL_CLAUDE_CODE_E2B_TEMPLATE })
|
|
276
|
-
e2bSandbox({ template: NICEEVAL_CODEX_E2B_TEMPLATE })
|
|
277
|
-
e2bSandbox({ template: NICEEVAL_BUB_E2B_TEMPLATE })
|
|
278
|
-
```
|
|
279
|
-
|
|
280
|
-
这些基线都实际启动验证过:Claude Code `2.1.207`、Codex `0.144.1`、Bub `0.4.0`(安装指纹随 Bub requirement、client override、OTel 插件和 Python 插件 pin 一起变)。模板的版本号跟着它装的那个 Agent 走(形如 `0.144.1-r1`:Agent 版本 + NiceEval 配方修订号),三个 Agent 各自独立发版,NiceEval 库自己的版本不参与命名。所以业务仓库直接用常量,不复制这些字符串、也不跟踪版本。派生模板需要记录 base 身份时,同样用常量的值。
|
|
281
|
-
|
|
282
|
-
当前这批公共模板中,Claude Code 模板沿用 E2B 官方 `/usr` npm prefix,普通用户不能直接写全局模块。需要在运行时追加 pnpm、yarn 等全局 Node 工具时,显式把它们装到两个模板都已加入 PATH 的 `/usr/local`:
|
|
283
|
-
|
|
284
|
-
```ts
|
|
285
|
-
await t.sandbox.runCommand("npm", [
|
|
286
|
-
"install", "-g", "--prefix", "/usr/local", "pnpm@10.34.5",
|
|
287
|
-
]);
|
|
288
|
-
```
|
|
289
|
-
|
|
290
|
-
不要改用 `sudo npm install -g`。模板里已有的 root 全局包可能产生文件冲突。NiceEval 后续会在
|
|
291
|
-
新模板发布时统一这条默认 prefix。在发布说明明确新 release 已满足前,继续保留显式
|
|
292
|
-
`--prefix /usr/local`。
|
|
293
|
-
|
|
294
|
-
```ts title="scripts/build-e2b-template.ts"
|
|
295
|
-
import { Template } from "e2b";
|
|
296
|
-
import { e2bCodingAgentTemplate } from "niceeval/sandbox/e2b-template";
|
|
297
|
-
|
|
298
|
-
const template = e2bCodingAgentTemplate("codex")
|
|
299
|
-
.aptInstall(["ripgrep", "jq"])
|
|
300
|
-
.runCmd("corepack enable && pnpm --version")
|
|
301
|
-
.copy("fixtures/toolchain.lock", "/opt/evals/toolchain.lock");
|
|
302
|
-
|
|
303
|
-
await Template.build(template, "acme-codex-evals:0.144.1-r1", {
|
|
304
|
-
cpuCount: 2,
|
|
305
|
-
memoryMB: 4096,
|
|
306
|
-
});
|
|
307
|
-
```
|
|
308
|
-
|
|
309
|
-
```bash
|
|
310
|
-
e2b auth login
|
|
311
|
-
pnpm tsx scripts/build-e2b-template.ts
|
|
312
|
-
```
|
|
313
|
-
|
|
314
|
-
然后在 Experiment 里只引用构建结果:
|
|
315
|
-
|
|
316
|
-
```ts
|
|
317
|
-
import { e2bSandbox } from "niceeval/sandbox";
|
|
318
|
-
|
|
319
|
-
sandbox: e2bSandbox({ template: "acme-codex-evals:0.144.1-r1" })
|
|
320
|
-
```
|
|
321
|
-
|
|
322
|
-
也可以直接从 NiceEval 公共模板继续派生,只支付项目依赖的构建成本:
|
|
323
|
-
|
|
324
|
-
```ts
|
|
325
|
-
import { NICEEVAL_CODEX_E2B_TEMPLATE } from "niceeval/sandbox/e2b-template";
|
|
326
|
-
|
|
327
|
-
const template = Template()
|
|
328
|
-
.fromTemplate(NICEEVAL_CODEX_E2B_TEMPLATE)
|
|
329
|
-
.aptInstall(["ripgrep", "jq"])
|
|
330
|
-
.runCmd("corepack enable");
|
|
331
|
-
```
|
|
332
|
-
|
|
333
|
-
`e2bCodingAgentTemplate("claude-code" | "codex" | "bub")` 返回原生 `TemplateBuilder`,不是 NiceEval 私有构建 DSL。你可以继续使用 `.aptInstall()`、`.runCmd()`、`.copy()` 等 E2B 能力。构建自己的 alias 会把官方起点和项目依赖冻结在同一个可复现构建输出里。依赖变更时重建并换一个版本化 alias。
|
|
334
|
-
|
|
335
|
-
若 Bub Adapter 配了 `pythonPlugins`,构建模板时把同一组 package 传给 factory,插件集合才会进入兼容性指纹并真正命中预装环境:
|
|
336
|
-
|
|
337
|
-
```ts
|
|
338
|
-
e2bCodingAgentTemplate("bub", {
|
|
339
|
-
bubPythonPackages: ["bub-plugin-memory==1.3.0"],
|
|
340
|
-
})
|
|
341
|
-
```
|
|
342
|
-
|
|
343
|
-
#### Docker:使用 NiceEval 维护的镜像,或从官方 node 基础镜像派生
|
|
344
|
-
|
|
345
|
-
要直接运行 NiceEval 内置的 `claude-code`、`codex` 或 `bub` Adapter,可以使用对应的公开镜像:
|
|
346
|
-
[`niceeval/claude-code`](https://hub.docker.com/r/niceeval/claude-code)、
|
|
347
|
-
[`niceeval/codex`](https://hub.docker.com/r/niceeval/codex) 或
|
|
348
|
-
[`niceeval/bub`](https://hub.docker.com/r/niceeval/bub)。每个镜像只包含自己的 Agent CLI,并为
|
|
349
|
-
`linux/amd64` 和 `linux/arm64` 发布 manifest。tag 与对应的 E2B 公共模板同号——版本位是镜像里那个
|
|
350
|
-
Agent 的版本。稳定 CI 用具名常量或 digest,不要依赖会移动的 `latest`:
|
|
351
|
-
|
|
352
|
-
```ts
|
|
353
|
-
import { NICEEVAL_CODEX_DOCKER_IMAGE, dockerSandbox } from "niceeval/sandbox";
|
|
354
|
-
|
|
355
|
-
sandbox: dockerSandbox({ source: { type: "image", image: NICEEVAL_CODEX_DOCKER_IMAGE } })
|
|
356
|
-
```
|
|
357
|
-
|
|
358
|
-
这个镜像是 NiceEval 维护的公开镜像,不是 Docker 的 `library/*` Official Image。它在 Agent 版本或
|
|
359
|
-
构建配方变化时发布新 tag,跟 NiceEval 库的发版节奏无关。
|
|
360
|
-
|
|
361
|
-
如果只需要一个 Agent,或还要加入项目专有依赖,写 Dockerfile 从 Docker 的官方基线
|
|
362
|
-
`node:24-slim` 派生:
|
|
363
|
-
|
|
364
|
-
```dockerfile title="Dockerfile"
|
|
365
|
-
FROM node:24-slim
|
|
366
|
-
# slim 镜像不带 ca-certificates / git,Agent 和 npm 都要用
|
|
367
|
-
RUN apt-get update \
|
|
368
|
-
&& apt-get install -y --no-install-recommends ca-certificates git \
|
|
369
|
-
&& rm -rf /var/lib/apt/lists/*
|
|
370
|
-
# npm 全局装进 /usr/local/bin,正好落在沙箱注入的 PATH 上
|
|
371
|
-
RUN npm install -g @openai/codex@0.144.1
|
|
372
|
-
```
|
|
373
|
-
|
|
374
|
-
```bash
|
|
375
|
-
docker build -t acme-codex-evals:0.144.1-r1 .
|
|
376
|
-
```
|
|
377
|
-
|
|
378
|
-
然后在 Experiment 里只引用构建结果:
|
|
379
|
-
|
|
380
|
-
```ts
|
|
381
|
-
import { dockerSandbox } from "niceeval/sandbox";
|
|
382
|
-
|
|
383
|
-
sandbox: dockerSandbox({ source: { type: "image", image: "acme-codex-evals:0.144.1-r1" } })
|
|
384
|
-
```
|
|
385
|
-
|
|
386
|
-
Docker Sandbox 沿用镜像自己声明的执行身份:上面这份 Dockerfile 没写 `USER`,容器就默认以 root 跑命令,`/usr/local/bin` 已经在 root 的 PATH 上,`npm install -g` 装的全局二进制天然可见。需要非 root 身份时(比如 Claude Code 在 root 下会拒绝 `--dangerously-skip-permissions`),在 Dockerfile 里加一行 `USER node`(`node:24-slim` 镜像自带这个用户)。也可以用 `dockerSandbox({ source: { type: "image", image }, user: "node" })` 显式覆盖。
|
|
387
|
-
|
|
388
|
-
要装到别处的 Agent(如落在 `~/.local/bin`)记得让它进 PATH。`dockerSandbox` 要求显式 image。稳定 CI 引用不可变 tag。
|
|
389
|
-
|
|
390
|
-
#### Vercel:从官方 runtime 拍快照
|
|
391
|
-
|
|
392
|
-
Vercel 没有 E2B 式的 template registry,也没有 Dockerfile。Sandbox 快照是从一台跑起来的 microVM 拍出来的。用 Vercel SDK 从官方 runtime(`node24`)起一台 Sandbox,装好 Agent CLI,调 `.snapshot()` 拿到 `snap_...`,再把它交给 `vercelSandbox({ snapshotId })`:
|
|
393
|
-
|
|
394
|
-
```ts title="scripts/build-vercel-snapshot.ts"
|
|
395
|
-
import { Sandbox } from "@vercel/sandbox";
|
|
396
|
-
|
|
397
|
-
const sandbox = await Sandbox.create({ runtime: "node24" }); // 官方 runtime 起 microVM
|
|
398
|
-
await sandbox.runCommand({
|
|
399
|
-
cmd: "npm",
|
|
400
|
-
args: ["install", "-g", "@openai/codex@0.144.1"],
|
|
401
|
-
sudo: true, // 全局装进 /usr/local/bin,落在沙箱 PATH 上
|
|
402
|
-
});
|
|
403
|
-
const { snapshotId } = await sandbox.snapshot();
|
|
404
|
-
console.log(snapshotId); // snap_...
|
|
405
|
-
await sandbox.stop();
|
|
406
|
-
```
|
|
407
|
-
|
|
408
|
-
```bash
|
|
409
|
-
pnpm tsx scripts/build-vercel-snapshot.ts
|
|
410
|
-
```
|
|
411
|
-
|
|
412
|
-
然后在 Experiment 里引用打印出的 ID:
|
|
413
|
-
|
|
414
|
-
```ts
|
|
415
|
-
import { vercelSandbox } from "niceeval/sandbox";
|
|
416
|
-
|
|
417
|
-
sandbox: vercelSandbox({ snapshotId: "snap_xxx" })
|
|
418
|
-
```
|
|
419
|
-
|
|
420
|
-
Vercel snapshot 不支持 E2B 式公共发布:snapshot ID 受创建它的 Team/Project 权限控制,同项目成员可以复用,外部用户必须在自己的 Vercel Project 重拍一份。NiceEval 维护项目当前验证过的永不过期 snapshot 是 `snap_7sIjfs71xfmVly0WEUTGhTBoMGeL`,但它不是跨账号公共 ID。
|
|
421
|
-
|
|
422
|
-
### 运行时 checkpoint
|
|
423
|
-
|
|
424
|
-
`createCheckpoint()` / `restoreCheckpoint()` 是另一件事。它们把指定的 Linux 路径打包成 `Buffer`,可以在已创建的 Sandbox 之间恢复文件系统片段:
|
|
425
|
-
|
|
426
|
-
```ts
|
|
427
|
-
import { createCheckpoint, restoreCheckpoint } from "niceeval/sandbox";
|
|
428
|
-
|
|
429
|
-
const data = await createCheckpoint(sandbox, ["/home/user/.cache/tool"]);
|
|
430
|
-
await restoreCheckpoint(nextSandbox, data);
|
|
431
|
-
```
|
|
432
|
-
|
|
433
|
-
这适合运行时缓存,不会创建可发布的 image/template/snapshot,也不管理共享、版本和过期。归档或恢复失败会直接抛错。
|
|
434
|
-
|
|
435
|
-
如果这些目录要跨 Attempt 延续,在动态 `.before()` 中调用 `restoreCheckpoint()`。恢复成功后用 `context.onCleanup()` 登记 `createCheckpoint()`,让回存在实例退出、Provider finalizer 之前执行。
|
|
436
|
-
|
|
437
|
-
`sandboxReuse: true` 只让同一个物理实例在本 Invocation 内继续存在。多个 Invocation 会读写同一 checkpoint 时,在 Experiment 顶层声明 `sharedState: { key }`。NiceEval 在 Experiment setup 或创建 Sandbox 前取得租约,等 checkpoint 回存、Provider finalizer 与 Experiment teardown 完成后释放。它只提供互斥,不负责 checkpoint 存储、事务恢复或跨机器协调。
|
|
263
|
+
怎样从官方基线派生镜像、快照和 template,以及怎样用运行时 checkpoint 在 Attempt 之间延续缓存,见[预制 Sandbox 环境](/zh/tutorials/prebuilt-sandbox)。
|
|
438
264
|
|
|
439
265
|
## 瞬时错误重试
|
|
440
266
|
|
|
441
|
-
内置 Provider 创建 Sandbox
|
|
442
|
-
|
|
443
|
-
`readText`、`readBytes`、`downloadFile`、`uploadFile`、文件写入和目录上传会对 429、5xx、`fetch failed`、连接重置等瞬时传输错误自动做有限重试。文件不存在、权限错误、取消和 Sandbox terminated 不重试。
|
|
444
|
-
|
|
445
|
-
`runCommand` 与 `runShell` 不自动重试。命令可能已经产生副作用,只有你能确认它可安全重复时,才在 hook 或评估用例中显式重试。
|
|
446
|
-
|
|
447
|
-
## Docker
|
|
267
|
+
内置 Provider 创建 Sandbox 时,遇到限流、`fetch failed`、连接重置、5xx、临时网络不可达这类临时失败,会自动按指数退避重试。模板不存在、凭据缺失这类配置错误第一次就报错。重试用完后,这个 Attempt 记为 `errored`。`defineSandbox` 自定义 Provider 的 `create` 是你自己的函数,NiceEval 不替它重试。
|
|
448
268
|
|
|
449
|
-
|
|
269
|
+
`readText`、`readBytes`、`downloadFile`、`uploadFile`、文件写入和目录上传,遇到 429、5xx、`fetch failed`、连接重置等临时传输错误时,会自动重试有限次。文件不存在、权限错误、取消和 Sandbox 已终止不重试。
|
|
450
270
|
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
Vercel Sandbox 适合需要云端隔离、更多资源或更稳定环境的任务。需要相应 token 或 OIDC 配置。
|
|
271
|
+
`runCommand` 和 `runShell` 不自动重试,因为命令可能已经产生了副作用。只有你确认某条命令可以安全重复时,才在 hook 或评估用例里自己重试。
|
|
454
272
|
|
|
455
273
|
## 自定义 Provider
|
|
456
274
|
|
|
457
|
-
|
|
275
|
+
要接入其它服务,用 `defineSandbox`。你要自己负责文件系统、进程、网络和凭据的隔离,NiceEval 不会为任意一个 `Sandbox` 实现自动补上这些安全边界。
|
|
276
|
+
|
|
277
|
+
`create` 拿到的 `feedback` 用来报告创建阶段的状态,比如分配实例、拉镜像或恢复快照:
|
|
458
278
|
|
|
459
279
|
```ts
|
|
460
280
|
import { defineSandbox } from "niceeval/sandbox";
|
|
@@ -480,23 +300,25 @@ export default defineSandbox({
|
|
|
480
300
|
});
|
|
481
301
|
```
|
|
482
302
|
|
|
483
|
-
返回值实现 `Sandbox`
|
|
303
|
+
返回值实现 `Sandbox` 接口即可。`recommendedConcurrency` 是没有其它设置时的默认并发数。
|
|
304
|
+
|
|
305
|
+
不要把 Provider SDK 的原始日志直接写到宿主进程的 `stdout` / `stderr`:临时状态用 `feedback.progress`,需要保留的问题用 `feedback.diagnostic`,无法创建环境时抛错。这样终端的进度面板不会被日志打乱,CI 里也只有一份有序的输出。
|
|
484
306
|
|
|
485
307
|
## 权限和执行身份
|
|
486
308
|
|
|
487
|
-
不同
|
|
309
|
+
不同 Provider 对执行用户、网络、文件系统和进程生命周期的限制不同。写 Fixture 时尽量不要依赖宿主机环境,把依赖写进 `package.json` 或 Fixture 的准备步骤。
|
|
488
310
|
|
|
489
311
|
## 性能建议
|
|
490
312
|
|
|
491
|
-
-
|
|
492
|
-
-
|
|
493
|
-
-
|
|
494
|
-
- 控制 `maxConcurrency`(
|
|
495
|
-
-
|
|
313
|
+
- 把稳定的重依赖做进 image、template 或快照,或者写成低频的 `.before()` 步骤。
|
|
314
|
+
- 减小 Fixture 依赖的体积。
|
|
315
|
+
- 动态内容用小而明确的缓存或预先检查。
|
|
316
|
+
- 控制 `maxConcurrency`(Experiment 字段或 `--max-concurrency`),避免本地 Docker 资源耗尽。
|
|
317
|
+
- 把慢的检查拆开:必须通过的保留为 gate,可有可无的用 `.optional()`。
|
|
496
318
|
|
|
497
319
|
### 在 Attempt 之间复用 Provider 启动
|
|
498
320
|
|
|
499
|
-
|
|
321
|
+
Sandbox 启动时间占了大头时,在 Experiment 里声明 `sandboxReuse: true`。多个 Attempt 会依次共用一台 Sandbox:每台只创建一次,每个 Attempt 仍然执行自己的 `.before()` / `.after()`,题与题之间工作目录会被重置。Docker 上没变的准备步骤还可以直接沿用。
|
|
500
322
|
|
|
501
323
|
```ts
|
|
502
324
|
export default defineExperiment({
|
|
@@ -507,4 +329,4 @@ export default defineExperiment({
|
|
|
507
329
|
});
|
|
508
330
|
```
|
|
509
331
|
|
|
510
|
-
|
|
332
|
+
复用写在 Experiment 文件里,不是命令行开关:同一个实验不能临时打开或关闭。需要全新 Sandbox 做对照时,另写一个不声明复用的实验。代价、各层生命周期的执行次数和准备代码要满足的要求见[复用 Sandbox](/zh/tutorials/sandbox-reuse)。
|