niceeval 0.9.1 → 0.10.2
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 +31 -33
- package/dist/agents/types.d.ts +20 -17
- package/dist/context/types.d.ts +21 -21
- package/dist/i18n/en.d.ts +10 -2
- package/dist/i18n/zh-CN.d.ts +14 -6
- package/dist/o11y/execution-tree.d.ts +103 -0
- package/dist/o11y/otlp/select.d.ts +22 -0
- package/dist/report/{react → assets}/colors.d.ts +8 -0
- package/dist/report/{react → assets}/colors.js +23 -0
- package/dist/report/built-in/index.d.ts +2 -2
- package/dist/report/built-in/index.js +2 -2
- package/dist/report/built-in/standard.d.ts +8 -1
- package/dist/report/built-in/standard.js +17 -7
- package/dist/report/components/attempt-detail/AttemptAssertions.d.ts +6 -0
- package/dist/report/components/attempt-detail/AttemptAssertions.js +17 -0
- package/dist/report/components/attempt-detail/AttemptConversation.d.ts +10 -0
- package/dist/report/components/attempt-detail/AttemptConversation.js +74 -0
- package/dist/report/components/attempt-detail/AttemptDiagnostics.d.ts +6 -0
- package/dist/report/components/attempt-detail/AttemptDiagnostics.js +7 -0
- package/dist/report/components/attempt-detail/AttemptDiff.d.ts +6 -0
- package/dist/report/components/attempt-detail/AttemptDiff.js +11 -0
- package/dist/report/components/attempt-detail/AttemptError.d.ts +6 -0
- package/dist/report/components/attempt-detail/AttemptError.js +16 -0
- package/dist/report/components/attempt-detail/AttemptFixPrompt.d.ts +6 -0
- package/dist/report/components/attempt-detail/AttemptFixPrompt.js +7 -0
- package/dist/report/components/attempt-detail/AttemptSource.d.ts +6 -0
- package/dist/report/components/attempt-detail/AttemptSource.js +97 -0
- package/dist/report/components/attempt-detail/AttemptSummary.d.ts +8 -0
- package/dist/report/components/attempt-detail/AttemptSummary.js +20 -0
- package/dist/report/components/attempt-detail/AttemptTimeline.d.ts +6 -0
- package/dist/report/components/attempt-detail/AttemptTimeline.js +28 -0
- package/dist/report/components/attempt-detail/AttemptTrace.d.ts +6 -0
- package/dist/report/components/attempt-detail/AttemptTrace.js +29 -0
- package/dist/report/components/attempt-detail/AttemptUsage.d.ts +6 -0
- package/dist/report/components/attempt-detail/AttemptUsage.js +20 -0
- package/dist/report/components/attempt-detail/compute.d.ts +24 -0
- package/dist/report/components/attempt-detail/compute.js +297 -0
- package/dist/report/components/attempt-detail/faces.d.ts +14 -0
- package/dist/report/components/attempt-detail/faces.js +239 -0
- package/dist/report/components/attempt-detail/index.d.ts +38 -0
- package/dist/report/components/attempt-detail/index.js +547 -0
- package/dist/report/{react → components}/cell.d.ts +5 -3
- package/dist/report/{react → components}/cell.js +3 -3
- package/dist/report/{react → components/entity-lists}/AttemptList.d.ts +8 -4
- package/dist/report/{react → components/entity-lists}/AttemptList.js +16 -10
- package/dist/report/{react → components/entity-lists}/EvalList.d.ts +3 -3
- package/dist/report/{react → components/entity-lists}/EvalList.js +0 -0
- package/dist/report/{react → components/entity-lists}/ExperimentList.d.ts +4 -5
- package/dist/report/{react → components/entity-lists}/ExperimentList.js +12 -11
- package/dist/report/components/entity-lists/compute.d.ts +23 -0
- package/dist/report/components/entity-lists/compute.js +171 -0
- package/dist/report/components/entity-lists/faces.d.ts +5 -0
- package/dist/report/components/entity-lists/faces.js +175 -0
- package/dist/report/components/entity-lists/index.d.ts +49 -0
- package/dist/report/components/entity-lists/index.js +169 -0
- package/dist/report/{react → components}/fixtures.d.ts +2 -2
- package/dist/report/{react → components}/fixtures.js +1 -1
- package/dist/report/{react → components/metric-views}/DeltaTable.d.ts +2 -2
- package/dist/report/{react → components/metric-views}/DeltaTable.js +4 -4
- package/dist/report/{react → components/metric-views}/MetricBars.d.ts +3 -3
- package/dist/report/{react → components/metric-views}/MetricBars.js +3 -3
- package/dist/report/{react → components/metric-views}/MetricLine.d.ts +2 -2
- package/dist/report/{react → components/metric-views}/MetricLine.js +8 -5
- package/dist/report/{react → components/metric-views}/MetricMatrix.d.ts +3 -3
- package/dist/report/{react → components/metric-views}/MetricMatrix.js +4 -4
- package/dist/report/components/metric-views/MetricScatter.d.ts +11 -0
- package/dist/report/{react → components/metric-views}/MetricScatter.js +27 -60
- package/dist/report/{react → components/metric-views}/MetricTable.d.ts +3 -3
- package/dist/report/{react → components/metric-views}/MetricTable.js +4 -4
- package/dist/report/{react → components/metric-views}/Scoreboard.d.ts +2 -2
- package/dist/report/{react → components/metric-views}/Scoreboard.js +3 -3
- package/dist/report/components/metric-views/compute.d.ts +89 -0
- package/dist/report/{compute.js → components/metric-views/compute.js} +32 -415
- package/dist/report/components/metric-views/faces.d.ts +13 -0
- package/dist/report/components/metric-views/faces.js +381 -0
- package/dist/report/components/metric-views/index.d.ts +50 -0
- package/dist/report/components/metric-views/index.js +273 -0
- package/dist/report/{text → components/metric-views}/plot.js +1 -1
- package/dist/report/components/shared-compute.d.ts +22 -0
- package/dist/report/components/shared-compute.js +47 -0
- package/dist/report/components/shared-faces.d.ts +9 -0
- package/dist/report/components/shared-faces.js +26 -0
- package/dist/report/components/shared.d.ts +68 -0
- package/dist/report/components/shared.js +125 -0
- package/dist/report/{react → components/site-components}/CopyFixPrompt.d.ts +2 -2
- package/dist/report/{react → components/site-components}/CopyFixPrompt.js +2 -2
- package/dist/report/{react → components/site-components}/HeroCard.d.ts +2 -2
- package/dist/report/{react → components/site-components}/HeroCard.js +2 -2
- package/dist/report/{react → components/site-components}/ScopeWarnings.d.ts +2 -2
- package/dist/report/{react → components/site-components}/ScopeWarnings.js +3 -3
- package/dist/report/{react → components/site-components}/TraceWaterfall.d.ts +3 -3
- package/dist/report/{react → components/site-components}/TraceWaterfall.js +5 -5
- package/dist/report/components/site-components/compute.d.ts +28 -0
- package/dist/report/components/site-components/compute.js +132 -0
- package/dist/report/components/site-components/faces.d.ts +21 -0
- package/dist/report/components/site-components/faces.js +75 -0
- package/dist/report/components/site-components/index.d.ts +74 -0
- package/dist/report/components/site-components/index.js +220 -0
- package/dist/report/{scope-warnings.d.ts → components/site-components/scope-warnings.d.ts} +2 -2
- package/dist/report/{scope-warnings.js → components/site-components/scope-warnings.js} +2 -2
- package/dist/report/{react → components/summaries}/ScopeSummary.d.ts +2 -2
- package/dist/report/{react → components/summaries}/ScopeSummary.js +17 -8
- package/dist/report/components/summaries/compute.d.ts +7 -0
- package/dist/report/components/summaries/compute.js +51 -0
- package/dist/report/components/summaries/faces.d.ts +7 -0
- package/dist/report/components/summaries/faces.js +38 -0
- package/dist/report/components/summaries/index.d.ts +27 -0
- package/dist/report/components/summaries/index.js +78 -0
- package/dist/report/definition/grid-layout.d.ts +50 -0
- package/dist/report/definition/grid-layout.js +89 -0
- package/dist/report/{primitives.d.ts → definition/primitives.d.ts} +34 -4
- package/dist/report/{primitives.js → definition/primitives.js} +101 -10
- package/dist/report/{report.d.ts → definition/report.d.ts} +36 -65
- package/dist/report/{report.js → definition/report.js} +58 -90
- package/dist/report/{text/table.d.ts → definition/table-text.d.ts} +2 -2
- package/dist/report/{text/table.js → definition/table-text.js} +2 -2
- package/dist/report/{tree.d.ts → definition/tree.d.ts} +43 -11
- package/dist/report/{tree.js → definition/tree.js} +9 -11
- package/dist/report/index.d.ts +33 -18
- package/dist/report/index.js +23 -14
- package/dist/report/{aggregate.d.ts → model/aggregate.d.ts} +12 -4
- package/dist/report/{aggregate.js → model/aggregate.js} +28 -8
- package/dist/report/{flag.d.ts → model/flag.d.ts} +14 -1
- package/dist/report/{flag.js → model/flag.js} +35 -0
- package/dist/report/{format.d.ts → model/format.d.ts} +13 -7
- package/dist/report/{format.js → model/format.js} +79 -9
- package/dist/report/{locale.d.ts → model/locale.d.ts} +17 -17
- package/dist/report/{locale.js → model/locale.js} +31 -33
- package/dist/report/{metrics.d.ts → model/metrics.d.ts} +2 -2
- package/dist/report/{metrics.js → model/metrics.js} +2 -2
- package/dist/report/{types.d.ts → model/types.d.ts} +154 -20
- package/dist/report/react/index.d.ts +32 -21
- package/dist/report/react/index.js +33 -21
- package/dist/report/{load.d.ts → runtime/load.d.ts} +1 -1
- package/dist/report/{load.js → runtime/load.js} +1 -1
- package/dist/report/runtime/text.d.ts +67 -0
- package/dist/report/runtime/text.js +114 -0
- package/dist/report/runtime/web.d.ts +35 -0
- package/dist/report/runtime/web.js +70 -0
- package/dist/results/annotated-source.d.ts +87 -0
- package/dist/results/attempt-evidence.d.ts +74 -0
- package/dist/results/attempt-source.d.ts +15 -0
- package/dist/results/select.d.ts +11 -1
- package/dist/results/select.js +27 -5
- package/dist/runner/eval-selection.d.ts +26 -0
- package/dist/runner/feedback/sink.d.ts +26 -1
- package/dist/runner/types.d.ts +151 -24
- package/dist/sandbox/docker.d.ts +6 -0
- package/dist/sandbox/e2b.d.ts +0 -1
- package/dist/sandbox/types.d.ts +23 -21
- package/dist/scoring/display.d.ts +7 -2
- package/dist/scoring/display.js +42 -4
- package/dist/scoring/types.d.ts +3 -3
- package/dist/shared/aggregate.d.ts +14 -0
- package/dist/shared/aggregate.js +31 -0
- package/dist/shared/types.d.ts +6 -1
- package/docs-site/images/logo-dark.svg +7 -0
- package/docs-site/images/logo.svg +6 -5
- package/docs-site/zh/README.md +8 -7
- package/docs-site/zh/examples/ai-agent-application.mdx +5 -5
- package/docs-site/zh/examples/coding-agent-extensions.mdx +4 -4
- package/docs-site/zh/examples/index.mdx +3 -3
- package/docs-site/zh/examples/integrations/ai-sdk-v7.mdx +6 -6
- package/docs-site/zh/examples/integrations/claude-sdk.mdx +3 -3
- package/docs-site/zh/examples/integrations/codex-sdk.mdx +3 -3
- package/docs-site/zh/examples/integrations/langgraph.mdx +3 -3
- package/docs-site/zh/examples/integrations/pi-sdk.mdx +2 -2
- package/docs-site/zh/explanation/adapter.mdx +19 -19
- package/docs-site/zh/explanation/assert.mdx +9 -9
- package/docs-site/zh/explanation/drive.mdx +4 -4
- package/docs-site/zh/explanation/evals.mdx +8 -8
- package/docs-site/zh/explanation/experiment.mdx +8 -8
- package/docs-site/zh/explanation/hitl.mdx +13 -13
- package/docs-site/zh/explanation/judge.mdx +3 -3
- package/docs-site/zh/explanation/overview.mdx +7 -7
- package/docs-site/zh/explanation/runner.mdx +17 -13
- package/docs-site/zh/explanation/tier.mdx +6 -6
- package/docs-site/zh/index.mdx +14 -14
- package/docs-site/zh/introduction.mdx +13 -16
- package/docs-site/zh/reference/builtin-agents.mdx +61 -28
- package/docs-site/zh/reference/capabilities.mdx +7 -27
- package/docs-site/zh/reference/cli.mdx +36 -33
- package/docs-site/zh/reference/define-agent.mdx +32 -31
- package/docs-site/zh/reference/define-config.mdx +6 -6
- package/docs-site/zh/reference/define-eval.mdx +33 -20
- package/docs-site/zh/reference/events.mdx +4 -4
- package/docs-site/zh/reference/expect.mdx +3 -3
- package/docs-site/zh/reference/official-adapters.mdx +17 -17
- package/docs-site/zh/reference/report-components.mdx +195 -121
- package/docs-site/zh/reference/results-data.mdx +13 -13
- package/docs-site/zh/troubleshooting/debug-sandbox.mdx +11 -11
- package/docs-site/zh/troubleshooting/debugging.mdx +40 -16
- package/docs-site/zh/{how-to → tutorials}/agent-feedback-loop.mdx +38 -38
- package/docs-site/zh/tutorials/agent-onboarding.mdx +100 -0
- package/docs-site/zh/tutorials/authoring.mdx +211 -0
- package/docs-site/zh/{how-to → tutorials}/ci-integration.mdx +8 -8
- package/docs-site/zh/{how-to → tutorials}/connect-otel.mdx +22 -22
- package/docs-site/zh/{how-to → tutorials}/connect-your-agent.mdx +58 -63
- package/docs-site/zh/tutorials/custom-reports.mdx +453 -0
- package/docs-site/zh/{how-to → tutorials}/dataset-fanout.mdx +4 -4
- package/docs-site/zh/tutorials/experiments.mdx +102 -0
- package/docs-site/zh/{how-to → tutorials}/fixtures.mdx +9 -9
- package/docs-site/zh/{how-to → tutorials}/publish-report.mdx +6 -6
- package/docs-site/zh/tutorials/quickstart.mdx +18 -18
- package/docs-site/zh/{how-to → tutorials}/reporters.mdx +6 -6
- package/docs-site/zh/{how-to → tutorials}/sandbox-agent.mdx +6 -6
- package/docs-site/zh/{how-to → tutorials}/sandbox-providers.mdx +41 -19
- package/docs-site/zh/{how-to → tutorials}/scoring-guide.mdx +4 -4
- package/docs-site/zh/{how-to → tutorials}/viewing-results.mdx +60 -57
- package/docs-site/zh/tutorials/write-experiment.mdx +353 -0
- package/docs-site/zh/{how-to → tutorials}/write-send.mdx +40 -40
- package/package.json +10 -7
- package/src/agents/bub.ts +21 -8
- package/src/agents/claude-code.ts +23 -10
- package/src/agents/codex.test.ts +22 -7
- package/src/agents/codex.ts +22 -9
- package/src/agents/index.ts +2 -2
- package/src/agents/openai-compat.ts +1 -1
- package/src/agents/post-setup.ts +45 -22
- package/src/agents/streaming.ts +1 -1
- package/src/agents/types.ts +20 -17
- package/src/agents/ui-message-stream.test.ts +10 -0
- package/src/agents/ui-message-stream.ts +12 -1
- package/src/cli.ts +75 -59
- package/src/context/types.ts +21 -21
- package/src/define.ts +13 -0
- package/src/i18n/en.ts +27 -12
- package/src/i18n/zh-CN.ts +27 -12
- package/src/index.ts +2 -0
- package/src/o11y/prices.json +176 -99
- package/src/report/{react → assets}/colors.ts +22 -0
- package/src/report/{react → assets}/enhance.js +1 -33
- package/src/report/assets/styles.css +1785 -0
- package/src/report/built-in/index.tsx +2 -2
- package/src/report/built-in/standard.tsx +18 -6
- package/src/report/components/attempt-detail/AttemptAssertions.tsx +67 -0
- package/src/report/components/attempt-detail/AttemptConversation.tsx +158 -0
- package/src/report/components/attempt-detail/AttemptDiagnostics.tsx +38 -0
- package/src/report/components/attempt-detail/AttemptDiff.tsx +35 -0
- package/src/report/components/attempt-detail/AttemptError.tsx +31 -0
- package/src/report/components/attempt-detail/AttemptFixPrompt.tsx +26 -0
- package/src/report/components/attempt-detail/AttemptSource.tsx +224 -0
- package/src/report/components/attempt-detail/AttemptSummary.tsx +74 -0
- package/src/report/components/attempt-detail/AttemptTimeline.tsx +108 -0
- package/src/report/components/attempt-detail/AttemptTrace.tsx +63 -0
- package/src/report/components/attempt-detail/AttemptUsage.tsx +29 -0
- package/src/report/components/attempt-detail/attempt-components.test.tsx +758 -0
- package/src/report/components/attempt-detail/compute.ts +336 -0
- package/src/report/components/attempt-detail/faces.ts +260 -0
- package/src/report/components/attempt-detail/index.tsx +600 -0
- package/src/report/components/attempt-detail/validate.test.ts +252 -0
- package/src/report/{react → components}/cell.tsx +6 -3
- package/src/report/{report.test.ts → components/compute.test.ts} +316 -46
- package/src/report/{react → components/entity-lists}/AttemptList.tsx +24 -16
- package/src/report/{react → components/entity-lists}/EvalList.tsx +0 -0
- package/src/report/{react → components/entity-lists}/ExperimentList.tsx +33 -27
- package/src/report/components/entity-lists/compute.ts +196 -0
- package/src/report/components/entity-lists/faces.ts +208 -0
- package/src/report/components/entity-lists/index.tsx +238 -0
- package/src/report/components/entity-lists/validate.test.ts +114 -0
- package/src/report/{react → components}/fixtures.ts +2 -2
- package/src/report/{react → components/metric-views}/DeltaTable.tsx +5 -5
- package/src/report/{react → components/metric-views}/MetricBars.tsx +5 -5
- package/src/report/{react → components/metric-views}/MetricLine.tsx +9 -6
- package/src/report/{react → components/metric-views}/MetricMatrix.tsx +6 -6
- package/src/report/{react → components/metric-views}/MetricScatter.tsx +42 -70
- package/src/report/{react → components/metric-views}/MetricTable.tsx +6 -6
- package/src/report/{react → components/metric-views}/Scoreboard.tsx +4 -4
- package/src/report/{compute.ts → components/metric-views/compute.ts} +51 -477
- package/src/report/components/metric-views/faces.ts +423 -0
- package/src/report/components/metric-views/index.tsx +352 -0
- package/src/report/{text → components/metric-views}/plot.ts +1 -1
- package/src/report/components/metric-views/validate.test.ts +211 -0
- package/src/report/{react → components}/render.test.tsx +66 -26
- package/src/report/components/shared-compute.ts +59 -0
- package/src/report/components/shared-faces.ts +30 -0
- package/src/report/components/shared.ts +192 -0
- package/src/report/{react → components/site-components}/CopyFixPrompt.tsx +3 -3
- package/src/report/{react → components/site-components}/HeroCard.tsx +3 -3
- package/src/report/{react → components/site-components}/ScopeWarnings.tsx +4 -4
- package/src/report/{react → components/site-components}/TraceWaterfall.tsx +13 -10
- package/src/report/components/site-components/compute.ts +144 -0
- package/src/report/components/site-components/faces.ts +80 -0
- package/src/report/components/site-components/index.tsx +265 -0
- package/src/report/{scope-warnings.ts → components/site-components/scope-warnings.ts} +3 -3
- package/src/report/{site-components.test.tsx → components/site-components/site-components.test.tsx} +23 -21
- package/src/report/components/site-components/validate.test.ts +89 -0
- package/src/report/{react → components/summaries}/ScopeSummary.tsx +26 -11
- package/src/report/components/summaries/compute.ts +56 -0
- package/src/report/components/summaries/faces.ts +48 -0
- package/src/report/components/summaries/index.tsx +127 -0
- package/src/report/components/summaries/validate.test.ts +49 -0
- package/src/report/definition/grid-layout.test.ts +124 -0
- package/src/report/definition/grid-layout.ts +146 -0
- package/src/report/{primitives.tsx → definition/primitives.tsx} +168 -18
- package/src/report/{report.ts → definition/report.ts} +98 -165
- package/src/report/{shell-head.test.ts → definition/shell-head.test.ts} +2 -2
- package/src/report/{text/table.ts → definition/table-text.ts} +4 -4
- package/src/report/{tree.ts → definition/tree.ts} +56 -20
- package/src/report/index.ts +128 -66
- package/src/report/{aggregate.ts → model/aggregate.ts} +31 -9
- package/src/report/{flag.ts → model/flag.ts} +39 -1
- package/src/report/{format.ts → model/format.ts} +89 -10
- package/src/report/{locale.ts → model/locale.ts} +34 -36
- package/src/report/{metrics.ts → model/metrics.ts} +3 -3
- package/src/report/{types.ts → model/types.ts} +159 -22
- package/src/report/react/index.tsx +54 -26
- package/src/report/{dual-render.test.tsx → runtime/dual-render.test.tsx} +601 -53
- package/src/report/runtime/host.test.ts +44 -0
- package/src/report/runtime/host.ts +138 -0
- package/src/report/{load.ts → runtime/load.ts} +1 -1
- package/src/report/runtime/text.ts +192 -0
- package/src/report/runtime/web.ts +106 -0
- package/src/results/attempt-evidence.ts +5 -1
- package/src/results/host-equivalence.test.ts +53 -2
- package/src/results/select.ts +29 -5
- package/src/runner/attempt.test.ts +48 -1
- package/src/runner/attempt.ts +62 -42
- package/src/runner/cleanup-timeout.test.ts +16 -0
- package/src/runner/cleanup-timeout.ts +23 -0
- package/src/runner/discover.ts +1 -2
- package/src/runner/eval-selection.test.ts +187 -0
- package/src/runner/eval-selection.ts +109 -0
- package/src/runner/experiment-cleanup-registry.test.ts +89 -0
- package/src/runner/experiment-cleanup-registry.ts +39 -0
- package/src/runner/experiment-labels.test.ts +71 -0
- package/src/runner/feedback/agent.test.ts +33 -1
- package/src/runner/feedback/agent.ts +12 -16
- package/src/runner/feedback/ci.test.ts +35 -1
- package/src/runner/feedback/ci.ts +16 -18
- package/src/runner/feedback/coordinator.ts +28 -0
- package/src/runner/feedback/human.test.ts +108 -1
- package/src/runner/feedback/human.ts +71 -21
- package/src/runner/feedback/reducer.test.ts +64 -0
- package/src/runner/feedback/reducer.ts +26 -0
- package/src/runner/feedback/sink.ts +40 -1
- package/src/runner/fingerprint.ts +2 -1
- package/src/runner/report.test.ts +14 -0
- package/src/runner/report.ts +3 -1
- package/src/runner/run.test.ts +390 -12
- package/src/runner/run.ts +259 -26
- package/src/runner/sandbox-selection.test.ts +13 -3
- package/src/runner/sandbox-selection.ts +4 -2
- package/src/runner/types.ts +160 -24
- package/src/sandbox/docker.ts +7 -0
- package/src/sandbox/e2b-reconcile.test.ts +125 -0
- package/src/sandbox/e2b.ts +47 -12
- package/src/sandbox/types.ts +23 -21
- package/src/scoring/display.test.ts +28 -2
- package/src/scoring/display.ts +38 -5
- package/src/scoring/types.ts +3 -3
- package/src/shared/aggregate.test.ts +52 -0
- package/src/shared/aggregate.ts +29 -0
- package/src/shared/types.ts +6 -1
- package/src/show/command.test.ts +34 -0
- package/src/show/command.ts +16 -0
- package/src/show/compose.ts +1 -1
- package/src/show/index.ts +56 -20
- package/src/show/render.ts +15 -239
- package/src/show/show.test.ts +127 -34
- package/src/view/app/App.test.tsx +1 -1
- package/src/view/app/App.tsx +119 -47
- package/src/view/app/i18n.ts +7 -147
- package/src/view/app/lib/attempt-dialog.test.ts +65 -0
- package/src/view/app/lib/attempt-dialog.ts +69 -0
- package/src/view/app/main.tsx +0 -1
- package/src/view/app/types.ts +3 -86
- package/src/view/artifact-serving.test.ts +22 -38
- package/src/view/client-dist/app.css +1 -1
- package/src/view/client-dist/app.js +15 -22
- package/src/view/data.test.ts +48 -36
- package/src/view/data.ts +105 -83
- package/src/view/index.ts +1 -1
- package/src/view/server.ts +32 -2
- package/src/view/shared/types.ts +6 -31
- package/src/view/site-parity.test.ts +24 -1
- package/src/view/site.ts +144 -17
- package/src/view/styles.css +0 -805
- package/src/view/view-report.test.ts +143 -22
- package/dist/report/components.d.ts +0 -179
- package/dist/report/components.js +0 -544
- package/dist/report/compute.d.ts +0 -139
- package/dist/report/react/ExperimentComparison.d.ts +0 -10
- package/dist/report/react/ExperimentComparison.js +0 -12
- package/dist/report/react/MetricScatter.d.ts +0 -9
- package/dist/report/react/format.d.ts +0 -3
- package/dist/report/react/format.js +0 -7
- package/dist/report/text/faces.d.ts +0 -45
- package/dist/report/text/faces.js +0 -671
- package/dist/report/web.d.ts +0 -32
- package/dist/report/web.js +0 -48
- package/docs-site/zh/how-to/authoring.mdx +0 -162
- package/docs-site/zh/how-to/custom-reports.mdx +0 -414
- package/docs-site/zh/how-to/experiments.mdx +0 -86
- package/docs-site/zh/how-to/write-experiment.mdx +0 -164
- package/src/report/components.tsx +0 -925
- package/src/report/react/ExperimentComparison.tsx +0 -73
- package/src/report/react/format.ts +0 -9
- package/src/report/react/styles.css +0 -945
- package/src/report/text/faces.ts +0 -767
- package/src/report/web.ts +0 -77
- package/src/show/report-host.test.ts +0 -205
- package/src/show/report-host.ts +0 -389
- package/src/view/app/components/AttemptModal.tsx +0 -496
- package/src/view/app/components/CodeView.test.tsx +0 -142
- package/src/view/app/components/CodeView.tsx +0 -310
- package/src/view/app/components/CopyControls.tsx +0 -106
- package/src/view/app/components/Trace.tsx +0 -100
- package/src/view/app/components/Transcript.tsx +0 -157
- package/src/view/app/components/ui/badge.tsx +0 -21
- package/src/view/app/lib/artifact-url.ts +0 -17
- package/src/view/app/lib/attempt-route.test.ts +0 -80
- package/src/view/app/lib/attempt-route.ts +0 -52
- package/src/view/app/lib/format.ts +0 -70
- package/src/view/app/lib/guards.test.ts +0 -108
- package/src/view/app/lib/guards.ts +0 -71
- package/src/view/app/lib/rows.ts +0 -22
- package/src/view/app/lib/transcript-data.tsx +0 -151
- package/src/view/app/lib/verdict.ts +0 -23
- package/src/view/app/shared.ts +0 -8
- /package/dist/report/{react → components/metric-views}/chart-math.d.ts +0 -0
- /package/dist/report/{react → components/metric-views}/chart-math.js +0 -0
- /package/dist/report/{text → components/metric-views}/plot.d.ts +0 -0
- /package/dist/report/{react → components/site-components}/PoweredBy.d.ts +0 -0
- /package/dist/report/{react → components/site-components}/PoweredBy.js +0 -0
- /package/dist/report/{text/layout.d.ts → model/text-layout.d.ts} +0 -0
- /package/dist/report/{text/layout.js → model/text-layout.js} +0 -0
- /package/dist/report/{types.js → model/types.js} +0 -0
- /package/src/report/{react → components/metric-views}/chart-math.test.ts +0 -0
- /package/src/report/{react → components/metric-views}/chart-math.ts +0 -0
- /package/src/report/{react → components/site-components}/PoweredBy.tsx +0 -0
- /package/src/report/{text/layout.ts → model/text-layout.ts} +0 -0
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import type { AttemptHandle, Scope, ScopeWarning, Snapshot } from "
|
|
2
|
-
import type { AttemptLocator } from "
|
|
3
|
-
import type {
|
|
1
|
+
import type { AttemptHandle, Scope, ScopeWarning, Snapshot } from "../../results/types.ts";
|
|
2
|
+
import type { AttemptIdentity, AttemptLocator } from "../../results/locator.ts";
|
|
3
|
+
import type { AttemptEvidenceCapabilities } from "../../results/attempt-evidence.ts";
|
|
4
|
+
import type { AnnotatedEvalSourceSummary, AnnotatedSourceLine } from "../../results/annotated-source.ts";
|
|
5
|
+
import type { AssertionResult, AttemptError, DiagnosticRecord, ExperimentRunInfo, InputRequest, JsonValue, PhaseTiming, SourceLoc, ToolName, TraceSpan, Usage, Verdict } from "../../types.ts";
|
|
4
6
|
import type { LocalizedText, ReportLocale } from "./locale.ts";
|
|
5
7
|
export type { ScopeWarning };
|
|
6
8
|
export type { AttemptLocator };
|
|
@@ -57,18 +59,24 @@ export interface CustomDimension {
|
|
|
57
59
|
of(attempt: AttemptHandle): string;
|
|
58
60
|
}
|
|
59
61
|
/**
|
|
60
|
-
* flag() / runConfig() 的产物:把 experiment 声明的 flag
|
|
61
|
-
*
|
|
62
|
-
* `(missing)`,不同原始值撞出同一显示键时计算报错并要求改用 CustomDimension。
|
|
62
|
+
* flag() / label() / runConfig() 的产物:把 experiment 声明的 flag、报告标注 label 或
|
|
63
|
+
* 顶层运行配置当分组维度。读取的落盘值可能是任意形状,分组显示键按稳定 JSON 规则生成;
|
|
64
|
+
* 缺失值显示内置文案 `(missing)`,不同原始值撞出同一显示键时计算报错并要求改用 CustomDimension。
|
|
63
65
|
*/
|
|
64
66
|
export interface DimensionRef {
|
|
65
|
-
readonly kind: "flag" | "runConfig";
|
|
67
|
+
readonly kind: "flag" | "runConfig" | "label";
|
|
66
68
|
readonly name: string;
|
|
67
69
|
readonly label?: LocalizedText;
|
|
68
70
|
readonly unit?: string;
|
|
69
71
|
}
|
|
70
|
-
/** 维度槽的输入:内置维度、自定义维度,或 flag() / runConfig() 的产物。 */
|
|
72
|
+
/** 维度槽的输入:内置维度、自定义维度,或 flag() / label() / runConfig() 的产物。 */
|
|
71
73
|
export type DimensionInput = BuiltInDimension | CustomDimension | DimensionRef;
|
|
74
|
+
/**
|
|
75
|
+
* series 类选项(MetricScatter / MetricLine / ExperimentComparison)的输入:单维度,或
|
|
76
|
+
* 非空数组解析为复合维度——name 依声明顺序以 ` × ` 连接,每个 attempt 的值为各成员显示键
|
|
77
|
+
* 以 ` · ` 连接,任一成员缺失沿用 `(missing)` 显示键参与连接(docs/feature/reports/library/metrics.md)。
|
|
78
|
+
*/
|
|
79
|
+
export type SeriesInput = DimensionInput | readonly [DimensionInput, ...DimensionInput[]];
|
|
72
80
|
/** MetricLine 的 x 轴:必须是数值;字符串配置显式映射,组件不猜 low < medium < high。 */
|
|
73
81
|
export interface NumericAxis {
|
|
74
82
|
name: string;
|
|
@@ -252,7 +260,7 @@ export interface VerdictTally {
|
|
|
252
260
|
skipped: number;
|
|
253
261
|
}
|
|
254
262
|
/**
|
|
255
|
-
* 一个范围的摘要:快照时间窗、experiment / eval / attempt
|
|
263
|
+
* 一个范围的摘要:快照时间窗、experiment / eval / attempt 数、两级判定计票、端到端通过率
|
|
256
264
|
* 和总成本。eval 的身份键是 experimentId + evalId;data 恒携带两级计票,渲染面显示哪一级
|
|
257
265
|
* 由呈现 prop `votes` 决定,不改变 data(docs/feature/reports/library/summaries.md)。
|
|
258
266
|
*/
|
|
@@ -320,17 +328,6 @@ export interface TraceWaterfallRow {
|
|
|
320
328
|
/** 顶层 span 摘要,按 startOffsetMs 升序。 */
|
|
321
329
|
spans: readonly TraceSpanSummary[];
|
|
322
330
|
}
|
|
323
|
-
/** 一个可比组的数据;三个子块都只消费本组快照,不能含其它父目录的引用。 */
|
|
324
|
-
export interface ExperimentComparisonGroupData {
|
|
325
|
-
/** experiment id 的完整父路径;根目录 experiment 使用完整 id。 */
|
|
326
|
-
key: string;
|
|
327
|
-
summary: ScopeSummaryData;
|
|
328
|
-
scatter: ScatterData;
|
|
329
|
-
experiments: ExperimentListItem[];
|
|
330
|
-
}
|
|
331
|
-
export interface ExperimentComparisonData {
|
|
332
|
-
groups: ExperimentComparisonGroupData[];
|
|
333
|
-
}
|
|
334
331
|
/**
|
|
335
332
|
* `AttemptList` 一项 = 一次 attempt:身份、判定、算好的单行结果摘要与证据引用。
|
|
336
333
|
* 完整 assertions、Judge evidence、diagnostics、cause 与 stack 不进列表 data;
|
|
@@ -404,3 +401,140 @@ export interface ExperimentListItem {
|
|
|
404
401
|
lastRunAt: string;
|
|
405
402
|
evalRows: ExperimentListEvalRow[];
|
|
406
403
|
}
|
|
404
|
+
/** `AttemptSummary` 的 data:身份、verdict、时间与成本——恒非空。 */
|
|
405
|
+
export interface AttemptSummaryData {
|
|
406
|
+
locator: AttemptLocator;
|
|
407
|
+
identity: AttemptIdentity;
|
|
408
|
+
verdict: Verdict;
|
|
409
|
+
startedAt?: string;
|
|
410
|
+
durationMs: number;
|
|
411
|
+
costUSD: number | null;
|
|
412
|
+
capabilities: AttemptEvidenceCapabilities;
|
|
413
|
+
}
|
|
414
|
+
/** `AttemptError` 的 data:结构化 error 一层原因 + cause + stack;没有 error 时 null。 */
|
|
415
|
+
export type AttemptErrorData = AttemptError;
|
|
416
|
+
/** `AttemptAssertions` 的 data:非 passed 条目默认展开,passed 按 group 折叠计数;没有 assertion 时 null。 */
|
|
417
|
+
export interface AttemptAssertionsData {
|
|
418
|
+
/** failed / unavailable / soft 全部非 passed 条目,按原始声明顺序。 */
|
|
419
|
+
attention: AssertionResult[];
|
|
420
|
+
/** passed 条目按 groupPath.join(" > ") 分组(无分组键为 ""),组内保持原始顺序。 */
|
|
421
|
+
passedGroups: {
|
|
422
|
+
group: string;
|
|
423
|
+
items: AssertionResult[];
|
|
424
|
+
}[];
|
|
425
|
+
}
|
|
426
|
+
/** `AttemptSource` 源码行内的一轮执行:send 头事实 + 标准事件流归并出的完整回复。 */
|
|
427
|
+
export interface AttemptSourceTurn {
|
|
428
|
+
label: string;
|
|
429
|
+
status: "completed" | "failed" | "waiting";
|
|
430
|
+
durationMs?: number;
|
|
431
|
+
sentText: string;
|
|
432
|
+
replies: AttemptConversationReply[];
|
|
433
|
+
}
|
|
434
|
+
/** AnnotatedSourceLine 加上 web 源码视图需要的行内执行轮。 */
|
|
435
|
+
export interface AttemptSourceLineData extends AnnotatedSourceLine {
|
|
436
|
+
turns: AttemptSourceTurn[];
|
|
437
|
+
}
|
|
438
|
+
/** `AttemptSource` 的 data:AnnotatedEvalSource + 按 loc 投影的标准事件流;没有 source 时 null。 */
|
|
439
|
+
export interface AttemptSourceData {
|
|
440
|
+
/** text 面拼 `niceeval show <locator> --source` 下钻命令用;web 面不需要。 */
|
|
441
|
+
locator: AttemptLocator;
|
|
442
|
+
sourcePath: string;
|
|
443
|
+
lines: AttemptSourceLineData[];
|
|
444
|
+
unmapped: AssertionResult[];
|
|
445
|
+
/** 没有 loc、指向其它文件或越界的轮次;不能静默丢弃,放在源码块末尾。 */
|
|
446
|
+
unlocatedTurns: AttemptSourceTurn[];
|
|
447
|
+
summary: AnnotatedEvalSourceSummary;
|
|
448
|
+
}
|
|
449
|
+
/** `AttemptFixPrompt` 的 data:单条 attempt 的复制修复 prompt;passed/skipped 或无可操作失败时 null。 */
|
|
450
|
+
export interface AttemptFixPromptData {
|
|
451
|
+
prompt: string;
|
|
452
|
+
}
|
|
453
|
+
/** `AttemptTimeline` 的 data:runner 阶段主链 + 收尾段,以及可选的 trace(供 turn 节点按 traceId 关联 span);没有 phase 时 null。 */
|
|
454
|
+
export interface AttemptTimelineData {
|
|
455
|
+
/** text 面拼 `niceeval show <locator> --timing` 下钻命令用;web 面不需要。 */
|
|
456
|
+
locator: AttemptLocator;
|
|
457
|
+
phases: PhaseTiming[];
|
|
458
|
+
trace: TraceSpan[] | null;
|
|
459
|
+
}
|
|
460
|
+
/** `AttemptConversation` 一轮:由带 `loc` 的 user 消息开启;`loc` 缺省表示流首无位置信息的兜底轮(旧 artifact)。 */
|
|
461
|
+
export interface AttemptConversationRound {
|
|
462
|
+
loc?: SourceLoc;
|
|
463
|
+
sentText: string;
|
|
464
|
+
replies: AttemptConversationReply[];
|
|
465
|
+
}
|
|
466
|
+
/** 一轮内的回复条目;`raw` 是未识别事件类型的原样兜底,不吞没其余事件。 */
|
|
467
|
+
export type AttemptConversationReply = {
|
|
468
|
+
kind: "assistant" | "user" | "thinking" | "error";
|
|
469
|
+
text: string;
|
|
470
|
+
} | {
|
|
471
|
+
kind: "tool";
|
|
472
|
+
callId: string;
|
|
473
|
+
name: string;
|
|
474
|
+
tool?: ToolName;
|
|
475
|
+
input: JsonValue;
|
|
476
|
+
output?: JsonValue;
|
|
477
|
+
status?: "completed" | "failed" | "rejected";
|
|
478
|
+
} | {
|
|
479
|
+
kind: "skill";
|
|
480
|
+
skill: string;
|
|
481
|
+
} | {
|
|
482
|
+
kind: "subagent";
|
|
483
|
+
callId: string;
|
|
484
|
+
name: string;
|
|
485
|
+
remoteUrl?: string;
|
|
486
|
+
output?: JsonValue;
|
|
487
|
+
status?: "completed" | "failed";
|
|
488
|
+
} | {
|
|
489
|
+
kind: "input";
|
|
490
|
+
request: InputRequest;
|
|
491
|
+
} | {
|
|
492
|
+
kind: "compaction";
|
|
493
|
+
reason?: string;
|
|
494
|
+
} | {
|
|
495
|
+
kind: "raw";
|
|
496
|
+
raw: JsonValue;
|
|
497
|
+
};
|
|
498
|
+
/** `AttemptConversation` 的 data:标准事件流按 loc 分轮;没有 events 时 null。 */
|
|
499
|
+
export interface AttemptConversationData {
|
|
500
|
+
/** text 面拼 `niceeval show <locator> --execution` 下钻命令用;web 面不需要。 */
|
|
501
|
+
locator: AttemptLocator;
|
|
502
|
+
rounds: AttemptConversationRound[];
|
|
503
|
+
}
|
|
504
|
+
/** `AttemptDiagnostics` 的 data:按 lifecycle phase 分组;没有 diagnostics 时 null。 */
|
|
505
|
+
export interface AttemptDiagnosticsData {
|
|
506
|
+
groups: {
|
|
507
|
+
phase: string;
|
|
508
|
+
items: DiagnosticRecord[];
|
|
509
|
+
}[];
|
|
510
|
+
}
|
|
511
|
+
/** `AttemptUsage` 的 data:token / cache token / provider usage 明细;没有 usage 时 null。 */
|
|
512
|
+
export interface AttemptUsageData {
|
|
513
|
+
usage: Usage;
|
|
514
|
+
costUSD: number | null;
|
|
515
|
+
}
|
|
516
|
+
/** `AttemptTrace` 的 data:不与 runner 节点合并的原始 OTel span 列表;没有 trace 时 null。 */
|
|
517
|
+
export interface AttemptTraceData {
|
|
518
|
+
/** text 面拼 `niceeval show <locator> --timing` 下钻命令用;web 面不需要。 */
|
|
519
|
+
locator: AttemptLocator;
|
|
520
|
+
spans: TraceSpan[];
|
|
521
|
+
}
|
|
522
|
+
/** `AttemptDiff` 一个文件的摘要:`net` 恒 !== "none"(净无变化的触碰不进这份列表)。 */
|
|
523
|
+
export interface AttemptDiffFileEntry {
|
|
524
|
+
path: string;
|
|
525
|
+
net: "added" | "modified" | "deleted";
|
|
526
|
+
/** 净行数变化(公共前后缀修剪后的近似上界,与 `niceeval show --diff` 同一算法)。 */
|
|
527
|
+
lines: {
|
|
528
|
+
added: number;
|
|
529
|
+
deleted: number;
|
|
530
|
+
};
|
|
531
|
+
binary?: true;
|
|
532
|
+
/** 触碰过该文件的窗口标签,按时序;供 text 面引用 `--diff` 深挖同一批窗口。 */
|
|
533
|
+
windows: string[];
|
|
534
|
+
}
|
|
535
|
+
/** `AttemptDiff` 的 data:generated / modified / deleted 的文件级摘要;没有变更时 null。 */
|
|
536
|
+
export interface AttemptDiffData {
|
|
537
|
+
/** text 面拼 `niceeval show <locator> --diff` 下钻命令用;web 面不需要。 */
|
|
538
|
+
locator: AttemptLocator;
|
|
539
|
+
files: AttemptDiffFileEntry[];
|
|
540
|
+
}
|
|
@@ -1,21 +1,32 @@
|
|
|
1
|
-
export { AttemptList } from "
|
|
2
|
-
export { EvalList } from "
|
|
3
|
-
export { ExperimentList } from "
|
|
4
|
-
export { ScopeSummary } from "
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
12
|
-
export {
|
|
13
|
-
export {
|
|
14
|
-
export {
|
|
15
|
-
export {
|
|
16
|
-
export {
|
|
17
|
-
export {
|
|
18
|
-
export
|
|
19
|
-
export {
|
|
20
|
-
export
|
|
21
|
-
export {
|
|
1
|
+
export { AttemptList } from "../components/entity-lists/AttemptList.tsx";
|
|
2
|
+
export { EvalList } from "../components/entity-lists/EvalList.tsx";
|
|
3
|
+
export { ExperimentList } from "../components/entity-lists/ExperimentList.tsx";
|
|
4
|
+
export { ScopeSummary } from "../components/summaries/ScopeSummary.tsx";
|
|
5
|
+
export { MetricTable } from "../components/metric-views/MetricTable.tsx";
|
|
6
|
+
export { MetricMatrix } from "../components/metric-views/MetricMatrix.tsx";
|
|
7
|
+
export { MetricBars } from "../components/metric-views/MetricBars.tsx";
|
|
8
|
+
export { MetricScatter } from "../components/metric-views/MetricScatter.tsx";
|
|
9
|
+
export { MetricLine } from "../components/metric-views/MetricLine.tsx";
|
|
10
|
+
export { DeltaTable } from "../components/metric-views/DeltaTable.tsx";
|
|
11
|
+
export { Scoreboard } from "../components/metric-views/Scoreboard.tsx";
|
|
12
|
+
export { HeroCard } from "../components/site-components/HeroCard.tsx";
|
|
13
|
+
export { PoweredBy } from "../components/site-components/PoweredBy.tsx";
|
|
14
|
+
export { ScopeWarnings } from "../components/site-components/ScopeWarnings.tsx";
|
|
15
|
+
export { CopyFixPrompt } from "../components/site-components/CopyFixPrompt.tsx";
|
|
16
|
+
export { TraceWaterfall } from "../components/site-components/TraceWaterfall.tsx";
|
|
17
|
+
export { AttemptSummary } from "../components/attempt-detail/AttemptSummary.tsx";
|
|
18
|
+
export { AttemptError } from "../components/attempt-detail/AttemptError.tsx";
|
|
19
|
+
export { AttemptAssertions } from "../components/attempt-detail/AttemptAssertions.tsx";
|
|
20
|
+
export { AttemptSource } from "../components/attempt-detail/AttemptSource.tsx";
|
|
21
|
+
export { AttemptFixPrompt } from "../components/attempt-detail/AttemptFixPrompt.tsx";
|
|
22
|
+
export { AttemptTimeline } from "../components/attempt-detail/AttemptTimeline.tsx";
|
|
23
|
+
export { AttemptConversation } from "../components/attempt-detail/AttemptConversation.tsx";
|
|
24
|
+
export { AttemptDiagnostics } from "../components/attempt-detail/AttemptDiagnostics.tsx";
|
|
25
|
+
export { AttemptUsage } from "../components/attempt-detail/AttemptUsage.tsx";
|
|
26
|
+
export { AttemptTrace } from "../components/attempt-detail/AttemptTrace.tsx";
|
|
27
|
+
export { AttemptDiff } from "../components/attempt-detail/AttemptDiff.tsx";
|
|
28
|
+
export type { AttemptAssertionsData, AttemptConversationData, AttemptConversationReply, AttemptConversationRound, AttemptDiagnosticsData, AttemptDiffData, AttemptDiffFileEntry, AttemptErrorData, AttemptFixPromptData, AttemptListItem, AttemptLocator, AttemptSourceData, AttemptSourceLineData, AttemptSourceTurn, AttemptSummaryData, AttemptTimelineData, AttemptTraceData, AttemptUsageData, CopyFixPromptData, DeltaData, EvalListItem, ExperimentListEvalRow, ExperimentListItem, HeroData, LineData, MatrixData, MetricCell, MetricColumn, ScatterData, ScopeSummaryData, ScopeWarning, ScoreboardData, TableData, TraceSpanSummary, TraceWaterfallRow, VerdictTally, } from "../model/types.ts";
|
|
29
|
+
export type { AttemptEvidence, AttemptEvidenceCapabilities } from "../../results/attempt-evidence.ts";
|
|
30
|
+
export { DEFAULT_REPORT_LOCALE, resolveLocalizedText, resolveMetricLabel } from "../model/locale.ts";
|
|
31
|
+
export type { LocalizedText, ReportLocale } from "../model/locale.ts";
|
|
32
|
+
export { NRE_PALETTE, colorClassForKey, colorHexForKey, colorIndexForKey, seriesClassForKey } from "../assets/colors.ts";
|
|
@@ -6,26 +6,38 @@
|
|
|
6
6
|
// - 组件只认「算好的可序列化数据」:零 hooks、零数据操作;
|
|
7
7
|
// - 样式随包发布:配套 ./styles.css(nre-* 稳定类名),使用者在其后加载覆盖即可;
|
|
8
8
|
// - 渐进增强脚本 ./enhance.js 可选加载,初始静态 HTML 无 JS 完整可读;
|
|
9
|
-
// - 跨块配色一致:维度键 → 稳定散列 → 固定调色板下标(colors.ts)。
|
|
10
|
-
export { AttemptList } from "
|
|
11
|
-
export { EvalList } from "
|
|
12
|
-
export { ExperimentList } from "
|
|
13
|
-
export { ScopeSummary } from "
|
|
14
|
-
export {
|
|
15
|
-
export {
|
|
16
|
-
export {
|
|
17
|
-
export {
|
|
18
|
-
export {
|
|
19
|
-
export {
|
|
20
|
-
export {
|
|
21
|
-
export { Scoreboard } from "./Scoreboard.js";
|
|
9
|
+
// - 跨块配色一致:维度键 → 稳定散列 → 固定调色板下标(../assets/colors.ts)。
|
|
10
|
+
export { AttemptList } from "../components/entity-lists/AttemptList.js";
|
|
11
|
+
export { EvalList } from "../components/entity-lists/EvalList.js";
|
|
12
|
+
export { ExperimentList } from "../components/entity-lists/ExperimentList.js";
|
|
13
|
+
export { ScopeSummary } from "../components/summaries/ScopeSummary.js";
|
|
14
|
+
export { MetricTable } from "../components/metric-views/MetricTable.js";
|
|
15
|
+
export { MetricMatrix } from "../components/metric-views/MetricMatrix.js";
|
|
16
|
+
export { MetricBars } from "../components/metric-views/MetricBars.js";
|
|
17
|
+
export { MetricScatter } from "../components/metric-views/MetricScatter.js";
|
|
18
|
+
export { MetricLine } from "../components/metric-views/MetricLine.js";
|
|
19
|
+
export { DeltaTable } from "../components/metric-views/DeltaTable.js";
|
|
20
|
+
export { Scoreboard } from "../components/metric-views/Scoreboard.js";
|
|
22
21
|
// 站点组件的纯 web 面(data 形态;Hero 是组合组件,只住 niceeval/report)
|
|
23
|
-
export { HeroCard } from "
|
|
24
|
-
export { PoweredBy } from "
|
|
25
|
-
export { ScopeWarnings } from "
|
|
26
|
-
export { CopyFixPrompt } from "
|
|
27
|
-
export { TraceWaterfall } from "
|
|
28
|
-
//
|
|
29
|
-
|
|
22
|
+
export { HeroCard } from "../components/site-components/HeroCard.js";
|
|
23
|
+
export { PoweredBy } from "../components/site-components/PoweredBy.js";
|
|
24
|
+
export { ScopeWarnings } from "../components/site-components/ScopeWarnings.js";
|
|
25
|
+
export { CopyFixPrompt } from "../components/site-components/CopyFixPrompt.js";
|
|
26
|
+
export { TraceWaterfall } from "../components/site-components/TraceWaterfall.js";
|
|
27
|
+
// Attempt 详情组件族的纯 web 面(data 形态;AttemptAssessment / AttemptDetail 是组合组件,
|
|
28
|
+
// 不产生新渲染面,只住 niceeval/report)
|
|
29
|
+
export { AttemptSummary } from "../components/attempt-detail/AttemptSummary.js";
|
|
30
|
+
export { AttemptError } from "../components/attempt-detail/AttemptError.js";
|
|
31
|
+
export { AttemptAssertions } from "../components/attempt-detail/AttemptAssertions.js";
|
|
32
|
+
export { AttemptSource } from "../components/attempt-detail/AttemptSource.js";
|
|
33
|
+
export { AttemptFixPrompt } from "../components/attempt-detail/AttemptFixPrompt.js";
|
|
34
|
+
export { AttemptTimeline } from "../components/attempt-detail/AttemptTimeline.js";
|
|
35
|
+
export { AttemptConversation } from "../components/attempt-detail/AttemptConversation.js";
|
|
36
|
+
export { AttemptDiagnostics } from "../components/attempt-detail/AttemptDiagnostics.js";
|
|
37
|
+
export { AttemptUsage } from "../components/attempt-detail/AttemptUsage.js";
|
|
38
|
+
export { AttemptTrace } from "../components/attempt-detail/AttemptTrace.js";
|
|
39
|
+
export { AttemptDiff } from "../components/attempt-detail/AttemptDiff.js";
|
|
40
|
+
// locale(官方组件 chrome 文案的语言;LocalizedText 的按 locale 解析也用它)
|
|
41
|
+
export { DEFAULT_REPORT_LOCALE, resolveLocalizedText, resolveMetricLabel } from "../model/locale.js";
|
|
30
42
|
// 稳定配色(自定义组件想与官方组件同键同色时用;seriesClassForKey 配 CSS 的 --nre-series)
|
|
31
|
-
export { NRE_PALETTE, colorClassForKey, colorHexForKey, colorIndexForKey, seriesClassForKey } from "
|
|
43
|
+
export { NRE_PALETTE, colorClassForKey, colorHexForKey, colorIndexForKey, seriesClassForKey } from "../assets/colors.js";
|
|
@@ -14,7 +14,7 @@ var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExte
|
|
|
14
14
|
import { existsSync, statSync } from "node:fs";
|
|
15
15
|
import { resolve } from "node:path";
|
|
16
16
|
import { pathToFileURL } from "node:url";
|
|
17
|
-
import { isReportDefinition } from "
|
|
17
|
+
import { isReportDefinition } from "../definition/report.js";
|
|
18
18
|
/** 可预期的装载错误:宿主打一句英文直说问题与下一步,不抛堆栈。 */
|
|
19
19
|
export class ReportLoadError extends Error {
|
|
20
20
|
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { Results, Scope } from "../../results/types.ts";
|
|
2
|
+
import { type PageContext, type ReportNode, type TextRenderOptions } from "../definition/tree.ts";
|
|
3
|
+
import { type ReportDefinition, type ReportMeta, type ReportPage } from "../definition/report.ts";
|
|
4
|
+
import { type ReportLocale } from "../model/locale.ts";
|
|
5
|
+
/** `--page` 未命中:宿主据此按用法错误退出并列出可用页 id(只列 navigation !== false 的)。 */
|
|
6
|
+
export declare class ReportPageNotFoundError extends Error {
|
|
7
|
+
readonly pageId: string;
|
|
8
|
+
readonly available: string[];
|
|
9
|
+
constructor(pageId: string, available: string[]);
|
|
10
|
+
}
|
|
11
|
+
/** 显式请求了 attempt-input page,但当前入口没有 locator 可注入 evidence。 */
|
|
12
|
+
export declare class ReportPageNeedsLocatorError extends Error {
|
|
13
|
+
readonly pageId: string;
|
|
14
|
+
constructor(pageId: string);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* 挑选要渲染的 page:省略 pageId 时挑第一张 `navigation !== false` 的页(跳过参数化详情页,
|
|
18
|
+
* 它没有 locator 就不可打开);显式 pageId 命中 attempt-input page 时报
|
|
19
|
+
* ReportPageNeedsLocatorError——这个入口没有 locator,不能拿 Scope 强行 resolve。
|
|
20
|
+
*/
|
|
21
|
+
export declare function pickReportPage(definition: ReportDefinition, pageId?: string): ReportPage;
|
|
22
|
+
/** 宿主注入的渲染上下文:官方口径挑好的 Scope 与结果根完整读取面。 */
|
|
23
|
+
export interface ReportHostContext {
|
|
24
|
+
scope: Scope;
|
|
25
|
+
/** 组合组件 ctx.results 的来源;历史视图从这里自行挑 Snapshot[]。 */
|
|
26
|
+
results: Results;
|
|
27
|
+
}
|
|
28
|
+
export interface RenderReportTextOptions extends TextRenderOptions {
|
|
29
|
+
/** 渲染哪一页;缺省第一张可导航页。命中 attempt-input page 抛 ReportPageNeedsLocatorError,未命中抛 ReportPageNotFoundError。 */
|
|
30
|
+
pageId?: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* text 宿主的装载语义:选页(只能是 scope-input page,见 pickReportPage)→ resolve(组合展开 +
|
|
34
|
+
* spec 取数,唯一的 await 边界)→ 树校验 → 遍历渲染 text 面。不需要 react-dom。宿主不在报告树外
|
|
35
|
+
* 另设警告通道——挑选警告的呈现件是 `ScopeWarnings` 组件,内建报告每页都放它,自定义报告放不放
|
|
36
|
+
* 是作者义务(docs/feature/reports/architecture.md「Scope 是计算入口」)。
|
|
37
|
+
*/
|
|
38
|
+
export declare function renderReportToText(definition: ReportDefinition, ctx: ReportHostContext, options?: RenderReportTextOptions): Promise<string>;
|
|
39
|
+
/** 页索引标题行(show 多页索引 / view 导航共用的解析结果):按 locale 解析的标题字符串。 */
|
|
40
|
+
export declare function reportTitleText(definition: ReportDefinition, scope: Scope, locale: ReportLocale): string;
|
|
41
|
+
/** 宿主索引命令的完整上下文(docs/feature/reports/show/reports.md「索引命令携带完整上下文」)。 */
|
|
42
|
+
export interface HostCommandContext {
|
|
43
|
+
patterns: string[];
|
|
44
|
+
results?: string;
|
|
45
|
+
experiment?: string;
|
|
46
|
+
report?: string;
|
|
47
|
+
page?: string;
|
|
48
|
+
}
|
|
49
|
+
/** 逐页渲染的宿主上下文:官方口径的 Scope、结果根读取面、规范化声明(ctx.report)与当前页判别。 */
|
|
50
|
+
export interface ReportTreeHostContext {
|
|
51
|
+
scope: Scope;
|
|
52
|
+
results: Results;
|
|
53
|
+
report: ReportMeta;
|
|
54
|
+
/** 当前渲染的页:scope 分支只有 id;attempt 分支带 locator + evidence(宿主已完成寻址与装配)。 */
|
|
55
|
+
page: PageContext;
|
|
56
|
+
}
|
|
57
|
+
export interface RenderTreeTextOptions extends TextRenderOptions {
|
|
58
|
+
/** 组索引命令的完整上下文;给了就按它拼命令,experimentCommand 显式注入时以后者为准。 */
|
|
59
|
+
commandContext?: HostCommandContext;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* 渲染一页报告树的 text 面(宿主逐页调用;页选择归宿主):
|
|
63
|
+
* resolve(组合展开 + spec 取数)→ validate → render。宿主不在报告树外另设警告通道,
|
|
64
|
+
* 挑选警告由页内的 `ScopeWarnings` 组件呈现(内建报告每页都放它)。当前 definition 没有
|
|
65
|
+
* attempt-input page 时不注入默认下钻命令,调用方也没显式给,`ctx.attemptCommand` 就不存在。
|
|
66
|
+
*/
|
|
67
|
+
export declare function renderReportTreeToText(tree: ReportNode, ctx: ReportTreeHostContext, options?: RenderTreeTextOptions): Promise<string>;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
// text 宿主(show)的渲染入口:装载好的 ReportDefinition/page → resolve(组合展开 + spec 取数)
|
|
2
|
+
// → validate(两面资格)→ render(纯同步字符输出)。web 宿主的对应入口在 ./web.ts(那一侧才
|
|
3
|
+
// import react-dom)。管线以页为单位执行;defineReport 本身与 ReportDefinition 的类型体系在
|
|
4
|
+
// ../definition/report.ts,这里只做渲染编排与宿主联系面(页选择、索引命令拼装)。
|
|
5
|
+
import { createTextContext, renderNodeToText, resolveReportTree, validateReportTree, ResolveMemo, } from "../definition/tree.js";
|
|
6
|
+
import { buildReportMeta, resolveReportTitle, } from "../definition/report.js";
|
|
7
|
+
import { resolveLocalizedText } from "../model/locale.js";
|
|
8
|
+
/** 默认下钻命令:`niceeval show <locator>` 是 show 已实现的真实 CLI 语法,不需要反查 eval id 再拼近似命令。 */
|
|
9
|
+
const DEFAULT_ATTEMPT_COMMAND = (locator) => `niceeval show ${locator}`;
|
|
10
|
+
// ───────────────────────── 页选择与 text 宿主入口 ─────────────────────────
|
|
11
|
+
/** `--page` 未命中:宿主据此按用法错误退出并列出可用页 id(只列 navigation !== false 的)。 */
|
|
12
|
+
export class ReportPageNotFoundError extends Error {
|
|
13
|
+
pageId;
|
|
14
|
+
available;
|
|
15
|
+
constructor(pageId, available) {
|
|
16
|
+
super(`page "${pageId}" not found. Available pages: ${available.join(", ")}`);
|
|
17
|
+
this.pageId = pageId;
|
|
18
|
+
this.available = available;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
/** 显式请求了 attempt-input page,但当前入口没有 locator 可注入 evidence。 */
|
|
22
|
+
export class ReportPageNeedsLocatorError extends Error {
|
|
23
|
+
pageId;
|
|
24
|
+
constructor(pageId) {
|
|
25
|
+
super(`Page "${pageId}" is an attempt-input page and needs a locator — it cannot be opened with --page or #/page/<id> directly. ` +
|
|
26
|
+
"Use the host's locator addressing instead (niceeval show @<locator>, or the view attempt route), which resolves this page with the matching AttemptEvidence.");
|
|
27
|
+
this.pageId = pageId;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* 挑选要渲染的 page:省略 pageId 时挑第一张 `navigation !== false` 的页(跳过参数化详情页,
|
|
32
|
+
* 它没有 locator 就不可打开);显式 pageId 命中 attempt-input page 时报
|
|
33
|
+
* ReportPageNeedsLocatorError——这个入口没有 locator,不能拿 Scope 强行 resolve。
|
|
34
|
+
*/
|
|
35
|
+
export function pickReportPage(definition, pageId) {
|
|
36
|
+
if (pageId === undefined) {
|
|
37
|
+
return definition.pages.find((p) => p.navigation !== false) ?? definition.pages[0];
|
|
38
|
+
}
|
|
39
|
+
const page = definition.pages.find((p) => p.id === pageId);
|
|
40
|
+
if (!page) {
|
|
41
|
+
throw new ReportPageNotFoundError(pageId, definition.pages.filter((p) => p.navigation !== false).map((p) => p.id));
|
|
42
|
+
}
|
|
43
|
+
if (page.input === "attempt")
|
|
44
|
+
throw new ReportPageNeedsLocatorError(page.id);
|
|
45
|
+
return page;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* text 宿主的装载语义:选页(只能是 scope-input page,见 pickReportPage)→ resolve(组合展开 +
|
|
49
|
+
* spec 取数,唯一的 await 边界)→ 树校验 → 遍历渲染 text 面。不需要 react-dom。宿主不在报告树外
|
|
50
|
+
* 另设警告通道——挑选警告的呈现件是 `ScopeWarnings` 组件,内建报告每页都放它,自定义报告放不放
|
|
51
|
+
* 是作者义务(docs/feature/reports/architecture.md「Scope 是计算入口」)。
|
|
52
|
+
*/
|
|
53
|
+
export async function renderReportToText(definition, ctx, options) {
|
|
54
|
+
const page = pickReportPage(definition, options?.pageId);
|
|
55
|
+
const meta = buildReportMeta(definition, ctx.scope);
|
|
56
|
+
const hasAttemptPage = definition.pages.some((p) => p.input === "attempt");
|
|
57
|
+
const resolved = await resolveReportTree(page.content, {
|
|
58
|
+
scope: ctx.scope,
|
|
59
|
+
results: ctx.results,
|
|
60
|
+
report: meta,
|
|
61
|
+
page: { id: page.id, input: "scope" },
|
|
62
|
+
memo: new ResolveMemo(),
|
|
63
|
+
});
|
|
64
|
+
validateReportTree(resolved);
|
|
65
|
+
return renderNodeToText(resolved, createTextContext({
|
|
66
|
+
...options,
|
|
67
|
+
attemptCommand: options?.attemptCommand ?? (hasAttemptPage ? DEFAULT_ATTEMPT_COMMAND : undefined),
|
|
68
|
+
}));
|
|
69
|
+
}
|
|
70
|
+
/** 页索引标题行(show 多页索引 / view 导航共用的解析结果):按 locale 解析的标题字符串。 */
|
|
71
|
+
export function reportTitleText(definition, scope, locale) {
|
|
72
|
+
return resolveLocalizedText(resolveReportTitle(definition, scope), locale);
|
|
73
|
+
}
|
|
74
|
+
function quoteArg(value) {
|
|
75
|
+
return /^[A-Za-z0-9._/@-]+$/.test(value) ? value : `'${value.replaceAll("'", `'"'"'`)}'`;
|
|
76
|
+
}
|
|
77
|
+
/** 按上下文拼组索引的可复制命令:`niceeval show <patterns> --exp <id> [--results/--report/--page]`。 */
|
|
78
|
+
function experimentCommandFor(ctx) {
|
|
79
|
+
return (prefix) => {
|
|
80
|
+
const parts = ["niceeval show", ...ctx.patterns.map(quoteArg), `--exp ${quoteArg(prefix)}`];
|
|
81
|
+
if (ctx.results !== undefined)
|
|
82
|
+
parts.push(`--results ${quoteArg(ctx.results)}`);
|
|
83
|
+
if (ctx.report !== undefined)
|
|
84
|
+
parts.push(`--report ${quoteArg(ctx.report)}`);
|
|
85
|
+
if (ctx.page !== undefined)
|
|
86
|
+
parts.push(`--page ${quoteArg(ctx.page)}`);
|
|
87
|
+
return parts.join(" ");
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* 渲染一页报告树的 text 面(宿主逐页调用;页选择归宿主):
|
|
92
|
+
* resolve(组合展开 + spec 取数)→ validate → render。宿主不在报告树外另设警告通道,
|
|
93
|
+
* 挑选警告由页内的 `ScopeWarnings` 组件呈现(内建报告每页都放它)。当前 definition 没有
|
|
94
|
+
* attempt-input page 时不注入默认下钻命令,调用方也没显式给,`ctx.attemptCommand` 就不存在。
|
|
95
|
+
*/
|
|
96
|
+
export async function renderReportTreeToText(tree, ctx, options) {
|
|
97
|
+
const resolved = await resolveReportTree(tree, {
|
|
98
|
+
scope: ctx.scope,
|
|
99
|
+
results: ctx.results,
|
|
100
|
+
report: ctx.report,
|
|
101
|
+
page: ctx.page,
|
|
102
|
+
memo: new ResolveMemo(),
|
|
103
|
+
});
|
|
104
|
+
validateReportTree(resolved);
|
|
105
|
+
const hasAttemptPage = ctx.report.pages.some((p) => p.input === "attempt");
|
|
106
|
+
const textCtx = createTextContext({
|
|
107
|
+
...options,
|
|
108
|
+
attemptCommand: options?.attemptCommand ?? (hasAttemptPage ? DEFAULT_ATTEMPT_COMMAND : undefined),
|
|
109
|
+
...(options?.experimentCommand === undefined && options?.commandContext !== undefined
|
|
110
|
+
? { experimentCommand: experimentCommandFor(options.commandContext) }
|
|
111
|
+
: {}),
|
|
112
|
+
});
|
|
113
|
+
return renderNodeToText(resolved, textCtx);
|
|
114
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { AttemptLocator } from "../../results/locator.ts";
|
|
2
|
+
import type { Scope } from "../../results/types.ts";
|
|
3
|
+
import { type PageContext } from "../definition/tree.ts";
|
|
4
|
+
import { type ReportLocale } from "../model/locale.ts";
|
|
5
|
+
import { type ReportDefinition } from "../definition/report.ts";
|
|
6
|
+
import { type ReportHostContext } from "./text.ts";
|
|
7
|
+
export interface StaticHtmlOptions {
|
|
8
|
+
/** 渲染哪一页;缺省第一张可导航页。命中 attempt-input page 抛 ReportPageNeedsLocatorError。 */
|
|
9
|
+
pageId?: string;
|
|
10
|
+
/** 证据室深链;当前 definition 没有 attempt-input page 时不注入默认值,除非显式传入。 */
|
|
11
|
+
attemptHref?: (locator: AttemptLocator) => string;
|
|
12
|
+
/** 官方组件 chrome 文案的 locale;默认 "en"。 */
|
|
13
|
+
locale?: ReportLocale;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* web 宿主的装载语义:选页(只能是 scope-input page)→ resolve(组合展开 + spec 取数,
|
|
17
|
+
* 唯一的 await 边界)→ 树校验(与 text 宿主同一遍)→ 静态渲染 web 面。宿主不在报告树外
|
|
18
|
+
* 另设警告通道——挑选警告的呈现件是 `ScopeWarnings` 组件,内建报告每页都放它,自定义报告
|
|
19
|
+
* 放不放是作者义务(docs/feature/reports/architecture.md「Scope 是计算入口」)。
|
|
20
|
+
*/
|
|
21
|
+
export declare function renderReportToStaticHtml(definition: ReportDefinition, ctx: ReportHostContext, options?: StaticHtmlOptions): Promise<string>;
|
|
22
|
+
/**
|
|
23
|
+
* 渲染一页报告树的 web 面(宿主逐页调用;页选择归宿主):resolve → validate → 静态渲染。
|
|
24
|
+
* 挑选警告由页内的 `ScopeWarnings` 组件呈现,宿主不前置任何树外块。
|
|
25
|
+
* ctx.report 是宿主规范化后的声明,ctx.page 是当前页判别(scope 或 attempt 分支)。
|
|
26
|
+
*/
|
|
27
|
+
export declare function renderReportTreeToStaticHtml(tree: import("../definition/tree.ts").ReportNode, ctx: {
|
|
28
|
+
scope: Scope;
|
|
29
|
+
results: import("../../results/types.ts").Results;
|
|
30
|
+
report: import("../definition/report.ts").ReportMeta;
|
|
31
|
+
page: PageContext;
|
|
32
|
+
}, options?: {
|
|
33
|
+
attemptHref?: (locator: AttemptLocator) => string;
|
|
34
|
+
locale?: ReportLocale;
|
|
35
|
+
}): Promise<string>;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// web 宿主(view --report)的装载入口:同一棵树走 web 面,renderToStaticMarkup 吐静态
|
|
2
|
+
// HTML 烘进查看器的报告槽。只有这一侧真正 import react-dom(import 边界即运行时边界),
|
|
3
|
+
// 所以本文件不从 niceeval/report 的入口 re-export —— 宿主与测试按源路径 import。
|
|
4
|
+
import { renderToStaticMarkup } from "react-dom/server";
|
|
5
|
+
import { resolveReportTree, runWithWebContext, validateReportTree, ResolveMemo, } from "../definition/tree.js";
|
|
6
|
+
import { DEFAULT_REPORT_LOCALE } from "../model/locale.js";
|
|
7
|
+
import { buildReportMeta } from "../definition/report.js";
|
|
8
|
+
import { pickReportPage } from "./text.js";
|
|
9
|
+
/**
|
|
10
|
+
* 默认证据室深链:view 静态站的 attempt 文档路径,根相对(与 index.html 同级 —— scope-input
|
|
11
|
+
* page 恒在文档树的根)。文件名是 URL 编码后的 locator(architecture.md「Attempt 详情是一张
|
|
12
|
+
* 参数化 page」);磁盘/清单键用未编码的原始 locator,两者的对应关系与拆分只住在 view 的站点
|
|
13
|
+
* 管线(site.ts),这里只产出 href 字符串。从 attempt 页面自身内容渲染时(极少见:自定义
|
|
14
|
+
* attempt-input page 里嵌了别的证据引用组件)view 显式传入同级相对版本覆盖这个默认值,
|
|
15
|
+
* 不依赖这里的根相对形态。
|
|
16
|
+
*/
|
|
17
|
+
const DEFAULT_ATTEMPT_HREF = (locator) => `attempt/${encodeURIComponent(locator)}.html`;
|
|
18
|
+
/**
|
|
19
|
+
* web 宿主的装载语义:选页(只能是 scope-input page)→ resolve(组合展开 + spec 取数,
|
|
20
|
+
* 唯一的 await 边界)→ 树校验(与 text 宿主同一遍)→ 静态渲染 web 面。宿主不在报告树外
|
|
21
|
+
* 另设警告通道——挑选警告的呈现件是 `ScopeWarnings` 组件,内建报告每页都放它,自定义报告
|
|
22
|
+
* 放不放是作者义务(docs/feature/reports/architecture.md「Scope 是计算入口」)。
|
|
23
|
+
*/
|
|
24
|
+
export async function renderReportToStaticHtml(definition, ctx, options) {
|
|
25
|
+
const page = pickReportPage(definition, options?.pageId);
|
|
26
|
+
const meta = buildReportMeta(definition, ctx.scope);
|
|
27
|
+
const hasAttemptPage = definition.pages.some((p) => p.input === "attempt");
|
|
28
|
+
const resolved = await resolveReportTree(page.content, {
|
|
29
|
+
scope: ctx.scope,
|
|
30
|
+
results: ctx.results,
|
|
31
|
+
report: meta,
|
|
32
|
+
page: { id: page.id, input: "scope" },
|
|
33
|
+
memo: new ResolveMemo(),
|
|
34
|
+
});
|
|
35
|
+
validateReportTree(resolved);
|
|
36
|
+
const webCtx = {
|
|
37
|
+
...(options?.attemptHref !== undefined
|
|
38
|
+
? { attemptHref: options.attemptHref }
|
|
39
|
+
: hasAttemptPage
|
|
40
|
+
? { attemptHref: DEFAULT_ATTEMPT_HREF }
|
|
41
|
+
: {}),
|
|
42
|
+
locale: options?.locale ?? DEFAULT_REPORT_LOCALE,
|
|
43
|
+
};
|
|
44
|
+
return runWithWebContext(webCtx, () => renderToStaticMarkup(resolved));
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* 渲染一页报告树的 web 面(宿主逐页调用;页选择归宿主):resolve → validate → 静态渲染。
|
|
48
|
+
* 挑选警告由页内的 `ScopeWarnings` 组件呈现,宿主不前置任何树外块。
|
|
49
|
+
* ctx.report 是宿主规范化后的声明,ctx.page 是当前页判别(scope 或 attempt 分支)。
|
|
50
|
+
*/
|
|
51
|
+
export async function renderReportTreeToStaticHtml(tree, ctx, options) {
|
|
52
|
+
const resolved = await resolveReportTree(tree, {
|
|
53
|
+
scope: ctx.scope,
|
|
54
|
+
results: ctx.results,
|
|
55
|
+
report: ctx.report,
|
|
56
|
+
page: ctx.page,
|
|
57
|
+
memo: new ResolveMemo(),
|
|
58
|
+
});
|
|
59
|
+
validateReportTree(resolved);
|
|
60
|
+
const hasAttemptPage = ctx.report.pages.some((p) => p.input === "attempt");
|
|
61
|
+
const webCtx = {
|
|
62
|
+
...(options?.attemptHref !== undefined
|
|
63
|
+
? { attemptHref: options.attemptHref }
|
|
64
|
+
: hasAttemptPage
|
|
65
|
+
? { attemptHref: DEFAULT_ATTEMPT_HREF }
|
|
66
|
+
: {}),
|
|
67
|
+
locale: options?.locale ?? DEFAULT_REPORT_LOCALE,
|
|
68
|
+
};
|
|
69
|
+
return runWithWebContext(webCtx, () => renderToStaticMarkup(resolved));
|
|
70
|
+
}
|