π€― 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: restore userId in gateway dispatch, gate local-system by executionTarget, add device switcher for regular agents (#15232)
LiJiane295f80235b2
diff --git a/packages/device-gateway-client/src/http.ts b/packages/device-gateway-client/src/http.tsindex cc28dc6eb4e..805641dda8c 100644--- a/packages/device-gateway-client/src/http.ts+++ b/packages/device-gateway-client/src/http.ts@@ -85,8 +85,7 @@ export class GatewayHttpClient {topicId: string;userId: string;}): Promise<{ success: boolean; error?: string }> {- const { userId: _userId, ...body } = params;- const res = await this.post('/api/device/agent/run', body);+ const res = await this.post('/api/device/agent/run', params);if (!res.ok) {const text = await res.text().catch(() => '');return { error: text || `HTTP ${res.status}`, success: false };diff --git a/src/features/ChatInput/RuntimeConfig/index.tsx b/src/features/ChatInput/RuntimeConfig/index.tsxindex c45e0006ec1..baf90c1dc6e 100644--- a/src/features/ChatInput/RuntimeConfig/index.tsx+++ b/src/features/ChatInput/RuntimeConfig/index.tsx@@ -19,6 +19,8 @@ import { useAgentStore } from '@/store/agent';import { agentByIdSelectors, chatConfigByIdSelectors } from '@/store/agent/selectors';import { useChatStore } from '@/store/chat';import { topicSelectors } from '@/store/chat/selectors';+import { useUserStore } from '@/store/user';+import { labPreferSelectors } from '@/store/user/selectors';import ContextWindow from '../ActionBar/Token';import { useAgentId } from '../hooks/useAgentId';@@ -27,6 +29,7 @@ import { useChatInputStore } from '../store';import ApprovalMode from './ApprovalMode';import CloudRepoSwitcher from './CloudRepoSwitcher';import GitStatus from './GitStatus';+import HeteroDeviceSwitcher from './HeteroDeviceSwitcher';import ModeSelector from './ModeSelector';import { useRepoType } from './useRepoType';import WorkingDirectory from './WorkingDirectory';@@ -118,6 +121,10 @@ const RuntimeConfig = memo(() => {agentByIdSelectors.getAgentEnableModeById(agentId)(s),]);+ const enableExecutionDeviceSwitcher = useUserStore(+ labPreferSelectors.enableExecutionDeviceSwitcher,+ );+const topicWorkingDirectory = useChatStore(topicSelectors.currentTopicWorkingDirectory);const agentWorkingDirectory = useAgentStore((s) =>agentId ? agentByIdSelectors.getAgentWorkingDirectoryById(agentId)(s) : undefined,@@ -285,6 +292,9 @@ const RuntimeConfig = memo(() => {{/* Left: Chat mode switcher + (agent-only) runtime env + working directory */}<Flexbox horizontal align={'center'} gap={4}><ModeSelector />+ {enableAgentMode && !isHeterogeneous && enableExecutionDeviceSwitcher && agentId && (+ <HeteroDeviceSwitcher agentId={agentId} />+ )}{enableAgentMode && (<><Popoverdiff --git a/src/server/services/aiAgent/index.ts b/src/server/services/aiAgent/index.tsindex 3d0515e1034..230dc1da2e2 100644--- a/src/server/services/aiAgent/index.ts+++ b/src/server/services/aiAgent/index.ts@@ -1223,7 +1223,11 @@ export class AiAgentService {// bypassing the engine's enabledToolIds exclusion. Skipping the// assignment here closes that bypass at the source.//- // Resolution order ():+ // Resolution order:+ // 0. executionTarget === 'sandbox': always skip β sandbox and device are+ // mutually exclusive. Without this gate a single online device would+ // be auto-activated and local-system tool calls would silently route+ // to that device instead of being suppressed for the sandbox session.// 1. boundDeviceId (topic-bound > agent-bound): use if online; if offline,// respect the explicit choice and stay unrouted β don't silently fall// back to a different device, that would surprise the user.@@ -1235,15 +1239,17 @@ export class AiAgentService {// behind (the local-system system prompt's// `{{workingDirectory}}` reached the LLM as a literal, wasting the// first N steps groping for cwd).- activeDeviceId = !canUseDevice- ? undefined- : boundDeviceId- ? onlineDevices.some((device) => device.deviceId === boundDeviceId)- ? boundDeviceId- : undefined- : onlineDevices.length === 1- ? onlineDevices[0].deviceId- : undefined;+ const regularAgentExecutionTarget = agentConfig.agencyConfig?.executionTarget;+ activeDeviceId =+ !canUseDevice || regularAgentExecutionTarget === 'sandbox'+ ? undefined+ : boundDeviceId+ ? onlineDevices.some((device) => device.deviceId === boundDeviceId)+ ? boundDeviceId+ : undefined+ : onlineDevices.length === 1+ ? onlineDevices[0].deviceId+ : undefined;const toolsEngine = createServerAgentToolsEngine(toolsContext, {additionalManifests: [...lobehubSkillManifests, ...klavisManifests],