π€― LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
π fix: name the deployment's own app in server notices and run context (#22109)
LiJian73a55b0f811c
diff --git a/apps/desktop/pnpm-lock.yaml b/apps/desktop/pnpm-lock.yamlindex 0aaee84966b..621c6e8250b 100644--- a/apps/desktop/pnpm-lock.yaml+++ b/apps/desktop/pnpm-lock.yaml@@ -637,6 +637,9 @@ importers:../../packages/prompts:dependencies:+ '@lobechat/business-const':+ specifier: workspace:*+ version: link:../business/const'@lobechat/const':specifier: workspace:*version: link:../constdiff --git a/apps/server/src/modules/AgentRuntime/llmRelay/clientWait.ts b/apps/server/src/modules/AgentRuntime/llmRelay/clientWait.tsindex c682c20f337..5dd99096e8f 100644--- a/apps/server/src/modules/AgentRuntime/llmRelay/clientWait.ts+++ b/apps/server/src/modules/AgentRuntime/llmRelay/clientWait.ts@@ -1,4 +1,5 @@import type { AgentRunClientLlmWait, AgentRuntimeContext } from '@lobechat/agent-runtime';+import { BRANDING_NAME } from '@lobechat/business-const';import type { ChatMessageError } from '@lobechat/types';import { AgentRuntimeErrorType } from '@lobechat/types';@@ -85,7 +86,7 @@ export const buildClientLlmWaitMessageError = (wait: AgentRunClientLlmWait): Charecoverable: true,waitingForClient: true,},- message: `Waiting for a LobeHub client that can reach ${wait.provider}`,+ message: `Waiting for a ${BRANDING_NAME} client that can reach ${wait.provider}`,type: AgentRuntimeErrorType.ClientLlmExecutorUnavailable,});diff --git a/apps/server/src/modules/AgentRuntime/llmRelay/oneShot.ts b/apps/server/src/modules/AgentRuntime/llmRelay/oneShot.tsindex b0372058c39..9794a2a7d03 100644--- a/apps/server/src/modules/AgentRuntime/llmRelay/oneShot.ts+++ b/apps/server/src/modules/AgentRuntime/llmRelay/oneShot.ts@@ -1,4 +1,5 @@import type { LlmRelayDeadlines } from '@lobechat/agent-gateway-client';+import { BRANDING_NAME } from '@lobechat/business-const';import type {ChatMethodOptions,ChatStreamPayload,@@ -113,7 +114,7 @@ class OneShotRelayRuntime implements RequestModelRuntime {const noClientRequestError = (provider: string) =>createClientLlmExecutorUnavailableError(provider, 'no_executor', {context: 'no_client_request',- message: `${provider} runs on the user's device, and no open LobeHub tab is attached to this request to run it.`,+ message: `${provider} runs on the user's device, and no open ${BRANDING_NAME} tab is attached to this request to run it.`,});export interface InitModelRuntimeForRequestOptions {diff --git a/apps/server/src/router-hono/agent/handlers/messengerInstall.ts b/apps/server/src/router-hono/agent/handlers/messengerInstall.tsindex 232a195a95d..44f05a8e0d4 100644--- a/apps/server/src/router-hono/agent/handlers/messengerInstall.ts+++ b/apps/server/src/router-hono/agent/handlers/messengerInstall.ts@@ -1,3 +1,4 @@+import { BRANDING_NAME } from '@lobechat/business-const';import debug from 'debug';import type { Context } from 'hono';@@ -60,7 +61,7 @@ export async function messengerInstall(c: Context): Promise<Response> {if (!config) {log('install: %s messenger not configured', platform);return new Response(- `${definition.name} messenger is not configured on this LobeHub deployment. ` ++ `${definition.name} messenger is not configured on this ${BRANDING_NAME} deployment. ` +`Ask the operator to add a ${definition.name} bot in dc-center β Agent β System Bots ` +`and enable it.`,{ status: 503 },diff --git a/apps/server/src/router-hono/agent/handlers/messengerOAuthCallback.ts b/apps/server/src/router-hono/agent/handlers/messengerOAuthCallback.tsindex ede5473ca38..1aeb694eb40 100644--- a/apps/server/src/router-hono/agent/handlers/messengerOAuthCallback.ts+++ b/apps/server/src/router-hono/agent/handlers/messengerOAuthCallback.ts@@ -1,3 +1,4 @@+import { BRANDING_NAME } from '@lobechat/business-const';import debug from 'debug';import type { Context } from 'hono';@@ -75,7 +76,7 @@ export async function messengerOAuthCallback(c: Context): Promise<Response> {if (!config) {log('callback[%s]: messenger env not configured', platform);return new Response(- `${definition.name} messenger is not configured on this LobeHub deployment.`,+ `${definition.name} messenger is not configured on this ${BRANDING_NAME} deployment.`,{ status: 503 },);}diff --git a/apps/server/src/services/agentRuntime/AgentRuntimeService/clientLlmWait.ts b/apps/server/src/services/agentRuntime/AgentRuntimeService/clientLlmWait.tsindex cf831afb825..3e22e8b3d76 100644--- a/apps/server/src/services/agentRuntime/AgentRuntimeService/clientLlmWait.ts+++ b/apps/server/src/services/agentRuntime/AgentRuntimeService/clientLlmWait.ts@@ -4,6 +4,7 @@ import type {AgentRuntimeContext,AgentState,} from '@lobechat/agent-runtime';+import { BRANDING_NAME } from '@lobechat/business-const';import { type ClientLlmWaitItem, type ResumeClientLlmWaitResult } from '@lobechat/types';import debug from 'debug';import pMap from 'p-map';@@ -520,7 +521,7 @@ export async function finishClientLlmWaitExpiry(await deps.traceRecorder.finalize(operationId, {completionReason: 'error',error: {- message: `No LobeHub client picked up the ${provider ?? 'local model'} call in time`,+ message: `No ${BRANDING_NAME} client picked up the ${provider ?? 'local model'} call in time`,type: String(finalState.error?.type ?? 'ClientLlmExecutorUnavailable'),},state: finalState,diff --git a/apps/server/src/services/connector/oauth.ts b/apps/server/src/services/connector/oauth.tsindex a4a94fdcf1f..09b9c6ab4bc 100644--- a/apps/server/src/services/connector/oauth.ts+++ b/apps/server/src/services/connector/oauth.ts@@ -1,3 +1,4 @@+import { BRANDING_NAME } from '@lobechat/business-const';import { ssrfSafeFetch } from '@lobechat/ssrf-safe-fetch';import type {AuthorizationServerMetadata,@@ -153,7 +154,7 @@ export const registerDynamicClient = async (params: {}): Promise<OAuthClientInformationFull> => {return registerClient(params.authorizationServerUrl, {clientMetadata: {- client_name: params.clientName ?? 'LobeHub',+ client_name: params.clientName ?? BRANDING_NAME,grant_types: ['authorization_code', 'refresh_token'],redirect_uris: [params.redirectUri],response_types: ['code'],diff --git a/apps/server/src/services/scm/ScmIngestService.ts b/apps/server/src/services/scm/ScmIngestService.tsindex 457f22ed465..b5cb68a0f21 100644--- a/apps/server/src/services/scm/ScmIngestService.ts+++ b/apps/server/src/services/scm/ScmIngestService.ts@@ -1,3 +1,4 @@+import { BRANDING_NAME } from '@lobechat/business-const';import debug from 'debug';import { isFailingCheck, ScmChangeRequestModel, ScmInstallationModel } from '@/database/models/scm';@@ -76,7 +77,7 @@ export class ScmIngestService {if (!existing) {return {- detail: `installation ${installation.installationId} is not bound to a LobeHub scope`,+ detail: `installation ${installation.installationId} is not bound to a ${BRANDING_NAME} scope`,status: 'skipped',};}diff --git a/apps/server/src/services/scm/trackingComment.ts b/apps/server/src/services/scm/trackingComment.tsindex 28a74f0f75e..e8d8ac39eaf 100644--- a/apps/server/src/services/scm/trackingComment.ts+++ b/apps/server/src/services/scm/trackingComment.ts@@ -1,3 +1,4 @@+import { BRANDING_NAME } from '@lobechat/business-const';import type { AcceptanceStatus, ScmProvider } from '@lobechat/types';/**@@ -110,7 +111,7 @@ export const buildTrackingComment = (input: TrackingCommentInput): string => {return [encodeTrackingMarker(marker),'',- `**LobeHub is tracking this pull request.** Merging accepts the delivery; failing checks and review feedback reach the agent that opened it. [Learn more βοΈ](${GITHUB_INTEGRATION_DOCS_URL})`,+ `**${BRANDING_NAME} is tracking this pull request.** Merging accepts the delivery; failing checks and review feedback reach the agent that opened it. [Learn more βοΈ](${GITHUB_INTEGRATION_DOCS_URL})`,'','| Acceptance | Status | Conversation | Notifications | Updated (UTC) |','| :--- | :--- | :--- | :--- | :--- |',diff --git a/apps/server/src/services/toolExecution/index.ts b/apps/server/src/services/toolExecution/index.tsindex 487df645dcd..a067d87ffb1 100644--- a/apps/server/src/services/toolExecution/index.ts+++ b/apps/server/src/services/toolExecution/index.ts@@ -1,3 +1,4 @@+import { BRANDING_NAME } from '@lobechat/business-const';import { DEFAULT_TOOL_RESULT_MAX_LENGTH, truncateToolResult } from '@lobechat/prompts/toolResult';import { type ChatToolPayload } from '@lobechat/types';import { safeParseJSON } from '@lobechat/utils';@@ -327,7 +328,7 @@ export class ToolExecutionService {: undefined;if (!tunnelTarget) {log('Device-only MCP %s:%s has no reachable device β failing fast', identifier, apiName);- const message = `MCP server '${identifier}' only your own machine can reach (stdio or local network). No online LobeHub desktop app was found to run it (a device connected only through the \`lh connect\` CLI cannot run MCP servers) β open the LobeHub desktop app on the machine that hosts this MCP server, then retry.`;+ const message = `MCP server '${identifier}' only your own machine can reach (stdio or local network). No online ${BRANDING_NAME} desktop app was found to run it (a device connected only through the \`lh connect\` CLI cannot run MCP servers) β open the LobeHub desktop app on the machine that hosts this MCP server, then retry.`;return {content: message,error: { code: 'MCP_DEVICE_UNAVAILABLE', message },diff --git a/apps/server/src/services/toolExecution/serverRuntimes/auv.ts b/apps/server/src/services/toolExecution/serverRuntimes/auv.tsindex 4039883b042..cd38d91ae71 100644--- a/apps/server/src/services/toolExecution/serverRuntimes/auv.ts+++ b/apps/server/src/services/toolExecution/serverRuntimes/auv.ts@@ -1,4 +1,5 @@import { AuvApiName, AuvIdentifier } from '@lobechat/builtin-tool-auv';+import { BRANDING_NAME } from '@lobechat/business-const';import type { DeviceClient } from '@lobechat/types';import { deviceGateway } from '@/server/services/deviceGateway';@@ -30,17 +31,17 @@ const buildUnverifiedDeviceResult = (const message =clientKind === 'cli-only'? `The active device (${deviceId}) is connected only through ${CLI_WITHOUT_COMPUTER_USE}. ` +- `Nothing was run. Ask the user to open the LobeHub desktop app on that machine, or to ` ++ `Nothing was run. Ask the user to open the ${BRANDING_NAME} desktop app on that machine, or to ` +`restart \`lh connect\` with \`--auv\`, then retry.`: clientKind === 'mixed'? `Could not confirm that the active device (${deviceId}) can run Computer Use: the ` +`desktop app did not answer the capability check (${reason}), and the device also runs ` +`${CLI_WITHOUT_COMPUTER_USE}. Nothing was run. Retry shortly; if it keeps failing, ask ` +- `the user to check that the LobeHub desktop app is running and connected.`+ `the user to check that the ${BRANDING_NAME} desktop app is running and connected.`: `Could not confirm that the active device (${deviceId}) can run Computer Use: it did ` +`not answer the capability check (${reason}). Nothing was run. The device may be busy ` +`or reconnecting β retry shortly, and if it keeps failing, ask the user to check that ` +- `the LobeHub desktop app is running and connected.`;+ `the ${BRANDING_NAME} desktop app is running and connected.`;return {content: message,error: { code: COMPUTER_USE_DEVICE_UNAVAILABLE_ERROR_CODE, message },diff --git a/apps/server/src/services/toolExecution/serverRuntimes/browser.ts b/apps/server/src/services/toolExecution/serverRuntimes/browser.tsindex d28bfa9b5cc..905ab755cba 100644--- a/apps/server/src/services/toolExecution/serverRuntimes/browser.ts+++ b/apps/server/src/services/toolExecution/serverRuntimes/browser.ts@@ -1,5 +1,6 @@import { BrowserIdentifier, BrowserManifest } from '@lobechat/builtin-tool-browser';import { WebBrowsingManifest } from '@lobechat/builtin-tool-web-browsing';+import { BRANDING_NAME } from '@lobechat/business-const';import type { DeviceClient } from '@lobechat/types';import debug from 'debug';@@ -126,7 +127,7 @@ const buildCliOnlyDeviceBrowserResult = (publicPageHint +`To enable it, ask the user to install agent-browser on that machine ` +`(\`npm i -g agent-browser && agent-browser install\`) and restart \`lh connect\`; ` +- `if a signed-in browser session is required, ask them to open the LobeHub desktop app ` ++ `if a signed-in browser session is required, ask them to open the ${BRANDING_NAME} desktop app ` +`on a machine and activate that device instead, then retry.`;return {content: message,diff --git a/apps/server/src/services/toolExecution/serverRuntimes/skills.ts b/apps/server/src/services/toolExecution/serverRuntimes/skills.tsindex 2f99664455f..5ac662b1c90 100644--- a/apps/server/src/services/toolExecution/serverRuntimes/skills.ts+++ b/apps/server/src/services/toolExecution/serverRuntimes/skills.ts@@ -15,6 +15,7 @@ import {type SkillRuntimeService,SkillsExecutionRuntime,} from '@lobechat/builtin-tool-skills/executionRuntime';+import { BRANDING_NAME } from '@lobechat/business-const';import { resolveShareAllowedSkillIds } from '@lobechat/const';import {type BuiltinSkill,@@ -140,8 +141,7 @@ const LEGACY_DEVICE_CLIENT = Symbol('legacy-device-client');* discloses the degradation β the manifest already told it the command would* run on the user's device.*/-const LEGACY_FALLBACK_NOTE =- "Note: the user's device client is outdated and does not support on-device skill execution, so this command ran in the cloud sandbox instead. Tell the user to update their LobeHub app to run skills on their device.";+const LEGACY_FALLBACK_NOTE = `Note: the user's device client is outdated and does not support on-device skill execution, so this command ran in the cloud sandbox instead. Tell the user to update their ${BRANDING_NAME} app to run skills on their device.`;class SkillServerRuntimeService implements SkillRuntimeService {private agentId?: string;@@ -567,7 +567,7 @@ class SkillServerRuntimeService implements SkillRuntimeService {return fail(`Failed to prepare skill "${archive.name}" on the user's device: ${prepared.error ?? 'unknown error'}. ` +- 'Do not retry elsewhere β report this to the user (their LobeHub app may need an update).',+ `Do not retry elsewhere β report this to the user (their ${BRANDING_NAME} app may need an update).`,);}runDir = prepared.extractedDir;diff --git a/packages/builtin-skills/package.json b/packages/builtin-skills/package.jsonindex a31cc70e3a7..407edd9d258 100644--- a/packages/builtin-skills/package.json+++ b/packages/builtin-skills/package.json@@ -11,6 +11,7 @@"main": "./src/index.ts","dependencies": {"@lobechat/artifact-template": "workspace:*",+ "@lobechat/business-const": "workspace:*","fflate": "^0.8.3","yaml": "^2.9.0","zod": "^4.4.3"diff --git a/packages/builtin-skills/src/agent-browser/content.ts b/packages/builtin-skills/src/agent-browser/content.tsindex 89b076d57b7..4bd6de4420d 100644--- a/packages/builtin-skills/src/agent-browser/content.ts+++ b/packages/builtin-skills/src/agent-browser/content.ts@@ -1,3 +1,4 @@+import { BRANDING_NAME } from '@lobechat/business-const';/*** The agent-browser release the desktop app downloads* (`apps/desktop/src/main/modules/binaries/agentBrowserBinaries.ts` `pinnedVersion`).@@ -27,7 +28,7 @@ where.exe agent-browser # Windows (cmd or PowerShell)\`\`\`bash${NPX_AGENT_BROWSER} open example.com\`\`\`-- **Neither works** (no \`npx\` either) β stop and tell the user \`agent-browser\` isn't installed on this device yet. The LobeHub desktop app retries the download on its next launch, and **Settings β System Tools β Browser Automation** shows whether it's been detected; they can also install it themselves with \`npm i -g agent-browser\` or \`brew install agent-browser\`. Don't hand-roll a replacement with curl/python scraping.+- **Neither works** (no \`npx\` either) β stop and tell the user \`agent-browser\` isn't installed on this device yet. The ${BRANDING_NAME} desktop app retries the download on its next launch, and **Settings β System Tools β Browser Automation** shows whether it's been detected; they can also install it themselves with \`npm i -g agent-browser\` or \`brew install agent-browser\`. Don't hand-roll a replacement with curl/python scraping.If a command fails because no browser is available, run \`agent-browser install\` (same prefix) once to download Chrome for Testing, then retry.diff --git a/packages/const/src/heterogeneousAgent.ts b/packages/const/src/heterogeneousAgent.tsindex ff7b49b2fa5..b98976d8a7f 100644--- a/packages/const/src/heterogeneousAgent.ts+++ b/packages/const/src/heterogeneousAgent.ts@@ -1,3 +1,5 @@+import { BRANDING_NAME } from '@lobechat/business-const';+/** Model instruction used when resuming an interrupted Claude Code or Codex session. */export const HETERO_CONTINUE_PROMPT ='Continue the task from where it stopped. The transcript above shows the work already completed β do not redo it.';@@ -8,8 +10,7 @@ export const HETERO_CONTINUE_PROMPT =* is answered with the CLI's own "[Request interrupted]" marker, so the model* only needs to be told why it stopped and to pick up rather than start over.*/-export const HETERO_RESTART_CONTINUE_PROMPT =- 'The LobeHub desktop app hosting this session was restarted while you were working, which interrupted your previous turn. Continue the task from where it stopped β the transcript above shows the work already completed, do not redo it. If the task was already finished, briefly report the final result instead.';+export const HETERO_RESTART_CONTINUE_PROMPT = `The ${BRANDING_NAME} desktop app hosting this session was restarted while you were working, which interrupted your previous turn. Continue the task from where it stopped β the transcript above shows the work already completed, do not redo it. If the task was already finished, briefly report the final result instead.`;/*** Legacy heterogeneous-agent model IDs. Before `agencyConfig.heterogeneousProvider`diff --git a/packages/prompts/package.json b/packages/prompts/package.jsonindex ab1fb679dd8..3f44fa5ad8a 100644--- a/packages/prompts/package.json+++ b/packages/prompts/package.json@@ -16,6 +16,7 @@"test:update": "vitest -u"},"dependencies": {+ "@lobechat/business-const": "workspace:*","@lobechat/const": "workspace:*"},"devDependencies": {diff --git a/packages/prompts/src/prompts/workspaceContext/index.ts b/packages/prompts/src/prompts/workspaceContext/index.tsindex 21713cc836e..0aac57b3375 100644--- a/packages/prompts/src/prompts/workspaceContext/index.ts+++ b/packages/prompts/src/prompts/workspaceContext/index.ts@@ -1,3 +1,5 @@+import { BRANDING_NAME } from '@lobechat/business-const';+import { escapeXmlContent } from '../search/xmlEscape';export interface WorkspaceContextWorkspace {@@ -75,14 +77,14 @@ export const workspaceContextPrompt = ({ appUrl, workspace }: WorkspaceContextInif (origin) lines.push(` <app_url>${escapedOrigin}</app_url>`);lines.push(` <link_base>${linkBase}</link_base>`);lines.push(- ` <instruction>You are running inside the LobeHub app${origin ? ` at ${escapedOrigin}` : ''}, in the team workspace identified by the workspace_slug field above. Every in-app link to a workspace resource (agents, tasks, documents, pages, knowledge bases, files, settings) MUST start with the workspace slug prefix "${linkBase}/". A link without the "/${escapedSlug}" prefix opens the user's personal space and will not show workspace content.</instruction>`,+ ` <instruction>You are running inside the ${BRANDING_NAME} app${origin ? ` at ${escapedOrigin}` : ''}, in the team workspace identified by the workspace_slug field above. Every in-app link to a workspace resource (agents, tasks, documents, pages, knowledge bases, files, settings) MUST start with the workspace slug prefix "${linkBase}/". A link without the "/${escapedSlug}" prefix opens the user's personal space and will not show workspace content.</instruction>`,);} else {lines.push(` <scope>personal</scope>`,` <app_url>${escapedOrigin}</app_url>`,` <link_base>${linkBase}</link_base>`,- ` <instruction>You are running inside the LobeHub app at ${escapedOrigin}, in the user's personal space. In-app links start with "${linkBase}/" directly (no workspace prefix).</instruction>`,+ ` <instruction>You are running inside the ${BRANDING_NAME} app at ${escapedOrigin}, in the user's personal space. In-app links start with "${linkBase}/" directly (no workspace prefix).</instruction>`,);}@@ -90,7 +92,7 @@ export const workspaceContextPrompt = ({ appUrl, workspace }: WorkspaceContextIn` <routes>`,...ROUTE_HINTS.map(([label, path]) => ` ${label}: ${linkBase}${path}`),` </routes>`,- ` <link_rules>These rules apply only to links into this LobeHub app (agents, tasks, documents, pages, knowledge bases, files, settings). When a tool result already contains such a URL, reuse it verbatim. Compose one yourself only from the routes above with an id you actually hold; never invent hosts, paths, slugs, or ids, and never place in-app resources under the marketing site lobehub.com. Links to other websites, including the LobeHub homepage itself, are not affected.</link_rules>`,+ ` <link_rules>These rules apply only to links into this ${BRANDING_NAME} app (agents, tasks, documents, pages, knowledge bases, files, settings). When a tool result already contains such a URL, reuse it verbatim. Compose one yourself only from the routes above with an id you actually hold; never invent hosts, paths, slugs, or ids, and never place in-app resources under the marketing site lobehub.com. Links to other websites, including the LobeHub homepage itself, are not affected.</link_rules>`,'</workspace_context>',);