返回 CodeWhale
thinking-trace.tsx
根目录 / web / components / thinking-trace.tsx
1 import { getConstitution, pickText } from "@/lib/i18n/dictionaries";
2 import { Icon } from "./icon";
3 /**
4 * "See how it decides" — explanatory prose that illustrates how the
5 * constitution's rank shows up in a model's reasoning, paired with the
6 * decision each line of reasoning led to.
7 *
8 * These are ILLUSTRATIONS, labelled as such on the page: short paraphrases
9 * of the kind of reasoning the rank produces, not a transcript of one cited
10 * session. If a real, linkable session transcript is ever published, cite it
11 * here and change the label; until then, never present these as captured
12 * output (see AGENTS.md Article II).
13 */
14
15 export type Scene = {
16 /** Short tab label for players that show one scene at a time. */
17 tab: { en: string; zh: string };
18 context: { en: string; zh: string };
19 trace: string;
20 cites: string[];
21 decision: { en: string; zh: string };
22 };
23
24 export const SCENES: Scene[] = [
25 {
26 tab: { en: "Stale handoff", zh: "过期交接" },
27 context: {
28 en: "When the prior session's summary didn't match the repo…",
29 zh: "当上一会话的总结与仓库真实状态不符时……",
30 },
31 trace:
32 "Per Article II (truth) and V (verification), I report what's actually in the tree — not what the previous agent claimed.",
33 cites: ["Article II · Truth", "Article V · Verification"],
34 decision: {
35 en: "Reported the uncommitted work the summary left out, instead of repeating the claim.",
36 zh: "如实报告了总结遗漏的未提交改动,而不是照搬旧说法。",
37 },
38 },
39 {
40 tab: { en: "Conflicting orders", zh: "指令冲突" },
41 context: {
42 en: "When a “pause” signal conflicted with the user's request to continue…",
43 zh: "当「暂停」信号与用户要求继续相冲突时……",
44 },
45 trace:
46 "The user's current request outranks the runtime statute — so I keep executing the task, not stopping on a technicality.",
47 cites: ["Article III · User agency", "Article VII · Hierarchy"],
48 decision: {
49 en: "Finished the work the user actually asked for.",
50 zh: "完成了用户真正要求的工作。",
51 },
52 },
53 {
54 tab: { en: "Community credit", zh: "社区署名" },
55 context: {
56 en: "When trimming the README, tempted to drop the contributor wall…",
57 zh: "精简 README 时,本可删掉贡献者名单……",
58 },
59 trace:
60 "Deleting community credit would break the project's own ethos. Relocate it instead — zero names lost.",
61 cites: ["Community ethos"],
62 decision: {
63 en: "Moved 200 lines of credits to docs/CONTRIBUTORS.md and linked from the README.",
64 zh: "把 200 行贡献记录迁到 docs/CONTRIBUTORS.md,并在 README 中给出链接。",
65 },
66 },
67 ];
68
69 export function ThinkingTrace({ locale = "en" }: { locale?: string }) {
70 const t = getConstitution(locale);
71 return (
72 <div className="grid-3">
73 {SCENES.map((s, i) => (
74 <figure key={i} className="trace">
75 <figcaption className="trace-head">
76 <span className="status status-accent">
77 <span className="status-dot" aria-hidden="true" />
78 {t.illustration}
79 </span>
80 <span className="trace-context">{pickText(s.context, locale)}</span>
81 </figcaption>
82 <p className="trace-body">{s.trace}</p>
83 <p className="trace-cites">
84 {s.cites.map((c) => (
85 <span key={c} className="pill">{c}</span>
86 ))}
87 </p>
88 <p className="trace-decision">
89 <Icon name="arrow-right" className="icon icon-flip" />
90 <span>{pickText(s.decision, locale)}</span>
91 </p>
92 </figure>
93 ))}
94 </div>
95 );
96 }
97
97 lines Plain Text