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 Collaboration panel
Kilyn10b16550d042
diff --git a/apps/web/src/features/rooms/chat/voice-mode/voice-risk-markers.test.ts b/apps/web/src/features/rooms/chat/voice-mode/voice-risk-markers.test.tsindex a6b39f9b..beafcf28 100644--- a/apps/web/src/features/rooms/chat/voice-mode/voice-risk-markers.test.ts+++ b/apps/web/src/features/rooms/chat/voice-mode/voice-risk-markers.test.ts@@ -37,6 +37,8 @@ const notActions: Record<string, string> = {"shows or hides the password in place; it closes nothing","/src/features/rooms/chat/room-notice-row.tsx: chat.hideChanges":"folds the change list in place; it closes nothing",+ "/src/features/rooms/task-sidebar/collaboration-panel.tsx: collaboration.hideSource":+ "folds the source in place; it closes nothing","/src/features/rooms/room-secondary-navigation.tsx: roomList.deletedChat":"says the Agent of a direct chat was deleted; the link only opens the chat","/src/features/rooms/room-secondary-navigation.tsx: roomList.deleted":diff --git a/apps/web/src/features/rooms/task-sidebar/collaboration-language.test.tsx b/apps/web/src/features/rooms/task-sidebar/collaboration-language.test.tsxnew file mode 100644index 00000000..d5c9f0eb--- /dev/null+++ b/apps/web/src/features/rooms/task-sidebar/collaboration-language.test.tsx@@ -0,0 +1,58 @@+// @vitest-environment jsdom+import { act, fireEvent, render, screen } from "@testing-library/react";+import { afterEach, describe, expect, it } from "vitest";++import { resetLanguageForTest, setLanguage } from "@/i18n/language";+import zhCN from "@/i18n/locales/zh-CN.json";+import { seedTeamMd } from "@/test/teamhub-seed";++import { CollaborationGraph } from "./collaboration-panel";+import { layoutTeamGraph } from "./team-graph";++const words = zhCN.collaboration;++function agentName(name: string, identity: string) {+ return words.agentIdentity+ .replace("{name}", name)+ .replace("{identity}", identity);+}++describe("Collaboration in the language on screen", () => {+ afterEach(() => resetLanguageForTest());++ it("names each Agent's part in the pattern when the graph is laid out", async () => {+ const english = layoutTeamGraph(seedTeamMd, 360);+ expect(english.nodes.map((node) => node.identity)).toEqual([+ "Coordinator",+ "Verifier",+ ]);+ await setLanguage("zh-CN");+ expect(+ layoutTeamGraph(seedTeamMd, 360).nodes.map((node) => node.identity),+ ).toEqual([words.coordinator, words.verifier]);+ });++ it("switches the graph, its legend and the Agent detail", async () => {+ render(<CollaborationGraph actors={[]} document={seedTeamMd} />);+ expect(screen.getByRole("button", { name: "Handoff" })).toBeVisible();++ await act(() => setLanguage("zh-CN"));+ expect(screen.getByRole("group", { name: words.graph })).toBeVisible();+ expect(screen.getByRole("group", { name: words.legend })).toBeVisible();+ expect(screen.getByRole("button", { name: words.handoff })).toBeVisible();+ expect(screen.getByRole("button", { name: words.report })).toBeVisible();+ expect(screen.getByText(words.selectAgent)).toBeVisible();+ expect(+ screen.getByText(+ words.sourceRevision.replace("{revision}", String(seedTeamMd.revision)),+ ),+ ).toBeVisible();++ const lead = seedTeamMd.orchestrator.name;+ fireEvent.click(+ screen.getByRole("button", { name: agentName(lead, words.coordinator) }),+ );+ expect(screen.getByText(words.receivesFrom)).toBeVisible();+ expect(screen.getByText(words.sendsTo)).toBeVisible();+ });+});diff --git a/apps/web/src/features/rooms/task-sidebar/collaboration-panel.tsx b/apps/web/src/features/rooms/task-sidebar/collaboration-panel.tsxindex c658509d..1c06c772 100644--- a/apps/web/src/features/rooms/task-sidebar/collaboration-panel.tsx+++ b/apps/web/src/features/rooms/task-sidebar/collaboration-panel.tsx@@ -15,13 +15,18 @@ import { Button } from "@/components/ui/button";import { Icon, type IconSvgElement } from "@/components/ui/icon";import { TeamHubError } from "@/features/teamhub/teamhub-client";import { useTeamHubRuntime } from "@/features/teamhub/teamhub-runtime";+import { commonMessages } from "@/i18n/common.messages";+import type { Message } from "@/i18n/messages";+import { useT } from "@/i18n/use-translation";import type {TeamHubActorRef,TeamHubTeamMdDocument,} from "@/features/teamhub/teamhub-types";import { ActorAvatar } from "../members/actor-avatar";+import { collaborationMessages as m } from "./collaboration.messages";import { PanelLoading } from "./panel-loading";+import { sidePanelMessages } from "./side-panel.messages";import {layoutTeamGraph,patternTitles,@@ -52,6 +57,7 @@ export function CollaborationPanel({roomId: string;tenantId: string;}) {+ const t = useT();const { client } = useTeamHubRuntime();// team_md.published refreshes this query, so it does not poll.const query = useQuery({@@ -68,7 +74,7 @@ export function CollaborationPanel({: null;return (<section- aria-label="Room collaboration"+ aria-label={t(m.roomCollaboration)}className={hidden? "hidden"@@ -81,17 +87,19 @@ export function CollaborationPanel({<><span className="inline-flex items-center gap-1.5 font-medium text-app-body"><Icon icon={patternIcon} size={14} />- {patternTitles[query.data.collaborate_pattern]}+ {t(patternTitles[query.data.collaborate_pattern])}</span><spanaria-hiddenclassName="size-[3px] rounded-full bg-app-border-strong"/>- <span>{query.data.members.length + 1} Agents</span>+ <span>+ {t(m.agentCount, { count: query.data.members.length + 1 })}+ </span></>) : null}<Button- aria-label="Refresh collaboration"+ aria-label={t(m.refresh)}className="ml-auto"disabled={refreshing}onClick={() => {@@ -111,20 +119,16 @@ export function CollaborationPanel({</Button></div>{query.isPending ? (- <PanelLoading label="Loading collaboration" />+ <PanelLoading label={t(sidePanelMessages.loadingCollaboration)} />) : query.isError ? (<div className="p-6 text-sm" role="alert">- <p>- {denied- ? "You no longer have access to this collaboration."- : "Could not load collaboration."}- </p>+ <p>{denied ? t(m.accessLost) : t(m.loadFailed)}</p><ButtonclassName="mt-3"onClick={() => void query.refetch()}size="compact">- Retry+ {t(commonMessages.retry)}</Button></div>) : query.data ? (@@ -140,10 +144,9 @@ export function CollaborationPanel({className="mx-auto mb-3 text-app-muted"size={24}/>- <h3 className="text-sm font-medium">No collaboration plan yet</h3>+ <h3 className="text-sm font-medium">{t(m.emptyTitle)}</h3><p className="mt-2 text-xs leading-5 text-app-muted">- When an Agent publishes team.md for this Room, its team and- relationships appear here.+ {t(m.emptyBody)}</p></div>)}@@ -151,9 +154,9 @@ export function CollaborationPanel({);}-const relationshipLabels: Record<Relationship, string> = {- handoff: "Handoff",- report: "Report",+const relationshipLabels: Record<Relationship, Message<string>> = {+ handoff: m.handoff,+ report: m.report,};function lineStroke(kind: Relationship) {@@ -171,6 +174,7 @@ export function CollaborationGraph({actors: TeamHubActorRef[];document: TeamHubTeamMdDocument;}) {+ const t = useT();const [selectedId, setSelectedId] = useState<string | null>(null);const [hoveredId, setHoveredId] = useState<string | null>(null);const [visible, setVisible] = useState<RelationshipVisibility>({@@ -193,7 +197,7 @@ export function CollaborationGraph({observer.observe(canvas);return () => observer.disconnect();}, []);- const graph = layoutTeamGraph(document, width, visible);+ const graph = layoutTeamGraph(document, width, visible, t);const coordinator = document.orchestrator.actor_id;const selected = graph.nodes.find((node) => node.actor_id === selectedId);const focusId =@@ -238,7 +242,7 @@ export function CollaborationGraph({className="workspace-scrollbar overflow-x-auto overflow-y-hidden"ref={canvasRef}role="group"- aria-label="Agent collaboration graph"+ aria-label={t(m.graph)}><divclassName="relative mx-auto"@@ -293,6 +297,10 @@ export function CollaborationGraph({</svg>{graph.nodes.map((node) => {const name = displayName(node.actor_id);+ const label = t(m.agentIdentity, {+ name,+ identity: node.identity,+ });const active = selected?.actor_id === node.actor_id;const lead = node.actor_id === coordinator;const faded = Boolean(focusId && !linked.has(node.actor_id));@@ -300,12 +308,12 @@ export function CollaborationGraph({<buttontype="button"key={node.actor_id}- aria-label={`${name} · ${node.identity}`}+ aria-label={label}aria-pressed={active}data-agent-id={node.actor_id}data-center={node.center || undefined}data-faded={faded || undefined}- title={`${name} · ${node.identity}${node.role ? `\n${node.role}` : ""}`}+ title={node.role ? `${label}\n${node.role}` : label}className="group absolute flex w-20 -translate-x-1/2 flex-col items-center rounded-lg text-center transition-opacity focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-app-focus"style={{left: node.x,@@ -367,7 +375,7 @@ export function CollaborationGraph({{displayName(coordinator)}</span><span className="mt-px whitespace-nowrap text-[12px] leading-[14px] text-app-subtle">- {graph.loop ? "Decides" : "Collects"}+ {graph.loop ? t(m.decides) : t(m.collects)}</span></div>) : null}@@ -377,19 +385,19 @@ export function CollaborationGraph({style={{ left: graph.loop.labelX, top: graph.loop.labelY }}><Icon icon={RepeatIcon} size={12} />- Repeat until done+ {t(m.repeatUntilDone)}</span>) : null}</div></div><divclassName="flex items-center gap-1 border-t border-app-border bg-app-surface-soft/40 py-1.5 pl-3 pr-2 text-[12px] text-app-muted"- aria-label="Relationship legend"+ aria-label={t(m.legend)}role="group"><span className="inline-flex items-center gap-1.5"><span className="size-2.5 rounded-[3px] shadow-[inset_0_0_0_1.5px_var(--app-ink)]" />- Coordinator+ {t(m.coordinator)}</span>{(["handoff", "report"] as const).map((kind) => (<button@@ -414,7 +422,7 @@ export function CollaborationGraph({strokeDasharray={kind === "report" ? "3 3" : undefined}/></svg>- {relationshipLabels[kind]}+ {t(relationshipLabels[kind])}</button>))}</div>@@ -431,20 +439,18 @@ export function CollaborationGraph({node={selected}/>) : (- <p className="text-center text-app-subtle">- Select an Agent to see its responsibility and who it works with.- </p>+ <p className="text-center text-app-subtle">{t(m.selectAgent)}</p>)}</div><details className="group mx-4 border-t border-app-border text-[12px]"><summary className="flex cursor-pointer list-none items-center gap-1.5 py-3 text-app-subtle [&::-webkit-details-marker]:hidden"><Icon icon={File01Icon} size={12} />- team.md · Revision {document.revision}+ {t(m.sourceRevision, { revision: document.revision })}<span className="ml-auto text-app-muted hover:text-app-ink group-open:hidden">- View source+ {t(m.viewSource)}</span><span className="ml-auto hidden text-app-muted hover:text-app-ink group-open:inline">- Hide source+ {t(m.hideSource)}</span></summary><pre className="mb-4 whitespace-pre-wrap break-words rounded-lg bg-app-sidebar p-3 font-mono text-[12px] leading-[1.55] text-app-body">@@ -464,6 +470,7 @@ function AgentDetail({edges: TeamGraph["edges"];node: TeamGraph["nodes"][number];}) {+ const t = useT();const name = displayName(node.actor_id);const related = (direction: "from" | "to") =>edges.flatMap((edge) =>@@ -479,9 +486,9 @@ function AgentDetail({: [],);const rows = [- ...(name !== node.name ? [["Name in team.md", node.name] as const] : []),- ["Receives from", related("from")] as const,- ["Sends to", related("to")] as const,+ ...(name !== node.name ? [[t(m.nameInTeamMd), node.name] as const] : []),+ [t(m.receivesFrom), related("from")] as const,+ [t(m.sendsTo), related("to")] as const,];return (<>@@ -502,7 +509,7 @@ function AgentDetail({</div></div><p className="mb-3 mt-2.5 whitespace-pre-wrap break-words text-[14px] leading-[1.5] text-app-body">- {node.role?.trim() || "No responsibility specified in team.md."}+ {node.role?.trim() || t(m.noResponsibility)}</p><dl className="grid gap-2">{rows.map(([label, value]) => (@@ -528,13 +535,13 @@ function AgentDetail({{displayName(id)}{kind === "report" ? (<span className="text-[12px] text-app-subtle">- report+ {t(m.reportTag)}</span>) : null}</span>))) : (- <span className="text-xs text-app-subtle">None</span>+ <span className="text-xs text-app-subtle">{t(m.none)}</span>)}</dd></div>diff --git a/apps/web/src/features/rooms/task-sidebar/collaboration.messages.ts b/apps/web/src/features/rooms/task-sidebar/collaboration.messages.tsnew file mode 100644index 00000000..49e8cda3--- /dev/null+++ b/apps/web/src/features/rooms/task-sidebar/collaboration.messages.ts@@ -0,0 +1,54 @@+import { defineMessages } from "@/i18n/messages";++/**+ * The Collaboration panel of the Room side panel: the graph drawn from the+ * Room's team.md, its legend and the detail of the selected Agent. The file+ * name `team.md` and everything written in it are shown as they are.+ */+export const collaborationMessages = defineMessages("collaboration", {+ roomCollaboration: "Room collaboration",+ agentCount: { one: "{count} Agent", other: "{count} Agents" },+ refresh: "Refresh collaboration",+ accessLost: "You no longer have access to this collaboration.",+ loadFailed: "Could not load collaboration.",+ emptyTitle: "No collaboration plan yet",+ emptyBody:+ "When an Agent publishes team.md for this Room, its team and relationships appear here.",+ // The collaboration patterns of team.md.+ patternClassifyAndAct: "Classify and act",+ patternFanOutAndSynthesize: "Fan out and synthesize",+ patternCrossVerification: "Cross verification",+ patternTournament: "Tournament",+ patternIterateUntilDone: "Iterate until done",+ // What an Agent is in the pattern, shown under its name.+ coordinator: "Coordinator",+ specialist: "Specialist",+ verifier: "Verifier",+ judge: "Judge",+ contender: "Contender",+ synthesizer: "Synthesizer",+ researcher: "Researcher",+ worker: "Worker",+ // The graph.+ graph: "Agent collaboration graph",+ agentIdentity: "{name} · {identity}",+ decides: "Decides",+ collects: "Collects",+ repeatUntilDone: "Repeat until done",+ legend: "Relationship legend",+ handoff: "Handoff",+ report: "Report",+ // The detail of the selected Agent.+ selectAgent:+ "Select an Agent to see its responsibility and who it works with.",+ noResponsibility: "No responsibility specified in team.md.",+ nameInTeamMd: "Name in team.md",+ receivesFrom: "Receives from",+ sendsTo: "Sends to",+ reportTag: "report",+ none: "None",+ // The team.md source under the graph.+ sourceRevision: "team.md · Revision {revision}",+ viewSource: "View source",+ hideSource: "Hide source",+});diff --git a/apps/web/src/features/rooms/task-sidebar/team-graph.ts b/apps/web/src/features/rooms/task-sidebar/team-graph.tsindex 5657f818..c20030db 100644--- a/apps/web/src/features/rooms/task-sidebar/team-graph.ts+++ b/apps/web/src/features/rooms/task-sidebar/team-graph.ts@@ -2,6 +2,10 @@ import type {TeamHubTeamMdDocument,TeamHubTeamMdParticipant,} from "@/features/teamhub/teamhub-types";+import { type Translate, translate } from "@/i18n/language";+import type { Message } from "@/i18n/messages";++import { collaborationMessages as m } from "./collaboration.messages";export type Relationship = "handoff" | "report";export type RelationshipVisibility = Record<Relationship, boolean>;@@ -29,13 +33,13 @@ interface TeamPath {export const patternTitles: Record<TeamHubTeamMdDocument["collaborate_pattern"],- string+ Message<string>> = {- "classify-and-act": "Classify and act",- "fan-out-and-synthesize": "Fan out and synthesize",- "adversarial-verification": "Cross verification",- tournament: "Tournament",- "loop-until-done": "Iterate until done",+ "classify-and-act": m.patternClassifyAndAct,+ "fan-out-and-synthesize": m.patternFanOutAndSynthesize,+ "adversarial-verification": m.patternCrossVerification,+ tournament: m.patternTournament,+ "loop-until-done": m.patternIterateUntilDone,};/** Relationship names are local to team.md; Actor IDs are the graph identity. */@@ -80,6 +84,7 @@ export function layoutTeamGraph(document: TeamHubTeamMdDocument,width: number,visible: RelationshipVisibility = { handoff: true, report: true },+ t: Translate = translate,) {const edges = teamEdges(document);const coordinator = document.orchestrator.actor_id;@@ -160,7 +165,7 @@ export function layoutTeamGraph(x: columnX(level + offset),y: ys[i]!,center,- identity: memberIdentity(pattern, center),+ identity: t(memberIdentity(pattern, center)),});}}@@ -171,7 +176,7 @@ export function layoutTeamGraph(x: columnX(leadFirst ? 0 : columns - 1),y: meanY(leadFirst ? dispatched : collected),center: true,- identity: "Coordinator",+ identity: t(m.coordinator),};const ordered = [lead, ...members.map((p) => nodes.get(p.actor_id)!)];const returned = hasReturn@@ -255,18 +260,18 @@ export function layoutTeamGraph(function memberIdentity(pattern: TeamHubTeamMdDocument["collaborate_pattern"],center: boolean,-) {+): Message<string> {switch (pattern) {case "classify-and-act":- return "Specialist";+ return m.specialist;case "adversarial-verification":- return "Verifier";+ return m.verifier;case "tournament":- return center ? "Judge" : "Contender";+ return center ? m.judge : m.contender;case "fan-out-and-synthesize":- return center ? "Synthesizer" : "Researcher";+ return center ? m.synthesizer : m.researcher;default:- return "Worker";+ return m.worker;}}diff --git a/apps/web/src/i18n/locales/zh-CN.glossary.md b/apps/web/src/i18n/locales/zh-CN.glossary.mdindex 448dd873..4e7de95b 100644--- a/apps/web/src/i18n/locales/zh-CN.glossary.md+++ b/apps/web/src/i18n/locales/zh-CN.glossary.md@@ -180,6 +180,9 @@ elsewhere.| Session (a sign-in) | 登录 / 浏览器会话 | `会话` only for the browser session. || Panel, Panel view | 面板、面板视图 | A view in the Room's side panel. || Collaboration | 协作 | The panel on how a Room's Agents work together. |+| Coordinator | 协调者 | The Agent that leads a collaboration. |+| Handoff / Report | 交接 / 汇报 | How Agents pass work on in team.md. |+| Revision (of team.md) | 第 N 版 | `team.md` itself stays as it is. || Sponsor (of an Agent) | 创建者 | The Human who created the Agent. || Avatar | 头像 | || Runs on | 运行位置 | Where an Agent runs: Computer and Runtime. |diff --git a/apps/web/src/i18n/locales/zh-CN.json b/apps/web/src/i18n/locales/zh-CN.jsonindex 5f39c650..d815ae4d 100644--- a/apps/web/src/i18n/locales/zh-CN.json+++ b/apps/web/src/i18n/locales/zh-CN.json@@ -2669,5 +2669,45 @@"unavailableBody": "文件已被移除,或者你已失去访问权限。","loadFailedTitle": "无法加载文件","loadFailedBody": "请重试加载这个文件。"+ },+ "collaboration": {+ "roomCollaboration": "Room 协作",+ "agentCount": { "other": "{count} 个 Agent" },+ "refresh": "刷新协作",+ "accessLost": "你已失去这项协作的访问权限。",+ "loadFailed": "无法加载协作。",+ "emptyTitle": "还没有协作计划",+ "emptyBody": "当 Agent 为这个 Room 发布 team.md 后,团队和关系会显示在这里。",+ "patternClassifyAndAct": "分类处理",+ "patternFanOutAndSynthesize": "分头研究再汇总",+ "patternCrossVerification": "交叉验证",+ "patternTournament": "竞赛",+ "patternIterateUntilDone": "迭代直到完成",+ "coordinator": "协调者",+ "specialist": "专家",+ "verifier": "验证者",+ "judge": "评审",+ "contender": "参赛者",+ "synthesizer": "汇总者",+ "researcher": "研究者",+ "worker": "执行者",+ "graph": "Agent 协作关系图",+ "agentIdentity": "{name} · {identity}",+ "decides": "决定",+ "collects": "汇总",+ "repeatUntilDone": "重复直到完成",+ "legend": "关系图例",+ "handoff": "交接",+ "report": "汇报",+ "selectAgent": "选择一个 Agent,查看它的职责以及与谁协作。",+ "noResponsibility": "team.md 中没有写明职责。",+ "nameInTeamMd": "team.md 中的名称",+ "receivesFrom": "接收自",+ "sendsTo": "发送给",+ "reportTag": "汇报",+ "none": "无",+ "sourceRevision": "team.md · 第 {revision} 版",+ "viewSource": "查看源文件",+ "hideSource": "隐藏源文件"}}