@nexface/evals 0.1.21-alpha.7 → 0.1.22
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/README.md +4 -2
- package/generated.mjs +11 -4
- package/native-tools.mjs +30 -19
- package/package.json +7 -6
- package/report-output.mjs +6 -1
- package/runner.mjs +18 -8
- package/site-run.mjs +45 -57
- package/studio.html +31 -8
- package/task-session.mjs +1 -7
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# 在项目中评测 Nexface 工具
|
|
1
|
+
# 在项目中评测 Nexface 或原生 WebMCP 工具
|
|
2
2
|
|
|
3
3
|
[CLI 快速使用](CLI.md) · 首次编写、选跑任务和查看结果。
|
|
4
4
|
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
新任务的起始条件和业务结果填写自然语言预期。写 spec 时可用 before 或同 ID 的 checks 回调调用只读工具验收,省略回调时由模型检查页面。明确要求页面展示或最终回复时,分别使用 page 或 reply 条件。同一个任务可组合三种方式。需要 spec 时,从 `@nexface/evals/playwright` 导入 `defineChecks`。[接口和编写示例](../../docs/nexface-evaluation-api.md)
|
|
13
13
|
|
|
14
|
-
评测使用 Playwright 1.65.1 的 Chromium。在业务子仓库安装同版本的 `@playwright/test`,首次运行前执行 `pnpm exec playwright install chromium`。可用 `NEXFACE_BROWSER_PATH` 指定 Chromium
|
|
14
|
+
评测使用 Playwright 1.65.1 的 Chromium。在业务子仓库安装同版本的 `@playwright/test`,首次运行前执行 `pnpm exec playwright install chromium`。可用 `NEXFACE_BROWSER_PATH` 指定 Chromium 可执行文件,或用 `NEXFACE_BROWSER_CHANNEL` 选择已安装的浏览器渠道。
|
|
15
15
|
|
|
16
16
|
| 变量 | 用法 |
|
|
17
17
|
| --- | --- |
|
|
@@ -23,6 +23,8 @@
|
|
|
23
23
|
| NEXFACE_JUDGE_URL | 可选,默认使用执行模型地址。独立评分地址使用 Chat Completions,需同时指定评分模型名 |
|
|
24
24
|
| NEXFACE_JUDGE_MODEL | 可选,在执行模型地址评分时默认使用执行模型名 |
|
|
25
25
|
| NEXFACE_JUDGE_KEY | 可选,同一地址默认复用执行密钥,其他地址单独提供 |
|
|
26
|
+
| NEXFACE_STUDIO_PORT | 可选,指定本地 Studio 服务端口 |
|
|
27
|
+
| NEXFACE_NO_OPEN | 设为 `1` 时,启动 Studio 后手动打开终端显示的地址 |
|
|
26
28
|
| NEXFACE_STATE_DIR | 本机私有状态目录,默认用户目录下的 .nexface-evals。每次运行独立保存报告;CI 可收集 runs 目录。auth 文件含会话凭据,仅限本机使用。 |
|
|
27
29
|
|
|
28
30
|
站点按平时的方式运行。业务页面可以直接注册原生 WebMCP 工具,也可通过 Nexface 的 `ToolsProvider` 发布(默认开启 `webMcp`)。CLI 启动独立浏览器会话,由本地 Nexface Agent 调用页面发布的业务工具;模型凭据保存在 CLI 环境中。若页面关闭工具发布,CLI 会报告启动阻塞。
|
package/generated.mjs
CHANGED
|
@@ -10,16 +10,23 @@ function requiresToolChecks(task) {
|
|
|
10
10
|
return task.start?.condition?.check === "tool" || task.criteria.some((c) => c.check === "tool");
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
+
export class MissingSpec extends Error {
|
|
14
|
+
constructor(path) {
|
|
15
|
+
super("Missing spec: " + path);
|
|
16
|
+
this.path = path;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
13
20
|
export async function taskAssets(root, task) {
|
|
14
|
-
const path = join(
|
|
21
|
+
const path = join(".nexface/tests", task.id + ".spec.ts");
|
|
15
22
|
try {
|
|
16
|
-
await access(path);
|
|
23
|
+
await access(join(root, path));
|
|
17
24
|
} catch (error) {
|
|
18
25
|
if (error.code !== "ENOENT") throw error;
|
|
19
|
-
if (requiresToolChecks(task)) throw new
|
|
26
|
+
if (requiresToolChecks(task)) throw new MissingSpec(path);
|
|
20
27
|
// A registered setup must not disappear silently.
|
|
21
28
|
const records = await readJson(manifestPath(root), {});
|
|
22
|
-
if (Object.hasOwn(records, task.id)) throw new
|
|
29
|
+
if (Object.hasOwn(records, task.id)) throw new MissingSpec(path);
|
|
23
30
|
return null;
|
|
24
31
|
}
|
|
25
32
|
try {
|
package/native-tools.mjs
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import Ajv from "ajv";
|
|
2
2
|
import Ajv2019 from "ajv/dist/2019.js";
|
|
3
3
|
import Ajv2020 from "ajv/dist/2020.js";
|
|
4
|
-
import {
|
|
4
|
+
import { errors } from "playwright-core";
|
|
5
|
+
import { safeJson } from "./report-output.mjs";
|
|
6
|
+
import { ConfirmationBlocked, UnknownToolOutcome } from "./site-run.mjs";
|
|
5
7
|
|
|
6
8
|
const options = { strict: false, addUsedSchema: false };
|
|
7
9
|
const draft7 = new Ajv(options);
|
|
8
10
|
const draft2019 = new Ajv2019(options);
|
|
9
11
|
const draft2020 = new Ajv2020(options);
|
|
10
12
|
|
|
11
|
-
function validatorFor(schema
|
|
13
|
+
function validatorFor(schema) {
|
|
12
14
|
switch (schema.$schema?.replace(/#$/, "")) {
|
|
13
|
-
case undefined:
|
|
14
|
-
return nexface ? draft7 : draft2020;
|
|
15
15
|
case "http://json-schema.org/draft-07/schema":
|
|
16
16
|
return draft7;
|
|
17
17
|
case "https://json-schema.org/draft/2019-09/schema":
|
|
18
18
|
return draft2019;
|
|
19
|
+
case undefined:
|
|
19
20
|
case "https://json-schema.org/draft/2020-12/schema":
|
|
20
21
|
return draft2020;
|
|
21
22
|
default:
|
|
@@ -26,6 +27,7 @@ export class CheckConfigurationError extends Error {}
|
|
|
26
27
|
|
|
27
28
|
export function siteConnection(page, origin, row) {
|
|
28
29
|
const callTool = page.webmcp.callTool.bind(page.webmcp);
|
|
30
|
+
let unknownOutcome;
|
|
29
31
|
async function list() {
|
|
30
32
|
if (new URL(page.url()).origin !== origin) throw new Error("Unexpected tool origin.");
|
|
31
33
|
return (await page.webmcp.tools({ timeout: 5000 })).filter(
|
|
@@ -61,13 +63,10 @@ export function siteConnection(page, origin, row) {
|
|
|
61
63
|
}
|
|
62
64
|
if (!tool) throw new Error("Tool unavailable on this page: " + name);
|
|
63
65
|
const schema = tool.inputSchema ?? { type: "object" };
|
|
64
|
-
const
|
|
65
|
-
const readOnly = metadata ? metadata.effect === "read" : tool.annotations?.readOnly === true;
|
|
66
|
+
const readOnly = tool.annotations?.readOnly === true;
|
|
66
67
|
if (effect === "read" && !readOnly)
|
|
67
68
|
throw new CheckConfigurationError("Check requires a read-only tool: " + name);
|
|
68
|
-
|
|
69
|
-
throw new CheckConfigurationError("Expected a navigation tool: " + name);
|
|
70
|
-
const validator = validatorFor(schema, metadata);
|
|
69
|
+
const validator = validatorFor(schema);
|
|
71
70
|
const valid = validator.compile(schema);
|
|
72
71
|
if (!valid(args))
|
|
73
72
|
throw new CheckConfigurationError(
|
|
@@ -83,8 +82,22 @@ export function siteConnection(page, origin, row) {
|
|
|
83
82
|
);
|
|
84
83
|
call.path = new URL(page.url()).pathname;
|
|
85
84
|
signal?.throwIfAborted();
|
|
85
|
+
if (unknownOutcome) throw unknownOutcome;
|
|
86
86
|
call.status = "running";
|
|
87
|
-
|
|
87
|
+
let result;
|
|
88
|
+
try {
|
|
89
|
+
result = await callTool(name, args, { timeout: 15000, ...options });
|
|
90
|
+
} catch (error) {
|
|
91
|
+
if (!readOnly && error instanceof errors.TimeoutError) {
|
|
92
|
+
call.status = "outcome-unknown";
|
|
93
|
+
unknownOutcome = new UnknownToolOutcome(
|
|
94
|
+
`Timed out waiting for ${name} after dispatch. The outcome is unknown.`,
|
|
95
|
+
{ cause: error },
|
|
96
|
+
);
|
|
97
|
+
throw unknownOutcome;
|
|
98
|
+
}
|
|
99
|
+
throw error;
|
|
100
|
+
}
|
|
88
101
|
if (result?.isError) {
|
|
89
102
|
const detail = Array.isArray(result.content)
|
|
90
103
|
? result.content
|
|
@@ -92,13 +105,10 @@ export function siteConnection(page, origin, row) {
|
|
|
92
105
|
.map((item) => item.text)
|
|
93
106
|
.join("\n")
|
|
94
107
|
: result.content;
|
|
95
|
-
if (
|
|
96
|
-
metadata?.version === 2 &&
|
|
97
|
-
result._meta?.["x-nexface-eval"] === "host-confirmation-required"
|
|
98
|
-
)
|
|
108
|
+
if (result._meta?.["x-nexface-eval"] === "host-confirmation-required")
|
|
99
109
|
throw new ConfirmationBlocked("User confirmation required: " + name);
|
|
100
110
|
throw new Error(
|
|
101
|
-
typeof detail === "string" && detail ? detail :
|
|
111
|
+
typeof detail === "string" && detail ? detail : safeJson(result.content ?? result),
|
|
102
112
|
);
|
|
103
113
|
}
|
|
104
114
|
call.result = result;
|
|
@@ -140,10 +150,11 @@ export function siteConnection(page, origin, row) {
|
|
|
140
150
|
});
|
|
141
151
|
},
|
|
142
152
|
async tools() {
|
|
143
|
-
return (await list()).map(({ name, description, inputSchema = { type: "object" } }) => {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
153
|
+
return (await list()).map(({ name, description, inputSchema = { type: "object" } }) => ({
|
|
154
|
+
name,
|
|
155
|
+
description,
|
|
156
|
+
inputSchema,
|
|
157
|
+
}));
|
|
147
158
|
},
|
|
148
159
|
};
|
|
149
160
|
}
|
package/package.json
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nexface/evals",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.22",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"nexface": "./cli.mjs"
|
|
7
7
|
},
|
|
8
|
-
"scripts": {
|
|
9
|
-
"test:browser": "node --test ../../test/evals/checks.mjs ../../test/evals/browser-check.mjs ../../test/evals/native-check.mjs"
|
|
10
|
-
},
|
|
11
8
|
"exports": {
|
|
12
9
|
"./playwright": {
|
|
13
10
|
"types": "./playwright.d.mts",
|
|
@@ -21,8 +18,8 @@
|
|
|
21
18
|
"playwright-core": "1.65.1"
|
|
22
19
|
},
|
|
23
20
|
"peerDependencies": {
|
|
24
|
-
"@nexface/agent": "0.1.
|
|
25
|
-
"@nexface/tools": "0.1.
|
|
21
|
+
"@nexface/agent": "0.1.22",
|
|
22
|
+
"@nexface/tools": "0.1.22"
|
|
26
23
|
},
|
|
27
24
|
"files": [
|
|
28
25
|
"CLI.md",
|
|
@@ -50,5 +47,9 @@
|
|
|
50
47
|
],
|
|
51
48
|
"engines": {
|
|
52
49
|
"node": ">=22.19.0"
|
|
50
|
+
},
|
|
51
|
+
"repository": {
|
|
52
|
+
"type": "git",
|
|
53
|
+
"url": "git+https://github.com/fishear/nexface.git"
|
|
53
54
|
}
|
|
54
55
|
}
|
package/report-output.mjs
CHANGED
|
@@ -115,7 +115,12 @@ export function formatReport(tasks, verbose = false) {
|
|
|
115
115
|
];
|
|
116
116
|
for (const [index, task] of tasks.entries()) {
|
|
117
117
|
if (index) lines.push("", "─".repeat(Math.min(process.stdout.columns || 76, 76)));
|
|
118
|
-
lines.push("", labels[task.status] + " " + task.id
|
|
118
|
+
lines.push("", labels[task.status] + " " + task.id);
|
|
119
|
+
if (task.missingSpec) {
|
|
120
|
+
lines.push(field("Missing spec", task.missingSpec));
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
lines.push(" " + task.goal);
|
|
119
124
|
if (task.failedStep) lines.push(field("Step", task.failedStep));
|
|
120
125
|
if (task.startCheck && ["failed", "unknown"].includes(task.startCheck.status)) {
|
|
121
126
|
const check = task.startCheck;
|
package/runner.mjs
CHANGED
|
@@ -5,9 +5,15 @@ import { mkdir } from "node:fs/promises";
|
|
|
5
5
|
import { basename, join } from "node:path";
|
|
6
6
|
import { validateSuite, readSuite } from "./suite.mjs";
|
|
7
7
|
import { launch, authenticate, privateDir, atomicJson } from "./session.mjs";
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
safeJson,
|
|
10
|
+
redactText,
|
|
11
|
+
summarizeTask,
|
|
12
|
+
formatReport,
|
|
13
|
+
rerunCommand,
|
|
14
|
+
} from "./report-output.mjs";
|
|
9
15
|
import { existsSync } from "node:fs";
|
|
10
|
-
import { taskAssets } from "./generated.mjs";
|
|
16
|
+
import { MissingSpec, taskAssets } from "./generated.mjs";
|
|
11
17
|
import { runSpecs } from "./spec-run.mjs";
|
|
12
18
|
|
|
13
19
|
export async function run(root, ids, verbose = false) {
|
|
@@ -81,6 +87,10 @@ export async function run(root, ids, verbose = false) {
|
|
|
81
87
|
const record = await taskAssets(root, task);
|
|
82
88
|
fingerprints[task.id] = record?.fingerprint ?? null;
|
|
83
89
|
} catch (error) {
|
|
90
|
+
if (error instanceof MissingSpec) {
|
|
91
|
+
report.tasks.push({ id: task.id, status: "blocked", missingSpec: error.path });
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
84
94
|
const row = {
|
|
85
95
|
id: task.id,
|
|
86
96
|
goal: task.goal,
|
|
@@ -132,7 +142,7 @@ export async function run(root, ids, verbose = false) {
|
|
|
132
142
|
}
|
|
133
143
|
}
|
|
134
144
|
for (const row of report.tasks) {
|
|
135
|
-
if (row.status !== "blocked" || row.checks.length) continue;
|
|
145
|
+
if (row.missingSpec || row.status !== "blocked" || row.checks.length) continue;
|
|
136
146
|
const task = tasks.find((task) => task.id === row.id);
|
|
137
147
|
row.checks = task.criteria.map((criterion) => ({
|
|
138
148
|
...criterion,
|
|
@@ -149,11 +159,11 @@ export async function run(root, ids, verbose = false) {
|
|
|
149
159
|
const dir = join(privateDir(root), "runs");
|
|
150
160
|
await mkdir(dir, { recursive: true, mode: 0o700 });
|
|
151
161
|
const file = join(dir, report.id + ".json");
|
|
152
|
-
|
|
153
|
-
await atomicJson(file,
|
|
154
|
-
console.log(formatReport(
|
|
155
|
-
console.log("\nJudge: " + (
|
|
156
|
-
for (const error of
|
|
162
|
+
const output = JSON.parse(safeJson(report));
|
|
163
|
+
await atomicJson(file, output);
|
|
164
|
+
console.log(formatReport(output.tasks, verbose));
|
|
165
|
+
console.log("\nJudge: " + (output.judge ?? "not used"));
|
|
166
|
+
for (const error of output.errors ?? []) console.error("Playwright: " + error);
|
|
157
167
|
console.log("\nRun report");
|
|
158
168
|
console.log(redactText(file));
|
|
159
169
|
return !report.errors?.length && report.tasks.every((t) => t.status === "passed") ? 0 : 1;
|
package/site-run.mjs
CHANGED
|
@@ -4,8 +4,8 @@ import { gatewayReason } from "./report-output.mjs";
|
|
|
4
4
|
import { createAgent } from "@nexface/agent";
|
|
5
5
|
import { createModelConfig as completionsModel } from "@nexface/agent/openai-completions";
|
|
6
6
|
import { createModelConfig as responsesModel } from "@nexface/agent/openai-responses";
|
|
7
|
-
import { createToolRuntime } from "@nexface/tools";
|
|
8
7
|
|
|
8
|
+
export class UnknownToolOutcome extends Error {}
|
|
9
9
|
export class ConfirmationBlocked extends Error {}
|
|
10
10
|
|
|
11
11
|
// Preserve valid business names and consistently escape names reserved by either protocol.
|
|
@@ -41,74 +41,60 @@ export async function runSiteAgent(goal, timeout, connection, signal) {
|
|
|
41
41
|
return response;
|
|
42
42
|
},
|
|
43
43
|
});
|
|
44
|
-
const runtime = createToolRuntime({ pageAutomation: false });
|
|
45
44
|
let blockedReason;
|
|
45
|
+
let unknownOutcome;
|
|
46
46
|
let timedOut = false;
|
|
47
|
-
|
|
47
|
+
let previousCatalog = new Map();
|
|
48
48
|
let step = 0;
|
|
49
|
-
|
|
49
|
+
|
|
50
|
+
async function getStepTools(stepSignal) {
|
|
50
51
|
stepSignal.throwIfAborted();
|
|
51
52
|
const definitions = await connection.tools();
|
|
53
|
+
const catalog = new Map();
|
|
52
54
|
const published = [];
|
|
53
|
-
const
|
|
54
|
-
step++;
|
|
55
|
-
const names = new Set(definitions.map((tool) => modelName(tool.name)));
|
|
56
|
-
for (const [name, binding] of bindings) {
|
|
57
|
-
if (!names.has(name)) {
|
|
58
|
-
removed.push(binding.siteName);
|
|
59
|
-
binding.remove();
|
|
60
|
-
bindings.delete(name);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
for (const definition of definitions) {
|
|
55
|
+
const tools = definitions.map((definition) => {
|
|
64
56
|
const name = modelName(definition.name);
|
|
65
57
|
const signature = JSON.stringify(definition);
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
if (timedOut) throw new Error("Task timed out.");
|
|
80
|
-
if (blockedReason) throw new Error(blockedReason);
|
|
81
|
-
try {
|
|
82
|
-
return await connection.execute(definition.name, input, "task", {
|
|
83
|
-
signal: callSignal,
|
|
84
|
-
});
|
|
85
|
-
} catch (error) {
|
|
86
|
-
if (error instanceof ConfirmationBlocked) {
|
|
87
|
-
blockedReason = error.message;
|
|
88
|
-
run.cancel();
|
|
89
|
-
}
|
|
90
|
-
throw error;
|
|
91
|
-
}
|
|
92
|
-
},
|
|
93
|
-
},
|
|
94
|
-
);
|
|
95
|
-
bindings.set(name, {
|
|
96
|
-
siteName: definition.name,
|
|
97
|
-
signature,
|
|
98
|
-
remove,
|
|
99
|
-
schema: definition.inputSchema,
|
|
100
|
-
});
|
|
101
|
-
published.push(name === definition.name ? definition : { ...definition, modelName: name });
|
|
102
|
-
}
|
|
58
|
+
catalog.set(definition.name, signature);
|
|
59
|
+
if (previousCatalog.get(definition.name) !== signature)
|
|
60
|
+
published.push(name === definition.name ? definition : { ...definition, modelName: name });
|
|
61
|
+
return {
|
|
62
|
+
name,
|
|
63
|
+
description: definition.description?.trim() || definition.name,
|
|
64
|
+
inputSchema: definition.inputSchema,
|
|
65
|
+
effect: "action",
|
|
66
|
+
execute: (input, callSignal) => execute(definition.name, input, callSignal),
|
|
67
|
+
};
|
|
68
|
+
});
|
|
69
|
+
const removed = [...previousCatalog.keys()].filter((name) => !catalog.has(name));
|
|
70
|
+
step++;
|
|
103
71
|
if (step === 1 || published.length || removed.length)
|
|
104
72
|
connection.recordCatalogChange(step, published, removed);
|
|
73
|
+
previousCatalog = catalog;
|
|
74
|
+
return tools;
|
|
105
75
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
76
|
+
|
|
77
|
+
async function execute(name, input, callSignal) {
|
|
78
|
+
signal?.throwIfAborted();
|
|
79
|
+
if (timedOut) throw new Error("Task timed out.");
|
|
80
|
+
if (unknownOutcome) throw unknownOutcome;
|
|
81
|
+
if (blockedReason) throw new Error(blockedReason);
|
|
82
|
+
try {
|
|
83
|
+
return await connection.execute(name, input, "task", { signal: callSignal });
|
|
84
|
+
} catch (error) {
|
|
85
|
+
if (error instanceof UnknownToolOutcome) {
|
|
86
|
+
unknownOutcome = error;
|
|
87
|
+
run.cancel();
|
|
88
|
+
} else if (error instanceof ConfirmationBlocked) {
|
|
89
|
+
blockedReason = error.message;
|
|
90
|
+
run.cancel();
|
|
91
|
+
}
|
|
92
|
+
throw error;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
110
96
|
signal?.throwIfAborted();
|
|
111
|
-
const agent = createAgent({ model,
|
|
97
|
+
const agent = createAgent({ model, [Symbol.for("@nexface/evals/getStepTools")]: getStepTools });
|
|
112
98
|
const run = agent.run({ messages: [{ id: crypto.randomUUID(), role: "user", content: goal }] });
|
|
113
99
|
const cancel = () => {
|
|
114
100
|
timedOut = true;
|
|
@@ -121,9 +107,11 @@ export async function runSiteAgent(goal, timeout, connection, signal) {
|
|
|
121
107
|
/* Drain the run event stream. */
|
|
122
108
|
}
|
|
123
109
|
const result = await run.result;
|
|
110
|
+
if (unknownOutcome) throw unknownOutcome;
|
|
124
111
|
if (timedOut) throw new Error("Task timed out.");
|
|
125
112
|
return { ...result, model: agent.model, blockedReason };
|
|
126
113
|
} catch (error) {
|
|
114
|
+
if (unknownOutcome) throw unknownOutcome;
|
|
127
115
|
if (blockedReason) return { outcome: { type: "interrupt" }, model: agent.model, blockedReason };
|
|
128
116
|
if (requestFailure) throw new Error(requestFailure, { cause: error });
|
|
129
117
|
throw error;
|
package/studio.html
CHANGED
|
@@ -16,9 +16,12 @@
|
|
|
16
16
|
font: 16px/1.6 system-ui, sans-serif;
|
|
17
17
|
}
|
|
18
18
|
main {
|
|
19
|
+
display: grid;
|
|
20
|
+
grid-template-rows: auto auto minmax(0, 1fr) auto;
|
|
21
|
+
height: 100dvh;
|
|
19
22
|
max-width: 1240px;
|
|
20
23
|
margin: auto;
|
|
21
|
-
padding: 32px 24px;
|
|
24
|
+
padding: clamp(10px, 3vh, 32px) 24px 0;
|
|
22
25
|
}
|
|
23
26
|
header,
|
|
24
27
|
nav,
|
|
@@ -97,10 +100,13 @@
|
|
|
97
100
|
.sub, #selection-count { color: #596352; font-size: 14px; }
|
|
98
101
|
.sub { margin: 5px 0 0; }
|
|
99
102
|
#save { background: #30382e; }
|
|
103
|
+
#list { overflow-y: auto; }
|
|
100
104
|
footer {
|
|
101
|
-
|
|
102
|
-
|
|
105
|
+
border-top: 1px solid #ccd5ca;
|
|
106
|
+
padding: 12px 0 max(12px, env(safe-area-inset-bottom));
|
|
103
107
|
}
|
|
108
|
+
#message { flex: 1; min-width: 0; margin: 0; overflow-wrap: anywhere; }
|
|
109
|
+
#message:empty { display: none; }
|
|
104
110
|
.actions {
|
|
105
111
|
justify-content: flex-end;
|
|
106
112
|
}
|
|
@@ -129,9 +135,6 @@
|
|
|
129
135
|
textarea {
|
|
130
136
|
min-height: 70px;
|
|
131
137
|
}
|
|
132
|
-
#message {
|
|
133
|
-
min-height: 24px;
|
|
134
|
-
}
|
|
135
138
|
dialog.criteria-editor {
|
|
136
139
|
width: min(740px, 95vw);
|
|
137
140
|
max-height: 90vh;
|
|
@@ -199,6 +202,7 @@
|
|
|
199
202
|
.task-index button[aria-current="true"] { background: #edf0e7; border-color: #546a4d; }
|
|
200
203
|
.task-index button:hover { background: #f0f2eb; }
|
|
201
204
|
.task-index span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
|
|
205
|
+
.task-index .edit-label { display: none; }
|
|
202
206
|
.review-pane { min-width: 0; overflow-wrap: anywhere; }
|
|
203
207
|
.full-goal { white-space: pre-wrap; margin: 0 0 24px; font-size: 18px; }
|
|
204
208
|
.review-pane .condition-heading { border-top: 1px solid #dedfd9; padding-top: 16px; }
|
|
@@ -206,10 +210,22 @@
|
|
|
206
210
|
.review-pane h3 { margin: 22px 0 6px; font-size: 16px; }
|
|
207
211
|
.review-pane ul { margin: 0; padding-inline-start: 1.4em; }
|
|
208
212
|
.review-pane li { margin: 6px 0; white-space: pre-wrap; }
|
|
213
|
+
@media (min-width: 641px) {
|
|
214
|
+
.review #list { grid-template-rows: minmax(0, 1fr); overflow: hidden; }
|
|
215
|
+
.task-index, .review-pane { overflow-y: auto; }
|
|
216
|
+
}
|
|
209
217
|
@media (max-width: 640px) {
|
|
218
|
+
main { padding-inline: 12px; }
|
|
219
|
+
footer { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; }
|
|
220
|
+
#message { grid-column: 1; font-size: 14px; }
|
|
221
|
+
#save { grid-column: 2; grid-row: 1 / span 2; }
|
|
210
222
|
header { display: flex; justify-content: space-between; }
|
|
211
223
|
.review #list { grid-template-columns: 1fr; }
|
|
212
|
-
.task-index { border
|
|
224
|
+
.task-index { border: 0; padding: 0; }
|
|
225
|
+
.task-index button { display: flex; align-items: baseline; gap: 12px; }
|
|
226
|
+
.task-index button[aria-current="true"] { background: transparent; border-color: transparent; }
|
|
227
|
+
.task-index .edit-label { display: inline; margin-left: auto; flex: none; color: #596352; }
|
|
228
|
+
.review-pane { display: none; }
|
|
213
229
|
}
|
|
214
230
|
</style>
|
|
215
231
|
<main>
|
|
@@ -227,9 +243,9 @@
|
|
|
227
243
|
<section id="list"></section>
|
|
228
244
|
<footer>
|
|
229
245
|
<span id="selection-count" aria-live="polite"></span>
|
|
246
|
+
<p id="message" role="status"></p>
|
|
230
247
|
<button id="save" class="primary"></button>
|
|
231
248
|
</footer>
|
|
232
|
-
<p id="message" role="status"></p>
|
|
233
249
|
</main>
|
|
234
250
|
<dialog aria-labelledby="title">
|
|
235
251
|
<div class="dialog-heading">
|
|
@@ -377,12 +393,19 @@
|
|
|
377
393
|
pane.className = "review-pane";
|
|
378
394
|
for (const task of draft) {
|
|
379
395
|
const choice = button("", () => {
|
|
396
|
+
if (window.matchMedia("(max-width: 640px)").matches) {
|
|
397
|
+
edit(task);
|
|
398
|
+
return;
|
|
399
|
+
}
|
|
380
400
|
activeTaskId = task.id;
|
|
381
401
|
draw();
|
|
382
402
|
el("list").querySelector('[aria-current="true"]').focus();
|
|
383
403
|
});
|
|
384
404
|
choice.append(node("span", task.goal));
|
|
385
405
|
if (state.reviewTaskIds?.includes(task.id)) choice.append(node("small", "待复核"));
|
|
406
|
+
const editLabel = node("span", "编辑条件");
|
|
407
|
+
editLabel.className = "edit-label";
|
|
408
|
+
choice.append(editLabel);
|
|
386
409
|
choice.setAttribute("aria-current", String(task.id === active.id));
|
|
387
410
|
index.append(choice);
|
|
388
411
|
}
|
package/task-session.mjs
CHANGED
|
@@ -82,13 +82,7 @@ export async function openTask(page, baseURL, testInfo) {
|
|
|
82
82
|
clearTimeout(timer);
|
|
83
83
|
controller.abort();
|
|
84
84
|
}
|
|
85
|
-
if (
|
|
86
|
-
row.calls.some(
|
|
87
|
-
(call) =>
|
|
88
|
-
call.status === "running" ||
|
|
89
|
-
(call.phase === "task" && call.status === "error" && /timeout/i.test(call.error ?? "")),
|
|
90
|
-
)
|
|
91
|
-
) {
|
|
85
|
+
if (row.calls.some((call) => call.status === "running")) {
|
|
92
86
|
row.traceWarning = "A dispatched tool may still be running. The final page state is unknown.";
|
|
93
87
|
}
|
|
94
88
|
row.endURL = page.url().split(/[?#]/)[0];
|