





























@@ -0,0 +1,82 @@
1+import {
2+collectConditionalChannelFieldAssignments,
3+getChannelSurface,
4+hasConfiguredSecretInputValue,
5+normalizeSecretStringValue,
6+type ResolverContext,
7+type SecretDefaults,
8+type SecretTargetRegistryEntry,
9+} from "openclaw/plugin-sdk/channel-secret-basic-runtime";
10+11+export const secretTargetRegistryEntries = [
12+{
13+id: "channels.qqbot.accounts.*.clientSecret",
14+targetType: "channels.qqbot.accounts.*.clientSecret",
15+configFile: "openclaw.json",
16+pathPattern: "channels.qqbot.accounts.*.clientSecret",
17+secretShape: "secret_input",
18+expectedResolvedValue: "string",
19+includeInPlan: true,
20+includeInConfigure: true,
21+includeInAudit: true,
22+},
23+{
24+id: "channels.qqbot.clientSecret",
25+targetType: "channels.qqbot.clientSecret",
26+configFile: "openclaw.json",
27+pathPattern: "channels.qqbot.clientSecret",
28+secretShape: "secret_input",
29+expectedResolvedValue: "string",
30+includeInPlan: true,
31+includeInConfigure: true,
32+includeInAudit: true,
33+},
34+] satisfies SecretTargetRegistryEntry[];
35+36+function hasClientSecretFile(value: unknown): boolean {
37+return normalizeSecretStringValue(value).length > 0;
38+}
39+40+export function collectRuntimeConfigAssignments(params: {
41+config: { channels?: Record<string, unknown> };
42+defaults?: SecretDefaults;
43+context: ResolverContext;
44+}): void {
45+const resolved = getChannelSurface(params.config, "qqbot");
46+if (!resolved) {
47+return;
48+}
49+50+const { channel: qqbot, surface } = resolved;
51+const baseClientSecretFile = hasClientSecretFile(qqbot.clientSecretFile);
52+const accountClientSecretFile = (account: Record<string, unknown>) =>
53+hasClientSecretFile(account.clientSecretFile);
54+55+collectConditionalChannelFieldAssignments({
56+channelKey: "qqbot",
57+field: "clientSecret",
58+channel: qqbot,
59+ surface,
60+defaults: params.defaults,
61+context: params.context,
62+topLevelActiveWithoutAccounts: !baseClientSecretFile,
63+topLevelInheritedAccountActive: ({ account, enabled }) => {
64+if (!enabled || baseClientSecretFile) {
65+return false;
66+}
67+return (
68+!hasConfiguredSecretInputValue(account.clientSecret, params.defaults) &&
69+!accountClientSecretFile(account)
70+);
71+},
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.",
76+});
77+}
78+79+export const channelSecrets = {
80+ secretTargetRegistryEntries,
81+ collectRuntimeConfigAssignments,
82+};
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。