返回 CodeWhale
native-terminal.ts
根目录 / web / lib / content / native-terminal.ts
1 import type { LocalizedText } from "./vocabulary";
2 import { pickText } from "@/lib/i18n/dictionaries";
3
4 type Rows = readonly [number, number];
5
6 export const NATIVE_TERMINAL_VIEWS = [
7 {
8 id: "launch",
9 wide: "cols100/00-launch",
10 narrow: "cols48/00-launch",
11 wideRows: [5, 30] as Rows,
12 label: { en: "First launch", zh: "首次启动" },
13 description: {
14 en: "Run codewhale in a git repository. On first launch no model is connected yet, and nothing asks you to sign in.",
15 zh: "在 git 仓库中运行 codewhale。首次启动时尚未连接模型,也不会要求你登录。",
16 },
17 },
18 {
19 id: "model",
20 wide: "cols100/01-model-picker",
21 narrow: "cols48/01-model-picker",
22 label: { en: "Model", zh: "模型" },
23 description: {
24 en: "The model picker, searched for qwen3, lists the same model family across local Ollama and hosted providers.",
25 zh: "在模型选择器中搜索 qwen3,会列出本地 Ollama 与多个托管提供商的同系列模型。",
26 },
27 },
28 {
29 id: "edit",
30 wide: "cols100/03-task-diff",
31 narrow: "cols48/03-task-diff",
32 label: { en: "Edit", zh: "编辑" },
33 description: {
34 en: "qwen3:4b read the files and edited ls.py. Accept Edits applied the edit and shows the diff.",
35 zh: "qwen3:4b 读取文件并编辑了 ls.py。Accept Edits 模式直接应用了修改,并显示差异。",
36 },
37 },
38 {
39 id: "approval",
40 wide: "cols100/04-task-approval",
41 narrow: "cols48/04-task-approval",
42 label: { en: "Approval", zh: "审批" },
43 description: {
44 en: "The test command waits for your answer before it runs.",
45 zh: "测试命令在运行前等待你的回答。",
46 },
47 },
48 {
49 id: "result",
50 wide: "cols100/05-task-result",
51 narrow: "cols48/05-task-result",
52 label: { en: "Result", zh: "结果" },
53 description: {
54 en: "After you allowed it once, the tests ran and passed, and the model summarized what it changed.",
55 zh: "你允许一次后,测试运行并通过,模型总结了它所做的修改。",
56 },
57 },
58 {
59 id: "receipt",
60 wide: "cols56/06b-receipt-tall",
61 narrow: "cols48/06b-receipt-tall",
62 wideRows: [6, 37] as Rows,
63 narrowRows: [2, 34] as Rows,
64 label: { en: "Receipt", zh: "回执" },
65 description: {
66 en: "/receipts lists the file it changed, the command it ran, who approved it and the tokens it used.",
67 zh: "/receipts 列出它修改的文件、运行的命令、由谁批准以及使用的 token。",
68 },
69 },
70 ] as const satisfies readonly {
71 id: string;
72 wide: string;
73 narrow: string;
74 wideRows?: Rows;
75 narrowRows?: Rows;
76 label: LocalizedText;
77 description: LocalizedText;
78 }[];
79
80 export const NATIVE_TERMINAL_COPY = {
81 title: { en: "Explore the terminal", zh: "探索终端界面" },
82 description: {
83 en: "These views come from real sessions on the published 0.10.4 release: qwen3:4b through local Ollama, in Accept Edits.",
84 zh: "这些画面来自真实会话,运行在已发布的 0.10.4 版本上:通过本地 Ollama 使用 qwen3:4b,处于 Accept Edits 模式。",
85 },
86 viewsLabel: { en: "Terminal views", zh: "终端视图" },
87 } satisfies Record<string, LocalizedText>;
88
89 export function getNativeTerminalCopy(locale: string) {
90 return {
91 title: pickText(NATIVE_TERMINAL_COPY.title, locale),
92 description: pickText(NATIVE_TERMINAL_COPY.description, locale),
93 viewsLabel: pickText(NATIVE_TERMINAL_COPY.viewsLabel, locale),
94 views: NATIVE_TERMINAL_VIEWS.map((view) => ({
95 ...view,
96 label: pickText(view.label, locale),
97 description: pickText(view.description, locale),
98 })),
99 };
100 }
101
101 lines TYPESCRIPT