niceeval 0.9.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/INDEX.md +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 +15 -7
- 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 +6 -0
- package/dist/report/components/attempt-detail/AttemptConversation.js +34 -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 +27 -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 +254 -0
- package/dist/report/components/attempt-detail/faces.d.ts +14 -0
- package/dist/report/components/attempt-detail/faces.js +235 -0
- package/dist/report/components/attempt-detail/index.d.ts +38 -0
- package/dist/report/components/attempt-detail/index.js +527 -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 +3 -3
- package/dist/report/{react → components/entity-lists}/ExperimentList.js +10 -10
- 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 +174 -0
- package/dist/report/components/entity-lists/index.d.ts +51 -0
- package/dist/report/components/entity-lists/index.js +165 -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 +26 -23
- 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} +44 -12
- package/dist/report/{tree.js → definition/tree.js} +10 -12
- 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} +11 -5
- package/dist/report/{format.js → model/format.js} +48 -4
- 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} +140 -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 +12 -2
- 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 +149 -23
- package/dist/sandbox/docker.d.ts +6 -0
- 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 +15 -1
- package/dist/shared/aggregate.js +32 -1
- 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 +1 -1
- 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 +11 -11
- 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 +35 -32
- 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 +193 -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 +43 -19
- 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 +103 -0
- package/docs-site/zh/{how-to → tutorials}/fixtures.mdx +9 -9
- package/docs-site/zh/{how-to → tutorials}/publish-report.mdx +11 -5
- 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 +59 -50
- package/docs-site/zh/tutorials/write-experiment.mdx +355 -0
- package/docs-site/zh/{how-to → tutorials}/write-send.mdx +40 -40
- package/package.json +8 -4
- 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 +77 -64
- package/src/context/types.ts +21 -21
- package/src/define.ts +13 -0
- package/src/i18n/en.ts +30 -15
- package/src/i18n/zh-CN.ts +30 -15
- package/src/index.ts +2 -0
- package/src/report/{react → assets}/colors.ts +22 -0
- package/src/report/{react → assets}/enhance.js +1 -33
- package/src/report/{react → assets}/styles.css +136 -112
- 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 +110 -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 +80 -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 +680 -0
- package/src/report/components/attempt-detail/compute.ts +287 -0
- package/src/report/components/attempt-detail/faces.ts +257 -0
- package/src/report/components/attempt-detail/index.tsx +583 -0
- package/src/report/components/attempt-detail/validate.test.ts +235 -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 +23 -20
- package/src/report/components/entity-lists/compute.ts +196 -0
- package/src/report/components/entity-lists/faces.ts +207 -0
- package/src/report/components/entity-lists/index.tsx +241 -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 +41 -33
- 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 +47 -17
- 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} +58 -22
- package/src/report/index.ts +126 -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} +59 -5
- 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} +143 -22
- package/src/report/react/index.tsx +52 -26
- package/src/report/{dual-render.test.tsx → runtime/dual-render.test.tsx} +564 -49
- 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 +54 -3
- package/src/results/select.ts +30 -6
- 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 +158 -23
- package/src/sandbox/docker.ts +7 -0
- package/src/sandbox/e2b.ts +12 -13
- 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 +30 -1
- 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 +58 -22
- package/src/show/render.ts +16 -240
- package/src/show/show.test.ts +128 -35
- package/src/view/app/App.test.tsx +8 -7
- package/src/view/app/App.tsx +135 -51
- 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 +122 -89
- package/src/view/index.ts +3 -13
- package/src/view/server.ts +36 -6
- 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 +18 -806
- package/src/view/view-report.test.ts +182 -34
- 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/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,3 +1,3 @@
|
|
|
1
|
-
import { standard } from "./standard.tsx";
|
|
2
|
-
export { standard };
|
|
1
|
+
import { standard, standardAttemptPage } from "./standard.tsx";
|
|
2
|
+
export { standard, standardAttemptPage };
|
|
3
3
|
export default standard;
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
// 有自己的名字、一个源文件,按名字具名导出;默认导出恒等于 standard——裸宿主装载的那份
|
|
3
3
|
// (docs/feature/reports/library/built-in.md)。新增内建视图 = 新文件 + 新具名导出,
|
|
4
4
|
// 不需要注册表,也不改变装载管线。
|
|
5
|
-
import { standard } from "./standard.js";
|
|
6
|
-
export { standard };
|
|
5
|
+
import { standard, standardAttemptPage } from "./standard.js";
|
|
6
|
+
export { standard, standardAttemptPage };
|
|
7
7
|
export default standard;
|
|
@@ -1 +1,8 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const standardAttemptPage: {
|
|
2
|
+
readonly id: "attempt";
|
|
3
|
+
readonly title: "Attempt";
|
|
4
|
+
readonly input: "attempt";
|
|
5
|
+
readonly navigation: false;
|
|
6
|
+
readonly content: import("react").JSX.Element;
|
|
7
|
+
};
|
|
8
|
+
export declare const standard: import("../index.ts").ReportDefinition;
|
|
@@ -1,14 +1,23 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
// standard —— 内建视图之一:报告 / Attempts /
|
|
3
|
-
// (docs/feature/reports/library/built-in.md)。裸 `niceeval show` 与
|
|
4
|
-
// 装载的就是它:一份普通 defineReport,与用户的 --report 文件同层、走同一条
|
|
2
|
+
// standard —— 内建视图之一:报告 / Attempts / 追踪三页的通用结果站 + 一张隐藏的 attempt
|
|
3
|
+
// 详情页,没有任何私有钩子(docs/feature/reports/library/built-in.md)。裸 `niceeval show` 与
|
|
4
|
+
// `niceeval view` 装载的就是它:一份普通 defineReport,与用户的 --report 文件同层、走同一条
|
|
5
5
|
// 装载 → resolve → validate → render 管线。「builtin」不是装载逻辑里的类别,
|
|
6
6
|
// 只是宿主默认拿哪个值的事实;用户报告经 defineReport({ extends: standard, … }) 整站复用。
|
|
7
7
|
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
|
|
8
|
+
// 四页:report(Hero + 警告 + 批量修复 prompt + 实验对比)、attempts(带过滤的 attempt
|
|
9
|
+
// 全列表)、traces(执行瀑布)三页进导航;第四张 standardAttemptPage 以 locator 为输入、
|
|
10
|
+
// 不进导航,locator 深链打开它,content 就是公开的 AttemptDetail 组合组件。裸宿主导航上能
|
|
11
|
+
// 看到的一切内容都在这份定义里;宿主保留的只有机器(docs/feature/reports/architecture.md
|
|
12
|
+
// 「宿主保留的只有机器」)。
|
|
13
|
+
import { AttemptDetail, AttemptList, Col, CopyFixPrompt, ExperimentComparison, Hero, ScopeWarnings, TraceWaterfall, defineReport, } from "../index.js";
|
|
14
|
+
export const standardAttemptPage = {
|
|
15
|
+
id: "attempt",
|
|
16
|
+
title: "Attempt",
|
|
17
|
+
input: "attempt",
|
|
18
|
+
navigation: false,
|
|
19
|
+
content: _jsx(AttemptDetail, {}),
|
|
20
|
+
};
|
|
12
21
|
export const standard = defineReport({
|
|
13
22
|
pages: [
|
|
14
23
|
{
|
|
@@ -26,5 +35,6 @@ export const standard = defineReport({
|
|
|
26
35
|
title: { en: "Traces", "zh-CN": "追踪" },
|
|
27
36
|
content: (_jsxs(Col, { children: [_jsx(Hero, {}), _jsx(ScopeWarnings, {}), _jsx(TraceWaterfall, {})] })),
|
|
28
37
|
},
|
|
38
|
+
standardAttemptPage,
|
|
29
39
|
],
|
|
30
40
|
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cx } from "../shared.js";
|
|
3
|
+
function assertTone(a) {
|
|
4
|
+
if (a.outcome === "unavailable")
|
|
5
|
+
return "na";
|
|
6
|
+
if (a.outcome === "passed")
|
|
7
|
+
return "good";
|
|
8
|
+
return a.severity === "soft" ? "warn" : "bad";
|
|
9
|
+
}
|
|
10
|
+
function AssertionRow({ a }) {
|
|
11
|
+
return (_jsxs("details", { className: "nre-assertion-row", open: true, children: [_jsxs("summary", { children: [_jsx("span", { className: `nre-assertion-badge nre-tone-${assertTone(a)}`, children: a.outcome === "unavailable" ? "unavailable" : a.outcome }), _jsxs("span", { className: "nre-assertion-name", children: [a.groupPath?.length ? `${a.groupPath.join(" > ")} · ` : "", a.name] }), a.detail && a.detail !== a.name ? _jsx("span", { className: "nre-assertion-detail", children: a.detail }) : null] }), _jsxs("div", { className: "nre-assertion-body", children: [a.outcome === "unavailable" ? _jsx("div", { children: a.reason }) : null, a.outcome !== "unavailable" && a.expected !== undefined ? _jsxs("div", { children: ["expected: ", a.expected] }) : null, a.outcome !== "unavailable" && a.received !== undefined ? _jsxs("div", { children: ["received: ", a.received] }) : null] })] }));
|
|
12
|
+
}
|
|
13
|
+
export function AttemptAssertions({ data, className, }) {
|
|
14
|
+
if (data === null)
|
|
15
|
+
return null;
|
|
16
|
+
return (_jsxs("div", { className: cx("nre", "nre-attempt-assertions", className), children: [data.attention.map((a, i) => (_jsx(AssertionRow, { a: a }, i))), data.passedGroups.length > 0 ? (_jsxs("details", { className: "nre-assertions-passed", children: [_jsxs("summary", { children: ["passed \u00B7 ", data.passedGroups.reduce((n, g) => n + g.items.length, 0)] }), data.passedGroups.map(({ group, items }) => (_jsxs("details", { className: "nre-assertions-passed-group", children: [_jsxs("summary", { children: [group || "—", " \u00B7 ", items.length] }), items.map((a, i) => (_jsx(AssertionRow, { a: a }, i)))] }, group || "·")))] })) : null] }));
|
|
17
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ReactElement } from "react";
|
|
2
|
+
import type { AttemptConversationData } from "../../model/types.ts";
|
|
3
|
+
export declare function AttemptConversation({ data, className, }: {
|
|
4
|
+
data: AttemptConversationData | null;
|
|
5
|
+
className?: string;
|
|
6
|
+
}): ReactElement | null;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cx } from "../shared.js";
|
|
3
|
+
function ReplyRow({ reply }) {
|
|
4
|
+
switch (reply.kind) {
|
|
5
|
+
case "assistant":
|
|
6
|
+
return (_jsxs("div", { className: "nre-conv-assistant", children: [_jsx("span", { className: "nre-conv-role", children: "assistant" }), _jsx("div", { className: "nre-conv-text", children: reply.text })] }));
|
|
7
|
+
case "user":
|
|
8
|
+
return (_jsxs("div", { className: "nre-conv-user", children: [_jsx("span", { className: "nre-conv-role", children: "user" }), _jsx("div", { className: "nre-conv-text", children: reply.text })] }));
|
|
9
|
+
case "thinking":
|
|
10
|
+
return (_jsxs("details", { className: "nre-conv-thinking", children: [_jsx("summary", { children: "thinking" }), _jsx("div", { className: "nre-conv-text", children: reply.text })] }));
|
|
11
|
+
case "error":
|
|
12
|
+
return _jsxs("div", { className: "nre-conv-error", children: ["! ", reply.text] });
|
|
13
|
+
case "skill":
|
|
14
|
+
return (_jsxs("div", { className: "nre-conv-skill", children: [_jsx("span", { className: "nre-conv-role", children: "skill loaded" }), " ", reply.skill] }));
|
|
15
|
+
case "tool":
|
|
16
|
+
return (_jsxs("details", { className: "nre-conv-tool", children: [_jsxs("summary", { children: [reply.name, reply.status ? ` · ${reply.status}` : ""] }), _jsx("pre", { className: "nre-conv-tool-io", children: JSON.stringify(reply.input, null, 2) }), reply.output !== undefined ? _jsx("pre", { className: "nre-conv-tool-io", children: JSON.stringify(reply.output, null, 2) }) : null] }));
|
|
17
|
+
case "subagent":
|
|
18
|
+
return (_jsxs("details", { className: "nre-conv-subagent", children: [_jsxs("summary", { children: ["subagent ", reply.name, reply.status ? ` · ${reply.status}` : ""] }), reply.output !== undefined ? _jsx("pre", { className: "nre-conv-tool-io", children: JSON.stringify(reply.output, null, 2) }) : null] }));
|
|
19
|
+
case "input":
|
|
20
|
+
return _jsxs("div", { className: "nre-conv-input", children: ["input requested", reply.request.prompt ? `: ${reply.request.prompt}` : ""] });
|
|
21
|
+
case "compaction":
|
|
22
|
+
return _jsxs("div", { className: "nre-conv-compaction", children: ["compaction", reply.reason ? `: ${reply.reason}` : ""] });
|
|
23
|
+
case "raw":
|
|
24
|
+
return (_jsxs("details", { className: "nre-conv-raw", children: [_jsx("summary", { children: "unrecognized event" }), _jsx("pre", { className: "nre-conv-tool-io", children: JSON.stringify(reply.raw, null, 2) })] }));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function RoundCard({ round, index }) {
|
|
28
|
+
return (_jsxs("div", { className: "nre-conv-round", children: [_jsxs("div", { className: "nre-conv-round-head", children: ["round ", index + 1, round.loc ? (_jsxs("span", { className: "nre-conv-round-loc", title: `${round.loc.file}:${round.loc.line}`, children: [round.loc.file.split("/").pop(), ":", round.loc.line] })) : null] }), round.sentText ? _jsx("div", { className: "nre-conv-sent", children: round.sentText }) : null, _jsx("div", { className: "nre-conv-replies", children: round.replies.map((reply, i) => (_jsx(ReplyRow, { reply: reply }, i))) })] }));
|
|
29
|
+
}
|
|
30
|
+
export function AttemptConversation({ data, className, }) {
|
|
31
|
+
if (data === null)
|
|
32
|
+
return null;
|
|
33
|
+
return (_jsx("div", { className: cx("nre", "nre-attempt-conversation", className), children: data.rounds.map((round, i) => (_jsx(RoundCard, { round: round, index: i }, i))) }));
|
|
34
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cx } from "../shared.js";
|
|
3
|
+
export function AttemptDiagnostics({ data, className, }) {
|
|
4
|
+
if (data === null)
|
|
5
|
+
return null;
|
|
6
|
+
return (_jsx("div", { className: cx("nre", "nre-attempt-diagnostics", className), children: data.groups.map(({ phase, items }) => (_jsxs("div", { className: "nre-diagnostics-group", children: [_jsx("div", { className: "nre-diagnostics-phase", children: phase }), _jsx("ul", { children: items.map((d, i) => (_jsxs("li", { className: `nre-diagnostics-item nre-tone-${d.level === "error" ? "bad" : "warn"}`, children: [_jsxs("span", { className: "nre-diagnostics-meta", children: [d.level, " \u00B7 ", d.code] }), _jsxs("div", { children: [d.message, d.count && d.count > 1 ? ` (${d.count} occurrences)` : ""] })] }, i))) })] }, phase))) }));
|
|
7
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cx } from "../shared.js";
|
|
3
|
+
const NET_LABEL = { added: "generated", modified: "modified", deleted: "deleted" };
|
|
4
|
+
function FileRow({ file }) {
|
|
5
|
+
return (_jsxs("li", { className: cx("nre-diff-file", `nre-diff-${file.net}`), children: [_jsx("span", { className: "nre-diff-net", children: NET_LABEL[file.net] }), _jsx("span", { className: "nre-diff-path", children: file.path }), file.binary ? (_jsx("span", { className: "nre-diff-lines", children: "binary" })) : (_jsxs("span", { className: "nre-diff-lines", children: ["+", file.lines.added, " / -", file.lines.deleted] }))] }));
|
|
6
|
+
}
|
|
7
|
+
export function AttemptDiff({ data, className }) {
|
|
8
|
+
if (data === null)
|
|
9
|
+
return null;
|
|
10
|
+
return (_jsx("ul", { className: cx("nre", "nre-attempt-diff", className), children: data.files.map((f) => (_jsx(FileRow, { file: f }, f.path))) }));
|
|
11
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Fragment } from "react";
|
|
3
|
+
import { cx } from "../shared.js";
|
|
4
|
+
export function AttemptError({ data, className }) {
|
|
5
|
+
if (data === null)
|
|
6
|
+
return null;
|
|
7
|
+
const rows = [
|
|
8
|
+
["phase", data.phase],
|
|
9
|
+
["code", data.code],
|
|
10
|
+
["message", data.message],
|
|
11
|
+
];
|
|
12
|
+
if (data.cause)
|
|
13
|
+
rows.push(["cause", data.cause.name ? `${data.cause.name} · ${data.cause.message}` : data.cause.message]);
|
|
14
|
+
const stack = data.stack?.replace(/\n+$/, "") ?? "";
|
|
15
|
+
return (_jsxs("div", { className: cx("nre", "nre-attempt-error", className), children: [_jsx("dl", { className: "nre-attempt-error-fields", children: rows.map(([k, v]) => (_jsxs(Fragment, { children: [_jsx("dt", { children: k }), _jsx("dd", { children: v })] }, k))) }), stack ? _jsx("pre", { className: "nre-attempt-error-stack", children: stack }) : null] }));
|
|
16
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cx } from "../shared.js";
|
|
3
|
+
export function AttemptFixPrompt({ data, className, }) {
|
|
4
|
+
if (data === null)
|
|
5
|
+
return null;
|
|
6
|
+
return (_jsxs("details", { className: cx("nre", "nre-attempt-fix-prompt", className), children: [_jsx("summary", { className: "nre-attempt-fix-prompt-summary", children: "Fix prompt" }), _jsx("button", { type: "button", className: "nre-attempt-fix-prompt-copy", "data-nre-copy": data.prompt, children: "Copy fix prompt" }), _jsx("pre", { className: "nre-attempt-fix-prompt-text", children: data.prompt })] }));
|
|
7
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cx } from "../shared.js";
|
|
3
|
+
function assertTone(a) {
|
|
4
|
+
if (a.outcome === "unavailable")
|
|
5
|
+
return "na";
|
|
6
|
+
if (a.outcome === "passed")
|
|
7
|
+
return "good";
|
|
8
|
+
return a.severity === "soft" ? "warn" : "bad";
|
|
9
|
+
}
|
|
10
|
+
export function AttemptSource({ data, className }) {
|
|
11
|
+
if (data === null)
|
|
12
|
+
return null;
|
|
13
|
+
return (_jsxs("div", { className: cx("nre", "nre-attempt-source", className), children: [_jsx("div", { className: "nre-attempt-source-head", children: data.sourcePath }), _jsx("div", { className: "nre-attempt-source-lines", children: data.lines.map((line) => {
|
|
14
|
+
const hasAsserts = line.assertions.length > 0;
|
|
15
|
+
const hasSends = line.sends.length > 0;
|
|
16
|
+
const worstTone = hasAsserts
|
|
17
|
+
? line.assertions.some((a) => assertTone(a) === "bad")
|
|
18
|
+
? "bad"
|
|
19
|
+
: line.assertions.some((a) => assertTone(a) === "warn")
|
|
20
|
+
? "warn"
|
|
21
|
+
: line.assertions.some((a) => assertTone(a) === "na")
|
|
22
|
+
? "na"
|
|
23
|
+
: "good"
|
|
24
|
+
: undefined;
|
|
25
|
+
return (_jsxs("details", { className: cx("nre-source-line", worstTone ? `nre-tone-${worstTone}` : undefined, hasSends ? "nre-source-line-send" : undefined), open: hasAsserts && (worstTone === "bad" || worstTone === "warn"), children: [_jsxs("summary", { children: [_jsx("span", { className: "nre-source-ln", children: line.line }), _jsx("code", { className: "nre-source-text", children: line.text }), hasSends ? _jsxs("span", { className: "nre-source-send-mark", children: ["\u21B3 ", line.sends.map((s) => s.label).join(", ")] }) : null] }), hasAsserts ? (_jsx("div", { className: "nre-source-line-detail", children: line.assertions.map((a, i) => (_jsxs("div", { className: `nre-assertion-row nre-tone-${assertTone(a)}`, children: [_jsx("span", { className: "nre-assertion-name", children: a.name }), a.outcome === "unavailable" ? (_jsx("span", { children: a.reason })) : (_jsxs(_Fragment, { children: [a.expected !== undefined ? _jsxs("span", { children: ["expected: ", a.expected] }) : null, a.received !== undefined ? _jsxs("span", { children: ["received: ", a.received] }) : null] }))] }, i))) })) : null] }, line.line));
|
|
26
|
+
}) }), data.unmapped.length > 0 ? (_jsxs("div", { className: "nre-attempt-source-unmapped", children: [_jsx("div", { className: "nre-attempt-source-unmapped-head", children: "Other assertions" }), data.unmapped.map((a, i) => (_jsxs("div", { className: `nre-assertion-row nre-tone-${assertTone(a)}`, children: [a.groupPath?.length ? `${a.groupPath.join(" > ")} · ` : "", a.name] }, i)))] })) : null] }));
|
|
27
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ReactElement } from "react";
|
|
2
|
+
import type { AttemptSummaryData } from "../../model/types.ts";
|
|
3
|
+
import { type ReportLocale } from "../../model/locale.ts";
|
|
4
|
+
export declare function AttemptSummary({ data, locale, className, }: {
|
|
5
|
+
data: AttemptSummaryData;
|
|
6
|
+
locale?: ReportLocale;
|
|
7
|
+
className?: string;
|
|
8
|
+
}): ReactElement;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { DEFAULT_REPORT_LOCALE, localeText } from "../../model/locale.js";
|
|
3
|
+
import { cx } from "../shared.js";
|
|
4
|
+
const CAPABILITY_LABEL = {
|
|
5
|
+
source: "source",
|
|
6
|
+
execution: "execution",
|
|
7
|
+
timing: "timing",
|
|
8
|
+
diff: "diff",
|
|
9
|
+
};
|
|
10
|
+
export function AttemptSummary({ data, locale = DEFAULT_REPORT_LOCALE, className, }) {
|
|
11
|
+
const caps = Object.keys(data.capabilities).filter((k) => data.capabilities[k]);
|
|
12
|
+
return (_jsxs("div", { className: cx("nre", "nre-attempt-summary", className), children: [_jsxs("div", { className: "nre-attempt-summary-head", children: [_jsx("span", { className: `nre-verdict-pill nre-verdict-${data.verdict}`, children: localeText(locale, `verdict.${data.verdict}`) }), _jsx("span", { className: "nre-attempt-summary-locator", children: data.locator })] }), _jsxs("dl", { className: "nre-attempt-summary-kpis", children: [_jsxs("div", { children: [_jsx("dt", { children: "Experiment" }), _jsx("dd", { children: data.identity.experimentId })] }), _jsxs("div", { children: [_jsx("dt", { children: "Eval" }), _jsx("dd", { children: data.identity.evalId })] }), _jsxs("div", { children: [_jsx("dt", { children: "Attempt" }), _jsx("dd", { children: data.identity.attempt + 1 })] }), data.startedAt ? (_jsxs("div", { children: [_jsx("dt", { children: "Started" }), _jsx("dd", { children: data.startedAt })] })) : null, _jsxs("div", { children: [_jsx("dt", { children: "Duration" }), _jsx("dd", { children: formatDurationMs(data.durationMs) })] }), data.costUSD !== null ? (_jsxs("div", { children: [_jsx("dt", { children: "Cost" }), _jsxs("dd", { children: ["$", data.costUSD.toFixed(4)] })] })) : null] }), caps.length > 0 ? (_jsx("p", { className: "nre-attempt-summary-caps", children: caps.map((k) => CAPABILITY_LABEL[k]).join(" · ") })) : null] }));
|
|
13
|
+
}
|
|
14
|
+
function formatDurationMs(ms) {
|
|
15
|
+
if (ms >= 60_000)
|
|
16
|
+
return `${Math.floor(ms / 60_000)}m ${Math.round((ms % 60_000) / 1000)}s`;
|
|
17
|
+
if (ms >= 1000)
|
|
18
|
+
return `${(ms / 1000).toFixed(1)}s`;
|
|
19
|
+
return `${ms}ms`;
|
|
20
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { formatDurationMs } from "../../model/format.js";
|
|
3
|
+
import { cx } from "../shared.js";
|
|
4
|
+
const CLOSING_PHASES = new Set(["eval.teardown", "agent.teardown", "sandbox.teardown", "sandbox.suspend", "sandbox.stop"]);
|
|
5
|
+
function TimingNodeRow({ node, trace }) {
|
|
6
|
+
const kids = node.children ?? [];
|
|
7
|
+
const spans = node.kind === "turn" && node.traceId && trace ? trace.filter((s) => s.traceId === node.traceId) : [];
|
|
8
|
+
const label = node.kind === "command" && node.command ? `shell · ${node.command.display}` : node.label;
|
|
9
|
+
if (kids.length === 0 && spans.length === 0) {
|
|
10
|
+
return (_jsxs("li", { className: cx("nre-timeline-node", node.failed ? "nre-timeline-failed" : undefined), children: [_jsx("span", { title: label, children: label }), " ", _jsx("span", { className: "nre-timeline-dur", children: formatDurationMs(node.durationMs) }), node.failed ? " ✗" : ""] }));
|
|
11
|
+
}
|
|
12
|
+
return (_jsx("li", { children: _jsxs("details", { open: Boolean(node.failed), children: [_jsxs("summary", { className: cx("nre-timeline-node", node.failed ? "nre-timeline-failed" : undefined), children: [_jsx("span", { title: label, children: label }), " ", _jsx("span", { className: "nre-timeline-dur", children: formatDurationMs(node.durationMs) }), node.failed ? " ✗" : ""] }), kids.length > 0 ? (_jsx("ul", { className: "nre-timeline-children", children: kids.map((child) => (_jsx(TimingNodeRow, { node: child, trace: trace }, child.id))) })) : null, spans.length > 0 ? (_jsx("ul", { className: "nre-timeline-spans", children: spans.map((s) => (_jsxs("li", { children: [s.kind, " \u00B7 ", s.name, " \u00B7 ", formatDurationMs(s.endMs - s.startMs)] }, s.spanId))) })) : null] }) }));
|
|
13
|
+
}
|
|
14
|
+
export function AttemptTimeline({ data, className }) {
|
|
15
|
+
if (data === null)
|
|
16
|
+
return null;
|
|
17
|
+
const main = data.phases.filter((p) => !CLOSING_PHASES.has(p.name));
|
|
18
|
+
const closing = data.phases.filter((p) => CLOSING_PHASES.has(p.name));
|
|
19
|
+
const total = main.reduce((sum, p) => sum + p.durationMs, 0);
|
|
20
|
+
const anyFailed = data.phases.some((p) => p.failed);
|
|
21
|
+
return (_jsxs("details", { className: cx("nre", "nre-attempt-timeline", className), open: anyFailed, children: [_jsxs("summary", { children: ["Timing ", _jsx("span", { className: "nre-timeline-dur", children: formatDurationMs(total) }), anyFailed ? " ✗" : ""] }), _jsx("ul", { className: "nre-timeline-phases", children: main.map((p, i) => {
|
|
22
|
+
const kids = p.children ?? [];
|
|
23
|
+
if (kids.length === 0) {
|
|
24
|
+
return (_jsxs("li", { className: cx("nre-timeline-phase", p.failed ? "nre-timeline-failed" : undefined), children: [p.name, " ", _jsx("span", { className: "nre-timeline-dur", children: formatDurationMs(p.durationMs) }), p.failed ? " ✗" : ""] }, i));
|
|
25
|
+
}
|
|
26
|
+
return (_jsx("li", { children: _jsxs("details", { open: Boolean(p.failed), children: [_jsxs("summary", { className: cx("nre-timeline-phase", p.failed ? "nre-timeline-failed" : undefined), children: [p.name, " ", _jsx("span", { className: "nre-timeline-dur", children: formatDurationMs(p.durationMs) }), p.failed ? " ✗" : ""] }), _jsx("ul", { className: "nre-timeline-children", children: kids.map((node) => (_jsx(TimingNodeRow, { node: node, trace: data.trace }, node.id))) })] }) }, i));
|
|
27
|
+
}) }), closing.length > 0 ? (_jsxs("div", { className: "nre-timeline-closing", children: [_jsx("div", { className: "nre-timeline-closing-head", children: "teardown" }), _jsx("ul", { className: "nre-timeline-phases", children: closing.map((p, i) => (_jsxs("li", { className: cx("nre-timeline-phase", p.failed ? "nre-timeline-failed" : undefined), children: [p.name, " ", _jsx("span", { className: "nre-timeline-dur", children: formatDurationMs(p.durationMs) }), p.failed ? " ✗" : ""] }, i))) })] })) : null] }));
|
|
28
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { formatDurationMs } from "../../model/format.js";
|
|
3
|
+
import { cx } from "../shared.js";
|
|
4
|
+
function buildForest(spans) {
|
|
5
|
+
const byId = new Map(spans.map((s) => [s.spanId, { span: s, children: [] }]));
|
|
6
|
+
const roots = [];
|
|
7
|
+
for (const node of byId.values()) {
|
|
8
|
+
const parent = node.span.parentSpanId ? byId.get(node.span.parentSpanId) : undefined;
|
|
9
|
+
if (parent)
|
|
10
|
+
parent.children.push(node);
|
|
11
|
+
else
|
|
12
|
+
roots.push(node);
|
|
13
|
+
}
|
|
14
|
+
return roots;
|
|
15
|
+
}
|
|
16
|
+
function SpanRow({ node }) {
|
|
17
|
+
const failed = node.span.status === "error";
|
|
18
|
+
const body = (_jsxs(_Fragment, { children: [_jsx("span", { className: cx("nre-span-kind", node.span.kind ? `nre-span-${node.span.kind}` : undefined), children: node.span.kind ?? "other" }), _jsx("span", { title: node.span.name, children: node.span.name }), _jsx("span", { className: "nre-span-dur", children: formatDurationMs(node.span.endMs - node.span.startMs) }), failed ? " ✗" : ""] }));
|
|
19
|
+
if (node.children.length === 0) {
|
|
20
|
+
return _jsx("li", { className: "nre-trace-span", children: body });
|
|
21
|
+
}
|
|
22
|
+
return (_jsx("li", { children: _jsxs("details", { open: failed, children: [_jsx("summary", { className: "nre-trace-span", children: body }), _jsx("ul", { className: "nre-trace-children", children: node.children.map((child) => (_jsx(SpanRow, { node: child }, child.span.spanId))) })] }) }));
|
|
23
|
+
}
|
|
24
|
+
export function AttemptTrace({ data, className }) {
|
|
25
|
+
if (data === null)
|
|
26
|
+
return null;
|
|
27
|
+
const forest = buildForest(data.spans);
|
|
28
|
+
return (_jsx("ul", { className: cx("nre", "nre-attempt-trace", className), children: forest.map((node) => (_jsx(SpanRow, { node: node }, node.span.spanId))) }));
|
|
29
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cx } from "../shared.js";
|
|
3
|
+
export function AttemptUsage({ data, className }) {
|
|
4
|
+
if (data === null)
|
|
5
|
+
return null;
|
|
6
|
+
const { usage } = data;
|
|
7
|
+
const rows = [
|
|
8
|
+
["input tokens", usage.inputTokens.toLocaleString()],
|
|
9
|
+
["output tokens", usage.outputTokens.toLocaleString()],
|
|
10
|
+
];
|
|
11
|
+
if (usage.cacheReadTokens !== undefined)
|
|
12
|
+
rows.push(["cache read", usage.cacheReadTokens.toLocaleString()]);
|
|
13
|
+
if (usage.cacheWriteTokens !== undefined)
|
|
14
|
+
rows.push(["cache write", usage.cacheWriteTokens.toLocaleString()]);
|
|
15
|
+
if (usage.requests !== undefined)
|
|
16
|
+
rows.push(["requests", String(usage.requests)]);
|
|
17
|
+
if (data.costUSD !== null)
|
|
18
|
+
rows.push(["cost", `$${data.costUSD.toFixed(4)}`]);
|
|
19
|
+
return (_jsx("dl", { className: cx("nre", "nre-attempt-usage", className), children: rows.map(([k, v]) => (_jsxs("div", { className: "nre-attempt-usage-row", children: [_jsx("dt", { children: k }), _jsx("dd", { children: v })] }, k))) }));
|
|
20
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { AttemptEvidence } from "../../../results/attempt-evidence.ts";
|
|
2
|
+
import type { AttemptAssertionsData, AttemptConversationData, AttemptDiagnosticsData, AttemptDiffData, AttemptErrorData, AttemptFixPromptData, AttemptSourceData, AttemptSummaryData, AttemptTimelineData, AttemptTraceData, AttemptUsageData } from "../../model/types.ts";
|
|
3
|
+
export declare function attemptSummaryData(evidence: AttemptEvidence): AttemptSummaryData;
|
|
4
|
+
export declare function attemptErrorData(evidence: AttemptEvidence): AttemptErrorData | null;
|
|
5
|
+
export declare function attemptAssertionsData(evidence: AttemptEvidence): AttemptAssertionsData | null;
|
|
6
|
+
export declare function attemptSourceData(evidence: AttemptEvidence): AttemptSourceData | null;
|
|
7
|
+
/** 单条 attempt 版的批量修复 prompt(与 CopyFixPrompt 的多条版本同一份步骤文案)。 */
|
|
8
|
+
export declare function attemptFixPromptData(evidence: AttemptEvidence): AttemptFixPromptData | null;
|
|
9
|
+
/** 收尾段的阶段名(见 docs/feature/results/architecture.md);两面渲染都把这些单列在主链之后,不计入主链总耗时。 */
|
|
10
|
+
export declare const TIMELINE_CLOSING_PHASES: ReadonlySet<string>;
|
|
11
|
+
export declare function attemptTimelineData(evidence: AttemptEvidence): AttemptTimelineData | null;
|
|
12
|
+
/**
|
|
13
|
+
* 标准事件流按 `loc` 分轮(docs/feature/reports/library/attempt-detail.md「Attempt 详情组件」):
|
|
14
|
+
* 带 loc 的 user 消息开一轮;无 loc 的 user 消息不开新轮——与当前轮 sent 同文本的回显直接
|
|
15
|
+
* 吃掉,其它(stop-hook 反馈、skill 注入等轮内注入)作为回复条目留在当前轮。流首出现无 loc
|
|
16
|
+
* 的 user 消息(没有当前轮可归入)时退化开一条 loc 缺省的兜底轮,不丢弃。未识别的事件类型
|
|
17
|
+
* 包成 `raw` 条目原样呈现,不吞没其余事件——StreamEvent 是随 artifact 版本演进的开放词表,
|
|
18
|
+
* 这份纯函数不能假设自己认识每一种将来会出现的 type。
|
|
19
|
+
*/
|
|
20
|
+
export declare function attemptConversationData(evidence: AttemptEvidence): AttemptConversationData | null;
|
|
21
|
+
export declare function attemptDiagnosticsData(evidence: AttemptEvidence): AttemptDiagnosticsData | null;
|
|
22
|
+
export declare function attemptUsageData(evidence: AttemptEvidence): AttemptUsageData | null;
|
|
23
|
+
export declare function attemptTraceData(evidence: AttemptEvidence): AttemptTraceData | null;
|
|
24
|
+
export declare function attemptDiffData(evidence: AttemptEvidence): AttemptDiffData | null;
|