dsh-trajectory-traceview-plus 0.11.4 → 0.11.6
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/CHANGELOG.md +199 -0
- package/README.en.md +26 -13
- package/README.md +36 -17
- package/docs/DESIGN.md +1128 -8
- package/docs/PROVENANCE.md +11 -2
- package/lib/client.js +745 -121
- package/package.json +2 -2
- package/scripts/browser-check.mjs +25 -3
- package/scripts/browser-harness.mjs +13 -0
- package/scripts/build-client.mjs +9 -0
- package/scripts/harness-stamp.mjs +56 -0
- package/scripts/path-leak-check.mjs +71 -0
- package/scripts/readme-numbers.mjs +13 -2
- package/scripts/shortcut-check.mjs +33 -8
- package/src/00-locale.js +17 -0
- package/src/10-styles.js +19 -2
- package/src/30-helpers.js +297 -41
- package/src/40-view.js +412 -78
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-trajectory-traceview-plus",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.6",
|
|
4
4
|
"description": "轨迹视图增强版(Plus):在「轨迹」标签旁新增可回放的横向时间轴——minimap、窗口内检索(显式标注覆盖边界)、回放、轮次跳转、跟随模式、历史分页、步骤/子调用耗时与吞吐、时钟轴切换、稳定锚点复制与深链、孤立工具结果站点、提示词变更对比、原始请求分析与 Markdown 导出。基于 AFAP/dsh-trajectory-traceview (MIT) 改造。",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
},
|
|
63
63
|
"scripts": {
|
|
64
64
|
"build": "node scripts/build-client.mjs",
|
|
65
|
-
"check": "node scripts/build-client.mjs --check && node scripts/provenance.mjs --check && node scripts/version-check.mjs && node scripts/doc-ref-check.mjs && node scripts/doc-heading-check.mjs && node test/smoke.test.cjs && node scripts/readme-numbers.mjs && node scripts/shortcut-check.mjs",
|
|
65
|
+
"check": "node scripts/build-client.mjs --check && node scripts/provenance.mjs --check && node scripts/version-check.mjs && node scripts/doc-ref-check.mjs && node scripts/doc-heading-check.mjs && node test/smoke.test.cjs && node scripts/readme-numbers.mjs && node scripts/shortcut-check.mjs && node scripts/harness-stamp.mjs && node scripts/path-leak-check.mjs",
|
|
66
66
|
"test": "node test/smoke.test.cjs",
|
|
67
67
|
"prepublishOnly": "npm run check"
|
|
68
68
|
}
|
|
@@ -26,7 +26,11 @@ const open = run("agent-browser", ["open", url]);
|
|
|
26
26
|
if (open.status !== 0) { console.log("agent-browser open failed:\n" + open.stdout + open.stderr); process.exit(1); }
|
|
27
27
|
run("agent-browser", ["wait", "1200"]);
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
// BOTH halves share one page: the browser is opened once and the evals run in order, so
|
|
30
|
+
// `probe-detail.js` continues from the state `probe.js` leaves. Split because
|
|
31
|
+
// `agent-browser eval` aborts at 30 s and the single file had reached 27.4 s (§13.70).
|
|
32
|
+
const probeFiles = ["test/browser/probe.js", "test/browser/probe-detail.js", "test/browser/probe-detail2.js"];
|
|
33
|
+
const probe = fs.readFileSync(path.join(root, probeFiles[0]), "utf8");
|
|
30
34
|
const out = run("agent-browser", ["eval", "--stdin"], probe);
|
|
31
35
|
const raw = (out.stdout || "").trim();
|
|
32
36
|
let parsed = null;
|
|
@@ -40,7 +44,22 @@ try {
|
|
|
40
44
|
process.exit(1);
|
|
41
45
|
}
|
|
42
46
|
|
|
43
|
-
//
|
|
47
|
+
// Remaining halves of the assertions. Each is a separate `agent-browser eval` because the
|
|
48
|
+
// command aborts at 30 s; the probe was split twice for exactly that reason (§13.70). They
|
|
49
|
+
// run in order on ONE page, so each continues from the state the previous one left.
|
|
50
|
+
for (const rel of probeFiles.slice(1)) {
|
|
51
|
+
const outTail = run("agent-browser", ["eval", "--stdin"], fs.readFileSync(path.join(root, rel), "utf8"));
|
|
52
|
+
try {
|
|
53
|
+
const outerTail = JSON.parse((outTail.stdout || "").trim());
|
|
54
|
+
const parsedTail = JSON.parse(outerTail);
|
|
55
|
+
if (Array.isArray(parsedTail.failures)) parsed.failures.push(...parsedTail.failures);
|
|
56
|
+
Object.assign(parsed.info, parsedTail.info);
|
|
57
|
+
} catch {
|
|
58
|
+
parsed.failures.push(rel + " did not return a parsable result");
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// The English pass runs as a third eval. `agent-browser eval` aborts with
|
|
44
63
|
// "Resource temporarily unavailable" at 30 s, and the main probe alone is close to that;
|
|
45
64
|
// merging the two failed as an unparsable result instead of a red assertion.
|
|
46
65
|
const probeEn = fs.readFileSync(path.join(root, "test/browser/probe-en.js"), "utf8");
|
|
@@ -49,7 +68,10 @@ try {
|
|
|
49
68
|
const outerEn = JSON.parse((outEn.stdout || "").trim());
|
|
50
69
|
const parsedEn = JSON.parse(outerEn);
|
|
51
70
|
if (Array.isArray(parsedEn.failures)) parsed.failures.push(...parsedEn.failures);
|
|
52
|
-
|
|
71
|
+
// Merge EVERY key, not just one. Copying only `englishLeaks` made the printed group
|
|
72
|
+
// count (28) disagree with the number the READMEs state and readme-numbers verifies
|
|
73
|
+
// (29) — the gate read the three probe files, the runtime read two. One source.
|
|
74
|
+
Object.assign(parsed.info, parsedEn.info);
|
|
53
75
|
} catch {
|
|
54
76
|
parsed.failures.push("the English pass did not return a parsable result");
|
|
55
77
|
}
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
* Deliberately NOT part of the smoke suite: it needs a browser.
|
|
11
11
|
* node scripts/browser-harness.mjs # writes test/browser/harness.html
|
|
12
12
|
*/
|
|
13
|
+
import { createHash } from "node:crypto";
|
|
13
14
|
import fs from "node:fs";
|
|
14
15
|
import path from "node:path";
|
|
15
16
|
|
|
@@ -78,11 +79,23 @@ for (const [id, rel] of Object.entries(MODULES)) {
|
|
|
78
79
|
}
|
|
79
80
|
|
|
80
81
|
const client = read("lib/client.js");
|
|
82
|
+
/**
|
|
83
|
+
* Stamp the bundle this page was built from.
|
|
84
|
+
*
|
|
85
|
+
* Manual browser probing goes: edit `src/` -> `build-client.mjs` -> open harness.html. That
|
|
86
|
+
* skips `browser-harness.mjs`, so the page keeps an OLD inlined bundle and every measurement
|
|
87
|
+
* or fix-verification silently describes the previous revision. It cost a real debugging
|
|
88
|
+
* cycle (§13.75): a correct cache fix looked broken because the page predated it.
|
|
89
|
+
*
|
|
90
|
+
* `harness-stamp.mjs` compares this stamp against the current `lib/client.js`.
|
|
91
|
+
*/
|
|
92
|
+
const clientHash = createHash("sha256").update(client).digest("hex").slice(0, 16);
|
|
81
93
|
const fixture = read("test/browser/fixture.js");
|
|
82
94
|
|
|
83
95
|
const html = `<!doctype html>
|
|
84
96
|
<html lang="zh-CN" data-ds-dark-theme="false">
|
|
85
97
|
<head>
|
|
98
|
+
<script>window.__HARNESS_CLIENT_HASH__ = "${clientHash}";</script>
|
|
86
99
|
<meta charset="utf-8">
|
|
87
100
|
<title>TraceMapView harness</title>
|
|
88
101
|
<style>
|
package/scripts/build-client.mjs
CHANGED
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
* node scripts/build-client.mjs # write lib/client.js
|
|
18
18
|
* node scripts/build-client.mjs --check # fail if lib/client.js is stale
|
|
19
19
|
*/
|
|
20
|
+
import { spawnSync } from "node:child_process";
|
|
20
21
|
import fs from "node:fs";
|
|
21
22
|
import path from "node:path";
|
|
22
23
|
import { fileURLToPath } from "node:url";
|
|
@@ -93,4 +94,12 @@ if (process.argv.includes("--check")) {
|
|
|
93
94
|
fs.mkdirSync(path.dirname(OUT), { recursive: true });
|
|
94
95
|
fs.writeFileSync(OUT, built);
|
|
95
96
|
console.log(`build-client: wrote ${path.relative(ROOT, OUT)} (${built.split("\n").length} lines)`);
|
|
97
|
+
// A hand-built bundle makes any EXISTING harness.html stale, and a stale page silently
|
|
98
|
+
// answers questions about the previous revision. Say so at the moment it happens (§13.75).
|
|
99
|
+
{
|
|
100
|
+
const stamp = spawnSync(process.execPath, [path.join(ROOT, "scripts/harness-stamp.mjs"), "--quiet"], { stdio: "ignore" });
|
|
101
|
+
if (stamp.status !== 0) {
|
|
102
|
+
console.log("build-client: note — test/browser/harness.html is now stale; run `node scripts/browser-harness.mjs` before probing by hand");
|
|
103
|
+
}
|
|
104
|
+
}
|
|
96
105
|
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Is `test/browser/harness.html` built from the CURRENT `lib/client.js`?
|
|
4
|
+
*
|
|
5
|
+
* Why this exists: manual browser probing goes
|
|
6
|
+
*
|
|
7
|
+
* edit src/ -> build-client.mjs -> open harness.html
|
|
8
|
+
*
|
|
9
|
+
* which skips `browser-harness.mjs` — the page keeps an OLD inlined bundle, so every
|
|
10
|
+
* measurement and every "is the fix working?" check silently describes the previous
|
|
11
|
+
* revision. That cost a real debugging cycle (§13.75): a correct element-cache fix looked
|
|
12
|
+
* broken, and the tempting next move was to revert it.
|
|
13
|
+
*
|
|
14
|
+
* `browser-check.mjs` always regenerates the harness, so it never sees this. Only a human
|
|
15
|
+
* (or an agent) driving the page by hand does.
|
|
16
|
+
*
|
|
17
|
+
* node scripts/harness-stamp.mjs # explain, exit 1 when stale
|
|
18
|
+
* node scripts/harness-stamp.mjs --quiet # exit code only
|
|
19
|
+
*
|
|
20
|
+
* Exits 0 when the harness is absent (CI does not build one) or when it is current.
|
|
21
|
+
*/
|
|
22
|
+
import { createHash } from "node:crypto";
|
|
23
|
+
import fs from "node:fs";
|
|
24
|
+
import path from "node:path";
|
|
25
|
+
|
|
26
|
+
const root = path.resolve(import.meta.dirname, "..");
|
|
27
|
+
const harnessPath = path.join(root, "test/browser/harness.html");
|
|
28
|
+
const clientPath = path.join(root, "lib/client.js");
|
|
29
|
+
const quiet = process.argv.includes("--quiet");
|
|
30
|
+
|
|
31
|
+
const say = (msg) => { if (!quiet) console.log(msg); };
|
|
32
|
+
|
|
33
|
+
if (!fs.existsSync(harnessPath)) {
|
|
34
|
+
say("harness-stamp: no test/browser/harness.html (nothing to check)");
|
|
35
|
+
process.exit(0);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const current = createHash("sha256").update(fs.readFileSync(clientPath)).digest("hex").slice(0, 16);
|
|
39
|
+
const html = fs.readFileSync(harnessPath, "utf8");
|
|
40
|
+
const found = /window\.__HARNESS_CLIENT_HASH__\s*=\s*"([0-9a-f]+)"/.exec(html);
|
|
41
|
+
|
|
42
|
+
if (found === null) {
|
|
43
|
+
say("harness-stamp: STALE — the page carries no bundle stamp, so it predates this guard.");
|
|
44
|
+
say(" before probing by hand: node scripts/browser-harness.mjs");
|
|
45
|
+
process.exit(1);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (found[1] !== current) {
|
|
49
|
+
say("harness-stamp: STALE — harness.html inlines " + found[1] + " but lib/client.js is " + current + ".");
|
|
50
|
+
say(" Anything you observe in that page describes the OLD bundle.");
|
|
51
|
+
say(" before probing by hand: node scripts/browser-harness.mjs");
|
|
52
|
+
process.exit(1);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
say("harness-stamp: OK (" + current + ")");
|
|
56
|
+
process.exit(0);
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Fail when a file that ships in the npm tarball carries this machine's absolute paths.
|
|
4
|
+
*
|
|
5
|
+
* `docs/DESIGN.md` is published (`files` lists `docs/`). It accumulated ten paths such as
|
|
6
|
+
* `/Users/<name>/Documents/...` and `/Volumes/...` — the username, the working directory and
|
|
7
|
+
* the Node install layout, shipped to everyone who installs the plugin. No credentials, but
|
|
8
|
+
* it is fingerprint material that no reader needs, and it was invisible because the earlier
|
|
9
|
+
* sweep (§13.38) only covered `scripts/`.
|
|
10
|
+
*
|
|
11
|
+
* The rule: anything inside `files` may mention the repo's own NAME, never a home directory
|
|
12
|
+
* or a volume path. Documentation that legitimately describes a check (this file's own
|
|
13
|
+
* `$ git ls-files … grep -E '/Users/…'` example) is allowed through by the marker below.
|
|
14
|
+
*
|
|
15
|
+
* node scripts/path-leak-check.mjs
|
|
16
|
+
*
|
|
17
|
+
* Exempt: a line carrying `path-leak-check: allow` (the rule it documents) — used exactly
|
|
18
|
+
* once, in DESIGN §13.38, so the guard cannot be turned into a blanket excuse.
|
|
19
|
+
*/
|
|
20
|
+
import fs from "node:fs";
|
|
21
|
+
import path from "node:path";
|
|
22
|
+
|
|
23
|
+
const root = path.resolve(import.meta.dirname, "..");
|
|
24
|
+
const pkg = JSON.parse(fs.readFileSync(path.join(root, "package.json"), "utf8"));
|
|
25
|
+
|
|
26
|
+
const ALLOW = "path-leak-check: allow";
|
|
27
|
+
const PATTERN = /\/Users\/[A-Za-z][\w.-]*|\/Volumes\/[A-Za-z]|\/home\/[A-Za-z][\w.-]*|\/private\/tmp\//;
|
|
28
|
+
|
|
29
|
+
/** Expand the `files` list into the concrete files npm would pack. */
|
|
30
|
+
function shippedFiles() {
|
|
31
|
+
const out = [];
|
|
32
|
+
const walk = (rel) => {
|
|
33
|
+
const abs = path.join(root, rel);
|
|
34
|
+
if (!fs.existsSync(abs)) return;
|
|
35
|
+
const st = fs.statSync(abs);
|
|
36
|
+
if (st.isDirectory()) {
|
|
37
|
+
for (const name of fs.readdirSync(abs)) walk(path.join(rel, name));
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
out.push(rel);
|
|
41
|
+
};
|
|
42
|
+
for (const entry of pkg.files ?? []) {
|
|
43
|
+
const clean = entry.replace(/\/$/, "");
|
|
44
|
+
walk(clean);
|
|
45
|
+
}
|
|
46
|
+
return out;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const TEXT = /\.(md|js|mjs|cjs|json|yml|yaml|ts|txt)$/;
|
|
50
|
+
const problems = [];
|
|
51
|
+
let scanned = 0;
|
|
52
|
+
|
|
53
|
+
for (const rel of shippedFiles()) {
|
|
54
|
+
if (!TEXT.test(rel)) continue;
|
|
55
|
+
scanned += 1;
|
|
56
|
+
const lines = fs.readFileSync(path.join(root, rel), "utf8").split("\n");
|
|
57
|
+
lines.forEach((line, i) => {
|
|
58
|
+
if (line.includes(ALLOW)) return;
|
|
59
|
+
if (!PATTERN.test(line)) return;
|
|
60
|
+
problems.push(rel + ":" + (i + 1) + " — " + line.trim().slice(0, 120));
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (problems.length > 0) {
|
|
65
|
+
console.error("path-leak-check: " + problems.length + " absolute path(s) would be published:");
|
|
66
|
+
for (const p of problems) console.error(" ✗ " + p);
|
|
67
|
+
console.error(" replace them with <repo> / <workdir> / $NODE_HOME, or mark the line `" + ALLOW + "`");
|
|
68
|
+
process.exit(1);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
console.log("path-leak-check: OK (" + scanned + " shipped text file(s), no local paths)");
|
|
@@ -39,7 +39,7 @@ const localSteps = pkg.scripts.check.split('&&').map((s) => s.trim()).filter(Boo
|
|
|
39
39
|
// aborts at 30 s and the language switch pushed the single file over it (§13.69) — and
|
|
40
40
|
// leaving it out of this count is exactly the one-source-vs-two-sources blindness this
|
|
41
41
|
// very block has already been fixed for once (§13.44).
|
|
42
|
-
const PROBE_FILES = ['test/browser/probe.js', 'test/browser/probe-en.js'];
|
|
42
|
+
const PROBE_FILES = ['test/browser/probe.js', 'test/browser/probe-detail.js', 'test/browser/probe-detail2.js', 'test/browser/probe-en.js'];
|
|
43
43
|
const probes = PROBE_FILES.map((f) => read(f));
|
|
44
44
|
const observedGroups = new Set();
|
|
45
45
|
let assertions = 0;
|
|
@@ -73,12 +73,19 @@ const extraAssertions = [...browserCheck.matchAll(/(?:parsed\.)?failures\.push\(
|
|
|
73
73
|
const truth = {
|
|
74
74
|
ciGates, localSteps, groups: observedGroups.size, assertions,
|
|
75
75
|
extraGroups: extraGroupNames.size, extraAssertions,
|
|
76
|
+
// The `--shots` line ends with a TOTAL ("共 36 组" / "(36 total)"), not the extra.
|
|
77
|
+
// It was not a claim at all until now, so it drifted silently while the line's other
|
|
78
|
+
// numbers were gated: the English copy read "(30 total)" for six releases after the
|
|
79
|
+
// base grew past it. A number written down twice goes stale (§13.37) — including the
|
|
80
|
+
// one that is a SUM of two numbers the same file already checks.
|
|
81
|
+
shotsTotalGroups: observedGroups.size + extraGroupNames.size,
|
|
76
82
|
};
|
|
77
83
|
|
|
78
84
|
if (process.argv.includes('--print')) {
|
|
79
85
|
console.log('CI 门禁 ' + ciGates + ' 项(workflow 具名步骤 ' + namedSteps.length + ' − Install)');
|
|
80
86
|
console.log('npm run check ' + localSteps + ' 步');
|
|
81
87
|
console.log('probe.js 观测组 ' + truth.groups + ' 个 / 断言 ' + assertions + ' 条');
|
|
88
|
+
console.log('--shots 合计 ' + truth.shotsTotalGroups + ' 组(基础 ' + truth.groups + ' + 额外 ' + truth.extraGroups + ')');
|
|
82
89
|
console.log('browser-check 额外 ' + truth.extraGroups + ' 组 / ' + truth.extraAssertions + ' 条断言'
|
|
83
90
|
+ (extraGroupNames.size > 0 ? '(组:' + [...extraGroupNames].join(', ') + ')' : ''));
|
|
84
91
|
process.exit(0);
|
|
@@ -91,7 +98,7 @@ if (process.argv.includes('--print')) {
|
|
|
91
98
|
// it looked for `N 项` — the audit was wrong, not the document. Anchoring on the
|
|
92
99
|
// sentence is what made it correct.
|
|
93
100
|
const problems = [];
|
|
94
|
-
const counted = { ciGates: 0, localSteps: 0, groups: 0, assertions: 0, extraGroups: 0, extraAssertions: 0 };
|
|
101
|
+
const counted = { ciGates: 0, localSteps: 0, groups: 0, assertions: 0, extraGroups: 0, extraAssertions: 0, shotsTotalGroups: 0 };
|
|
95
102
|
|
|
96
103
|
const claim = (file, lineNo, kind, found, want) => {
|
|
97
104
|
counted[kind] += 1;
|
|
@@ -123,6 +130,10 @@ for (const file of ['README.md', 'README.en.md']) {
|
|
|
123
130
|
for (const m of line.matchAll(/--shots[^\n]{0,80}?另加\s*\d+\s*组\s*\/\s*(\d+)\s*条/g)) claimSpan(m, 'extraAssertions', Number(m[1]), truth.extraAssertions);
|
|
124
131
|
for (const m of line.matchAll(/--shots[^\n]{0,60}?(?:adds?|plus)\s*(\d+)\s*(?:more\s*)?group/g)) claimSpan(m, 'extraGroups', Number(m[1]), truth.extraGroups);
|
|
125
132
|
for (const m of line.matchAll(/--shots[^\n]{0,60}?adds?\s*\d+\s*more\s*group\s*\/\s*(\d+)\s*assertions?/g)) claimSpan(m, 'extraAssertions', Number(m[1]), truth.extraAssertions);
|
|
133
|
+
// The total at the end of the same line: "…(375px 溢出,共 36 组)" / "(36 total)".
|
|
134
|
+
// Scoped to the `--shots` line so an unrelated "共 N 组" elsewhere is not misread.
|
|
135
|
+
for (const m of line.matchAll(/--shots[^\n]{0,90}?共\s*(\d+)\s*组/g)) claimSpan(m, 'shotsTotalGroups', Number(m[1]), truth.shotsTotalGroups);
|
|
136
|
+
for (const m of line.matchAll(/--shots[^\n]{0,90}?\((\d+)\s*total\)/g)) claimSpan(m, 'shotsTotalGroups', Number(m[1]), truth.shotsTotalGroups);
|
|
126
137
|
|
|
127
138
|
// "CI:7 项门禁" / "the seven gates" / "门禁本身是 7 项" / "those 7 gates"
|
|
128
139
|
for (const m of line.matchAll(/(\d+)\s*项门禁/g)) if (!isClaimed(m.index)) claim(file, at, 'ciGates', Number(m[1]), ciGates);
|
|
@@ -44,7 +44,14 @@ const table = tableEnd < 0 ? section : section.slice(0, tableEnd);
|
|
|
44
44
|
// A row looks like: `| `←` / `→` | 上一个 / 下一个站点 |`
|
|
45
45
|
// Take every backticked key in the FIRST cell. Cells like `` `↑` / `↓`(搜索时) ``
|
|
46
46
|
// contain two keys and a qualifier; both keys must be covered.
|
|
47
|
-
|
|
47
|
+
// Take the whole FIRST CELL and pull the backticked keys out of it. The earlier pattern
|
|
48
|
+
// required the cell to END right after a backtick, so the two rows with a qualifier —
|
|
49
|
+
// "`↑` / `↓`(搜索时)" and "`Enter` / `Shift+Enter`(搜索时)" — were never parsed at all.
|
|
50
|
+
// The gate then reported "8 行 / 11 个键" as if that were the whole table: the two rows a
|
|
51
|
+
// reader most needs (search-time navigation) were promised and unverified.
|
|
52
|
+
const rows = [...table.matchAll(/^\|([^|]*)\|/gm)]
|
|
53
|
+
.map((m) => m[1])
|
|
54
|
+
.filter((cell) => cell.indexOf("`") >= 0);
|
|
48
55
|
if (rows.length === 0) {
|
|
49
56
|
problems.push('README §7 has no shortcut rows; the patterns have drifted from the table');
|
|
50
57
|
}
|
|
@@ -56,22 +63,40 @@ const PROBE_NAME = {
|
|
|
56
63
|
'→': 'ArrowRight',
|
|
57
64
|
'↑': 'ArrowUp',
|
|
58
65
|
'↓': 'ArrowDown',
|
|
59
|
-
'空格': '
|
|
66
|
+
'空格': ' ',
|
|
60
67
|
Esc: 'Escape',
|
|
61
68
|
'`Esc`': 'Escape',
|
|
62
|
-
'`空格`': '
|
|
69
|
+
'`空格`': ' ',
|
|
70
|
+
Enter: 'Enter',
|
|
63
71
|
};
|
|
64
72
|
|
|
65
|
-
const
|
|
73
|
+
const PROBE_FILES = ['test/browser/probe.js', 'test/browser/probe-detail.js', 'test/browser/probe-en.js'];
|
|
74
|
+
// Comments are dropped first: `// await press("f")` is a note, not a test, but matching the
|
|
75
|
+
// raw text counted it as coverage. Verified by commenting the call out — the gate stayed
|
|
76
|
+
// green until the comment lines were excluded.
|
|
77
|
+
const codeOf = (f) => read(f).split('\n').filter((l) => !l.trim().startsWith('//')).join('\n');
|
|
78
|
+
const probe = PROBE_FILES.map(codeOf).join('\n');
|
|
66
79
|
const covered = [];
|
|
67
80
|
for (const row of rows) {
|
|
68
81
|
const keys = [...row.matchAll(/`([^`]+)`/g)].map((m) => m[1]);
|
|
69
82
|
for (const key of keys) {
|
|
83
|
+
// `Shift+Enter` is not a string literal in the probe: it is a key plus a modifier.
|
|
84
|
+
// Requiring both halves is what makes the row mean something.
|
|
85
|
+
if (key === "Shift+Enter") {
|
|
86
|
+
const shifted = /shiftPress\("Enter",\s*true\)/.test(probe);
|
|
87
|
+
if (!shifted) problems.push('README §7 documents `Shift+Enter` but no probe calls shiftPress("Enter", true)');
|
|
88
|
+
else covered.push(key);
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
70
91
|
const needle = PROBE_NAME[key] ?? key;
|
|
71
|
-
// `
|
|
72
|
-
//
|
|
73
|
-
|
|
74
|
-
|
|
92
|
+
// A plain `includes` was worthless for one-character keys: `f` occurs 199 times in
|
|
93
|
+
// the probe as an ordinary letter, so the row could never fail. Require an actual
|
|
94
|
+
// key event — `press("<key>")` or `shiftPress("<key>"` — in any of the probe files.
|
|
95
|
+
const escaped = needle.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
96
|
+
const call = new RegExp('(?:press|shiftPress)\\("' + escaped + '"');
|
|
97
|
+
const usedIn = PROBE_FILES.find((f) => call.test(codeOf(f)));
|
|
98
|
+
if (usedIn === void 0) {
|
|
99
|
+
problems.push('README §7 documents `' + key + '` but no probe ever presses '
|
|
75
100
|
+ JSON.stringify(needle) + ' — the key is promised and never exercised');
|
|
76
101
|
} else {
|
|
77
102
|
covered.push(key);
|
package/src/00-locale.js
CHANGED
|
@@ -62,6 +62,10 @@
|
|
|
62
62
|
"kpi.tokensIn": "请求 tokens",
|
|
63
63
|
"kpi.tokensOut": "生成 tokens",
|
|
64
64
|
"kpi.errors": "错误",
|
|
65
|
+
// The KPI counts STEPS that contain an error, not error events: one step with 24
|
|
66
|
+
// tool calls and 4 failures shows 1. The bare label "错误 / Errors" made that read
|
|
67
|
+
// as a wrong number; the chip says what it counts now.
|
|
68
|
+
"kpi.errorSteps": "出错步骤",
|
|
65
69
|
// The Token-usage chips were hardcoded English ("in" / "out" / "cache-read" …)
|
|
66
70
|
// inside a Chinese panel, while README §2 describes this section as
|
|
67
71
|
// "入站(含缓存读 / 写)与出站(含思考)". Same words as the README, compact
|
|
@@ -78,6 +82,9 @@
|
|
|
78
82
|
"detail.args": "调用参数",
|
|
79
83
|
"detail.noArgs": "(无参数)",
|
|
80
84
|
"detail.subCalls": "子调用",
|
|
85
|
+
// The budget silently dropped the tail: 20,000 children rendered 1,999 with no
|
|
86
|
+
// indication anywhere. Say how many exist when the list was cut.
|
|
87
|
+
"detail.subCallsCut": "只显示前 {shown} 个(共 {total} 个)",
|
|
81
88
|
"detail.position": "站点",
|
|
82
89
|
"detail.result": "工具结果",
|
|
83
90
|
"detail.noResult": "(无结果内容)",
|
|
@@ -92,6 +99,8 @@
|
|
|
92
99
|
"detail.items": "项",
|
|
93
100
|
"detail.request": "请求配置",
|
|
94
101
|
"detail.systemPrompt": "系统提示",
|
|
102
|
+
"detail.systemOutside": "来自窗口外的系统事件 e{seq}",
|
|
103
|
+
"detail.systemNone": "(当前窗口内没有系统提示)",
|
|
95
104
|
"detail.toolsCatalog": "工具目录",
|
|
96
105
|
"detail.messages": "消息列表",
|
|
97
106
|
"detail.copy": "复制",
|
|
@@ -115,6 +124,8 @@
|
|
|
115
124
|
"gap.idle": "空闲",
|
|
116
125
|
"node.orphanTool": "孤立工具结果",
|
|
117
126
|
"orphan.badge": "调用不在窗口内",
|
|
127
|
+
"node.replayedTool": "压缩重放的工具结果",
|
|
128
|
+
"orphan.replayBadge": "与 e{seq} 相同(上下文压缩后重放)",
|
|
118
129
|
"orphan.noText": "(无结果文本)",
|
|
119
130
|
"timing.notRecorded": "未记录耗时",
|
|
120
131
|
"timing.notRecordedHint": "该步骤没有 timing 记录,无法得到耗时",
|
|
@@ -248,6 +259,7 @@
|
|
|
248
259
|
"kpi.tokensIn": "Prompt tokens",
|
|
249
260
|
"kpi.tokensOut": "Output tokens",
|
|
250
261
|
"kpi.errors": "Errors",
|
|
262
|
+
"kpi.errorSteps": "steps with errors",
|
|
251
263
|
"usage.in": "in",
|
|
252
264
|
"usage.fresh": "fresh",
|
|
253
265
|
"usage.cacheRead": "cache-read",
|
|
@@ -259,6 +271,7 @@
|
|
|
259
271
|
"detail.args": "Call arguments",
|
|
260
272
|
"detail.noArgs": "(no arguments)",
|
|
261
273
|
"detail.subCalls": "Sub-calls",
|
|
274
|
+
"detail.subCallsCut": "showing the first {shown} of {total}",
|
|
262
275
|
"detail.position": "Station",
|
|
263
276
|
"detail.result": "Tool result",
|
|
264
277
|
"detail.noResult": "(no result content)",
|
|
@@ -273,6 +286,8 @@
|
|
|
273
286
|
"detail.items": "items",
|
|
274
287
|
"detail.request": "Request config",
|
|
275
288
|
"detail.systemPrompt": "System prompt",
|
|
289
|
+
"detail.systemOutside": "from system event e{seq} outside the window",
|
|
290
|
+
"detail.systemNone": "(no system prompt in this window)",
|
|
276
291
|
"detail.toolsCatalog": "Tool catalog",
|
|
277
292
|
"detail.messages": "Messages",
|
|
278
293
|
"detail.copy": "Copy",
|
|
@@ -296,6 +311,8 @@
|
|
|
296
311
|
"gap.idle": "Idle",
|
|
297
312
|
"node.orphanTool": "Orphan tool result",
|
|
298
313
|
"orphan.badge": "call outside window",
|
|
314
|
+
"node.replayedTool": "Replayed tool result",
|
|
315
|
+
"orphan.replayBadge": "same as e{seq} (re-sent after compaction)",
|
|
299
316
|
"orphan.noText": "(no result text)",
|
|
300
317
|
"timing.notRecorded": "no duration",
|
|
301
318
|
"timing.notRecordedHint": "This step has no timing record at all",
|
package/src/10-styles.js
CHANGED
|
@@ -242,6 +242,11 @@
|
|
|
242
242
|
// surface one consistent, high-contrast focus indicator (WCAG 2.4.7/2.4.11).
|
|
243
243
|
".dstv_root button:focus-visible,.dstv_root summary:focus-visible,.dstv_root a:focus-visible,.dstv_root input:focus-visible{outline:2px solid var(--dstv-info);outline-offset:2px;border-radius:6px}",
|
|
244
244
|
// Suppress the ring only for pointer users, never for keyboard users.
|
|
245
|
+
// The panel root is focusable (it owns the keyboard shortcuts), and it had NO focus
|
|
246
|
+
// ring: real Tab put focus on `.dstv_root` with `:focus-visible=true` and
|
|
247
|
+
// `outline-style:none`, so a keyboard user could not see where they were. Inset so
|
|
248
|
+
// the ring is not clipped by the panel's own overflow.
|
|
249
|
+
".dstv_root:focus-visible{outline:2px solid var(--dstv-info);outline-offset:-2px}",
|
|
245
250
|
".dstv_root:focus:not(:focus-visible){outline:none}",
|
|
246
251
|
".dstv_station:focus:not(:focus-visible){outline:none}",
|
|
247
252
|
".dstv_search:focus-within{border-color:var(--dstv-info);box-shadow:0 0 0 2px color-mix(in srgb,var(--dstv-info) 18%,transparent)}",
|
|
@@ -281,9 +286,21 @@
|
|
|
281
286
|
".dstv_btn[data-on=true]{color:var(--dstv-info-ink);background:color-mix(in srgb,var(--dstv-info) 12%,transparent);box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--dstv-info) 40%,transparent)}",
|
|
282
287
|
".dstv_tbtn[data-on=true]{color:var(--dstv-info-ink);background:color-mix(in srgb,var(--dstv-info) 14%,transparent);font-weight:700}",
|
|
283
288
|
".dstv_station[data-match=true] .dstv_hcard{border-color:transparent;background:linear-gradient(var(--dsw-alias-bg-layer-1),var(--dsw-alias-bg-layer-1)) padding-box,linear-gradient(135deg,var(--dstv-warn),var(--dstv-warn)) border-box;box-shadow:0 0 12px color-mix(in srgb,var(--dstv-warn) 35%,transparent)}",
|
|
284
|
-
|
|
285
|
-
|
|
289
|
+
// Searching dims the non-matches. Driven from the listbox so a keystroke does not
|
|
290
|
+
// rewrite every station element (§13.72): reached = not [data-dim], matched =
|
|
291
|
+
// [data-match]. Same visual result, one attribute instead of N.
|
|
292
|
+
// `.dstv_listbox` does not exist: the element carrying `data-searching` is the
|
|
293
|
+
// horizontally-scrolling flex row, whose class is `.dstv_hflow`. The rule matched
|
|
294
|
+
// nothing, so typing a query left every non-matching card at full opacity while
|
|
295
|
+
// the MINIMAP dimmed correctly (its selector uses `.dstv_minimap`, which is real).
|
|
296
|
+
// Measured after the move to a container attribute: card opacity 1 / filter none
|
|
297
|
+
// with `data-searching="true"` on the listbox, tick opacity .25.
|
|
298
|
+
".dstv_hflow[data-searching=true] .dstv_station:not([data-dim=true]):not([data-match=true]) .dstv_hcard{opacity:.5;filter:saturate(.3)}",
|
|
299
|
+
".dstv_hflow[data-searching=true] .dstv_station:not([data-dim=true]):not([data-match=true]) .dstv_hDot{opacity:.35}",
|
|
286
300
|
".dstv_miniTick[data-match=true]{box-shadow:0 0 0 1.5px var(--dstv-warn);height:14px}",
|
|
301
|
+
// While searching, fade the ticks that did not match. Reached-only ticks fade via
|
|
302
|
+
// [data-dim]; the search fade lives here so it costs no per-tick attribute (§13.72).
|
|
303
|
+
".dstv_minimap[data-searching=true] .dstv_miniTick:not([data-dim=true]):not([data-match=true]){opacity:.25}",
|
|
287
304
|
".dstv_detail.full{max-height:82vh}",
|
|
288
305
|
".dstv_panelToggle{margin-left:4px}",
|
|
289
306
|
".dstv_subCard{border:1px solid var(--dsw-alias-border-l2);border-radius:8px;padding:5px 8px;background:var(--dsw-alias-bg-layer-2);display:flex;flex-direction:column;gap:3px;margin-top:3px}",
|