| 1 | /** |
| 2 | * vocabulary.ts — shared, locale-aware product vocabulary for codewhale.net. |
| 3 | * |
| 4 | * This module is the single source of truth for the exact product nouns a new |
| 5 | * user meets on the site: the Fleet/Workflow/Lane/Runtime execution nouns, |
| 6 | * the Plan/Work and permission-posture vocabulary, the |
| 7 | * public Advisor role, and the fields that make route provenance legible. |
| 8 | * |
| 9 | * TRUTH CONTRACT: |
| 10 | * - `short.en` for every product term MUST equal the verbatim definition in |
| 11 | * docs/public-surface-facts.json → product.terminology, which is itself |
| 12 | * pinned verbatim against docs/FLEET.md by public-surface-contract.test.ts. |
| 13 | * - Mode and posture names MUST equal matrix.control.modes / |
| 14 | * matrix.control.permissionPostures (pinned against docs/MODES.md). |
| 15 | * - No marketing adjectives. Each description states behavior and boundary. |
| 16 | * |
| 17 | * EXTENSION PATH FOR NEW LOCALES (localization lane): |
| 18 | * Shared text requires English and Chinese and accepts additional locale |
| 19 | * keys. Migrated content loads those keys from the shared dictionaries; |
| 20 | * untranslated content retains its English fallback. |
| 21 | */ |
| 22 | |
| 23 | import type { CapabilityContext } from "../capabilities"; |
| 24 | import { showsReleasedText, sourcePlacement, type SourcePlacement } from "../docs-release"; |
| 25 | import { FEATURE_CATALOGUE, type Feature } from "../features"; |
| 26 | |
| 27 | export interface LocalizedText { |
| 28 | en: string; |
| 29 | zh: string; |
| 30 | [locale: string]: string | undefined; |
| 31 | } |
| 32 | |
| 33 | export interface ProductTerm { |
| 34 | /** The exact product noun. Never translate the noun itself. */ |
| 35 | term: "Fleet" | "Workflow" | "Lane" | "Runtime"; |
| 36 | /** One-line definition; `en` is verbatim from docs/public-surface-facts.json. */ |
| 37 | short: LocalizedText; |
| 38 | /** One-sentence elaboration used on docs pages. */ |
| 39 | long: LocalizedText; |
| 40 | } |
| 41 | |
| 42 | export const PRODUCT_TERMS: ProductTerm[] = [ |
| 43 | { |
| 44 | term: "Fleet", |
| 45 | short: { |
| 46 | en: "the user's model inventory: who is in the roster and which member is selected", |
| 47 | zh: "用户的模型清单:花名册中有哪些成员,以及选中了哪一位", |
| 48 | }, |
| 49 | long: { |
| 50 | en: "Fleet records member IDs and names, semantic roles, provider/model identities, and roster state.", |
| 51 | zh: "Fleet 记录成员 ID 和名称、语义角色、提供商/模型身份以及花名册状态。", |
| 52 | }, |
| 53 | }, |
| 54 | { |
| 55 | term: "Workflow", |
| 56 | short: { en: "what order the work follows", zh: "工作按什么顺序进行" }, |
| 57 | long: { |
| 58 | en: "What order the work follows: phases, gates, budgets, replay, and fan-in.", |
| 59 | zh: "工作按什么顺序进行:阶段、门禁、预算、回放和汇总。", |
| 60 | }, |
| 61 | }, |
| 62 | { |
| 63 | term: "Lane", |
| 64 | short: { en: "one running Workflow instance", zh: "一个正在运行的 Workflow 实例" }, |
| 65 | long: { |
| 66 | en: "One running Workflow instance and its live progress.", |
| 67 | zh: "一个正在运行的 Workflow 实例及其实时进度。", |
| 68 | }, |
| 69 | }, |
| 70 | { |
| 71 | term: "Runtime", |
| 72 | short: { |
| 73 | en: "where, how, and with what authority selected work executes", |
| 74 | zh: "选定工作在哪里、如何以及以何种权限执行", |
| 75 | }, |
| 76 | long: { |
| 77 | en: "Runtime owns the local or remote process, provider route, project/workspace trust, filesystem, network, secrets, approvals, sandbox, tools, and API boundary.", |
| 78 | zh: "Runtime 负责本地或远程进程、提供商路由、项目/工作区信任、文件系统、网络、密钥、审批、沙箱、工具和 API 边界。", |
| 79 | }, |
| 80 | }, |
| 81 | ]; |
| 82 | |
| 83 | export interface ControlTerm { |
| 84 | /** The exact control noun. Never translate the noun itself. */ |
| 85 | term: string; |
| 86 | kind: "mode" | "permission-posture"; |
| 87 | /** Behavioral description aligned with docs/MODES.md. */ |
| 88 | description: LocalizedText; |
| 89 | } |
| 90 | |
| 91 | export const MODES_CLAIM = { feature: "modes", describesCurrentRow: true } as const; |
| 92 | export const POSTURES_CLAIM = { feature: "permission-postures", describesCurrentRow: true } as const; |
| 93 | |
| 94 | export const RELEASED_CONTROL_MODES: ControlTerm[] = [ |
| 95 | { |
| 96 | term: "Plan", |
| 97 | kind: "mode", |
| 98 | description: { |
| 99 | en: "Plan permits workspace inspection and policy-allowed research, but refuses file mutation and shell execution.", |
| 100 | zh: "Plan 允许检查工作区和进行策略许可的研究,但拒绝文件修改与 shell 执行。", |
| 101 | }, |
| 102 | }, |
| 103 | { |
| 104 | term: "Work", |
| 105 | kind: "mode", |
| 106 | description: { |
| 107 | en: "Work uses tools across multiple steps under the active permissions, sandbox and repository rules.", |
| 108 | zh: "Work 在当前权限、沙箱和仓库规则下分多步使用工具。", |
| 109 | }, |
| 110 | }, |
| 111 | { |
| 112 | term: "Operate", |
| 113 | kind: "mode", |
| 114 | description: { |
| 115 | en: "Operate has the same tools and authority as Work, and leans toward delegating multi-part work to parallel agents and checking results before the work is called done.", |
| 116 | zh: "Operate 的工具和权限与 Work 相同,但更倾向于把多部分任务交给并行智能体,并在宣布完成前检查结果。", |
| 117 | }, |
| 118 | }, |
| 119 | ]; |
| 120 | |
| 121 | export const RELEASED_PERMISSION_POSTURES: ControlTerm[] = [ |
| 122 | { |
| 123 | term: "Ask", |
| 124 | kind: "permission-posture", |
| 125 | description: { |
| 126 | en: "The default. Codewhale asks before a command runs; saved approvals and policy rules still apply.", |
| 127 | zh: "默认设置。Codewhale 在运行命令前询问;已保存的批准和策略规则仍然适用。", |
| 128 | }, |
| 129 | }, |
| 130 | { |
| 131 | term: "Auto-Review", |
| 132 | kind: "permission-posture", |
| 133 | description: { |
| 134 | en: "Codewhale reviews eligible tool actions automatically and denies high-risk calls or failed reviews. It can still ask you to resolve a user choice.", |
| 135 | zh: "Codewhale 自动审查符合条件的工具操作,并拒绝高风险调用或审查失败的调用。它仍可能请你作出用户选择。", |
| 136 | }, |
| 137 | }, |
| 138 | { |
| 139 | term: "Full Access", |
| 140 | kind: "permission-posture", |
| 141 | description: { |
| 142 | en: "Commands can reach anything on this computer without approval prompts. Repository law and managed policy still apply.", |
| 143 | zh: "命令无需审批提示即可访问这台计算机上的任何内容。仓库规则与托管策略仍然适用。", |
| 144 | }, |
| 145 | }, |
| 146 | ]; |
| 147 | |
| 148 | /** TUI modes; Shift+Tab steps the permission dial. */ |
| 149 | export const CONTROL_MODES: ControlTerm[] = [ |
| 150 | { |
| 151 | term: "Plan", |
| 152 | kind: "mode", |
| 153 | description: { |
| 154 | en: "Plan permits workspace inspection and policy-allowed research, but refuses file mutation and shell execution.", |
| 155 | zh: "Plan 允许检查工作区和进行策略许可的研究,但拒绝文件修改与 shell 执行。", |
| 156 | }, |
| 157 | }, |
| 158 | { |
| 159 | term: "Work", |
| 160 | kind: "mode", |
| 161 | description: { |
| 162 | en: "Work uses tools across multiple steps under the active permissions, sandbox and repository rules. The retired Operate mode is accepted as an alias for Work.", |
| 163 | zh: "Work 在当前权限、沙箱和仓库规则下分多步使用工具。已退役的 Operate 模式仍作为 Work 的别名被接受。", |
| 164 | }, |
| 165 | }, |
| 166 | |
| 167 | ]; |
| 168 | |
| 169 | /** Permission postures; Plan is a separate stop on the dial. */ |
| 170 | export const PERMISSION_POSTURES: ControlTerm[] = [ |
| 171 | { |
| 172 | term: "Ask", |
| 173 | kind: "permission-posture", |
| 174 | description: { |
| 175 | en: "Codewhale asks before file edits and commands, including workspace edits; saved approvals and policy rules still apply.", |
| 176 | zh: "Codewhale 在修改文件和运行命令前询问,包括工作区内的修改;已保存的批准和策略规则仍然适用。", |
| 177 | }, |
| 178 | }, |
| 179 | { |
| 180 | term: "Accept Edits", |
| 181 | kind: "permission-posture", |
| 182 | description: { |
| 183 | en: "Ordinary edits inside a git workspace can run without a prompt; commands and sensitive-file edits still ask. New installs use this posture unless a saved choice or managed policy applies.", |
| 184 | zh: "Git 工作区内的普通修改可以不经提示执行;命令和敏感文件修改仍会询问。除非已有保存的选择或托管策略,新安装使用此权限设置。", |
| 185 | }, |
| 186 | }, |
| 187 | { |
| 188 | term: "Auto-Review", |
| 189 | kind: "permission-posture", |
| 190 | description: { |
| 191 | en: "Codewhale reviews eligible tool actions automatically and denies high-risk calls or failed reviews. It can still ask you to resolve a user choice.", |
| 192 | zh: "Codewhale 自动审查符合条件的工具操作,并拒绝高风险调用或审查失败的调用。它仍可能请你作出用户选择。", |
| 193 | }, |
| 194 | }, |
| 195 | { |
| 196 | term: "Full Access", |
| 197 | kind: "permission-posture", |
| 198 | description: { |
| 199 | en: "Commands can reach anything on this computer without approval prompts. Repository law and managed policy still apply.", |
| 200 | zh: "命令无需审批提示即可访问这台计算机上的任何内容。仓库规则与托管策略仍然适用。", |
| 201 | }, |
| 202 | }, |
| 203 | ]; |
| 204 | |
| 205 | /** |
| 206 | * Route identity vocabulary. Requested and effective reasoning are separate: |
| 207 | * an adaptive request is not itself evidence of the tier a provider used. |
| 208 | * Routing source is provenance, not a provider or model substitute. Unknown |
| 209 | * effective values stay explicitly unknown. |
| 210 | */ |
| 211 | export const ROUTE_IDENTITY: { term: string; description: LocalizedText }[] = [ |
| 212 | { |
| 213 | term: "Provider", |
| 214 | description: { |
| 215 | en: "Who serves inference — a hosted API, a gateway, or a loopback local runtime. A configured provider is never inferred from a model name.", |
| 216 | zh: "谁提供推理——托管 API、网关或本机回环本地运行时。绝不会根据模型名称推断已配置的 provider。", |
| 217 | }, |
| 218 | }, |
| 219 | { |
| 220 | term: "Model", |
| 221 | description: { |
| 222 | en: "The exact model on that provider. Codewhale treats models as selectable components; no provider or model is privileged over another.", |
| 223 | zh: "该提供商上的具体模型。Codewhale 把模型当作可选组件;任何提供商或模型都不享有特权。", |
| 224 | }, |
| 225 | }, |
| 226 | { |
| 227 | term: "Requested reasoning", |
| 228 | description: { |
| 229 | en: "The policy requested for the frozen route: inherit, off, low, medium, high, max, or auto. Auto permits adaptive reasoning; it never permits a silent provider or model switch.", |
| 230 | zh: "为冻结路由请求的策略:inherit、off、low、medium、high、max 或 auto。Auto 允许自适应思考,但绝不允许静默切换 provider 或模型。", |
| 231 | }, |
| 232 | }, |
| 233 | { |
| 234 | term: "Effective reasoning", |
| 235 | description: { |
| 236 | en: "The tier actually applied for the run when the runtime or provider can establish it. If it cannot be established, the value is unavailable — never copied from the request or invented.", |
| 237 | zh: "运行时或 provider 能够确认时,显示该次运行实际采用的档位;无法确认时标为暂不可用,绝不从请求值复制或臆造。", |
| 238 | }, |
| 239 | }, |
| 240 | { |
| 241 | term: "Routing source", |
| 242 | description: { |
| 243 | en: "Why this configured route was selected, such as an explicit member profile or inherited session setting. Missing provenance stays unavailable rather than being guessed.", |
| 244 | zh: "说明为何选择这条已配置路由,例如显式成员档案或继承的会话设置。缺失的来源保持暂不可用,绝不猜测。", |
| 245 | }, |
| 246 | }, |
| 247 | ]; |
| 248 | |
| 249 | /** Public advisory role vocabulary; legacy spellings are input compatibility. */ |
| 250 | export const ADVISORY_ROLE = { |
| 251 | term: "Advisor", |
| 252 | description: { |
| 253 | en: "The public read-only advisory fleet role. The historical consultant and oracle spellings remain compatibility aliases for saved configuration and replay only; new product surfaces say Advisor.", |
| 254 | zh: "面向用户的只读 fleet 咨询角色。历史拼写 consultant 与 oracle 仅作为已保存配置和回放的兼容别名保留;新的产品界面统一使用 Advisor。", |
| 255 | }, |
| 256 | } as const; |
| 257 | |
| 258 | /** |
| 259 | * Measurement truth — what the site may claim about benchmark-style numbers. |
| 260 | * These are policy statements, not results: the site publishes no leaderboard, |
| 261 | * and any future number must carry its exact route identity and harness. |
| 262 | */ |
| 263 | export const MEASUREMENT_PRINCIPLES: LocalizedText[] = [ |
| 264 | { |
| 265 | en: "Provider token and cache usage is shown locally when the provider reports it; unknown usage stays unknown and is never displayed as zero.", |
| 266 | zh: "当提供商上报时,token 与缓存用量会在本地显示;未知用量保持未知,绝不显示为零。", |
| 267 | }, |
| 268 | { |
| 269 | en: "Costs, progress, capabilities, and delivery state are shown only when a source establishes them. Unavailable values remain unavailable rather than becoming zero or success.", |
| 270 | zh: "成本、进度、能力和交付状态仅在有来源能够确认时显示。暂不可用的值保持暂不可用,绝不会变成零或成功。", |
| 271 | }, |
| 272 | { |
| 273 | en: "This site publishes no benchmark leaderboard. Any number Codewhale ever publishes must name its exact provider, model, requested and effective reasoning, and measurement harness alongside the result.", |
| 274 | zh: "本站不发布基准排行榜。Codewhale 今后发布任何数字时,都必须同时给出确切的提供商、模型、请求与实际思考档位和测量工具链。", |
| 275 | }, |
| 276 | ]; |
| 277 | |
| 278 | export function controlTermsFor(context: CapabilityContext, features: readonly Feature[] = FEATURE_CATALOGUE.features): { body: ControlTerm[]; source: ControlTerm[] } { |
| 279 | const inSource = (placement: SourcePlacement) => [ |
| 280 | ...(sourcePlacement(MODES_CLAIM, context, features) === placement ? CONTROL_MODES : []), |
| 281 | ...(sourcePlacement(POSTURES_CLAIM, context, features) === placement ? PERMISSION_POSTURES : []), |
| 282 | ]; |
| 283 | return { |
| 284 | body: [ |
| 285 | ...(showsReleasedText(MODES_CLAIM, context, features) ? RELEASED_CONTROL_MODES : []), |
| 286 | ...(showsReleasedText(POSTURES_CLAIM, context, features) ? RELEASED_PERMISSION_POSTURES : []), |
| 287 | ...inSource("body"), |
| 288 | ], |
| 289 | source: inSource("source"), |
| 290 | }; |
| 291 | } |
| 292 |