Skip to content

🤯 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.

✨ feat(channel): seat every Agent runtime, including remote Hermes and OpenClaw (#23425)

Arvin Xu4300126b884b
diff --git a/apps/server/src/services/channel/ChannelService.direct.test.ts b/apps/server/src/services/channel/ChannelService.direct.test.ts
index fe25dbb26b5..e8e2c112ec5 100644
--- a/apps/server/src/services/channel/ChannelService.direct.test.ts
+++ b/apps/server/src/services/channel/ChannelService.direct.test.ts
@@ -135,9 +135,19 @@ describe('the direct Channel of a new Agent', () => {
expect(create).toHaveBeenCalledWith({ agentConfig: {}, agentId: 'agt_new', title: 'Windy' });
});
- it('opens nothing for a runtime Channels do not support', async () => {
+ it.each(['hermes', 'openclaw'])('opens a remote %s Agent without a device', async (type) => {
getAgent.mockResolvedValue({
- agencyConfig: { heterogeneousProvider: { type: 'openclaw' } },
+ agencyConfig: { heterogeneousProvider: { type } },
+ name: 'Agent',
+ });
+ await expect(createDirect()).resolves.toEqual({ channel: { id: 'chn_1' } });
+ expect(findDevice).not.toHaveBeenCalled();
+ expect(create).toHaveBeenCalledWith({ agentConfig: {}, agentId: 'agt_new', title: 'Agent' });
+ });
+
+ it('opens nothing for an unknown runtime', async () => {
+ getAgent.mockResolvedValue({
+ agencyConfig: { heterogeneousProvider: { type: 'unknown-cli' } },
name: 'Agent',
});
await expect(createDirect()).resolves.toBeUndefined();
diff --git a/apps/server/src/services/channel/ChannelService.environment.test.ts b/apps/server/src/services/channel/ChannelService.environment.test.ts
index c6b93816e6f..52d2ac44a8f 100644
--- a/apps/server/src/services/channel/ChannelService.environment.test.ts
+++ b/apps/server/src/services/channel/ChannelService.environment.test.ts
@@ -132,6 +132,26 @@ describe('changing an Agent member’s channel environment', () => {
expect(notify).toHaveBeenCalledWith(expect.anything(), 'channel');
});
+ it.each(['hermes', 'openclaw'])('refuses a device for a remote %s Agent', async (type) => {
+ getAgent.mockResolvedValue({ agencyConfig: { heterogeneousProvider: { type } } });
+ await expect(
+ service().updateAgentEnvironment('channel', 'member-1', { deviceId: 'mac' }),
+ ).rejects.toMatchObject({
+ code: 'BAD_REQUEST',
+ message: 'A remote Agent runs on its own host, not a device',
+ });
+
+ expect(findDevice).not.toHaveBeenCalled();
+ expect(update).not.toHaveBeenCalled();
+ });
+
+ it('seats a remote Agent with no device', async () => {
+ getAgent.mockResolvedValue({ agencyConfig: { heterogeneousProvider: { type: 'hermes' } } });
+ await service().updateAgentEnvironment('channel', 'member-1', {});
+
+ expect(update).toHaveBeenCalledWith('channel', 'member-1', {});
+ });
+
it('still refuses a directory without a device', async () => {
await expect(
service().updateAgentEnvironment('channel', 'member-1', { workingDirectory: '/repo' }),
diff --git a/apps/server/src/services/channel/ChannelService.ts b/apps/server/src/services/channel/ChannelService.ts
index a6ae642bd18..130644ba639 100644
--- a/apps/server/src/services/channel/ChannelService.ts
+++ b/apps/server/src/services/channel/ChannelService.ts
@@ -7,6 +7,7 @@ import {
CHANNEL_LIMITS,
defaultChannelAgentDirectory,
isChannelRuntime,
+ isRemoteChannelRuntime,
} from '@lobechat/types';
import { eq } from 'drizzle-orm';
import pMap from 'p-map';
@@ -81,6 +82,8 @@ export class ChannelService {
if (!isChannelRuntime(runtime))
throw new ChannelError('BAD_REQUEST', 'Unsupported Channel runtime');
const config: NonNullable<ChannelAddAgentInput['config']> = {};
+ if (input.deviceId && isRemoteChannelRuntime(runtime))
+ throw new ChannelError('BAD_REQUEST', 'A remote Agent runs on its own host, not a device');
if (input.deviceId) {
const device = this.workspaceId
? await this.deviceModel.findWorkspaceDeviceById(input.deviceId)
diff --git a/locales/en-US/channel.json b/locales/en-US/channel.json
index f4d23803c3e..8c2602ce180 100644
--- a/locales/en-US/channel.json
+++ b/locales/en-US/channel.json
@@ -91,6 +91,7 @@
"environment.inherited.deviceOffline": "This Agent’s device is offline. Reconnect the device, or remove the Agent.",
"environment.inherited.deviceUnavailable": "This Agent’s device is unavailable in the current space. Change it in the Agent’s settings, or remove the Agent.",
"environment.permissionRequired": "You do not have permission to save these members. Check channel and Agent access.",
+ "environment.remoteHost": "This Agent runs on its own host, so there is no device to choose.",
"environment.resolveRequired": "Resolve the issues shown under the selected Agents first.",
"environment.saveFailed": "Could not save channel members. Your choices are preserved; try again.",
"environment.saved": "Runtime environment updated",
diff --git a/locales/zh-CN/channel.json b/locales/zh-CN/channel.json
index 83970c1b369..351ee17e403 100644
--- a/locales/zh-CN/channel.json
+++ b/locales/zh-CN/channel.json
@@ -91,6 +91,7 @@
"environment.inherited.deviceOffline": "此 Agent 的设备已离线,请重新连接设备,或移除此 Agent。",
"environment.inherited.deviceUnavailable": "当前空间无法使用此 Agent 的设备,请在它的设置里更换设备,或移除此 Agent。",
"environment.permissionRequired": "你无权保存这些成员,请检查频道和 Agent 的访问权限。",
+ "environment.remoteHost": "这个助手在它自己的主机上运行,无需选择设备。",
"environment.resolveRequired": "请先处理成员下方提示的问题。",
"environment.saveFailed": "未能保存频道成员,已保留你的选择,请重试。",
"environment.saved": "运行环境已更新",
diff --git a/packages/locales/src/default/channel.ts b/packages/locales/src/default/channel.ts
index a99cb653a4b..45356d8091f 100644
--- a/packages/locales/src/default/channel.ts
+++ b/packages/locales/src/default/channel.ts
@@ -36,6 +36,7 @@ export default {
'This Agent is no longer available. Remove it and choose another.',
'environment.checkingDevice': 'Checking status',
'environment.followAgent': "Use the Agent's own settings",
+ 'environment.remoteHost': 'This Agent runs on its own host, so there is no device to choose.',
'environment.configurationFailed': 'Could not load this Agent’s settings. Try again.',
'environment.configurationLoading': 'Loading this Agent’s settings…',
'environment.connectorUpgradeRequired':
diff --git a/packages/types/src/channel.test.ts b/packages/types/src/channel.test.ts
index fd44aef8551..7799ae2a43c 100644
--- a/packages/types/src/channel.test.ts
+++ b/packages/types/src/channel.test.ts
@@ -4,7 +4,7 @@ import {
LocalExecutionHeterogeneousAgentTypeSchema,
REMOTE_HETEROGENEOUS_AGENT_CONFIGS,
} from './agent/heterogeneousAgent';
-import { CHANNEL_EXCLUDED_RUNTIMES, CHANNEL_RUNTIMES, isChannelRuntime } from './channel';
+import { isChannelRuntime, isRemoteChannelRuntime } from './channel';
describe('isChannelRuntime', () => {
it('accepts LobeHub native execution', () => {
@@ -18,16 +18,17 @@ describe('isChannelRuntime', () => {
expect(isChannelRuntime('deepseek-harness')).toBe(true);
});
- it('excludes every remote-task runtime, each with a reason', () => {
+ it('accepts every remote-task runtime', () => {
for (const { type } of REMOTE_HETEROGENEOUS_AGENT_CONFIGS) {
- expect(isChannelRuntime(type)).toBe(false);
- expect(CHANNEL_EXCLUDED_RUNTIMES[type]).toMatch(/remote-task/);
+ expect(isChannelRuntime(type)).toBe(true);
+ expect(isRemoteChannelRuntime(type)).toBe(true);
}
});
- it('never lists an excluded runtime as supported', () => {
- for (const type of Object.keys(CHANNEL_EXCLUDED_RUNTIMES))
- expect(CHANNEL_RUNTIMES as readonly string[]).not.toContain(type);
+ it('marks only remote-task runtimes as remote', () => {
+ expect(isRemoteChannelRuntime('native')).toBe(false);
+ for (const type of LocalExecutionHeterogeneousAgentTypeSchema.options)
+ expect(isRemoteChannelRuntime(type)).toBe(false);
});
it('rejects unknown runtimes', () => {
diff --git a/packages/types/src/channel.ts b/packages/types/src/channel.ts
index af0734ce555..39f2bcb316c 100644
--- a/packages/types/src/channel.ts
+++ b/packages/types/src/channel.ts
@@ -1,5 +1,8 @@
-import type { LobeAgentAgencyConfig, LobeAgentConfig, RemoteHeterogeneousAgentType } from './agent';
-import { LocalExecutionHeterogeneousAgentTypeSchema } from './agent/heterogeneousAgent';
+import type { LobeAgentAgencyConfig, LobeAgentConfig } from './agent';
+import {
+ LocalExecutionHeterogeneousAgentTypeSchema,
+ REMOTE_HETEROGENEOUS_AGENT_CONFIGS,
+} from './agent/heterogeneousAgent';
import { getWorkingDirEffectivePath } from './device';
import type { BotWakeKind } from './signal';
import type { ExternalWorkSummaryItem } from './work';
@@ -12,33 +15,30 @@ import type { ExternalWorkSummaryItem } from './work';
*/
/**
- * Runtimes a Channel can seat, derived rather than listed: LobeHub's own `native` loop plus every
- * heterogeneous runtime that executes on its user's machine (descriptor-backed CLIs and
- * protocol-driven local runtimes). A new local runtime joins Channels when it joins the provider
- * registry; only runtimes known not to work are excluded below, each with its reason.
+ * Remote-task runtimes (`openclaw`, `hermes`) run on their own host, so a Channel seats them
+ * without a device or working directory; the run routes to that host as an ordinary one does.
*/
-const LOCAL_EXECUTION_RUNTIMES = LocalExecutionHeterogeneousAgentTypeSchema.options;
+const REMOTE_RUNTIMES = REMOTE_HETEROGENEOUS_AGENT_CONFIGS.map(({ type }) => type);
/**
- * Remote-task runtimes (`openclaw`, `hermes`) run a task on a remote host instead of on a seated
- * device, so a Channel's "pick a device + working directory" premise does not hold for them.
- * They are not part of LOCAL_EXECUTION_RUNTIMES; this list documents the exclusion and is
- * asserted by tests so a remote runtime cannot slip in by being reclassified.
+ * Runtimes a Channel can seat: every runtime an Agent can have, derived rather than listed.
+ * LobeHub's own `native` loop, every heterogeneous runtime that executes on its user's machine
+ * and every remote-task runtime. A new runtime joins Channels when it joins the registry.
*/
-export const CHANNEL_EXCLUDED_RUNTIMES: Readonly<Record<RemoteHeterogeneousAgentType, string>> = {
- hermes:
- 'remote-task runtime: runs off-device, so there is no Channel device or working directory',
- openclaw:
- 'remote-task runtime: runs off-device, so there is no Channel device or working directory',
-};
-
-export const CHANNEL_RUNTIMES = ['native', ...LOCAL_EXECUTION_RUNTIMES] as const;
-export type ChannelRuntime = 'native' | (typeof LOCAL_EXECUTION_RUNTIMES)[number];
+export const CHANNEL_RUNTIMES = [
+ 'native',
+ ...LocalExecutionHeterogeneousAgentTypeSchema.options,
+ ...REMOTE_RUNTIMES,
+] as const;
+export type ChannelRuntime = (typeof CHANNEL_RUNTIMES)[number];
export const isChannelRuntime = (runtime: string): runtime is ChannelRuntime =>
- !Object.hasOwn(CHANNEL_EXCLUDED_RUNTIMES, runtime) &&
(CHANNEL_RUNTIMES as readonly string[]).includes(runtime);
+/** A runtime that runs on its own host: a Channel picks no device or directory for it. */
+export const isRemoteChannelRuntime = (runtime: string) =>
+ (REMOTE_RUNTIMES as readonly string[]).includes(runtime);
+
/** The directory on that device: the Agent's own choice there, else the device's default. */
export const defaultChannelAgentDirectory = (
agencyConfig: Pick<LobeAgentAgencyConfig, 'workingDirByDevice'> | null | undefined,
diff --git a/src/features/Channels/CreateChannel/EnvironmentFields.tsx b/src/features/Channels/CreateChannel/EnvironmentFields.tsx
index e4d53e4e274..9e6b5dc62fc 100644
--- a/src/features/Channels/CreateChannel/EnvironmentFields.tsx
+++ b/src/features/Channels/CreateChannel/EnvironmentFields.tsx
@@ -22,7 +22,7 @@ type DraftControls = ReturnType<typeof useChannelAgentDraft>;
/** Device and working directory for one Agent in one Channel. */
export const EnvironmentFields = ({
- controls: { change, changeDevice, draft },
+ controls: { change, changeDevice, draft, remote },
devices,
name,
}: {
@@ -40,6 +40,13 @@ export const EnvironmentFields = ({
(item) => item.deviceId === draft.deviceId && item.online && !item.onlineUnknown,
);
+ if (remote)
+ return (
+ <Text fontSize={12} type="secondary">
+ {t('environment.remoteHost')}
+ </Text>
+ );
+
return (
<>
<Select
diff --git a/src/features/Channels/CreateChannel/agentEnvironment.test.ts b/src/features/Channels/CreateChannel/agentEnvironment.test.ts
index 4aa073aa8b7..5fdc48ef670 100644
--- a/src/features/Channels/CreateChannel/agentEnvironment.test.ts
+++ b/src/features/Channels/CreateChannel/agentEnvironment.test.ts
@@ -8,6 +8,7 @@ import {
changeChannelAgentDevice,
createChannelAgentSelection,
getChannelAgentIssue,
+ isRemoteChannelAgent,
reconcileChannelAgentDraft,
toChannelAgentSelection,
} from './agentEnvironment';
@@ -231,8 +232,17 @@ describe('Channel runtime support', () => {
},
);
- it.each(['openclaw', 'hermes'])('rejects the remote-task %s runtime', (type) => {
- expect(getChannelAgentIssue(selection, withRuntime(type))).toBe('unsupportedRuntime');
+ it.each(['openclaw', 'hermes'])('accepts the remote-task %s runtime with no device', (type) => {
+ expect(getChannelAgentIssue({ agentId: 'agent' }, withRuntime(type))).toBeUndefined();
+ expect(isRemoteChannelAgent(withRuntime(type))).toBe(true);
+ });
+
+ it('keeps a device picker for local runtimes', () => {
+ expect(isRemoteChannelAgent(withRuntime('kimi-code'))).toBe(false);
+ });
+
+ it('rejects an unknown runtime', () => {
+ expect(getChannelAgentIssue(selection, withRuntime('unknown-cli'))).toBe('unsupportedRuntime');
});
});
diff --git a/src/features/Channels/CreateChannel/agentEnvironment.ts b/src/features/Channels/CreateChannel/agentEnvironment.ts
index 4054996cfd2..822396cada3 100644
--- a/src/features/Channels/CreateChannel/agentEnvironment.ts
+++ b/src/features/Channels/CreateChannel/agentEnvironment.ts
@@ -1,6 +1,10 @@
import { isHeterogeneousAgentModelId } from '@lobechat/const';
import type { DeviceListItem, LobeAgentAgencyConfig } from '@lobechat/types';
-import { defaultChannelAgentDirectory, isChannelRuntime } from '@lobechat/types';
+import {
+ defaultChannelAgentDirectory,
+ isChannelRuntime,
+ isRemoteChannelRuntime,
+} from '@lobechat/types';
import type { ChannelAgentSelection } from '@/services/channel';
@@ -44,6 +48,10 @@ const getRuntime = ({ agencyConfig, model }: ChannelAgentEnvironment) =>
agencyConfig?.heterogeneousProvider?.type ??
(isHeterogeneousAgentModelId(model) ? model! : 'native');
+/** A remote-task Agent runs on its own host; a Channel picks no device for it. */
+export const isRemoteChannelAgent = (environment: ChannelAgentEnvironment) =>
+ isRemoteChannelRuntime(getRuntime(environment));
+
const getDeviceDirectory = (deviceId: string | undefined, environment: ChannelAgentEnvironment) => {
if (!deviceId) return;
return defaultChannelAgentDirectory(
diff --git a/src/features/Channels/CreateChannel/useChannelAgentDraft.ts b/src/features/Channels/CreateChannel/useChannelAgentDraft.ts
index b74d99a0ff6..daad306e425 100644
--- a/src/features/Channels/CreateChannel/useChannelAgentDraft.ts
+++ b/src/features/Channels/CreateChannel/useChannelAgentDraft.ts
@@ -14,6 +14,7 @@ import type {
import {
changeChannelAgentDevice,
getChannelAgentIssue,
+ isRemoteChannelAgent,
reconcileChannelAgentDraft,
} from './agentEnvironment';
@@ -80,6 +81,7 @@ export const useChannelAgentDraft = (
change,
changeDevice,
draft: resolved,
+ remote: isRemoteChannelAgent(environment),
retry: sync.mutate,
sync,
};