niceeval 0.6.2 → 0.7.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 +23 -23
- package/README.zh.md +6 -6
- package/dist/agents/types.d.ts +2 -2
- package/dist/i18n/zh-CN.d.ts +3 -3
- package/dist/report/aggregate.d.ts +32 -26
- package/dist/report/aggregate.js +157 -76
- package/dist/report/built-in/index.d.ts +2 -0
- package/dist/report/built-in/index.js +8 -0
- package/dist/report/components.d.ts +91 -164
- package/dist/report/components.js +377 -114
- package/dist/report/compute.d.ts +86 -73
- package/dist/report/compute.js +592 -432
- package/dist/report/flag.d.ts +28 -17
- package/dist/report/flag.js +86 -16
- package/dist/report/format.d.ts +11 -11
- package/dist/report/format.js +17 -15
- package/dist/report/index.d.ts +16 -17
- package/dist/report/index.js +20 -22
- package/dist/report/load.js +3 -2
- package/dist/report/locale.d.ts +49 -34
- package/dist/report/locale.js +106 -58
- package/dist/report/metrics.d.ts +10 -3
- package/dist/report/metrics.js +46 -12
- package/dist/report/primitives.d.ts +42 -15
- package/dist/report/primitives.js +135 -26
- package/dist/report/react/AttemptList.d.ts +10 -8
- package/dist/report/react/AttemptList.js +18 -10
- package/dist/report/react/DeltaTable.js +19 -18
- package/dist/report/react/EvalList.d.ts +3 -3
- package/dist/report/react/EvalList.js +0 -0
- package/dist/report/react/ExperimentComparison.d.ts +4 -2
- package/dist/report/react/ExperimentComparison.js +5 -4
- package/dist/report/react/ExperimentList.d.ts +3 -3
- package/dist/report/react/ExperimentList.js +16 -15
- package/dist/report/react/MetricBars.js +5 -4
- package/dist/report/react/MetricLine.js +12 -5
- package/dist/report/react/MetricMatrix.js +1 -1
- package/dist/report/react/MetricScatter.js +54 -17
- package/dist/report/react/MetricTable.js +2 -12
- package/dist/report/react/ScopeSummary.d.ts +10 -0
- package/dist/report/react/ScopeSummary.js +17 -0
- package/dist/report/react/Scoreboard.js +6 -6
- package/dist/report/react/cell.js +2 -2
- package/dist/report/react/fixtures.d.ts +5 -9
- package/dist/report/react/fixtures.js +105 -149
- package/dist/report/react/index.d.ts +15 -5
- package/dist/report/react/index.js +18 -7
- package/dist/report/report.d.ts +137 -20
- package/dist/report/report.js +261 -34
- package/dist/report/text/faces.d.ts +17 -19
- package/dist/report/text/faces.js +225 -157
- package/dist/report/text/plot.js +1 -1
- package/dist/report/text/table.js +2 -2
- package/dist/report/tree.d.ts +90 -40
- package/dist/report/tree.js +252 -94
- package/dist/report/types.d.ts +245 -300
- package/dist/report/types.js +4 -3
- package/dist/report/web.d.ts +21 -5
- package/dist/report/web.js +42 -16
- package/dist/results/select.d.ts +38 -16
- package/dist/results/select.js +73 -25
- package/dist/results/types.d.ts +38 -14
- package/dist/shared/aggregate.d.ts +3 -2
- package/dist/shared/aggregate.js +5 -4
- package/docs-site/zh/README.md +44 -0
- package/docs-site/zh/examples/ai-agent-application.mdx +63 -0
- package/docs-site/zh/examples/coding-agent-extensions.mdx +57 -0
- package/docs-site/zh/examples/index.mdx +50 -0
- package/docs-site/zh/{concepts → explanation}/adapter.mdx +11 -11
- package/docs-site/zh/{concepts → explanation}/assert.mdx +7 -7
- package/docs-site/zh/{concepts → explanation}/drive.mdx +8 -8
- package/docs-site/zh/{concepts → explanation}/evals.mdx +4 -4
- package/docs-site/zh/{concepts → explanation}/experiment.mdx +8 -8
- package/docs-site/zh/{concepts → explanation}/hitl.mdx +8 -8
- package/docs-site/zh/{concepts → explanation}/judge.mdx +5 -5
- package/docs-site/zh/{concepts → explanation}/overview.mdx +5 -5
- package/docs-site/zh/{guides → explanation}/runner.mdx +1 -1
- package/docs-site/zh/{concepts → explanation}/tier.mdx +6 -6
- package/docs-site/zh/{guides → how-to}/agent-feedback-loop.mdx +7 -7
- package/docs-site/zh/{guides → how-to}/authoring.mdx +2 -2
- package/docs-site/zh/{guides → how-to}/connect-otel.mdx +6 -6
- package/docs-site/zh/{guides → how-to}/connect-your-agent.mdx +18 -18
- package/docs-site/zh/{guides → how-to}/custom-reports.mdx +6 -6
- package/docs-site/zh/{guides → how-to}/experiments.mdx +3 -3
- package/docs-site/zh/{guides → how-to}/publish-report.mdx +2 -2
- package/docs-site/zh/{guides → how-to}/sandbox-agent.mdx +2 -2
- package/docs-site/zh/{guides → how-to}/sandbox-providers.mdx +1 -1
- package/docs-site/zh/{guides → how-to}/viewing-results.mdx +6 -6
- package/docs-site/zh/{guides → how-to}/write-experiment.mdx +3 -3
- package/docs-site/zh/{guides → how-to}/write-send.mdx +13 -13
- package/docs-site/zh/index.mdx +23 -25
- package/docs-site/zh/introduction.mdx +8 -8
- package/docs-site/zh/reference/builtin-agents.mdx +5 -5
- package/docs-site/zh/reference/capabilities.mdx +6 -6
- package/docs-site/zh/reference/cli.mdx +9 -7
- package/docs-site/zh/reference/define-agent.mdx +1 -1
- package/docs-site/zh/reference/events.mdx +3 -3
- package/docs-site/zh/{guides → reference}/official-adapters.mdx +7 -7
- package/docs-site/zh/{guides → reference}/report-components.mdx +5 -5
- package/docs-site/zh/{guides → reference}/results-data.mdx +5 -5
- package/docs-site/zh/{guides → troubleshooting}/debug-sandbox.mdx +2 -2
- package/docs-site/zh/{guides → troubleshooting}/debugging.mdx +4 -2
- package/docs-site/zh/{quickstart.mdx → tutorials/quickstart.mdx} +5 -17
- package/package.json +6 -2
- package/src/agents/index.ts +2 -2
- package/src/agents/openai-compat.ts +1 -1
- package/src/agents/streaming.ts +2 -2
- package/src/agents/types.ts +3 -3
- package/src/cli.ts +42 -23
- package/src/context/context.ts +1 -1
- package/src/context/session.test.ts +1 -1
- package/src/context/session.ts +1 -1
- package/src/i18n/en.ts +18 -16
- package/src/i18n/zh-CN.ts +16 -15
- package/src/report/aggregate.ts +175 -87
- package/src/report/built-in/index.tsx +9 -0
- package/src/report/components.tsx +625 -285
- package/src/report/compute.ts +717 -515
- package/src/report/dual-render.test.tsx +738 -1148
- package/src/report/flag.ts +97 -33
- package/src/report/format.ts +18 -22
- package/src/report/index.ts +113 -58
- package/src/report/load.ts +3 -2
- package/src/report/locale.ts +120 -69
- package/src/report/metrics.ts +42 -12
- package/src/report/primitives.tsx +190 -45
- package/src/report/react/AttemptList.tsx +32 -20
- package/src/report/react/DeltaTable.tsx +63 -45
- package/src/report/react/EvalList.tsx +0 -0
- package/src/report/react/ExperimentComparison.tsx +12 -7
- package/src/report/react/ExperimentList.tsx +38 -26
- package/src/report/react/MetricBars.tsx +5 -4
- package/src/report/react/MetricLine.tsx +13 -8
- package/src/report/react/MetricMatrix.tsx +2 -2
- package/src/report/react/MetricScatter.tsx +74 -20
- package/src/report/react/MetricTable.tsx +4 -76
- package/src/report/react/ScopeSummary.tsx +86 -0
- package/src/report/react/Scoreboard.tsx +28 -10
- package/src/report/react/cell.tsx +2 -2
- package/src/report/react/enhance.js +57 -5
- package/src/report/react/fixtures.ts +109 -156
- package/src/report/react/index.tsx +24 -39
- package/src/report/react/render.test.tsx +139 -104
- package/src/report/react/styles.css +181 -91
- package/src/report/report.test.ts +761 -1031
- package/src/report/report.ts +425 -47
- package/src/report/text/faces.ts +257 -164
- package/src/report/text/plot.ts +1 -1
- package/src/report/text/table.ts +2 -2
- package/src/report/tree.ts +362 -104
- package/src/report/types.ts +257 -287
- package/src/report/web.ts +63 -20
- package/src/results/attempt-evidence.test.ts +4 -4
- package/src/results/attempt-evidence.ts +5 -5
- package/src/results/copy.ts +6 -6
- package/src/results/host-equivalence.test.ts +26 -14
- package/src/results/index.ts +10 -4
- package/src/results/open.ts +8 -4
- package/src/results/results.test.ts +4 -3
- package/src/results/select.ts +104 -34
- package/src/results/types.ts +36 -14
- package/src/runner/feedback/human.test.ts +1 -1
- package/src/runner/run.ts +1 -1
- package/src/sandbox/cli-commands.ts +2 -2
- package/src/scoring/judge.test.ts +1 -1
- package/src/shared/aggregate.ts +5 -4
- package/src/show/compose.ts +50 -67
- package/src/show/index.ts +107 -56
- package/src/show/render.ts +43 -27
- package/src/show/report-host.test.ts +188 -0
- package/src/show/report-host.ts +375 -0
- package/src/show/show.test.ts +86 -36
- package/src/view/app/App.test.tsx +69 -0
- package/src/view/app/App.tsx +144 -48
- package/src/view/app/components/AttemptModal.tsx +324 -63
- package/src/view/app/components/CodeView.tsx +10 -4
- package/src/view/app/i18n.ts +31 -17
- package/src/view/app/main.tsx +13 -8
- package/src/view/app/pages/{RunsPage.tsx → AttemptsPage.tsx} +6 -6
- package/src/view/app/types.ts +4 -1
- package/src/view/client-dist/app.css +1 -1
- package/src/view/client-dist/app.js +14 -14
- package/src/view/data.test.ts +9 -3
- package/src/view/data.ts +145 -49
- package/src/view/index.ts +48 -44
- package/src/view/server.ts +35 -15
- package/src/view/shared/types.ts +34 -5
- package/src/view/styles.css +224 -0
- package/src/view/view-report.test.ts +161 -57
- package/dist/report/built-ins/experiment-comparison.d.ts +0 -39
- package/dist/report/built-ins/experiment-comparison.js +0 -119
- package/dist/report/built-ins/index.d.ts +0 -2
- package/dist/report/built-ins/index.js +0 -2
- package/dist/report/react/GroupSummary.d.ts +0 -8
- package/dist/report/react/GroupSummary.js +0 -8
- package/dist/report/react/RunOverview.d.ts +0 -8
- package/dist/report/react/RunOverview.js +0 -12
- package/docs-site/zh/example/ai-agent-application.mdx +0 -152
- package/docs-site/zh/example/claude-code-codex-plugin.mdx +0 -167
- package/docs-site/zh/example/claude-code-codex-skill.mdx +0 -152
- package/docs-site/zh/example/showcase.mdx +0 -39
- package/src/report/built-in-user-parity.test.tsx +0 -597
- package/src/report/built-ins/experiment-comparison.tsx +0 -179
- package/src/report/built-ins/index.ts +0 -7
- package/src/report/react/GroupSummary.tsx +0 -66
- package/src/report/react/RunOverview.tsx +0 -109
- /package/docs-site/zh/{example/tier1-ai-sdk-v7.mdx → examples/integrations/ai-sdk-v7.mdx} +0 -0
- /package/docs-site/zh/{example/tier1-claude-sdk.mdx → examples/integrations/claude-sdk.mdx} +0 -0
- /package/docs-site/zh/{example/tier1-codex-sdk.mdx → examples/integrations/codex-sdk.mdx} +0 -0
- /package/docs-site/zh/{example/tier1-langgraph.mdx → examples/integrations/langgraph.mdx} +0 -0
- /package/docs-site/zh/{example/tier1-pi-sdk.mdx → examples/integrations/pi-sdk.mdx} +0 -0
- /package/docs-site/zh/{guides → how-to}/ci-integration.mdx +0 -0
- /package/docs-site/zh/{guides → how-to}/dataset-fanout.mdx +0 -0
- /package/docs-site/zh/{guides → how-to}/fixtures.mdx +0 -0
- /package/docs-site/zh/{guides → how-to}/reporters.mdx +0 -0
- /package/docs-site/zh/{guides → how-to}/scoring-guide.mdx +0 -0
package/dist/report/text/plot.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// text 面的字符坐标图:MetricScatter / MetricLine 共用。
|
|
2
|
-
// 形态照 docs-site/zh/
|
|
2
|
+
// 形态照 docs-site/zh/reference/report-components.mdx 的示例块:y 轴刻度 + │ 边框,
|
|
3
3
|
// 点用字母标注、图例列在图下;lower-better 的轴反向,「好」的角落恒在右上。
|
|
4
4
|
import { padDisplay, padStartDisplay, stringWidth } from "./layout.js";
|
|
5
5
|
function makeScale(values, cells, invert) {
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
//
|
|
6
6
|
// 列宽按显示宽度算(CJK 记 2 列);null 渲染 —,不补 0;超宽先折最宽的左对齐列,
|
|
7
7
|
// 压到下限仍放不下就从右侧丢列并如实报数(「截断报剩余」是既有契约,不在这里破例)。
|
|
8
|
-
import { countText, localeText } from "../locale.js";
|
|
8
|
+
import { countText, localeText, resolveLocalizedText } from "../locale.js";
|
|
9
9
|
import { charDisplayWidth, renderAlignedRows, stringWidth, wrapDisplay } from "./layout.js";
|
|
10
10
|
const MISSING_MARK = "—";
|
|
11
11
|
/** 列间距,与 renderAlignedRows 的 join(" ") 一致。 */
|
|
@@ -93,7 +93,7 @@ export function renderTableText(props, ctx) {
|
|
|
93
93
|
const hasLocator = props.rows.some((row) => row.locator !== undefined);
|
|
94
94
|
if (props.columns.length === 0 && !hasLocator)
|
|
95
95
|
return "";
|
|
96
|
-
const header = props.columns.map((column) => column.header);
|
|
96
|
+
const header = props.columns.map((column) => resolveLocalizedText(column.header, locale));
|
|
97
97
|
const align = props.columns.map((column) => column.align ?? "left");
|
|
98
98
|
const body = props.rows.map((row) => props.columns.map((column) => cellText(row, column.key)));
|
|
99
99
|
if (hasLocator) {
|
package/dist/report/tree.d.ts
CHANGED
|
@@ -1,16 +1,32 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
2
|
import type { AttemptLocator } from "../results/locator.ts";
|
|
3
|
+
import type { Results, Scope } from "../results/types.ts";
|
|
3
4
|
import { type ReportLocale } from "./locale.ts";
|
|
5
|
+
import type { ReportInput } from "./types.ts";
|
|
6
|
+
import type { ReportMeta } from "./report.ts";
|
|
4
7
|
/** 标准 jsx-runtime 元素形状;text 宿主只认 type / props,不管 $$typeof。 */
|
|
5
8
|
export interface ReportElement {
|
|
6
9
|
type: unknown;
|
|
7
10
|
props: Record<string, unknown>;
|
|
8
11
|
key?: unknown;
|
|
9
12
|
}
|
|
10
|
-
/**
|
|
11
|
-
|
|
12
|
-
|
|
13
|
+
/**
|
|
14
|
+
* 报告树节点,形状穷尽(docs/feature/reports/library/layout.md「树的节点」):
|
|
15
|
+
* 元素、数组 / Fragment(展平保序),或条件渲染的空分支(渲染为空)。
|
|
16
|
+
* 裸字符串与数字**不是**节点——自由文本必须经 <Text> 携带,树校验遇到时按完整用户反馈拒绝。
|
|
17
|
+
*/
|
|
18
|
+
export type ReportNode = ReportElement | readonly ReportNode[] | null | undefined | boolean;
|
|
19
|
+
/** 挂 faces 的私有键:管线与树校验靠它识别双面组件。 */
|
|
13
20
|
export declare const COMPONENT_FACES: unique symbol;
|
|
21
|
+
/** 挂组合函数的私有键:resolve 阶段靠它识别组合组件。 */
|
|
22
|
+
export declare const COMPONENT_COMPOSE: unique symbol;
|
|
23
|
+
/** Tabs / Tab 的结构角色标记:树校验的配对规则靠它,不 import primitives(避免环)。 */
|
|
24
|
+
export declare const COMPONENT_ROLE: unique symbol;
|
|
25
|
+
/**
|
|
26
|
+
* children 是不透明值(自由文本 / CSS 字符串)而非报告树的组件标记(Text / Style):
|
|
27
|
+
* resolve 与 validate 不下钻它们的 children——那是组件自己的 props,不是树。
|
|
28
|
+
*/
|
|
29
|
+
export declare const COMPONENT_RAW_CHILDREN: unique symbol;
|
|
14
30
|
export interface TextContext {
|
|
15
31
|
/** 可用列宽;Row 分栏后变窄。 */
|
|
16
32
|
width: number;
|
|
@@ -20,6 +36,11 @@ export interface TextContext {
|
|
|
20
36
|
render(node: ReportNode, width?: number): string;
|
|
21
37
|
/** 下钻命令,通证据室:`niceeval show @<locator>`。 */
|
|
22
38
|
attemptCommand(locator: AttemptLocator): string;
|
|
39
|
+
/**
|
|
40
|
+
* 组索引一类「按实验收窄」命令的生成;宿主注入以携带完整上下文(--results / --report /
|
|
41
|
+
* --page 与位置参数),默认 `niceeval show --experiment <id>`。非契约字段,官方组件内部用。
|
|
42
|
+
*/
|
|
43
|
+
experimentCommand(experimentIdPrefix: string): string;
|
|
23
44
|
}
|
|
24
45
|
export interface WebContext {
|
|
25
46
|
/** 证据室深链,同 view 的 attempt 路由(`#/attempt/@<locator>`,单段、不透明)。 */
|
|
@@ -27,73 +48,102 @@ export interface WebContext {
|
|
|
27
48
|
/** chrome 文案的 locale;官方组件渲染面经上下文读取,宿主外默认 "en"。 */
|
|
28
49
|
locale: ReportLocale;
|
|
29
50
|
}
|
|
51
|
+
/** 双面组件解析面的上下文:宿主注入的数据来源;props 显式给出 input 时以 props 为准。 */
|
|
52
|
+
export interface ResolveContext {
|
|
53
|
+
input: ReportInput;
|
|
54
|
+
}
|
|
55
|
+
/** 组合组件的上下文:宿主 Scope、结果根完整读取面与规范化后的报告声明。 */
|
|
56
|
+
export interface ComposeContext {
|
|
57
|
+
/** 宿主注入的 Scope。 */
|
|
58
|
+
scope: Scope;
|
|
59
|
+
/** 结果根完整读取面;历史视图从这里自行挑 Snapshot[]。 */
|
|
60
|
+
results: Results;
|
|
61
|
+
/** 规范化后的报告声明,只读(docs/feature/reports/library/layout.md「自定义组件」)。 */
|
|
62
|
+
report: ReportMeta;
|
|
63
|
+
}
|
|
30
64
|
export interface ComponentFaces<P, R = P> {
|
|
31
65
|
/**
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
* 不实现 resolve 时 R = P,组件被当作纯数据组件直接渲染。
|
|
66
|
+
* 组件唯一的异步 / IO 面:把作者写下的 props 规范化成渲染 props(R)。宿主管线在
|
|
67
|
+
* resolve 阶段调用它,按「同引用 input + 深相等 spec」在一次页渲染内记忆化;
|
|
68
|
+
* 渲染面(web / text)只看已解析的 R,保持同步、零 IO。不实现 resolve 时 R = P。
|
|
36
69
|
*/
|
|
37
|
-
resolve?(props: P): Promise<R>;
|
|
70
|
+
resolve?(props: P, context: ResolveContext): R | Promise<R>;
|
|
38
71
|
/** 真 React JSX 在这个面里;返回静态可渲染的 ReactNode。只看已解析的 R。 */
|
|
39
72
|
web(props: R, ctx: WebContext): ReactNode;
|
|
40
73
|
text(props: R, ctx: TextContext): string;
|
|
41
74
|
}
|
|
42
75
|
/**
|
|
43
|
-
*
|
|
44
|
-
*
|
|
76
|
+
* 报告组件的产物:可直接用于 JSX。双面组件当普通 React 组件调用时走 web 面(只接受
|
|
77
|
+
* 数据形态 props);组合组件只在报告管线内展开,宿主外直接渲染报错。R 在存储边界抹成 any——
|
|
45
78
|
* 树遍历只按 ComponentFaces 的结构调用 resolve / web / text,不需要在类型层追踪 R。
|
|
46
79
|
*/
|
|
47
80
|
export type ReportComponent<P> = ((props: P) => ReactNode) & {
|
|
48
|
-
[COMPONENT_FACES]
|
|
81
|
+
[COMPONENT_FACES]?: ComponentFaces<P, any>;
|
|
82
|
+
[COMPONENT_COMPOSE]?: (props: P, ctx: ComposeContext) => ReportNode | Promise<ReportNode>;
|
|
83
|
+
[COMPONENT_ROLE]?: "tabs" | "tab";
|
|
84
|
+
[COMPONENT_RAW_CHILDREN]?: true;
|
|
49
85
|
displayName?: string;
|
|
50
86
|
};
|
|
51
87
|
/** web 宿主用:在给定 WebContext 下同步渲染(React 静态渲染本身是同步的)。 */
|
|
52
88
|
export declare function runWithWebContext<T>(ctx: WebContext, fn: () => T): T;
|
|
53
89
|
/** 官方组件的装配用:宿主上下文激活时才把 ctx.attemptHref 当默认下钻。 */
|
|
54
90
|
export declare function isHostWebContextActive(): boolean;
|
|
55
|
-
/**
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
*/
|
|
91
|
+
/** 函数形态:组合组件,只装配已有组件,可以异步;ctx 携带 scope / results / report。 */
|
|
92
|
+
export declare function defineComponent<P>(compose: (props: P, context: ComposeContext) => ReportNode | Promise<ReportNode>): ReportComponent<P>;
|
|
93
|
+
/** 对象形态:双面组件,自己渲染;text 与 web 两面必填,可选 resolve 承担取数。 */
|
|
59
94
|
export declare function defineComponent<P, R = P>(faces: ComponentFaces<P, R>): ReportComponent<P>;
|
|
60
95
|
export declare function facesOf(type: unknown): ComponentFaces<unknown> | undefined;
|
|
96
|
+
export declare function composeOf(type: unknown): ((props: unknown, ctx: ComposeContext) => ReportNode | Promise<ReportNode>) | undefined;
|
|
97
|
+
/**
|
|
98
|
+
* resolve 记忆化的深相等:只递归比较可序列化值(普通对象 / 数组 / 原始值);
|
|
99
|
+
* 函数与 Metric / Dimension / NumericAxis 一类携带函数的实例按引用比较——
|
|
100
|
+
* 共享计算的成立条件是引用同一实例,引用不同的等价定义只是各算一次,不构成错误。
|
|
101
|
+
*/
|
|
102
|
+
export declare function deepEqualSpec(a: unknown, b: unknown): boolean;
|
|
103
|
+
/** 一次页渲染内的记忆化缓存:键 = 计算函数引用 → (同引用 input + 深相等 spec) 命中。 */
|
|
104
|
+
export declare class ResolveMemo {
|
|
105
|
+
private readonly entries;
|
|
106
|
+
fetch(fn: unknown, input: unknown, spec: unknown, compute: () => Promise<unknown>): Promise<unknown>;
|
|
107
|
+
}
|
|
108
|
+
/** resolveReportTree 的环境:宿主注入的 Scope / 读取面 / 规范化声明。 */
|
|
109
|
+
export interface ResolveEnv {
|
|
110
|
+
scope: Scope;
|
|
111
|
+
results: Results;
|
|
112
|
+
report: ReportMeta;
|
|
113
|
+
/** 一次页渲染一份;跨页共享缓存时由宿主显式传同一实例。 */
|
|
114
|
+
memo?: ResolveMemo;
|
|
115
|
+
}
|
|
116
|
+
/** 官方 spec 组件在 resolve 内取数的记忆化入口;经内部扩展的 ResolveContext 传递。 */
|
|
117
|
+
export interface InternalResolveContext extends ResolveContext {
|
|
118
|
+
/** 按 (计算函数引用, 同引用 input, 深相等 options) 记忆化地调用计算函数。 */
|
|
119
|
+
memoFetch<T>(dataFn: unknown, input: unknown, options: unknown, compute: () => Promise<T>): Promise<T>;
|
|
120
|
+
}
|
|
121
|
+
/** 组件 resolve 里安全取记忆化入口:经宿主管线时在场,手工直调 resolve 时退化为直接计算。 */
|
|
122
|
+
export declare function memoFetchOf(ctx: ResolveContext): InternalResolveContext["memoFetch"];
|
|
61
123
|
/**
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
* await 的组件级步骤,连同报告函数体自己的 `build()`),两个渲染面
|
|
67
|
-
* 之后都只看已解析的树、保持同步零 IO。遍历形状与 {@link validateReportTree} /
|
|
68
|
-
* {@link renderNodeToText} 一致:
|
|
69
|
-
*
|
|
70
|
-
* - 同层数组兄弟并行解析(`Promise.all`),保持原始顺序 / keys;
|
|
71
|
-
* - 双面组件带 resolve 的:调 `faces.resolve(props)` 换 props(有 children 再递归解析);
|
|
72
|
-
* - 双面组件无 resolve 的(Row / Col / Section / RunOverview…):只递归 children,自身 props
|
|
73
|
-
* 原样保留(title / className 等不能动);
|
|
74
|
-
* - 普通函数组件:同步调用展开,展开结果继续解析(与 validate / render 对函数组件的处理一致);
|
|
75
|
-
* - 字符串 intrinsic(<div>):原样返回,交给随后的 validateReportTree 报同一条错误。
|
|
76
|
-
*
|
|
77
|
-
* resolver 跑完后,树里已没有函数组件 / 未解析 props;validate / render 里对这两者的分支在
|
|
78
|
-
* 正常管线下是 no-op,但保留着——手搭树直接调 validate / render(不过 resolver)的低层用法仍需要。
|
|
124
|
+
* 管线的 resolve 阶段:递归展开组合组件(以 (props, ctx) 调用并 await 返回树)、执行双面
|
|
125
|
+
* 组件的解析面;同层 sibling 并行取数且不改变节点顺序;带 resolve 的组件按「同引用 input +
|
|
126
|
+
* 深相等 spec」记忆化。非法节点(React 组件、未经 defineComponent 的普通函数、任意 HTML
|
|
127
|
+
* intrinsic)在展开遇到时立即以完整用户反馈拒绝,不为非法节点取数。
|
|
79
128
|
*/
|
|
80
|
-
export declare function resolveReportTree(node: ReportNode): Promise<ReportNode>;
|
|
129
|
+
export declare function resolveReportTree(node: ReportNode, env: ResolveEnv): Promise<ReportNode>;
|
|
81
130
|
/**
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
* 普通函数组件调用展开(渲染面纯同步,重复调用无副作用)。
|
|
131
|
+
* 管线的 validate 阶段:确保展开后树中每个组件都有 text 和 web 两面。校验只看节点资格,
|
|
132
|
+
* 不限定树形:根节点可以是单个组件、Col 或 Tabs,宿主不强制任何最外层容器。
|
|
133
|
+
* 裸字符串 / 数字、HTML intrinsic、无两面资格的函数都以完整用户反馈拒绝;
|
|
134
|
+
* Tabs / Tab 的结构配对(空 Tabs、游离 Tab、非 Tab 直接子节点)也在这里校验。
|
|
87
135
|
*/
|
|
88
|
-
export declare function validateReportTree(node: ReportNode, path?: string[]): void;
|
|
136
|
+
export declare function validateReportTree(node: ReportNode, path?: string[], insideTabs?: boolean): void;
|
|
89
137
|
export interface TextRenderOptions {
|
|
90
138
|
/** 终端可用列宽;默认 80。 */
|
|
91
139
|
width?: number;
|
|
92
140
|
/** 下钻命令的生成;宿主注入,默认 `niceeval show @<locator>`(真实可跑的 CLI 语法)。 */
|
|
93
141
|
attemptCommand?: (locator: AttemptLocator) => string;
|
|
142
|
+
/** 组索引命令的生成;宿主注入以携带 --results / --report / --page 等上下文。 */
|
|
143
|
+
experimentCommand?: (experimentIdPrefix: string) => string;
|
|
94
144
|
/** chrome 文案的 locale;默认 "en"(`niceeval show` 现有输出不变)。 */
|
|
95
145
|
locale?: ReportLocale;
|
|
96
146
|
}
|
|
97
147
|
export declare function createTextContext(options?: TextRenderOptions): TextContext;
|
|
98
|
-
/** text 宿主的遍历渲染:双面组件走 text
|
|
148
|
+
/** text 宿主的遍历渲染:双面组件走 text 面,块之间以换行相接。只吃已 resolve + validate 的树。 */
|
|
99
149
|
export declare function renderNodeToText(node: ReportNode, ctx: TextContext): string;
|