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(bot): limit device access to listed channels (#21974)

Lobehub Coderfa476c3e6257
diff --git a/apps/server/src/services/aiAgent/deviceAccessPolicy.test.ts b/apps/server/src/services/aiAgent/deviceAccessPolicy.test.ts
index 8da947c8f03..d92a20616ab 100644
--- a/apps/server/src/services/aiAgent/deviceAccessPolicy.test.ts
+++ b/apps/server/src/services/aiAgent/deviceAccessPolicy.test.ts
@@ -88,6 +88,52 @@ describe('resolveDeviceAccessPolicy', () => {
});
});
+ describe('device channel scope', () => {
+ it('denies the owner in a channel outside the device channel list', () => {
+ expect(
+ resolveDeviceAccessPolicy({
+ botContext: baseBotContext({ isDeviceChannelRestricted: true, isOwner: true }),
+ }),
+ ).toEqual({ canUseDevice: false, reason: 'bot-channel-restricted' });
+ });
+
+ it('denies a trusted sender in a channel outside the device channel list', () => {
+ expect(
+ resolveDeviceAccessPolicy({
+ botContext: baseBotContext({ isDeviceChannelRestricted: true, isDeviceTrusted: true }),
+ }),
+ ).toEqual({ canUseDevice: false, reason: 'bot-channel-restricted' });
+ });
+
+ it('still lets the people check decide inside an allowed channel', () => {
+ expect(
+ resolveDeviceAccessPolicy({
+ botContext: baseBotContext({ isDeviceChannelRestricted: false, isOwner: true }),
+ }),
+ ).toEqual({ canUseDevice: true, reason: 'bot-owner' });
+ expect(
+ resolveDeviceAccessPolicy({
+ botContext: baseBotContext({ isDeviceChannelRestricted: false, isDeviceTrusted: true }),
+ }),
+ ).toEqual({ canUseDevice: true, reason: 'bot-trusted' });
+ expect(
+ resolveDeviceAccessPolicy({
+ botContext: baseBotContext({ isDeviceChannelRestricted: false }),
+ }),
+ ).toEqual({ canUseDevice: false, reason: 'bot-external-sender' });
+ });
+
+ it('keeps share-visitor and first-party decisions ahead of the channel scope', () => {
+ expect(
+ resolveDeviceAccessPolicy({
+ botContext: baseBotContext({ isDeviceChannelRestricted: true, isOwner: true }),
+ shareVisitor: { canUseDevice: false },
+ }),
+ ).toEqual({ canUseDevice: false, reason: 'share-visitor' });
+ expect(resolveDeviceAccessPolicy({})).toEqual({ canUseDevice: true, reason: 'first-party' });
+ });
+ });
+
describe('personal-scope bot platforms', () => {
it('grants device access on WeChat even when isOwner cannot be computed', () => {
// WeChat's schema has no `userId` field, so `isOwner` is structurally
diff --git a/apps/server/src/services/aiAgent/deviceAccessPolicy.ts b/apps/server/src/services/aiAgent/deviceAccessPolicy.ts
index bce7f5021e2..d9b249c45b1 100644
--- a/apps/server/src/services/aiAgent/deviceAccessPolicy.ts
+++ b/apps/server/src/services/aiAgent/deviceAccessPolicy.ts
@@ -21,6 +21,12 @@ export type DeviceAccessReason =
* 'allowlist'`), carried as `botContext.isDeviceTrusted`.
*/
| 'bot-trusted'
+ /**
+ * Bot caller in a channel outside the owner's device channel list
+ * (`settings.deviceChannelPolicy = 'allowlist'`), carried as
+ * `botContext.isDeviceChannelRestricted` — DENY device tools, owner included.
+ */
+ | 'bot-channel-restricted'
/** Bot caller, sender is identifiable but not the owner — DENY device tools. */
| 'bot-external-sender'
/**
@@ -111,6 +117,13 @@ export const resolveDeviceAccessPolicy = (
return { canUseDevice: true, reason: 'first-party' };
}
+ // The channel scope narrows every people branch below: a sender must both
+ // pass the people check AND be in an allowed channel. It is only set when
+ // the owner configured a channel list, so unconfigured bots are unaffected.
+ if (botContext.isDeviceChannelRestricted) {
+ return { canUseDevice: false, reason: 'bot-channel-restricted' };
+ }
+
if (botContext.isOwner) {
return { canUseDevice: true, reason: 'bot-owner' };
}
diff --git a/apps/server/src/services/aiAgent/pipeline/heteroDispatch/index.branches.test.ts b/apps/server/src/services/aiAgent/pipeline/heteroDispatch/index.branches.test.ts
index a055138767a..19e086368e5 100644
--- a/apps/server/src/services/aiAgent/pipeline/heteroDispatch/index.branches.test.ts
+++ b/apps/server/src/services/aiAgent/pipeline/heteroDispatch/index.branches.test.ts
@@ -363,6 +363,27 @@ describe('dispatchHeteroAgent — remote platform agents', () => {
expect(mocks.executeToolCall).not.toHaveBeenCalled();
});
+ it('names the channel when the device is limited to other channels', async () => {
+ const { deps } = createDeps();
+
+ await dispatchHeteroAgent(
+ deps,
+ createCtx(remoteConfig({ boundDeviceId: 'dev-1' }), {
+ canUseDevice: false,
+ deviceAccessReason: 'bot-channel-restricted',
+ }),
+ createInput('openclaw'),
+ );
+
+ expect(mocks.finalizeHeteroDispatchError).toHaveBeenCalledWith(
+ deps,
+ finalizeParams({
+ detail: 'Running agents on a bound device is not allowed in this channel.',
+ message: 'Device access denied',
+ }),
+ );
+ });
+
it('fails when no device is available', async () => {
const { deps } = createDeps();
diff --git a/apps/server/src/services/aiAgent/pipeline/heteroDispatch/remote.ts b/apps/server/src/services/aiAgent/pipeline/heteroDispatch/remote.ts
index 55d24a12fc7..dfc38b0d4ff 100644
--- a/apps/server/src/services/aiAgent/pipeline/heteroDispatch/remote.ts
+++ b/apps/server/src/services/aiAgent/pipeline/heteroDispatch/remote.ts
@@ -66,7 +66,10 @@ export const dispatchToPlatformDevice = async (
deps,
run,
{
- detail: 'This sender is not allowed to run agents on a bound device.',
+ detail:
+ deviceAccessReason === 'bot-channel-restricted'
+ ? 'Running agents on a bound device is not allowed in this channel.'
+ : 'This sender is not allowed to run agents on a bound device.',
message: 'Device access denied',
},
{ error: 'Device access denied', message: 'Remote hetero agent requires device access' },
diff --git a/apps/server/src/services/bot/BotMessageRouter/catchAll.ts b/apps/server/src/services/bot/BotMessageRouter/catchAll.ts
index 2731bf37e6a..e51da385d37 100644
--- a/apps/server/src/services/bot/BotMessageRouter/catchAll.ts
+++ b/apps/server/src/services/bot/BotMessageRouter/catchAll.ts
@@ -31,6 +31,7 @@ export const registerCatchAllHandler = (bot: Chat<any>, ctx: BotHandlerContext):
commands,
detectReplyLocale,
deviceAllowlist,
+ isDeviceChannelRestrictedFor,
displayToolCalls,
dmSettings,
gateFollowup,
@@ -280,6 +281,7 @@ export const registerCatchAllHandler = (bot: Chat<any>, ctx: BotHandlerContext):
applicationId,
authorUserId: merged.author?.userId,
deviceAllowlist,
+ deviceChannelRestricted: isDeviceChannelRestrictedFor(thread),
operatorUserId,
platform,
platformThreadId: thread.id,
diff --git a/apps/server/src/services/bot/BotMessageRouter/handlers.ts b/apps/server/src/services/bot/BotMessageRouter/handlers.ts
index e2ae2cc8304..9c7caaf8c72 100644
--- a/apps/server/src/services/bot/BotMessageRouter/handlers.ts
+++ b/apps/server/src/services/bot/BotMessageRouter/handlers.ts
@@ -34,7 +34,11 @@ import {
resolveReplyStyle,
type UserAllowlist,
} from '../platforms';
-import { extractDeviceAllowlist } from '../platforms/deviceAccess';
+import {
+ extractDeviceAllowlist,
+ extractDeviceChannelAllowlist,
+ isDeviceChannelRestricted,
+} from '../platforms/deviceAccess';
import { renderThrownAgentError } from '../renderThrownError';
import { createReplyOpener } from '../wake/opener';
import { resolveWakeScheduler } from '../wake/scheduler';
@@ -168,6 +172,21 @@ export function registerHandlers(
: undefined;
/** Who besides the owner may use the owner's devices; read once per bot. */
const deviceAllowlist = extractDeviceAllowlist(info.settings);
+ /** Channels the owner limited device use to; `undefined` when unrestricted. */
+ const deviceChannelAllowlist = extractDeviceChannelAllowlist(info.settings);
+ /**
+ * Whether a thread sits outside those channels. Matches the same raw IDs as
+ * the group policy (`passesGroupPolicy`), so pasted channel IDs line up.
+ */
+ const isDeviceChannelRestrictedFor = (thread: { id: string; isDM?: boolean }): boolean =>
+ isDeviceChannelRestricted({
+ candidateChannelIds: [
+ client.extractChatId(thread.id),
+ ...(client.extraGroupAllowlistChannels?.(thread.id) ?? []),
+ ],
+ channelAllowlist: deviceChannelAllowlist,
+ isDM: thread.isDM === true,
+ });
const fallbackReplyLocale: BotReplyLocale = getBotReplyLocale(platform);
/**
@@ -557,6 +576,7 @@ export function registerHandlers(
applicationId,
authorUserId: merged.author?.userId,
deviceAllowlist,
+ deviceChannelRestricted: isDeviceChannelRestrictedFor(thread),
operatorUserId,
platform,
platformThreadId: thread.id,
@@ -840,6 +860,7 @@ export function registerHandlers(
applicationId,
authorUserId: merged.author?.userId,
deviceAllowlist,
+ deviceChannelRestricted: isDeviceChannelRestrictedFor(thread),
operatorUserId,
platform,
platformThreadId: thread.id,
@@ -895,6 +916,7 @@ export function registerHandlers(
registerCatchAllHandler(bot, {
deviceAllowlist,
+ isDeviceChannelRestrictedFor,
agentId,
applicationId,
replyVoiceFor,
diff --git a/apps/server/src/services/bot/BotMessageRouter/index.policy.test.ts b/apps/server/src/services/bot/BotMessageRouter/index.policy.test.ts
index 664471ac4df..15881e7f896 100644
--- a/apps/server/src/services/bot/BotMessageRouter/index.policy.test.ts
+++ b/apps/server/src/services/bot/BotMessageRouter/index.policy.test.ts
@@ -185,6 +185,57 @@ describe('BotMessageRouter', () => {
expect(opts.botContext.isDeviceTrusted).toBe(true);
});
+ describe('device channel scope', () => {
+ const channelScoped = {
+ deviceChannelAllowFrom: [{ id: 'dev-channel', name: '#dev' }],
+ deviceChannelPolicy: 'allowlist',
+ dmPolicy: 'open',
+ userId: 'owner-platform-id',
+ };
+ const ownerMessage = {
+ author: { isBot: false, userId: 'owner-platform-id', userName: 'owner' },
+ isMention: true,
+ text: '@bot run the build',
+ };
+ const mention = async (
+ settings: Record<string, unknown>,
+ thread: Record<string, unknown>,
+ ) => {
+ const handler = await loadMentionHandler(settings);
+ await handler({ post: vi.fn().mockResolvedValue(undefined), ...thread }, ownerMessage);
+ expect(mockHandleMention).toHaveBeenCalledTimes(1);
+ return mockHandleMention.mock.calls[0][2].botContext;
+ };
+
+ it('leaves a listed channel unrestricted', async () => {
+ const botContext = await mention(channelScoped, {
+ id: 'telegram:dev-channel',
+ isDM: false,
+ });
+ expect(botContext.isOwner).toBe(true);
+ expect(botContext.isDeviceChannelRestricted).toBeUndefined();
+ });
+
+ it('restricts any other channel, even for the owner', async () => {
+ const botContext = await mention(channelScoped, { id: 'telegram:random', isDM: false });
+ expect(botContext.isOwner).toBe(true);
+ expect(botContext.isDeviceChannelRestricted).toBe(true);
+ });
+
+ it('never restricts a DM', async () => {
+ const botContext = await mention(channelScoped, { id: 'telegram:owner-dm', isDM: true });
+ expect(botContext.isDeviceChannelRestricted).toBeUndefined();
+ });
+
+ it('keeps the previous behavior when no channel scope is configured', async () => {
+ const botContext = await mention(
+ { dmPolicy: 'open', userId: 'owner-platform-id' },
+ { id: 'telegram:random', isDM: false },
+ );
+ expect(botContext.isDeviceChannelRestricted).toBeUndefined();
+ });
+ });
+
it('should fall back to isOwner=false when settings.userId is missing (fail-closed)', async () => {
// No `userId` configured on the bot — even a sender who happens to
// share an ID with the operator can't claim owner status.
diff --git a/apps/server/src/services/bot/BotMessageRouter/types.ts b/apps/server/src/services/bot/BotMessageRouter/types.ts
index eafd018ff08..94d9befefd4 100644
--- a/apps/server/src/services/bot/BotMessageRouter/types.ts
+++ b/apps/server/src/services/bot/BotMessageRouter/types.ts
@@ -158,6 +158,8 @@ export interface BotHandlerContext {
thread: { id: string },
threadSubscribed?: boolean,
) => Promise<WakeInitiation | undefined>;
+ /** Whether a thread is outside the channels the owner limited device use to. */
+ isDeviceChannelRestrictedFor: (thread: { id: string; isDM?: boolean }) => boolean;
isMessageMonitoringAllowed: (caller: string, threadId: string) => Promise<boolean>;
/** Watch keywords the owner marked as the bot's names (`asName`); a subset of `watchKeywords`. */
nameKeywords: ReadonlyArray<string>;
diff --git a/apps/server/src/services/bot/buildBotContext.test.ts b/apps/server/src/services/bot/buildBotContext.test.ts
index f6e1581777b..edf32e4d65d 100644
--- a/apps/server/src/services/bot/buildBotContext.test.ts
+++ b/apps/server/src/services/bot/buildBotContext.test.ts
@@ -129,4 +129,18 @@ describe('buildBotContext', () => {
expect(ctx.isDeviceTrusted).toBeUndefined();
});
});
+
+ describe('device channel scope', () => {
+ it('marks a restricted channel on the context', () => {
+ const ctx = buildBotContext({ ...baseParams, deviceChannelRestricted: true });
+ expect(ctx.isDeviceChannelRestricted).toBe(true);
+ });
+
+ it('omits the flag when the channel is allowed or no scope is configured', () => {
+ expect(buildBotContext({ ...baseParams, deviceChannelRestricted: false })).not.toHaveProperty(
+ 'isDeviceChannelRestricted',
+ );
+ expect(buildBotContext(baseParams)).not.toHaveProperty('isDeviceChannelRestricted');
+ });
+ });
});
diff --git a/apps/server/src/services/bot/buildBotContext.ts b/apps/server/src/services/bot/buildBotContext.ts
index 85e5a6e5a37..721844e4252 100644
--- a/apps/server/src/services/bot/buildBotContext.ts
+++ b/apps/server/src/services/bot/buildBotContext.ts
@@ -9,6 +9,11 @@ export interface BuildBotContextParams {
* (`extractDeviceAllowlist(settings)`). Omitted or empty: owner only.
*/
deviceAllowlist?: string[];
+ /**
+ * Whether this conversation is outside the channels the owner limited device
+ * use to (`isDeviceChannelRestricted`). Omitted: no channel restriction.
+ */
+ deviceChannelRestricted?: boolean;
/**
* Configured owner ID for this bot install (e.g. `agent_bot_providers.settings.userId`
* or messenger link's `platformUserId`). Owner identity is decided by
@@ -42,6 +47,7 @@ export const buildBotContext = (params: BuildBotContextParams): ChatTopicBotCont
return {
applicationId: params.applicationId,
isOwner,
+ ...(params.deviceChannelRestricted && { isDeviceChannelRestricted: true }),
...(isDeviceTrusted && { isDeviceTrusted }),
platform: params.platform,
platformThreadId: params.platformThreadId,
diff --git a/apps/server/src/services/bot/platforms/deviceAccess.test.ts b/apps/server/src/services/bot/platforms/deviceAccess.test.ts
index bb43aa8368e..90df55b4265 100644
--- a/apps/server/src/services/bot/platforms/deviceAccess.test.ts
+++ b/apps/server/src/services/bot/platforms/deviceAccess.test.ts
@@ -1,6 +1,10 @@
import { describe, expect, it } from 'vitest';
-import { extractDeviceAllowlist } from './deviceAccess';
+import {
+ extractDeviceAllowlist,
+ extractDeviceChannelAllowlist,
+ isDeviceChannelRestricted,
+} from './deviceAccess';
describe('extractDeviceAllowlist', () => {
it('returns the listed IDs under the allowlist policy', () => {
@@ -24,3 +28,80 @@ describe('extractDeviceAllowlist', () => {
expect(extractDeviceAllowlist({ deviceAllowFrom: 'u1', devicePolicy: 'everyone' })).toEqual([]);
});
});
+
+describe('extractDeviceChannelAllowlist', () => {
+ it('returns the listed channel IDs under the allowlist policy', () => {
+ expect(
+ extractDeviceChannelAllowlist({
+ deviceChannelAllowFrom: [{ id: ' c1 ', name: '#dev' }, { id: '' }, { id: 'c2' }],
+ deviceChannelPolicy: 'allowlist',
+ }),
+ ).toEqual(['c1', 'c2']);
+ });
+
+ it('returns an empty list for an allowlist with no channels (restricts everywhere)', () => {
+ expect(extractDeviceChannelAllowlist({ deviceChannelPolicy: 'allowlist' })).toEqual([]);
+ });
+
+ it('is unrestricted for missing, `any` or malformed policies', () => {
+ expect(extractDeviceChannelAllowlist(undefined)).toBeUndefined();
+ expect(
+ extractDeviceChannelAllowlist({ deviceChannelAllowFrom: [{ id: 'c1' }] }),
+ ).toBeUndefined();
+ expect(
+ extractDeviceChannelAllowlist({
+ deviceChannelAllowFrom: [{ id: 'c1' }],
+ deviceChannelPolicy: 'any',
+ }),
+ ).toBeUndefined();
+ expect(extractDeviceChannelAllowlist({ deviceChannelPolicy: 'everywhere' })).toBeUndefined();
+ });
+});
+
+describe('isDeviceChannelRestricted', () => {
+ it('never restricts without a channel list', () => {
+ expect(
+ isDeviceChannelRestricted({
+ candidateChannelIds: ['c9'],
+ channelAllowlist: undefined,
+ isDM: false,
+ }),
+ ).toBe(false);
+ });
+
+ it('never restricts a DM', () => {
+ expect(
+ isDeviceChannelRestricted({ candidateChannelIds: ['dm'], channelAllowlist: [], isDM: true }),
+ ).toBe(false);
+ });
+
+ it('allows a listed channel, including through a parent-channel candidate', () => {
+ expect(
+ isDeviceChannelRestricted({
+ candidateChannelIds: ['thread-1', 'c1'],
+ channelAllowlist: ['c1'],
+ isDM: false,
+ }),
+ ).toBe(false);
+ });
+
+ it('restricts unlisted channels, empty lists and unknown channels', () => {
+ expect(
+ isDeviceChannelRestricted({
+ candidateChannelIds: ['c2'],
+ channelAllowlist: ['c1'],
+ isDM: false,
+ }),
+ ).toBe(true);
+ expect(
+ isDeviceChannelRestricted({ candidateChannelIds: ['c1'], channelAllowlist: [], isDM: false }),
+ ).toBe(true);
+ expect(
+ isDeviceChannelRestricted({
+ candidateChannelIds: [undefined, ''],
+ channelAllowlist: ['c1'],
+ isDM: false,
+ }),
+ ).toBe(true);
+ });
+});
diff --git a/apps/server/src/services/bot/platforms/deviceAccess.ts b/apps/server/src/services/bot/platforms/deviceAccess.ts
index 591a0027376..c730855f09b 100644
--- a/apps/server/src/services/bot/platforms/deviceAccess.ts
+++ b/apps/server/src/services/bot/platforms/deviceAccess.ts
@@ -52,6 +52,62 @@ export const deviceAllowFromField: FieldSchema = {
export const deviceAccessFields: FieldSchema[] = [devicePolicyField, deviceAllowFromField];
+/**
+ * Where on a bot the owner's devices may be used, on top of who may use them.
+ *
+ * - `any` (default): no channel restriction; only `devicePolicy` decides.
+ * - `allowlist`: outside DMs, only in the channels listed in
+ * `deviceChannelAllowFrom`. Elsewhere even the owner falls back to the
+ * sandbox.
+ *
+ * Mirrors `groupPolicy` / `groupAllowFrom`: same raw channel IDs, same rows.
+ * Only platforms with group chat declare it.
+ */
+export type DeviceChannelPolicy = 'allowlist' | 'any';
+
+export const deviceChannelPolicyField: FieldSchema = {
+ key: 'deviceChannelPolicy',
+ default: 'any',
+ description: 'channel.deviceChannelPolicyHint',
+ enum: ['any', 'allowlist'],
+ label: 'channel.deviceChannelPolicy',
+ type: 'string',
+};
+
+/** Same `{ id, name? }` rows as `groupAllowFrom`, so operators paste the same channel IDs. */
+export const deviceChannelAllowFromField: FieldSchema = {
+ key: 'deviceChannelAllowFrom',
+ default: [],
+ description: 'channel.deviceChannelAllowFromHint',
+ items: {
+ key: 'item',
+ label: '',
+ properties: [
+ {
+ key: 'id',
+ label: 'channel.groupAllowFromIdLabel',
+ placeholder: 'channel.groupAllowFromIdPlaceholder',
+ required: true,
+ type: 'string',
+ },
+ {
+ key: 'name',
+ label: 'channel.groupAllowFromNameLabel',
+ placeholder: 'channel.groupAllowFromNamePlaceholder',
+ type: 'string',
+ },
+ ],
+ type: 'object',
+ },
+ label: 'channel.deviceChannelAllowFrom',
+ type: 'array',
+};
+
+export const deviceChannelFields: FieldSchema[] = [
+ deviceChannelPolicyField,
+ deviceChannelAllowFromField,
+];
+
/**
* The user IDs, besides the owner, who may use the owner's devices. Anything
* but an explicit `allowlist` policy yields an empty list, so a missing or
@@ -63,3 +119,36 @@ export const extractDeviceAllowlist = (
if (settings?.devicePolicy !== 'allowlist') return [];
return parseIdList(settings.deviceAllowFrom);
};
+
+/**
+ * The channel IDs the owner's devices are limited to, or `undefined` when no
+ * channel restriction applies. Anything but an explicit `allowlist` policy is
+ * unrestricted, so bots saved before this setting existed keep their behavior.
+ * An `allowlist` with no entries restricts every channel (fail-closed, like
+ * `groupAllowFrom`).
+ */
+export const extractDeviceChannelAllowlist = (
+ settings: Record<string, unknown> | null | undefined,
+): string[] | undefined => {
+ if (settings?.deviceChannelPolicy !== 'allowlist') return undefined;
+ return parseIdList(settings.deviceChannelAllowFrom);
+};
+
+/**
+ * Whether the conversation sits outside the channels the owner's devices are
+ * limited to. DMs are never restricted: a DM is not a channel, and who may use
+ * the devices there is already decided by `devicePolicy`.
+ *
+ * `candidateChannelIds` are the same raw IDs the group policy matches
+ * (`extractChatId` plus `extraGroupAllowlistChannels`), so a Discord reply
+ * thread counts as its parent channel.
+ */
+export const isDeviceChannelRestricted = (params: {
+ candidateChannelIds: ReadonlyArray<string | undefined>;
+ channelAllowlist: string[] | undefined;
+ isDM: boolean;
+}): boolean => {
+ const { candidateChannelIds, channelAllowlist, isDM } = params;
+ if (!channelAllowlist || isDM) return false;
+ return !candidateChannelIds.some((id) => !!id && channelAllowlist.includes(id));
+};
diff --git a/apps/server/src/services/bot/platforms/discord/schema.ts b/apps/server/src/services/bot/platforms/discord/schema.ts
index 0626c66f972..271dbceae0a 100644
--- a/apps/server/src/services/bot/platforms/discord/schema.ts
+++ b/apps/server/src/services/bot/platforms/discord/schema.ts
@@ -18,7 +18,7 @@ import {
replyPlacementField,
watchKeywordsField,
} from '../const';
-import { deviceAccessFields } from '../deviceAccess';
+import { deviceAccessFields, deviceChannelFields } from '../deviceAccess';
import { replyStyleFields } from '../replyStyle';
import type { FieldSchema } from '../types';
import {
@@ -72,6 +72,7 @@ export const schema: FieldSchema[] = [
properties: [
makeUserIdField('discord'),
...deviceAccessFields,
+ ...deviceChannelFields,
makeServerIdField('discord'),
{
key: 'charLimit',
diff --git a/apps/server/src/services/bot/platforms/feishu/definitions/schema.ts b/apps/server/src/services/bot/platforms/feishu/definitions/schema.ts
index 8ea82f2e8e8..a91888d388e 100644
--- a/apps/server/src/services/bot/platforms/feishu/definitions/schema.ts
+++ b/apps/server/src/services/bot/platforms/feishu/definitions/schema.ts
@@ -16,7 +16,7 @@ import {
reactionModeField,
watchKeywordsField,
} from '../../const';
-import { deviceAccessFields } from '../../deviceAccess';
+import { deviceAccessFields, deviceChannelFields } from '../../deviceAccess';
import { replyStyleFields } from '../../replyStyle';
import type { FieldSchema } from '../../types';
import { DEFAULT_FEISHU_CONNECTION_MODE, MAX_FEISHU_HISTORY_LIMIT } from '../const';
@@ -63,6 +63,7 @@ export const sharedSchema: FieldSchema[] = [
properties: [
makeUserIdField('feishu'),
...deviceAccessFields,
+ ...deviceChannelFields,
{
key: 'connectionMode',
default: DEFAULT_FEISHU_CONNECTION_MODE,
diff --git a/apps/server/src/services/bot/platforms/qq/schema.ts b/apps/server/src/services/bot/platforms/qq/schema.ts
index 197d2f8ceb2..d3fdee06283 100644
--- a/apps/server/src/services/bot/platforms/qq/schema.ts
+++ b/apps/server/src/services/bot/platforms/qq/schema.ts
@@ -9,7 +9,7 @@ import {
processingMessageField,
watchKeywordsField,
} from '../const';
-import { deviceAccessFields } from '../deviceAccess';
+import { deviceAccessFields, deviceChannelFields } from '../deviceAccess';
import { replyStyleFields } from '../replyStyle';
import type { FieldSchema } from '../types';
import { DEFAULT_QQ_CONNECTION_MODE } from './const';
@@ -42,6 +42,7 @@ export const schema: FieldSchema[] = [
properties: [
makeUserIdField('qq'),
...deviceAccessFields,
+ ...deviceChannelFields,
{
key: 'connectionMode',
default: DEFAULT_QQ_CONNECTION_MODE,
diff --git a/apps/server/src/services/bot/platforms/slack/schema.ts b/apps/server/src/services/bot/platforms/slack/schema.ts
index dc8398480dc..7b2354dcefd 100644
--- a/apps/server/src/services/bot/platforms/slack/schema.ts
+++ b/apps/server/src/services/bot/platforms/slack/schema.ts
@@ -17,7 +17,7 @@ import {
replyPlacementField,
watchKeywordsField,
} from '../const';
-import { deviceAccessFields } from '../deviceAccess';
+import { deviceAccessFields, deviceChannelFields } from '../deviceAccess';
import { replyStyleFields } from '../replyStyle';
import type { FieldSchema } from '../types';
import { DEFAULT_SLACK_CONNECTION_MODE, MAX_SLACK_HISTORY_LIMIT } from './const';
@@ -64,6 +64,7 @@ export const schema: FieldSchema[] = [
properties: [
makeUserIdField('slack'),
...deviceAccessFields,
+ ...deviceChannelFields,
makeServerIdField('slack'),
{
key: 'connectionMode',
diff --git a/apps/server/src/services/bot/platforms/telegram/schema.ts b/apps/server/src/services/bot/platforms/telegram/schema.ts
index 7d1a4748313..6691b22d5cd 100644
--- a/apps/server/src/services/bot/platforms/telegram/schema.ts
+++ b/apps/server/src/services/bot/platforms/telegram/schema.ts
@@ -11,7 +11,7 @@ import {
reactionModeField,
watchKeywordsField,
} from '../const';
-import { deviceAccessFields } from '../deviceAccess';
+import { deviceAccessFields, deviceChannelFields } from '../deviceAccess';
import { replyStyleFields } from '../replyStyle';
import type { FieldSchema } from '../types';
@@ -51,6 +51,7 @@ export const schema: FieldSchema[] = [
properties: [
makeUserIdField('telegram'),
...deviceAccessFields,
+ ...deviceChannelFields,
{
key: 'charLimit',
default: 4000,
diff --git a/locales/en-US/agent.json b/locales/en-US/agent.json
index 35c3bd6ddd0..f0f2bb80438 100644
--- a/locales/en-US/agent.json
+++ b/locales/en-US/agent.json
@@ -1,6 +1,14 @@
{
"channel.access.device.allowlist": "Me and authorized people",
"channel.access.device.allowlistDesc": "You and the people listed below can have the bot operate your devices.",
+ "channel.access.device.channel.allowlist": "Only listed channels",
+ "channel.access.device.channel.allowlistDesc": "Outside the channels listed below, the bot runs in the sandbox for everyone, you included. Direct messages are not affected.",
+ "channel.access.device.channel.any": "Any channel",
+ "channel.access.device.channel.anyDesc": "Device access follows the choice above wherever the bot is used.",
+ "channel.access.device.channel.label": "Where devices can be used",
+ "channel.access.device.channel.list": "Channels for devices",
+ "channel.access.device.channel.listEmpty": "No channels added yet, so devices cannot be used in any channel.",
+ "channel.access.device.channel.listHint": "Use the same channel / group / chat IDs as Allowed Channels for conversations.",
"channel.access.device.label": "Who can use your devices",
"channel.access.device.list": "Authorized people",
"channel.access.device.listEmpty": "No one is authorized yet, so only you can use your devices.",
@@ -186,6 +194,12 @@
"channel.deviceAllowFromAdd": "Add person",
"channel.deviceAllowFromEmpty": "No one is authorized yet, so only you can use your devices.",
"channel.deviceAllowFromHint": "Listed people can read and write files and run commands on your devices through the bot.",
+ "channel.deviceChannelAllowFrom": "Device Channels",
+ "channel.deviceChannelAllowFromAdd": "Add channel",
+ "channel.deviceChannelAllowFromEmpty": "No channels added yet, so devices cannot be used in any channel.",
+ "channel.deviceChannelAllowFromHint": "Channel / group / chat IDs where the bot may operate your devices.",
+ "channel.deviceChannelPolicy": "Device Channels",
+ "channel.deviceChannelPolicyHint": "In which channels the bot may operate your devices.",
"channel.devicePolicy": "Device Access",
"channel.devicePolicyHint": "Who may operate your devices through the bot.",
"channel.dingtalk.clientId": "Client ID (AppKey)",
diff --git a/locales/zh-CN/agent.json b/locales/zh-CN/agent.json
index a35f64731ff..fbfaa9e0a21 100644
--- a/locales/zh-CN/agent.json
+++ b/locales/zh-CN/agent.json
@@ -1,6 +1,14 @@
{
"channel.access.device.allowlist": "本人及授权成员",
"channel.access.device.allowlistDesc": "你和下方名单中的成员可以让机器人操作你的设备。",
+ "channel.access.device.channel.allowlist": "仅列出的频道",
+ "channel.access.device.channel.allowlistDesc": "在下方名单以外的频道,所有人(包括你本人)都只能在沙箱中运行。私信不受影响。",
+ "channel.access.device.channel.any": "不限频道",
+ "channel.access.device.channel.anyDesc": "无论在哪个频道,设备权限都按上面的选择生效。",
+ "channel.access.device.channel.label": "设备可在哪些频道使用",
+ "channel.access.device.channel.list": "可使用设备的频道",
+ "channel.access.device.channel.listEmpty": "尚未添加频道,目前任何频道都无法使用设备。",
+ "channel.access.device.channel.listHint": "填写与对话「允许的频道」相同的频道 / 群组 / 会话 ID。",
"channel.access.device.label": "谁可以使用你的设备",
"channel.access.device.list": "授权成员",
"channel.access.device.listEmpty": "尚未授权任何成员,目前仅你本人可以使用设备。",
@@ -186,6 +194,12 @@
"channel.deviceAllowFromAdd": "添加成员",
"channel.deviceAllowFromEmpty": "尚未授权任何成员,目前仅你本人可以使用设备。",
"channel.deviceAllowFromHint": "名单中的成员可以通过机器人在你的设备上读写文件、执行命令。",
+ "channel.deviceChannelAllowFrom": "设备频道",
+ "channel.deviceChannelAllowFromAdd": "添加频道",
+ "channel.deviceChannelAllowFromEmpty": "尚未添加频道,目前任何频道都无法使用设备。",
+ "channel.deviceChannelAllowFromHint": "机器人可以在这些频道 / 群组 / 会话 ID 中操作你的设备。",
+ "channel.deviceChannelPolicy": "设备频道",
+ "channel.deviceChannelPolicyHint": "机器人可以在哪些频道操作你的设备。",
"channel.devicePolicy": "设备权限",
"channel.devicePolicyHint": "谁可以通过机器人操作你的设备。",
"channel.dingtalk.clientId": "Client ID(AppKey)",
diff --git a/packages/locales/src/default/agent.ts b/packages/locales/src/default/agent.ts
index 9502224fec2..9f08185784b 100644
--- a/packages/locales/src/default/agent.ts
+++ b/packages/locales/src/default/agent.ts
@@ -701,6 +701,18 @@ export default {
'channel.access.device.listHint':
'Listed people can read and write files and run commands on your devices through the bot. Add only people you trust.',
'channel.access.device.listEmpty': 'No one is authorized yet, so only you can use your devices.',
+ 'channel.access.device.channel.label': 'Where devices can be used',
+ 'channel.access.device.channel.any': 'Any channel',
+ 'channel.access.device.channel.anyDesc':
+ 'Device access follows the choice above wherever the bot is used.',
+ 'channel.access.device.channel.allowlist': 'Only listed channels',
+ 'channel.access.device.channel.allowlistDesc':
+ 'Outside the channels listed below, the bot runs in the sandbox for everyone, you included. Direct messages are not affected.',
+ 'channel.access.device.channel.list': 'Channels for devices',
+ 'channel.access.device.channel.listHint':
+ 'Use the same channel / group / chat IDs as Allowed Channels for conversations.',
+ 'channel.access.device.channel.listEmpty':
+ 'No channels added yet, so devices cannot be used in any channel.',
'channel.access.device.ownerMissing':
'Add your platform user ID under Owner identity first. Until then the bot cannot recognize you, and no one can use your devices.',
'channel.devicePolicy': 'Device Access',
@@ -708,6 +720,14 @@ export default {
'channel.deviceAllowFrom': 'Authorized People',
'channel.deviceAllowFromAdd': 'Add person',
'channel.deviceAllowFromEmpty': 'No one is authorized yet, so only you can use your devices.',
+ 'channel.deviceChannelPolicy': 'Device Channels',
+ 'channel.deviceChannelPolicyHint': 'In which channels the bot may operate your devices.',
+ 'channel.deviceChannelAllowFrom': 'Device Channels',
+ 'channel.deviceChannelAllowFromAdd': 'Add channel',
+ 'channel.deviceChannelAllowFromEmpty':
+ 'No channels added yet, so devices cannot be used in any channel.',
+ 'channel.deviceChannelAllowFromHint':
+ 'Channel / group / chat IDs where the bot may operate your devices.',
'channel.deviceAllowFromHint':
'Listed people can read and write files and run commands on your devices through the bot.',
'channel.hero.title': '{{name}} bot',
diff --git a/packages/types/src/topic/topic.ts b/packages/types/src/topic/topic.ts
index 566b66c6533..ad1ac16825d 100644
--- a/packages/types/src/topic/topic.ts
+++ b/packages/types/src/topic/topic.ts
@@ -70,6 +70,13 @@ export interface ChatTopicWebhookContext {
export interface ChatTopicBotContext {
applicationId: string;
+ /**
+ * Whether the conversation is outside the channels the owner limited device
+ * use to (`settings.deviceChannelPolicy = 'allowlist'` +
+ * `settings.deviceChannelAllowFrom`). Denies device access to everyone,
+ * the owner included. Absent means no channel restriction.
+ */
+ isDeviceChannelRestricted?: boolean;
/**
* Whether the sender, not being the owner, is on the owner's device list
* (`settings.devicePolicy = 'allowlist'` + `settings.deviceAllowFrom`).
diff --git a/src/features/AgentChannel/PlatformDetail/AccessSection.tsx b/src/features/AgentChannel/PlatformDetail/AccessSection.tsx
index 0d003854026..67ebdf9e80e 100644
--- a/src/features/AgentChannel/PlatformDetail/AccessSection.tsx
+++ b/src/features/AgentChannel/PlatformDetail/AccessSection.tsx
@@ -22,6 +22,7 @@ import type { AccessSectionKey } from './settingsGroups';
type GroupPolicy = 'allowlist' | 'disabled' | 'open';
type DevicePolicy = 'allowlist' | 'owner';
+type DeviceChannelPolicy = 'allowlist' | 'any';
interface AccessSectionProps {
disabled?: boolean;
@@ -43,8 +44,9 @@ interface AccessSectionProps {
* (`allowFrom`), a group policy and a group list. This section lets a person
* choose one stance per surface and only then shows what that choice needs: the
* list for "approval" and "listed", the owner's ID for approving. Devices are
- * the owner's alone unless they name people in `deviceAllowFrom`. A list stays
- * mounted when hidden so a saved list is never dropped by a save.
+ * the owner's alone unless they name people in `deviceAllowFrom`, and can be
+ * limited to the channels in `deviceChannelAllowFrom`. A list stays mounted
+ * when hidden so a saved list is never dropped by a save.
*/
export const AccessSection = memo<AccessSectionProps>(
({ disabled, fields, form, onValuesChange, section, userIdExtras }) => {
@@ -59,6 +61,8 @@ export const AccessSection = memo<AccessSectionProps>(
const groupPolicy = (settings.groupPolicy as GroupPolicy | undefined) ?? 'open';
const devicePolicy: DevicePolicy =
settings.devicePolicy === 'allowlist' ? 'allowlist' : 'owner';
+ const deviceChannelPolicy: DeviceChannelPolicy =
+ settings.deviceChannelPolicy === 'allowlist' ? 'allowlist' : 'any';
const hasPeopleList = countListed(settings.allowFrom) > 0;
const write = useCallback(
@@ -114,6 +118,13 @@ export const AccessSection = memo<AccessSectionProps>(
value,
}),
);
+ const deviceChannelOptions: ChoiceOption<DeviceChannelPolicy>[] = (
+ ['any', 'allowlist'] as const
+ ).map((value) => ({
+ desc: t(`channel.access.device.channel.${value}Desc`),
+ label: t(`channel.access.device.channel.${value}`),
+ value,
+ }));
const groupOptions: ChoiceOption<GroupPolicy>[] = (
['open', 'allowlist', 'disabled'] as const
).map((value) => ({
@@ -128,6 +139,7 @@ export const AccessSection = memo<AccessSectionProps>(
const guestPolicy = byKey.get('guestPolicy');
const groupAllowFrom = byKey.get('groupAllowFrom');
const deviceAllowFrom = byKey.get('deviceAllowFrom');
+ const deviceChannelAllowFrom = byKey.get('deviceChannelAllowFrom');
const ownerMissing = !(typeof settings.userId === 'string' && settings.userId.trim());
const approverMissing = settings.dmPolicy === 'pairing' && ownerMissing;
@@ -205,6 +217,29 @@ export const AccessSection = memo<AccessSectionProps>(
parentKey="settings"
/>
)}
+ {byKey.has('deviceChannelPolicy') && (
+ <Form.Field divider label={t('channel.access.device.channel.label')} layout="vertical">
+ <ChoiceList
+ aria-label={t('channel.access.device.channel.label')}
+ disabled={disabled}
+ options={deviceChannelOptions}
+ value={deviceChannelPolicy}
+ onChange={(next) => write({ deviceChannelPolicy: next })}
+ />
+ </Form.Field>
+ )}
+ {deviceChannelAllowFrom && (
+ <SchemaField
+ divider
+ descOverride={t('channel.access.device.channel.listHint')}
+ disabled={disabled}
+ emptyOverride={t('channel.access.device.channel.listEmpty')}
+ field={deviceChannelAllowFrom}
+ hidden={deviceChannelPolicy !== 'allowlist'}
+ labelOverride={t('channel.access.device.channel.list')}
+ parentKey="settings"
+ />
+ )}
</>
);
diff --git a/src/features/AgentChannel/PlatformDetail/Body.access.test.tsx b/src/features/AgentChannel/PlatformDetail/Body.access.test.tsx
index cbd2c8b3b7b..eb3ef7bcf73 100644
--- a/src/features/AgentChannel/PlatformDetail/Body.access.test.tsx
+++ b/src/features/AgentChannel/PlatformDetail/Body.access.test.tsx
@@ -157,6 +157,60 @@ describe('channel settings form: access tab', () => {
expect(onSave).toHaveBeenCalledWith('access-device');
});
+ it('leaves devices usable in any channel by default and hides the channel list', () => {
+ state.copy = en;
+
+ render(<Harness />);
+
+ const scope = screen.getByRole('radiogroup', {
+ name: en['channel.access.device.channel.label'],
+ });
+ expect(
+ within(scope).getByRole('radio', {
+ name: new RegExp(en['channel.access.device.channel.any']),
+ }),
+ ).toHaveAttribute('aria-checked', 'true');
+ expect(screen.queryByText(en['channel.access.device.channel.list'])).not.toBeVisible();
+ });
+
+ it('limits devices to listed channels and saves the choice with the device block', () => {
+ state.copy = zh;
+ const onSave = vi.fn();
+
+ render(
+ <Harness
+ moduleControls={controls({ dirty: ['access-device'], onSave })}
+ settings={{
+ deviceChannelAllowFrom: [{ id: 'dev-channel', name: '#dev' }],
+ deviceChannelPolicy: 'allowlist',
+ userId: 'owner-1',
+ }}
+ />,
+ );
+
+ const scope = screen.getByRole('radiogroup', {
+ name: zh['channel.access.device.channel.label'],
+ });
+ expect(
+ within(scope).getByRole('radio', {
+ name: new RegExp(zh['channel.access.device.channel.allowlist']),
+ }),
+ ).toHaveAttribute('aria-checked', 'true');
+ expect(screen.getByText(zh['channel.access.device.channel.list'])).toBeVisible();
+ // The list's add button derives its copy from the field label: a missing key shows raw.
+ expect(
+ screen.getByRole('button', { name: zh['channel.deviceChannelAllowFromAdd'] }),
+ ).toBeVisible();
+ expect(screen.getByDisplayValue('dev-channel')).toBeInTheDocument();
+
+ const enabled = screen
+ .getAllByRole('button', { name: zh['channel.module.save'] })
+ .filter((button) => !(button as HTMLButtonElement).disabled);
+ expect(enabled).toHaveLength(1);
+ fireEvent.click(enabled[0]);
+ expect(onSave).toHaveBeenCalledWith('access-device');
+ });
+
it('warns that nobody can use the devices until the owner ID is filled', () => {
state.copy = en;
diff --git a/src/features/AgentChannel/PlatformDetail/accessStance.test.ts b/src/features/AgentChannel/PlatformDetail/accessStance.test.ts
index fdaf39db59f..bcf09e42416 100644
--- a/src/features/AgentChannel/PlatformDetail/accessStance.test.ts
+++ b/src/features/AgentChannel/PlatformDetail/accessStance.test.ts
@@ -100,6 +100,24 @@ describe('dropHiddenIncompleteRows', () => {
).toEqual({});
});
+ it('drops a half-added device channel row once devices are no longer limited to channels', () => {
+ expect(
+ dropHiddenIncompleteRows({
+ deviceChannelAllowFrom: [{ id: 'c1' }, { id: '' }],
+ deviceChannelPolicy: 'any',
+ }),
+ ).toEqual({ deviceChannelAllowFrom: [{ id: 'c1' }] });
+ });
+
+ it('keeps an incomplete device channel row while the channel list is shown', () => {
+ expect(
+ dropHiddenIncompleteRows({
+ deviceChannelAllowFrom: [{ id: '' }],
+ deviceChannelPolicy: 'allowlist',
+ }),
+ ).toEqual({});
+ });
+
it('drops a half-added group row once groups are no longer limited to a list', () => {
expect(
dropHiddenIncompleteRows({
diff --git a/src/features/AgentChannel/PlatformDetail/accessStance.ts b/src/features/AgentChannel/PlatformDetail/accessStance.ts
index 4e04b7f0130..44c0a5fb6f7 100644
--- a/src/features/AgentChannel/PlatformDetail/accessStance.ts
+++ b/src/features/AgentChannel/PlatformDetail/accessStance.ts
@@ -80,6 +80,8 @@ export type AccessIssue = 'approverMissing' | 'groupListEmpty' | 'listEmpty';
export interface AccessSettings extends StanceSettings {
deviceAllowFrom?: unknown;
+ deviceChannelAllowFrom?: unknown;
+ deviceChannelPolicy?: string;
devicePolicy?: string;
groupAllowFrom?: unknown;
groupPolicy?: string;
@@ -116,7 +118,9 @@ export const dropHiddenIncompleteRows = (
settings: AccessSettings & { groupAllowFrom?: unknown; groupPolicy?: string },
): Record<string, unknown> => {
const patch: Record<string, unknown> = {};
- const prune = (key: 'allowFrom' | 'deviceAllowFrom' | 'groupAllowFrom') => {
+ const prune = (
+ key: 'allowFrom' | 'deviceAllowFrom' | 'deviceChannelAllowFrom' | 'groupAllowFrom',
+ ) => {
const list = settings[key];
if (Array.isArray(list) && list.some((entry) => !hasId(entry))) patch[key] = list.filter(hasId);
};
@@ -127,6 +131,7 @@ export const dropHiddenIncompleteRows = (
if (!peopleListShown) prune('allowFrom');
if (settings.groupPolicy !== 'allowlist') prune('groupAllowFrom');
if (settings.devicePolicy !== 'allowlist') prune('deviceAllowFrom');
+ if (settings.deviceChannelPolicy !== 'allowlist') prune('deviceChannelAllowFrom');
return patch;
};
diff --git a/src/features/AgentChannel/PlatformDetail/saveModules.test.ts b/src/features/AgentChannel/PlatformDetail/saveModules.test.ts
index 944f6f33dbf..f2adc2cc5bd 100644
--- a/src/features/AgentChannel/PlatformDetail/saveModules.test.ts
+++ b/src/features/AgentChannel/PlatformDetail/saveModules.test.ts
@@ -23,6 +23,8 @@ describe('resolveSaveModules', () => {
'groupPolicy',
'devicePolicy',
'deviceAllowFrom',
+ 'deviceChannelPolicy',
+ 'deviceChannelAllowFrom',
'watchKeywords',
'botWakeDisabled',
'botWakeScope',
@@ -100,7 +102,10 @@ describe('resolveSaveModules', () => {
expect(access.map((m) => [m.id, m.keys])).toEqual([
['access-identity', ['userId']],
['access-conversation', ['dmPolicy', 'groupPolicy']],
- ['access-device', ['devicePolicy', 'deviceAllowFrom']],
+ [
+ 'access-device',
+ ['devicePolicy', 'deviceAllowFrom', 'deviceChannelPolicy', 'deviceChannelAllowFrom'],
+ ],
]);
});
diff --git a/src/features/AgentChannel/PlatformDetail/settingsGroups.test.ts b/src/features/AgentChannel/PlatformDetail/settingsGroups.test.ts
index 08ee322f914..dd2e77a997f 100644
--- a/src/features/AgentChannel/PlatformDetail/settingsGroups.test.ts
+++ b/src/features/AgentChannel/PlatformDetail/settingsGroups.test.ts
@@ -17,15 +17,25 @@ const field = (key: string): FieldSchema => ({ key, label: key, type: 'string' }
describe('groupAccessFields', () => {
it('splits access into owner identity, conversation and device blocks, in page order', () => {
const sections = groupAccessFields(
- ['deviceAllowFrom', 'groupPolicy', 'userId', 'devicePolicy', 'dmPolicy', 'serverId'].map(
- field,
- ),
+ [
+ 'deviceChannelAllowFrom',
+ 'deviceAllowFrom',
+ 'groupPolicy',
+ 'userId',
+ 'deviceChannelPolicy',
+ 'devicePolicy',
+ 'dmPolicy',
+ 'serverId',
+ ].map(field),
);
expect(sections.map((s) => [s.key, s.fields.map((f) => f.key)])).toEqual([
['identity', ['userId', 'serverId']],
['conversation', ['dmPolicy', 'groupPolicy']],
- ['device', ['devicePolicy', 'deviceAllowFrom']],
+ [
+ 'device',
+ ['devicePolicy', 'deviceAllowFrom', 'deviceChannelPolicy', 'deviceChannelAllowFrom'],
+ ],
]);
});
diff --git a/src/features/AgentChannel/PlatformDetail/settingsGroups.ts b/src/features/AgentChannel/PlatformDetail/settingsGroups.ts
index b48ac85fbf4..e3f11213324 100644
--- a/src/features/AgentChannel/PlatformDetail/settingsGroups.ts
+++ b/src/features/AgentChannel/PlatformDetail/settingsGroups.ts
@@ -44,12 +44,12 @@ export interface AccessSectionGroup {
*
* - identity: who the owner is (their own ID, and the server that is theirs)
* - conversation: who may talk to the bot, in DMs (and the list they lean on) and in groups
- * - device: who, besides the owner, may use the owner's devices through the bot
+ * - device: who, besides the owner, may use the owner's devices through the bot, and in which channels
*/
const ACCESS_SECTION_KEYS: Array<[AccessSectionKey, string[]]> = [
['identity', ['userId', 'serverId']],
['conversation', ['dmPolicy', 'allowFrom', 'guestPolicy', 'groupPolicy', 'groupAllowFrom']],
- ['device', ['devicePolicy', 'deviceAllowFrom']],
+ ['device', ['devicePolicy', 'deviceAllowFrom', 'deviceChannelPolicy', 'deviceChannelAllowFrom']],
];
const ACCESS_KEYS = ACCESS_SECTION_KEYS.flatMap(([, keys]) => keys);