1- import type { OpenClawConfig } from "../../config/config.js" ;
21import { resolveAccountEntry } from "../../routing/account-lookup.js" ;
32import { DEFAULT_ACCOUNT_ID , normalizeAccountId } from "../../routing/session-key.js" ;
43
@@ -11,6 +10,10 @@ type ChannelConfigWithAccounts = {
1110 accounts ?: Record < string , AccountConfigWithWrites > ;
1211} ;
1312
13+ type ConfigWritePolicyConfig = {
14+ channels ?: Record < string , ChannelConfigWithAccounts > ;
15+ } ;
16+
1417export type ConfigWriteScopeLike < TChannelId extends string = string > = {
1518 channelId ?: TChannelId | null ;
1619 accountId ?: string | null ;
@@ -46,13 +49,13 @@ function listConfigWriteTargetScopes<TChannelId extends string>(
4649}
4750
4851function resolveChannelConfig < TChannelId extends string > (
49- cfg : OpenClawConfig ,
52+ cfg : ConfigWritePolicyConfig ,
5053 channelId ?: TChannelId | null ,
5154) : ChannelConfigWithAccounts | undefined {
5255 if ( ! channelId ) {
5356 return undefined ;
5457 }
55- return ( cfg . channels as Record < string , ChannelConfigWithAccounts > | undefined ) ?. [ channelId ] ;
58+ return cfg . channels ?. [ channelId ] ;
5659}
5760
5861function resolveChannelAccountConfig (
@@ -63,7 +66,7 @@ function resolveChannelAccountConfig(
6366}
6467
6568export function resolveChannelConfigWritesShared < TChannelId extends string > ( params : {
66- cfg : OpenClawConfig ;
69+ cfg : ConfigWritePolicyConfig ;
6770 channelId ?: TChannelId | null ;
6871 accountId ?: string | null ;
6972} ) : boolean {
@@ -77,7 +80,7 @@ export function resolveChannelConfigWritesShared<TChannelId extends string>(para
7780}
7881
7982export function authorizeConfigWriteShared < TChannelId extends string > ( params : {
80- cfg : OpenClawConfig ;
83+ cfg : ConfigWritePolicyConfig ;
8184 origin ?: ConfigWriteScopeLike < TChannelId > ;
8285 target ?: ConfigWriteTargetLike < TChannelId > ;
8386 allowBypass ?: boolean ;
0 commit comments