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
|
@@ -47,34 +47,51 @@ function validatePartialResponseContentLength (headers, range, statusCode, retry
|
|
|
47
47
|
// so nothing outside the handler can trigger it.
|
|
48
48
|
class RetryController {
|
|
49
49
|
#onAbort
|
|
50
|
+
#paused = false
|
|
51
|
+
#target = null
|
|
50
52
|
|
|
51
53
|
constructor (onAbort) {
|
|
52
54
|
this.#onAbort = onAbort
|
|
53
|
-
this.target = null
|
|
54
55
|
}
|
|
55
56
|
|
|
56
|
-
|
|
57
|
-
|
|
57
|
+
set target (target) {
|
|
58
|
+
this.#target = target
|
|
59
|
+
if (this.#paused) {
|
|
60
|
+
target?.pause()
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
get target () { return this.#target }
|
|
65
|
+
|
|
66
|
+
pause () {
|
|
67
|
+
this.#paused = true
|
|
68
|
+
this.#target?.pause()
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
resume () {
|
|
72
|
+
this.#paused = false
|
|
73
|
+
this.#target?.resume()
|
|
74
|
+
}
|
|
58
75
|
|
|
59
76
|
abort (reason) {
|
|
60
|
-
this
|
|
77
|
+
this.#target?.abort(reason)
|
|
61
78
|
this.#onAbort(reason)
|
|
62
79
|
}
|
|
63
80
|
|
|
64
|
-
get paused () { return this
|
|
65
|
-
get aborted () { return this
|
|
66
|
-
get reason () { return this
|
|
67
|
-
get rawHeaders () { return this
|
|
81
|
+
get paused () { return this.#paused || (this.#target?.paused ?? false) }
|
|
82
|
+
get aborted () { return this.#target?.aborted ?? false }
|
|
83
|
+
get reason () { return this.#target?.reason ?? null }
|
|
84
|
+
get rawHeaders () { return this.#target?.rawHeaders ?? null }
|
|
68
85
|
set rawHeaders (value) {
|
|
69
|
-
if (this
|
|
70
|
-
this
|
|
86
|
+
if (this.#target) {
|
|
87
|
+
this.#target.rawHeaders = value
|
|
71
88
|
}
|
|
72
89
|
}
|
|
73
90
|
|
|
74
|
-
get rawTrailers () { return this
|
|
91
|
+
get rawTrailers () { return this.#target?.rawTrailers ?? null }
|
|
75
92
|
set rawTrailers (value) {
|
|
76
|
-
if (this
|
|
77
|
-
this
|
|
93
|
+
if (this.#target) {
|
|
94
|
+
this.#target.rawTrailers = value
|
|
78
95
|
}
|
|
79
96
|
}
|
|
80
97
|
}
|
|
@@ -142,6 +159,12 @@ class RetryHandler {
|
|
|
142
159
|
// Backoff timer returned by the retry policy, so #onAbort can cancel it.
|
|
143
160
|
// Null for custom policies that do not return their timer.
|
|
144
161
|
this.retryTimer = null
|
|
162
|
+
// A response can complete while its controller is paused if the peer closes
|
|
163
|
+
// the connection. Hold its body until the retry policy decides whether to
|
|
164
|
+
// discard it for a retry or forward it as the final response.
|
|
165
|
+
this.pendingResponseData = null
|
|
166
|
+
this.pendingResponseTrailers = null
|
|
167
|
+
this.pendingResponseEnded = false
|
|
145
168
|
// Set once an abort during the backoff delivered the terminal error
|
|
146
169
|
// downstream; late policy callbacks and connection errors are then moot.
|
|
147
170
|
this.aborted = false
|
|
@@ -183,6 +206,13 @@ class RetryHandler {
|
|
|
183
206
|
this.retryPending = false
|
|
184
207
|
this.retryTimer = null
|
|
185
208
|
|
|
209
|
+
const pendingData = this.pendingResponseData
|
|
210
|
+
const pendingTrailers = this.pendingResponseTrailers
|
|
211
|
+
const pendingEnd = this.pendingResponseEnded
|
|
212
|
+
this.pendingResponseData = null
|
|
213
|
+
this.pendingResponseTrailers = null
|
|
214
|
+
this.pendingResponseEnded = false
|
|
215
|
+
|
|
186
216
|
if (passedErr) {
|
|
187
217
|
if (this.headersSent) {
|
|
188
218
|
// The downstream handler already received the response from an
|
|
@@ -193,6 +223,15 @@ class RetryHandler {
|
|
|
193
223
|
this.headersSent = true
|
|
194
224
|
this.checkpointResponseEnd(headers)
|
|
195
225
|
this.handler.onResponseStart?.(this.controllerProxy, statusCode, headers, statusMessage)
|
|
226
|
+
controller.resume()
|
|
227
|
+
|
|
228
|
+
if (pendingEnd) {
|
|
229
|
+
for (const chunk of pendingData) {
|
|
230
|
+
this.onResponseData(controller, chunk)
|
|
231
|
+
}
|
|
232
|
+
this.onResponseEnd(controller, pendingTrailers)
|
|
233
|
+
}
|
|
234
|
+
return
|
|
196
235
|
}
|
|
197
236
|
controller.resume()
|
|
198
237
|
return
|
|
@@ -200,6 +239,9 @@ class RetryHandler {
|
|
|
200
239
|
|
|
201
240
|
this.error = err
|
|
202
241
|
controller.resume()
|
|
242
|
+
if (pendingEnd) {
|
|
243
|
+
this.onResponseEnd(controller, pendingTrailers)
|
|
244
|
+
}
|
|
203
245
|
}
|
|
204
246
|
|
|
205
247
|
// The pause()/resume() pair (here and in shouldRetry) acts on THIS
|
|
@@ -213,6 +255,9 @@ class RetryHandler {
|
|
|
213
255
|
// The default policy returns its backoff timer so an abort can cancel it;
|
|
214
256
|
// a custom policy may return anything (or nothing), which is ignored.
|
|
215
257
|
this.retryPending = true
|
|
258
|
+
this.pendingResponseData = []
|
|
259
|
+
this.pendingResponseTrailers = null
|
|
260
|
+
this.pendingResponseEnded = false
|
|
216
261
|
this.retryTimer = this.retryOpts.retry(
|
|
217
262
|
err,
|
|
218
263
|
{
|
|
@@ -464,6 +509,11 @@ class RetryHandler {
|
|
|
464
509
|
}
|
|
465
510
|
|
|
466
511
|
onResponseData (_controller, chunk) {
|
|
512
|
+
if (this.pendingResponseData !== null) {
|
|
513
|
+
this.pendingResponseData.push(chunk)
|
|
514
|
+
return
|
|
515
|
+
}
|
|
516
|
+
|
|
467
517
|
if (this.error) {
|
|
468
518
|
return
|
|
469
519
|
}
|
|
@@ -474,6 +524,12 @@ class RetryHandler {
|
|
|
474
524
|
}
|
|
475
525
|
|
|
476
526
|
onResponseEnd (_controller, trailers) {
|
|
527
|
+
if (this.pendingResponseData !== null) {
|
|
528
|
+
this.pendingResponseTrailers = trailers
|
|
529
|
+
this.pendingResponseEnded = true
|
|
530
|
+
return
|
|
531
|
+
}
|
|
532
|
+
|
|
477
533
|
if (this.error && this.retryOpts.throwOnError) {
|
|
478
534
|
throw this.error
|
|
479
535
|
}
|
|
@@ -587,6 +643,9 @@ class RetryHandler {
|
|
|
587
643
|
this.retryPending = false
|
|
588
644
|
clearTimeout(this.retryTimer)
|
|
589
645
|
this.retryTimer = null
|
|
646
|
+
this.pendingResponseData = null
|
|
647
|
+
this.pendingResponseTrailers = null
|
|
648
|
+
this.pendingResponseEnded = false
|
|
590
649
|
this.handler.onResponseError?.(this.controllerProxy, reason ?? new RequestAbortedError())
|
|
591
650
|
}
|
|
592
651
|
}
|
|
@@ -330,6 +330,8 @@ function sendCachedValue (handler, opts, result, age, context, isStale) {
|
|
|
330
330
|
assert(!stream.destroyed, 'stream should not be destroyed')
|
|
331
331
|
assert(!stream.readableDidRead, 'stream should not be readableDidRead')
|
|
332
332
|
|
|
333
|
+
let aborted = false
|
|
334
|
+
|
|
333
335
|
const controller = {
|
|
334
336
|
rawHeaders: [],
|
|
335
337
|
rawTrailers: [],
|
|
@@ -343,12 +345,13 @@ function sendCachedValue (handler, opts, result, age, context, isStale) {
|
|
|
343
345
|
return stream.isPaused()
|
|
344
346
|
},
|
|
345
347
|
get aborted () {
|
|
346
|
-
return
|
|
348
|
+
return aborted
|
|
347
349
|
},
|
|
348
350
|
get reason () {
|
|
349
351
|
return stream.errored
|
|
350
352
|
},
|
|
351
353
|
abort (reason) {
|
|
354
|
+
aborted = true
|
|
352
355
|
stream.destroy(reason ?? new AbortError())
|
|
353
356
|
}
|
|
354
357
|
}
|
|
@@ -9,8 +9,63 @@ const DecoratorHandler = require('../handler/decorator-handler')
|
|
|
9
9
|
/** @typedef {import('node:stream').Transform} Controller */
|
|
10
10
|
/** @typedef {Transform&import('node:zlib').Zlib} DecompressorStream */
|
|
11
11
|
|
|
12
|
+
class DecompressController {
|
|
13
|
+
#onPause
|
|
14
|
+
#onResume
|
|
15
|
+
#onAbort
|
|
16
|
+
#paused = false
|
|
17
|
+
|
|
18
|
+
constructor (onPause, onResume, onAbort) {
|
|
19
|
+
this.#onPause = onPause
|
|
20
|
+
this.#onResume = onResume
|
|
21
|
+
this.#onAbort = onAbort
|
|
22
|
+
this.target = null
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
pause () {
|
|
26
|
+
if (this.#paused) {
|
|
27
|
+
return
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
this.#paused = true
|
|
31
|
+
this.#onPause()
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
resume () {
|
|
35
|
+
if (!this.#paused) {
|
|
36
|
+
return
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
this.#paused = false
|
|
40
|
+
this.#onResume()
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
abort (reason) {
|
|
44
|
+
this.target?.abort(reason)
|
|
45
|
+
this.#onAbort(reason)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
get paused () { return this.#paused }
|
|
49
|
+
get aborted () { return this.target?.aborted ?? false }
|
|
50
|
+
get reason () { return this.target?.reason ?? null }
|
|
51
|
+
get rawHeaders () { return this.target?.rawHeaders ?? null }
|
|
52
|
+
set rawHeaders (value) {
|
|
53
|
+
if (this.target) {
|
|
54
|
+
this.target.rawHeaders = value
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
get rawTrailers () { return this.target?.rawTrailers ?? null }
|
|
59
|
+
set rawTrailers (value) {
|
|
60
|
+
if (this.target) {
|
|
61
|
+
this.target.rawTrailers = value
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
12
66
|
/** @type {Record<string, () => DecompressorStream>} */
|
|
13
67
|
const supportedEncodings = {
|
|
68
|
+
__proto__: null,
|
|
14
69
|
gzip: createGunzip,
|
|
15
70
|
'x-gzip': createGunzip,
|
|
16
71
|
br: createBrotliDecompress,
|
|
@@ -21,7 +76,7 @@ const supportedEncodings = {
|
|
|
21
76
|
}
|
|
22
77
|
|
|
23
78
|
const defaultSkipStatusCodes = /** @type {const} */ ([204, 304])
|
|
24
|
-
const defaultMaxSize =
|
|
79
|
+
const defaultMaxSize = 0
|
|
25
80
|
|
|
26
81
|
/**
|
|
27
82
|
* Limits the output of one stage in a decompression chain.
|
|
@@ -53,7 +108,7 @@ let warningEmitted = /** @type {boolean} */ (false)
|
|
|
53
108
|
* @typedef {Object} DecompressHandlerOptions
|
|
54
109
|
* @property {number[]|Readonly<number[]>} [skipStatusCodes=[204, 304]] - List of status codes to skip decompression for
|
|
55
110
|
* @property {boolean} [skipErrorResponses] - Whether to skip decompression for error responses (status codes >= 400)
|
|
56
|
-
* @property {number} [maxSize=
|
|
111
|
+
* @property {number} [maxSize=0] - Maximum decompressed response size in bytes. 0 disables the limit
|
|
57
112
|
*/
|
|
58
113
|
|
|
59
114
|
class DecompressHandler extends DecoratorHandler {
|
|
@@ -73,16 +128,130 @@ class DecompressHandler extends DecoratorHandler {
|
|
|
73
128
|
#terminated = false
|
|
74
129
|
/** @type {boolean} */
|
|
75
130
|
#inputEnded = false
|
|
131
|
+
/** @type {boolean} */
|
|
132
|
+
#inputBackpressured = false
|
|
133
|
+
/** @type {boolean} */
|
|
134
|
+
#upstreamPaused = false
|
|
135
|
+
/** @type {boolean} */
|
|
136
|
+
#draining = false
|
|
137
|
+
/** @type {boolean} */
|
|
138
|
+
#drainRequested = false
|
|
139
|
+
/** @type {boolean} */
|
|
140
|
+
#completionPending = false
|
|
141
|
+
/** @type {DecompressorStream | undefined} */
|
|
142
|
+
#finalDecompressor
|
|
143
|
+
/** @type {DecompressController} */
|
|
144
|
+
#controller
|
|
76
145
|
|
|
77
146
|
constructor (handler, { skipStatusCodes = defaultSkipStatusCodes, skipErrorResponses = true, maxSize = defaultMaxSize } = {}) {
|
|
78
|
-
if (!Number.isSafeInteger(maxSize) || maxSize <
|
|
79
|
-
throw new InvalidArgumentError('maxSize must be a
|
|
147
|
+
if (!Number.isSafeInteger(maxSize) || maxSize < 0) {
|
|
148
|
+
throw new InvalidArgumentError('maxSize must be a non-negative integer')
|
|
80
149
|
}
|
|
81
150
|
|
|
82
151
|
super(handler)
|
|
83
152
|
this.#skipStatusCodes = skipStatusCodes
|
|
84
153
|
this.#skipErrorResponses = skipErrorResponses
|
|
85
154
|
this.#maxSize = maxSize
|
|
155
|
+
this.#controller = new DecompressController(
|
|
156
|
+
() => this.#onDownstreamPause(),
|
|
157
|
+
() => this.#onDownstreamResume(),
|
|
158
|
+
reason => {
|
|
159
|
+
if (this.#inputEnded && !this.#terminated) {
|
|
160
|
+
this.onResponseError(this.#controller, reason)
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
)
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
#onDownstreamPause () {
|
|
167
|
+
this.#pauseUpstream()
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
#onDownstreamResume () {
|
|
171
|
+
const drainWasDeferred = this.#draining
|
|
172
|
+
this.#drainOutput()
|
|
173
|
+
if (!drainWasDeferred) {
|
|
174
|
+
this.#resumeUpstreamIfNeeded()
|
|
175
|
+
this.#finishIfReady()
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
#pauseUpstream () {
|
|
180
|
+
if (!this.#upstreamPaused && !this.#terminated) {
|
|
181
|
+
this.#upstreamPaused = true
|
|
182
|
+
this.#controller.target?.pause()
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
#resumeUpstreamIfNeeded () {
|
|
187
|
+
if (this.#upstreamPaused && !this.#controller.paused && !this.#inputBackpressured) {
|
|
188
|
+
this.#upstreamPaused = false
|
|
189
|
+
if (!this.#inputEnded) {
|
|
190
|
+
this.#controller.target?.resume()
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
#drainOutput () {
|
|
196
|
+
if (this.#terminated || this.#controller.paused || !this.#finalDecompressor) {
|
|
197
|
+
return
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
if (this.#draining) {
|
|
201
|
+
this.#drainRequested = true
|
|
202
|
+
return
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
this.#draining = true
|
|
206
|
+
try {
|
|
207
|
+
do {
|
|
208
|
+
this.#drainRequested = false
|
|
209
|
+
let chunk
|
|
210
|
+
while (!this.#terminated && !this.#controller.paused && (chunk = this.#finalDecompressor.read()) !== null) {
|
|
211
|
+
if (this.#maxSize > 0) {
|
|
212
|
+
const decompressedSize = this.#decompressedSize + chunk.length
|
|
213
|
+
if (decompressedSize > this.#maxSize) {
|
|
214
|
+
this.#fail(new ResponseExceededMaxSizeError(
|
|
215
|
+
`Decompressed response size (${decompressedSize}) exceeded maxSize (${this.#maxSize})`
|
|
216
|
+
))
|
|
217
|
+
return
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
this.#decompressedSize = decompressedSize
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
const result = super.onResponseData(this.#controller, chunk)
|
|
224
|
+
if (result === false && !this.#controller.paused) {
|
|
225
|
+
this.#controller.pause()
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
} while (this.#drainRequested && !this.#terminated && !this.#controller.paused)
|
|
229
|
+
} finally {
|
|
230
|
+
this.#draining = false
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
this.#resumeUpstreamIfNeeded()
|
|
234
|
+
this.#finishIfReady()
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
#finishIfReady () {
|
|
238
|
+
if (this.#terminated || !this.#completionPending || this.#controller.paused || this.#draining) {
|
|
239
|
+
return
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
this.#terminated = true
|
|
243
|
+
this.#cleanupDecompressors()
|
|
244
|
+
super.onResponseEnd(this.#controller, this.#trailers)
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
#onDecompressionEnd () {
|
|
248
|
+
if (this.#terminated) {
|
|
249
|
+
return
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
this.#completionPending = true
|
|
253
|
+
this.#drainOutput()
|
|
254
|
+
this.#finishIfReady()
|
|
86
255
|
}
|
|
87
256
|
|
|
88
257
|
/**
|
|
@@ -138,7 +307,7 @@ class DecompressHandler extends DecoratorHandler {
|
|
|
138
307
|
const streams = []
|
|
139
308
|
for (let i = 0; i < decompressors.length; i++) {
|
|
140
309
|
streams.push(decompressors[i])
|
|
141
|
-
if (i < decompressors.length - 1) {
|
|
310
|
+
if (i < decompressors.length - 1 && this.#maxSize > 0) {
|
|
142
311
|
streams.push(createMaxSizeLimiter(this.#maxSize))
|
|
143
312
|
}
|
|
144
313
|
}
|
|
@@ -148,11 +317,10 @@ class DecompressHandler extends DecoratorHandler {
|
|
|
148
317
|
|
|
149
318
|
/**
|
|
150
319
|
* Stops decompression and reports an error.
|
|
151
|
-
* @param {Controller} controller - The controller to coordinate with
|
|
152
320
|
* @param {Error} error - The decompression error
|
|
153
321
|
* @returns {void}
|
|
154
322
|
*/
|
|
155
|
-
#fail (
|
|
323
|
+
#fail (error) {
|
|
156
324
|
if (this.#terminated) {
|
|
157
325
|
return
|
|
158
326
|
}
|
|
@@ -160,75 +328,41 @@ class DecompressHandler extends DecoratorHandler {
|
|
|
160
328
|
if (this.#inputEnded) {
|
|
161
329
|
// The request is already marked complete once the compressed input ends,
|
|
162
330
|
// so controller.abort() can no longer propagate decoder flush errors.
|
|
163
|
-
this.onResponseError(controller, error)
|
|
331
|
+
this.onResponseError(this.#controller, error)
|
|
164
332
|
} else {
|
|
165
|
-
controller.abort(error)
|
|
333
|
+
this.#controller.abort(error)
|
|
166
334
|
}
|
|
167
335
|
}
|
|
168
336
|
|
|
169
337
|
/**
|
|
170
|
-
* Sets up event handlers for
|
|
338
|
+
* Sets up event handlers for the final decompressor stream.
|
|
171
339
|
* @param {DecompressorStream} decompressor - The decompressor stream
|
|
172
|
-
* @param {Controller} controller - The controller to coordinate with
|
|
173
340
|
* @returns {void}
|
|
174
341
|
*/
|
|
175
|
-
#setupDecompressorEvents (decompressor
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
let chunk
|
|
182
|
-
while ((chunk = decompressor.read()) !== null) {
|
|
183
|
-
const decompressedSize = this.#decompressedSize + chunk.length
|
|
184
|
-
if (decompressedSize > this.#maxSize) {
|
|
185
|
-
this.#fail(controller, new ResponseExceededMaxSizeError(
|
|
186
|
-
`Decompressed response size (${decompressedSize}) exceeded maxSize (${this.#maxSize})`
|
|
187
|
-
))
|
|
188
|
-
return
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
this.#decompressedSize = decompressedSize
|
|
192
|
-
const result = super.onResponseData(controller, chunk)
|
|
193
|
-
if (result === false) {
|
|
194
|
-
break
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
})
|
|
198
|
-
|
|
199
|
-
decompressor.on('error', (error) => {
|
|
200
|
-
this.#fail(controller, error)
|
|
201
|
-
})
|
|
342
|
+
#setupDecompressorEvents (decompressor) {
|
|
343
|
+
this.#finalDecompressor = decompressor
|
|
344
|
+
decompressor.on('readable', () => this.#drainOutput())
|
|
345
|
+
decompressor.on('error', (error) => this.#fail(error))
|
|
202
346
|
}
|
|
203
347
|
|
|
204
348
|
/**
|
|
205
349
|
* Sets up event handling for a single decompressor
|
|
206
|
-
* @param {Controller} controller - The controller to handle events
|
|
207
350
|
* @returns {void}
|
|
208
351
|
*/
|
|
209
|
-
#setupSingleDecompressor (
|
|
352
|
+
#setupSingleDecompressor () {
|
|
210
353
|
const decompressor = this.#decompressors[0]
|
|
211
|
-
this.#setupDecompressorEvents(decompressor
|
|
354
|
+
this.#setupDecompressorEvents(decompressor)
|
|
212
355
|
|
|
213
|
-
decompressor.on('end', () =>
|
|
214
|
-
if (this.#terminated) {
|
|
215
|
-
return
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
this.#terminated = true
|
|
219
|
-
this.#cleanupDecompressors()
|
|
220
|
-
super.onResponseEnd(controller, this.#trailers)
|
|
221
|
-
})
|
|
356
|
+
decompressor.on('end', () => this.#onDecompressionEnd())
|
|
222
357
|
}
|
|
223
358
|
|
|
224
359
|
/**
|
|
225
360
|
* Sets up event handling for multiple chained decompressors using pipeline
|
|
226
|
-
* @param {Controller} controller - The controller to handle events
|
|
227
361
|
* @returns {void}
|
|
228
362
|
*/
|
|
229
|
-
#setupMultipleDecompressors (
|
|
363
|
+
#setupMultipleDecompressors () {
|
|
230
364
|
const lastDecompressor = this.#decompressors[this.#decompressors.length - 1]
|
|
231
|
-
this.#setupDecompressorEvents(lastDecompressor
|
|
365
|
+
this.#setupDecompressorEvents(lastDecompressor)
|
|
232
366
|
|
|
233
367
|
pipeline(this.#decompressors, (err) => {
|
|
234
368
|
if (this.#terminated) {
|
|
@@ -236,13 +370,26 @@ class DecompressHandler extends DecoratorHandler {
|
|
|
236
370
|
}
|
|
237
371
|
|
|
238
372
|
if (err) {
|
|
239
|
-
this.#fail(
|
|
373
|
+
this.#fail(err)
|
|
240
374
|
return
|
|
241
375
|
}
|
|
242
376
|
|
|
243
|
-
this.#
|
|
244
|
-
|
|
245
|
-
|
|
377
|
+
this.#onDecompressionEnd()
|
|
378
|
+
})
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
#setupInputBackpressure () {
|
|
382
|
+
const decompressor = this.#decompressors[0]
|
|
383
|
+
decompressor.on('drain', () => {
|
|
384
|
+
if (this.#terminated) {
|
|
385
|
+
return
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
this.#inputBackpressured = false
|
|
389
|
+
if (!this.#controller.paused) {
|
|
390
|
+
this.#drainOutput()
|
|
391
|
+
this.#resumeUpstreamIfNeeded()
|
|
392
|
+
}
|
|
246
393
|
})
|
|
247
394
|
}
|
|
248
395
|
|
|
@@ -252,6 +399,16 @@ class DecompressHandler extends DecoratorHandler {
|
|
|
252
399
|
*/
|
|
253
400
|
#cleanupDecompressors () {
|
|
254
401
|
this.#decompressors.length = 0
|
|
402
|
+
this.#finalDecompressor = undefined
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
onRequestStart (controller, context) {
|
|
406
|
+
this.#controller.target = controller
|
|
407
|
+
return super.onRequestStart(this.#controller, context)
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
onRequestUpgrade (controller, statusCode, headers, socket) {
|
|
411
|
+
return super.onRequestUpgrade(this.#controller, statusCode, headers, socket)
|
|
255
412
|
}
|
|
256
413
|
|
|
257
414
|
/**
|
|
@@ -262,18 +419,24 @@ class DecompressHandler extends DecoratorHandler {
|
|
|
262
419
|
* @returns {void}
|
|
263
420
|
*/
|
|
264
421
|
onResponseStart (controller, statusCode, headers, statusMessage) {
|
|
265
|
-
|
|
422
|
+
// Repeated field lines reach us as an array. RFC 9110 section 5.3 lets a
|
|
423
|
+
// recipient join them with commas, which yields the single-line form the
|
|
424
|
+
// decompression chain already handles.
|
|
425
|
+
const rawContentEncoding = headers['content-encoding']
|
|
426
|
+
const contentEncoding = Array.isArray(rawContentEncoding)
|
|
427
|
+
? rawContentEncoding.join(',')
|
|
428
|
+
: rawContentEncoding
|
|
266
429
|
|
|
267
430
|
// If content encoding is not supported or status code is in skip list
|
|
268
431
|
if (this.#shouldSkipDecompression(contentEncoding, statusCode)) {
|
|
269
|
-
return super.onResponseStart(controller, statusCode, headers, statusMessage)
|
|
432
|
+
return super.onResponseStart(this.#controller, statusCode, headers, statusMessage)
|
|
270
433
|
}
|
|
271
434
|
|
|
272
435
|
const decompressors = this.#createDecompressionChain(contentEncoding.toLowerCase())
|
|
273
436
|
|
|
274
437
|
if (decompressors.length === 0) {
|
|
275
438
|
this.#cleanupDecompressors()
|
|
276
|
-
return super.onResponseStart(controller, statusCode, headers, statusMessage)
|
|
439
|
+
return super.onResponseStart(this.#controller, statusCode, headers, statusMessage)
|
|
277
440
|
}
|
|
278
441
|
|
|
279
442
|
this.#decompressors = decompressors
|
|
@@ -281,8 +444,8 @@ class DecompressHandler extends DecoratorHandler {
|
|
|
281
444
|
// Remove compression headers since we're decompressing
|
|
282
445
|
const { 'content-encoding': _, 'content-length': __, ...newHeaders } = headers
|
|
283
446
|
|
|
284
|
-
if (controller
|
|
285
|
-
const rawHeaders = controller.rawHeaders
|
|
447
|
+
if (this.#controller.rawHeaders) {
|
|
448
|
+
const rawHeaders = this.#controller.rawHeaders
|
|
286
449
|
|
|
287
450
|
if (Array.isArray(rawHeaders)) {
|
|
288
451
|
const filteredHeaders = []
|
|
@@ -308,13 +471,14 @@ class DecompressHandler extends DecoratorHandler {
|
|
|
308
471
|
}
|
|
309
472
|
}
|
|
310
473
|
|
|
474
|
+
this.#setupInputBackpressure()
|
|
311
475
|
if (this.#decompressors.length === 1) {
|
|
312
|
-
this.#setupSingleDecompressor(
|
|
476
|
+
this.#setupSingleDecompressor()
|
|
313
477
|
} else {
|
|
314
|
-
this.#setupMultipleDecompressors(
|
|
478
|
+
this.#setupMultipleDecompressors()
|
|
315
479
|
}
|
|
316
480
|
|
|
317
|
-
return super.onResponseStart(controller, statusCode, newHeaders, statusMessage)
|
|
481
|
+
return super.onResponseStart(this.#controller, statusCode, newHeaders, statusMessage)
|
|
318
482
|
}
|
|
319
483
|
|
|
320
484
|
/**
|
|
@@ -324,10 +488,13 @@ class DecompressHandler extends DecoratorHandler {
|
|
|
324
488
|
*/
|
|
325
489
|
onResponseData (controller, chunk) {
|
|
326
490
|
if (this.#decompressors.length > 0) {
|
|
327
|
-
this.#decompressors[0].write(chunk)
|
|
491
|
+
if (!this.#decompressors[0].write(chunk)) {
|
|
492
|
+
this.#inputBackpressured = true
|
|
493
|
+
this.#pauseUpstream()
|
|
494
|
+
}
|
|
328
495
|
return
|
|
329
496
|
}
|
|
330
|
-
super.onResponseData(controller, chunk)
|
|
497
|
+
return super.onResponseData(this.#controller, chunk)
|
|
331
498
|
}
|
|
332
499
|
|
|
333
500
|
/**
|
|
@@ -342,7 +509,7 @@ class DecompressHandler extends DecoratorHandler {
|
|
|
342
509
|
this.#decompressors[0].end()
|
|
343
510
|
return
|
|
344
511
|
}
|
|
345
|
-
super.onResponseEnd(controller, trailers)
|
|
512
|
+
return super.onResponseEnd(this.#controller, trailers)
|
|
346
513
|
}
|
|
347
514
|
|
|
348
515
|
/**
|
|
@@ -360,7 +527,7 @@ class DecompressHandler extends DecoratorHandler {
|
|
|
360
527
|
decompressor.destroy()
|
|
361
528
|
}
|
|
362
529
|
this.#cleanupDecompressors()
|
|
363
|
-
super.onResponseError(controller, err)
|
|
530
|
+
super.onResponseError(this.#controller, err)
|
|
364
531
|
}
|
|
365
532
|
}
|
|
366
533
|
|