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): word TeamHub's catalog text by id
yunhe16c0b72790c1
diff --git a/apps/web/src/features/apps/app-description.test.ts b/apps/web/src/features/apps/app-description.test.tsnew file mode 100644index 00000000..77d75da7--- /dev/null+++ b/apps/web/src/features/apps/app-description.test.ts@@ -0,0 +1,38 @@+import { afterEach, describe, expect, it } from "vitest";++import type { TeamHubExternalApp } from "@/features/teamhub/teamhub-types";+import { resetLanguageForTest, setLanguage, translate } from "@/i18n/language";+import zhCN from "@/i18n/locales/zh-CN.json";++import { appDescription } from "./app-groups";++afterEach(() => resetLanguageForTest());++function app(key: string, description: string) {+ return { description, key } as TeamHubExternalApp;+}++describe("appDescription", () => {+ it("words a catalog app's description by its key", async () => {+ await setLanguage("zh-CN");+ expect(+ appDescription(+ app("slack", "Connect workspaces and selected channels."),+ translate,+ ),+ ).toBe(zhCN.appDescriptions.slack);+ });++ it("keeps TeamHub's text for an app this client does not know", async () => {+ await setLanguage("zh-CN");+ expect(+ appDescription(app("jira", "Let Agents work with Jira."), translate),+ ).toBe("Let Agents work with Jira.");+ });++ it("shows TeamHub's own text in English, even where the copy differs", () => {+ expect(+ appDescription(app("slack", "Slack, as TeamHub now says it."), translate),+ ).toBe("Slack, as TeamHub now says it.");+ });+});diff --git a/apps/web/src/features/apps/app-descriptions.messages.ts b/apps/web/src/features/apps/app-descriptions.messages.tsnew file mode 100644index 00000000..7c348732--- /dev/null+++ b/apps/web/src/features/apps/app-descriptions.messages.ts@@ -0,0 +1,28 @@+import { defineMessages } from "@/i18n/messages";++/**+ * TeamHub's longer description of each catalog app, worded by app key for+ * the manage dialog, where import limits and scope matter.+ */+export const appDescriptionMessages = defineMessages("appDescriptions", {+ mail: "Import the last six months, up to 3,000 messages, for Profile and Wiki.",+ googleDrive: "Let Agents work with your Drive files.",+ slack: "Connect workspaces and selected channels.",+ discord: "Connect one installed Discord server and selected channels.",+ facebook: "Connect supported Facebook content.",+ github:+ "Import a public profile and selected owned repositories, and let authorized Agents read repositories, issues, and pull requests.",+ googleMeet: "Connect available Google Meet records.",+ googleCalendar: "Connect calendars and import selected events.",+ notion:+ "Connect Notion to generate your profile and let authorized Agents use shared pages and databases.",+ linear: "Let Agents work with your Linear issues and projects.",+ figma: "Let Agents work with your Figma files.",+ canva: "Let Agents work with your Canva designs.",+ higgsfield: "Let Agents generate images and videos with Higgsfield.",+ falAi: "Let Agents run generative media models on fal.ai.",+ granola: "Let Agents read your Granola meeting notes and transcripts.",+ calendly:+ "Let Agents work with your Calendly event types and scheduled events.",+ outlookCalendar: "Let Agents work with your Outlook calendars and events.",+});diff --git a/apps/web/src/features/apps/app-groups.ts b/apps/web/src/features/apps/app-groups.tsindex 7bd7b79b..6b890819 100644--- a/apps/web/src/features/apps/app-groups.ts+++ b/apps/web/src/features/apps/app-groups.ts@@ -1,7 +1,9 @@+import { teamHubCatalogText } from "@/features/teamhub/teamhub-catalog-text";import type { TeamHubExternalApp } from "@/features/teamhub/teamhub-types";import { type Translate, translate } from "@/i18n/language";import type { Message } from "@/i18n/messages";+import { appDescriptionMessages as d } from "./app-descriptions.messages";import { connectorMessages as m } from "./connectors.messages";export interface AppGroup {@@ -91,3 +93,38 @@ export function groupCatalogApps(apps: readonly TeamHubExternalApp[]) {apps: group.apps.flatMap((key) => byKey.get(key) ?? []),})).filter((entry) => entry.apps.length > 0);}++const APP_DESCRIPTIONS: Record<string, Message<string>> = {+ calendly: d.calendly,+ canva: d.canva,+ discord: d.discord,+ facebook: d.facebook,+ fal_ai: d.falAi,+ figma: d.figma,+ github: d.github,+ gmail: d.mail,+ google_calendar: d.googleCalendar,+ google_meet: d.googleMeet,+ googledrive: d.googleDrive,+ granola: d.granola,+ higgsfield: d.higgsfield,+ linear: d.linear,+ notion: d.notion,+ outlook: d.mail,+ outlook_calendar: d.outlookCalendar,+ slack: d.slack,+};++/**+ * A catalog app's full description: TeamHub's own text in English and for+ * apps without a copy here.+ */+export function appDescription(+ app: TeamHubExternalApp,+ t: Translate = translate,+) {+ const description = Object.hasOwn(APP_DESCRIPTIONS, app.key)+ ? APP_DESCRIPTIONS[app.key]+ : undefined;+ return teamHubCatalogText(app.description, description, t);+}diff --git a/apps/web/src/features/apps/app-manage-dialog.tsx b/apps/web/src/features/apps/app-manage-dialog.tsxindex 24aca984..aae6d716 100644--- a/apps/web/src/features/apps/app-manage-dialog.tsx+++ b/apps/web/src/features/apps/app-manage-dialog.tsx@@ -23,6 +23,7 @@ import {externalConnectionQueryOptions,externalConnectionsQueryKey,} from "./connected-apps-queries";+import { appDescription } from "./app-groups";import { ConnectAppStatus, useConnectAppFlow } from "./connect-app-flow";import {establishedExternalConnections,@@ -66,7 +67,7 @@ export function AppManageDialog({<><ModalDialogcloseOnBackdrop- description={app.description}+ description={appDescription(app, t)}onClose={onClose}size="md"title={app.display_name}diff --git a/apps/web/src/features/apps/web-search-connectors.tsx b/apps/web/src/features/apps/web-search-connectors.tsxindex dda7b9cf..6f920275 100644--- a/apps/web/src/features/apps/web-search-connectors.tsx+++ b/apps/web/src/features/apps/web-search-connectors.tsx@@ -29,6 +29,11 @@ import { formatLocale, type Translation } from "@/i18n/language";import { useT, useTranslation } from "@/i18n/use-translation";import { formatUpdatedAt } from "@/lib/date-format";import { cn } from "@/lib/cn";+import {+ webSearchBackendDescription,+ webSearchBackendFreeTier,+ webSearchBackendFreeUse,+} from "@/features/web-search/web-search-backend-text";import { WEB_SEARCH_FILTER } from "./app-groups";import { AppLogo } from "./app-logo";@@ -120,7 +125,7 @@ function WebSearchBackendCard({const translation = useTranslation();const { t } = translation;const state = connectionState(backend, translation);- const line = state?.label ?? backend.description;+ const line = state?.label ?? webSearchBackendDescription(backend, t);const canConnect =isWebSearchKeyBackend(backend) &&(backend.key_state === "none" || state?.tone === "danger");@@ -193,7 +198,7 @@ function WebSearchBackendDialog({<ModalDialogclassName="app-key-dialog"closeOnBackdrop- description={backend.description}+ description={webSearchBackendDescription(backend, t)}onClose={onClose}size="md"title={backend.name}@@ -206,10 +211,14 @@ function WebSearchBackendDialog({: t(m.searches)}</Fact>{backend.free_tier ? (- <Fact label={t(m.factFreeTier)}>{backend.free_tier}</Fact>+ <Fact label={t(m.factFreeTier)}>+ {webSearchBackendFreeTier(backend, t) ?? ""}+ </Fact>) : null}{backend.tier_text ? (- <Fact label={t(m.factFreeUse)}>{backend.tier_text}</Fact>+ <Fact label={t(m.factFreeUse)}>+ {webSearchBackendFreeUse(backend, t) ?? ""}+ </Fact>) : null}{usage ? <Fact label={t(m.factUsage)}>{usage}</Fact> : null}</dl>diff --git a/apps/web/src/features/rooms/agent-templates/builtin-template-text.test.ts b/apps/web/src/features/rooms/agent-templates/builtin-template-text.test.tsnew file mode 100644index 00000000..d646e2ec--- /dev/null+++ b/apps/web/src/features/rooms/agent-templates/builtin-template-text.test.ts@@ -0,0 +1,63 @@+import { afterEach, describe, expect, it } from "vitest";++import { resetLanguageForTest, setLanguage, translate } from "@/i18n/language";+import zhCN from "@/i18n/locales/zh-CN.json";++import { templateDescription, templateName } from "./builtin-template-text";++afterEach(() => resetLanguageForTest());++describe("built-in template text", () => {+ it("words TeamHub's built-in templates by id", async () => {+ await setLanguage("zh-CN");+ const template = {+ description:+ "Reviews changes for correctness, risk, and clarity, and reports actionable findings.",+ name: "Code Reviewer",+ origin: "builtin",+ template_id: "code-reviewer",+ } as const;+ expect(templateName(template, translate)).toBe(+ zhCN.builtinTemplates.codeReviewerName,+ );+ expect(templateDescription(template, translate)).toBe(+ zhCN.builtinTemplates.codeReviewerDescription,+ );+ });++ it("keeps a published template's own words, even with a built-in id", async () => {+ await setLanguage("zh-CN");+ const template = {+ description: "My reviewer.",+ name: "Code Reviewer",+ origin: "published",+ template_id: "code-reviewer",+ } as const;+ expect(templateName(template, translate)).toBe("Code Reviewer");+ expect(templateDescription(template, translate)).toBe("My reviewer.");+ });++ it("keeps the text of a built-in template this client does not know", async () => {+ await setLanguage("zh-CN");+ const template = {+ description: "Writes release notes.",+ name: "Release Writer",+ origin: "builtin",+ template_id: "release-writer",+ } as const;+ expect(templateName(template, translate)).toBe("Release Writer");+ });++ it("shows TeamHub's own text in English, even where the copy differs", () => {+ const template = {+ description: "Reviews changes, as TeamHub now says it.",+ name: "Code Review",+ origin: "builtin",+ template_id: "code-reviewer",+ } as const;+ expect(templateName(template, translate)).toBe("Code Review");+ expect(templateDescription(template, translate)).toBe(+ "Reviews changes, as TeamHub now says it.",+ );+ });+});diff --git a/apps/web/src/features/rooms/agent-templates/builtin-template-text.ts b/apps/web/src/features/rooms/agent-templates/builtin-template-text.tsnew file mode 100644index 00000000..8c8c01f5--- /dev/null+++ b/apps/web/src/features/rooms/agent-templates/builtin-template-text.ts@@ -0,0 +1,46 @@+import { teamHubCatalogText } from "@/features/teamhub/teamhub-catalog-text";+import type { TeamHubAgentTemplate } from "@/features/teamhub/teamhub-types";+import type { Translate } from "@/i18n/language";+import type { Message } from "@/i18n/messages";++import { builtinTemplateMessages as m } from "./builtin-templates.messages";++const builtins: Readonly<+ Record<string, { name: Message<string>; description: Message<string> }>+> = {+ "research-analyst": {+ name: m.researchAnalystName,+ description: m.researchAnalystDescription,+ },+ "code-reviewer": {+ name: m.codeReviewerName,+ description: m.codeReviewerDescription,+ },+};++type Template = Pick<+ TeamHubAgentTemplate,+ "description" | "name" | "origin" | "template_id"+>;++// A published template is a Human's own words and stays as they wrote it.+function builtin(template: Template) {+ return template.origin === "builtin" &&+ Object.hasOwn(builtins, template.template_id)+ ? builtins[template.template_id]+ : undefined;+}++/** A template's name, worded for TeamHub's built-in templates. */+export function templateName(template: Template, t: Translate): string {+ return teamHubCatalogText(template.name, builtin(template)?.name, t);+}++/** A template's description, worded for TeamHub's built-in templates. */+export function templateDescription(template: Template, t: Translate): string {+ return teamHubCatalogText(+ template.description,+ builtin(template)?.description,+ t,+ );+}diff --git a/apps/web/src/features/rooms/agent-templates/builtin-templates.messages.ts b/apps/web/src/features/rooms/agent-templates/builtin-templates.messages.tsnew file mode 100644index 00000000..71f892c8--- /dev/null+++ b/apps/web/src/features/rooms/agent-templates/builtin-templates.messages.ts@@ -0,0 +1,11 @@+import { defineMessages } from "@/i18n/messages";++/** The names and descriptions of TeamHub's built-in Agent templates. */+export const builtinTemplateMessages = defineMessages("builtinTemplates", {+ researchAnalystName: "Research Analyst",+ researchAnalystDescription:+ "Turns questions and source material into sourced, decision-ready briefs.",+ codeReviewerName: "Code Reviewer",+ codeReviewerDescription:+ "Reviews changes for correctness, risk, and clarity, and reports actionable findings.",+});diff --git a/apps/web/src/features/rooms/agent-templates/create-agent-from-template-dialog.tsx b/apps/web/src/features/rooms/agent-templates/create-agent-from-template-dialog.tsxindex 18fb90e4..2a7a4ca7 100644--- a/apps/web/src/features/rooms/agent-templates/create-agent-from-template-dialog.tsx+++ b/apps/web/src/features/rooms/agent-templates/create-agent-from-template-dialog.tsx@@ -43,6 +43,7 @@ import { createTenantAgent } from "../members/create-tenant-agent";import { useAgentPlacementFlow } from "../members/use-agent-placement-flow";import { templateResourceChips } from "./agent-template";+import { templateDescription, templateName } from "./builtin-template-text";import { agentTemplateMessages as m } from "./agent-templates.messages";import {TemplateContents,@@ -218,13 +219,13 @@ function TemplatePicker({<ActorAvataravatarKey={template.avatar_key}kind="agent"- name={template.name}+ name={templateName(template, t)}size="md"/><span className="min-w-0 flex-1"><span className="flex min-w-0 items-baseline gap-1.5 pr-7"><span className="truncate text-sm font-semibold text-app-ink">- {template.name}+ {templateName(template, t)}</span>{template.published_by ? (<span className="shrink-0 truncate text-xs leading-4 text-muted-foreground">@@ -407,9 +408,9 @@ function TemplateSetup({template: TeamHubAgentTemplate;tenantId: string;}) {- const [name, setName] = useState(template.name);- const { client } = useTeamHubRuntime();const t = useT();+ const [name, setName] = useState(() => templateName(template, t));+ const { client } = useTeamHubRuntime();const placement = useAgentPlacementFlow({ tenantId });const modelSelection = useAgentModelSelection(placement.selection.runtimeModels,@@ -468,7 +469,7 @@ function TemplateSetup({}const input = {agentType: "general" as const,- description: template.description,+ description: templateDescription(template, t),instructions: template.instructions,model: modelSelection.model,...(modelSelection.reasoningEffort@@ -551,13 +552,13 @@ function TemplateSetup({<ActorAvataravatarKey={template.avatar_key}kind="agent"- name={template.name}+ name={templateName(template, t)}size="sm"/><div className="min-w-0">- <h2 className="truncate text-lg">{template.name}</h2>+ <h2 className="truncate text-lg">{templateName(template, t)}</h2><p className="mt-1 text-sm text-app-muted">- {template.description || t(m.chooseWhere)}+ {templateDescription(template, t) || t(m.chooseWhere)}</p></div></div>diff --git a/apps/web/src/features/rooms/cards/decision-search-key-view.tsx b/apps/web/src/features/rooms/cards/decision-search-key-view.tsxindex 5307598a..3060d271 100644--- a/apps/web/src/features/rooms/cards/decision-search-key-view.tsx+++ b/apps/web/src/features/rooms/cards/decision-search-key-view.tsx@@ -30,6 +30,7 @@ import { webSearchBackendLogo } from "@/features/web-search/web-search-logos";import type { Translate } from "@/i18n/language";import { useT } from "@/i18n/use-translation";import { cn } from "@/lib/cn";+import { webSearchBackendDescription } from "@/features/web-search/web-search-backend-text";import {CardActions,@@ -106,7 +107,7 @@ export function SearchKeyDecision({return (<CardBox heading={decisionCardHeading(card, t)} label={t(m.labelSearchKey)}><CardRow- detail={shown?.description}+ detail={shown && webSearchBackendDescription(shown, t)}icon={<AppLogoTile name={target.name} url={webSearchBackendLogo(shownID)} />}@@ -230,7 +231,7 @@ function OtherProviders({) : null}</p><p className="truncate text-xs text-app-muted">- {backend.description}+ {webSearchBackendDescription(backend, t)}</p></div></div>diff --git a/apps/web/src/features/rooms/members/agent-move-target.ts b/apps/web/src/features/rooms/members/agent-move-target.tsindex 5de183a5..c94cd246 100644--- a/apps/web/src/features/rooms/members/agent-move-target.ts+++ b/apps/web/src/features/rooms/members/agent-move-target.ts@@ -8,6 +8,7 @@ import type {import { translate, type Translate } from "@/i18n/language";import { agentRuntimeMessages } from "./agent-runtime.messages";+import { runtimeModelLabel } from "./runtime-model-label";import { reasoningEffortLabel } from "./use-agent-model-selection";export type LocalComputer = TeamHubLocalComputerPage["items"][number];@@ -198,9 +199,13 @@ export function describeMoveTarget(const runtime = computer?.runtimes.find((item) => item.type === target.runtimeType,);- const modelLabel =- runtime?.models.find((item) => item.id === target.model)?.label ??- target.model;+ const modelLabel = runtimeModelLabel(+ runtime?.models.find((item) => item.id === target.model) ?? {+ id: target.model,+ label: target.model,+ },+ t,+ );const summary = [runtimeLabels[target.runtimeType],modelLabel,diff --git a/apps/web/src/features/rooms/members/runtime-model-label.test.ts b/apps/web/src/features/rooms/members/runtime-model-label.test.tsnew file mode 100644index 00000000..d39cde69--- /dev/null+++ b/apps/web/src/features/rooms/members/runtime-model-label.test.ts@@ -0,0 +1,36 @@+import { afterEach, describe, expect, it } from "vitest";++import { resetLanguageForTest, setLanguage, translate } from "@/i18n/language";+import zhCN from "@/i18n/locales/zh-CN.json";++import { runtimeModelLabel } from "./runtime-model-label";++afterEach(() => resetLanguageForTest());++describe("runtimeModelLabel", () => {+ it("words TeamHub's stand-in default model by its id", async () => {+ await setLanguage("zh-CN");+ expect(+ runtimeModelLabel(+ { id: "codex-default", label: "Codex default" },+ translate,+ ),+ ).toBe(zhCN.runtimeModel.hostDefault.replace("{app}", "Codex"));+ });++ it("keeps the label a Runtime reported for its own models", async () => {+ await setLanguage("zh-CN");+ expect(+ runtimeModelLabel({ id: "gpt-5.5", label: "GPT-5.5" }, translate),+ ).toBe("GPT-5.5");+ });++ it("shows the label TeamHub sent in English", () => {+ expect(+ runtimeModelLabel(+ { id: "codex-default", label: "Codex's default model" },+ translate,+ ),+ ).toBe("Codex's default model");+ });+});diff --git a/apps/web/src/features/rooms/members/runtime-model-label.ts b/apps/web/src/features/rooms/members/runtime-model-label.tsnew file mode 100644index 00000000..a6437fc5--- /dev/null+++ b/apps/web/src/features/rooms/members/runtime-model-label.ts@@ -0,0 +1,30 @@+import { getLanguage, SOURCE_LANGUAGE, type Translate } from "@/i18n/language";++import { runtimeModelMessages } from "./runtime-model.messages";++// TeamHub's stand-in ids and the short app names its labels use, from+// defaultLocalRuntimeModels: "Claude default", not "Claude Code default".+const hostDefaults: Readonly<Record<string, string>> = {+ "claude-default": "Claude",+ "codex-default": "Codex",+ "pi-default": "Pi",+ "antigravity-default": "Antigravity",+};++/**+ * A Runtime model's name. TeamHub's stand-in for "the app's own default+ * model" is worded here by its id for languages other than English; every+ * other model keeps the label its Runtime reported.+ */+export function runtimeModelLabel(+ model: { readonly id: string; readonly label: string },+ t: Translate,+): string {+ const app = Object.hasOwn(hostDefaults, model.id)+ ? hostDefaults[model.id]+ : undefined;+ // As with teamHubCatalogText, the copy is only a translation: English+ // keeps the label TeamHub sent.+ if (!app || getLanguage() === SOURCE_LANGUAGE) return model.label;+ return t(runtimeModelMessages.hostDefault, { app });+}diff --git a/apps/web/src/features/rooms/members/runtime-model.messages.ts b/apps/web/src/features/rooms/members/runtime-model.messages.tsnew file mode 100644index 00000000..ff84b8e9--- /dev/null+++ b/apps/web/src/features/rooms/members/runtime-model.messages.ts@@ -0,0 +1,6 @@+import { defineMessages } from "@/i18n/messages";++/** The stand-in model TeamHub lists when a Runtime reports no models. */+export const runtimeModelMessages = defineMessages("runtimeModel", {+ hostDefault: "{app} default",+});diff --git a/apps/web/src/features/rooms/members/use-agent-model-selection.ts b/apps/web/src/features/rooms/members/use-agent-model-selection.tsindex 10b31aef..51512c17 100644--- a/apps/web/src/features/rooms/members/use-agent-model-selection.ts+++ b/apps/web/src/features/rooms/members/use-agent-model-selection.ts@@ -6,12 +6,14 @@ import { localModelsQueryOptions } from "@/features/local-models/local-models-quimport type { TeamHubClient } from "@/features/teamhub/teamhub-client";import { translate, type Translate } from "@/i18n/language";import type { Message } from "@/i18n/messages";+import { useT } from "@/i18n/use-translation";import type {TeamHubAgentReasoningEffort,TeamHubTenantAgent,} from "@/features/teamhub/teamhub-types";import { composerMessages } from "../chat/composer.messages";+import { runtimeModelLabel } from "./runtime-model-label";interface RuntimeModel {id: string;@@ -23,6 +25,7 @@ interface RuntimeModel {/** The model and reasoning effort of a new Agent, chosen among the models the* selected Computer Runtime reports; the first model is the default. */export function useAgentModelSelection(models: readonly RuntimeModel[]) {+ const t = useT();const [requestedModel, setRequestedModel] = useState("");const [requestedReasoningEffort, setRequestedReasoningEffort] = useState<TeamHubAgentReasoningEffort | ""@@ -42,7 +45,10 @@ export function useAgentModelSelection(models: readonly RuntimeModel[]) {: defaultReasoningEffort;return {- items: models.map(({ id, label }) => ({ value: id, label })),+ items: models.map((item) => ({+ value: item.id,+ label: runtimeModelLabel(item, t),+ })),model: selectedModel?.id ?? "",reasoningEffort,reasoningEfforts,@@ -89,6 +95,7 @@ export function useResolvedAgentModelLabel(tenantId: string,runtime: TeamHubTenantAgent["runtime"] | undefined,): string | undefined {+ const t = useT();const placement = runtime?.placement;const computerId =placement?.type === "local" ? placement.computer_id : undefined;@@ -96,10 +103,11 @@ export function useResolvedAgentModelLabel(...localComputersQueryOptions(client, tenantId),enabled: Boolean(computerId),});- const catalogLabel = computers.data?.items+ const catalogModel = computers.data?.items.find((item) => item.computer_id === computerId)?.runtimes.find((item) => item.type === placement?.runtime_type)- ?.models.find((item) => item.id === runtime?.model)?.label;+ ?.models.find((item) => item.id === runtime?.model);+ const catalogLabel = catalogModel && runtimeModelLabel(catalogModel, t);const localModels = useQuery({...localModelsQueryOptions(client, tenantId, computerId ?? ""),enabled: Boolean(@@ -114,5 +122,11 @@ export function useResolvedAgentModelLabel((item) => item.model.pi_model === runtime?.model,)?.model.name: undefined;- return catalogLabel ?? localModelLabel ?? runtime?.model;+ return (+ catalogLabel ??+ localModelLabel ??+ (runtime?.model+ ? runtimeModelLabel({ id: runtime.model, label: runtime.model }, t)+ : undefined)+ );}diff --git a/apps/web/src/features/rooms/quick-create-local-agent-dialog.tsx b/apps/web/src/features/rooms/quick-create-local-agent-dialog.tsxindex 0cba8684..80dfe748 100644--- a/apps/web/src/features/rooms/quick-create-local-agent-dialog.tsx+++ b/apps/web/src/features/rooms/quick-create-local-agent-dialog.tsx@@ -30,6 +30,7 @@ import {} from "./quick-create-general-agent-page";import { AgentCreationProgress } from "./agent-creation-progress";import { createAgentMessages } from "./create-agent.messages";+import { runtimeModelLabel } from "./members/runtime-model-label";const localRuntimeLabels: Record<TeamHubLocalRuntimeType, string> = {claude: "Claude Code",@@ -409,7 +410,7 @@ export function QuickCreateLocalAgentDialog({>{modelOptions.map((model) => (<SelectItem key={model.id} value={model.id}>- {model.label}+ {runtimeModelLabel(model, t)}</SelectItem>))}</Select>diff --git a/apps/web/src/features/teamhub/teamhub-catalog-text.ts b/apps/web/src/features/teamhub/teamhub-catalog-text.tsnew file mode 100644index 00000000..d44a96b8--- /dev/null+++ b/apps/web/src/features/teamhub/teamhub-catalog-text.ts@@ -0,0 +1,16 @@+import { getLanguage, SOURCE_LANGUAGE, type Translate } from "@/i18n/language";+import type { Message } from "@/i18n/messages";++/**+ * Catalog text TeamHub sends in English, such as a provider's free tier, in+ * the interface language. The client's copy is only a translation: in English+ * TeamHub's own text shows, so a change on the server shows at once, and the+ * copy is used for other languages only.+ */+export function teamHubCatalogText(+ sent: string,+ copy: Message<string> | undefined,+ t: Translate,+): string {+ return copy && getLanguage() !== SOURCE_LANGUAGE ? t(copy) : sent;+}diff --git a/apps/web/src/features/web-search/web-search-backend-text.messages.ts b/apps/web/src/features/web-search/web-search-backend-text.messages.tsnew file mode 100644index 00000000..4ba21a9e--- /dev/null+++ b/apps/web/src/features/web-search/web-search-backend-text.messages.ts@@ -0,0 +1,30 @@+import { defineMessages } from "@/i18n/messages";++/**+ * The descriptions and free use TeamHub's web search catalog gives each+ * backend, worded on the client by backend id.+ */+export const webSearchBackendTextMessages = defineMessages(+ "webSearchBackendText",+ {+ descriptionTavily: "The real-time search engine for AI agents.",+ descriptionBrave:+ "Enterprise-grade web search API with an index of 40+ billion pages.",+ descriptionFirecrawl: "Web data API for AI agents.",+ descriptionExa: "Search API for AI agents that need real-time web data.",+ descriptionYou: "Web search API for AI agents and LLMs.",+ descriptionDuckDuckGo: "Private search from the Internet privacy company.",+ descriptionDirect: "Reads pages from the Agent's own computer.",+ freeTierTavily: "1,000 free API credits every month.",+ freeTierBrave:+ "$5 of free credit every month; sign-up needs a credit card.",+ freeTierFirecrawl: "1,000 free credits every month.",+ freeTierExa: "$10 of free credit every month; no card needed.",+ freeTierYou:+ "Works without a key, limited; a key gives full quality and higher limits.",+ freeUseYou:+ "Free without a key: limited searches with lower quality results.",+ freeUseDuckDuckGo:+ "Free, no key: DuckDuckGo blocks searches for a while when they come too often.",+ },+);diff --git a/apps/web/src/features/web-search/web-search-backend-text.test.ts b/apps/web/src/features/web-search/web-search-backend-text.test.tsnew file mode 100644index 00000000..ea72fb6c--- /dev/null+++ b/apps/web/src/features/web-search/web-search-backend-text.test.ts@@ -0,0 +1,63 @@+import { afterEach, describe, expect, it } from "vitest";++import { resetLanguageForTest, setLanguage, translate } from "@/i18n/language";+import zhCN from "@/i18n/locales/zh-CN.json";++import {+ webSearchBackendDescription,+ webSearchBackendFreeTier,+ webSearchBackendFreeUse,+} from "./web-search-backend-text";++afterEach(() => resetLanguageForTest());++const tavily = {+ description: "The real-time search engine for AI agents.",+ free_tier: "1,000 free API credits every month.",+ id: "tavily",+} as const;++describe("web search backend text", () => {+ it("words a known backend's text by its id", async () => {+ await setLanguage("zh-CN");+ expect(webSearchBackendDescription(tavily, translate)).toBe(+ zhCN.webSearchBackendText.descriptionTavily,+ );+ expect(webSearchBackendFreeTier(tavily, translate)).toBe(+ zhCN.webSearchBackendText.freeTierTavily,+ );+ });++ it("shows nothing TeamHub did not send", async () => {+ await setLanguage("zh-CN");+ expect(webSearchBackendFreeUse(tavily, translate)).toBeUndefined();+ });++ it("keeps TeamHub's English for a backend this client does not know", async () => {+ await setLanguage("zh-CN");+ const backend = {+ description: "A new search API.",+ free_tier: "Free for a week.",+ id: "newsearch" as never,+ };+ expect(webSearchBackendDescription(backend, translate)).toBe(+ "A new search API.",+ );+ expect(webSearchBackendFreeTier(backend, translate)).toBe(+ "Free for a week.",+ );+ });++ it("shows TeamHub's own text in English, even where the copy differs", () => {+ const changed = {+ ...tavily,+ free_tier: "500 free API credits every month.",+ };+ expect(webSearchBackendFreeTier(changed, translate)).toBe(+ "500 free API credits every month.",+ );+ expect(webSearchBackendDescription(changed, translate)).toBe(+ tavily.description,+ );+ });+});diff --git a/apps/web/src/features/web-search/web-search-backend-text.ts b/apps/web/src/features/web-search/web-search-backend-text.tsnew file mode 100644index 00000000..e1d1debb--- /dev/null+++ b/apps/web/src/features/web-search/web-search-backend-text.ts@@ -0,0 +1,63 @@+import { teamHubCatalogText } from "@/features/teamhub/teamhub-catalog-text";+import type { TeamHubWebSearchBackend } from "@/features/teamhub/teamhub-types";+import type { Translate } from "@/i18n/language";+import type { Message } from "@/i18n/messages";++import { webSearchBackendTextMessages as m } from "./web-search-backend-text.messages";++type BackendId = TeamHubWebSearchBackend["id"];++const descriptions: Partial<Record<BackendId, Message<string>>> = {+ tavily: m.descriptionTavily,+ brave: m.descriptionBrave,+ firecrawl: m.descriptionFirecrawl,+ exa: m.descriptionExa,+ you: m.descriptionYou,+ duckduckgo: m.descriptionDuckDuckGo,+ direct: m.descriptionDirect,+};++const freeTiers: Partial<Record<BackendId, Message<string>>> = {+ tavily: m.freeTierTavily,+ brave: m.freeTierBrave,+ firecrawl: m.freeTierFirecrawl,+ exa: m.freeTierExa,+ you: m.freeTierYou,+};++const freeUses: Partial<Record<BackendId, Message<string>>> = {+ you: m.freeUseYou,+ duckduckgo: m.freeUseDuckDuckGo,+};++function worded(+ table: Partial<Record<BackendId, Message<string>>>,+ id: string,+ sent: string | undefined,+ t: Translate,+) {+ // Only text TeamHub sent is worded, so a backend without it shows none.+ if (!sent) return sent;+ const message = Object.hasOwn(table, id) ? table[id as BackendId] : undefined;+ return teamHubCatalogText(sent, message, t);+}++type Backend = Pick<+ TeamHubWebSearchBackend,+ "description" | "free_tier" | "id" | "tier_text"+>;++/** The provider's one-line description; an unknown backend keeps TeamHub's. */+export function webSearchBackendDescription(backend: Backend, t: Translate) {+ return worded(descriptions, backend.id, backend.description, t) ?? "";+}++/** What a key's free plan gives, when TeamHub says. */+export function webSearchBackendFreeTier(backend: Backend, t: Translate) {+ return worded(freeTiers, backend.id, backend.free_tier, t);+}++/** What the keyless free use allows, when TeamHub says. */+export function webSearchBackendFreeUse(backend: Backend, t: Translate) {+ return worded(freeUses, backend.id, backend.tier_text, t);+}diff --git a/apps/web/src/features/web-search/web-search.messages.ts b/apps/web/src/features/web-search/web-search.messages.tsindex 5c175d3d..89ade03f 100644--- a/apps/web/src/features/web-search/web-search.messages.ts+++ b/apps/web/src/features/web-search/web-search.messages.ts@@ -2,8 +2,8 @@ import { defineMessages } from "@/i18n/messages";/*** The web search key field, shared by Connectors and the chat's search key- * card. Backend names and descriptions TeamHub sends are data and are shown- * as they arrive.+ * card. Backend names are brands and stay as TeamHub sends them; their+ * descriptions are worded in web-search-backend-text.ts.*/export const webSearchMessages = defineMessages("webSearch", {apiKey: "{backend} API key",diff --git a/apps/web/src/i18n/locales/zh-CN.json b/apps/web/src/i18n/locales/zh-CN.jsonindex c2329591..9728ee09 100644--- a/apps/web/src/i18n/locales/zh-CN.json+++ b/apps/web/src/i18n/locales/zh-CN.json@@ -2795,5 +2795,49 @@"roomCreation": "请求创建协作 Room:{name}","agentCreate": "创建 Agent“{name}”","agentChange": "修改 Agent“{name}”"+ },+ "runtimeModel": {+ "hostDefault": "{app} 默认"+ },+ "webSearchBackendText": {+ "descriptionTavily": "面向 AI Agent 的实时搜索引擎。",+ "descriptionBrave": "企业级网页搜索 API,索引超过 400 亿个网页。",+ "descriptionFirecrawl": "面向 AI Agent 的网页数据 API。",+ "descriptionExa": "面向需要实时网页数据的 AI Agent 的搜索 API。",+ "descriptionYou": "面向 AI Agent 和大语言模型的网页搜索 API。",+ "descriptionDuckDuckGo": "来自互联网隐私公司的私密搜索。",+ "descriptionDirect": "从 Agent 自己的电脑读取网页。",+ "freeTierTavily": "每月 1,000 个免费 API 额度。",+ "freeTierBrave": "每月 5 美元免费额度;注册需要绑定信用卡。",+ "freeTierFirecrawl": "每月 1,000 个免费额度。",+ "freeTierExa": "每月 10 美元免费额度;无需绑卡。",+ "freeTierYou": "不填密钥也能用,但有限制;填写密钥可获得完整质量和更高额度。",+ "freeUseYou": "不填密钥即可免费使用:搜索次数有限,结果质量较低。",+ "freeUseDuckDuckGo": "免费,无需密钥:搜索过于频繁时,DuckDuckGo 会暂时拦截。"+ },+ "appDescriptions": {+ "mail": "导入最近六个月、最多 3,000 封邮件,用于个人资料和 Wiki。",+ "googleDrive": "让 Agent 使用你的 Drive 文件。",+ "slack": "连接工作区和所选频道。",+ "discord": "连接一个已安装的 Discord 服务器和所选频道。",+ "facebook": "连接受支持的 Facebook 内容。",+ "github": "导入公开资料和所选的自有仓库,并让获得授权的 Agent 读取仓库、Issue 和 Pull Request。",+ "googleMeet": "连接可用的 Google Meet 记录。",+ "googleCalendar": "连接日历并导入所选日程。",+ "notion": "连接 Notion 来生成你的个人资料,并让获得授权的 Agent 使用共享的页面和数据库。",+ "linear": "让 Agent 使用你的 Linear Issue 和项目。",+ "figma": "让 Agent 使用你的 Figma 文件。",+ "canva": "让 Agent 使用你的 Canva 设计。",+ "higgsfield": "让 Agent 用 Higgsfield 生成图片和视频。",+ "falAi": "让 Agent 在 fal.ai 上运行生成式媒体模型。",+ "granola": "让 Agent 读取你的 Granola 会议笔记和转写。",+ "calendly": "让 Agent 使用你的 Calendly 活动类型和已安排的活动。",+ "outlookCalendar": "让 Agent 使用你的 Outlook 日历和日程。"+ },+ "builtinTemplates": {+ "researchAnalystName": "研究分析师",+ "researchAnalystDescription": "把问题和资料整理成有出处、可直接用于决策的简报。",+ "codeReviewerName": "代码审查员",+ "codeReviewerDescription": "从正确性、风险和清晰度审查改动,并给出可执行的发现。"}}