🤯 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
✨ feat(channel): derive supported runtimes from local-execution agents (Kimi Code et al.) (#22604)
Lobehub Coderd29fee054933
diff --git a/packages/database/src/repositories/channel/__tests__/agentConfig.test.ts b/packages/database/src/repositories/channel/__tests__/agentConfig.test.tsindex 7c36d087436..a210c4c9c04 100644--- a/packages/database/src/repositories/channel/__tests__/agentConfig.test.ts+++ b/packages/database/src/repositories/channel/__tests__/agentConfig.test.ts@@ -40,6 +40,27 @@ describe('Channel Agent configuration', () => {expect(claim.job.executionConfig?.runtime).toBe(model);});+ it.each(['kimi-code', 'deepseek-harness'])(+ 'runs the local %s runtime on the member device',+ async (type) => {+ const team = await fixture.createTeamChannel();+ const member = await fixture.addAgent(team.channel.id, 'Local Agent', deviceConfig());+ await db+ .update(agents)+ .set({ agencyConfig: { heterogeneousProvider: { type } } as never })+ .where(eq(agents.id, member.agentId!));+ const message = await team.asMember.send(team.channel.id, {+ content: 'Request',+ mentions: [member.id],+ requestKey: 'request',+ routing: 'fallback',+ });+ const [job] = await jobsOf(db, message.id);+ const claim = (await execution.claim(team.channel.id, job.id, lease))!;+ expect(claim.job.executionConfig?.runtime).toBe(type);+ },+ );+it.each([false, true])('uses the Agent default layers (workspace=%s)', async (workspace) => {await db.insert(userSettings).values({id: fixture.ownerId,diff --git a/packages/types/src/channel.test.ts b/packages/types/src/channel.test.tsnew file mode 100644index 00000000000..fd44aef8551--- /dev/null+++ b/packages/types/src/channel.test.ts@@ -0,0 +1,36 @@+import { describe, expect, it } from 'vitest';++import {+ LocalExecutionHeterogeneousAgentTypeSchema,+ REMOTE_HETEROGENEOUS_AGENT_CONFIGS,+} from './agent/heterogeneousAgent';+import { CHANNEL_EXCLUDED_RUNTIMES, CHANNEL_RUNTIMES, isChannelRuntime } from './channel';++describe('isChannelRuntime', () => {+ it('accepts LobeHub native execution', () => {+ expect(isChannelRuntime('native')).toBe(true);+ });++ it('accepts every runtime that executes on its user machine', () => {+ for (const type of LocalExecutionHeterogeneousAgentTypeSchema.options)+ expect(isChannelRuntime(type)).toBe(true);+ expect(isChannelRuntime('kimi-code')).toBe(true);+ expect(isChannelRuntime('deepseek-harness')).toBe(true);+ });++ it('excludes every remote-task runtime, each with a reason', () => {+ for (const { type } of REMOTE_HETEROGENEOUS_AGENT_CONFIGS) {+ expect(isChannelRuntime(type)).toBe(false);+ expect(CHANNEL_EXCLUDED_RUNTIMES[type]).toMatch(/remote-task/);+ }+ });++ 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('rejects unknown runtimes', () => {+ expect(isChannelRuntime('unknown-cli')).toBe(false);+ });+});diff --git a/packages/types/src/channel.ts b/packages/types/src/channel.tsindex 3899dcef024..86b15ab179d 100644--- a/packages/types/src/channel.ts+++ b/packages/types/src/channel.ts@@ -1,4 +1,5 @@-import type { LobeAgentAgencyConfig, LobeAgentConfig } from './agent';+import type { LobeAgentAgencyConfig, LobeAgentConfig, RemoteHeterogeneousAgentType } from './agent';+import { LocalExecutionHeterogeneousAgentTypeSchema } from './agent/heterogeneousAgent';import { getWorkingDirEffectivePath } from './device';import type { BotWakeKind } from './signal';@@ -9,17 +10,32 @@ import type { BotWakeKind } from './signal';* and operations; the internal transcript stays separate from the public timeline.*/-export const CHANNEL_RUNTIMES = [- 'native',- 'codex',- 'amp',- 'grok-build',- 'claude-code',- 'pi',-] as const;-export type ChannelRuntime = (typeof CHANNEL_RUNTIMES)[number];+/**+ * 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.+ */+const LOCAL_EXECUTION_RUNTIMES = LocalExecutionHeterogeneousAgentTypeSchema.options;++/**+ * 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.+ */+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 isChannelRuntime = (runtime: string): runtime is ChannelRuntime =>+ !Object.hasOwn(CHANNEL_EXCLUDED_RUNTIMES, runtime) &&(CHANNEL_RUNTIMES as readonly string[]).includes(runtime);/**diff --git a/src/features/Channels/CreateChannel/agentEnvironment.test.ts b/src/features/Channels/CreateChannel/agentEnvironment.test.tsindex 16df54d4e50..fbb8f6ea716 100644--- a/src/features/Channels/CreateChannel/agentEnvironment.test.ts+++ b/src/features/Channels/CreateChannel/agentEnvironment.test.ts@@ -281,6 +281,25 @@ describe('Channel Agent submission guard', () => {});});+describe('Channel runtime support', () => {+ const withRuntime = (type: string) =>+ environment({+ agencyConfig: { ...environment().agencyConfig, heterogeneousProvider: { type } as never },+ });+ const selection = { agentId: 'agent', deviceId: 'bound', workingDirectory: '/project' };++ it.each(['kimi-code', 'codebuddy', 'cursor', 'opencode', 'deepseek-harness'])(+ 'accepts the local %s runtime',+ (type) => {+ expect(getChannelAgentIssue(selection, withRuntime(type))).toBeUndefined();+ },+ );++ it.each(['openclaw', 'hermes'])('rejects the remote-task %s runtime', (type) => {+ expect(getChannelAgentIssue(selection, withRuntime(type))).toBe('unsupportedRuntime');+ });+});+describe('Channel member submission guard', () => {const ready = { agentId: 'native', initialized: true };const pending = { agentId: 'pi', initialized: true, issue: 'deviceRequired' as const };