@openclaw/discord 2026.9.8 → 2026.10.1-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -0
- package/dist/.setup/{account-inspect-De8hOUxG.mjs → account-inspect-CjKqkDnH.mjs} +2 -2
- package/dist/.setup/{accounts-ChaMcixG.mjs → accounts-DXHCL8Zm.mjs} +9 -32
- package/dist/.setup/{active-turn-thread-route-fmHl1HNd.mjs → active-turn-thread-route-C4tp9noA.mjs} +5 -9
- package/dist/.setup/{activities-api-tvbsU2e3.mjs → activities-api-BL_hJ0JQ.mjs} +15 -18
- package/dist/.setup/{api-DVbJwZVt.mjs → api-_oznjffB.mjs} +1 -1
- package/dist/.setup/{approval-handler.runtime-DxCK2Rux.mjs → approval-handler.runtime-BilYSrRF.mjs} +22 -61
- package/dist/.setup/{approval-message-updates-BKFqavHZ.mjs → approval-message-updates-CgRwc2_Q.mjs} +2 -2
- package/dist/.setup/{audit-CLg9I71N.mjs → audit-DtvzxONM.mjs} +4 -4
- package/dist/.setup/{channel-access-C12aDZ0p.mjs → channel-access-BRp3Y-rF.mjs} +4 -17
- package/dist/.setup/{channel-type-DRCrEMss.mjs → channel-type-D1_b5UhU.mjs} +12 -16
- package/dist/.setup/{channel-DxlUVU9t.mjs → channel-z5lQMS_9.mjs} +79 -75
- package/dist/.setup/{channel.setup-CRo1GjV7.mjs → channel.setup-DBJtugJO.mjs} +14 -34
- package/dist/.setup/{components-Cq1PvIpN.mjs → components-CzXLR3QH.mjs} +56 -72
- package/dist/.setup/{config-schema-oxELUSDx.mjs → config-schema-CsemBDpS.mjs} +6 -17
- package/dist/.setup/{conversation-binding-route-Caz_XuFH.mjs → conversation-binding-route-Bi62ApSt.mjs} +1 -1
- package/dist/.setup/{directory-config-esqNn0Eo.mjs → directory-config-BH1LA-gi.mjs} +1 -1
- package/dist/.setup/{directory-live-DtKRHuGV.mjs → directory-live-C9xz7IPm.mjs} +10 -13
- package/dist/.setup/{discord-0xJYfdDD.mjs → discord-J7aRzq2Q.mjs} +101 -381
- package/dist/.setup/{doctor-BCl1H5tl.mjs → doctor-DxSAngJq.mjs} +31 -70
- package/dist/.setup/doctor-contract-Bg3NPAMw.mjs +137 -0
- package/dist/.setup/{handle-action-CUvQWnE7.mjs → handle-action-DlmFX-_G.mjs} +10 -11
- package/dist/.setup/{handle-action.guild-admin-Df-8gVle.mjs → handle-action.guild-admin-BnyqTczR.mjs} +67 -129
- package/dist/.setup/{live-policy-config-8Pv20CHc.mjs → live-policy-config-emmPNyh4.mjs} +1 -1
- package/dist/.setup/{message-handler-B-Jk4oDk.mjs → message-handler-BNToPZrx.mjs} +7 -6
- package/dist/.setup/{message-handler.preflight-v-__NSDq.mjs → message-handler.preflight-D0BcCyI7.mjs} +13 -23
- package/dist/.setup/{message-handler.preflight-pluralkit-CWLUBVcx.mjs → message-handler.preflight-pluralkit-D1g3eq0B.mjs} +5 -8
- package/dist/.setup/{message-handler.process-BNFFuChn.mjs → message-handler.process-CThRmCWK.mjs} +57 -96
- package/dist/.setup/{outbound-adapter-BobT-kse.mjs → outbound-adapter-BPq0c2wY.mjs} +11 -17
- package/dist/.setup/{outbound-session-route-zVGxxceg.mjs → outbound-session-route-DGPPKA0z.mjs} +21 -46
- package/dist/.setup/{presence-cache-Di3H3DIU.mjs → presence-cache-Dg3_dADn.mjs} +2 -4
- package/dist/.setup/{probe-LYrIHlBF.mjs → probe-DIRY8vh7.mjs} +17 -27
- package/dist/.setup/{provider-B_G5hASF.mjs → provider-D2OKMo0f.mjs} +273 -446
- package/dist/.setup/{provider-session.runtime-BYlTBFD2.mjs → provider-session.runtime-BupCTZQv.mjs} +3 -3
- package/dist/.setup/provider.runtime-BaW_JnfU.mjs +2 -0
- package/dist/.setup/{realtime-session.runtime-oUd9DOcz.mjs → realtime-session.runtime-D5RSC8Mm.mjs} +6 -8
- package/dist/.setup/{receive-recovery-CHPOsnLc.mjs → receive-recovery-GqF2PUN_.mjs} +1 -4
- package/dist/.setup/{resolve-allowlist-common-DPdRggu5.mjs → resolve-allowlist-common-DUYRrrVB.mjs} +5 -9
- package/dist/.setup/{resolve-channels-BFPNRmVv.mjs → resolve-channels--MUatisx.mjs} +3 -3
- package/dist/.setup/{resolve-users-0-aBuCy3.mjs → resolve-users-CxLcDmM0.mjs} +6 -9
- package/dist/.setup/{retry-pz_cSha2.mjs → retry-BKzO25k4.mjs} +27 -51
- package/dist/.setup/{runtime-sUksZ--Q.mjs → runtime-CerRBfaa.mjs} +2 -2
- package/dist/.setup/{runtime-FN000lxA.mjs → runtime-CwUA0RLr.mjs} +228 -255
- package/dist/.setup/{runtime-doctor-migrations-CshUGl36.mjs → runtime-doctor-migrations-BPV-R4G9.mjs} +6 -0
- package/dist/.setup/{security-audit-Cdaegq7C.mjs → security-audit-D42cp5N7.mjs} +21 -48
- package/dist/.setup/{send-CrfEI6Bs.mjs → send-2X7m2Zmw.mjs} +45 -58
- package/dist/.setup/{send.components-DxQAMfES.mjs → send.components-RqvgmCs3.mjs} +44 -90
- package/dist/.setup/{send.outbound-BISKnb-a.mjs → send.outbound-B4QHSEzm.mjs} +60 -98
- package/dist/.setup/{send.shared-DGFkbkQR.mjs → send.shared-BQIUh6Vn.mjs} +13 -20
- package/dist/.setup/{sender-identity-B9X5Vb9R.mjs → sender-identity-CooeYfAn.mjs} +1 -1
- package/dist/.setup/{session-key-normalization-wJgsKPNF.mjs → session-key-normalization-CCHGNSQw.mjs} +3 -9
- package/dist/.setup/setup-plugin-api-nn_giXvZ.mjs +3 -0
- package/dist/.setup/{shared-B3wZ4hN-.mjs → shared-CIJn6AEC.mjs} +7 -7
- package/dist/.setup/{subagent-hooks-nlUE9ow7.mjs → subagent-hooks-BYlVnxzy.mjs} +4 -9
- package/dist/.setup/{system-events-CdeZnvPV.mjs → system-events-CQ3if_pS.mjs} +2 -2
- package/dist/.setup/{target-resolver-BuLapkhy.mjs → target-resolver-Dzxf80Y3.mjs} +5 -13
- package/dist/.setup/targets-Lf8D55w-.mjs +3 -0
- package/dist/.setup/{thread-bindings-D7TfgjR_.mjs → thread-bindings-yNNlcUWE.mjs} +5 -6
- package/dist/.setup/{thread-bindings.manager-DN-NissX.mjs → thread-bindings.manager-plk0zJAW.mjs} +14 -20
- package/dist/.setup/{thread-bindings.session-updates-CshfKghV.mjs → thread-bindings.session-updates-C9aKtVs6.mjs} +295 -5
- package/dist/.setup/{timeouts-D86uWLt_.mjs → timeouts-pun7VJ02.mjs} +2 -15
- package/dist/.setup/{transcripts-source-p8EV179h.mjs → transcripts-source-CNWswry-.mjs} +31 -79
- package/dist/.setup/typing-CNlSKY5S.mjs +11 -0
- package/dist/.setup/{voice-runtime-B46rcwrG.mjs → voice-runtime-Bc75quiH.mjs} +62 -110
- package/dist/account-inspect-api.js +1 -1
- package/dist/action-runtime-api.js +1 -1
- package/dist/activities-api.js +1 -1
- package/dist/api.js +18 -18
- package/dist/channel-config-api.js +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/control-ui/2afbdab1d3aa65a789d8a3eba666f4b1ec5df07073538fe30d6cf32093a1fb2d/index.js +1 -0
- package/dist/directory-contract-api.js +1 -1
- package/dist/doctor-contract-api.js +19 -128
- package/dist/index.js +1 -1
- package/dist/runtime-api.js +20 -21
- package/dist/security-audit-contract-api.js +1 -1
- package/dist/session-key-api.js +1 -1
- package/dist/setup-entry.js +1 -1
- package/dist/setup-plugin-api.js +1 -1
- package/dist/src/voice/audio-worker.runtime.js +6 -8
- package/dist/subagent-hooks-api.js +1 -1
- package/dist/transcripts-source-api.js +1 -1
- package/node_modules/libopus-wasm/CHANGELOG.md +8 -0
- package/node_modules/libopus-wasm/dist/discordjs.d.ts.map +1 -1
- package/node_modules/libopus-wasm/dist/discordjs.js +14 -2
- package/node_modules/libopus-wasm/dist/generated/libopus.generated.mjs +0 -0
- package/node_modules/libopus-wasm/dist/index.d.ts.map +1 -1
- package/node_modules/libopus-wasm/dist/index.js +55 -100
- package/node_modules/libopus-wasm/package.json +5 -5
- package/node_modules/undici/README.md +10 -1
- package/node_modules/undici/docs/docs/api/Agent.md +8 -8
- package/node_modules/undici/docs/docs/api/DiagnosticsChannel.md +9 -6
- package/node_modules/undici/docs/docs/api/Dispatcher.md +9 -0
- package/node_modules/undici/docs/docs/api/Errors.md +25 -0
- package/node_modules/undici/docs/docs/api/Fetch.md +10 -0
- package/node_modules/undici/docs/docs/api/Interceptors.md +4 -3
- package/node_modules/undici/docs/docs/api/Pool.md +5 -6
- package/node_modules/undici/docs/docs/index.md +10 -1
- package/node_modules/undici/lib/api/readable.js +1 -2
- package/node_modules/undici/lib/core/request.js +23 -2
- package/node_modules/undici/lib/core/util.js +0 -39
- package/node_modules/undici/lib/dispatcher/client-h1.js +11 -4
- package/node_modules/undici/lib/dispatcher/client-h2.js +52 -8
- package/node_modules/undici/lib/dispatcher/client.js +6 -1
- package/node_modules/undici/lib/dispatcher/env-http-proxy-agent.js +21 -6
- package/node_modules/undici/lib/dispatcher/pool-base.js +63 -2
- package/node_modules/undici/lib/dispatcher/pool.js +90 -7
- package/node_modules/undici/lib/dispatcher/proxy-agent.js +16 -3
- package/node_modules/undici/lib/handler/deduplication-handler.js +24 -11
- package/node_modules/undici/lib/handler/redirect-handler.js +5 -0
- package/node_modules/undici/lib/handler/retry-handler.js +72 -13
- package/node_modules/undici/lib/interceptor/cache.js +4 -1
- package/node_modules/undici/lib/interceptor/decompress.js +236 -69
- package/node_modules/undici/lib/web/cache/cache.js +17 -8
- package/node_modules/undici/lib/web/cache/cachestorage.js +11 -5
- package/node_modules/undici/lib/web/cookies/index.js +19 -7
- package/node_modules/undici/lib/web/cookies/util.js +3 -1
- package/node_modules/undici/lib/web/eventsource/eventsource.js +25 -1
- package/node_modules/undici/lib/web/fetch/body.js +22 -15
- package/node_modules/undici/lib/web/fetch/data-url.js +6 -6
- package/node_modules/undici/lib/web/fetch/formdata.js +30 -36
- package/node_modules/undici/lib/web/fetch/headers.js +34 -31
- package/node_modules/undici/lib/web/fetch/index.js +46 -25
- package/node_modules/undici/lib/web/fetch/request.js +74 -79
- package/node_modules/undici/lib/web/fetch/response.js +43 -44
- package/node_modules/undici/lib/web/fetch/util.js +7 -7
- package/node_modules/undici/lib/web/infra/index.js +16 -1
- package/node_modules/undici/lib/web/webidl/index.js +2 -14
- package/node_modules/undici/lib/web/websocket/connection.js +33 -12
- package/node_modules/undici/lib/web/websocket/events.js +43 -26
- package/node_modules/undici/lib/web/websocket/receiver.js +2 -0
- package/node_modules/undici/lib/web/websocket/stream/websocketerror.js +13 -10
- package/node_modules/undici/lib/web/websocket/stream/websocketstream.js +19 -4
- package/node_modules/undici/lib/web/websocket/websocket.js +44 -41
- package/node_modules/undici/package.json +1 -1
- package/node_modules/undici/types/diagnostics-channel.d.ts +2 -1
- package/node_modules/undici/types/interceptors.d.ts +1 -1
- package/node_modules/undici/types/webidl.d.ts +13 -7
- package/openclaw.plugin.json +6 -0
- package/package.json +12 -7
- package/dist/.setup/doctor-contract-CvvgwrrG.mjs +0 -409
- package/dist/.setup/model-picker-preference-primitives-BHT1LkR_.mjs +0 -37
- package/dist/.setup/provider.runtime-CUE3UxER.mjs +0 -2
- package/dist/.setup/setup-plugin-api-BQUBxbhe.mjs +0 -3
- package/dist/.setup/targets-0KUcEIYx.mjs +0 -3
- package/dist/.setup/thread-bindings.state-g6v9zAym.mjs +0 -331
- package/dist/.setup/typing-BiHCzBRu.mjs +0 -15
|
@@ -1,409 +0,0 @@
|
|
|
1
|
-
import { t as runtime_doctor_migrations_exports } from "./runtime-doctor-migrations-CshUGl36.mjs";
|
|
2
|
-
import { isSupportedRealtimeVoiceActivationName, normalizeRealtimeVoiceActivationNamePrefix } from "openclaw/plugin-sdk/realtime-voice-activation";
|
|
3
|
-
//#region extensions/discord/src/doctor-contract.ts
|
|
4
|
-
const LEGACY_TTS_PROVIDER_KEYS = [
|
|
5
|
-
"openai",
|
|
6
|
-
"elevenlabs",
|
|
7
|
-
"microsoft",
|
|
8
|
-
"edge"
|
|
9
|
-
];
|
|
10
|
-
const RETIRED_TUNING_KEYS = /* @__PURE__ */ new Set([
|
|
11
|
-
"gatewayInfoTimeoutMs",
|
|
12
|
-
"gatewayReadyTimeoutMs",
|
|
13
|
-
"gatewayRuntimeReadyTimeoutMs",
|
|
14
|
-
"eventQueue",
|
|
15
|
-
"retry"
|
|
16
|
-
]);
|
|
17
|
-
const streamingAliasMigration = (0, runtime_doctor_migrations_exports.defineChannelAliasMigration)({
|
|
18
|
-
channelId: "discord",
|
|
19
|
-
streaming: {
|
|
20
|
-
defaultMode: "off",
|
|
21
|
-
includePreviewChunk: true
|
|
22
|
-
},
|
|
23
|
-
accountStreamingReplacesRoot: true,
|
|
24
|
-
dm: {
|
|
25
|
-
root: true,
|
|
26
|
-
accounts: true
|
|
27
|
-
},
|
|
28
|
-
normalizeAccountExtra: ({ account, pathPrefix, changes }) => {
|
|
29
|
-
const accountVoice = (0, runtime_doctor_migrations_exports.asObjectRecord)(account.voice);
|
|
30
|
-
if (!accountVoice || !migrateLegacyTtsConfig((0, runtime_doctor_migrations_exports.asObjectRecord)(accountVoice.tts), `${pathPrefix}.voice.tts`, changes)) return {
|
|
31
|
-
entry: account,
|
|
32
|
-
changed: false
|
|
33
|
-
};
|
|
34
|
-
return {
|
|
35
|
-
entry: {
|
|
36
|
-
...account,
|
|
37
|
-
voice: accountVoice
|
|
38
|
-
},
|
|
39
|
-
changed: true
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
function hasLegacyTtsProviderKeys(value) {
|
|
44
|
-
const tts = (0, runtime_doctor_migrations_exports.asObjectRecord)(value);
|
|
45
|
-
if (!tts) return false;
|
|
46
|
-
return LEGACY_TTS_PROVIDER_KEYS.some((key) => Object.hasOwn(tts, key));
|
|
47
|
-
}
|
|
48
|
-
const guildChannelAllowMigration = (0, runtime_doctor_migrations_exports.defineKeyMoveMigration)({
|
|
49
|
-
scope: [
|
|
50
|
-
"guilds",
|
|
51
|
-
"*",
|
|
52
|
-
"channels",
|
|
53
|
-
"*"
|
|
54
|
-
],
|
|
55
|
-
from: ["allow"],
|
|
56
|
-
to: ["enabled"]
|
|
57
|
-
});
|
|
58
|
-
function hasLegacyDiscordGuildChannelAgentId(value) {
|
|
59
|
-
const guilds = (0, runtime_doctor_migrations_exports.asObjectRecord)((0, runtime_doctor_migrations_exports.asObjectRecord)(value)?.guilds);
|
|
60
|
-
if (!guilds) return false;
|
|
61
|
-
return Object.values(guilds).some((guildValue) => {
|
|
62
|
-
const channels = (0, runtime_doctor_migrations_exports.asObjectRecord)((0, runtime_doctor_migrations_exports.asObjectRecord)(guildValue)?.channels);
|
|
63
|
-
if (!channels) return false;
|
|
64
|
-
return Object.values(channels).some((channel) => Object.hasOwn((0, runtime_doctor_migrations_exports.asObjectRecord)(channel) ?? {}, "agentId"));
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
function hasUnsupportedRealtimeWakeNamesInVoice(value) {
|
|
68
|
-
const voice = (0, runtime_doctor_migrations_exports.asObjectRecord)(value);
|
|
69
|
-
const wakeNames = (0, runtime_doctor_migrations_exports.asObjectRecord)(voice?.realtime)?.wakeNames;
|
|
70
|
-
return Array.isArray(wakeNames) ? wakeNames.length === 0 || wakeNames.some((wakeName) => typeof wakeName === "string" && !isSupportedRealtimeVoiceActivationName(wakeName)) : false;
|
|
71
|
-
}
|
|
72
|
-
function hasUnsupportedDiscordRealtimeWakeNames(value) {
|
|
73
|
-
const entry = (0, runtime_doctor_migrations_exports.asObjectRecord)(value);
|
|
74
|
-
if (!entry) return false;
|
|
75
|
-
return hasUnsupportedRealtimeWakeNamesInVoice(entry.voice);
|
|
76
|
-
}
|
|
77
|
-
function mergeMissing(target, source) {
|
|
78
|
-
for (const [key, value] of Object.entries(source)) {
|
|
79
|
-
if (value === void 0) continue;
|
|
80
|
-
const existing = target[key];
|
|
81
|
-
if (existing === void 0) {
|
|
82
|
-
target[key] = value;
|
|
83
|
-
continue;
|
|
84
|
-
}
|
|
85
|
-
if (existing && typeof existing === "object" && !Array.isArray(existing) && value && typeof value === "object" && !Array.isArray(value)) mergeMissing(existing, value);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
function getOrCreateTtsProviders(tts) {
|
|
89
|
-
const providers = (0, runtime_doctor_migrations_exports.asObjectRecord)(tts.providers) ?? {};
|
|
90
|
-
tts.providers = providers;
|
|
91
|
-
return providers;
|
|
92
|
-
}
|
|
93
|
-
function mergeLegacyTtsProviderConfig(tts, legacyKey, providerId) {
|
|
94
|
-
const legacyValue = (0, runtime_doctor_migrations_exports.asObjectRecord)(tts[legacyKey]);
|
|
95
|
-
if (!legacyValue) return false;
|
|
96
|
-
const providers = getOrCreateTtsProviders(tts);
|
|
97
|
-
const existing = (0, runtime_doctor_migrations_exports.asObjectRecord)(providers[providerId]) ?? {};
|
|
98
|
-
const merged = structuredClone(existing);
|
|
99
|
-
mergeMissing(merged, legacyValue);
|
|
100
|
-
providers[providerId] = merged;
|
|
101
|
-
delete tts[legacyKey];
|
|
102
|
-
return true;
|
|
103
|
-
}
|
|
104
|
-
function migrateLegacyTtsConfig(tts, pathLabel, changes) {
|
|
105
|
-
if (!tts) return false;
|
|
106
|
-
let changed = false;
|
|
107
|
-
for (const legacyKey of LEGACY_TTS_PROVIDER_KEYS) {
|
|
108
|
-
const providerId = legacyKey === "edge" ? "microsoft" : legacyKey;
|
|
109
|
-
if (mergeLegacyTtsProviderConfig(tts, legacyKey, providerId)) {
|
|
110
|
-
changes.push(`Moved ${pathLabel}.${legacyKey} → ${pathLabel}.providers.${providerId}.`);
|
|
111
|
-
changed = true;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
return changed;
|
|
115
|
-
}
|
|
116
|
-
function normalizeUnsupportedRealtimeWakeNames(entry, pathPrefix, changes) {
|
|
117
|
-
const voice = (0, runtime_doctor_migrations_exports.asObjectRecord)(entry.voice);
|
|
118
|
-
const realtime = (0, runtime_doctor_migrations_exports.asObjectRecord)(voice?.realtime);
|
|
119
|
-
const wakeNames = realtime?.wakeNames;
|
|
120
|
-
if (!voice || !realtime || !Array.isArray(wakeNames)) return {
|
|
121
|
-
entry,
|
|
122
|
-
changed: false
|
|
123
|
-
};
|
|
124
|
-
if (wakeNames.length === 0) {
|
|
125
|
-
const nextRealtime = { ...realtime };
|
|
126
|
-
delete nextRealtime.wakeNames;
|
|
127
|
-
changes.push(`Removed empty ${pathPrefix}.voice.realtime.wakeNames; unset wake names use the default agent/OpenClaw fallback.`);
|
|
128
|
-
return {
|
|
129
|
-
entry: {
|
|
130
|
-
...entry,
|
|
131
|
-
voice: {
|
|
132
|
-
...voice,
|
|
133
|
-
realtime: nextRealtime
|
|
134
|
-
}
|
|
135
|
-
},
|
|
136
|
-
changed: true
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
let normalized = 0;
|
|
140
|
-
let removed = 0;
|
|
141
|
-
const nextWakeNames = wakeNames.flatMap((wakeName) => {
|
|
142
|
-
if (typeof wakeName !== "string" || isSupportedRealtimeVoiceActivationName(wakeName)) return [wakeName];
|
|
143
|
-
const nextWakeName = normalizeRealtimeVoiceActivationNamePrefix(wakeName);
|
|
144
|
-
if (!nextWakeName) {
|
|
145
|
-
removed += 1;
|
|
146
|
-
return [];
|
|
147
|
-
}
|
|
148
|
-
normalized += 1;
|
|
149
|
-
return [nextWakeName];
|
|
150
|
-
});
|
|
151
|
-
if (normalized === 0 && removed === 0) return {
|
|
152
|
-
entry,
|
|
153
|
-
changed: false
|
|
154
|
-
};
|
|
155
|
-
const dedupedWakeNames = Array.from(new Set(nextWakeNames));
|
|
156
|
-
const nextRealtime = { ...realtime };
|
|
157
|
-
if (dedupedWakeNames.length > 0) nextRealtime.wakeNames = dedupedWakeNames;
|
|
158
|
-
else delete nextRealtime.wakeNames;
|
|
159
|
-
if (normalized > 0) changes.push(`Shortened ${normalized} unsupported ${pathPrefix}.voice.realtime.wakeNames entries to one or two words.`);
|
|
160
|
-
if (removed > 0) changes.push(`Removed ${removed} unsupported ${pathPrefix}.voice.realtime.wakeNames entries with no usable words.`);
|
|
161
|
-
return {
|
|
162
|
-
entry: {
|
|
163
|
-
...entry,
|
|
164
|
-
voice: {
|
|
165
|
-
...voice,
|
|
166
|
-
realtime: nextRealtime
|
|
167
|
-
}
|
|
168
|
-
},
|
|
169
|
-
changed: true
|
|
170
|
-
};
|
|
171
|
-
}
|
|
172
|
-
function isDiscordChannelAgentBinding(value, match) {
|
|
173
|
-
const binding = (0, runtime_doctor_migrations_exports.asObjectRecord)(value);
|
|
174
|
-
const bindingMatch = (0, runtime_doctor_migrations_exports.asObjectRecord)(binding?.match);
|
|
175
|
-
const peer = (0, runtime_doctor_migrations_exports.asObjectRecord)(bindingMatch?.peer);
|
|
176
|
-
if (!binding || !bindingMatch || !peer) return false;
|
|
177
|
-
return bindingMatch.channel === "discord" && bindingMatch.guildId === match.guildId && (match.accountId === void 0 || bindingMatch.accountId === match.accountId) && peer.kind === "channel" && peer.id === match.channelId;
|
|
178
|
-
}
|
|
179
|
-
function normalizeDiscordGuildChannelAgentIds(params) {
|
|
180
|
-
const guilds = (0, runtime_doctor_migrations_exports.asObjectRecord)(params.entry.guilds);
|
|
181
|
-
if (!guilds) return {
|
|
182
|
-
entry: params.entry,
|
|
183
|
-
changed: false
|
|
184
|
-
};
|
|
185
|
-
const existingBindings = Array.isArray(params.cfg.bindings) ? params.cfg.bindings : [];
|
|
186
|
-
let changed = false;
|
|
187
|
-
const nextGuilds = { ...guilds };
|
|
188
|
-
for (const [guildId, guildValue] of Object.entries(guilds)) {
|
|
189
|
-
const guild = (0, runtime_doctor_migrations_exports.asObjectRecord)(guildValue);
|
|
190
|
-
const channels = (0, runtime_doctor_migrations_exports.asObjectRecord)(guild?.channels);
|
|
191
|
-
if (!guild || !channels) continue;
|
|
192
|
-
let channelsChanged = false;
|
|
193
|
-
const nextChannels = { ...channels };
|
|
194
|
-
for (const [channelId, channelValue] of Object.entries(channels)) {
|
|
195
|
-
const channel = (0, runtime_doctor_migrations_exports.asObjectRecord)(channelValue);
|
|
196
|
-
if (!channel || !Object.hasOwn(channel, "agentId")) continue;
|
|
197
|
-
const nextChannel = { ...channel };
|
|
198
|
-
const rawAgentId = nextChannel.agentId;
|
|
199
|
-
delete nextChannel.agentId;
|
|
200
|
-
nextChannels[channelId] = nextChannel;
|
|
201
|
-
channelsChanged = true;
|
|
202
|
-
const path = `${params.pathPrefix}.guilds.${guildId}.channels.${channelId}.agentId`;
|
|
203
|
-
const agentId = typeof rawAgentId === "string" ? rawAgentId.trim() : "";
|
|
204
|
-
if (!agentId) {
|
|
205
|
-
params.changes.push(`Removed ${path}; configure top-level bindings[] for per-channel Discord agent routing.`);
|
|
206
|
-
continue;
|
|
207
|
-
}
|
|
208
|
-
const match = {
|
|
209
|
-
accountId: params.accountId,
|
|
210
|
-
guildId,
|
|
211
|
-
channelId
|
|
212
|
-
};
|
|
213
|
-
if (existingBindings.find((binding) => isDiscordChannelAgentBinding(binding, match))) {
|
|
214
|
-
params.changes.push(`Removed ${path}; a matching top-level bindings[] route already exists for Discord channel ${channelId}.`);
|
|
215
|
-
continue;
|
|
216
|
-
}
|
|
217
|
-
const bindingMatch = {
|
|
218
|
-
channel: "discord",
|
|
219
|
-
guildId,
|
|
220
|
-
peer: {
|
|
221
|
-
kind: "channel",
|
|
222
|
-
id: channelId
|
|
223
|
-
}
|
|
224
|
-
};
|
|
225
|
-
if (params.accountId) bindingMatch.accountId = params.accountId;
|
|
226
|
-
params.bindingsToAdd.push({
|
|
227
|
-
agentId,
|
|
228
|
-
match: bindingMatch
|
|
229
|
-
});
|
|
230
|
-
params.changes.push(`Moved ${path} → top-level bindings[] route for Discord channel ${channelId}.`);
|
|
231
|
-
}
|
|
232
|
-
if (!channelsChanged) continue;
|
|
233
|
-
nextGuilds[guildId] = {
|
|
234
|
-
...guild,
|
|
235
|
-
channels: nextChannels
|
|
236
|
-
};
|
|
237
|
-
changed = true;
|
|
238
|
-
}
|
|
239
|
-
return changed ? {
|
|
240
|
-
entry: {
|
|
241
|
-
...params.entry,
|
|
242
|
-
guilds: nextGuilds
|
|
243
|
-
},
|
|
244
|
-
changed: true
|
|
245
|
-
} : {
|
|
246
|
-
entry: params.entry,
|
|
247
|
-
changed: false
|
|
248
|
-
};
|
|
249
|
-
}
|
|
250
|
-
const legacyConfigRules = [
|
|
251
|
-
{
|
|
252
|
-
path: [
|
|
253
|
-
"channels",
|
|
254
|
-
"discord",
|
|
255
|
-
"voice",
|
|
256
|
-
"tts"
|
|
257
|
-
],
|
|
258
|
-
message: "channels.discord.voice.tts.<provider> keys (openai/elevenlabs/microsoft/edge) are legacy; use channels.discord.voice.tts.providers.<provider>. Run \"openclaw doctor --fix\".",
|
|
259
|
-
match: hasLegacyTtsProviderKeys
|
|
260
|
-
},
|
|
261
|
-
{
|
|
262
|
-
path: [
|
|
263
|
-
"channels",
|
|
264
|
-
"discord",
|
|
265
|
-
"accounts"
|
|
266
|
-
],
|
|
267
|
-
message: "channels.discord.accounts.<id>.voice.tts.<provider> keys (openai/elevenlabs/microsoft/edge) are legacy; use channels.discord.accounts.<id>.voice.tts.providers.<provider>. Run \"openclaw doctor --fix\".",
|
|
268
|
-
match: (value) => (0, runtime_doctor_migrations_exports.hasLegacyAccountStreamingAliases)(value, (accountValue) => {
|
|
269
|
-
const account = (0, runtime_doctor_migrations_exports.asObjectRecord)(accountValue);
|
|
270
|
-
return hasLegacyTtsProviderKeys((0, runtime_doctor_migrations_exports.asObjectRecord)(account?.voice)?.tts);
|
|
271
|
-
})
|
|
272
|
-
},
|
|
273
|
-
{
|
|
274
|
-
path: ["channels", "discord"],
|
|
275
|
-
message: "channels.discord.guilds.<id>.channels.<id>.allow is legacy; use channels.discord.guilds.<id>.channels.<id>.enabled instead. Run \"openclaw doctor --fix\".",
|
|
276
|
-
match: guildChannelAllowMigration.hasLegacy
|
|
277
|
-
},
|
|
278
|
-
{
|
|
279
|
-
path: [
|
|
280
|
-
"channels",
|
|
281
|
-
"discord",
|
|
282
|
-
"accounts"
|
|
283
|
-
],
|
|
284
|
-
message: "channels.discord.accounts.<id>.guilds.<id>.channels.<id>.allow is legacy; use channels.discord.accounts.<id>.guilds.<id>.channels.<id>.enabled instead. Run \"openclaw doctor --fix\".",
|
|
285
|
-
match: (value) => (0, runtime_doctor_migrations_exports.hasLegacyAccountStreamingAliases)(value, guildChannelAllowMigration.hasLegacy)
|
|
286
|
-
},
|
|
287
|
-
{
|
|
288
|
-
path: ["channels", "discord"],
|
|
289
|
-
message: "channels.discord.guilds.<id>.channels.<id>.agentId is legacy; use top-level bindings[] for per-channel Discord agent routing. Run \"openclaw doctor --fix\".",
|
|
290
|
-
match: hasLegacyDiscordGuildChannelAgentId
|
|
291
|
-
},
|
|
292
|
-
{
|
|
293
|
-
path: [
|
|
294
|
-
"channels",
|
|
295
|
-
"discord",
|
|
296
|
-
"accounts"
|
|
297
|
-
],
|
|
298
|
-
message: "channels.discord.accounts.<id>.guilds.<id>.channels.<id>.agentId is legacy; use top-level bindings[] with match.accountId for per-channel Discord agent routing. Run \"openclaw doctor --fix\".",
|
|
299
|
-
match: (value) => (0, runtime_doctor_migrations_exports.hasLegacyAccountStreamingAliases)(value, hasLegacyDiscordGuildChannelAgentId)
|
|
300
|
-
},
|
|
301
|
-
{
|
|
302
|
-
path: ["channels", "discord"],
|
|
303
|
-
message: "channels.discord.voice.realtime.wakeNames entries longer than two words are unsupported; use one- or two-word activation names. Run \"openclaw doctor --fix\".",
|
|
304
|
-
match: hasUnsupportedDiscordRealtimeWakeNames
|
|
305
|
-
},
|
|
306
|
-
{
|
|
307
|
-
path: [
|
|
308
|
-
"channels",
|
|
309
|
-
"discord",
|
|
310
|
-
"accounts"
|
|
311
|
-
],
|
|
312
|
-
message: "channels.discord.accounts.<id>.voice.realtime.wakeNames entries longer than two words are unsupported; use one- or two-word activation names. Run \"openclaw doctor --fix\".",
|
|
313
|
-
match: (value) => (0, runtime_doctor_migrations_exports.hasLegacyAccountStreamingAliases)(value, hasUnsupportedDiscordRealtimeWakeNames)
|
|
314
|
-
},
|
|
315
|
-
...streamingAliasMigration.legacyConfigRules
|
|
316
|
-
];
|
|
317
|
-
function normalizeCompatibilityConfig({ cfg }) {
|
|
318
|
-
const changes = [];
|
|
319
|
-
const bindingsToAdd = [];
|
|
320
|
-
const aliases = streamingAliasMigration.normalizeChannelConfig({
|
|
321
|
-
cfg,
|
|
322
|
-
changes
|
|
323
|
-
});
|
|
324
|
-
const tuningKnobs = (0, runtime_doctor_migrations_exports.stripRetiredChannelKeys)({
|
|
325
|
-
cfg: aliases.config,
|
|
326
|
-
channelId: "discord",
|
|
327
|
-
keys: RETIRED_TUNING_KEYS,
|
|
328
|
-
scope: "root-and-accounts"
|
|
329
|
-
});
|
|
330
|
-
const rawEntry = (0, runtime_doctor_migrations_exports.asObjectRecord)(tuningKnobs.config.channels?.discord);
|
|
331
|
-
if (!rawEntry) return {
|
|
332
|
-
config: cfg,
|
|
333
|
-
changes: []
|
|
334
|
-
};
|
|
335
|
-
let updated = rawEntry;
|
|
336
|
-
let changed = tuningKnobs.config !== cfg;
|
|
337
|
-
if (tuningKnobs.changed) changes.push("Removed retired Discord tuning knobs.");
|
|
338
|
-
const guildAliases = guildChannelAllowMigration.normalize({
|
|
339
|
-
entry: updated,
|
|
340
|
-
pathPrefix: "channels.discord",
|
|
341
|
-
changes
|
|
342
|
-
});
|
|
343
|
-
updated = guildAliases.entry;
|
|
344
|
-
changed = changed || guildAliases.changed;
|
|
345
|
-
const channelAgentIds = normalizeDiscordGuildChannelAgentIds({
|
|
346
|
-
cfg,
|
|
347
|
-
entry: updated,
|
|
348
|
-
pathPrefix: "channels.discord",
|
|
349
|
-
changes,
|
|
350
|
-
bindingsToAdd
|
|
351
|
-
});
|
|
352
|
-
updated = channelAgentIds.entry;
|
|
353
|
-
changed = changed || channelAgentIds.changed;
|
|
354
|
-
const accounts = (0, runtime_doctor_migrations_exports.normalizeChannelAccounts)({
|
|
355
|
-
entry: updated,
|
|
356
|
-
pathPrefix: "channels.discord",
|
|
357
|
-
changes,
|
|
358
|
-
normalizeAccount: ({ account, accountId, pathPrefix, changes: accountChanges }) => {
|
|
359
|
-
const guilds = guildChannelAllowMigration.normalize({
|
|
360
|
-
entry: account,
|
|
361
|
-
pathPrefix,
|
|
362
|
-
changes: accountChanges
|
|
363
|
-
});
|
|
364
|
-
const agentIds = normalizeDiscordGuildChannelAgentIds({
|
|
365
|
-
cfg,
|
|
366
|
-
entry: guilds.entry,
|
|
367
|
-
pathPrefix,
|
|
368
|
-
accountId,
|
|
369
|
-
changes: accountChanges,
|
|
370
|
-
bindingsToAdd
|
|
371
|
-
});
|
|
372
|
-
const wakeNames = normalizeUnsupportedRealtimeWakeNames(agentIds.entry, pathPrefix, accountChanges);
|
|
373
|
-
return {
|
|
374
|
-
entry: wakeNames.entry,
|
|
375
|
-
changed: guilds.changed || agentIds.changed || wakeNames.changed
|
|
376
|
-
};
|
|
377
|
-
}
|
|
378
|
-
});
|
|
379
|
-
updated = accounts.entry;
|
|
380
|
-
changed = changed || accounts.changed;
|
|
381
|
-
const voice = (0, runtime_doctor_migrations_exports.asObjectRecord)(updated.voice);
|
|
382
|
-
if (voice && migrateLegacyTtsConfig((0, runtime_doctor_migrations_exports.asObjectRecord)(voice.tts), "channels.discord.voice.tts", changes)) {
|
|
383
|
-
updated = {
|
|
384
|
-
...updated,
|
|
385
|
-
voice
|
|
386
|
-
};
|
|
387
|
-
changed = true;
|
|
388
|
-
}
|
|
389
|
-
const normalizedWakeNames = normalizeUnsupportedRealtimeWakeNames(updated, "channels.discord", changes);
|
|
390
|
-
updated = normalizedWakeNames.entry;
|
|
391
|
-
changed = changed || normalizedWakeNames.changed;
|
|
392
|
-
if (!changed) return {
|
|
393
|
-
config: cfg,
|
|
394
|
-
changes: []
|
|
395
|
-
};
|
|
396
|
-
return {
|
|
397
|
-
config: {
|
|
398
|
-
...tuningKnobs.config,
|
|
399
|
-
channels: {
|
|
400
|
-
...tuningKnobs.config.channels,
|
|
401
|
-
discord: updated
|
|
402
|
-
},
|
|
403
|
-
bindings: bindingsToAdd.length > 0 ? [...cfg.bindings ?? [], ...bindingsToAdd] : cfg.bindings
|
|
404
|
-
},
|
|
405
|
-
changes
|
|
406
|
-
};
|
|
407
|
-
}
|
|
408
|
-
//#endregion
|
|
409
|
-
export { normalizeCompatibilityConfig as n, legacyConfigRules as t };
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { createHash } from "node:crypto";
|
|
2
|
-
import { normalizeProviderId } from "openclaw/plugin-sdk/model-ref-parse";
|
|
3
|
-
//#region extensions/discord/src/monitor/model-picker-preference-primitives.ts
|
|
4
|
-
function normalizeModelRef(raw) {
|
|
5
|
-
const value = raw?.trim();
|
|
6
|
-
if (!value) return null;
|
|
7
|
-
const slashIndex = value.indexOf("/");
|
|
8
|
-
if (slashIndex <= 0 || slashIndex >= value.length - 1) return null;
|
|
9
|
-
const provider = normalizeProviderId(value.slice(0, slashIndex));
|
|
10
|
-
const model = value.slice(slashIndex + 1).trim();
|
|
11
|
-
return provider && model ? `${provider}/${model}` : null;
|
|
12
|
-
}
|
|
13
|
-
function sanitizeRecentModels(models, limit) {
|
|
14
|
-
const deduped = [];
|
|
15
|
-
const seen = /* @__PURE__ */ new Set();
|
|
16
|
-
if (!Array.isArray(models)) return deduped;
|
|
17
|
-
for (const item of models) {
|
|
18
|
-
const normalized = normalizeModelRef(typeof item === "string" ? item : void 0);
|
|
19
|
-
if (!normalized || seen.has(normalized)) continue;
|
|
20
|
-
seen.add(normalized);
|
|
21
|
-
deduped.push(normalized);
|
|
22
|
-
if (deduped.length >= limit) break;
|
|
23
|
-
}
|
|
24
|
-
return deduped;
|
|
25
|
-
}
|
|
26
|
-
function hashSegment(value, length) {
|
|
27
|
-
return createHash("sha256").update(value, "utf8").digest("hex").slice(0, length);
|
|
28
|
-
}
|
|
29
|
-
function buildPreferenceModelKey(scopeKey, modelRef) {
|
|
30
|
-
return `v1:${hashSegment(scopeKey, 32)}:${hashSegment(modelRef, 24)}`;
|
|
31
|
-
}
|
|
32
|
-
function preferenceTimestampMs(value) {
|
|
33
|
-
const parsed = typeof value === "string" ? Date.parse(value) : NaN;
|
|
34
|
-
return Number.isFinite(parsed) ? parsed : 0;
|
|
35
|
-
}
|
|
36
|
-
//#endregion
|
|
37
|
-
export { sanitizeRecentModels as i, normalizeModelRef as n, preferenceTimestampMs as r, buildPreferenceModelKey as t };
|