pi-evals 0.1.0 → 0.2.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/CHANGELOG.md +7 -0
- package/README.md +13 -3
- package/dist/index.js +8 -3
- package/dist/render.js +30 -171
- package/dist/report/concepts.js +37 -0
- package/dist/report/findings.js +73 -0
- package/dist/report/format.js +16 -0
- package/dist/report/sections.js +61 -0
- package/dist/report/style.js +77 -0
- package/dist/report/timeline.js +91 -0
- package/dist/report/week.js +36 -0
- package/docs/design.md +11 -0
- package/docs/learn.zh-TW.md +33 -0
- package/package.json +2 -2
- package/src/index.ts +8 -3
- package/src/render.ts +62 -188
- package/src/report/concepts.ts +94 -0
- package/src/report/findings.ts +84 -0
- package/src/report/format.ts +24 -0
- package/src/report/sections.ts +188 -0
- package/src/report/style.ts +77 -0
- package/src/report/timeline.ts +143 -0
- package/src/report/week.ts +55 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { Rate, ReportModel } from "../model.ts";
|
|
2
|
+
import { type Change, type Lang, num, pct, usd, type Words, words } from "./format.ts";
|
|
3
|
+
|
|
4
|
+
type Key = "anchor_before_first_edit" | "check_after_last_edit" | "package_error_rate" | "tool_error_rate" | "cost_per_session";
|
|
5
|
+
export interface Reading {
|
|
6
|
+
key: Key;
|
|
7
|
+
label: string;
|
|
8
|
+
direction: string;
|
|
9
|
+
unit: string;
|
|
10
|
+
before?: Rate;
|
|
11
|
+
after?: Rate;
|
|
12
|
+
}
|
|
13
|
+
export function readings(c: Change, m: ReportModel, lang: Lang): Reading[] {
|
|
14
|
+
const L = words(lang), i = c.impact;
|
|
15
|
+
const has = (k: Key) => i?.before[k]?.value != null && i.after[k]?.value != null;
|
|
16
|
+
const process = c.package === "pi-anchorloop" && has("anchor_before_first_edit");
|
|
17
|
+
const keys: Key[] = process
|
|
18
|
+
? ["anchor_before_first_edit", "check_after_last_edit"]
|
|
19
|
+
: [has("package_error_rate") ? "package_error_rate" : "tool_error_rate", "cost_per_session"];
|
|
20
|
+
return keys.map((key) => {
|
|
21
|
+
const meta = m.meta.detectors[key] ?? m.meta.metrics[key === "package_error_rate" ? "tool_error_rate" : key];
|
|
22
|
+
return {
|
|
23
|
+
key,
|
|
24
|
+
label: key === "package_error_rate" ? L("Package tool error rate", "套件工具出錯比例") : meta.label[lang],
|
|
25
|
+
direction: meta.goodDirection === "higher" ? L("higher is better", "越高越好") : L("lower is better", "越低越好"),
|
|
26
|
+
unit: key.endsWith("error_rate") ? L("calls", "次呼叫") : L("sessions", "段"),
|
|
27
|
+
before: i?.before[key],
|
|
28
|
+
after: i?.after[key],
|
|
29
|
+
};
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
export const value = (r: Reading, side: "before" | "after") => r.key === "cost_per_session" ? usd(r[side]?.value ?? null) : pct(r[side]);
|
|
33
|
+
const comparable = (r: Reading) => r.before?.value != null && r.after?.value != null;
|
|
34
|
+
export function verdict(c: Change, rs: Reading[], L: Words): string {
|
|
35
|
+
const i = c.impact;
|
|
36
|
+
if (!i) return L("Too early to tell: no earlier records.", "還看不出來:調整前沒有紀錄。");
|
|
37
|
+
const notes: string[] = [];
|
|
38
|
+
if (i.smallSample) notes.push(L("too few sessions", "樣本太少"));
|
|
39
|
+
else if (rs.some((r) => comparable(r) && Math.min(r.before!.n, r.after!.n) < 20)) {
|
|
40
|
+
notes.push(L("a reading is based on fewer than 20 observations", "有指標的樣本不到 20"));
|
|
41
|
+
}
|
|
42
|
+
if (i.incomplete) notes.push(L(`less than ${i.window.days} days on one side`, `一側未滿 ${i.window.days} 天`));
|
|
43
|
+
if (!rs.some(comparable)) notes.push(L("no comparable readings", "沒有可比較的數字"));
|
|
44
|
+
const other = i.confounded ? L(`${num(i.confounded)} other changes in the same period`, `同期還有 ${num(i.confounded)} 筆別的調整`) : "";
|
|
45
|
+
if (notes.length || other) {
|
|
46
|
+
return [notes.length ? L(`Too early to tell: ${notes.join("; ")}`, `還看不出來(${notes.join("、")})`) : "", other].filter(Boolean)
|
|
47
|
+
.join(" · ");
|
|
48
|
+
}
|
|
49
|
+
return rs.some((r) => comparable(r) && value(r, "before") !== value(r, "after"))
|
|
50
|
+
? L("An observable difference, not proof of cause.", "看得出變化,但不能證明原因。")
|
|
51
|
+
: L("No visible difference at this precision.", "依顯示精度,前後數字持平。");
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export const eligible = (c: Change) => c.kind === "pin" || c.kind === "model-routing" || (!!c.impact && !c.impact.smallSample);
|
|
55
|
+
export function select(m: ReportModel) {
|
|
56
|
+
const all = [...m.changes].sort((a, b) => b.at.localeCompare(a.at));
|
|
57
|
+
const candidates = all.filter(eligible);
|
|
58
|
+
const recent = candidates.filter((c) => Date.parse(c.at) >= Date.parse(all[0]?.at ?? "") - 7 * 86400000);
|
|
59
|
+
const lead = recent.find((c) =>
|
|
60
|
+
c.package === "pi-anchorloop" && (c.impact?.before.anchor_before_first_edit.n ?? 0) >= 20 &&
|
|
61
|
+
(c.impact?.after.anchor_before_first_edit.n ?? 0) >= 20
|
|
62
|
+
) ??
|
|
63
|
+
candidates.find((c) => c.impact && !c.impact.smallSample) ?? candidates[0];
|
|
64
|
+
const rest = candidates.filter((c) => c !== lead && c.at <= lead.at && (!lead.sha || c.sha !== lead.sha));
|
|
65
|
+
const second = rest.find((c) => c.impact?.smallSample && c.impact.before.sessions && c.impact.after.sessions) ??
|
|
66
|
+
rest.find((c) => (c.kind === "pin" || c.kind === "model-routing") && c.impact && !c.impact.incomplete) ?? rest[0];
|
|
67
|
+
const highlighted = all.filter((c) => c === lead || c === second);
|
|
68
|
+
return { all, lead, highlighted, folded: all.filter((c) => !highlighted.includes(c)) };
|
|
69
|
+
}
|
|
70
|
+
export function finding(c: Change, rs: Reading[], L: Words) {
|
|
71
|
+
const r = rs.find(comparable);
|
|
72
|
+
if (!r) return L("There are not enough records to compare this change", "這次調整還沒有足夠紀錄可比較");
|
|
73
|
+
const dir = value(r, "before") === value(r, "after")
|
|
74
|
+
? L(" held steady", "持平")
|
|
75
|
+
: r.after!.value! > r.before!.value!
|
|
76
|
+
? L(" rose", "上升")
|
|
77
|
+
: L(" fell", "下降");
|
|
78
|
+
const label = r.key === "anchor_before_first_edit" ? L("The share naming a check before editing", "先說驗證方法的比例") : r.label;
|
|
79
|
+
return `${label}${dir}${
|
|
80
|
+
c.impact?.confounded || c.impact?.smallSample || c.impact?.incomplete || Math.min(r.before!.n, r.after!.n) < 20
|
|
81
|
+
? L("; the reason is unclear", ",原因還不明")
|
|
82
|
+
: ""
|
|
83
|
+
}`;
|
|
84
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Rate, ReportModel } from "../model.ts";
|
|
2
|
+
|
|
3
|
+
export type Lang = "en" | "zh";
|
|
4
|
+
export type Words = (en: string, zh: string) => string;
|
|
5
|
+
export type Change = ReportModel["changes"][number];
|
|
6
|
+
export const words = (lang: Lang): Words => (en, zh) => lang === "zh" ? zh : en;
|
|
7
|
+
export const esc = (s: unknown) =>
|
|
8
|
+
String(s ?? "").replace(/[&<>"']/g, (c) => ({ "&": "&", "<": "<", ">": ">", '"': """, "'": "'" })[c]!);
|
|
9
|
+
const formatter = new Intl.NumberFormat("en-US");
|
|
10
|
+
export const num = (n: number) => formatter.format(n);
|
|
11
|
+
export const pct = (r?: Rate) => r?.value != null ? `${(100 * r.value).toFixed(1)}%` : "—";
|
|
12
|
+
export const usd = (v: number | null) => v == null ? "—" : `$${v.toFixed(2)}`;
|
|
13
|
+
export const duration = (v: number | null) =>
|
|
14
|
+
v == null ? "—" : v < 1000 ? `${v} ms` : v < 60_000 ? `${(v / 1000).toFixed(1)} s` : `${(v / 60_000).toFixed(1)} min`;
|
|
15
|
+
export const stamp = (at: string) => `${at.slice(5, 10).replace("-", ".")} ${at.slice(11, 16)}`;
|
|
16
|
+
export const title = (c: Change) => c.package ? `${c.package} ${c.from ?? "∅"} → ${c.to ?? "∅"}` : c.subject;
|
|
17
|
+
/** Cells are text, never markup. */
|
|
18
|
+
export function table(headers: string[], rows: (string | number)[][], L: Words) {
|
|
19
|
+
if (!rows.length) return `<p class="muted">${L("No records in this period.", "這段期間沒有紀錄。")}</p>`;
|
|
20
|
+
const cell = (x: string | number) => esc(typeof x === "number" ? num(x) : x);
|
|
21
|
+
return `<div class="scroll"><table><thead><tr>${headers.map((h) => `<th scope="col">${esc(h)}</th>`).join("")}</tr></thead><tbody>${
|
|
22
|
+
rows.map((r) => `<tr>${r.map((c) => `<td>${cell(c)}</td>`).join("")}</tr>`).join("")
|
|
23
|
+
}</tbody></table></div>`;
|
|
24
|
+
}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import type { ReportModel } from "../model.ts";
|
|
2
|
+
import { type concepts, lesson, selfCheck } from "./concepts.ts";
|
|
3
|
+
import { duration, esc, type Lang, num, pct, table, usd, words } from "./format.ts";
|
|
4
|
+
|
|
5
|
+
export function sections(m: ReportModel, lang: Lang, cards: ReturnType<typeof concepts>) {
|
|
6
|
+
const L = words(lang), meta = m.meta.metrics;
|
|
7
|
+
const label = (id: string) => meta[id].label[lang];
|
|
8
|
+
const T = (head: string[], rows: (number | string)[][]) => table(head, rows, L);
|
|
9
|
+
const section = (id: string, title: string, intro: string, body: string) =>
|
|
10
|
+
`<section id="${id}" class="topic"><p class="eyebrow">PI-EVALS / ${
|
|
11
|
+
L("Field notes", "工作紀錄")
|
|
12
|
+
}</p><h2>${title}</h2><p class="intro">${esc(intro)}</p>${body}</section>`;
|
|
13
|
+
const more = (title: string, html: string) => `<details><summary>${esc(title)}</summary>${html}</details>`;
|
|
14
|
+
const daily = (values: number[]) => T([L("Date (UTC)", "日期(UTC)"), L("Value", "數值")], m.series.days.map((d, i) => [d, values[i]]));
|
|
15
|
+
const entries = (map: Record<string, number>) => Object.entries(map);
|
|
16
|
+
const sk = m.skills, a = m.askUser, mon = m.monitors, s = m.subagents;
|
|
17
|
+
const skills = section(
|
|
18
|
+
"skills",
|
|
19
|
+
L("Which skills got opened?", "哪些技能真的有人打開?"),
|
|
20
|
+
meta.skill_loads.meaning[lang],
|
|
21
|
+
`<div class="pair"><article class="panel"><h3>${L("Most used", "最常載入")}</h3>${
|
|
22
|
+
T([L("Skill", "技能"), L("Loads", "次數"), L("Sessions", "工作段數")], sk.top.slice(0, 8).map((r) => [r.name, r.loads, r.sessions]))
|
|
23
|
+
}</article><article class="panel tint"><h3>${L("Offered but never opened", "有提供,但沒人載入")}</h3><p class="big">${
|
|
24
|
+
num(sk.neverLoaded.length)
|
|
25
|
+
} / ${num(sk.offered)}</p><p>${esc(meta.never_loaded.howComputed[lang])}</p>${
|
|
26
|
+
more(L("Skill names", "看技能名稱"), `<p>${sk.neverLoaded.map(esc).join("、") || "—"}</p>`)
|
|
27
|
+
}</article></div>` +
|
|
28
|
+
more(
|
|
29
|
+
L("Loads by day, project and trigger", "查看每日載入、各專案與載入方式"),
|
|
30
|
+
daily(m.series.skillLoads) +
|
|
31
|
+
T([L("Project", "專案"), L("Skill", "技能"), L("Loads", "次數")], sk.byProject.map((r) => [r.project, r.skill, r.loads])) +
|
|
32
|
+
T([L("Trigger", "方式"), L("Loads", "次數")], entries(sk.triggers)),
|
|
33
|
+
),
|
|
34
|
+
);
|
|
35
|
+
const packages = section(
|
|
36
|
+
"packages",
|
|
37
|
+
L("Packages and tools", "套件與工具"),
|
|
38
|
+
meta.package_calls.meaning[lang],
|
|
39
|
+
T(
|
|
40
|
+
[L("Package", "套件"), L("Version", "版本"), L("Calls", "呼叫次數"), label("tool_error_rate"), label("avg_duration_ms")],
|
|
41
|
+
m.packages.map((r) => [r.owner, r.version ?? "—", r.calls, pct(r.errorRate), duration(r.avgMs)]),
|
|
42
|
+
) +
|
|
43
|
+
more(
|
|
44
|
+
L("Tools by calls", "依呼叫次數查看工具"),
|
|
45
|
+
T(
|
|
46
|
+
[L("Tool", "工具"), L("Package", "套件"), L("Calls", "次數"), label("tool_error_rate")],
|
|
47
|
+
m.tools.map((r) => [r.name, r.owner, r.calls, pct(r.errorRate)]),
|
|
48
|
+
),
|
|
49
|
+
),
|
|
50
|
+
);
|
|
51
|
+
const ask = section(
|
|
52
|
+
"ask",
|
|
53
|
+
L("When the agent stopped to ask", "代理人何時停下來問你"),
|
|
54
|
+
L(
|
|
55
|
+
"See how often you were asked, how long an answer took and how often you dismissed the question.",
|
|
56
|
+
"這裡可以看到代理人問了幾次、答一題平均要等多久,以及你取消了多少提問。",
|
|
57
|
+
),
|
|
58
|
+
T([L("Measure", "指標"), L("Reading", "數值"), L("Counted", "計算次數")], [[label("ask_calls"), a.calls, a.calls], [
|
|
59
|
+
label("ask_wait_ms"),
|
|
60
|
+
duration(a.avgWaitMs),
|
|
61
|
+
a.waitN,
|
|
62
|
+
], [label("ask_cancel_rate"), pct(a.cancelRate), a.cancelRate.n]]) +
|
|
63
|
+
more(
|
|
64
|
+
L("Wait times and answer sources", "查看等待時間分布與回答來源"),
|
|
65
|
+
T(
|
|
66
|
+
[L("Wait", "等待時間"), L("Count", "次數")],
|
|
67
|
+
a.buckets.map((b, i) => [
|
|
68
|
+
b.upToMs == null
|
|
69
|
+
? `≥ ${duration(a.buckets[i - 1]?.upToMs ?? 0)}`
|
|
70
|
+
: `${duration(i ? a.buckets[i - 1].upToMs : 0)} – < ${duration(b.upToMs)}`,
|
|
71
|
+
b.n,
|
|
72
|
+
]),
|
|
73
|
+
) + T([L("Source", "來源"), L("Count", "次數")], entries(a.sources)),
|
|
74
|
+
),
|
|
75
|
+
);
|
|
76
|
+
const monitors = section(
|
|
77
|
+
"monitors",
|
|
78
|
+
L("Background jobs", "背景工作"),
|
|
79
|
+
meta.monitor_outcomes.meaning[lang],
|
|
80
|
+
`<p>${L("Started", "啟動")} ${num(mon.started)} / ${L("Ending recorded", "有結束紀錄")} ${num(mon.finished)} / ${
|
|
81
|
+
label("monitor_duration_ms")
|
|
82
|
+
} ${duration(mon.avgMs)}(${num(mon.durationN)})</p>${
|
|
83
|
+
T([L("Outcome", "結果"), L("Count", "次數")], entries(mon.statuses))
|
|
84
|
+
}<p class="muted">${esc(meta.monitor_outcomes.howComputed[lang])}</p>`,
|
|
85
|
+
);
|
|
86
|
+
const sub = section(
|
|
87
|
+
"subagents",
|
|
88
|
+
L("Work handed to other agents", "交給子代理的工作"),
|
|
89
|
+
meta.subagent_launches.meaning[lang],
|
|
90
|
+
T([L("Role", "角色"), L("Model", "模型"), L("Launches", "啟動次數")], s.launches.slice(0, 40).map((r) => [r.role, r.model, r.n])) +
|
|
91
|
+
more(label("subagent_cost"), T([L("Role", "角色"), L("USD", "美元")], s.costByRole.map((r) => [r.role, usd(r.cost)]))) +
|
|
92
|
+
`<p>${L("Linked to a parent across the index", "整份索引中能對回母工作階段的子代理")}:${num(s.linked)} / ${
|
|
93
|
+
num(s.subagentTotal)
|
|
94
|
+
}</p>`,
|
|
95
|
+
);
|
|
96
|
+
const process = section(
|
|
97
|
+
"process",
|
|
98
|
+
L("Did the agent follow the steps?", "工作有沒有照說好的步驟走?"),
|
|
99
|
+
L(
|
|
100
|
+
`Only sessions starting from ${m.process.eraStart} are judged. Earlier work is not a failure.`,
|
|
101
|
+
`只檢查 ${m.process.eraStart} 起的工作;更早的工作不算失敗。`,
|
|
102
|
+
),
|
|
103
|
+
lesson(cards.check, L) + `<div class="pair checks">${
|
|
104
|
+
m.process.detectors.map((d) => {
|
|
105
|
+
const md = m.meta.detectors[d.name];
|
|
106
|
+
return `<article class="panel"><p class="eyebrow">${L("Code check", "程式檢查")} / ${L("higher is better", "越高越好")}</p><h3>${
|
|
107
|
+
esc(md.label[lang])
|
|
108
|
+
}</h3><p class="big">${pct(d.passRate)} <small>${num(d.pass)} / ${num(d.passRate.n)} ${L("sessions", "段")}</small></p><p>${
|
|
109
|
+
esc(md.howComputed[lang])
|
|
110
|
+
}</p><p><b>${L("Pass", "通過")}</b> ${esc(md.example.pass[lang])}<br><b>${L("Fail", "未通過")}</b> ${
|
|
111
|
+
esc(md.example.fail[lang])
|
|
112
|
+
}</p>${
|
|
113
|
+
more(
|
|
114
|
+
L("By day and version", "查看每日與各版本的通過數"),
|
|
115
|
+
T([L("Day", "日期"), L("Pass", "通過"), L("Fail", "未通過")], d.perDay.map((r) => [r.day, r.pass, r.fail])) +
|
|
116
|
+
T([L("Version", "版本"), L("Pass", "通過"), L("Fail", "未通過")], d.byVersion.map((r) => [r.version, r.pass, r.fail])),
|
|
117
|
+
)
|
|
118
|
+
}</article>`;
|
|
119
|
+
}).join("")
|
|
120
|
+
}</div>` +
|
|
121
|
+
more(
|
|
122
|
+
L("Close-guard reminders", "收尾提醒"),
|
|
123
|
+
T([L("Kind", "種類"), L("Count", "次數")], entries(m.process.notices).map(([k, n]) => [m.meta.notices[k]?.[lang] ?? k, n])),
|
|
124
|
+
),
|
|
125
|
+
);
|
|
126
|
+
const cost = section(
|
|
127
|
+
"cost",
|
|
128
|
+
L("What the work cost", "工作花了多少錢"),
|
|
129
|
+
meta.cost.meaning[lang],
|
|
130
|
+
`<p class="big">${usd(m.cost.total)} <small>USD</small></p><p>${label("cost_per_session")} ${usd(m.cost.perSession.value)}(${
|
|
131
|
+
num(m.cost.perSession.n)
|
|
132
|
+
} ${L("sessions", "段")})</p><p>${esc(meta.skill_cost.meaning[lang])}</p>` +
|
|
133
|
+
T([L("Skill", "技能"), L("USD", "美元"), L("Sessions", "工作段數")], m.cost.bySkill.map((r) => [r.skill, usd(r.cost), r.sessions])) +
|
|
134
|
+
more(
|
|
135
|
+
L("Daily spend and model replies", "查看每日費用與各模型回覆數"),
|
|
136
|
+
daily(m.series.cost) + T([L("Model", "模型"), L("Replies", "回覆數")], m.cost.byModel.map((r) => [r.model, r.replies])),
|
|
137
|
+
),
|
|
138
|
+
);
|
|
139
|
+
const cov = m.coverage;
|
|
140
|
+
const coverage = section(
|
|
141
|
+
"coverage",
|
|
142
|
+
L("When is cleanup safe?", "何時可以開啟清理?"),
|
|
143
|
+
L(
|
|
144
|
+
"Only consider cleanup when all old files match the index, by both file count and bytes. This report never deletes a file.",
|
|
145
|
+
"所有舊檔的大小和修改時間都要和索引相符,未建索引的檔案數和位元組數都歸零,才考慮開啟清理。報表不會刪檔。",
|
|
146
|
+
),
|
|
147
|
+
cov
|
|
148
|
+
? `<p>${L("Inactive days", "閒置天數")} > ${cov.cutDays} / ${L("Files indexed", "已建索引")} ${num(cov.indexed.files)} / ${
|
|
149
|
+
num(cov.old.files)
|
|
150
|
+
}</p><p>${L("Not indexed", "未建索引")}:${num(cov.notIndexed.files)} ${L("files", "個檔案")} · ${
|
|
151
|
+
num(cov.notIndexed.bytes)
|
|
152
|
+
} bytes</p>`
|
|
153
|
+
: `<p>${L("Coverage not measured; keep cleanup off.", "沒有索引覆蓋資料,請勿開啟清理。")}</p>`,
|
|
154
|
+
);
|
|
155
|
+
const labels = section(
|
|
156
|
+
"labels",
|
|
157
|
+
L("Your labels", "你的標記"),
|
|
158
|
+
meta.agreement.meaning[lang],
|
|
159
|
+
m.labels.present && m.labels.n
|
|
160
|
+
? T(
|
|
161
|
+
[L("Check", "檢查"), L("Labelled", "已標記"), L("Agreement", "一致比例")],
|
|
162
|
+
m.labels.agreement.map((r) => [m.meta.detectors[r.detector]?.label[lang] ?? r.detector, r.n, pct(r.rate)]),
|
|
163
|
+
)
|
|
164
|
+
: `<p>${
|
|
165
|
+
L(
|
|
166
|
+
"No labels yet. In phase 2 you will judge sessions yourself and compare your answers with the code checks.",
|
|
167
|
+
"還沒有標記。第二階段會讓你親自判讀工作紀錄,再對照程式與你的判斷是否一致。",
|
|
168
|
+
)
|
|
169
|
+
}</p>`,
|
|
170
|
+
);
|
|
171
|
+
return [
|
|
172
|
+
skills,
|
|
173
|
+
packages,
|
|
174
|
+
ask,
|
|
175
|
+
monitors,
|
|
176
|
+
sub,
|
|
177
|
+
process,
|
|
178
|
+
cost,
|
|
179
|
+
coverage,
|
|
180
|
+
labels,
|
|
181
|
+
section(
|
|
182
|
+
"concepts",
|
|
183
|
+
L("Concepts", "概念"),
|
|
184
|
+
L("Use these five ideas when you read the next report.", "下次讀報表時,可以用這五個概念判讀數字。"),
|
|
185
|
+
`<div class="notes-grid">${Object.values(cards).map((c) => lesson(c, L)).join("")}</div>${selfCheck(L)}`,
|
|
186
|
+
),
|
|
187
|
+
].join("");
|
|
188
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/** Embedded in report.html so the page also works when copied or opened offline. */
|
|
2
|
+
export const css = `
|
|
3
|
+
:root {
|
|
4
|
+
color-scheme:light dark; --bg:#f9faf6; --paper:#fff; --ink:#172e36; --sub:#4f6366;
|
|
5
|
+
--green:#16665c; --line:#cdd8d3; --tint:#e4f1eb; --area:#dceae3; --warm:#855126; --accent:#16665c;
|
|
6
|
+
}
|
|
7
|
+
@media(prefers-color-scheme:dark) { :root {
|
|
8
|
+
--bg:#152320; --paper:#1e302d; --ink:#ebf5ef; --sub:#bdcfc8; --green:#98dcca;
|
|
9
|
+
--line:#465d56; --tint:#243e36; --area:#355348; --warm:#eabc90;
|
|
10
|
+
} }
|
|
11
|
+
* {box-sizing:border-box}
|
|
12
|
+
body {margin:0 auto;max-width:1280px;padding:0 clamp(18px,4.375vw,56px);background:var(--bg);color:var(--ink);
|
|
13
|
+
font:17px/1.58 -apple-system,BlinkMacSystemFont,"PingFang TC","Noto Sans TC","Segoe UI",sans-serif;
|
|
14
|
+
font-variant-numeric:tabular-nums;overflow-wrap:anywhere}
|
|
15
|
+
a,summary {color:var(--green)}
|
|
16
|
+
a:focus-visible,summary:focus-visible {outline:3px solid var(--warm);outline-offset:3px}
|
|
17
|
+
header,.hero,.topic {border-bottom:1px solid var(--line)}
|
|
18
|
+
header,footer,.ends,.ruler-head,.reading {display:flex;align-items:center;justify-content:space-between;gap:12px}
|
|
19
|
+
header {min-height:75px;flex-wrap:wrap}
|
|
20
|
+
.brand {display:flex;align-items:center;gap:12px;text-decoration:none;color:var(--ink);font-size:21px;font-weight:700}
|
|
21
|
+
.brand span {font-size:17px;font-weight:400;padding-left:20px;margin-left:16px;border-left:1px solid var(--line);color:var(--sub)}
|
|
22
|
+
small,.muted,.intro,.deck,.ends {color:var(--sub)}
|
|
23
|
+
small,.muted,.ends,summary,.footline,.button {font-size:15px}
|
|
24
|
+
.hero {padding:36px 0 20px}
|
|
25
|
+
.hero h1,.hero-title {font-size:clamp(29px,3.125vw,40px);line-height:1.25;margin:18px 0}
|
|
26
|
+
.deck,.intro {font-size:19px;margin:0}.hero .deck+.deck {margin-top:24px}
|
|
27
|
+
.eyebrow {font-size:14px;font-weight:650;letter-spacing:1px;color:var(--green);margin:0}
|
|
28
|
+
.stale,.verdict {color:var(--warm)}
|
|
29
|
+
h2 {font-size:25px;line-height:1.35;margin:0 0 14px}
|
|
30
|
+
h3,.big {font-size:29px;line-height:1.35;margin:14px 0 18px}
|
|
31
|
+
.spine {padding-top:25px}
|
|
32
|
+
.layout {display:grid;grid-template-columns:minmax(0,709fr) minmax(0,419fr);gap:40px;align-items:start}
|
|
33
|
+
.rail {position:relative;padding-left:54px}
|
|
34
|
+
.rail:before {content:"";position:absolute;left:22px;top:20px;bottom:20px;border-left:2px solid var(--line)}
|
|
35
|
+
.card,.panel,.lesson {background:var(--paper);border:1px solid var(--line);border-radius:12px;padding:22px 25px}
|
|
36
|
+
.card {position:relative;padding-block:19px 17px}.card+.card {margin-top:30px}
|
|
37
|
+
.card:before,.ruler i {width:10px;height:10px;background:var(--green);border:3px solid var(--bg);outline:2px solid var(--green);border-radius:50%}
|
|
38
|
+
.card:before {content:"";position:absolute;left:-37px;top:31px}
|
|
39
|
+
.card h3 {margin:9px 0 14px}.reading {line-height:1.45;margin:12px 0}.card .reading {margin:9px 0}
|
|
40
|
+
.reading b {font-size:18px}.reading small {flex-shrink:0}.card .muted {margin:9px 0}
|
|
41
|
+
.button {display:inline-block;padding:9px 22px;border-radius:8px;background:var(--accent);color:white;text-decoration:none;margin-top:3px;min-width:156px;text-align:center}
|
|
42
|
+
.workload h2 {margin-bottom:0}.workload h3 {margin:25px 0 12px}.workload .muted {margin:5px 0}
|
|
43
|
+
.workload svg {width:100%;height:auto;display:block;margin-top:8px}
|
|
44
|
+
.area {fill:var(--area)}.trend {stroke:var(--green);stroke-width:2.5;stroke-linejoin:round;fill:none}
|
|
45
|
+
.marker {stroke:var(--warm);stroke-dasharray:3 4}.dot {fill:var(--green)}.ends {margin:4px 0}
|
|
46
|
+
.footline {border-top:1px solid var(--line);padding-top:13px;margin:12px 0 0}
|
|
47
|
+
.lesson,.tint,.after {background:var(--tint)}.lesson {padding:16px 19px}.lesson p {margin:5px 0 0}.side>.lesson {margin-top:16px}
|
|
48
|
+
.topic {padding:38px 0}.topic h2 {margin:9px 0}.intro {margin:0 0 18px}
|
|
49
|
+
.jump {display:flex;flex-wrap:wrap;gap:8px 18px;padding:20px 0;border-block:1px solid var(--line);margin:32px 0 0}
|
|
50
|
+
.day li {margin:.45rem 0}.day time {color:var(--sub)}details {margin:12px 0}summary {cursor:pointer;font-weight:600}
|
|
51
|
+
.scroll {overflow-x:auto}table {width:100%;border-collapse:collapse;margin:.4rem 0;background:var(--paper)}
|
|
52
|
+
th,td {text-align:start;padding:7px 12px;border-bottom:1px solid var(--line)}th {font-size:15px;color:var(--green)}
|
|
53
|
+
.pair,.notes-grid {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:20px}
|
|
54
|
+
.checks {margin-top:18px}.checks h3,.topic .panel h3 {font-size:22px}
|
|
55
|
+
.detail {display:none;padding-bottom:24px;scroll-margin-top:75px}.detail:target {display:block;outline:none}
|
|
56
|
+
body:has(.detail:target) main {display:none}.back {float:right;font-size:15px}
|
|
57
|
+
.ruler-head {margin:30px 0 24px}.ruler-head h2 {margin:0}
|
|
58
|
+
.ruler {position:relative;list-style:none;margin:0 0 30px;padding:0;height:86px}
|
|
59
|
+
.ruler:before,.ruler.partial:after {content:"";position:absolute;top:39px;left:6%;right:6%;height:2px;background:var(--green)}
|
|
60
|
+
.ruler.partial:after {left:65.5%;right:6.5%;background:var(--bg);border-top:2px dashed var(--line)}
|
|
61
|
+
.ruler li {position:absolute;width:118px;transform:translateX(-50%);text-align:center;font-size:15px;color:var(--sub)}
|
|
62
|
+
.ruler li:first-child {left:6%}.ruler li:nth-child(2) {left:50%}.ruler li:nth-child(3) {left:65%}.ruler li:last-child {left:94%}
|
|
63
|
+
.ruler time {color:var(--green);white-space:nowrap}.ruler i {display:block;position:relative;margin:11px auto}
|
|
64
|
+
.compare h3 {border-bottom:1px solid var(--line);padding-bottom:12px}.compare .reading {min-height:32px}.detail>.eyebrow {margin-bottom:8px}
|
|
65
|
+
.notes-grid {margin:16px 0}.notes-grid .lesson {font-size:16px}
|
|
66
|
+
footer {font-size:14px;margin-top:24px;padding:18px 0 25px;color:var(--sub);border-top:1px solid var(--line)}
|
|
67
|
+
@media(max-width:850px) {
|
|
68
|
+
.layout,.pair,.notes-grid {grid-template-columns:1fr}.layout {gap:22px}.rail {padding-left:27px}.rail:before {left:7px}.card:before {left:-26px}
|
|
69
|
+
.reading {flex-wrap:wrap}.ruler-head,footer {align-items:flex-start;flex-direction:column}
|
|
70
|
+
}
|
|
71
|
+
@media(max-width:640px) {
|
|
72
|
+
header {padding:12px 0;gap:5px}.hero {padding:24px 0}.brand span {margin-left:4px;padding-left:10px}
|
|
73
|
+
.card,.panel {padding:16px}.ruler {height:auto}.ruler:before,.ruler:after,.ruler li i {display:none}
|
|
74
|
+
.ruler li {position:static;width:auto;transform:none;display:flex;align-items:center;gap:8px;text-align:left}
|
|
75
|
+
.card h3 {font-size:23px}.back {float:none;display:block;margin-bottom:8px}
|
|
76
|
+
}
|
|
77
|
+
`;
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import type { ReportModel } from "../model.ts";
|
|
2
|
+
import { concepts, lesson } from "./concepts.ts";
|
|
3
|
+
import { finding, type Reading, readings, select, value, verdict } from "./findings.ts";
|
|
4
|
+
import { type Change, esc, type Lang, num, stamp, title, type Words, words } from "./format.ts";
|
|
5
|
+
import type { Week } from "./week.ts";
|
|
6
|
+
|
|
7
|
+
function card(c: Change, id: string, rs: Reading[], L: Words) {
|
|
8
|
+
const i = c.impact;
|
|
9
|
+
return `<article class="card"><p class="eyebrow"><time datetime="${esc(c.at)}">${esc(stamp(c.at))} UTC</time></p><h3>${
|
|
10
|
+
esc(title(c))
|
|
11
|
+
}</h3>${
|
|
12
|
+
rs.map((r) =>
|
|
13
|
+
`<div class="reading"><b>${esc(r.label)} ${value(r, "before")} → ${value(r, "after")}</b><small>${num(r.before?.n ?? 0)} → ${
|
|
14
|
+
num(r.after?.n ?? 0)
|
|
15
|
+
} ${r.unit}</small></div>`
|
|
16
|
+
).join("")
|
|
17
|
+
}<p class="muted">${
|
|
18
|
+
rs[0].direction === rs[1].direction
|
|
19
|
+
? L(`Both: ${rs[0].direction}.`, `兩項都${rs[0].direction}。`)
|
|
20
|
+
: rs.map((r) => `${r.label}:${r.direction}`).join(" · ")
|
|
21
|
+
}${i ? ` ${num(i.before.sessions)} → ${num(i.after.sessions)} ${L("sessions.", "段工作。")}` : ""}<br><span class="verdict">${
|
|
22
|
+
esc(verdict(c, rs, L))
|
|
23
|
+
}</span></p><a class="button" href="#${id}">${L("Change details", "看調整明細")} →</a></article>`;
|
|
24
|
+
}
|
|
25
|
+
function ruler(c: Change, last: string | null, L: Words) {
|
|
26
|
+
const i = c.impact!;
|
|
27
|
+
const cutoff = last && last > c.at && last < i.window.after.until ? last : null;
|
|
28
|
+
const points = [
|
|
29
|
+
[i.window.before.since, L("Before starts", "開始算調整前")],
|
|
30
|
+
[c.at, L("Change", "做了調整")],
|
|
31
|
+
...(cutoff ? [[cutoff, L("Last extract", "資料截至這裡")]] : []),
|
|
32
|
+
[i.window.after.until, L("After window ends", "調整後期間結束")],
|
|
33
|
+
];
|
|
34
|
+
return `<div class="ruler-head"><h2>${
|
|
35
|
+
L(`Compare ${i.window.days} days on each side`, `同一條規則,前後各看 ${i.window.days} 天`)
|
|
36
|
+
}</h2><small>${L("Grouped by start time · not to scale", "依工作開始時間分組 / 時間線不按比例繪製")}</small></div><ol class="ruler${
|
|
37
|
+
cutoff ? " partial" : ""
|
|
38
|
+
}">${points.map(([at, text]) => `<li><time>${esc(stamp(at))}</time><i></i><span>${text}</span></li>`).join("")}</ol>`;
|
|
39
|
+
}
|
|
40
|
+
function panel(c: Change, side: "before" | "after", rs: Reading[], period: string, L: Words) {
|
|
41
|
+
const i = c.impact!;
|
|
42
|
+
return `<article class="panel compare ${side}"><p class="eyebrow">${
|
|
43
|
+
side === "before" ? L("Before", "調整前") : L("After", "調整後")
|
|
44
|
+
} / ${esc(period)}</p><h3>${num(i[side].sessions)} ${L("sessions", "段工作")}</h3>${
|
|
45
|
+
rs.map((r) => {
|
|
46
|
+
const x = r[side];
|
|
47
|
+
const sample = x?.value != null
|
|
48
|
+
? (r.key === "cost_per_session" ? `${num(x.n)} ${r.unit}` : `${num(Math.round(x.value * x.n))} / ${num(x.n)} ${r.unit}`)
|
|
49
|
+
: L("no eligible records", "沒有適用紀錄");
|
|
50
|
+
return `<div class="reading"><span>${esc(r.label)}</span><b>${value(r, side)} <small>(${sample})</small></b></div>`;
|
|
51
|
+
}).join("")
|
|
52
|
+
}</article>`;
|
|
53
|
+
}
|
|
54
|
+
function detail(c: Change, id: string, rs: Reading[], m: ReportModel, w: Week, lang: Lang, siblings: Change[]) {
|
|
55
|
+
const L = words(lang), i = c.impact, lessons = concepts(m, w, c, L);
|
|
56
|
+
const peers = siblings.filter((s) => s !== c);
|
|
57
|
+
const together = peers.length
|
|
58
|
+
? L(
|
|
59
|
+
`Same commit: ${peers.map((s) => s.package ?? m.meta.changeKinds[s.kind][lang]).join(", ")}.`,
|
|
60
|
+
`同一次提交也調整了 ${peers.map((s) => s.package ?? m.meta.changeKinds[s.kind][lang]).join("、")}。`,
|
|
61
|
+
)
|
|
62
|
+
: "";
|
|
63
|
+
const primary = rs[0];
|
|
64
|
+
const age = (Date.parse(m.freshness.lastExtract ?? "") - Date.parse(c.at)) / 3600000;
|
|
65
|
+
const partial = i?.incomplete && age >= 0 && age < i.window.days * 24;
|
|
66
|
+
const ageText = age < 1 ? L("less than an hour", "不到一小時") : L(`about ${Math.floor(age)} hours`, `約 ${Math.floor(age)} 小時`);
|
|
67
|
+
const heading = partial ? L(`Only ${ageText} since the change: too early to tell`, `調整後${ageText},還看不出效果`) : verdict(c, rs, L);
|
|
68
|
+
const fullPeriod = L(`${i?.window.days} days`, `${i?.window.days} 天`);
|
|
69
|
+
const beforePeriod = i?.incomplete ? L(`Planned: ${fullPeriod}`, `原定 ${fullPeriod}`) : fullPeriod;
|
|
70
|
+
return `<section class="detail" id="${id}" tabindex="-1"><div class="hero"><a class="back" href="#timeline">← ${
|
|
71
|
+
L("Timeline", "回時間軸")
|
|
72
|
+
}</a><p class="eyebrow">${L("Architecture change", "架構調整明細")} / ${esc(stamp(c.at))} UTC</p><h2 class="hero-title">${
|
|
73
|
+
esc(heading)
|
|
74
|
+
}</h2><p class="deck">${esc(title(c))} ${esc(together)}</p>${
|
|
75
|
+
i
|
|
76
|
+
? `<p class="deck">${esc(primary.label)}:${value(primary, "before")} → ${value(primary, "after")}。 ${esc(verdict(c, rs, L))}</p>`
|
|
77
|
+
: ""
|
|
78
|
+
}</div>
|
|
79
|
+
${
|
|
80
|
+
i
|
|
81
|
+
? `${ruler(c, m.freshness.lastExtract, L)}<p class="eyebrow">${L("Records side by side", "紀錄對照")}</p><h2>${
|
|
82
|
+
L("Compare the two groups", "比較兩個時段的工作")
|
|
83
|
+
}</h2><div class="pair">${panel(c, "before", rs, beforePeriod, L)}${
|
|
84
|
+
panel(c, "after", rs, partial ? ageText : fullPeriod, L)
|
|
85
|
+
}</div><p>${rs.map((r) => `${esc(r.label)}:${r.direction}`).join(" / ")}</p>`
|
|
86
|
+
: ""
|
|
87
|
+
}
|
|
88
|
+
<div class="notes-grid">${lesson(lessons.sample, L)}${lesson(lessons.confounding, L)}${
|
|
89
|
+
c.package === "pi-anchorloop" ? lesson(lessons.check, L) : ""
|
|
90
|
+
}</div><p class="muted">${esc(c.repo)} ${esc(c.sha)} ${esc(c.subject)}</p><a href="#timeline">← ${
|
|
91
|
+
L("Timeline", "回時間軸")
|
|
92
|
+
}</a></section>`;
|
|
93
|
+
}
|
|
94
|
+
export function timeline(m: ReportModel, w: Week, lang: Lang) {
|
|
95
|
+
const L = words(lang), { all, lead, highlighted, folded } = select(m);
|
|
96
|
+
const ids = new Map(all.map((c, i) => [c, `change-${i + 1}`]));
|
|
97
|
+
const metrics = new Map(all.map((c) => [c, readings(c, m, lang)]));
|
|
98
|
+
const byDay = new Map<string, Change[]>(), byCommit = new Map<string, Change[]>();
|
|
99
|
+
for (const c of folded) {
|
|
100
|
+
const d = c.at.slice(0, 10);
|
|
101
|
+
if (!byDay.has(d)) byDay.set(d, []);
|
|
102
|
+
byDay.get(d)!.push(c);
|
|
103
|
+
}
|
|
104
|
+
for (const c of all) {
|
|
105
|
+
if (c.sha) {
|
|
106
|
+
const key = `${c.repo}/${c.sha}`;
|
|
107
|
+
if (!byCommit.has(key)) byCommit.set(key, []);
|
|
108
|
+
byCommit.get(key)!.push(c);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
const headline = lead
|
|
112
|
+
? finding(lead, metrics.get(lead)!, L)
|
|
113
|
+
: all.length
|
|
114
|
+
? L("Not enough sessions to compare changes yet", "這批調整的工作段數還不夠比較")
|
|
115
|
+
: L("No changes recorded in this period", "這段期間沒有調整紀錄");
|
|
116
|
+
const reason = lead?.impact;
|
|
117
|
+
const trust = lead && reason?.incomplete && reason.confounded && !reason.smallSample
|
|
118
|
+
? L(
|
|
119
|
+
`There were ${
|
|
120
|
+
num(reason.confounded)
|
|
121
|
+
} other changes, and one side has less than ${reason.window.days} days of data. We cannot credit this change alone.`,
|
|
122
|
+
`同期還有 ${num(reason.confounded)} 筆別的調整,一側的資料也未滿 ${reason.window.days} 天;目前不能把差異歸給這次調整。`,
|
|
123
|
+
)
|
|
124
|
+
: lead
|
|
125
|
+
? verdict(lead, metrics.get(lead)!, L)
|
|
126
|
+
: L(
|
|
127
|
+
`There are ${num(m.totals.sessions)} sessions in this report, but no eligible comparison.`,
|
|
128
|
+
`報表收錄 ${num(m.totals.sessions)} 段工作,目前沒有適合放在首頁的比較。`,
|
|
129
|
+
);
|
|
130
|
+
return {
|
|
131
|
+
lead,
|
|
132
|
+
headline,
|
|
133
|
+
trust,
|
|
134
|
+
count: highlighted.length,
|
|
135
|
+
cards: highlighted.map((c) => card(c, ids.get(c)!, metrics.get(c)!, L)).join(""),
|
|
136
|
+
archive: [...byDay].map(([day, list]) =>
|
|
137
|
+
`<details class="day"><summary>${esc(day)} / ${num(list.length)} ${L("changes", "筆調整")}</summary><ul>${
|
|
138
|
+
list.map((c) => `<li><time>${esc(c.at.slice(11, 16))}</time> <a href="#${ids.get(c)}">${esc(title(c))}</a></li>`).join("")
|
|
139
|
+
}</ul></details>`
|
|
140
|
+
).join(""),
|
|
141
|
+
details: all.map((c) => detail(c, ids.get(c)!, metrics.get(c)!, m, w, lang, byCommit.get(`${c.repo}/${c.sha}`) ?? [])).join(""),
|
|
142
|
+
};
|
|
143
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { ReportModel } from "../model.ts";
|
|
2
|
+
import { esc, num, type Words } from "./format.ts";
|
|
3
|
+
|
|
4
|
+
/** Last seven calendar days ending on the last complete UTC day in the selected period. */
|
|
5
|
+
export function week(m: ReportModel) {
|
|
6
|
+
const last = m.freshness.lastExtract?.slice(0, 10);
|
|
7
|
+
if (!last || !m.window.until || !m.window.since) return [];
|
|
8
|
+
const end = Math.min(Date.parse(last) - 86400000, Date.parse(m.window.until));
|
|
9
|
+
const rows = [];
|
|
10
|
+
for (let t = Math.max(end - 6 * 86400000, Date.parse(m.window.since)); t <= end; t += 86400000) {
|
|
11
|
+
const day = new Date(t).toISOString().slice(0, 10), i = m.series.days.indexOf(day);
|
|
12
|
+
rows.push({
|
|
13
|
+
day,
|
|
14
|
+
sessions: m.series.sessions[i] ?? 0,
|
|
15
|
+
calls: m.series.toolCalls[i] ?? 0,
|
|
16
|
+
loads: m.series.skillLoads[i] ?? 0,
|
|
17
|
+
changes: m.changes.filter((c) => c.at.startsWith(day)).length,
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return rows;
|
|
21
|
+
}
|
|
22
|
+
export type Week = ReturnType<typeof week>;
|
|
23
|
+
export function workload(rows: Week, L: Words) {
|
|
24
|
+
const heading = `<h2>${L("This week’s workload", "這週的工作量")}</h2>`;
|
|
25
|
+
if (!rows.length) return `<div class="panel">${heading}<p>${L("No complete recorded day yet.", "尚無完整一天的紀錄。")}</p></div>`;
|
|
26
|
+
const total = (key: "sessions" | "calls" | "loads") => num(rows.reduce((n, r) => n + r[key], 0));
|
|
27
|
+
const max = Math.max(1, ...rows.map((r) => r.sessions));
|
|
28
|
+
const points = rows.map((r, i) => [5 + i * 348 / Math.max(1, rows.length - 1), 89 - 64 * r.sessions / max]);
|
|
29
|
+
const line = points.map((p) => p.join(",")).join(" ");
|
|
30
|
+
const md = (d: string) => d.slice(5).replace("-", ".");
|
|
31
|
+
const desc = rows.map((r) => `${r.day}: ${num(r.sessions)} ${L("sessions", "段工作")} · ${r.changes} ${L("changes", "筆調整")}`).join(
|
|
32
|
+
"; ",
|
|
33
|
+
);
|
|
34
|
+
return `<div class="panel workload">${heading}<p class="muted">${md(rows[0].day)}–${md(rows.at(-1)!.day)} / ${
|
|
35
|
+
L("Volume is not quality", "多寡不代表好壞")
|
|
36
|
+
}</p><h3>${total("sessions")} ${L("sessions", "段工作")}</h3><p class="muted">${
|
|
37
|
+
L("Sessions per day · dashes mark changes", "每日工作段數 · 虛線表示當天有調整")
|
|
38
|
+
}</p>
|
|
39
|
+
<svg role="img" aria-label="${esc(desc)}" viewBox="0 0 358 96"><polygon points="5,89 ${line} ${
|
|
40
|
+
points.at(-1)![0]
|
|
41
|
+
},89" class="area"/><polyline points="${line}" class="trend"/>${
|
|
42
|
+
points.map(([x, y], i) =>
|
|
43
|
+
rows[i].changes
|
|
44
|
+
? `<path d="M${x} 12V89" class="marker"/><circle cx="${x}" cy="${y}" r="3.5" class="dot"><title>${esc(rows[i].day)}: ${
|
|
45
|
+
rows[i].changes
|
|
46
|
+
} ${L("changes", "筆調整")}</title></circle>`
|
|
47
|
+
: ""
|
|
48
|
+
).join("")
|
|
49
|
+
}</svg>
|
|
50
|
+
<div class="ends"><span>${md(rows[0].day)} ${num(rows[0].sessions)}</span><span>${md(rows.at(-1)!.day)} ${
|
|
51
|
+
num(rows.at(-1)!.sessions)
|
|
52
|
+
}</span></div><p class="footline">${L("Tool calls", "工具呼叫")} ${total("calls")} / ${L("Skill loads", "讀取技能")} ${
|
|
53
|
+
total("loads")
|
|
54
|
+
}</p></div>`;
|
|
55
|
+
}
|