@openclaw/discord 2026.5.31-beta.3 → 2026.6.1-beta.1
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/dist/api.js +3 -3
- package/dist/{channel-CEcqsGv4.js → channel-W1HBHzdw.js} +5 -5
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel.setup-DbGXTREm.js → channel.setup-BX7g7pL-.js} +1 -1
- package/dist/contract-api.js +2 -2
- package/dist/{doctor-BUhqxLb9.js → doctor-D3ngpo-Y.js} +2 -2
- package/dist/{doctor-contract-BAu3WLvd.js → doctor-contract-CU7lnZTF.js} +2 -2
- package/dist/doctor-contract-api.js +1 -1
- package/dist/legacy-state-migrations-api.js +39 -6
- package/dist/{manager.runtime-GXQRqG8a.js → manager.runtime-CVB9_dwq.js} +45 -39
- package/dist/{message-handler-CNU-L8ef.js → message-handler-CQGpWQ0f.js} +4 -4
- package/dist/{message-handler.preflight-DaQIDMY6.js → message-handler.preflight-B9aZ9jQD.js} +7 -7
- package/dist/{message-handler.process-B61wYezH.js → message-handler.process-DrLZOgzG.js} +5 -5
- package/dist/{message-utils-C3eyx-ih.js → message-utils-ZTGvA2L8.js} +1 -3
- package/dist/{outbound-adapter-C6Da39L-.js → outbound-adapter-Bt6-9M13.js} +1 -1
- package/dist/{provider-CHlc1TDX.js → provider-BTp6enEl.js} +25 -72
- package/dist/{provider-session.runtime-BO12DuAF.js → provider-session.runtime-CC2f_W1j.js} +3 -3
- package/dist/provider.runtime-DUQJvWin.js +2 -0
- package/dist/runtime-api.js +9 -9
- package/dist/runtime-api.monitor-BkA-vJZA.js +6 -0
- package/dist/runtime-api.monitor.js +4 -4
- package/dist/runtime-api.threads.js +5 -5
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{shared-BMGLQw74.js → shared-D11J9bXI.js} +2 -2
- package/dist/subagent-hooks-api.js +1 -1
- package/dist/{subagent-hooks-65qGV_Ft.js → subagent-hooks-nBcp0iGm.js} +1 -1
- package/dist/{thread-bindings-BesPuVYd.js → thread-bindings-Tfr_vFxk.js} +4 -4
- package/dist/{thread-bindings.discord-api-D8MZQPER.js → thread-bindings.discord-api-CfDs1lWu.js} +1 -1
- package/dist/{thread-bindings.manager-DbgHc5KB.js → thread-bindings.manager-CRc4hYr1.js} +2 -3
- package/dist/{thread-bindings.session-updates-DoDFvU_h.js → thread-bindings.session-updates-DeMxmcXB.js} +1 -1
- package/dist/{thread-bindings.state-DYp4FVEB.js → thread-bindings.state-CVLF7gJH.js} +48 -22
- package/npm-shrinkwrap.json +3 -3
- package/package.json +4 -4
- package/dist/provider.runtime-BTiF5ENi.js +0 -2
- package/dist/runtime-api.monitor-BfCA2SYy.js +0 -6
package/dist/api.js
CHANGED
|
@@ -6,10 +6,10 @@ import { n as fetchDiscord, r as requestDiscord, t as DiscordApiError } from "./
|
|
|
6
6
|
import { i as parseDiscordSendTarget, n as resolveDiscordTarget } from "./target-resolver-BKGK0ftO.js";
|
|
7
7
|
import "./targets-Cv797U29.js";
|
|
8
8
|
import { a as getDiscordExecApprovalApprovers, c as shouldSuppressLocalDiscordExecApprovalPrompt, o as isDiscordExecApprovalApprover, s as isDiscordExecApprovalClientEnabled } from "./conversation-identity-CEP1KbK0.js";
|
|
9
|
-
import { i as resolveDiscordGroupToolPolicy, n as collectDiscordStatusIssues, r as resolveDiscordGroupRequireMention, t as discordPlugin } from "./channel-
|
|
9
|
+
import { i as resolveDiscordGroupToolPolicy, n as collectDiscordStatusIssues, r as resolveDiscordGroupRequireMention, t as discordPlugin } from "./channel-W1HBHzdw.js";
|
|
10
10
|
import { t as normalizeExplicitDiscordSessionKey } from "./session-key-normalization-wJgsKPNF.js";
|
|
11
|
-
import { t as discordSetupPlugin } from "./channel.setup-
|
|
12
|
-
import { n as handleDiscordSubagentEnded, r as handleDiscordSubagentSpawning, t as handleDiscordSubagentDeliveryTarget } from "./subagent-hooks-
|
|
11
|
+
import { t as discordSetupPlugin } from "./channel.setup-BX7g7pL-.js";
|
|
12
|
+
import { n as handleDiscordSubagentEnded, r as handleDiscordSubagentSpawning, t as handleDiscordSubagentDeliveryTarget } from "./subagent-hooks-nBcp0iGm.js";
|
|
13
13
|
import { t as tryHandleDiscordMessageActionGuildAdmin } from "./handle-action.guild-admin-CqUsOA2L.js";
|
|
14
14
|
import { n as listDiscordDirectoryGroupsFromConfig, r as listDiscordDirectoryPeersFromConfig } from "./directory-config-j1bfTue_.js";
|
|
15
15
|
import { t as fetchPluralKitMessageInfo } from "./pluralkit-BEEldePl.js";
|
|
@@ -6,9 +6,9 @@ import { t as getDiscordRuntime } from "./runtime-DgnVQ7zW.js";
|
|
|
6
6
|
import { c as shouldSuppressLocalDiscordExecApprovalPrompt, n as resolveDiscordCurrentConversationIdentity, r as getDiscordApprovalCapability } from "./conversation-identity-CEP1KbK0.js";
|
|
7
7
|
import { r as resolveRequiredDiscordChannelPermissions } from "./audit-core-xwjIczO0.js";
|
|
8
8
|
import { t as discordMessageActions$1 } from "./channel-actions-BaPDAWN_.js";
|
|
9
|
-
import { n as setThreadBindingMaxAgeBySessionKey, t as setThreadBindingIdleTimeoutBySessionKey } from "./thread-bindings.session-updates-
|
|
10
|
-
import { n as discordOutbound } from "./outbound-adapter-
|
|
11
|
-
import { a as discordSecurityAdapter, i as discordSetupAdapter, n as discordConfigAdapter, t as createDiscordPluginBase } from "./shared-
|
|
9
|
+
import { n as setThreadBindingMaxAgeBySessionKey, t as setThreadBindingIdleTimeoutBySessionKey } from "./thread-bindings.session-updates-DeMxmcXB.js";
|
|
10
|
+
import { n as discordOutbound } from "./outbound-adapter-Bt6-9M13.js";
|
|
11
|
+
import { a as discordSecurityAdapter, i as discordSetupAdapter, n as discordConfigAdapter, t as createDiscordPluginBase } from "./shared-D11J9bXI.js";
|
|
12
12
|
import { t as normalizeExplicitDiscordSessionKey } from "./session-key-normalization-wJgsKPNF.js";
|
|
13
13
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeOptionalStringifiedId } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
14
14
|
import { createChatChannelPlugin } from "openclaw/plugin-sdk/channel-core";
|
|
@@ -128,10 +128,10 @@ let discordDirectoryLiveModulePromise;
|
|
|
128
128
|
const loadDiscordDirectoryConfigModule = createLazyRuntimeModule(() => import("./directory-config-j1bfTue_.js").then((n) => n.t));
|
|
129
129
|
const loadDiscordResolveChannelsModule = createLazyRuntimeModule(() => import("./resolve-channels-DLNfxFQP.js").then((n) => n.n));
|
|
130
130
|
const loadDiscordResolveUsersModule = createLazyRuntimeModule(() => import("./resolve-users-QTyD8qgI.js").then((n) => n.n));
|
|
131
|
-
const loadDiscordThreadBindingsManagerModule = createLazyRuntimeModule(() => import("./thread-bindings.manager-
|
|
131
|
+
const loadDiscordThreadBindingsManagerModule = createLazyRuntimeModule(() => import("./thread-bindings.manager-CRc4hYr1.js").then((n) => n.a));
|
|
132
132
|
const loadDiscordTargetResolverModule = createLazyRuntimeModule(() => import("./target-resolver-BKGK0ftO.js").then((n) => n.r));
|
|
133
133
|
async function loadDiscordProviderRuntime() {
|
|
134
|
-
discordProviderRuntimePromise ??= import("./provider.runtime-
|
|
134
|
+
discordProviderRuntimePromise ??= import("./provider.runtime-DUQJvWin.js");
|
|
135
135
|
return await discordProviderRuntimePromise;
|
|
136
136
|
}
|
|
137
137
|
async function loadDiscordProbeRuntime() {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as discordPlugin } from "./channel-
|
|
1
|
+
import { t as discordPlugin } from "./channel-W1HBHzdw.js";
|
|
2
2
|
export { discordPlugin };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as inspectDiscordConfiguredToken } from "./account-inspect-DDZtT5C8.js";
|
|
2
2
|
import { a as mergeDiscordAccountConfig, c as resolveDiscordAccountAllowFrom, l as resolveDiscordAccountConfig, m as resolveDiscordToken, o as resolveDefaultDiscordAccountId } from "./accounts-P19jm1lf.js";
|
|
3
|
-
import { i as discordSetupAdapter, t as createDiscordPluginBase } from "./shared-
|
|
3
|
+
import { i as discordSetupAdapter, t as createDiscordPluginBase } from "./shared-D11J9bXI.js";
|
|
4
4
|
import { t as resolveDiscordChannelAllowlist } from "./resolve-channels-DLNfxFQP.js";
|
|
5
5
|
import { t as resolveDiscordUserAllowlist } from "./resolve-users-QTyD8qgI.js";
|
|
6
6
|
import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
package/dist/contract-api.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { n as normalizeCompatibilityConfig, t as legacyConfigRules } from "./doctor-contract-
|
|
1
|
+
import { n as normalizeCompatibilityConfig, t as legacyConfigRules } from "./doctor-contract-CU7lnZTF.js";
|
|
2
2
|
import { n as secretTargetRegistryEntries, t as collectRuntimeConfigAssignments } from "./secret-config-contract-BjM-1hr9.js";
|
|
3
3
|
import { n as unsupportedSecretRefSurfacePatterns, t as collectUnsupportedSecretRefConfigCandidates } from "./security-contract-DSHk7I2w.js";
|
|
4
4
|
import { t as deriveLegacySessionChatType } from "./session-contract-BO5tlIdl.js";
|
|
5
|
-
import { i as testing, n as createThreadBindingManager } from "./thread-bindings.manager-
|
|
5
|
+
import { i as testing, n as createThreadBindingManager } from "./thread-bindings.manager-CRc4hYr1.js";
|
|
6
6
|
import { n as listDiscordDirectoryGroupsFromConfig, r as listDiscordDirectoryPeersFromConfig } from "./directory-config-j1bfTue_.js";
|
|
7
7
|
import { t as collectDiscordSecurityAuditFindings } from "./security-audit-Bh_65L5C.js";
|
|
8
8
|
export { collectDiscordSecurityAuditFindings, collectRuntimeConfigAssignments, collectUnsupportedSecretRefConfigCandidates, createThreadBindingManager, deriveLegacySessionChatType, testing as discordThreadBindingTesting, legacyConfigRules, listDiscordDirectoryGroupsFromConfig, listDiscordDirectoryPeersFromConfig, normalizeCompatibilityConfig, secretTargetRegistryEntries, unsupportedSecretRefSurfacePatterns };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as inspectDiscordAccount } from "./account-inspect-DDZtT5C8.js";
|
|
2
2
|
import { o as resolveDefaultDiscordAccountId } from "./accounts-P19jm1lf.js";
|
|
3
|
-
import { r as DISCORD_LEGACY_CONFIG_RULES } from "./shared-
|
|
4
|
-
import { n as normalizeCompatibilityConfig } from "./doctor-contract-
|
|
3
|
+
import { r as DISCORD_LEGACY_CONFIG_RULES } from "./shared-D11J9bXI.js";
|
|
4
|
+
import { n as normalizeCompatibilityConfig } from "./doctor-contract-CU7lnZTF.js";
|
|
5
5
|
import { t as isDiscordMutableAllowEntry } from "./security-doctor-uUo8hTD5.js";
|
|
6
6
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
7
7
|
import { collectProviderDangerousNameMatchingScopes } from "openclaw/plugin-sdk/runtime-doctor";
|
|
@@ -358,8 +358,8 @@ function normalizeCompatibilityConfig({ cfg }) {
|
|
|
358
358
|
changes: []
|
|
359
359
|
};
|
|
360
360
|
const changes = [];
|
|
361
|
-
let updated
|
|
362
|
-
let changed
|
|
361
|
+
let updated;
|
|
362
|
+
let changed;
|
|
363
363
|
const bindingsToAdd = [];
|
|
364
364
|
const aliases = normalizeLegacyChannelAliases({
|
|
365
365
|
entry: rawEntry,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as normalizeCompatibilityConfig, t as legacyConfigRules } from "./doctor-contract-
|
|
1
|
+
import { n as normalizeCompatibilityConfig, t as legacyConfigRules } from "./doctor-contract-CU7lnZTF.js";
|
|
2
2
|
export { legacyConfigRules, normalizeCompatibilityConfig };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { a as THREAD_BINDINGS_MAX_ENTRIES, f as normalizePersistedBinding, j as toBindingRecordKey, o as THREAD_BINDINGS_NAMESPACE } from "./thread-bindings.state-CVLF7gJH.js";
|
|
1
2
|
import { MAX_DATE_TIMESTAMP_MS, timestampMsToIsoString } from "openclaw/plugin-sdk/number-runtime";
|
|
2
3
|
import { createHash } from "node:crypto";
|
|
3
4
|
import path from "node:path";
|
|
@@ -22,6 +23,11 @@ function readLegacyStore(filePath) {
|
|
|
22
23
|
return null;
|
|
23
24
|
}
|
|
24
25
|
}
|
|
26
|
+
function readLegacyThreadBindingsStore(filePath) {
|
|
27
|
+
const parsed = JSON.parse(fs.readFileSync(filePath, "utf8"));
|
|
28
|
+
if (!parsed || typeof parsed !== "object") throw new Error("legacy Discord thread bindings store must be an object");
|
|
29
|
+
return parsed;
|
|
30
|
+
}
|
|
25
31
|
function normalizeLegacyPreferenceKey(key) {
|
|
26
32
|
const trimmed = key.trim();
|
|
27
33
|
if (!trimmed || textEncoder.encode(trimmed).length > MAX_PLUGIN_STATE_KEY_BYTES) return;
|
|
@@ -64,12 +70,12 @@ function legacyUpdatedAtForIndex(updatedAt, index, total) {
|
|
|
64
70
|
return timestampMsToIsoString(Math.min(baseMs + Math.max(0, total), MAX_DATE_TIMESTAMP_MS) - Math.max(0, index)) ?? timestampMsToIsoString(baseMs) ?? timestampMsToIsoString(Math.max(0, total - index)) ?? "1970-01-01T00:00:00.000Z";
|
|
65
71
|
}
|
|
66
72
|
const detectDiscordLegacyStateMigrations = ({ stateDir }) => {
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
|
|
73
|
+
const plans = [];
|
|
74
|
+
const modelPickerSourcePath = path.join(stateDir, "discord", "model-picker-preferences.json");
|
|
75
|
+
if (fileExists(modelPickerSourcePath)) plans.push({
|
|
70
76
|
kind: "plugin-state-import",
|
|
71
77
|
label: "Discord model picker preferences",
|
|
72
|
-
sourcePath,
|
|
78
|
+
sourcePath: modelPickerSourcePath,
|
|
73
79
|
targetPath: "plugin state:model-picker-preferences",
|
|
74
80
|
pluginId: "discord",
|
|
75
81
|
namespace: "model-picker-preferences",
|
|
@@ -77,7 +83,7 @@ const detectDiscordLegacyStateMigrations = ({ stateDir }) => {
|
|
|
77
83
|
scopeKey: "",
|
|
78
84
|
cleanupSource: "rename",
|
|
79
85
|
readEntries: () => {
|
|
80
|
-
const store = readLegacyStore(
|
|
86
|
+
const store = readLegacyStore(modelPickerSourcePath);
|
|
81
87
|
if (!store || !store.entries || typeof store.entries !== "object") return [];
|
|
82
88
|
const out = [];
|
|
83
89
|
for (const [rawKey, rawEntry] of Object.entries(store.entries)) {
|
|
@@ -95,7 +101,34 @@ const detectDiscordLegacyStateMigrations = ({ stateDir }) => {
|
|
|
95
101
|
}
|
|
96
102
|
return out;
|
|
97
103
|
}
|
|
98
|
-
}
|
|
104
|
+
});
|
|
105
|
+
const threadBindingsSourcePath = path.join(stateDir, "discord", "thread-bindings.json");
|
|
106
|
+
if (fileExists(threadBindingsSourcePath)) plans.push({
|
|
107
|
+
kind: "plugin-state-import",
|
|
108
|
+
label: "Discord thread bindings",
|
|
109
|
+
sourcePath: threadBindingsSourcePath,
|
|
110
|
+
targetPath: `plugin state:${THREAD_BINDINGS_NAMESPACE}`,
|
|
111
|
+
pluginId: "discord",
|
|
112
|
+
namespace: THREAD_BINDINGS_NAMESPACE,
|
|
113
|
+
maxEntries: THREAD_BINDINGS_MAX_ENTRIES,
|
|
114
|
+
scopeKey: "",
|
|
115
|
+
cleanupSource: "rename",
|
|
116
|
+
cleanupWhenEmpty: true,
|
|
117
|
+
readEntries: () => {
|
|
118
|
+
const store = readLegacyThreadBindingsStore(threadBindingsSourcePath);
|
|
119
|
+
if (store?.version !== 1 || !store.bindings || typeof store.bindings !== "object") throw new Error("legacy Discord thread bindings store must have version 1 bindings");
|
|
120
|
+
const out = [];
|
|
121
|
+
for (const [rawKey, rawEntry] of Object.entries(store.bindings)) {
|
|
122
|
+
const normalized = normalizePersistedBinding(rawKey, rawEntry);
|
|
123
|
+
if (normalized) out.push({
|
|
124
|
+
key: toBindingRecordKey(normalized),
|
|
125
|
+
value: normalized
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
return out;
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
return plans;
|
|
99
132
|
};
|
|
100
133
|
//#endregion
|
|
101
134
|
export { detectDiscordLegacyStateMigrations };
|
|
@@ -3,7 +3,7 @@ import { c as resolveDiscordAccountAllowFrom } from "./accounts-P19jm1lf.js";
|
|
|
3
3
|
import { a as normalizeDiscordSlug, b as formatDiscordUserTag, m as resolveDiscordOwnerAccess } from "./allow-list-C-MqM-B_.js";
|
|
4
4
|
import { o as formatMention } from "./send.outbound-DhMLobqR.js";
|
|
5
5
|
import { t as getDiscordRuntime } from "./runtime-DgnVQ7zW.js";
|
|
6
|
-
import { f as buildDiscordGroupSystemPrompt, o as authorizeDiscordVoiceIngress, u as resolveDiscordVoiceEnabled } from "./provider-
|
|
6
|
+
import { f as buildDiscordGroupSystemPrompt, o as authorizeDiscordVoiceIngress, u as resolveDiscordVoiceEnabled } from "./provider-BTp6enEl.js";
|
|
7
7
|
import { createRequire } from "node:module";
|
|
8
8
|
import { asBoolean, normalizeOptionalString, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
9
9
|
import { resolveAgentRoute } from "openclaw/plugin-sdk/routing";
|
|
@@ -158,34 +158,38 @@ var DiscordOpusEncodeStream = class extends Transform {
|
|
|
158
158
|
if (!this.#encoder) this.#encoder = await this.#encoderPromise;
|
|
159
159
|
return this.#encoder;
|
|
160
160
|
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
161
|
+
_transform(chunk, _encoding, done) {
|
|
162
|
+
(async () => {
|
|
163
|
+
try {
|
|
164
|
+
const encoder = await this.#getEncoder();
|
|
165
|
+
this.#buffer = this.#buffer.length > 0 ? Buffer.concat([this.#buffer, chunk]) : Buffer.from(chunk);
|
|
166
|
+
while (this.#buffer.length >= DISCORD_OPUS_FRAME_BYTES) {
|
|
167
|
+
const frame = this.#buffer.subarray(0, DISCORD_OPUS_FRAME_BYTES);
|
|
168
|
+
this.#buffer = this.#buffer.subarray(DISCORD_OPUS_FRAME_BYTES);
|
|
169
|
+
this.push(Buffer.from(encoder.encode(frame, { frameSize: DISCORD_OPUS_FRAME_SIZE })));
|
|
170
|
+
}
|
|
171
|
+
done();
|
|
172
|
+
} catch (err) {
|
|
173
|
+
done(err instanceof Error ? err : new Error(formatErrorMessage(err)));
|
|
169
174
|
}
|
|
170
|
-
|
|
171
|
-
} catch (err) {
|
|
172
|
-
done(err instanceof Error ? err : new Error(formatErrorMessage(err)));
|
|
173
|
-
}
|
|
175
|
+
})();
|
|
174
176
|
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
177
|
+
_final(done) {
|
|
178
|
+
(async () => {
|
|
179
|
+
try {
|
|
180
|
+
if (this.#buffer.length > 0) {
|
|
181
|
+
const encoder = await this.#getEncoder();
|
|
182
|
+
const frame = Buffer.alloc(DISCORD_OPUS_FRAME_BYTES);
|
|
183
|
+
this.#buffer.copy(frame);
|
|
184
|
+
this.#buffer = Buffer.alloc(0);
|
|
185
|
+
this.push(Buffer.from(encoder.encode(frame, { frameSize: DISCORD_OPUS_FRAME_SIZE })));
|
|
186
|
+
}
|
|
187
|
+
this.#freeEncoder();
|
|
188
|
+
done();
|
|
189
|
+
} catch (err) {
|
|
190
|
+
done(err instanceof Error ? err : new Error(formatErrorMessage(err)));
|
|
183
191
|
}
|
|
184
|
-
|
|
185
|
-
done();
|
|
186
|
-
} catch (err) {
|
|
187
|
-
done(err instanceof Error ? err : new Error(formatErrorMessage(err)));
|
|
188
|
-
}
|
|
192
|
+
})();
|
|
189
193
|
}
|
|
190
194
|
_destroy(err, done) {
|
|
191
195
|
this.#freeEncoder();
|
|
@@ -2485,19 +2489,21 @@ var DiscordVoiceManager$1 = class {
|
|
|
2485
2489
|
const speakingEndHandler = (userId) => {
|
|
2486
2490
|
this.scheduleCaptureFinalize(entry, userId, "speaker end");
|
|
2487
2491
|
};
|
|
2488
|
-
const disconnectedHandler =
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2492
|
+
const disconnectedHandler = () => {
|
|
2493
|
+
(async () => {
|
|
2494
|
+
try {
|
|
2495
|
+
logVoiceVerbose(`disconnected: attempting recovery guild ${guildId} channel ${channelId} grace=${reconnectGraceMs}ms`);
|
|
2496
|
+
await Promise.race([voiceSdk.entersState(connection, voiceSdk.VoiceConnectionStatus.Signalling, reconnectGraceMs), voiceSdk.entersState(connection, voiceSdk.VoiceConnectionStatus.Connecting, reconnectGraceMs)]);
|
|
2497
|
+
logVoiceVerbose(`disconnected: recovery started guild ${guildId} channel ${channelId}`);
|
|
2498
|
+
} catch (err) {
|
|
2499
|
+
logger.warn(`discord voice: disconnect recovery failed: guild ${guildId} channel ${channelId} timeout=${reconnectGraceMs}ms error=${formatErrorMessage(err)}; destroying connection`);
|
|
2500
|
+
clearSessionIfCurrent();
|
|
2501
|
+
stopEntry(entry, {
|
|
2502
|
+
destroyConnection: true,
|
|
2503
|
+
reason: `disconnect recovery failed guild ${guildId} channel ${channelId}`
|
|
2504
|
+
});
|
|
2505
|
+
}
|
|
2506
|
+
})();
|
|
2501
2507
|
};
|
|
2502
2508
|
const destroyedHandler = () => {
|
|
2503
2509
|
clearSessionIfCurrent();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { I as createDiscordRestClient } from "./send.shared-B3QxPnR3.js";
|
|
2
|
-
import { d as resolveDiscordChannelNameSafe, l as resolveDiscordChannelIdSafe, p as resolveDiscordChannelParentSafe, u as resolveDiscordChannelInfoSafe } from "./thread-bindings.discord-api-
|
|
2
|
+
import { d as resolveDiscordChannelNameSafe, l as resolveDiscordChannelIdSafe, p as resolveDiscordChannelParentSafe, u as resolveDiscordChannelInfoSafe } from "./thread-bindings.discord-api-CfDs1lWu.js";
|
|
3
3
|
import { a as mergeAbortSignals } from "./timeouts-CEJ3--Uw.js";
|
|
4
|
-
import { c as hasDiscordMessageStickers, d as resolveDiscordMessageChannelId, r as resolveDiscordMessageText } from "./message-utils-
|
|
4
|
+
import { c as hasDiscordMessageStickers, d as resolveDiscordMessageChannelId, r as resolveDiscordMessageText } from "./message-utils-ZTGvA2L8.js";
|
|
5
5
|
import { t as sendTyping } from "./typing-C7RXECnL.js";
|
|
6
6
|
import { danger, logVerbose } from "openclaw/plugin-sdk/runtime-env";
|
|
7
7
|
import { createChannelRunQueue, createTypingCallbacks, resolveChannelMessageSourceReplyDeliveryMode } from "openclaw/plugin-sdk/channel-outbound";
|
|
@@ -178,7 +178,7 @@ function resolveDiscordAcceptedTypingPrestart(ctx) {
|
|
|
178
178
|
//#region extensions/discord/src/monitor/message-run-queue.ts
|
|
179
179
|
let messageProcessRuntimePromise;
|
|
180
180
|
async function loadMessageProcessRuntime() {
|
|
181
|
-
messageProcessRuntimePromise ??= import("./message-handler.process-
|
|
181
|
+
messageProcessRuntimePromise ??= import("./message-handler.process-DrLZOgzG.js");
|
|
182
182
|
return await messageProcessRuntimePromise;
|
|
183
183
|
}
|
|
184
184
|
async function processDiscordQueuedMessage(params) {
|
|
@@ -307,7 +307,7 @@ function createDiscordReplyTypingFeedback(params) {
|
|
|
307
307
|
//#region extensions/discord/src/monitor/message-handler.ts
|
|
308
308
|
let messagePreflightRuntimePromise;
|
|
309
309
|
async function loadMessagePreflightRuntime() {
|
|
310
|
-
messagePreflightRuntimePromise ??= import("./message-handler.preflight-
|
|
310
|
+
messagePreflightRuntimePromise ??= import("./message-handler.preflight-B9aZ9jQD.js");
|
|
311
311
|
return await messagePreflightRuntimePromise;
|
|
312
312
|
}
|
|
313
313
|
function isNonEmptyString(value) {
|
package/dist/{message-handler.preflight-DaQIDMY6.js → message-handler.preflight-B9aZ9jQD.js}
RENAMED
|
@@ -2,11 +2,11 @@ import { c as discord_exports, k as Message, mt as getChannelMessage } from "./s
|
|
|
2
2
|
import { o as resolveDefaultDiscordAccountId } from "./accounts-P19jm1lf.js";
|
|
3
3
|
import { S as resolveTimestampMs, _ as resolveGroupDmAllow, a as normalizeDiscordSlug, b as formatDiscordUserTag, c as resolveDiscordChannelConfigWithFallback, d as resolveDiscordGuildEntry, f as resolveDiscordMemberAccessState, g as resolveDiscordShouldRequireMention, i as normalizeDiscordDisplaySlug, n as isDiscordGroupAllowedByPolicy, x as resolveDiscordSystemLocation } from "./allow-list-C-MqM-B_.js";
|
|
4
4
|
import { t as resolveDiscordConversationIdentity } from "./conversation-identity-CEP1KbK0.js";
|
|
5
|
-
import {
|
|
6
|
-
import { d as resolveDiscordChannelNameSafe, u as resolveDiscordChannelInfoSafe } from "./thread-bindings.discord-api-
|
|
7
|
-
import "./thread-bindings-
|
|
8
|
-
import { D as resolveDiscordTextCommandAccess, E as resolveDiscordDmCommandAccess, _ as resolveDiscordEffectiveRoute, g as resolveDiscordConversationRoute, h as buildDiscordRoutePeer, v as shouldIgnoreStaleDiscordRouteBinding, y as handleDiscordDmCommandDecision } from "./provider-
|
|
9
|
-
import { d as resolveDiscordMessageChannelId, l as resolveDiscordMessageStickers, o as resolveMediaList, r as resolveDiscordMessageText, u as resolveDiscordChannelInfo } from "./message-utils-
|
|
5
|
+
import { d as isRecentlyUnboundThreadWebhookMessage } from "./thread-bindings.state-CVLF7gJH.js";
|
|
6
|
+
import { d as resolveDiscordChannelNameSafe, u as resolveDiscordChannelInfoSafe } from "./thread-bindings.discord-api-CfDs1lWu.js";
|
|
7
|
+
import "./thread-bindings-Tfr_vFxk.js";
|
|
8
|
+
import { D as resolveDiscordTextCommandAccess, E as resolveDiscordDmCommandAccess, _ as resolveDiscordEffectiveRoute, g as resolveDiscordConversationRoute, h as buildDiscordRoutePeer, v as shouldIgnoreStaleDiscordRouteBinding, y as handleDiscordDmCommandDecision } from "./provider-BTp6enEl.js";
|
|
9
|
+
import { d as resolveDiscordMessageChannelId, l as resolveDiscordMessageStickers, o as resolveMediaList, r as resolveDiscordMessageText, u as resolveDiscordChannelInfo } from "./message-utils-ZTGvA2L8.js";
|
|
10
10
|
import { n as resolveDiscordWebhookId, t as resolveDiscordSenderIdentity } from "./sender-identity-CEsfDF0L.js";
|
|
11
11
|
import { normalizeOptionalString, readStringValue } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
12
12
|
import { getChildLogger, logVerbose, shouldLogVerbose } from "openclaw/plugin-sdk/runtime-env";
|
|
@@ -189,7 +189,7 @@ function copyRuntimeMessageFields(source, target) {
|
|
|
189
189
|
if (channelDescriptor) Object.defineProperty(target, "channel", channelDescriptor);
|
|
190
190
|
}
|
|
191
191
|
function shouldHydrateDiscordMessage(params) {
|
|
192
|
-
let currentText
|
|
192
|
+
let currentText;
|
|
193
193
|
try {
|
|
194
194
|
currentText = resolveDiscordMessageText(params.message, { includeForwarded: true });
|
|
195
195
|
} catch {
|
|
@@ -438,7 +438,7 @@ async function loadSystemEventsRuntime() {
|
|
|
438
438
|
return await systemEventsRuntimePromise;
|
|
439
439
|
}
|
|
440
440
|
async function loadDiscordThreadingRuntime() {
|
|
441
|
-
discordThreadingRuntimePromise ??= import("./provider-
|
|
441
|
+
discordThreadingRuntimePromise ??= import("./provider-BTp6enEl.js").then((n) => n.x);
|
|
442
442
|
return await discordThreadingRuntimePromise;
|
|
443
443
|
}
|
|
444
444
|
function isPreflightAborted(abortSignal) {
|
|
@@ -7,12 +7,12 @@ import { a as discordTextHasTargetedMention, i as discordTextHasBroadcastMention
|
|
|
7
7
|
import "./targets-Cv797U29.js";
|
|
8
8
|
import { t as resolveDiscordConversationIdentity } from "./conversation-identity-CEP1KbK0.js";
|
|
9
9
|
import { t as beginDiscordInboundEventDeliveryCorrelation } from "./inbound-event-delivery-CEPlt2uz.js";
|
|
10
|
-
import { t as DISCORD_TEXT_CHUNK_LIMIT } from "./outbound-adapter-
|
|
10
|
+
import { t as DISCORD_TEXT_CHUNK_LIMIT } from "./outbound-adapter-Bt6-9M13.js";
|
|
11
11
|
import { t as resolveDiscordPreviewStreamMode } from "./preview-streaming-DXT8oJdo.js";
|
|
12
12
|
import { n as DISCORD_ATTACHMENT_TOTAL_TIMEOUT_MS, t as DISCORD_ATTACHMENT_IDLE_TIMEOUT_MS } from "./timeouts-CEJ3--Uw.js";
|
|
13
|
-
import { S as resolveDiscordAutoThreadReplyPlan, a as resolveReplyContext, i as buildGuildLabel, m as createDiscordSupplementalContextAccessChecker, n as deliverDiscordReply, p as buildDiscordInboundAccessContext, r as buildDirectLabel, w as resolveDiscordThreadStarter } from "./provider-
|
|
14
|
-
import { a as resolveForwardedMediaList, o as resolveMediaList, r as resolveDiscordMessageText, s as resolveReferencedReplyMediaList } from "./message-utils-
|
|
15
|
-
import { n as createDiscordReplyTypingFeedback } from "./message-handler-
|
|
13
|
+
import { S as resolveDiscordAutoThreadReplyPlan, a as resolveReplyContext, i as buildGuildLabel, m as createDiscordSupplementalContextAccessChecker, n as deliverDiscordReply, p as buildDiscordInboundAccessContext, r as buildDirectLabel, w as resolveDiscordThreadStarter } from "./provider-BTp6enEl.js";
|
|
14
|
+
import { a as resolveForwardedMediaList, o as resolveMediaList, r as resolveDiscordMessageText, s as resolveReferencedReplyMediaList } from "./message-utils-ZTGvA2L8.js";
|
|
15
|
+
import { n as createDiscordReplyTypingFeedback } from "./message-handler-CQGpWQ0f.js";
|
|
16
16
|
import { buildAgentSessionKey, normalizeAccountId, resolveAccountEntry, resolveThreadSessionKeys } from "openclaw/plugin-sdk/routing";
|
|
17
17
|
import { MessageFlags } from "discord-api-types/v10";
|
|
18
18
|
import path from "node:path";
|
|
@@ -685,7 +685,7 @@ function createDiscordDraftPreviewController(params) {
|
|
|
685
685
|
}
|
|
686
686
|
if (previewToolProgressEnabled && !previewToolProgressSuppressed && normalized) previewToolProgressLines = mergeChannelProgressDraftLine(previewToolProgressLines, progressLine, { maxLines: resolveChannelProgressDraftMaxLines(params.discordConfig) });
|
|
687
687
|
const alreadyStarted = progressDraftGate.hasStarted;
|
|
688
|
-
let progressActive
|
|
688
|
+
let progressActive;
|
|
689
689
|
if (shouldStartDiscordProgressDraftNow(line)) {
|
|
690
690
|
await progressDraftGate.startNow();
|
|
691
691
|
progressActive = progressDraftGate.hasStarted;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { u as resolveDiscordChannelInfoSafe } from "./thread-bindings.discord-api-
|
|
1
|
+
import { u as resolveDiscordChannelInfoSafe } from "./thread-bindings.discord-api-CfDs1lWu.js";
|
|
2
2
|
import { a as mergeAbortSignals } from "./timeouts-CEJ3--Uw.js";
|
|
3
3
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeOptionalStringifiedId, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
4
|
import { ComponentType, StickerFormatType } from "discord-api-types/v10";
|
|
@@ -354,8 +354,6 @@ function resolveStickerAssetCandidates(sticker) {
|
|
|
354
354
|
url: `${DISCORD_STICKER_ASSET_BASE_URL}/${sticker.id}.json`,
|
|
355
355
|
fileName: `${baseName}.json`
|
|
356
356
|
}];
|
|
357
|
-
case StickerFormatType.APNG:
|
|
358
|
-
case StickerFormatType.PNG:
|
|
359
357
|
default: return [{
|
|
360
358
|
url: `${DISCORD_STICKER_ASSET_BASE_URL}/${sticker.id}.png`,
|
|
361
359
|
fileName: `${baseName}.png`
|
|
@@ -280,7 +280,7 @@ function stripDiscordInternalRuntimeScaffolding(text) {
|
|
|
280
280
|
}
|
|
281
281
|
let discordThreadBindingsPromise;
|
|
282
282
|
function loadDiscordThreadBindings() {
|
|
283
|
-
discordThreadBindingsPromise ??= import("./thread-bindings-
|
|
283
|
+
discordThreadBindingsPromise ??= import("./thread-bindings-Tfr_vFxk.js").then((n) => n.t);
|
|
284
284
|
return discordThreadBindingsPromise;
|
|
285
285
|
}
|
|
286
286
|
function resolveDiscordWebhookIdentity(params) {
|
|
@@ -12,10 +12,10 @@ import { t as getDiscordRuntime } from "./runtime-DgnVQ7zW.js";
|
|
|
12
12
|
import { a as getDiscordExecApprovalApprovers, s as isDiscordExecApprovalClientEnabled, t as resolveDiscordConversationIdentity } from "./conversation-identity-CEP1KbK0.js";
|
|
13
13
|
import { t as resolveDiscordChannelAllowlist } from "./resolve-channels-DLNfxFQP.js";
|
|
14
14
|
import { t as resolveDiscordUserAllowlist } from "./resolve-users-QTyD8qgI.js";
|
|
15
|
-
import { _ as formatThreadBindingDurationLabel, a as isThreadArchived, d as resolveDiscordChannelNameSafe, f as resolveDiscordChannelParentIdSafe, l as resolveDiscordChannelIdSafe, m as resolveDiscordChannelTopicSafe, p as resolveDiscordChannelParentSafe, u as resolveDiscordChannelInfoSafe } from "./thread-bindings.discord-api-
|
|
15
|
+
import { _ as formatThreadBindingDurationLabel, a as isThreadArchived, d as resolveDiscordChannelNameSafe, f as resolveDiscordChannelParentIdSafe, l as resolveDiscordChannelIdSafe, m as resolveDiscordChannelTopicSafe, p as resolveDiscordChannelParentSafe, u as resolveDiscordChannelInfoSafe } from "./thread-bindings.discord-api-CfDs1lWu.js";
|
|
16
16
|
import { r as parseApplicationIdFromToken, t as fetchDiscordApplicationId } from "./probe-2MdGjUAf.js";
|
|
17
17
|
import { o as raceWithTimeout, s as withAbortTimeout } from "./timeouts-CEJ3--Uw.js";
|
|
18
|
-
import { d as resolveDiscordMessageChannelId, n as resolveDiscordForwardedMessagesTextFromSnapshots, t as resolveDiscordEmbedText, u as resolveDiscordChannelInfo } from "./message-utils-
|
|
18
|
+
import { d as resolveDiscordMessageChannelId, n as resolveDiscordForwardedMessagesTextFromSnapshots, t as resolveDiscordEmbedText, u as resolveDiscordChannelInfo } from "./message-utils-ZTGvA2L8.js";
|
|
19
19
|
import { t as resolveDiscordSenderIdentity } from "./sender-identity-CEsfDF0L.js";
|
|
20
20
|
import "./approval-handler.runtime-DQiJ1Z0k.js";
|
|
21
21
|
import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
@@ -23,7 +23,7 @@ import { normalizeLowercaseStringOrEmpty, normalizeOptionalLowercaseString, norm
|
|
|
23
23
|
import { buildAgentSessionKey, deriveLastRoutePolicy, isAcpSessionKey, isSubagentSessionKey, parseAgentSessionKey, resolveAgentIdFromSessionKey, resolveAgentRoute } from "openclaw/plugin-sdk/routing";
|
|
24
24
|
import { getRuntimeConfig } from "openclaw/plugin-sdk/runtime-config-snapshot";
|
|
25
25
|
import { ApplicationCommandOptionType, ButtonStyle, ChannelType, ComponentType, GatewayCloseCodes, GatewayCloseCodes as GatewayCloseCodes$1, GatewayDispatchEvents, GatewayIntentBits, GatewayOpcodes } from "discord-api-types/v10";
|
|
26
|
-
import { MAX_DATE_TIMESTAMP_MS, asDateTimestampMs, parseFiniteNumber, parseStrictFiniteNumber, parseStrictInteger, parseStrictNonNegativeInteger, parseStrictPositiveInteger, resolveDateTimestampMs, resolveTimestampMsToIsoString
|
|
26
|
+
import { MAX_DATE_TIMESTAMP_MS, asDateTimestampMs, parseFiniteNumber, parseStrictFiniteNumber, parseStrictInteger, parseStrictNonNegativeInteger, parseStrictPositiveInteger, resolveDateTimestampMs, resolveTimestampMsToIsoString } from "openclaw/plugin-sdk/number-runtime";
|
|
27
27
|
import { createHash, randomUUID } from "node:crypto";
|
|
28
28
|
import path from "node:path";
|
|
29
29
|
import { resolvePinnedMainDmOwnerFromAllowlist as resolvePinnedMainDmOwnerFromAllowlist$1 } from "openclaw/plugin-sdk/security-runtime";
|
|
@@ -44,8 +44,6 @@ import { fetchWithSsrFGuard, formatErrorMessage as formatErrorMessage$1 } from "
|
|
|
44
44
|
import { GROUP_POLICY_BLOCKED_LABEL, resolveDefaultGroupPolicy, resolveOpenProviderRuntimeGroupPolicy, warnMissingProviderGroupPolicyFallbackOnce } from "openclaw/plugin-sdk/runtime-group-policy";
|
|
45
45
|
import { createChannelPairingChallengeIssuer } from "openclaw/plugin-sdk/channel-pairing";
|
|
46
46
|
import { CHANNEL_APPROVAL_NATIVE_RUNTIME_CONTEXT_CAPABILITY } from "openclaw/plugin-sdk/approval-handler-adapter-runtime";
|
|
47
|
-
import { readJsonFileWithFallback } from "openclaw/plugin-sdk/json-store";
|
|
48
|
-
import { resolveStateDir } from "openclaw/plugin-sdk/state-paths";
|
|
49
47
|
import { addAllowlistUserEntriesFromConfigEntry, buildAllowlistResolutionSummary, canonicalizeAllowlistWithResolvedIds, patchAllowlistUsersInConfigEntries, summarizeMapping } from "openclaw/plugin-sdk/allow-from";
|
|
50
48
|
import { buildPairingReply, upsertChannelPairingRequest, upsertChannelPairingRequest as upsertChannelPairingRequest$1 } from "openclaw/plugin-sdk/conversation-runtime";
|
|
51
49
|
import { clearExpiredCooldowns, ensureAuthProfileStore, isProfileInCooldown, resolveAgentAvatar, resolveDefaultModelForAgent, resolveHumanDelayConfig, resolveProfilesUnavailableReason } from "openclaw/plugin-sdk/agent-runtime";
|
|
@@ -67,7 +65,6 @@ import * as pluginRuntime from "openclaw/plugin-sdk/plugin-runtime";
|
|
|
67
65
|
import { createInteractiveConversationBindingHelpers, dispatchPluginInteractiveHandler } from "openclaw/plugin-sdk/plugin-runtime";
|
|
68
66
|
import { dispatchReplyWithDispatcher, finalizeInboundContext } from "openclaw/plugin-sdk/reply-dispatch-runtime";
|
|
69
67
|
import * as conversationRuntime from "openclaw/plugin-sdk/conversation-binding-runtime";
|
|
70
|
-
import os from "node:os";
|
|
71
68
|
import { createConnectedChannelStatusPatch, createTransportActivityStatusPatch } from "openclaw/plugin-sdk/gateway-runtime";
|
|
72
69
|
import { EventEmitter } from "node:events";
|
|
73
70
|
import * as ws from "ws";
|
|
@@ -78,6 +75,7 @@ import { registerChannelRuntimeContext } from "openclaw/plugin-sdk/channel-runti
|
|
|
78
75
|
import { logDebug, logError } from "openclaw/plugin-sdk/logging-core";
|
|
79
76
|
import { stripPlainTextToolCallBlocks } from "openclaw/plugin-sdk/tool-payload";
|
|
80
77
|
import { resolveApprovalOverGateway } from "openclaw/plugin-sdk/approval-gateway-runtime";
|
|
78
|
+
import { resolveStateDir } from "openclaw/plugin-sdk/state-paths";
|
|
81
79
|
import { resolveRequestUrl } from "openclaw/plugin-sdk/request-url";
|
|
82
80
|
import { Agent as Agent$1, fetch as fetch$1 } from "undici";
|
|
83
81
|
//#region extensions/discord/src/monitor/listeners.queue.ts
|
|
@@ -2229,11 +2227,8 @@ function createDiscordCommandArgFallbackButton$1(params) {
|
|
|
2229
2227
|
//#region extensions/discord/src/monitor/model-picker-preferences.ts
|
|
2230
2228
|
const DEFAULT_RECENT_LIMIT = 5;
|
|
2231
2229
|
const PREFERENCE_MAX_ENTRIES = 2e3;
|
|
2232
|
-
const MAX_PLUGIN_STATE_KEY_BYTES = 512;
|
|
2233
|
-
const textEncoder = new TextEncoder();
|
|
2234
2230
|
let lastPreferenceTimestampMs = 0;
|
|
2235
2231
|
let lastPreferenceOrder = 0;
|
|
2236
|
-
const legacyPreferenceImports = /* @__PURE__ */ new Map();
|
|
2237
2232
|
function openPreferenceStore(env) {
|
|
2238
2233
|
return getDiscordRuntime().state.openKeyedStore({
|
|
2239
2234
|
namespace: "model-picker-preferences",
|
|
@@ -2274,14 +2269,6 @@ function sanitizeRecentModels(models, limit) {
|
|
|
2274
2269
|
}
|
|
2275
2270
|
return deduped;
|
|
2276
2271
|
}
|
|
2277
|
-
function sanitizeLegacyPreferenceEntry(value) {
|
|
2278
|
-
if (!value || typeof value !== "object") return;
|
|
2279
|
-
const typedValue = value;
|
|
2280
|
-
return {
|
|
2281
|
-
recent: Array.isArray(typedValue.recent) ? typedValue.recent.filter((item) => typeof item === "string") : [],
|
|
2282
|
-
updatedAt: typeof typedValue.updatedAt === "string" ? typedValue.updatedAt : ""
|
|
2283
|
-
};
|
|
2284
|
-
}
|
|
2285
2272
|
function sanitizeStoredPreferenceEntry(value) {
|
|
2286
2273
|
if (!value || typeof value !== "object") return;
|
|
2287
2274
|
const typedValue = value;
|
|
@@ -2311,10 +2298,6 @@ function timestampOrder(value) {
|
|
|
2311
2298
|
function comparePreferenceEntries(left, right) {
|
|
2312
2299
|
return timestampMs(right.value.updatedAt) - timestampMs(left.value.updatedAt) || timestampOrder(right.value.updatedOrder) - timestampOrder(left.value.updatedOrder) || left.key.localeCompare(right.key);
|
|
2313
2300
|
}
|
|
2314
|
-
function legacyUpdatedAtForIndex(updatedAt, index, total) {
|
|
2315
|
-
const baseMs = timestampMs(updatedAt);
|
|
2316
|
-
return timestampMsToIsoString(Math.min(baseMs + Math.max(0, total), MAX_DATE_TIMESTAMP_MS) - Math.max(0, index)) ?? timestampMsToIsoString(baseMs) ?? timestampMsToIsoString(Math.max(0, total - index)) ?? "1970-01-01T00:00:00.000Z";
|
|
2317
|
-
}
|
|
2318
2301
|
function nextPreferenceTimestamp(existingEntries) {
|
|
2319
2302
|
const existingMaxTimestampMs = existingEntries.reduce((max, entry) => Math.max(max, timestampMs(entry.updatedAt)), 0);
|
|
2320
2303
|
lastPreferenceTimestampMs = Math.min(Math.max(resolveDateTimestampMs(Date.now(), 0), lastPreferenceTimestampMs + 1, existingMaxTimestampMs + 1), MAX_DATE_TIMESTAMP_MS);
|
|
@@ -2325,53 +2308,11 @@ function nextPreferenceTimestamp(existingEntries) {
|
|
|
2325
2308
|
updatedOrder: lastPreferenceOrder
|
|
2326
2309
|
};
|
|
2327
2310
|
}
|
|
2328
|
-
function normalizeLegacyPreferenceKey(key) {
|
|
2329
|
-
const trimmed = key.trim();
|
|
2330
|
-
if (!trimmed || textEncoder.encode(trimmed).length > MAX_PLUGIN_STATE_KEY_BYTES) return;
|
|
2331
|
-
return trimmed;
|
|
2332
|
-
}
|
|
2333
|
-
function resolveLegacyPreferencesPath(env) {
|
|
2334
|
-
return path.join(resolveStateDir(env ?? process.env, os.homedir), "discord", "model-picker-preferences.json");
|
|
2335
|
-
}
|
|
2336
|
-
async function importLegacyPreferences(env) {
|
|
2337
|
-
const legacyPath = resolveLegacyPreferencesPath(env);
|
|
2338
|
-
const stateDir = path.dirname(path.dirname(legacyPath));
|
|
2339
|
-
const existingImport = legacyPreferenceImports.get(stateDir);
|
|
2340
|
-
if (existingImport) {
|
|
2341
|
-
await existingImport;
|
|
2342
|
-
return;
|
|
2343
|
-
}
|
|
2344
|
-
const importPromise = (async () => {
|
|
2345
|
-
const { value, exists } = await readJsonFileWithFallback(legacyPath, null);
|
|
2346
|
-
if (!exists || !value || typeof value.entries !== "object" || value.entries == null) return;
|
|
2347
|
-
const store = openPreferenceStore(env);
|
|
2348
|
-
for (const [rawKey, rawEntry] of Object.entries(value.entries)) {
|
|
2349
|
-
const key = normalizeLegacyPreferenceKey(rawKey);
|
|
2350
|
-
if (!key) continue;
|
|
2351
|
-
const entry = sanitizeLegacyPreferenceEntry(rawEntry);
|
|
2352
|
-
if (!entry || entry.recent.length === 0 && !entry.updatedAt) continue;
|
|
2353
|
-
const recent = sanitizeRecentModels(entry.recent, 10);
|
|
2354
|
-
for (const [index, modelRef] of recent.entries()) await store.registerIfAbsent(buildPreferenceModelKey(key, modelRef), {
|
|
2355
|
-
scopeKey: key,
|
|
2356
|
-
modelRef,
|
|
2357
|
-
updatedAt: legacyUpdatedAtForIndex(entry.updatedAt, index, recent.length)
|
|
2358
|
-
});
|
|
2359
|
-
}
|
|
2360
|
-
})();
|
|
2361
|
-
legacyPreferenceImports.set(stateDir, importPromise);
|
|
2362
|
-
try {
|
|
2363
|
-
await importPromise;
|
|
2364
|
-
} catch (error) {
|
|
2365
|
-
legacyPreferenceImports.delete(stateDir);
|
|
2366
|
-
throw error;
|
|
2367
|
-
}
|
|
2368
|
-
}
|
|
2369
2311
|
async function readDiscordModelPickerRecentModels(params) {
|
|
2370
2312
|
const key = buildDiscordModelPickerPreferenceKey(params.scope);
|
|
2371
2313
|
if (!key) return [];
|
|
2372
2314
|
const limit = Math.max(1, Math.min(params.limit ?? DEFAULT_RECENT_LIMIT, 10));
|
|
2373
2315
|
try {
|
|
2374
|
-
await importLegacyPreferences(params.env);
|
|
2375
2316
|
const recent = (await openPreferenceStore(params.env).entries()).map((entry) => ({
|
|
2376
2317
|
key: entry.key,
|
|
2377
2318
|
value: sanitizeStoredPreferenceEntry(entry.value)
|
|
@@ -2387,7 +2328,6 @@ async function recordDiscordModelPickerRecentModel(params) {
|
|
|
2387
2328
|
const normalizedModelRef = normalizeModelRef(params.modelRef);
|
|
2388
2329
|
if (!key || !normalizedModelRef) return;
|
|
2389
2330
|
try {
|
|
2390
|
-
await importLegacyPreferences(params.env);
|
|
2391
2331
|
const store = openPreferenceStore(params.env);
|
|
2392
2332
|
const timestamp = nextPreferenceTimestamp((await store.entries()).map((entry) => sanitizeStoredPreferenceEntry(entry.value)).filter((entry) => entry?.scopeKey === key));
|
|
2393
2333
|
await store.register(buildPreferenceModelKey(key, normalizedModelRef), {
|
|
@@ -3406,7 +3346,9 @@ async function applyDiscordModelPickerSelection(params) {
|
|
|
3406
3346
|
noticeMessage: `❌ Failed to apply ${params.resolvedModelRef}. Try /model ${params.resolvedModelRef} directly.`
|
|
3407
3347
|
};
|
|
3408
3348
|
const fallbackRoute = dispatchResult.effectiveRoute ?? params.route;
|
|
3409
|
-
if (params.settleMs > 0) await new Promise((resolve) =>
|
|
3349
|
+
if (params.settleMs > 0) await new Promise((resolve) => {
|
|
3350
|
+
setTimeout(resolve, params.settleMs);
|
|
3351
|
+
});
|
|
3410
3352
|
let effectiveModelRef = params.resolveCurrentModel(fallbackRoute);
|
|
3411
3353
|
let persisted = effectiveModelRef === params.resolvedModelRef;
|
|
3412
3354
|
if (params.selectedRuntime?.trim()) {
|
|
@@ -3418,7 +3360,9 @@ async function applyDiscordModelPickerSelection(params) {
|
|
|
3418
3360
|
isDefault: params.selectedProvider === params.defaultProvider && params.selectedModel === params.defaultModel,
|
|
3419
3361
|
runtime: params.selectedRuntime
|
|
3420
3362
|
});
|
|
3421
|
-
await new Promise((resolve) =>
|
|
3363
|
+
await new Promise((resolve) => {
|
|
3364
|
+
setTimeout(resolve, 100);
|
|
3365
|
+
});
|
|
3422
3366
|
effectiveModelRef = params.resolveCurrentModel(fallbackRoute);
|
|
3423
3367
|
persisted = effectiveModelRef === params.resolvedModelRef;
|
|
3424
3368
|
}
|
|
@@ -3433,7 +3377,9 @@ async function applyDiscordModelPickerSelection(params) {
|
|
|
3433
3377
|
isDefault: params.selectedProvider === params.defaultProvider && params.selectedModel === params.defaultModel,
|
|
3434
3378
|
runtime: params.selectedRuntime
|
|
3435
3379
|
});
|
|
3436
|
-
await new Promise((resolve) =>
|
|
3380
|
+
await new Promise((resolve) => {
|
|
3381
|
+
setTimeout(resolve, 100);
|
|
3382
|
+
});
|
|
3437
3383
|
effectiveModelRef = params.resolveCurrentModel(fallbackRoute);
|
|
3438
3384
|
persisted = effectiveModelRef === params.resolvedModelRef;
|
|
3439
3385
|
if (!persisted) logVerbose(`discord: direct session override persist failed — expected ${params.resolvedModelRef} but read ${effectiveModelRef} from session key ${fallbackRoute.sessionKey}`);
|
|
@@ -5526,7 +5472,7 @@ function createDiscordAutoPresenceController(params) {
|
|
|
5526
5472
|
let lastAppliedSignature = null;
|
|
5527
5473
|
let lastAppliedAt = 0;
|
|
5528
5474
|
const runEvaluation = (options) => {
|
|
5529
|
-
let decision
|
|
5475
|
+
let decision;
|
|
5530
5476
|
try {
|
|
5531
5477
|
decision = resolveDiscordAutoPresenceDecision({
|
|
5532
5478
|
discordConfig: params.discordConfig,
|
|
@@ -6749,7 +6695,7 @@ function formatDiscordDeployErrorDetails(err) {
|
|
|
6749
6695
|
if (typeof status === "number") details.push(`status=${status}`);
|
|
6750
6696
|
if (typeof discordCode === "number" || typeof discordCode === "string") details.push(`code=${discordCode}`);
|
|
6751
6697
|
if (rawBody !== void 0) {
|
|
6752
|
-
let bodyText
|
|
6698
|
+
let bodyText;
|
|
6753
6699
|
try {
|
|
6754
6700
|
bodyText = JSON.stringify(rawBody);
|
|
6755
6701
|
} catch {
|
|
@@ -9220,7 +9166,7 @@ async function waitForDiscordGatewayStop(params) {
|
|
|
9220
9166
|
gateway?.disconnect?.();
|
|
9221
9167
|
} finally {
|
|
9222
9168
|
cleanup();
|
|
9223
|
-
reject(err);
|
|
9169
|
+
reject(toLintErrorObject(err, "Non-Error rejection"));
|
|
9224
9170
|
}
|
|
9225
9171
|
};
|
|
9226
9172
|
const onAbort = () => {
|
|
@@ -9241,6 +9187,13 @@ async function waitForDiscordGatewayStop(params) {
|
|
|
9241
9187
|
params.registerForceStop?.(onForceStop);
|
|
9242
9188
|
});
|
|
9243
9189
|
}
|
|
9190
|
+
function toLintErrorObject(value, fallbackMessage) {
|
|
9191
|
+
if (value instanceof Error) return value;
|
|
9192
|
+
if (typeof value === "string") return new Error(value);
|
|
9193
|
+
const error = new Error(fallbackMessage, { cause: value });
|
|
9194
|
+
if (typeof value === "object" && value !== null || typeof value === "function") Object.assign(error, value);
|
|
9195
|
+
return error;
|
|
9196
|
+
}
|
|
9244
9197
|
//#endregion
|
|
9245
9198
|
//#region extensions/discord/src/monitor/provider.lifecycle.ts
|
|
9246
9199
|
const DEFAULT_DISCORD_GATEWAY_READY_TIMEOUT_MS = 15e3;
|
|
@@ -9885,7 +9838,7 @@ function logDiscordStartupPhase(params) {
|
|
|
9885
9838
|
});
|
|
9886
9839
|
}
|
|
9887
9840
|
async function loadDiscordVoiceRuntime() {
|
|
9888
|
-
const promise = discordVoiceRuntimePromise ?? import("./manager.runtime-
|
|
9841
|
+
const promise = discordVoiceRuntimePromise ?? import("./manager.runtime-CVB9_dwq.js");
|
|
9889
9842
|
discordVoiceRuntimePromise = promise;
|
|
9890
9843
|
try {
|
|
9891
9844
|
return await promise;
|
|
@@ -9895,7 +9848,7 @@ async function loadDiscordVoiceRuntime() {
|
|
|
9895
9848
|
}
|
|
9896
9849
|
}
|
|
9897
9850
|
async function loadDiscordProviderSessionRuntime() {
|
|
9898
|
-
const promise = discordProviderSessionRuntimePromise ?? import("./provider-session.runtime-
|
|
9851
|
+
const promise = discordProviderSessionRuntimePromise ?? import("./provider-session.runtime-CC2f_W1j.js");
|
|
9899
9852
|
discordProviderSessionRuntimePromise = promise;
|
|
9900
9853
|
try {
|
|
9901
9854
|
return await promise;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as reconcileAcpThreadBindingsOnStartup } from "./thread-bindings-
|
|
2
|
-
import { n as createThreadBindingManager, t as createNoopThreadBindingManager } from "./thread-bindings.manager-
|
|
3
|
-
import { t as createDiscordMessageHandler } from "./message-handler-
|
|
1
|
+
import { a as reconcileAcpThreadBindingsOnStartup } from "./thread-bindings-Tfr_vFxk.js";
|
|
2
|
+
import { n as createThreadBindingManager, t as createNoopThreadBindingManager } from "./thread-bindings.manager-CRc4hYr1.js";
|
|
3
|
+
import { t as createDiscordMessageHandler } from "./message-handler-CQGpWQ0f.js";
|
|
4
4
|
import { resolveThreadBindingIdleTimeoutMs, resolveThreadBindingMaxAgeMs, resolveThreadBindingsEnabled } from "openclaw/plugin-sdk/conversation-runtime";
|
|
5
5
|
import { getAcpSessionManager, isAcpRuntimeError } from "openclaw/plugin-sdk/acp-runtime";
|
|
6
6
|
export { createDiscordMessageHandler, createNoopThreadBindingManager, createThreadBindingManager, getAcpSessionManager, isAcpRuntimeError, reconcileAcpThreadBindingsOnStartup, resolveThreadBindingIdleTimeoutMs, resolveThreadBindingMaxAgeMs, resolveThreadBindingsEnabled };
|
package/dist/runtime-api.js
CHANGED
|
@@ -9,22 +9,22 @@ import { n as sendPollDiscord, r as sendStickerDiscord, t as sendMessageDiscord
|
|
|
9
9
|
import { a as readDiscordChannelCreateParams, c as readDiscordParentIdParam, i as requiredGuildPermissionForModerationAction, n as isDiscordModerationAction, o as readDiscordChannelEditParams, r as readDiscordModerationCommand, s as readDiscordChannelMoveParams, t as handleDiscordAction } from "./runtime-Dds0Ww1n.js";
|
|
10
10
|
import { r as setDiscordRuntime } from "./runtime-DgnVQ7zW.js";
|
|
11
11
|
import { t as discordMessageActions } from "./channel-actions-BaPDAWN_.js";
|
|
12
|
-
import { C as
|
|
13
|
-
import { n as setThreadBindingMaxAgeBySessionKey, t as setThreadBindingIdleTimeoutBySessionKey } from "./thread-bindings.session-updates-
|
|
12
|
+
import { C as resolveThreadBindingIdleTimeoutMs, E as resolveThreadBindingMaxAgeMs, T as resolveThreadBindingMaxAgeExpiresAt, d as isRecentlyUnboundThreadWebhookMessage, w as resolveThreadBindingInactivityExpiresAt } from "./thread-bindings.state-CVLF7gJH.js";
|
|
13
|
+
import { n as setThreadBindingMaxAgeBySessionKey, t as setThreadBindingIdleTimeoutBySessionKey } from "./thread-bindings.session-updates-DeMxmcXB.js";
|
|
14
14
|
import { t as resolveDiscordChannelAllowlist } from "./resolve-channels-DLNfxFQP.js";
|
|
15
15
|
import { t as resolveDiscordUserAllowlist } from "./resolve-users-QTyD8qgI.js";
|
|
16
|
-
import { _ as formatThreadBindingDurationLabel, b as resolveThreadBindingThreadName, g as resolveThreadBindingPersonaFromRecord, h as resolveThreadBindingPersona, y as resolveThreadBindingIntroText } from "./thread-bindings.discord-api-
|
|
17
|
-
import { a as reconcileAcpThreadBindingsOnStartup, c as resolveDiscordThreadBindingMaxAgeMs, i as listThreadBindingsForAccount, l as resolveThreadBindingsEnabled, n as autoBindSpawnedDiscordSubagent, o as unbindThreadBindingsBySessionKey, r as listThreadBindingsBySessionKey, s as resolveDiscordThreadBindingIdleTimeoutMs } from "./thread-bindings-
|
|
18
|
-
import { i as testing, n as createThreadBindingManager, r as getThreadBindingManager, t as createNoopThreadBindingManager } from "./thread-bindings.manager-
|
|
16
|
+
import { _ as formatThreadBindingDurationLabel, b as resolveThreadBindingThreadName, g as resolveThreadBindingPersonaFromRecord, h as resolveThreadBindingPersona, y as resolveThreadBindingIntroText } from "./thread-bindings.discord-api-CfDs1lWu.js";
|
|
17
|
+
import { a as reconcileAcpThreadBindingsOnStartup, c as resolveDiscordThreadBindingMaxAgeMs, i as listThreadBindingsForAccount, l as resolveThreadBindingsEnabled, n as autoBindSpawnedDiscordSubagent, o as unbindThreadBindingsBySessionKey, r as listThreadBindingsBySessionKey, s as resolveDiscordThreadBindingIdleTimeoutMs } from "./thread-bindings-Tfr_vFxk.js";
|
|
18
|
+
import { i as testing, n as createThreadBindingManager, r as getThreadBindingManager, t as createNoopThreadBindingManager } from "./thread-bindings.manager-CRc4hYr1.js";
|
|
19
19
|
import { a as resolveDiscordPrivilegedIntentsFromFlags, i as probeDiscord, n as fetchDiscordApplicationSummary, r as parseApplicationIdFromToken, t as fetchDiscordApplicationId } from "./probe-2MdGjUAf.js";
|
|
20
20
|
import { a as mergeAbortSignals, i as DISCORD_DEFAULT_LISTENER_TIMEOUT_MS, n as DISCORD_ATTACHMENT_TOTAL_TIMEOUT_MS, r as DISCORD_DEFAULT_INBOUND_WORKER_TIMEOUT_MS, t as DISCORD_ATTACHMENT_IDLE_TIMEOUT_MS } from "./timeouts-CEJ3--Uw.js";
|
|
21
21
|
import "./runtime-api.actions.js";
|
|
22
22
|
import { r as collectDiscordAuditChannelIds, t as auditDiscordChannelPermissions } from "./audit-eI8e8RpG.js";
|
|
23
23
|
import "./runtime-api.lookup.js";
|
|
24
|
-
import { C as resolveDiscordReplyTarget, T as sanitizeDiscordThreadName, b as registerDiscordListener, c as resolveDiscordGatewayIntents, d as createDiscordNativeCommand, l as waitForDiscordGatewayPluginRegistration, s as createDiscordGatewayPlugin, t as monitorDiscordProvider } from "./provider-
|
|
25
|
-
import { i as buildDiscordMediaPayload } from "./message-utils-
|
|
26
|
-
import { t as createDiscordMessageHandler } from "./message-handler-
|
|
27
|
-
import "./runtime-api.monitor-
|
|
24
|
+
import { C as resolveDiscordReplyTarget, T as sanitizeDiscordThreadName, b as registerDiscordListener, c as resolveDiscordGatewayIntents, d as createDiscordNativeCommand, l as waitForDiscordGatewayPluginRegistration, s as createDiscordGatewayPlugin, t as monitorDiscordProvider } from "./provider-BTp6enEl.js";
|
|
25
|
+
import { i as buildDiscordMediaPayload } from "./message-utils-ZTGvA2L8.js";
|
|
26
|
+
import { t as createDiscordMessageHandler } from "./message-handler-CQGpWQ0f.js";
|
|
27
|
+
import "./runtime-api.monitor-BkA-vJZA.js";
|
|
28
28
|
import "./runtime-api.send.js";
|
|
29
29
|
import "./runtime-api.threads.js";
|
|
30
30
|
export { DISCORD_ATTACHMENT_IDLE_TIMEOUT_MS, DISCORD_ATTACHMENT_TOTAL_TIMEOUT_MS, DISCORD_DEFAULT_INBOUND_WORKER_TIMEOUT_MS, DISCORD_DEFAULT_LISTENER_TIMEOUT_MS, DiscordSendError, testing as __testing, testing, addRoleDiscord, allowListMatches, auditDiscordChannelPermissions, autoBindSpawnedDiscordSubagent, banMemberDiscord, buildDiscordMediaPayload, clearGateways, clearPresences, collectDiscordAuditChannelIds, createChannelDiscord, createDiscordGatewayPlugin, createDiscordMessageHandler, createDiscordNativeCommand, createNoopThreadBindingManager, createScheduledEventDiscord, createThreadBindingManager, createThreadDiscord, deleteChannelDiscord, deleteMessageDiscord, discordMessageActions, editChannelDiscord, editDiscordComponentMessage, editMessageDiscord, fetchChannelInfoDiscord, fetchChannelPermissionsDiscord, fetchDiscordApplicationId, fetchDiscordApplicationSummary, fetchMemberGuildPermissionsDiscord, fetchMemberInfoDiscord, fetchMessageDiscord, fetchReactionsDiscord, fetchRoleInfoDiscord, fetchVoiceStatusDiscord, formatThreadBindingDurationLabel, getGateway, getPresence, getThreadBindingManager, handleDiscordAction, hasAllGuildPermissionsDiscord, hasAnyGuildPermissionDiscord, isDiscordGroupAllowedByPolicy, isDiscordModerationAction, isRecentlyUnboundThreadWebhookMessage, kickMemberDiscord, listDiscordDirectoryGroupsLive, listDiscordDirectoryPeersLive, listGuildChannelsDiscord, listGuildEmojisDiscord, listPinsDiscord, listScheduledEventsDiscord, listThreadBindingsBySessionKey, listThreadBindingsForAccount, listThreadsDiscord, mergeAbortSignals, monitorDiscordProvider, moveChannelDiscord, normalizeDiscordAllowList, normalizeDiscordSlug, parseApplicationIdFromToken, pinMessageDiscord, presenceCacheSize, probeDiscord, reactMessageDiscord, readDiscordChannelCreateParams, readDiscordChannelEditParams, readDiscordChannelMoveParams, readDiscordModerationCommand, readDiscordParentIdParam, readMessagesDiscord, reconcileAcpThreadBindingsOnStartup, registerBuiltDiscordComponentMessage, registerDiscordListener, registerGateway, removeChannelPermissionDiscord, removeOwnReactionsDiscord, removeReactionDiscord, removeRoleDiscord, requiredGuildPermissionForModerationAction, resolveDiscordChannelAllowlist, resolveDiscordChannelConfig, resolveDiscordChannelConfigWithFallback, resolveDiscordCommandAuthorized, resolveDiscordGatewayIntents, resolveDiscordGuildEntry, resolveDiscordOutboundSessionRoute, resolveDiscordPrivilegedIntentsFromFlags, resolveDiscordReplyTarget, resolveDiscordShouldRequireMention, resolveDiscordThreadBindingIdleTimeoutMs, resolveDiscordThreadBindingMaxAgeMs, resolveDiscordUserAllowlist, resolveEventCoverImage, resolveGroupDmAllow, resolveThreadBindingIdleTimeoutMs, resolveThreadBindingInactivityExpiresAt, resolveThreadBindingIntroText, resolveThreadBindingMaxAgeExpiresAt, resolveThreadBindingMaxAgeMs, resolveThreadBindingPersona, resolveThreadBindingPersonaFromRecord, resolveThreadBindingThreadName, resolveThreadBindingsEnabled, sanitizeDiscordThreadName, searchMessagesDiscord, sendDiscordComponentMessage, sendMessageDiscord, sendPollDiscord, sendStickerDiscord, sendTypingDiscord, sendVoiceMessageDiscord, sendWebhookMessageDiscord, setChannelPermissionDiscord, setDiscordRuntime, setPresence, setThreadBindingIdleTimeoutBySessionKey, setThreadBindingMaxAgeBySessionKey, shouldEmitDiscordReactionNotification, timeoutMemberDiscord, unbindThreadBindingsBySessionKey, unpinMessageDiscord, unregisterGateway, uploadEmojiDiscord, uploadStickerDiscord, waitForDiscordGatewayPluginRegistration };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { a as clearPresences, c as setPresence, i as unregisterGateway, n as getGateway, o as getPresence, r as registerGateway, s as presenceCacheSize, t as clearGateways } from "./gateway-registry-DPxmW0Db.js";
|
|
2
2
|
import { _ as resolveGroupDmAllow, a as normalizeDiscordSlug, c as resolveDiscordChannelConfigWithFallback, d as resolveDiscordGuildEntry, g as resolveDiscordShouldRequireMention, n as isDiscordGroupAllowedByPolicy, r as normalizeDiscordAllowList, s as resolveDiscordChannelConfig, t as allowListMatches, u as resolveDiscordCommandAuthorized, v as shouldEmitDiscordReactionNotification } from "./allow-list-C-MqM-B_.js";
|
|
3
3
|
import { a as mergeAbortSignals, i as DISCORD_DEFAULT_LISTENER_TIMEOUT_MS, n as DISCORD_ATTACHMENT_TOTAL_TIMEOUT_MS, r as DISCORD_DEFAULT_INBOUND_WORKER_TIMEOUT_MS, t as DISCORD_ATTACHMENT_IDLE_TIMEOUT_MS } from "./timeouts-CEJ3--Uw.js";
|
|
4
|
-
import { C as resolveDiscordReplyTarget, T as sanitizeDiscordThreadName, b as registerDiscordListener, c as resolveDiscordGatewayIntents, d as createDiscordNativeCommand, l as waitForDiscordGatewayPluginRegistration, s as createDiscordGatewayPlugin, t as monitorDiscordProvider } from "./provider-
|
|
5
|
-
import { i as buildDiscordMediaPayload } from "./message-utils-
|
|
6
|
-
import { t as createDiscordMessageHandler } from "./message-handler-
|
|
7
|
-
import "./runtime-api.monitor-
|
|
4
|
+
import { C as resolveDiscordReplyTarget, T as sanitizeDiscordThreadName, b as registerDiscordListener, c as resolveDiscordGatewayIntents, d as createDiscordNativeCommand, l as waitForDiscordGatewayPluginRegistration, s as createDiscordGatewayPlugin, t as monitorDiscordProvider } from "./provider-BTp6enEl.js";
|
|
5
|
+
import { i as buildDiscordMediaPayload } from "./message-utils-ZTGvA2L8.js";
|
|
6
|
+
import { t as createDiscordMessageHandler } from "./message-handler-CQGpWQ0f.js";
|
|
7
|
+
import "./runtime-api.monitor-BkA-vJZA.js";
|
|
8
8
|
export { DISCORD_ATTACHMENT_IDLE_TIMEOUT_MS, DISCORD_ATTACHMENT_TOTAL_TIMEOUT_MS, DISCORD_DEFAULT_INBOUND_WORKER_TIMEOUT_MS, DISCORD_DEFAULT_LISTENER_TIMEOUT_MS, allowListMatches, buildDiscordMediaPayload, clearGateways, clearPresences, createDiscordGatewayPlugin, createDiscordMessageHandler, createDiscordNativeCommand, getGateway, getPresence, isDiscordGroupAllowedByPolicy, mergeAbortSignals, monitorDiscordProvider, normalizeDiscordAllowList, normalizeDiscordSlug, presenceCacheSize, registerDiscordListener, registerGateway, resolveDiscordChannelConfig, resolveDiscordChannelConfigWithFallback, resolveDiscordCommandAuthorized, resolveDiscordGatewayIntents, resolveDiscordGuildEntry, resolveDiscordReplyTarget, resolveDiscordShouldRequireMention, resolveGroupDmAllow, sanitizeDiscordThreadName, setPresence, shouldEmitDiscordReactionNotification, unregisterGateway, waitForDiscordGatewayPluginRegistration };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { C as
|
|
2
|
-
import { n as setThreadBindingMaxAgeBySessionKey, t as setThreadBindingIdleTimeoutBySessionKey } from "./thread-bindings.session-updates-
|
|
3
|
-
import { _ as formatThreadBindingDurationLabel, b as resolveThreadBindingThreadName, g as resolveThreadBindingPersonaFromRecord, h as resolveThreadBindingPersona, y as resolveThreadBindingIntroText } from "./thread-bindings.discord-api-
|
|
4
|
-
import { a as reconcileAcpThreadBindingsOnStartup, c as resolveDiscordThreadBindingMaxAgeMs, i as listThreadBindingsForAccount, l as resolveThreadBindingsEnabled, n as autoBindSpawnedDiscordSubagent, o as unbindThreadBindingsBySessionKey, r as listThreadBindingsBySessionKey, s as resolveDiscordThreadBindingIdleTimeoutMs } from "./thread-bindings-
|
|
5
|
-
import { i as testing, n as createThreadBindingManager, r as getThreadBindingManager, t as createNoopThreadBindingManager } from "./thread-bindings.manager-
|
|
1
|
+
import { C as resolveThreadBindingIdleTimeoutMs, E as resolveThreadBindingMaxAgeMs, T as resolveThreadBindingMaxAgeExpiresAt, d as isRecentlyUnboundThreadWebhookMessage, w as resolveThreadBindingInactivityExpiresAt } from "./thread-bindings.state-CVLF7gJH.js";
|
|
2
|
+
import { n as setThreadBindingMaxAgeBySessionKey, t as setThreadBindingIdleTimeoutBySessionKey } from "./thread-bindings.session-updates-DeMxmcXB.js";
|
|
3
|
+
import { _ as formatThreadBindingDurationLabel, b as resolveThreadBindingThreadName, g as resolveThreadBindingPersonaFromRecord, h as resolveThreadBindingPersona, y as resolveThreadBindingIntroText } from "./thread-bindings.discord-api-CfDs1lWu.js";
|
|
4
|
+
import { a as reconcileAcpThreadBindingsOnStartup, c as resolveDiscordThreadBindingMaxAgeMs, i as listThreadBindingsForAccount, l as resolveThreadBindingsEnabled, n as autoBindSpawnedDiscordSubagent, o as unbindThreadBindingsBySessionKey, r as listThreadBindingsBySessionKey, s as resolveDiscordThreadBindingIdleTimeoutMs } from "./thread-bindings-Tfr_vFxk.js";
|
|
5
|
+
import { i as testing, n as createThreadBindingManager, r as getThreadBindingManager, t as createNoopThreadBindingManager } from "./thread-bindings.manager-CRc4hYr1.js";
|
|
6
6
|
export { testing as __testing, testing, autoBindSpawnedDiscordSubagent, createNoopThreadBindingManager, createThreadBindingManager, formatThreadBindingDurationLabel, getThreadBindingManager, isRecentlyUnboundThreadWebhookMessage, listThreadBindingsBySessionKey, listThreadBindingsForAccount, reconcileAcpThreadBindingsOnStartup, resolveDiscordThreadBindingIdleTimeoutMs, resolveDiscordThreadBindingMaxAgeMs, resolveThreadBindingIdleTimeoutMs, resolveThreadBindingInactivityExpiresAt, resolveThreadBindingIntroText, resolveThreadBindingMaxAgeExpiresAt, resolveThreadBindingMaxAgeMs, resolveThreadBindingPersona, resolveThreadBindingPersonaFromRecord, resolveThreadBindingThreadName, resolveThreadBindingsEnabled, setThreadBindingIdleTimeoutBySessionKey, setThreadBindingMaxAgeBySessionKey, unbindThreadBindingsBySessionKey };
|
package/dist/setup-plugin-api.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as discordSetupPlugin } from "./channel.setup-
|
|
1
|
+
import { t as discordSetupPlugin } from "./channel.setup-BX7g7pL-.js";
|
|
2
2
|
export { discordSetupPlugin };
|
|
@@ -2,7 +2,7 @@ import { t as inspectDiscordAccount } from "./account-inspect-DDZtT5C8.js";
|
|
|
2
2
|
import { a as mergeDiscordAccountConfig, c as resolveDiscordAccountAllowFrom, d as resolveDiscordAccountDmPolicy, n as isDiscordAccountEnabledForRuntime, o as resolveDefaultDiscordAccountId, r as listDiscordAccountIds, s as resolveDiscordAccount, u as resolveDiscordAccountDisabledReason } from "./accounts-P19jm1lf.js";
|
|
3
3
|
import { i as getChatChannelMeta, o as resolveConfiguredFromCredentialStatuses } from "./channel-api-CAJ0wMoV.js";
|
|
4
4
|
import { t as DiscordChannelConfigSchema } from "./config-schema-spuxW477.js";
|
|
5
|
-
import { n as normalizeCompatibilityConfig } from "./doctor-contract-
|
|
5
|
+
import { n as normalizeCompatibilityConfig } from "./doctor-contract-CU7lnZTF.js";
|
|
6
6
|
import { n as secretTargetRegistryEntries, t as collectRuntimeConfigAssignments } from "./secret-config-contract-BjM-1hr9.js";
|
|
7
7
|
import { n as unsupportedSecretRefSurfacePatterns, t as collectUnsupportedSecretRefConfigCandidates } from "./security-contract-DSHk7I2w.js";
|
|
8
8
|
import { t as deriveLegacySessionChatType } from "./session-contract-BO5tlIdl.js";
|
|
@@ -71,7 +71,7 @@ const DISCORD_LEGACY_CONFIG_RULES = [];
|
|
|
71
71
|
const DISCORD_CHANNEL = "discord";
|
|
72
72
|
let discordDoctorModulePromise;
|
|
73
73
|
async function loadDiscordDoctorModule() {
|
|
74
|
-
discordDoctorModulePromise ??= import("./doctor-
|
|
74
|
+
discordDoctorModulePromise ??= import("./doctor-D3ngpo-Y.js");
|
|
75
75
|
return await discordDoctorModulePromise;
|
|
76
76
|
}
|
|
77
77
|
const discordDoctor = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
//#region extensions/discord/subagent-hooks-api.ts
|
|
2
2
|
let discordSubagentHooksPromise = null;
|
|
3
3
|
function loadDiscordSubagentHooksModule() {
|
|
4
|
-
discordSubagentHooksPromise ??= import("./subagent-hooks-
|
|
4
|
+
discordSubagentHooksPromise ??= import("./subagent-hooks-nBcp0iGm.js").then((n) => n.i);
|
|
5
5
|
return discordSubagentHooksPromise;
|
|
6
6
|
}
|
|
7
7
|
function registerDiscordSubagentHooks(api) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Wt as __exportAll } from "./send.receipt-Z8V6yMOY.js";
|
|
2
2
|
import { s as resolveDiscordAccount } from "./accounts-P19jm1lf.js";
|
|
3
|
-
import { n as autoBindSpawnedDiscordSubagent, o as unbindThreadBindingsBySessionKey, r as listThreadBindingsBySessionKey } from "./thread-bindings-
|
|
3
|
+
import { n as autoBindSpawnedDiscordSubagent, o as unbindThreadBindingsBySessionKey, r as listThreadBindingsBySessionKey } from "./thread-bindings-Tfr_vFxk.js";
|
|
4
4
|
import { normalizeOptionalLowercaseString, normalizeOptionalStringifiedId } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
5
5
|
import { formatThreadBindingDisabledError, formatThreadBindingSpawnDisabledError, resolveThreadBindingSpawnPolicy } from "openclaw/plugin-sdk/conversation-runtime";
|
|
6
6
|
//#region extensions/discord/src/subagent-hooks.ts
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Ht as parseDiscordTarget, Wt as __exportAll } from "./send.receipt-Z8V6yMOY.js";
|
|
2
2
|
import "./targets-Cv797U29.js";
|
|
3
|
-
import {
|
|
4
|
-
import { n as setThreadBindingMaxAgeBySessionKey, r as resolveBindingIdsForTargetSession, t as setThreadBindingIdleTimeoutBySessionKey } from "./thread-bindings.session-updates-
|
|
5
|
-
import { _ as formatThreadBindingDurationLabel, b as resolveThreadBindingThreadName, g as resolveThreadBindingPersonaFromRecord, h as resolveThreadBindingPersona, s as resolveChannelIdForBinding, y as resolveThreadBindingIntroText } from "./thread-bindings.discord-api-
|
|
6
|
-
import { i as testing, n as createThreadBindingManager, r as getThreadBindingManager, t as createNoopThreadBindingManager } from "./thread-bindings.manager-
|
|
3
|
+
import { A as shouldPersistBindingMutations, C as resolveThreadBindingIdleTimeoutMs$1, D as saveBindingsToDisk, E as resolveThreadBindingMaxAgeMs$1, T as resolveThreadBindingMaxAgeExpiresAt, d as isRecentlyUnboundThreadWebhookMessage, g as rememberRecentUnboundWebhookEcho, h as normalizeThreadId, n as MANAGERS_BY_ACCOUNT_ID, t as BINDINGS_BY_THREAD_ID, u as getThreadBindingToken, w as resolveThreadBindingInactivityExpiresAt, y as removeBindingRecord } from "./thread-bindings.state-CVLF7gJH.js";
|
|
4
|
+
import { n as setThreadBindingMaxAgeBySessionKey, r as resolveBindingIdsForTargetSession, t as setThreadBindingIdleTimeoutBySessionKey } from "./thread-bindings.session-updates-DeMxmcXB.js";
|
|
5
|
+
import { _ as formatThreadBindingDurationLabel, b as resolveThreadBindingThreadName, g as resolveThreadBindingPersonaFromRecord, h as resolveThreadBindingPersona, s as resolveChannelIdForBinding, y as resolveThreadBindingIntroText } from "./thread-bindings.discord-api-CfDs1lWu.js";
|
|
6
|
+
import { i as testing, n as createThreadBindingManager, r as getThreadBindingManager, t as createNoopThreadBindingManager } from "./thread-bindings.manager-CRc4hYr1.js";
|
|
7
7
|
import { normalizeOptionalLowercaseString, normalizeOptionalString, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
8
8
|
import { normalizeAccountId } from "openclaw/plugin-sdk/routing";
|
|
9
9
|
import { resolveThreadBindingIdleTimeoutMs, resolveThreadBindingMaxAgeMs, resolveThreadBindingsEnabled } from "openclaw/plugin-sdk/conversation-runtime";
|
package/dist/{thread-bindings.discord-api-D8MZQPER.js → thread-bindings.discord-api-CfDs1lWu.js}
RENAMED
|
@@ -2,7 +2,7 @@ import { Ut as resolveDiscordChannelId, pt as getChannel, tt as createChannelWeb
|
|
|
2
2
|
import { I as createDiscordRestClient } from "./send.shared-B3QxPnR3.js";
|
|
3
3
|
import { c as sendWebhookMessageDiscord, u as createThreadDiscord } from "./send-CyyRF1yd.js";
|
|
4
4
|
import { t as sendMessageDiscord } from "./send.outbound-DhMLobqR.js";
|
|
5
|
-
import {
|
|
5
|
+
import { M as toReusableWebhookKey, _ as rememberReusableWebhook, i as REUSABLE_WEBHOOKS_BY_ACCOUNT_CHANNEL, t as BINDINGS_BY_THREAD_ID } from "./thread-bindings.state-CVLF7gJH.js";
|
|
6
6
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
7
7
|
import { ChannelType } from "discord-api-types/v10";
|
|
8
8
|
import { parseStrictNonNegativeInteger } from "openclaw/plugin-sdk/number-runtime";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Ut as resolveDiscordChannelId, Wt as __exportAll, pt as getChannel } from "./send.receipt-Z8V6yMOY.js";
|
|
2
2
|
import { I as createDiscordRestClient } from "./send.shared-B3QxPnR3.js";
|
|
3
|
-
import {
|
|
4
|
-
import { a as isThreadArchived, b as resolveThreadBindingThreadName, c as summarizeDiscordError, i as isDiscordThreadGoneError, n as createWebhookForChannel, o as maybeSendBindingMessage, r as findReusableWebhook, s as resolveChannelIdForBinding, t as createThreadForBinding, v as resolveThreadBindingFarewellText } from "./thread-bindings.discord-api-
|
|
3
|
+
import { C as resolveThreadBindingIdleTimeoutMs$1, D as saveBindingsToDisk, E as resolveThreadBindingMaxAgeMs$1, F as THREAD_BINDINGS_SWEEP_INTERVAL_MS, N as DEFAULT_THREAD_BINDING_IDLE_TIMEOUT_MS, O as setBindingRecord, S as resolveBindingRecordKey, T as resolveThreadBindingMaxAgeExpiresAt, b as resetThreadBindingsForTests, c as ensureBindingsLoaded, g as rememberRecentUnboundWebhookEcho, h as normalizeThreadId, k as shouldDefaultPersist, l as forgetThreadBindingToken, m as normalizeThreadBindingDurationMs, n as MANAGERS_BY_ACCOUNT_ID, p as normalizeTargetKind, r as PERSIST_BY_ACCOUNT_ID, s as THREAD_BINDING_TOUCH_PERSIST_MIN_INTERVAL_MS, t as BINDINGS_BY_THREAD_ID, u as getThreadBindingToken, v as rememberThreadBindingToken, w as resolveThreadBindingInactivityExpiresAt, x as resolveBindingIdsForSession, y as removeBindingRecord } from "./thread-bindings.state-CVLF7gJH.js";
|
|
4
|
+
import { a as isThreadArchived, b as resolveThreadBindingThreadName, c as summarizeDiscordError, i as isDiscordThreadGoneError, n as createWebhookForChannel, o as maybeSendBindingMessage, r as findReusableWebhook, s as resolveChannelIdForBinding, t as createThreadForBinding, v as resolveThreadBindingFarewellText } from "./thread-bindings.discord-api-CfDs1lWu.js";
|
|
5
5
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
6
6
|
import { normalizeAccountId, resolveAgentIdFromSessionKey } from "openclaw/plugin-sdk/routing";
|
|
7
7
|
import { getRuntimeConfigSnapshot } from "openclaw/plugin-sdk/runtime-config-snapshot";
|
|
@@ -522,7 +522,6 @@ function getThreadBindingManager(accountId) {
|
|
|
522
522
|
return MANAGERS_BY_ACCOUNT_ID.get(normalized) ?? null;
|
|
523
523
|
}
|
|
524
524
|
const testing = {
|
|
525
|
-
resolveThreadBindingsPath,
|
|
526
525
|
resolveThreadBindingThreadName,
|
|
527
526
|
resetThreadBindingsForTests,
|
|
528
527
|
runThreadBindingSweepForAccount: async (accountId) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { A as shouldPersistBindingMutations, D as saveBindingsToDisk, O as setBindingRecord, c as ensureBindingsLoaded, t as BINDINGS_BY_THREAD_ID, x as resolveBindingIdsForSession } from "./thread-bindings.state-CVLF7gJH.js";
|
|
2
2
|
import { normalizeAccountId } from "openclaw/plugin-sdk/routing";
|
|
3
3
|
//#region extensions/discord/src/monitor/thread-bindings.session-shared.ts
|
|
4
4
|
function normalizeNonNegativeMs(raw) {
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
+
import { t as getDiscordRuntime } from "./runtime-DgnVQ7zW.js";
|
|
1
2
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeOptionalStringifiedId } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
2
3
|
import { normalizeAccountId, resolveAgentIdFromSessionKey } from "openclaw/plugin-sdk/routing";
|
|
3
4
|
import { isFutureDateTimestampMs, resolveExpiresAtMsFromDurationMs } from "openclaw/plugin-sdk/number-runtime";
|
|
4
|
-
import path from "node:path";
|
|
5
|
-
import fs from "node:fs";
|
|
6
|
-
import { loadJsonFile, saveJsonFile } from "openclaw/plugin-sdk/json-store";
|
|
7
|
-
import { resolveStateDir } from "openclaw/plugin-sdk/state-paths";
|
|
8
5
|
//#region extensions/discord/src/monitor/thread-bindings.types.ts
|
|
9
6
|
const THREAD_BINDINGS_SWEEP_INTERVAL_MS = 12e4;
|
|
10
7
|
const DEFAULT_THREAD_BINDING_IDLE_TIMEOUT_MS = 1440 * 60 * 1e3;
|
|
@@ -24,6 +21,8 @@ function createThreadBindingsGlobalState() {
|
|
|
24
21
|
reusableWebhooksByAccountChannel: /* @__PURE__ */ new Map(),
|
|
25
22
|
persistByAccountId: /* @__PURE__ */ new Map(),
|
|
26
23
|
loadedBindings: false,
|
|
24
|
+
loadedPersistentBindings: false,
|
|
25
|
+
persistenceAvailable: true,
|
|
27
26
|
lastPersistedAtMs: 0
|
|
28
27
|
};
|
|
29
28
|
}
|
|
@@ -44,6 +43,8 @@ const RECENT_UNBOUND_WEBHOOK_ECHOES_BY_BINDING_KEY = THREAD_BINDINGS_STATE.recen
|
|
|
44
43
|
const REUSABLE_WEBHOOKS_BY_ACCOUNT_CHANNEL = THREAD_BINDINGS_STATE.reusableWebhooksByAccountChannel;
|
|
45
44
|
const PERSIST_BY_ACCOUNT_ID = THREAD_BINDINGS_STATE.persistByAccountId;
|
|
46
45
|
const THREAD_BINDING_TOUCH_PERSIST_MIN_INTERVAL_MS = 15e3;
|
|
46
|
+
const THREAD_BINDINGS_NAMESPACE = "thread-bindings";
|
|
47
|
+
const THREAD_BINDINGS_MAX_ENTRIES = 1e4;
|
|
47
48
|
function rememberThreadBindingToken(params) {
|
|
48
49
|
const normalizedAccountId = normalizeAccountId(params.accountId);
|
|
49
50
|
const token = params.token?.trim();
|
|
@@ -59,8 +60,11 @@ function getThreadBindingToken(accountId) {
|
|
|
59
60
|
function shouldDefaultPersist() {
|
|
60
61
|
return !(process.env.VITEST || false);
|
|
61
62
|
}
|
|
62
|
-
function
|
|
63
|
-
return
|
|
63
|
+
function openThreadBindingsStore() {
|
|
64
|
+
return getDiscordRuntime().state.openSyncKeyedStore({
|
|
65
|
+
namespace: THREAD_BINDINGS_NAMESPACE,
|
|
66
|
+
maxEntries: THREAD_BINDINGS_MAX_ENTRIES
|
|
67
|
+
});
|
|
64
68
|
}
|
|
65
69
|
function normalizeTargetKind(raw, targetSessionKey) {
|
|
66
70
|
if (raw === "subagent" || raw === "acp") return raw;
|
|
@@ -260,22 +264,34 @@ function shouldPersistAnyBindingState() {
|
|
|
260
264
|
return false;
|
|
261
265
|
}
|
|
262
266
|
function shouldPersistBindingMutations() {
|
|
267
|
+
if (!THREAD_BINDINGS_STATE.persistenceAvailable) return false;
|
|
263
268
|
if (shouldPersistAnyBindingState()) return true;
|
|
264
|
-
return
|
|
269
|
+
return THREAD_BINDINGS_STATE.loadedPersistentBindings;
|
|
270
|
+
}
|
|
271
|
+
function toPersistedBindingRecord(record) {
|
|
272
|
+
const serialized = JSON.stringify(record);
|
|
273
|
+
if (!serialized) return { ...record };
|
|
274
|
+
return JSON.parse(serialized);
|
|
265
275
|
}
|
|
266
276
|
function saveBindingsToDisk(params = {}) {
|
|
267
277
|
if (!params.force && !shouldPersistAnyBindingState()) return;
|
|
278
|
+
if (!THREAD_BINDINGS_STATE.persistenceAvailable) return;
|
|
268
279
|
const minIntervalMs = typeof params.minIntervalMs === "number" && Number.isFinite(params.minIntervalMs) ? Math.max(0, Math.floor(params.minIntervalMs)) : 0;
|
|
269
280
|
const now = Date.now();
|
|
270
281
|
if (!params.force && minIntervalMs > 0 && THREAD_BINDINGS_STATE.lastPersistedAtMs > 0 && now - THREAD_BINDINGS_STATE.lastPersistedAtMs < minIntervalMs) return;
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
282
|
+
try {
|
|
283
|
+
const store = openThreadBindingsStore();
|
|
284
|
+
const persistedKeys = /* @__PURE__ */ new Set();
|
|
285
|
+
for (const [bindingKey, record] of BINDINGS_BY_THREAD_ID.entries()) {
|
|
286
|
+
store.register(bindingKey, toPersistedBindingRecord(record));
|
|
287
|
+
persistedKeys.add(bindingKey);
|
|
288
|
+
}
|
|
289
|
+
for (const entry of store.entries()) if (!persistedKeys.has(entry.key)) store.delete(entry.key);
|
|
290
|
+
THREAD_BINDINGS_STATE.loadedPersistentBindings = persistedKeys.size > 0;
|
|
291
|
+
THREAD_BINDINGS_STATE.lastPersistedAtMs = now;
|
|
292
|
+
} catch {
|
|
293
|
+
THREAD_BINDINGS_STATE.persistenceAvailable = false;
|
|
294
|
+
}
|
|
279
295
|
}
|
|
280
296
|
function ensureBindingsLoaded() {
|
|
281
297
|
if (THREAD_BINDINGS_STATE.loadedBindings) return;
|
|
@@ -283,12 +299,20 @@ function ensureBindingsLoaded() {
|
|
|
283
299
|
BINDINGS_BY_THREAD_ID.clear();
|
|
284
300
|
BINDINGS_BY_SESSION_KEY.clear();
|
|
285
301
|
REUSABLE_WEBHOOKS_BY_ACCOUNT_CHANNEL.clear();
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
302
|
+
THREAD_BINDINGS_STATE.loadedPersistentBindings = false;
|
|
303
|
+
const entries = (() => {
|
|
304
|
+
try {
|
|
305
|
+
return openThreadBindingsStore().entries();
|
|
306
|
+
} catch {
|
|
307
|
+
THREAD_BINDINGS_STATE.persistenceAvailable = false;
|
|
308
|
+
return null;
|
|
309
|
+
}
|
|
310
|
+
})();
|
|
311
|
+
if (!entries) return;
|
|
312
|
+
THREAD_BINDINGS_STATE.persistenceAvailable = true;
|
|
313
|
+
THREAD_BINDINGS_STATE.loadedPersistentBindings = entries.length > 0;
|
|
314
|
+
for (const entry of entries) {
|
|
315
|
+
const normalized = normalizePersistedBinding(entry.key, entry.value);
|
|
292
316
|
if (!normalized) continue;
|
|
293
317
|
setBindingRecord(normalized);
|
|
294
318
|
}
|
|
@@ -318,7 +342,9 @@ function resetThreadBindingsForTests() {
|
|
|
318
342
|
TOKENS_BY_ACCOUNT_ID.clear();
|
|
319
343
|
PERSIST_BY_ACCOUNT_ID.clear();
|
|
320
344
|
THREAD_BINDINGS_STATE.loadedBindings = false;
|
|
345
|
+
THREAD_BINDINGS_STATE.loadedPersistentBindings = false;
|
|
346
|
+
THREAD_BINDINGS_STATE.persistenceAvailable = true;
|
|
321
347
|
THREAD_BINDINGS_STATE.lastPersistedAtMs = 0;
|
|
322
348
|
}
|
|
323
349
|
//#endregion
|
|
324
|
-
export {
|
|
350
|
+
export { shouldPersistBindingMutations as A, resolveThreadBindingIdleTimeoutMs as C, saveBindingsToDisk as D, resolveThreadBindingMaxAgeMs as E, THREAD_BINDINGS_SWEEP_INTERVAL_MS as F, toReusableWebhookKey as M, DEFAULT_THREAD_BINDING_IDLE_TIMEOUT_MS as N, setBindingRecord as O, DISCORD_UNKNOWN_CHANNEL_ERROR_CODE as P, resolveBindingRecordKey as S, resolveThreadBindingMaxAgeExpiresAt as T, rememberReusableWebhook as _, THREAD_BINDINGS_MAX_ENTRIES as a, resetThreadBindingsForTests as b, ensureBindingsLoaded as c, isRecentlyUnboundThreadWebhookMessage as d, normalizePersistedBinding as f, rememberRecentUnboundWebhookEcho as g, normalizeThreadId as h, REUSABLE_WEBHOOKS_BY_ACCOUNT_CHANNEL as i, toBindingRecordKey as j, shouldDefaultPersist as k, forgetThreadBindingToken as l, normalizeThreadBindingDurationMs as m, MANAGERS_BY_ACCOUNT_ID as n, THREAD_BINDINGS_NAMESPACE as o, normalizeTargetKind as p, PERSIST_BY_ACCOUNT_ID as r, THREAD_BINDING_TOUCH_PERSIST_MIN_INTERVAL_MS as s, BINDINGS_BY_THREAD_ID as t, getThreadBindingToken as u, rememberThreadBindingToken as v, resolveThreadBindingInactivityExpiresAt as w, resolveBindingIdsForSession as x, removeBindingRecord as y };
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/discord",
|
|
3
|
-
"version": "2026.
|
|
3
|
+
"version": "2026.6.1-beta.1",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@openclaw/discord",
|
|
9
|
-
"version": "2026.
|
|
9
|
+
"version": "2026.6.1-beta.1",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@discordjs/voice": "0.19.2",
|
|
12
12
|
"discord-api-types": "0.38.48",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"ws": "8.21.0"
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
|
-
"openclaw": ">=2026.
|
|
19
|
+
"openclaw": ">=2026.6.1-beta.1"
|
|
20
20
|
},
|
|
21
21
|
"peerDependenciesMeta": {
|
|
22
22
|
"openclaw": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/discord",
|
|
3
|
-
"version": "2026.
|
|
3
|
+
"version": "2026.6.1-beta.1",
|
|
4
4
|
"description": "OpenClaw Discord channel plugin for channels, DMs, commands, and app events.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"ws": "8.21.0"
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
|
-
"openclaw": ">=2026.
|
|
19
|
+
"openclaw": ">=2026.6.1-beta.1"
|
|
20
20
|
},
|
|
21
21
|
"peerDependenciesMeta": {
|
|
22
22
|
"openclaw": {
|
|
@@ -63,10 +63,10 @@
|
|
|
63
63
|
"allowInvalidConfigRecovery": true
|
|
64
64
|
},
|
|
65
65
|
"compat": {
|
|
66
|
-
"pluginApi": ">=2026.
|
|
66
|
+
"pluginApi": ">=2026.6.1-beta.1"
|
|
67
67
|
},
|
|
68
68
|
"build": {
|
|
69
|
-
"openclawVersion": "2026.
|
|
69
|
+
"openclawVersion": "2026.6.1-beta.1"
|
|
70
70
|
},
|
|
71
71
|
"release": {
|
|
72
72
|
"publishToClawHub": true,
|