


















@@ -2,12 +2,13 @@ import {
22collectConditionalChannelFieldAssignments,
33getChannelSurface,
44hasConfiguredSecretInputValue,
5-normalizeSecretStringValue,
65type ResolverContext,
76type SecretDefaults,
87type SecretTargetRegistryEntry,
98} from "openclaw/plugin-sdk/channel-secret-basic-runtime";
10910+const DEFAULT_ACCOUNT_ID = "default";
11+1112export const secretTargetRegistryEntries = [
1213{
1314id: "channels.qqbot.accounts.*.clientSecret",
@@ -33,8 +34,11 @@ export const secretTargetRegistryEntries = [
3334},
3435] satisfies SecretTargetRegistryEntry[];
353636-function hasClientSecretFile(value: unknown): boolean {
37-return normalizeSecretStringValue(value).length > 0;
37+function hasTopLevelAppId(qqbot: Record<string, unknown>): boolean {
38+if (typeof qqbot.appId === "string") {
39+return qqbot.appId.trim().length > 0;
40+}
41+return typeof qqbot.appId === "number";
3842}
39434044export function collectRuntimeConfigAssignments(params: {
@@ -48,9 +52,9 @@ export function collectRuntimeConfigAssignments(params: {
4852}
49535054const { channel: qqbot, surface } = resolved;
51-const baseClientSecretFile = hasClientSecretFile(qqbot.clientSecretFile);
52-const accountClientSecretFile = (account: Record<string, unknown>) =>
53- hasClientSecretFile(account.clientSecretFile);
55+const hasExplicitDefaultAccount = surface.accounts.some(
56+ ({ accountId }) => accountId === DEFAULT_ACCOUNT_ID,
57+);
54585559collectConditionalChannelFieldAssignments({
5660channelKey: "qqbot",
@@ -59,20 +63,16 @@ export function collectRuntimeConfigAssignments(params: {
5963 surface,
6064defaults: params.defaults,
6165context: params.context,
62-topLevelActiveWithoutAccounts: !baseClientSecretFile,
63-topLevelInheritedAccountActive: ({ account, enabled }) => {
64-if (!enabled || baseClientSecretFile) {
65-return false;
66+topLevelActiveWithoutAccounts: true,
67+topLevelInheritedAccountActive: ({ accountId, account, enabled }) => {
68+if (accountId === DEFAULT_ACCOUNT_ID) {
69+return enabled && !hasConfiguredSecretInputValue(account.clientSecret, params.defaults);
6670}
67-return (
68-!hasConfiguredSecretInputValue(account.clientSecret, params.defaults) &&
69-!accountClientSecretFile(account)
70-);
71+return !hasExplicitDefaultAccount && hasTopLevelAppId(qqbot);
7172},
72-accountActive: ({ account, enabled }) => enabled && !accountClientSecretFile(account),
73-topInactiveReason:
74-"no enabled QQBot surface inherits this top-level clientSecret (clientSecretFile is configured).",
75-accountInactiveReason: "QQBot account is disabled or clientSecretFile is configured.",
73+accountActive: ({ enabled }) => enabled,
74+topInactiveReason: "no enabled QQ Bot default surface uses this top-level clientSecret.",
75+accountInactiveReason: "QQ Bot account is disabled.",
7676});
7777}
7878此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。