niceeval 0.13.2 → 0.13.3
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/dist/agents/bub.cjs +4 -4
- package/dist/agents/bub.cjs.map +1 -1
- package/dist/agents/bub.d.cts +2 -2
- package/dist/agents/bub.d.mts +2 -2
- package/dist/agents/bub.d.ts +2 -2
- package/dist/agents/claude-code-native.cjs +213 -0
- package/dist/agents/claude-code-native.cjs.map +1 -0
- package/dist/agents/claude-code-native.d.cts +5 -0
- package/dist/agents/claude-code-native.d.mts +5 -0
- package/dist/agents/claude-code-native.d.ts +5 -0
- package/dist/agents/claude-code-native.js +6 -0
- package/dist/agents/claude-code-native.js.map +1 -0
- package/dist/agents/claude-code.cjs +26 -80
- package/dist/agents/claude-code.cjs.map +1 -1
- package/dist/agents/codex-app-server.cjs +314 -0
- package/dist/agents/codex-app-server.cjs.map +1 -0
- package/dist/agents/codex-app-server.d.cts +9 -0
- package/dist/agents/codex-app-server.d.mts +9 -0
- package/dist/agents/codex-app-server.d.ts +9 -0
- package/dist/agents/codex-app-server.js +6 -0
- package/dist/agents/codex-app-server.js.map +1 -0
- package/dist/agents/codex.cjs +19 -68
- package/dist/agents/codex.cjs.map +1 -1
- package/dist/agents/codex.d.cts +3 -3
- package/dist/agents/codex.d.mts +3 -3
- package/dist/agents/codex.d.ts +3 -3
- package/dist/agents/index.cjs +3 -1
- package/dist/agents/index.cjs.map +1 -1
- package/dist/agents/index.d.cts +1 -0
- package/dist/agents/index.d.mts +1 -0
- package/dist/agents/index.d.ts +1 -0
- package/dist/agents/index.js +84 -82
- package/dist/agents/index.mjs +84 -82
- package/dist/agents/managed-jsonl.cjs +207 -0
- package/dist/agents/managed-jsonl.cjs.map +1 -0
- package/dist/agents/managed-jsonl.d.cts +39 -0
- package/dist/agents/managed-jsonl.d.mts +39 -0
- package/dist/agents/managed-jsonl.d.ts +39 -0
- package/dist/agents/managed-jsonl.js +6 -0
- package/dist/agents/managed-jsonl.js.map +1 -0
- package/dist/agents/managed-process.cjs +31 -0
- package/dist/agents/managed-process.cjs.map +1 -0
- package/dist/agents/managed-process.d.cts +3 -0
- package/dist/agents/managed-process.d.mts +3 -0
- package/dist/agents/managed-process.d.ts +3 -0
- package/dist/agents/managed-process.js +6 -0
- package/dist/agents/managed-process.js.map +1 -0
- package/dist/agents/omp.cjs +18 -1
- package/dist/agents/omp.cjs.map +1 -1
- package/dist/agents/sdk-streams.cjs +11 -4
- package/dist/agents/sdk-streams.cjs.map +1 -1
- package/dist/agents/types.cjs.map +1 -1
- package/dist/agents/types.d.cts +8 -0
- package/dist/agents/types.d.mts +8 -0
- package/dist/agents/types.d.ts +8 -0
- package/dist/analysis/bindings.cjs +74 -19
- package/dist/analysis/bindings.cjs.map +1 -1
- package/dist/analysis/bindings.d.cts +534 -156
- package/dist/analysis/bindings.d.mts +534 -156
- package/dist/analysis/bindings.d.ts +534 -156
- package/dist/analysis/domain-view.cjs.map +1 -1
- package/dist/analysis/domain-view.d.cts +137 -8
- package/dist/analysis/domain-view.d.mts +137 -8
- package/dist/analysis/domain-view.d.ts +137 -8
- package/dist/analysis/index.cjs.map +1 -1
- package/dist/analysis/index.d.cts +1 -1
- package/dist/analysis/index.d.mts +1 -1
- package/dist/analysis/index.d.ts +1 -1
- package/dist/assertions/api.cjs.map +1 -1
- package/dist/assertions/api.d.cts +62 -0
- package/dist/assertions/api.d.mts +62 -0
- package/dist/assertions/api.d.ts +62 -0
- package/dist/assertions/judge.cjs +56 -5
- package/dist/assertions/judge.cjs.map +1 -1
- package/dist/assertions/match.cjs +66 -42
- package/dist/assertions/match.cjs.map +1 -1
- package/dist/assertions/match.d.cts +13 -0
- package/dist/assertions/match.d.mts +13 -0
- package/dist/assertions/match.d.ts +13 -0
- package/dist/assertions/record/attachment.cjs +104 -33
- package/dist/assertions/record/attachment.cjs.map +1 -1
- package/dist/assertions/record/attachment.d.cts +294 -57
- package/dist/assertions/record/attachment.d.mts +294 -57
- package/dist/assertions/record/attachment.d.ts +294 -57
- package/dist/assertions/record/codec.cjs +91 -17
- package/dist/assertions/record/codec.cjs.map +1 -1
- package/dist/assertions/record/codec.d.cts +280 -52
- package/dist/assertions/record/codec.d.mts +280 -52
- package/dist/assertions/record/codec.d.ts +280 -52
- package/dist/assertions/record/index.js +2 -0
- package/dist/assertions/record/model.cjs +16 -0
- package/dist/assertions/record/model.cjs.map +1 -1
- package/dist/assertions/record/model.d.cts +120 -13
- package/dist/assertions/record/model.d.mts +120 -13
- package/dist/assertions/record/model.d.ts +120 -13
- package/dist/assertions/record/model.js +2 -0
- package/dist/assertions/record/producer.cjs +70 -50
- package/dist/assertions/record/producer.cjs.map +1 -1
- package/dist/assertions/record/producer.d.cts +8 -7
- package/dist/assertions/record/producer.d.mts +8 -7
- package/dist/assertions/record/producer.d.ts +8 -7
- package/dist/assertions/runtime.cjs +49 -7
- package/dist/assertions/runtime.cjs.map +1 -1
- package/dist/cli/application.cjs +40 -0
- package/dist/cli/application.cjs.map +1 -0
- package/dist/cli/application.d.cts +129 -0
- package/dist/cli/application.d.mts +129 -0
- package/dist/cli/application.d.ts +129 -0
- package/dist/cli/application.js +24 -0
- package/dist/cli/application.js.map +1 -0
- package/dist/cli/bootstrap.cjs +10 -4
- package/dist/cli/bootstrap.cjs.map +1 -1
- package/dist/cli/node-application.cjs +123 -0
- package/dist/cli/node-application.cjs.map +1 -0
- package/dist/cli/node-application.d.cts +14 -0
- package/dist/cli/node-application.d.mts +14 -0
- package/dist/cli/node-application.d.ts +14 -0
- package/dist/cli/node-application.js +26 -0
- package/dist/cli/node-application.js.map +1 -0
- package/dist/cli/program.cjs +2807 -0
- package/dist/cli/program.cjs.map +1 -0
- package/dist/cli/program.d.cts +352 -0
- package/dist/cli/program.d.mts +352 -0
- package/dist/cli/program.d.ts +352 -0
- package/dist/cli/program.js +36 -0
- package/dist/cli/program.js.map +1 -0
- package/dist/cli/project-configuration.cjs +134 -0
- package/dist/cli/project-configuration.cjs.map +1 -0
- package/dist/cli/project-configuration.d.cts +64 -0
- package/dist/cli/project-configuration.d.mts +64 -0
- package/dist/cli/project-configuration.d.ts +64 -0
- package/dist/cli/project-configuration.js +22 -0
- package/dist/cli/project-configuration.js.map +1 -0
- package/dist/cli/record.cjs +20 -4
- package/dist/cli/record.cjs.map +1 -1
- package/dist/cli/record.d.cts +3 -3
- package/dist/cli/record.d.mts +3 -3
- package/dist/cli/record.d.ts +3 -3
- package/dist/cli.cjs +19 -3130
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.d.cts +2 -148
- package/dist/cli.d.mts +2 -148
- package/dist/cli.d.ts +2 -148
- package/dist/cli.js +22 -30
- package/dist/context/assert-first.cjs +21 -15
- package/dist/context/assert-first.cjs.map +1 -1
- package/dist/context/assert-first.d.cts +1 -0
- package/dist/context/assert-first.d.mts +1 -0
- package/dist/context/assert-first.d.ts +1 -0
- package/dist/context/attempt-resources.cjs +13 -0
- package/dist/context/attempt-resources.cjs.map +1 -0
- package/dist/context/attempt-resources.d.cts +3 -0
- package/dist/context/attempt-resources.d.mts +3 -0
- package/dist/context/attempt-resources.d.ts +3 -0
- package/dist/context/attempt-resources.js +8 -0
- package/dist/context/attempt-resources.js.map +1 -0
- package/dist/context/session.cjs +4 -3
- package/dist/context/session.cjs.map +1 -1
- package/dist/context/session.d.cts +1 -0
- package/dist/context/session.d.mts +1 -0
- package/dist/context/session.d.ts +1 -0
- package/dist/eval/record/verdict.cjs +3 -2
- package/dist/eval/record/verdict.cjs.map +1 -1
- package/dist/experiment/host/index.cjs +1 -6
- package/dist/experiment/host/index.cjs.map +1 -1
- package/dist/experiment/host/index.d.cts +1 -0
- package/dist/experiment/host/index.d.mts +1 -0
- package/dist/experiment/host/index.d.ts +1 -0
- package/dist/load-config.cjs +13 -4
- package/dist/load-config.cjs.map +1 -1
- package/dist/load-config.d.cts +4 -3
- package/dist/load-config.d.mts +4 -3
- package/dist/load-config.d.ts +4 -3
- package/dist/load-config.js +4 -2
- package/dist/o11y/parsers/codex.cjs +29 -7
- package/dist/o11y/parsers/codex.cjs.map +1 -1
- package/dist/record/codec/core.d.cts +0 -2
- package/dist/record/codec/core.d.mts +0 -2
- package/dist/record/codec/core.d.ts +0 -2
- package/dist/record/codec/identifiers.cjs +2 -3
- package/dist/record/codec/identifiers.cjs.map +1 -1
- package/dist/record/codec/identifiers.d.cts +1 -2
- package/dist/record/codec/identifiers.d.mts +1 -2
- package/dist/record/codec/identifiers.d.ts +1 -2
- package/dist/record/codec/identifiers.js +10 -12
- package/dist/record/codec/index.js +42 -44
- package/dist/record/definition/attachment.cjs +1 -0
- package/dist/record/definition/attachment.cjs.map +1 -1
- package/dist/record/definition/attachment.d.cts +14 -0
- package/dist/record/definition/attachment.d.mts +14 -0
- package/dist/record/definition/attachment.d.ts +14 -0
- package/dist/record/family/assertions-v1.cjs +104 -0
- package/dist/record/family/assertions-v1.cjs.map +1 -0
- package/dist/record/family/assertions-v1.d.cts +2 -0
- package/dist/record/family/assertions-v1.d.mts +2 -0
- package/dist/record/family/assertions-v1.d.ts +2 -0
- package/dist/record/family/assertions-v1.js +6 -0
- package/dist/record/family/assertions-v1.js.map +1 -0
- package/dist/record/family/assertions.cjs +16 -5
- package/dist/record/family/assertions.cjs.map +1 -1
- package/dist/record/family/assertions.d.cts +510 -56
- package/dist/record/family/assertions.d.mts +510 -56
- package/dist/record/family/assertions.d.ts +510 -56
- package/dist/record/family/assertions.js +14 -10
- package/dist/record/family/catalog.cjs +17 -1
- package/dist/record/family/catalog.cjs.map +1 -1
- package/dist/record/family/catalog.d.cts +1292 -104
- package/dist/record/family/catalog.d.mts +1292 -104
- package/dist/record/family/catalog.d.ts +1292 -104
- package/dist/record/family/catalog.js +22 -20
- package/dist/record/family/index.js +144 -138
- package/dist/record/family/observability-v1.cjs +5 -0
- package/dist/record/family/observability-v1.cjs.map +1 -1
- package/dist/record/family/observability.cjs +1 -1
- package/dist/record/family/observability.cjs.map +1 -1
- package/dist/record/host/runtime.cjs +323 -173
- package/dist/record/host/runtime.cjs.map +1 -1
- package/dist/record/host/types.cjs.map +1 -1
- package/dist/record/host/types.d.cts +9 -7
- package/dist/record/host/types.d.mts +9 -7
- package/dist/record/host/types.d.ts +9 -7
- package/dist/record/model/core.cjs.map +1 -1
- package/dist/record/model/core.d.cts +1 -2
- package/dist/record/model/core.d.mts +1 -2
- package/dist/record/model/core.d.ts +1 -2
- package/dist/record/model/definition.cjs +1 -2
- package/dist/record/model/definition.cjs.map +1 -1
- package/dist/record/model/definition.d.cts +1 -7
- package/dist/record/model/definition.d.mts +1 -7
- package/dist/record/model/definition.d.ts +1 -7
- package/dist/record/model/identifiers.cjs +2 -3
- package/dist/record/model/identifiers.cjs.map +1 -1
- package/dist/record/model/identifiers.d.cts +1 -3
- package/dist/record/model/identifiers.d.mts +1 -3
- package/dist/record/model/identifiers.d.ts +1 -3
- package/dist/record/model/identifiers.js +36 -38
- package/dist/record/model/index.js +60 -62
- package/dist/record/platform/node.cjs +17 -7
- package/dist/record/platform/node.cjs.map +1 -1
- package/dist/record/platform/services.cjs.map +1 -1
- package/dist/record/platform/services.d.cts +8 -3
- package/dist/record/platform/services.d.mts +8 -3
- package/dist/record/platform/services.d.ts +8 -3
- package/dist/record/reader/format.cjs +16 -65
- package/dist/record/reader/format.cjs.map +1 -1
- package/dist/record/reader/format.d.cts +5 -9
- package/dist/record/reader/format.d.mts +5 -9
- package/dist/record/reader/format.d.ts +5 -9
- package/dist/record/reader/index.js +10 -8
- package/dist/record/reader/runtime.cjs +63 -32
- package/dist/record/reader/runtime.cjs.map +1 -1
- package/dist/record/reader/runtime.d.cts +40 -4
- package/dist/record/reader/runtime.d.mts +40 -4
- package/dist/record/reader/runtime.d.ts +40 -4
- package/dist/record/reader/runtime.js +6 -4
- package/dist/report/assets/enhance.js +5 -5
- package/dist/report/assets/styles.css +190 -24
- package/dist/report/built-in/result-components.cjs +8 -5
- package/dist/report/built-in/result-components.cjs.map +1 -1
- package/dist/report/built-in/standard.cjs +3 -0
- package/dist/report/built-in/standard.cjs.map +1 -1
- package/dist/report/built-in/standard.d.cts +2 -0
- package/dist/report/built-in/standard.d.mts +2 -0
- package/dist/report/built-in/standard.d.ts +2 -0
- package/dist/report/client-dist/app.js +53 -0
- package/dist/report/components/attempt-detail/compute.cjs +108 -231
- package/dist/report/components/attempt-detail/compute.cjs.map +1 -1
- package/dist/report/components/attempt-detail/compute.d.cts +11 -45
- package/dist/report/components/attempt-detail/compute.d.mts +11 -45
- package/dist/report/components/attempt-detail/compute.d.ts +11 -45
- package/dist/report/components/attempt-detail/compute.js +2 -4
- package/dist/report/components/attempt-detail/content.cjs +4 -4
- package/dist/report/components/attempt-detail/content.cjs.map +1 -1
- package/dist/report/components/attempt-detail/validate.cjs +47 -4
- package/dist/report/components/attempt-detail/validate.cjs.map +1 -1
- package/dist/report/components/entity-lists/compute.cjs +9 -15
- package/dist/report/components/entity-lists/compute.cjs.map +1 -1
- package/dist/report/components/entity-lists/content.cjs +53 -40
- package/dist/report/components/entity-lists/content.cjs.map +1 -1
- package/dist/report/components/entity-lists/index.cjs +1 -3
- package/dist/report/components/entity-lists/index.cjs.map +1 -1
- package/dist/report/components/experiment-detail/compute.cjs +4 -6
- package/dist/report/components/experiment-detail/compute.cjs.map +1 -1
- package/dist/report/components/summaries/index.cjs +5 -1
- package/dist/report/components/summaries/index.cjs.map +1 -1
- package/dist/report/definition/cell.cjs +14 -7
- package/dist/report/definition/cell.cjs.map +1 -1
- package/dist/report/definition/cell.d.cts +4 -0
- package/dist/report/definition/cell.d.mts +4 -0
- package/dist/report/definition/cell.d.ts +4 -0
- package/dist/report/definition/primitives/assertion-evidence.cjs +96 -0
- package/dist/report/definition/primitives/assertion-evidence.cjs.map +1 -0
- package/dist/report/definition/primitives/assertion-evidence.d.cts +11 -0
- package/dist/report/definition/primitives/assertion-evidence.d.mts +11 -0
- package/dist/report/definition/primitives/assertion-evidence.d.ts +11 -0
- package/dist/report/definition/primitives/assertion-evidence.js +6 -0
- package/dist/report/definition/primitives/assertion-evidence.js.map +1 -0
- package/dist/report/definition/primitives/conversation.cjs +7 -0
- package/dist/report/definition/primitives/conversation.cjs.map +1 -1
- package/dist/report/definition/primitives/conversation.d.cts +2 -0
- package/dist/report/definition/primitives/conversation.d.mts +2 -0
- package/dist/report/definition/primitives/conversation.d.ts +2 -0
- package/dist/report/definition/primitives/turn-trace.cjs +53 -3
- package/dist/report/definition/primitives/turn-trace.cjs.map +1 -1
- package/dist/report/definition/primitives.cjs +14 -1
- package/dist/report/definition/primitives.cjs.map +1 -1
- package/dist/report/definition/report.cjs +16 -8
- package/dist/report/definition/report.cjs.map +1 -1
- package/dist/report/definition/report.d.cts +6 -0
- package/dist/report/definition/report.d.mts +6 -0
- package/dist/report/definition/report.d.ts +6 -0
- package/dist/report/definition/table-text.cjs +12 -3
- package/dist/report/definition/table-text.cjs.map +1 -1
- package/dist/report/definition/table-text.d.cts +6 -1
- package/dist/report/definition/table-text.d.mts +6 -1
- package/dist/report/definition/table-text.d.ts +6 -1
- package/dist/report/execution/model.cjs +6 -14
- package/dist/report/execution/model.cjs.map +1 -1
- package/dist/report/execution/model.d.cts +5 -10
- package/dist/report/execution/model.d.mts +5 -10
- package/dist/report/execution/model.d.ts +5 -10
- package/dist/report/execution/model.js +6 -6
- package/dist/report/execution/paths.cjs +0 -11
- package/dist/report/execution/paths.cjs.map +1 -1
- package/dist/report/execution/paths.d.cts +0 -1
- package/dist/report/execution/paths.d.mts +0 -1
- package/dist/report/execution/paths.d.ts +0 -1
- package/dist/report/execution/paths.js +6 -8
- package/dist/report/host/execute.cjs +13 -22
- package/dist/report/host/execute.cjs.map +1 -1
- package/dist/report/host/execute.d.cts +1 -4
- package/dist/report/host/execute.d.mts +1 -4
- package/dist/report/host/execute.d.ts +1 -4
- package/dist/report/host/from-record.cjs +3 -0
- package/dist/report/host/from-record.cjs.map +1 -1
- package/dist/report/host/from-record.d.cts +4 -1
- package/dist/report/host/from-record.d.mts +4 -1
- package/dist/report/host/from-record.d.ts +4 -1
- package/dist/report/host/site-assets.cjs +1 -2
- package/dist/report/host/site-assets.cjs.map +1 -1
- package/dist/report/host/site-assets.d.cts +0 -1
- package/dist/report/host/site-assets.d.mts +0 -1
- package/dist/report/host/site-assets.d.ts +0 -1
- package/dist/report/host/site-assets.js +2 -4
- package/dist/report/host/static.cjs +71 -346
- package/dist/report/host/static.cjs.map +1 -1
- package/dist/report/host/static.d.cts +1 -3
- package/dist/report/host/static.d.mts +1 -3
- package/dist/report/host/static.d.ts +1 -3
- package/dist/report/host/static.js +2 -2
- package/dist/report/host/view-session.cjs.map +1 -1
- package/dist/report/host/view-session.d.cts +1 -1
- package/dist/report/host/view-session.d.mts +1 -1
- package/dist/report/host/view-session.d.ts +1 -1
- package/dist/report/model/locale.cjs +1 -1
- package/dist/report/model/locale.cjs.map +1 -1
- package/dist/report/model/locale.d.cts +1 -1
- package/dist/report/model/locale.d.mts +1 -1
- package/dist/report/model/locale.d.ts +1 -1
- package/dist/report/model/pricing.cjs +2 -2
- package/dist/report/model/pricing.cjs.map +1 -1
- package/dist/report/react/enhance.js +5 -5
- package/dist/report/react/styles.css +190 -24
- package/dist/runner/adoption.cjs +4 -7
- package/dist/runner/adoption.cjs.map +1 -1
- package/dist/runner/attempt-resources.cjs +60 -0
- package/dist/runner/attempt-resources.cjs.map +1 -0
- package/dist/runner/attempt-resources.d.cts +13 -0
- package/dist/runner/attempt-resources.d.mts +13 -0
- package/dist/runner/attempt-resources.d.ts +13 -0
- package/dist/runner/attempt-resources.js +6 -0
- package/dist/runner/attempt-resources.js.map +1 -0
- package/dist/runner/attempt.cjs +37 -3
- package/dist/runner/attempt.cjs.map +1 -1
- package/dist/runner/feedback/failure.cjs +77 -2
- package/dist/runner/feedback/failure.cjs.map +1 -1
- package/dist/runner/feedback/failure.d.cts +2 -1
- package/dist/runner/feedback/failure.d.mts +2 -1
- package/dist/runner/feedback/failure.d.ts +2 -1
- package/dist/runner/project-current.cjs +2 -13
- package/dist/runner/project-current.cjs.map +1 -1
- package/dist/runner/project-current.d.cts +4 -2
- package/dist/runner/project-current.d.mts +4 -2
- package/dist/runner/project-current.d.ts +4 -2
- package/dist/runner/reporters/braintrust.cjs +7 -7
- package/dist/runner/reporters/braintrust.cjs.map +1 -1
- package/dist/runner/reuse-readback.cjs +3 -4
- package/dist/runner/reuse-readback.cjs.map +1 -1
- package/dist/runner/run.cjs +5 -2
- package/dist/runner/run.cjs.map +1 -1
- package/dist/sandbox/backend.cjs +32 -2
- package/dist/sandbox/backend.cjs.map +1 -1
- package/dist/sandbox/backend.d.cts +12 -1
- package/dist/sandbox/backend.d.mts +12 -1
- package/dist/sandbox/backend.d.ts +12 -1
- package/dist/sandbox/backend.js +28 -22
- package/dist/sandbox/docker.cjs +140 -0
- package/dist/sandbox/docker.cjs.map +1 -1
- package/dist/sandbox/docker.d.cts +3 -1
- package/dist/sandbox/docker.d.mts +3 -1
- package/dist/sandbox/docker.d.ts +3 -1
- package/dist/sandbox/e2b.cjs +42 -0
- package/dist/sandbox/e2b.cjs.map +1 -1
- package/dist/sandbox/e2b.d.cts +2 -0
- package/dist/sandbox/e2b.d.mts +2 -0
- package/dist/sandbox/e2b.d.ts +2 -0
- package/dist/sandbox/local.cjs +64 -0
- package/dist/sandbox/local.cjs.map +1 -1
- package/dist/sandbox/local.d.cts +3 -1
- package/dist/sandbox/local.d.mts +3 -1
- package/dist/sandbox/local.d.ts +3 -1
- package/dist/sandbox/managed-process.cjs +49 -0
- package/dist/sandbox/managed-process.cjs.map +1 -0
- package/dist/sandbox/managed-process.d.cts +11 -0
- package/dist/sandbox/managed-process.d.mts +11 -0
- package/dist/sandbox/managed-process.d.ts +11 -0
- package/dist/sandbox/managed-process.js +6 -0
- package/dist/sandbox/managed-process.js.map +1 -0
- package/dist/sandbox/types.cjs.map +1 -1
- package/dist/sandbox/types.d.cts +24 -0
- package/dist/sandbox/types.d.mts +24 -0
- package/dist/sandbox/types.d.ts +24 -0
- package/dist/sandbox/vercel.cjs +1 -0
- package/dist/sandbox/vercel.cjs.map +1 -1
- package/dist/sandbox/vercel.d.cts +1 -0
- package/dist/sandbox/vercel.d.mts +1 -0
- package/dist/sandbox/vercel.d.ts +1 -0
- package/dist/view/server.cjs +2 -37
- package/dist/view/server.cjs.map +1 -1
- package/dist/view/server.d.cts +0 -3
- package/dist/view/server.d.mts +0 -3
- package/dist/view/server.d.ts +0 -3
- package/docs-site/zh/reference/builtin-agents.mdx +7 -7
- package/docs-site/zh/reference/official-adapters.mdx +4 -4
- package/docs-site/zh/reference/report-components.mdx +2 -2
- package/docs-site/zh/tutorials/configuration.mdx +2 -2
- package/docs-site/zh/tutorials/deploy-report-site.mdx +24 -2
- package/docs-site/zh/tutorials/publish-report.mdx +4 -4
- package/docs-site/zh/tutorials/sandbox-agent.mdx +5 -5
- package/docs-site/zh/tutorials/theming.mdx +2 -2
- package/package.json +4 -6
- package/dist/record/migration/index.cjs +0 -5
- package/dist/record/migration/index.cjs.map +0 -1
- package/dist/record/migration/index.d.cts +0 -11
- package/dist/record/migration/index.d.mts +0 -11
- package/dist/record/migration/index.d.ts +0 -11
- package/dist/record/migration/index.js +0 -6
- package/dist/record/migration/index.js.map +0 -1
- package/dist/report/host/site-runtime.cjs +0 -92
- package/dist/report/host/site-runtime.cjs.map +0 -1
- package/dist/report/host/site-runtime.d.cts +0 -9
- package/dist/report/host/site-runtime.d.mts +0 -9
- package/dist/report/host/site-runtime.d.ts +0 -9
- package/dist/report/host/site-runtime.js +0 -10
- package/dist/report/host/site-runtime.js.map +0 -1
- package/dist/view/client-dist/app.css +0 -2
- package/dist/view/client-dist/app.js +0 -49
- package/dist/view/data.cjs +0 -3
- package/dist/view/data.cjs.map +0 -1
- package/dist/view/data.d.cts +0 -9
- package/dist/view/data.d.mts +0 -9
- package/dist/view/data.d.ts +0 -9
- package/dist/view/data.js +0 -4
- package/dist/view/data.js.map +0 -1
- package/dist/view/index.cjs +0 -24
- package/dist/view/index.cjs.map +0 -1
- package/dist/view/index.d.cts +0 -9
- package/dist/view/index.d.mts +0 -9
- package/dist/view/index.d.ts +0 -9
- package/dist/view/index.js +0 -28
- package/dist/view/index.js.map +0 -1
- package/dist/view/report-view-cache.cjs +0 -200
- package/dist/view/report-view-cache.cjs.map +0 -1
- package/dist/view/report-view-cache.d.cts +0 -67
- package/dist/view/report-view-cache.d.mts +0 -67
- package/dist/view/report-view-cache.d.ts +0 -67
- package/dist/view/report-view-cache.js +0 -8
- package/dist/view/report-view-cache.js.map +0 -1
- package/dist/view/shared/types.cjs +0 -3
- package/dist/view/shared/types.cjs.map +0 -1
- package/dist/view/shared/types.d.cts +0 -51
- package/dist/view/shared/types.d.mts +0 -51
- package/dist/view/shared/types.d.ts +0 -51
- package/dist/view/shared/types.js +0 -4
- package/dist/view/shared/types.js.map +0 -1
- package/dist/view/site.cjs +0 -32
- package/dist/view/site.cjs.map +0 -1
- package/dist/view/site.d.cts +0 -24
- package/dist/view/site.d.mts +0 -24
- package/dist/view/site.d.ts +0 -24
- package/dist/view/site.js +0 -8
- package/dist/view/site.js.map +0 -1
- package/dist/view/styles.css +0 -170
- package/dist/view/template.html +0 -17
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
const { pathToFileURL: __niceevalPathToFileURL } = require("node:url");
|
|
3
3
|
const __niceevalImportMetaUrl = __niceevalPathToFileURL(__filename).href;
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.
|
|
5
|
+
exports.REPORT_APP_RENDERER = exports.REPORT_THEME_STYLESHEET_PATH = exports.ReportFileSystem = void 0;
|
|
6
6
|
exports.buildSiteRevision = buildSiteRevision;
|
|
7
7
|
exports.signClosedSiteRevision = signClosedSiteRevision;
|
|
8
8
|
exports.closeStaticThemeStylesheet = closeStaticThemeStylesheet;
|
|
@@ -16,260 +16,33 @@ const paths_ts_1 = require("../execution/paths.cjs");
|
|
|
16
16
|
const locale_ts_1 = require("../model/locale.cjs");
|
|
17
17
|
const theme_ts_1 = require("../theme.cjs");
|
|
18
18
|
const site_assets_ts_1 = require("./site-assets.cjs");
|
|
19
|
-
const site_runtime_ts_1 = require("./site-runtime.cjs");
|
|
20
19
|
class ReportFileSystem extends effect_1.Context.Tag("@niceeval/report/ReportFileSystem")() {
|
|
21
20
|
}
|
|
22
21
|
exports.ReportFileSystem = ReportFileSystem;
|
|
23
22
|
/** The one Host-owned static resource path for a closed Theme stylesheet. */
|
|
24
23
|
exports.REPORT_THEME_STYLESHEET_PATH = "_niceeval/theme.css";
|
|
25
24
|
/** The Host-owned renderer identity carried by every static revision. */
|
|
26
|
-
exports.
|
|
25
|
+
exports.REPORT_APP_RENDERER = "niceeval.report-spa/v1";
|
|
27
26
|
const MANIFEST_PATH = "_niceeval/manifest.json";
|
|
28
27
|
const PROBLEMS_PATH = "_niceeval/problems.json";
|
|
29
28
|
const PROJECTIONS_PATH = "_niceeval/data/projections.json";
|
|
29
|
+
const REPORT_APP_PATH = "_niceeval/app.js";
|
|
30
|
+
const REPORT_FRAGMENT_ROOT = "_niceeval/fragments";
|
|
30
31
|
const COMPLETE_PATH = "_niceeval/complete";
|
|
31
|
-
const NICEEVAL_BRAND_HREF = "https://niceeval.com/?utm_source=report&utm_medium=brand";
|
|
32
32
|
const encoder = new TextEncoder();
|
|
33
33
|
const decoder = new TextDecoder();
|
|
34
34
|
const PRODUCT_STYLESHEET = (0, node_fs_1.readFileSync)(new URL("../assets/styles.css", __niceevalImportMetaUrl), "utf8");
|
|
35
|
-
const
|
|
36
|
-
/**
|
|
37
|
-
* Host-owned parameterized-Page dialog for the shared view/static runtime.
|
|
38
|
-
* A click on a same-site `<pageId>/<key>/index.html` href writes the legacy
|
|
39
|
-
* hash deep link and opens a native `<dialog>` filled with that standalone
|
|
40
|
-
* detail document's own slot bytes. No-JS and direct hrefs keep reading the
|
|
41
|
-
* same document. The route list comes from the revision's closed pages, not
|
|
42
|
-
* from any author declaration. The report content inside the dialog is styled
|
|
43
|
-
* by the existing product stylesheet; only the dialog chrome is styled here.
|
|
44
|
-
*/
|
|
45
|
-
const PARAM_PAGE_DIALOG_RUNTIME = `(() => {
|
|
46
|
-
"use strict";
|
|
47
|
-
if (typeof window === "undefined" || typeof HTMLDialogElement !== "function") return;
|
|
48
|
-
if (location.protocol !== "http:" && location.protocol !== "https:") return;
|
|
49
|
-
const routes = (document.documentElement.getAttribute("data-niceeval-param-routes") || "")
|
|
50
|
-
.split(" ")
|
|
51
|
-
.filter((value) => value.length > 0);
|
|
52
|
-
if (routes.length === 0) return;
|
|
53
|
-
const siteRoot = document.documentElement.getAttribute("data-niceeval-site-root") || "index.html";
|
|
54
|
-
|
|
55
|
-
function closest(target, selector) {
|
|
56
|
-
return target && target.closest ? target.closest(selector) : null;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
function escapeRegExp(value) {
|
|
60
|
-
const special = ".+*?^$()[]{}|";
|
|
61
|
-
let escaped = "";
|
|
62
|
-
for (const character of value) {
|
|
63
|
-
if (special.includes(character) || character.charCodeAt(0) === 92) {
|
|
64
|
-
escaped += String.fromCharCode(92);
|
|
65
|
-
}
|
|
66
|
-
escaped += character;
|
|
67
|
-
}
|
|
68
|
-
return escaped;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
function matchTarget(url) {
|
|
72
|
-
if (url.origin !== location.origin) return null;
|
|
73
|
-
for (const prefix of routes) {
|
|
74
|
-
const root = new URL(siteRoot, document.baseURI);
|
|
75
|
-
const pattern = new RegExp("^" + escapeRegExp(new URL(prefix + "/", root).pathname) + "([^/]+)/index\\\\.html$");
|
|
76
|
-
const match = pattern.exec(url.pathname);
|
|
77
|
-
if (!match) continue;
|
|
78
|
-
let key;
|
|
79
|
-
try {
|
|
80
|
-
key = decodeURIComponent(match[1]);
|
|
81
|
-
} catch {
|
|
82
|
-
return null;
|
|
83
|
-
}
|
|
84
|
-
if (!key || key.includes("/")) return null;
|
|
85
|
-
return { prefix, key, url };
|
|
86
|
-
}
|
|
87
|
-
return null;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
function targetFromHash() {
|
|
91
|
-
const match = location.hash.startsWith("#/") ? location.hash.slice(2).split("/") : [];
|
|
92
|
-
if (match.length !== 2 || !routes.includes(match[0]) || !match[1]) return null;
|
|
93
|
-
const root = new URL(siteRoot, document.baseURI);
|
|
94
|
-
return {
|
|
95
|
-
prefix: match[0],
|
|
96
|
-
key: match[1],
|
|
97
|
-
url: new URL(match[0] + "/" + encodeURIComponent(match[1]) + "/index.html", root),
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
function hashForTarget(target) {
|
|
102
|
-
return "#/" + target.prefix + "/" + target.key;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
function currentLocale() {
|
|
106
|
-
return document.documentElement.lang === "zh-CN" ? "zh-CN" : "en";
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
function rebaseSlotUrls(slot, responseUrl) {
|
|
110
|
-
for (const element of slot.querySelectorAll("[href], [src]")) {
|
|
111
|
-
for (const attribute of ["href", "src"]) {
|
|
112
|
-
const value = element.getAttribute(attribute);
|
|
113
|
-
if (value === null) continue;
|
|
114
|
-
// Fragment and non-document schemes retain their literal browser
|
|
115
|
-
// meaning. Every other relative reference must keep the fetched
|
|
116
|
-
// detail document as its base after this slot moves into the root
|
|
117
|
-
// page's dialog.
|
|
118
|
-
if (value.startsWith("#") || /^(?:data:|mailto:|tel:)/i.test(value)) continue;
|
|
119
|
-
try {
|
|
120
|
-
element.setAttribute(attribute, new URL(value, responseUrl).href);
|
|
121
|
-
} catch {
|
|
122
|
-
// Leave malformed author data untouched; the standalone document
|
|
123
|
-
// would have the same browser-level handling.
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
function extractDocument(html, locale, responseUrl) {
|
|
130
|
-
const parsed = new DOMParser().parseFromString(html, "text/html");
|
|
131
|
-
const slot = parsed.querySelector('.niceeval-view-report-slot[data-niceeval-locale="' + locale + '"]');
|
|
132
|
-
if (!slot) return null;
|
|
133
|
-
rebaseSlotUrls(slot, responseUrl);
|
|
134
|
-
return { title: parsed.title, content: slot.innerHTML };
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
let dialog = null;
|
|
138
|
-
let ownsHistory = false;
|
|
139
|
-
let requestRevision = 0;
|
|
140
|
-
let requestedTarget = null;
|
|
141
|
-
|
|
142
|
-
function ensureDialog() {
|
|
143
|
-
if (dialog !== null) return;
|
|
144
|
-
dialog = document.createElement("dialog");
|
|
145
|
-
dialog.className = "niceeval-view-dialog";
|
|
146
|
-
const head = document.createElement("div");
|
|
147
|
-
head.className = "niceeval-view-dialog-head";
|
|
148
|
-
const title = document.createElement("span");
|
|
149
|
-
title.className = "niceeval-view-dialog-title";
|
|
150
|
-
title.id = "niceeval-view-dialog-title";
|
|
151
|
-
const close = document.createElement("button");
|
|
152
|
-
close.type = "button";
|
|
153
|
-
close.className = "niceeval-view-dialog-close";
|
|
154
|
-
close.setAttribute("aria-label", "Close");
|
|
155
|
-
// Keep the static host visually identical to the legacy React/Radix
|
|
156
|
-
// dialog. The old DialogClose renders a literal x, rather than the
|
|
157
|
-
// typographic multiplication sign.
|
|
158
|
-
close.textContent = "x";
|
|
159
|
-
close.addEventListener("click", closeFromUi);
|
|
160
|
-
head.appendChild(title);
|
|
161
|
-
head.appendChild(close);
|
|
162
|
-
const body = document.createElement("div");
|
|
163
|
-
body.className = "niceeval-view-dialog-body niceeval-view-report-slot";
|
|
164
|
-
dialog.appendChild(head);
|
|
165
|
-
dialog.appendChild(body);
|
|
166
|
-
dialog.setAttribute("aria-labelledby", title.id);
|
|
167
|
-
dialog.addEventListener("click", (event) => {
|
|
168
|
-
if (event.target === dialog) closeFromUi();
|
|
169
|
-
});
|
|
170
|
-
dialog.addEventListener("cancel", (event) => {
|
|
171
|
-
event.preventDefault();
|
|
172
|
-
closeFromUi();
|
|
173
|
-
});
|
|
174
|
-
document.body.appendChild(dialog);
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
function closeFromUi() {
|
|
178
|
-
if (dialog === null || !dialog.open) return;
|
|
179
|
-
requestedTarget = null;
|
|
180
|
-
requestRevision++;
|
|
181
|
-
if (!ownsHistory) {
|
|
182
|
-
dialog.close();
|
|
183
|
-
history.replaceState(null, "", location.pathname + location.search);
|
|
184
|
-
return;
|
|
185
|
-
}
|
|
186
|
-
ownsHistory = false;
|
|
187
|
-
history.back();
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
function openTarget(target, nextOwnsHistory) {
|
|
191
|
-
ensureDialog();
|
|
192
|
-
requestedTarget = target;
|
|
193
|
-
const revision = ++requestRevision;
|
|
194
|
-
fetch(target.url.href, { credentials: "same-origin" })
|
|
195
|
-
.then((response) => {
|
|
196
|
-
if (!response.ok) throw new Error("http " + response.status);
|
|
197
|
-
return response.text().then((html) => ({ html, responseUrl: response.url || target.url.href }));
|
|
198
|
-
})
|
|
199
|
-
.then(({ html, responseUrl }) => {
|
|
200
|
-
if (revision !== requestRevision || requestedTarget !== target) return;
|
|
201
|
-
const extracted = extractDocument(html, currentLocale(), responseUrl);
|
|
202
|
-
if (extracted === null) {
|
|
203
|
-
location.href = target.url.href;
|
|
204
|
-
return;
|
|
205
|
-
}
|
|
206
|
-
dialog.querySelector(".niceeval-view-dialog-title").textContent = extracted.title;
|
|
207
|
-
dialog.querySelector(".niceeval-view-dialog-close").setAttribute(
|
|
208
|
-
"aria-label",
|
|
209
|
-
currentLocale() === "zh-CN" ? "关闭" : "Close",
|
|
210
|
-
);
|
|
211
|
-
dialog.querySelector(".niceeval-view-dialog-body").innerHTML = extracted.content;
|
|
212
|
-
if (!dialog.open) dialog.showModal();
|
|
213
|
-
ownsHistory = nextOwnsHistory;
|
|
214
|
-
})
|
|
215
|
-
.catch(() => {
|
|
216
|
-
if (revision === requestRevision && requestedTarget === target) location.href = target.url.href;
|
|
217
|
-
});
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
function onHashChange() {
|
|
221
|
-
const target = targetFromHash();
|
|
222
|
-
if (target !== null) {
|
|
223
|
-
openTarget(target, true);
|
|
224
|
-
return;
|
|
225
|
-
}
|
|
226
|
-
requestedTarget = null;
|
|
227
|
-
requestRevision++;
|
|
228
|
-
ownsHistory = false;
|
|
229
|
-
if (dialog !== null && dialog.open) dialog.close();
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
const initialTarget = targetFromHash();
|
|
233
|
-
if (initialTarget !== null) openTarget(initialTarget, false);
|
|
234
|
-
window.addEventListener("hashchange", onHashChange);
|
|
235
|
-
window.addEventListener("popstate", () => {
|
|
236
|
-
if (location.hash) return;
|
|
237
|
-
onHashChange();
|
|
238
|
-
});
|
|
239
|
-
|
|
240
|
-
document.addEventListener("click", (event) => {
|
|
241
|
-
if (event.defaultPrevented || event.button !== 0) return;
|
|
242
|
-
if (event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return;
|
|
243
|
-
const anchor = closest(event.target, "a[href]");
|
|
244
|
-
if (!anchor) return;
|
|
245
|
-
const anchorTarget = anchor.getAttribute("target");
|
|
246
|
-
if (anchorTarget !== null && anchorTarget !== "_self") return;
|
|
247
|
-
if (anchor.hasAttribute("download")) return;
|
|
248
|
-
let url;
|
|
249
|
-
try {
|
|
250
|
-
url = new URL(anchor.getAttribute("href"), document.baseURI);
|
|
251
|
-
} catch {
|
|
252
|
-
return;
|
|
253
|
-
}
|
|
254
|
-
const target = matchTarget(url);
|
|
255
|
-
if (target === null) return;
|
|
256
|
-
event.preventDefault();
|
|
257
|
-
location.hash = hashForTarget(target);
|
|
258
|
-
});
|
|
259
|
-
})();`;
|
|
35
|
+
const PRODUCT_APP = (0, node_fs_1.readFileSync)(new URL("../client-dist/app.js", __niceevalImportMetaUrl), "utf8");
|
|
260
36
|
/** Forms one byte-complete revision; neither view nor static renders afterward. */
|
|
261
37
|
function buildSiteRevision(input) {
|
|
262
38
|
return effect_1.Effect.try({
|
|
263
39
|
try: () => {
|
|
264
40
|
const files = buildSiteFiles(input.site, input.theme ?? input.site.theme ?? theme_ts_1.basalt);
|
|
265
41
|
assertFinalBuildBudgets(input.site.startedAtMs, input.site.baselineRssBytes);
|
|
266
|
-
const defaultRoute = defaultRouteForSite(input.site);
|
|
267
42
|
return signClosedSiteRevision({
|
|
268
43
|
sampleIdentity: input.site.sampleIdentity,
|
|
269
44
|
reportIdentity: input.site.reportIdentity,
|
|
270
45
|
files,
|
|
271
|
-
routes: input.site.pages.map(({ page }) => page.target.route),
|
|
272
|
-
...(defaultRoute === undefined ? {} : { defaultRoute }),
|
|
273
46
|
});
|
|
274
47
|
},
|
|
275
48
|
catch: (cause) => isBudgetError(cause)
|
|
@@ -290,12 +63,9 @@ function signClosedSiteRevision(input) {
|
|
|
290
63
|
sampleIdentity: input.sampleIdentity,
|
|
291
64
|
reportIdentity: input.reportIdentity,
|
|
292
65
|
files,
|
|
293
|
-
...(input.defaultRoute === undefined ? {} : { defaultRoute: input.defaultRoute }),
|
|
294
66
|
problems,
|
|
295
67
|
}),
|
|
296
68
|
files,
|
|
297
|
-
routes: input.routes,
|
|
298
|
-
...(input.defaultRoute === undefined ? {} : { defaultRoute: input.defaultRoute }),
|
|
299
69
|
problems,
|
|
300
70
|
});
|
|
301
71
|
}
|
|
@@ -306,14 +76,14 @@ function signClosedSiteRevision(input) {
|
|
|
306
76
|
function closeStaticThemeStylesheet(theme) {
|
|
307
77
|
return encoder.encode(`${(0, theme_ts_1.themeStylesheet)(theme)}\n${inlineThemeStyles(theme)}\n`);
|
|
308
78
|
}
|
|
309
|
-
function assertFinalBuildBudgets(startedAtMs, baselineRssBytes) {
|
|
79
|
+
function assertFinalBuildBudgets(startedAtMs, baselineRssBytes, target) {
|
|
310
80
|
const elapsed = Date.now() - startedAtMs;
|
|
311
81
|
if (elapsed > model_ts_1.REPORT_BUILD_TIME_MS_MAX) {
|
|
312
82
|
throw (0, model_ts_1.reportBuildBudgetExceeded)("build-time", model_ts_1.REPORT_BUILD_TIME_MS_MAX, elapsed);
|
|
313
83
|
}
|
|
314
84
|
const rssGrowth = Math.max(0, process.memoryUsage().rss - baselineRssBytes);
|
|
315
85
|
if (rssGrowth > model_ts_1.REPORT_BUILD_RSS_BYTES_MAX) {
|
|
316
|
-
throw (0, model_ts_1.reportBuildBudgetExceeded)("build-rss", model_ts_1.REPORT_BUILD_RSS_BYTES_MAX, rssGrowth);
|
|
86
|
+
throw (0, model_ts_1.reportBuildBudgetExceeded)("build-rss", model_ts_1.REPORT_BUILD_RSS_BYTES_MAX, rssGrowth, target);
|
|
317
87
|
}
|
|
318
88
|
}
|
|
319
89
|
/** Writes only the immutable revision mapping, then publishes its marker last. */
|
|
@@ -353,33 +123,40 @@ function buildSiteFiles(site, theme) {
|
|
|
353
123
|
};
|
|
354
124
|
const stylesheet = textFile(site_assets_ts_1.REPORT_STYLESHEET_PATH, PRODUCT_STYLESHEET, "text/css; charset=utf-8");
|
|
355
125
|
const themeFile = binaryFile(exports.REPORT_THEME_STYLESHEET_PATH, "text/css; charset=utf-8", closeStaticThemeStylesheet(theme));
|
|
356
|
-
const
|
|
126
|
+
const app = textFile(REPORT_APP_PATH, PRODUCT_APP, "text/javascript; charset=utf-8");
|
|
357
127
|
add(stylesheet, (0, paths_ts_1.hostStaticPath)(stylesheet.path));
|
|
358
128
|
add(themeFile, (0, paths_ts_1.hostStaticPath)(themeFile.path));
|
|
359
|
-
add(
|
|
129
|
+
add(app, (0, paths_ts_1.hostStaticPath)(app.path));
|
|
360
130
|
const pages = [...site.pages].sort(compareSitePages);
|
|
361
|
-
|
|
362
|
-
|
|
131
|
+
let shellFragmentBytes = 0;
|
|
132
|
+
const fragmentFiles = new Map();
|
|
363
133
|
for (const entry of pages) {
|
|
364
|
-
assertFinalBuildBudgets(site.startedAtMs, site.baselineRssBytes);
|
|
134
|
+
assertFinalBuildBudgets(site.startedAtMs, site.baselineRssBytes, entry.page.target);
|
|
365
135
|
const routeIssue = (0, paths_ts_1.validateReportRoute)(entry.page.target.route);
|
|
366
136
|
if (routeIssue !== undefined || entry.page.target.route === "/_niceeval" ||
|
|
367
137
|
entry.page.target.route.startsWith("/_niceeval/")) {
|
|
368
138
|
throw siteFailure("path", routeIssue?.reason ?? "author routes cannot occupy /_niceeval");
|
|
369
139
|
}
|
|
370
|
-
const
|
|
371
|
-
const
|
|
372
|
-
if (
|
|
373
|
-
throw (0, model_ts_1.reportBuildBudgetExceeded)("
|
|
140
|
+
const fragmentPath = fragmentPathForRoute(entry.page.target.route);
|
|
141
|
+
const fragment = textFile(fragmentPath, renderFragment(site, entry), "application/json; charset=utf-8");
|
|
142
|
+
if (fragment.bytes.byteLength > model_ts_1.REPORT_FRAGMENT_BYTES_MAX) {
|
|
143
|
+
throw (0, model_ts_1.reportBuildBudgetExceeded)("fragment-bytes", model_ts_1.REPORT_FRAGMENT_BYTES_MAX, fragment.bytes.byteLength, { pageId: entry.page.target.pageId, route: entry.page.target.route });
|
|
374
144
|
}
|
|
375
|
-
|
|
376
|
-
if (
|
|
377
|
-
throw (0, model_ts_1.reportBuildBudgetExceeded)("
|
|
145
|
+
shellFragmentBytes += fragment.bytes.byteLength;
|
|
146
|
+
if (shellFragmentBytes > model_ts_1.REPORT_SHELL_FRAGMENT_BYTES_MAX) {
|
|
147
|
+
throw (0, model_ts_1.reportBuildBudgetExceeded)("shell-fragment-bytes", model_ts_1.REPORT_SHELL_FRAGMENT_BYTES_MAX, shellFragmentBytes);
|
|
378
148
|
}
|
|
379
|
-
add(
|
|
149
|
+
add(fragment, (0, paths_ts_1.hostStaticPath)(fragment.path));
|
|
150
|
+
fragmentFiles.set(entry.page.target.route, fragment.path);
|
|
380
151
|
for (const asset of entry.page.assets)
|
|
381
152
|
addPageAsset(add, asset);
|
|
382
153
|
}
|
|
154
|
+
const shell = textFile("index.html", renderShell(site, pages), "text/html; charset=utf-8");
|
|
155
|
+
shellFragmentBytes += shell.bytes.byteLength;
|
|
156
|
+
if (shellFragmentBytes > model_ts_1.REPORT_SHELL_FRAGMENT_BYTES_MAX) {
|
|
157
|
+
throw (0, model_ts_1.reportBuildBudgetExceeded)("shell-fragment-bytes", model_ts_1.REPORT_SHELL_FRAGMENT_BYTES_MAX, shellFragmentBytes);
|
|
158
|
+
}
|
|
159
|
+
add(shell, (0, paths_ts_1.hostStaticPath)("index.html"));
|
|
383
160
|
const downloads = collectDownloads(site.pages);
|
|
384
161
|
if (downloads.length > model_ts_1.REPORT_DOWNLOAD_FILES_MAX) {
|
|
385
162
|
throw (0, model_ts_1.reportBuildBudgetExceeded)("download-files", model_ts_1.REPORT_DOWNLOAD_FILES_MAX, downloads.length);
|
|
@@ -402,20 +179,31 @@ function buildSiteFiles(site, theme) {
|
|
|
402
179
|
const projections = textFile(PROJECTIONS_PATH, `${canonicalJson(site.projections)}\n`, "application/json; charset=utf-8");
|
|
403
180
|
add(projections, (0, paths_ts_1.hostStaticPath)(projections.path));
|
|
404
181
|
assertAssetBudgets(files, site.pages);
|
|
182
|
+
const landing = landingPage(pages);
|
|
405
183
|
const manifestValue = Object.freeze({
|
|
406
|
-
format: "niceeval.report-static/
|
|
184
|
+
format: "niceeval.report-static/v2",
|
|
407
185
|
sampleIdentity: site.sampleIdentity,
|
|
408
186
|
reportIdentity: site.reportIdentity,
|
|
187
|
+
title: {
|
|
188
|
+
en: (0, locale_ts_1.resolveLocalizedText)(site.title, "en"),
|
|
189
|
+
"zh-CN": (0, locale_ts_1.resolveLocalizedText)(site.title, "zh-CN"),
|
|
190
|
+
},
|
|
191
|
+
defaultRoute: landing.page.target.route,
|
|
409
192
|
pages: pages.map((entry) => Object.freeze({
|
|
410
193
|
pageId: entry.page.target.pageId,
|
|
411
194
|
route: entry.page.target.route,
|
|
412
|
-
|
|
195
|
+
fragment: fragmentFiles.get(entry.page.target.route),
|
|
196
|
+
title: {
|
|
197
|
+
en: (0, locale_ts_1.resolveLocalizedText)(entry.page.title, "en"),
|
|
198
|
+
"zh-CN": (0, locale_ts_1.resolveLocalizedText)(entry.page.title, "zh-CN"),
|
|
199
|
+
},
|
|
413
200
|
navigation: entry.navigation,
|
|
201
|
+
presentation: entry.presentation,
|
|
414
202
|
})),
|
|
415
203
|
files: [...files.keys(), MANIFEST_PATH, COMPLETE_PATH].sort(model_ts_1.compareUtf8),
|
|
416
204
|
stylesheet: site_assets_ts_1.REPORT_STYLESHEET_PATH,
|
|
417
205
|
theme: exports.REPORT_THEME_STYLESHEET_PATH,
|
|
418
|
-
|
|
206
|
+
app: REPORT_APP_PATH,
|
|
419
207
|
problems: PROBLEMS_PATH,
|
|
420
208
|
projections: PROJECTIONS_PATH,
|
|
421
209
|
});
|
|
@@ -429,92 +217,38 @@ function buildSiteFiles(site, theme) {
|
|
|
429
217
|
}
|
|
430
218
|
return Object.freeze([...files.values()].sort((left, right) => (0, model_ts_1.compareUtf8)(left.path, right.path)));
|
|
431
219
|
}
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
* route minus its final key segment, without the leading slash). The shared
|
|
435
|
-
* dialog runtime uses them to recognize same-site detail hrefs.
|
|
436
|
-
*/
|
|
437
|
-
function parameterizedRoutePrefixes(site) {
|
|
438
|
-
const prefixes = new Set();
|
|
439
|
-
for (const entry of site.pages) {
|
|
440
|
-
if (entry.role?.kind === "experiment-group")
|
|
441
|
-
continue;
|
|
442
|
-
if (entry.page.target.params === undefined)
|
|
443
|
-
continue;
|
|
444
|
-
const route = entry.page.target.route;
|
|
445
|
-
const cut = route.lastIndexOf("/");
|
|
446
|
-
prefixes.add(route.slice(1, cut));
|
|
447
|
-
}
|
|
448
|
-
return Object.freeze([...prefixes].sort(model_ts_1.compareUtf8));
|
|
220
|
+
function fragmentPathForRoute(route) {
|
|
221
|
+
return route === "/" ? `${REPORT_FRAGMENT_ROOT}/root.json` : `${REPORT_FRAGMENT_ROOT}${route}.json`;
|
|
449
222
|
}
|
|
450
|
-
function
|
|
223
|
+
function renderFragment(site, entry) {
|
|
451
224
|
const page = entry.page;
|
|
452
|
-
const
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
225
|
+
const pageProblems = site.problems.filter((problem) => problem.path.length === 0 || (problem.path[0] === "page" && problem.path[1] === page.target.pageId));
|
|
226
|
+
return `${canonicalJson({
|
|
227
|
+
title: {
|
|
228
|
+
en: (0, locale_ts_1.resolveLocalizedText)(page.title, "en"),
|
|
229
|
+
"zh-CN": (0, locale_ts_1.resolveLocalizedText)(page.title, "zh-CN"),
|
|
230
|
+
},
|
|
231
|
+
html: {
|
|
232
|
+
en: `${projection(page, "en")}${renderProblems(pageProblems, "en")}`,
|
|
233
|
+
"zh-CN": `${projection(page, "zh-CN")}${renderProblems(pageProblems, "zh-CN")}`,
|
|
234
|
+
},
|
|
235
|
+
})}\n`;
|
|
236
|
+
}
|
|
237
|
+
function renderShell(site, pages) {
|
|
238
|
+
const first = pages[0];
|
|
239
|
+
const rendererAssets = [...new Map(pages.flatMap((entry) => entry.page.assets).map((asset) => [asset.path, asset])).values()]
|
|
240
|
+
.map((asset) => asset.kind === "style"
|
|
241
|
+
? `<link rel="stylesheet" href="${escapeAttribute(asset.path)}">`
|
|
461
242
|
: asset.kind === "script"
|
|
462
|
-
? `<script src="${escapeAttribute(
|
|
243
|
+
? `<script src="${escapeAttribute(asset.path)}" defer></script>`
|
|
463
244
|
: "").join("");
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
const
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
const problemsEn = renderProblems(pageProblems, "en");
|
|
472
|
-
const problemsZh = renderProblems(pageProblems, "zh-CN");
|
|
473
|
-
const paramRoutesAttr = paramRoutes.length === 0
|
|
474
|
-
? ""
|
|
475
|
-
: ` data-niceeval-param-routes="${escapeAttribute(paramRoutes.join(" "))}"`;
|
|
476
|
-
const siteRootHref = relativeHref(output, "index.html");
|
|
477
|
-
return `<!doctype html><html class="niceeval-view-document" lang="en" data-niceeval-title-en="${escapeAttribute(titleEn)}" data-niceeval-title-zh-cn="${escapeAttribute(titleZh)}" data-niceeval-site-root="${escapeAttribute(siteRootHref)}"${paramRoutesAttr}><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>${escapeText(titleEn)}</title><link rel="stylesheet" href="${escapeAttribute(stylesheetHref)}"><link rel="stylesheet" href="${escapeAttribute(themeHref)}">${authorHead}${rendererAssets}<script src="${escapeAttribute(runtimeHref)}" defer></script></head><body><header class="niceeval-view-shell"><a class="niceeval-view-brand" href="${escapeAttribute(NICEEVAL_BRAND_HREF)}" target="_blank" rel="noopener"><span class="niceeval-view-mark" aria-hidden="true"></span><span>NiceEval</span></a><div class="niceeval-view-pages"><nav class="niceeval-view-nav" data-niceeval-locale="en" aria-label="Report pages">${navigationEn}</nav><nav class="niceeval-view-nav" data-niceeval-locale="zh-CN" aria-label="报告页面" hidden>${navigationZh}</nav></div><div class="niceeval-view-controls">${groupsEn}${groupsZh}<label class="niceeval-view-language"><select aria-label="Language" data-niceeval-locale-select><option value="en">EN</option><option value="zh-CN">中文</option></select></label></div></header><main class="niceeval-view-main"><div class="niceeval-view-report-slot" data-niceeval-locale="en" data-page-id="${escapeAttribute(page.target.pageId)}">${bodyEn}${problemsEn}</div><div class="niceeval-view-report-slot" data-niceeval-locale="zh-CN" data-page-id="${escapeAttribute(page.target.pageId)}" hidden>${bodyZh}${problemsZh}</div><noscript><p class="niceeval-view-noscript">This report remains readable without JavaScript; language selection is unavailable.</p></noscript></main></body></html>`;
|
|
478
|
-
}
|
|
479
|
-
function renderExperimentGroupNavigation(pages, currentRoute, sourceFile, locale) {
|
|
480
|
-
const groups = pages.filter((entry) => entry.role?.kind === "experiment-group").sort(compareSitePages);
|
|
481
|
-
if (groups.length < 2)
|
|
482
|
-
return "";
|
|
483
|
-
const options = groups.map(({ page }) => {
|
|
484
|
-
const current = page.target.route === currentRoute ? " selected" : "";
|
|
485
|
-
const href = relativeHref(sourceFile, (0, paths_ts_1.staticPathForRoute)(page.target.route).posix);
|
|
486
|
-
const params = page.target.params;
|
|
487
|
-
const label = typeof params?.groupId === "string" ? params.groupId
|
|
488
|
-
: typeof params?.experimentId === "string" ? params.experimentId : page.target.route;
|
|
489
|
-
return `<option value="${escapeAttribute(href)}"${current}>${escapeText(label)}</option>`;
|
|
490
|
-
});
|
|
491
|
-
const links = groups.map(({ page }) => {
|
|
492
|
-
const current = page.target.route === currentRoute ? " aria-current=\"page\"" : "";
|
|
493
|
-
const href = relativeHref(sourceFile, (0, paths_ts_1.staticPathForRoute)(page.target.route).posix);
|
|
494
|
-
const params = page.target.params;
|
|
495
|
-
const label = typeof params?.groupId === "string" ? params.groupId
|
|
496
|
-
: typeof params?.experimentId === "string" ? params.experimentId : page.target.route;
|
|
497
|
-
return `<li><a href="${escapeAttribute(href)}"${current}>${escapeText(label)}</a></li>`;
|
|
498
|
-
});
|
|
499
|
-
const hidden = locale === "zh-CN" ? " hidden" : "";
|
|
500
|
-
const label = locale === "zh-CN" ? "实验" : "Experiments";
|
|
501
|
-
return `<div class="niceeval-view-experiment" data-niceeval-locale="${locale}"${hidden}><label><span>${label}</span><select aria-label="${label}" data-niceeval-experiment-select>${options.join("")}</select></label><noscript><nav class="niceeval-view-nav" aria-label="${label}"><ul>${links.join("")}</ul></nav></noscript></div>`;
|
|
502
|
-
}
|
|
503
|
-
function renderNavigation(pages, currentRoute, sourceFile, locale) {
|
|
504
|
-
const groups = pages.filter((entry) => entry.role?.kind === "experiment-group").sort(compareSitePages);
|
|
505
|
-
const groupRoutes = new Set(groups.map((entry) => entry.page.target.route));
|
|
506
|
-
const selectedGroupRoute = groupRoutes.has(currentRoute) ? currentRoute : groups[0]?.page.target.route;
|
|
507
|
-
const items = pages.filter((entry) => entry.navigation).sort(compareSitePages).map(({ page }) => {
|
|
508
|
-
const targetRoute = page.target.route === "/" && selectedGroupRoute !== undefined
|
|
509
|
-
? selectedGroupRoute
|
|
510
|
-
: page.target.route;
|
|
511
|
-
const current = page.target.route === currentRoute || (page.target.route === "/" && groupRoutes.has(currentRoute))
|
|
512
|
-
? " aria-current=\"page\""
|
|
513
|
-
: "";
|
|
514
|
-
const href = relativeHref(sourceFile, (0, paths_ts_1.staticPathForRoute)(targetRoute).posix);
|
|
515
|
-
return `<li><a href="${escapeAttribute(href)}"${current}>${escapeText((0, locale_ts_1.resolveLocalizedText)(page.title, locale))}</a></li>`;
|
|
516
|
-
});
|
|
517
|
-
return `<ul>${items.join("")}</ul>`;
|
|
245
|
+
return `<!doctype html><html class="niceeval-view-document" lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>${escapeText((0, locale_ts_1.resolveLocalizedText)(site.title, "en"))}</title><noscript><style>#root{display:none!important}</style></noscript><link rel="stylesheet" href="${site_assets_ts_1.REPORT_STYLESHEET_PATH}"><link rel="stylesheet" href="${exports.REPORT_THEME_STYLESHEET_PATH}">${renderHead(first.page, "index.html")}${rendererAssets}<script src="${REPORT_APP_PATH}" defer></script></head><body><noscript><main class="niceeval-view-js-required" role="alert"><h1>JavaScript required</h1><p>Enable JavaScript to view this NiceEval report.</p></main></noscript><div id="root"></div></body></html>`;
|
|
246
|
+
}
|
|
247
|
+
function landingPage(pages) {
|
|
248
|
+
const landing = pages.find((entry) => entry.presentation === "page");
|
|
249
|
+
if (landing === undefined)
|
|
250
|
+
throw siteFailure("render", "a report site requires at least one page presentation");
|
|
251
|
+
return landing;
|
|
518
252
|
}
|
|
519
253
|
function renderProblems(problems, locale) {
|
|
520
254
|
const visible = problems.filter((problem) => !isGenericMissingSlotProblem(problem));
|
|
@@ -636,14 +370,6 @@ function inlineThemeStyles(theme) {
|
|
|
636
370
|
}
|
|
637
371
|
}).join("\n");
|
|
638
372
|
}
|
|
639
|
-
/** A grouped site always opens a concrete comparison; other sites use their first navigable Page. */
|
|
640
|
-
function defaultRouteForSite(site) {
|
|
641
|
-
return [...site.pages]
|
|
642
|
-
.filter((entry) => entry.role?.kind === "experiment-group")
|
|
643
|
-
.sort(compareSitePages)[0]?.page.target.route
|
|
644
|
-
?? site.pages.find((entry) => entry.navigation)?.page.target.route
|
|
645
|
-
?? site.pages[0]?.page.target.route;
|
|
646
|
-
}
|
|
647
373
|
function closedProblemsFromFiles(files) {
|
|
648
374
|
const file = files.find((candidate) => candidate.path === PROBLEMS_PATH);
|
|
649
375
|
if (file === undefined || file.mediaType !== "application/json; charset=utf-8") {
|
|
@@ -682,11 +408,10 @@ function closedProblemsFromFiles(files) {
|
|
|
682
408
|
function siteRevisionIdentity(input) {
|
|
683
409
|
const hash = (0, node_crypto_1.createHash)("sha256");
|
|
684
410
|
hash.update(canonicalJson({
|
|
685
|
-
format: "niceeval.report-site-revision/
|
|
686
|
-
renderer: exports.
|
|
411
|
+
format: "niceeval.report-site-revision/v2",
|
|
412
|
+
renderer: exports.REPORT_APP_RENDERER,
|
|
687
413
|
sampleIdentity: input.sampleIdentity,
|
|
688
414
|
reportIdentity: input.reportIdentity,
|
|
689
|
-
...(input.defaultRoute === undefined ? {} : { defaultRoute: input.defaultRoute }),
|
|
690
415
|
problems: input.problems,
|
|
691
416
|
}));
|
|
692
417
|
hash.update("\0");
|