Linger is An Open-Source Personal Agent That Runs Fully on Your PC. We aim to break Big Tech’s grip on AI by bringing powerful local AI to everyday computers through efficient model–harness co-design, so everyone can run their own.
feat(web): translate the Runtime settings dialog
Kilync0dbb7e70837
diff --git a/apps/web/src/features/local-computer/remove-computer-dialog.tsx b/apps/web/src/features/local-computer/remove-computer-dialog.tsxindex cd4a168b..d8cec7bb 100644--- a/apps/web/src/features/local-computer/remove-computer-dialog.tsx+++ b/apps/web/src/features/local-computer/remove-computer-dialog.tsx@@ -87,6 +87,7 @@ export function RemoveComputerDialog({computers.find((item) => item.computer_id === option.target.computerId,),+ t,): plan?.action === "delete"? t(computersMessages.deleteAgentHint)@@ -94,7 +95,7 @@ export function RemoveComputerDialog({? agent.agent_type === "anotherme"? t(computersMessages.anotherMeNeedsComputer): t(computersMessages.agentNeedsComputer)- : describeMissingDefault(row, candidates);+ : describeMissingDefault(row, candidates, t);return { candidates, hint, options, plan, row };});const remaining = plans.filter(({ row }) => !move.isFinished(row.actor.id));diff --git a/apps/web/src/features/rooms/members/agent-move-target.ts b/apps/web/src/features/rooms/members/agent-move-target.tsindex 38e85527..5de183a5 100644--- a/apps/web/src/features/rooms/members/agent-move-target.ts+++ b/apps/web/src/features/rooms/members/agent-move-target.ts@@ -5,7 +5,9 @@ import type {TeamHubTenantAgent,TeamHubTenantAgentUpdateInput,} from "@/features/teamhub/teamhub-types";+import { translate, type Translate } from "@/i18n/language";+import { agentRuntimeMessages } from "./agent-runtime.messages";import { reasoningEffortLabel } from "./use-agent-model-selection";export type LocalComputer = TeamHubLocalComputerPage["items"][number];@@ -191,6 +193,7 @@ export function describeMoveTarget(agent: TeamHubTenantAgent,target: AgentMoveTarget,computer: LocalComputer | undefined,+ t: Translate = translate,) {const runtime = computer?.runtimes.find((item) => item.type === target.runtimeType,@@ -202,7 +205,7 @@ export function describeMoveTarget(runtimeLabels[target.runtimeType],modelLabel,target.reasoningEffort- ? reasoningEffortLabel(target.reasoningEffort)+ ? reasoningEffortLabel(target.reasoningEffort, t): undefined,].filter(Boolean)@@ -222,25 +225,31 @@ export function describeMoveTarget(target.reasoningEffort !== previousEffort;// Only a fallback within the same Runtime needs the missing model named;// a reasoning change on the same model is named so it is not silent.- return `${kept ? "Keeps" : "Uses"} ${summary}.${- sameRuntime && !sameModel- ? ` ${agent.runtime.model} isn't available there.`- : ""- }${- effortChanged- ? ` Reasoning was ${reasoningEffortLabel(previousEffort)}.`- : ""- }`;+ if (kept) return t(agentRuntimeMessages.targetKeeps, { summary });+ if (sameRuntime && !sameModel)+ return t(agentRuntimeMessages.targetUsesModelMissing, {+ model: agent.runtime.model,+ summary,+ });+ if (effortChanged)+ return t(agentRuntimeMessages.targetUsesReasoningWas, {+ effort: reasoningEffortLabel(previousEffort, t),+ summary,+ });+ return t(agentRuntimeMessages.targetUses, { summary });}export function describeMissingDefault(agent: TeamHubTenantAgent,candidates: readonly LocalComputer[],+ t: Translate = translate,) {- const name = runtimeLabels[agent.runtime.placement?.runtime_type ?? "codex"];- const where =- candidates.length === 1- ? candidates[0]!.display_name- : "any other computer";- return `${name} isn't ready on ${where}. Choose another Runtime.`;+ const runtime =+ runtimeLabels[agent.runtime.placement?.runtime_type ?? "codex"];+ return candidates.length === 1+ ? t(agentRuntimeMessages.missingDefault, {+ computer: candidates[0]!.display_name,+ runtime,+ })+ : t(agentRuntimeMessages.missingDefaultAnywhere, { runtime });}diff --git a/apps/web/src/features/rooms/members/agent-runtime.messages.ts b/apps/web/src/features/rooms/members/agent-runtime.messages.tsnew file mode 100644index 00000000..dc4f0e7f--- /dev/null+++ b/apps/web/src/features/rooms/members/agent-runtime.messages.ts@@ -0,0 +1,45 @@+import { defineMessages } from "@/i18n/messages";++/** An Agent's Runtime settings, and what moving it to another Computer does. */+export const agentRuntimeMessages = defineMessages("agentRuntime", {+ title: "Runtime settings",+ moveAgent: "Move Agent",+ saveRuntime: "Save Runtime",+ computer: "Computer",+ computerLabel: "Agent computer",+ chooseComputer: "Choose a computer",+ computerOnline: "{name} · Online",+ computerOffline: "{name} · Offline",+ computerOnlineUpgrade: "{name} · Online · Upgrade required",+ computerOfflineUpgrade: "{name} · Offline · Upgrade required",+ runtime: "Runtime",+ runtimeLabel: "Agent runtime",+ chooseRuntime: "Choose a runtime",+ runtimeNotReady: "{runtime} · {status}",+ model: "Model",+ modelLabel: "Agent model",+ noModels: "No models available",+ unavailableOption: "{name} · Unavailable",+ reasoning: "Reasoning",+ reasoningLabel: "Agent reasoning effort",+ waitForAgent: "Wait for this Agent to finish before saving changes.",+ moveHint:+ "Moving starts a new native Runtime session on the new computer. Local files stay on the old computer.",+ noWritableWorkspace:+ "This computer has no writable workspace. Choose another computer.",+ currentModelUnavailable:+ "The current model is unavailable. Choose another model.",+ noRuntimeModels: "No models are available for this runtime.",+ optionsUnavailable: "Runtime options are unavailable.",+ readyAfterSignIn: "It turns ready here on its own shortly after you sign in.",+ installAndSignIn:+ "Install and sign in to this runtime on the computer, then wait for it to become ready.",+ missingDefault:+ "{runtime} isn't ready on {computer}. Choose another Runtime.",+ missingDefaultAnywhere:+ "{runtime} isn't ready on any other computer. Choose another Runtime.",+ targetKeeps: "Keeps {summary}.",+ targetUses: "Uses {summary}.",+ targetUsesModelMissing: "Uses {summary}. {model} isn't available there.",+ targetUsesReasoningWas: "Uses {summary}. Reasoning was {effort}.",+});diff --git a/apps/web/src/features/rooms/members/edit-agent-runtime-dialog.test.tsx b/apps/web/src/features/rooms/members/edit-agent-runtime-dialog.test.tsxindex bb49c3a9..c2d260a7 100644--- a/apps/web/src/features/rooms/members/edit-agent-runtime-dialog.test.tsx+++ b/apps/web/src/features/rooms/members/edit-agent-runtime-dialog.test.tsx@@ -16,8 +16,8 @@ import type {} from "@/features/teamhub/teamhub-types";import { OFFLINE_COMPUTER_HINT } from "./agent-move-target";+import { agentRuntimeMessages } from "./agent-runtime.messages";import {- agentMoveHint,type AgentRuntimeField,EditAgentRuntimeDialog,type AgentRuntimeUpdateInput,@@ -316,7 +316,7 @@ describe("EditAgentRuntimeDialog", () => {name: "Agent computer",});await waitFor(() => expect(computer).toHaveTextContent("Old Mac · Online"));- expect(screen.queryByText(agentMoveHint)).toBeNull();+ expect(screen.queryByText(agentRuntimeMessages.moveHint.source)).toBeNull();fireEvent.click(computer);fireEvent.click(await screen.findByRole("option", { name: "New Mac · Online" }),@@ -330,7 +330,9 @@ describe("EditAgentRuntimeDialog", () => {expect(screen.getByRole("combobox", { name: "Agent reasoning effort" }),).toHaveTextContent("High");- expect(screen.getByText(agentMoveHint)).toBeVisible();+ expect(+ screen.getByText(agentRuntimeMessages.moveHint.source),+ ).toBeVisible();fireEvent.click(screen.getByRole("button", { name: "Move Agent" }));expect(onSave).toHaveBeenCalledWith({runtime: {diff --git a/apps/web/src/features/rooms/members/edit-agent-runtime-dialog.tsx b/apps/web/src/features/rooms/members/edit-agent-runtime-dialog.tsxindex e2bb3c09..61f7a515 100644--- a/apps/web/src/features/rooms/members/edit-agent-runtime-dialog.tsx+++ b/apps/web/src/features/rooms/members/edit-agent-runtime-dialog.tsx@@ -17,14 +17,19 @@ import type {TeamHubTenantAgent,TeamHubTenantAgentUpdateInput,} from "@/features/teamhub/teamhub-types";+import { commonMessages } from "@/i18n/common.messages";+import type { Translate } from "@/i18n/language";+import { RichMessage, useT } from "@/i18n/use-translation";++import { createAgentMessages } from "../create-agent.messages";import {agentRuntimeUpdate,describeMissingDefault,type LocalComputer,- OFFLINE_COMPUTER_HINT,runtimeLabels,} from "./agent-move-target";+import { agentRuntimeMessages } from "./agent-runtime.messages";import { useAgentMoveTarget } from "./use-agent-move-target";import { reasoningEffortLabel } from "./use-agent-model-selection";@@ -39,9 +44,6 @@ export interface AgentRuntimeUpdateInput {runtime: Runtime;}-export const agentMoveHint =- "Moving starts a new native Runtime session on the new computer. Local files stay on the old computer.";-export function EditAgentRuntimeDialog({busy = false,field = "runtime",@@ -64,6 +66,7 @@ export function EditAgentRuntimeDialog({registration: TeamHubTenantAgent;tenantId: string;}) {+ const t = useT();const formId = useId();const computers = useQuery({queryFn: () => client.listTenantLocalComputers(tenantId),@@ -102,6 +105,19 @@ export function EditAgentRuntimeDialog({computers.isError || (!loading && (!computer || (!moving && !grant)));const canSave = Boolean(modelIsAvailable && localReady && target);+ const modelsLink = (text: string) =>+ selection.computerId ? (+ <LocalModelsLink+ computerId={selection.computerId}+ onNavigate={onClose}+ tenantId={tenantId}+ >+ {text}+ </LocalModelsLink>+ ) : (+ text+ );+function submit(event: FormEvent) {event.preventDefault();if (!canSave || !target || isPending || busy) return;@@ -112,11 +128,11 @@ export function EditAgentRuntimeDialog({<ModalDialogonClose={onClose}size="md"- title="Runtime settings"+ title={t(agentRuntimeMessages.title)}footer={<><Button onClick={onClose} type="button">- Cancel+ {t(commonMessages.cancel)}</Button><Buttondisabled={busy || isPending || loading || unavailable || !canSave}@@ -125,7 +141,11 @@ export function EditAgentRuntimeDialog({tone="primary"type="submit">- {moving ? "Move Agent" : "Save Runtime"}+ {t(+ moving+ ? agentRuntimeMessages.moveAgent+ : agentRuntimeMessages.saveRuntime,+ )}</Button></>}@@ -136,13 +156,15 @@ export function EditAgentRuntimeDialog({disabled={isPending || loading}><label className="block">- <span className="mb-1.5 block text-sm font-medium">Computer</span>+ <span className="mb-1.5 block text-sm font-medium">+ {t(agentRuntimeMessages.computer)}+ </span><Select- aria-label="Agent computer"+ aria-label={t(agentRuntimeMessages.computerLabel)}className="ui-field-control w-full"disabled={placementLocked}onValueChange={selection.selectComputer}- placeholder="Choose a computer"+ placeholder={t(agentRuntimeMessages.chooseComputer)}value={selection.computerId}>{(computers.data?.items ?? []).map((item) => (@@ -151,47 +173,55 @@ export function EditAgentRuntimeDialog({key={item.computer_id}value={item.computer_id}>- {computerOptionLabel(item)}+ {computerOptionLabel(item, t)}</SelectItem>))}</Select></label><label className="block">- <span className="mb-1.5 block text-sm font-medium">Runtime</span>+ <span className="mb-1.5 block text-sm font-medium">+ {t(agentRuntimeMessages.runtime)}+ </span><Select- aria-label="Agent runtime"+ aria-label={t(agentRuntimeMessages.runtimeLabel)}className="ui-field-control w-full"disabled={placementLocked}onValueChange={(value) =>selection.selectRuntime(value as TeamHubLocalRuntimeType)}- placeholder="Choose a runtime"+ placeholder={t(agentRuntimeMessages.chooseRuntime)}value={selection.runtimeType}>{(computer?.runtimes ?? []).map((item) => (<SelectItem key={item.type} value={item.type}>- {runtimeLabels[item.type]}{item.status === "ready"- ? ""- : ` · ${runtimeStatusLabels[item.status].source}`}+ ? runtimeLabels[item.type]+ : t(agentRuntimeMessages.runtimeNotReady, {+ runtime: runtimeLabels[item.type],+ status: t(runtimeStatusLabels[item.status]),+ })}</SelectItem>))}</Select></label><div className="space-y-1.5"><label className="block">- <span className="mb-1.5 block text-sm font-medium">Model</span>+ <span className="mb-1.5 block text-sm font-medium">+ {t(agentRuntimeMessages.model)}+ </span><Select- aria-label="Agent model"+ aria-label={t(agentRuntimeMessages.modelLabel)}className="ui-field-control w-full"disabled={field === "reasoning"}onValueChange={selection.selectModel}- placeholder="No models available"+ placeholder={t(agentRuntimeMessages.noModels)}value={model}>{model && !modelIsAvailable ? (<SelectItem value={model} disabled>- {unavailableModelLabel} · Unavailable+ {t(agentRuntimeMessages.unavailableOption, {+ name: unavailableModelLabel,+ })}</SelectItem>) : null}{selection.modelOptions.map((item) => (@@ -208,13 +238,10 @@ export function EditAgentRuntimeDialog({localReady &&selection.modelOptions.length > 0 ? (<p className="text-xs text-muted-foreground">- Manage downloaded models in{" "}- <LocalModelsLink- computerId={selection.computerId}- onNavigate={onClose}- tenantId={tenantId}+ <RichMessage+ message={createAgentMessages.manageModels}+ tags={{ link: modelsLink }}/>- .</p>) : null}</div>@@ -226,27 +253,27 @@ export function EditAgentRuntimeDialog({/>{busy ? (<p className="text-sm text-app-subtle" role="status">- Wait for this Agent to finish before saving changes.+ {t(agentRuntimeMessages.waitForAgent)}</p>) : null}{moving && computer ? (<p className="text-sm text-app-subtle" role="status">- {agentMoveHint}+ {t(agentRuntimeMessages.moveHint)}</p>) : null}{computer?.status === "offline" && !computer.upgrade_required ? (<p className="text-sm text-app-subtle" role="status">- {OFFLINE_COMPUTER_HINT}+ {t(createAgentMessages.offlineComputerHint)}</p>) : null}{moving && computer && !selection.runtimeType ? (<p className="text-sm text-app-danger" role="alert">- {describeMissingDefault(registration, [computer])}+ {describeMissingDefault(registration, [computer], t)}</p>) : null}{noWritableGrant ? (<p className="text-sm text-app-danger" role="alert">- This computer has no writable workspace. Choose another computer.+ {t(agentRuntimeMessages.noWritableWorkspace)}</p>) : null}{!loading &&@@ -254,9 +281,11 @@ export function EditAgentRuntimeDialog({!modelIsAvailable &&runtime?.status === "ready" ? (<p className="text-sm text-app-danger" role="alert">- {selection.modelOptions.length- ? "The current model is unavailable. Choose another model."- : "No models are available for this runtime."}+ {t(+ selection.modelOptions.length+ ? agentRuntimeMessages.currentModelUnavailable+ : agentRuntimeMessages.noRuntimeModels,+ )}</p>) : null}{!localReady && !loading && !unavailable && computer && runtime ? (@@ -268,24 +297,21 @@ export function EditAgentRuntimeDialog({!unavailable &&(!localReady || selection.modelOptions.length === 0) ? (<p className="text-xs text-muted-foreground">- Download and load a local model in{" "}- <LocalModelsLink- computerId={selection.computerId}- onNavigate={onClose}- tenantId={tenantId}- />{" "}- to run Agents with Pi on this computer.+ <RichMessage+ message={createAgentMessages.downloadModel}+ tags={{ link: modelsLink }}+ /></p>) : null}{unavailable ? (<p className="text-sm text-app-danger" role="alert">- Runtime options are unavailable.+ {t(agentRuntimeMessages.optionsUnavailable)}<buttonclassName="ml-2 underline"type="button"onClick={() => void computers.refetch()}>- Retry+ {t(commonMessages.retry)}</button></p>) : null}@@ -310,6 +336,7 @@ function RuntimeSetupGuidance({computer: LocalComputer;runtime: LocalComputer["runtimes"][number];}) {+ const t = useT();if (runtime.status === "not_installed")return (<div role="status">@@ -331,22 +358,27 @@ function RuntimeSetupGuidance({runtimeType={runtime.type}/><p className="mt-1 text-muted-foreground">- It turns ready here on its own shortly after you sign in.+ {t(agentRuntimeMessages.readyAfterSignIn)}</p></div>);return (<p className="text-sm text-app-danger" role="alert">- {runtime.message ??- "Install and sign in to this runtime on the computer, then wait for it to become ready."}+ {runtime.message ?? t(agentRuntimeMessages.installAndSignIn)}</p>);}-function computerOptionLabel(computer: LocalComputer) {- return `${computer.display_name} · ${- computer.status === "online" ? "Online" : "Offline"- }${computer.upgrade_required ? " · Upgrade required" : ""}`;+function computerOptionLabel(computer: LocalComputer, t: Translate) {+ const online = computer.status === "online";+ const message = computer.upgrade_required+ ? online+ ? agentRuntimeMessages.computerOnlineUpgrade+ : agentRuntimeMessages.computerOfflineUpgrade+ : online+ ? agentRuntimeMessages.computerOnline+ : agentRuntimeMessages.computerOffline;+ return t(message, { name: computer.display_name });}/* Model and Reasoning are separate choices. While the model's options can't@@ -363,20 +395,25 @@ function ReasoningField({savedUnavailableEffort?: TeamHubAgentReasoningEffort;value?: TeamHubAgentReasoningEffort;}) {+ const t = useT();if (!allowed?.length) {if (!savedUnavailableEffort) return null;return (<div>- <span className="mb-1.5 block text-sm font-medium">Reasoning</span>+ <span className="mb-1.5 block text-sm font-medium">+ {t(agentRuntimeMessages.reasoning)}+ </span><Select- aria-label="Agent reasoning effort"+ aria-label={t(agentRuntimeMessages.reasoningLabel)}className="ui-field-control w-full"disabledonValueChange={() => {}}value={savedUnavailableEffort}><SelectItem value={savedUnavailableEffort} disabled>- {reasoningEffortLabel(savedUnavailableEffort)} · Unavailable+ {t(agentRuntimeMessages.unavailableOption, {+ name: reasoningEffortLabel(savedUnavailableEffort, t),+ })}</SelectItem></Select></div>@@ -384,16 +421,18 @@ function ReasoningField({}return (<label className="block">- <span className="mb-1.5 block text-sm font-medium">Reasoning</span>+ <span className="mb-1.5 block text-sm font-medium">+ {t(agentRuntimeMessages.reasoning)}+ </span><Select- aria-label="Agent reasoning effort"+ aria-label={t(agentRuntimeMessages.reasoningLabel)}className="ui-field-control w-full"onValueChange={(next) => onChange(next as TeamHubAgentReasoningEffort)}value={value ?? ""}>{allowed.map((effort) => (<SelectItem key={effort} value={effort}>- {reasoningEffortLabel(effort)}+ {reasoningEffortLabel(effort, t)}</SelectItem>))}</Select>@@ -402,10 +441,12 @@ function ReasoningField({}function LocalModelsLink({+ children,computerId,onNavigate,tenantId,}: {+ children: string;computerId: string;onNavigate: () => void;tenantId: string;@@ -417,7 +458,7 @@ function LocalModelsLink({onClick={onNavigate}to={to}>- Settings › Models+ {children}</Link>);}diff --git a/apps/web/src/i18n/locales/zh-CN.glossary.md b/apps/web/src/i18n/locales/zh-CN.glossary.mdindex a9d055cc..5cfa3f79 100644--- a/apps/web/src/i18n/locales/zh-CN.glossary.md+++ b/apps/web/src/i18n/locales/zh-CN.glossary.md@@ -45,6 +45,8 @@ elsewhere.| Pin | 置顶 | || Log out | 退出登录 | || Thinking effort | 思考强度 | |+| Reasoning (an Agent setting) | 思考强度 | The same setting as Thinking effort. |+| Move (an Agent) | 移动 | || Token | 令牌 | || Workspace | 工作区 | || Server | 服务器 | |diff --git a/apps/web/src/i18n/locales/zh-CN.json b/apps/web/src/i18n/locales/zh-CN.jsonindex 9bbd9ffc..e6934b93 100644--- a/apps/web/src/i18n/locales/zh-CN.json+++ b/apps/web/src/i18n/locales/zh-CN.json@@ -1250,7 +1250,7 @@"byokExplanation": "BYOK 即自带密钥:使用你自己的 OpenAI 兼容或 Anthropic API 端点,由这台电脑上的网关提供给你的 Agent。","switched": "已切换。","agentsNowUse": "Agent 现在使用:{source}。",- "agentsMoved": { "other": "已迁移 {count} 个 Agent。" },+ "agentsMoved": { "other": "已移动 {count} 个 Agent。" },"tasksEnded": { "other": "已结束 {count} 个任务。" },"terminateTitle": "结束正在运行的任务?","terminateDescription": {@@ -1555,5 +1555,41 @@"statusFlushing": "正在完成这条消息,你可以继续说话","statusSending": "正在发送消息,你可以继续说话","statusListening": "正在聆听 · 说完后自动发送"+ },+ "agentRuntime": {+ "title": "Runtime 设置",+ "moveAgent": "移动 Agent",+ "saveRuntime": "保存 Runtime",+ "computer": "电脑",+ "computerLabel": "Agent 所在的电脑",+ "chooseComputer": "选择一台电脑",+ "computerOnline": "{name} · 在线",+ "computerOffline": "{name} · 离线",+ "computerOnlineUpgrade": "{name} · 在线 · 需要升级",+ "computerOfflineUpgrade": "{name} · 离线 · 需要升级",+ "runtime": "Runtime",+ "runtimeLabel": "Agent 的 Runtime",+ "chooseRuntime": "选择一个 Runtime",+ "runtimeNotReady": "{runtime} · {status}",+ "model": "模型",+ "modelLabel": "Agent 的模型",+ "noModels": "没有可用的模型",+ "unavailableOption": "{name} · 不可用",+ "reasoning": "思考强度",+ "reasoningLabel": "Agent 的思考强度",+ "waitForAgent": "请等这个 Agent 完成当前工作后再保存更改。",+ "moveHint": "移动后,Agent 会在新电脑上开启一个新的原生 Runtime 会话。本地文件仍留在原来的电脑上。",+ "noWritableWorkspace": "这台电脑没有可写入的工作区,请选择另一台电脑。",+ "currentModelUnavailable": "当前模型不可用,请选择其他模型。",+ "noRuntimeModels": "这个 Runtime 没有可用的模型。",+ "optionsUnavailable": "Runtime 选项暂不可用。",+ "readyAfterSignIn": "登录后稍等片刻,这里会自动变为就绪。",+ "installAndSignIn": "请在这台电脑上安装并登录这个 Runtime,然后等待它就绪。",+ "missingDefault": "{runtime} 在 {computer} 上尚未就绪,请选择其他 Runtime。",+ "missingDefaultAnywhere": "{runtime} 在其他电脑上都尚未就绪,请选择其他 Runtime。",+ "targetKeeps": "沿用 {summary}。",+ "targetUses": "使用 {summary}。",+ "targetUsesModelMissing": "使用 {summary}。那台电脑上没有 {model}。",+ "targetUsesReasoningWas": "使用 {summary}。原来的思考强度是{effort}。"}}