@openclaw/discord 2026.11.3 → 2026.11.5-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/dist/.setup/{account-inspect-8cCu6uPG.mjs → account-inspect-DGkdWwix.mjs} +1 -1
- package/dist/.setup/{accounts-ljrzXBJi.mjs → accounts-C_25wyxC.mjs} +9 -6
- package/dist/.setup/{active-turn-thread-route-C4tp9noA.mjs → active-turn-thread-route-KvRTAVE3.mjs} +1 -2
- package/dist/.setup/{allow-list-BKqOldGy.mjs → allow-list-BXrS8-R9.mjs} +4 -152
- package/dist/.setup/{api-DqmMUZau.mjs → api-BlBD4ism.mjs} +10 -20
- package/dist/.setup/{approval-handler.runtime-D0qu1um7.mjs → approval-handler.runtime-BGYjX1t9.mjs} +80 -61
- package/dist/.setup/{approval-message-updates-CdurC9Ej.mjs → approval-message-updates-DKsCfxSW.mjs} +2 -2
- package/dist/.setup/{audit-ChorIwio.mjs → audit-5b-FXj9R.mjs} +4 -4
- package/dist/.setup/{channel-ZilgdF5e.mjs → channel-CWwTHWFo.mjs} +134 -202
- package/dist/.setup/channel-access-9cyzozUP.mjs +24 -0
- package/dist/.setup/channel.setup-B3MtmBQG.mjs +238 -0
- package/dist/.setup/{components-Du9NhD8h.mjs → components-YCvQ6YLS.mjs} +209 -430
- package/dist/.setup/components.base-CiS0h_XP.mjs +32 -0
- package/dist/.setup/{config-schema-_uBILpQf.mjs → config-schema-BNKN1cu5.mjs} +6 -7
- package/dist/.setup/{conversation-binding-route-8Ul1KpGF.mjs → conversation-binding-route-kCTw8cij.mjs} +2 -2
- package/dist/.setup/{directory-config-3iVub-3m.mjs → directory-config-Ble81PWH.mjs} +1 -1
- package/dist/.setup/{directory-live-BDVl2DoC.mjs → directory-live-DH3tpS3x.mjs} +52 -57
- package/dist/.setup/{discord-BMD-JiVS.mjs → discord-DGVSguhx.mjs} +1124 -1710
- package/dist/.setup/{doctor-hQKbkNKq.mjs → doctor-eujgbnpZ.mjs} +3 -5
- package/dist/.setup/endpoint-runtime-lf4DeLas.mjs +139 -0
- package/dist/.setup/guilds-eDq22iSM.mjs +22 -0
- package/dist/.setup/{handle-action-B1lmt4ms.mjs → handle-action-CktwmzMz.mjs} +15 -15
- package/dist/.setup/{handle-action.guild-admin-B6g31cwt.mjs → handle-action.guild-admin-WLQ7fRqI.mjs} +5 -5
- package/dist/.setup/listeners-Df8lx3vK.mjs +47 -0
- package/dist/.setup/{live-policy-config-C_Q966Wh.mjs → live-policy-config-DiBVuaU6.mjs} +2 -3
- package/dist/.setup/{message-handler-CkI3yMjL.mjs → message-handler-hhNSioxo.mjs} +154 -115
- package/dist/.setup/{message-handler.preflight-CEfkFV9U.mjs → message-handler.preflight-BZcZE1o-.mjs} +30 -105
- package/dist/.setup/{message-handler.preflight-pluralkit-D5si80_L.mjs → message-handler.preflight-pluralkit-CYZfXXb6.mjs} +9 -22
- package/dist/.setup/{message-handler.process-DsMtetRf.mjs → message-handler.process-B0n-mQ99.mjs} +256 -373
- package/dist/.setup/outbound-payload-BaZmjewa.mjs +447 -0
- package/dist/.setup/{outbound-session-route-BtUpGBTb.mjs → outbound-session-route-Cgx4i9cS.mjs} +139 -86
- package/dist/.setup/{preflight-audio-wWgsZG5F.mjs → preflight-audio-C6QtD6HX.mjs} +1 -5
- package/dist/.setup/{presence-cache-DCeTsL73.mjs → presence-cache-Dq-3nH7R.mjs} +1 -6
- package/dist/.setup/{probe-CBaoCs-c.mjs → probe-DezB-6xz.mjs} +5 -9
- package/dist/.setup/{provider-CI_OLfvz.mjs → provider-BN2bCIUp.mjs} +3440 -4308
- package/dist/.setup/{provider-session.runtime-TWOo_JZx.mjs → provider-session.runtime-Dr_5X43t.mjs} +3 -3
- package/dist/.setup/provider.runtime-BuJpl0Pv.mjs +1 -0
- package/dist/.setup/proxy-fetch-BzXwBAXt.mjs +30 -0
- package/dist/.setup/{realtime-session.runtime-DvfS4vJj.mjs → realtime-session.runtime-BTDWsV4d.mjs} +44 -81
- package/dist/.setup/{receive-recovery-CKvaG2Hf.mjs → receive-recovery-C3Ks4wAQ.mjs} +13 -27
- package/dist/.setup/{resolve-allowlist-common-cIjtqh2F.mjs → resolve-allowlist-common-Bk8Fj6Ik.mjs} +3 -13
- package/dist/.setup/{resolve-channels-Cj5i7hzj.mjs → resolve-channels-Bp8frXvc.mjs} +7 -8
- package/dist/.setup/{resolve-users-BQLbysRB.mjs → resolve-users-Cvcj22sG.mjs} +4 -7
- package/dist/.setup/{runtime-RWnuJgWB.mjs → runtime-BJaCvlmq.mjs} +196 -239
- package/dist/.setup/{runtime-plifsKg9.mjs → runtime-BMgTyuwg.mjs} +6 -6
- package/dist/.setup/{secret-config-contract-z6FhbT8E.mjs → secret-config-contract-B1kE4sDv.mjs} +4 -9
- package/dist/.setup/{send-da6ENJ9f.mjs → send-CVW7V-VZ.mjs} +149 -175
- package/dist/.setup/{send.components-CWZUuGvA.mjs → send.components-C8YXdnO_.mjs} +59 -71
- package/dist/.setup/{send.outbound-qZ3iK3Vq.mjs → send.outbound-Uzcmh3Yd.mjs} +76 -129
- package/dist/.setup/{send.receipt-C18khRYH.mjs → send.receipt-NZDOTZBU.mjs} +30 -32
- package/dist/.setup/{send.shared-CnlMgoqQ.mjs → send.shared-a_6Oeyg1.mjs} +38 -115
- package/dist/.setup/{sender-identity-DgbJykq0.mjs → sender-identity-76HFb8eK.mjs} +3 -9
- package/dist/.setup/setup-plugin-api-BExhGEhL.mjs +2 -0
- package/dist/.setup/shared-interactive-DmzaoKOM.mjs +316 -0
- package/dist/.setup/{shared-CY5vJM48.mjs → shared-yDUSExm2.mjs} +8 -11
- package/dist/.setup/{subagent-hooks-CIu2TFz3.mjs → subagent-hooks-CDkdHQyy.mjs} +1 -1
- package/dist/.setup/{system-events-DCOLXkwS.mjs → system-events-yfWz150v.mjs} +2 -2
- package/dist/.setup/{target-resolver-CApivu3G.mjs → target-resolver-BOOzqxxM.mjs} +3 -3
- package/dist/.setup/{thread-bindings-DcvT_JgI.mjs → thread-bindings-zce4cpu_.mjs} +12 -20
- package/dist/.setup/{thread-bindings.manager-5Sh7yedN.mjs → thread-bindings.manager-NywKzUtc.mjs} +22 -42
- package/dist/.setup/{thread-bindings.session-updates-BMdJeJMc.mjs → thread-bindings.session-updates-D0j7oh8S.mjs} +11 -18
- package/dist/.setup/{threading-CzjFeUSe.mjs → threading-DodLYDt-.mjs} +68 -105
- package/dist/.setup/{timeouts-CuNARfyw.mjs → timeouts-cIxzatmv.mjs} +1 -1
- package/dist/.setup/{transcripts-source-8RDQrSVb.mjs → transcripts-source-ie9GBWaU.mjs} +110 -179
- package/dist/.setup/{voice-runtime-BsDILmAv.mjs → voice-runtime-B7V_LTdX.mjs} +231 -452
- package/dist/.source-module-urls/d6c089460280c5a04184542d6712e04545caeb1ebb290d3504377b4cc5e22fea.json +1 -0
- package/dist/account-inspect-api.js +1 -1
- package/dist/action-runtime-api.js +1 -2
- package/dist/activities-api.js +286 -341
- package/dist/api.js +16 -16
- package/dist/channel-config-api.js +1 -2
- package/dist/channel-plugin-api.js +1 -2
- package/dist/contract-api.js +1 -2
- package/dist/directory-contract-api.js +1 -1
- package/dist/runtime-api.js +22 -22
- package/dist/runtime-setter-api.js +1 -2
- package/dist/secret-contract-api.js +1 -2
- package/dist/security-audit-contract-api.js +1 -2
- package/dist/security-contract-api.js +1 -2
- package/dist/session-key-api.js +1 -2
- package/dist/setup-entry.js +1 -1
- package/dist/setup-plugin-api.js +1 -2
- package/dist/src/voice/audio-worker.runtime.js +56 -68
- package/dist/subagent-hooks-api.js +1 -1
- package/dist/thread-binding-api.js +1 -2
- package/dist/transcripts-source-api.js +1 -1
- package/node_modules/@napi-rs/wasm-runtime/dist/fs.js +3339 -4021
- package/node_modules/@napi-rs/wasm-runtime/package.json +1 -1
- package/node_modules/@types/lodash/README.md +1 -1
- package/node_modules/@types/lodash/common/function.d.ts +2 -2
- package/node_modules/@types/lodash/package.json +2 -2
- package/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/node/package.json +2 -2
- package/node_modules/@types/node/util.d.ts +6 -3
- package/node_modules/discord-api-types/package.json +4 -4
- package/node_modules/discord-api-types/rest/v10/index.d.ts +8 -0
- package/node_modules/discord-api-types/rest/v10/index.d.ts.map +1 -1
- package/node_modules/discord-api-types/rest/v10/index.js +8 -0
- package/node_modules/discord-api-types/rest/v10/index.js.map +1 -1
- package/node_modules/discord-api-types/rest/v10/oauth2.d.ts +26 -2
- package/node_modules/discord-api-types/rest/v10/oauth2.d.ts.map +1 -1
- package/node_modules/discord-api-types/rest/v9/index.d.ts +8 -0
- package/node_modules/discord-api-types/rest/v9/index.d.ts.map +1 -1
- package/node_modules/discord-api-types/rest/v9/index.js +8 -0
- package/node_modules/discord-api-types/rest/v9/index.js.map +1 -1
- package/node_modules/discord-api-types/rest/v9/oauth2.d.ts +26 -2
- package/node_modules/discord-api-types/rest/v9/oauth2.d.ts.map +1 -1
- package/node_modules/typebox/build/format/duration.d.mts +2 -2
- package/node_modules/typebox/build/format/duration.mjs +2 -2
- package/node_modules/typebox/build/format/idn_email.d.mts +1 -0
- package/node_modules/typebox/build/format/idn_email.mjs +1 -0
- package/node_modules/typebox/build/format/idn_hostname.d.mts +1 -1
- package/node_modules/typebox/build/format/idn_hostname.mjs +1 -1
- package/node_modules/typebox/build/format/ipv4.d.mts +2 -2
- package/node_modules/typebox/build/format/ipv4.mjs +2 -2
- package/node_modules/typebox/build/format/ipv6.d.mts +1 -1
- package/node_modules/typebox/build/format/ipv6.mjs +1 -1
- package/node_modules/typebox/build/format/relative_json_pointer.d.mts +2 -2
- package/node_modules/typebox/build/format/relative_json_pointer.mjs +2 -2
- package/node_modules/typebox/build/schema/build.mjs +1 -0
- package/node_modules/typebox/build/schema/engine/_unique.d.mts +4 -2
- package/node_modules/typebox/build/schema/engine/_unique.mjs +7 -3
- package/node_modules/typebox/build/schema/engine/additionalItems.mjs +3 -3
- package/node_modules/typebox/build/schema/engine/additionalProperties.d.mts +0 -3
- package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +15 -17
- package/node_modules/typebox/build/schema/engine/contains.mjs +3 -3
- package/node_modules/typebox/build/schema/engine/index.d.mts +1 -0
- package/node_modules/typebox/build/schema/engine/index.mjs +1 -0
- package/node_modules/typebox/build/schema/engine/items.mjs +7 -4
- package/node_modules/typebox/build/schema/engine/maxContains.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/minContains.mjs +3 -3
- package/node_modules/typebox/build/schema/engine/oneOf.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/patternProperties.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/propertyNames.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/unevaluatedItems.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/unevaluatedProperties.mjs +2 -2
- package/node_modules/typebox/build/system/hashing/hash.mjs +63 -34
- package/node_modules/typebox/build/system/locale/en_US.mjs +2 -1
- package/node_modules/typebox/build/system/memory/assign.d.mts +2 -8
- package/node_modules/typebox/build/system/memory/assign.mjs +13 -6
- package/node_modules/typebox/build/system/memory/clone.d.mts +4 -5
- package/node_modules/typebox/build/system/memory/clone.mjs +8 -96
- package/node_modules/typebox/build/system/memory/create.d.mts +1 -5
- package/node_modules/typebox/build/system/memory/create.mjs +18 -13
- package/node_modules/typebox/build/system/memory/deep.d.mts +2 -0
- package/node_modules/typebox/build/system/memory/deep.mjs +108 -0
- package/node_modules/typebox/build/system/memory/discard.d.mts +1 -1
- package/node_modules/typebox/build/system/memory/discard.mjs +9 -8
- package/node_modules/typebox/build/system/memory/finalize.d.mts +4 -0
- package/node_modules/typebox/build/system/memory/finalize.mjs +30 -0
- package/node_modules/typebox/build/system/memory/keys.d.mts +2 -0
- package/node_modules/typebox/build/system/memory/keys.mjs +8 -0
- package/node_modules/typebox/build/system/memory/update.d.mts +1 -4
- package/node_modules/typebox/build/system/memory/update.mjs +43 -16
- package/node_modules/typebox/build/type/engine/call/index.d.mts +1 -0
- package/node_modules/typebox/build/type/engine/call/index.mjs +1 -0
- package/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +2 -24
- package/node_modules/typebox/build/type/engine/evaluate/composite.mjs +2 -29
- package/node_modules/typebox/build/type/engine/evaluate/index.d.mts +1 -0
- package/node_modules/typebox/build/type/engine/evaluate/index.mjs +1 -0
- package/node_modules/typebox/build/type/engine/evaluate/narrow.d.mts +5 -1
- package/node_modules/typebox/build/type/engine/evaluate/narrow.mjs +6 -1
- package/node_modules/typebox/build/type/engine/evaluate/property.d.mts +30 -0
- package/node_modules/typebox/build/type/engine/evaluate/property.mjs +29 -0
- package/node_modules/typebox/build/type/engine/immutable/instantiate_add.d.mts +1 -3
- package/node_modules/typebox/build/type/engine/immutable/instantiate_add.mjs +1 -4
- package/node_modules/typebox/build/type/engine/object/from_intersect.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/object/from_intersect.mjs +2 -2
- package/node_modules/typebox/build/type/engine/object/from_union.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/object/from_union.mjs +2 -2
- package/node_modules/typebox/build/type/engine/optional/instantiate_add.d.mts +1 -3
- package/node_modules/typebox/build/type/engine/optional/instantiate_add.mjs +1 -4
- package/node_modules/typebox/build/type/engine/readonly/instantiate_add.d.mts +1 -3
- package/node_modules/typebox/build/type/engine/readonly/instantiate_add.mjs +1 -4
- package/node_modules/typebox/build/type/engine/this/index.d.mts +1 -0
- package/node_modules/typebox/build/type/engine/this/index.mjs +1 -0
- package/node_modules/typebox/build/value/clone/clone.d.mts +4 -3
- package/node_modules/typebox/build/value/clone/clone.mjs +5 -7
- package/node_modules/typebox/build/value/repair/from_cyclic.d.mts +2 -0
- package/node_modules/typebox/build/value/repair/from_cyclic.mjs +6 -0
- package/node_modules/typebox/build/value/shared/union_priority_sort.mjs +25 -14
- package/node_modules/typebox/package.json +1 -1
- package/node_modules/typebox/readme.md +1 -1
- package/node_modules/undici/docs/docs/api/Interceptors.md +15 -2
- package/node_modules/undici/lib/dispatcher/client-h2.js +78 -3
- package/node_modules/undici/lib/dispatcher/pool-base.js +20 -3
- package/node_modules/undici/package.json +3 -3
- package/node_modules/undici/types/api.d.ts +1 -1
- package/node_modules/undici/types/utility.d.ts +4 -4
- package/node_modules/uuid/package.json +17 -17
- package/node_modules/zod/package.json +1 -1
- package/node_modules/zod/src/v4/classic/tests/array.test.ts +27 -0
- package/node_modules/zod/src/v4/classic/tests/map.test.ts +7 -0
- package/node_modules/zod/src/v4/classic/tests/set.test.ts +6 -0
- package/node_modules/zod/src/v4/core/compile.ts +9 -0
- package/node_modules/zod/src/v4/core/schemas.ts +35 -1
- package/node_modules/zod/src/v4/core/util.ts +13 -0
- package/node_modules/zod/src/v4/core/versions.ts +1 -1
- package/node_modules/zod/v4/core/compile.cjs +8 -0
- package/node_modules/zod/v4/core/compile.js +8 -0
- package/node_modules/zod/v4/core/schemas.cjs +30 -0
- package/node_modules/zod/v4/core/schemas.d.cts +3 -1
- package/node_modules/zod/v4/core/schemas.d.ts +3 -1
- package/node_modules/zod/v4/core/schemas.js +30 -0
- package/node_modules/zod/v4/core/util.cjs +15 -0
- package/node_modules/zod/v4/core/util.d.cts +2 -0
- package/node_modules/zod/v4/core/util.d.ts +2 -0
- package/node_modules/zod/v4/core/util.js +14 -0
- package/node_modules/zod/v4/core/versions.cjs +1 -1
- package/node_modules/zod/v4/core/versions.js +1 -1
- package/openclaw.plugin.json +1 -31
- package/package.json +8 -8
- package/dist/.setup/channel-access-DasWY_OV.mjs +0 -48
- package/dist/.setup/channel.setup-DaDQdctj.mjs +0 -249
- package/dist/.setup/outbound-adapter-DfAanoCO.mjs +0 -543
- package/dist/.setup/provider.runtime-DnionCyo.mjs +0 -2
- package/dist/.setup/setup-plugin-api-D1QuM187.mjs +0 -3
- package/dist/.setup/targets-UWWZ6gF7.mjs +0 -3
- package/node_modules/typebox/build/system/memory/freeze.d.mts +0 -4
- package/node_modules/typebox/build/system/memory/freeze.mjs +0 -6
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { c as resolveDefaultDiscordAccountId, f as resolveDiscordAccountDisabledReason, i as listDiscordAccountIds, l as resolveDiscordAccount, p as resolveDiscordAccountDmPolicy, r as isDiscordAccountEnabledForRuntime, s as mergeDiscordAccountConfig, u as resolveDiscordAccountAllowFrom } from "./accounts-
|
|
2
|
-
import { t as inspectDiscordAccount } from "./account-inspect-
|
|
1
|
+
import { c as resolveDefaultDiscordAccountId, f as resolveDiscordAccountDisabledReason, i as listDiscordAccountIds, l as resolveDiscordAccount, p as resolveDiscordAccountDmPolicy, r as isDiscordAccountEnabledForRuntime, s as mergeDiscordAccountConfig, u as resolveDiscordAccountAllowFrom } from "./accounts-C_25wyxC.mjs";
|
|
2
|
+
import { t as inspectDiscordAccount } from "./account-inspect-DGkdWwix.mjs";
|
|
3
3
|
import { t as parseDiscordTarget } from "./target-parsing-C-HyNxcE.mjs";
|
|
4
|
-
import { n as discordIngressIdentity, t as selectDiscordLivePolicyConfig } from "./live-policy-config-
|
|
5
|
-
import { t as DiscordChannelConfigSchema } from "./config-schema-
|
|
4
|
+
import { n as discordIngressIdentity, t as selectDiscordLivePolicyConfig } from "./live-policy-config-DiBVuaU6.mjs";
|
|
5
|
+
import { t as DiscordChannelConfigSchema } from "./config-schema-BNKN1cu5.mjs";
|
|
6
6
|
import { n as normalizeCompatibilityConfig } from "./doctor-contract-Bwv8EuQ_.mjs";
|
|
7
|
-
import { r as secretTargetRegistryEntries, t as collectRuntimeConfigAssignments } from "./secret-config-contract-
|
|
7
|
+
import { r as secretTargetRegistryEntries, t as collectRuntimeConfigAssignments } from "./secret-config-contract-B1kE4sDv.mjs";
|
|
8
8
|
import { n as unsupportedSecretRefSurfacePatterns, t as collectUnsupportedSecretRefConfigCandidates } from "./security-contract-DNyyjTZZ.mjs";
|
|
9
9
|
import { t as deriveLegacySessionChatType } from "./session-contract-BO5tlIdl.mjs";
|
|
10
10
|
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
@@ -94,19 +94,16 @@ const discordSetupContract = defineChannelSetupContract({
|
|
|
94
94
|
legacyAdapter: discordSetupAdapter
|
|
95
95
|
});
|
|
96
96
|
//#endregion
|
|
97
|
-
//#region extensions/discord/src/doctor-shared.ts
|
|
98
|
-
const DISCORD_LEGACY_CONFIG_RULES = [];
|
|
99
|
-
//#endregion
|
|
100
97
|
//#region extensions/discord/src/shared.ts
|
|
101
98
|
const DISCORD_CHANNEL = "discord";
|
|
102
99
|
const livePolicyConfigPrefixes = Object.keys(selectDiscordLivePolicyConfig({})).flatMap((key) => [`channels.discord.${key}`, `channels.discord.accounts.*.${key}`]);
|
|
103
|
-
const loadDiscordDoctorModule = createLazyRuntimeModule(() => import("./doctor-
|
|
100
|
+
const loadDiscordDoctorModule = createLazyRuntimeModule(() => import("./doctor-eujgbnpZ.mjs"));
|
|
104
101
|
const discordDoctor = {
|
|
105
102
|
dmAllowFromMode: "topOnly",
|
|
106
103
|
groupModel: "route",
|
|
107
104
|
groupAllowFromFallbackToAllowFrom: false,
|
|
108
105
|
warnOnEmptyGroupSenderAllowlist: false,
|
|
109
|
-
legacyConfigRules:
|
|
106
|
+
legacyConfigRules: [],
|
|
110
107
|
normalizeCompatibilityConfig,
|
|
111
108
|
collectPreviewWarnings: async (params) => (await loadDiscordDoctorModule()).discordDoctor.collectPreviewWarnings?.(params) ?? [],
|
|
112
109
|
collectMutableAllowlistWarnings: async (params) => (await loadDiscordDoctorModule()).discordDoctor.collectMutableAllowlistWarnings?.(params) ?? [],
|
|
@@ -227,4 +224,4 @@ function createDiscordPluginBase(params) {
|
|
|
227
224
|
};
|
|
228
225
|
}
|
|
229
226
|
//#endregion
|
|
230
|
-
export { discordSecurityAdapter as
|
|
227
|
+
export { discordSecurityAdapter as i, discordConfigAdapter as n, discordSetupContract as r, createDiscordPluginBase as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.mjs";
|
|
2
|
-
import { d as unbindThreadBindingsBySessionKeyAsync, o as listThreadBindingsBySessionKey, s as listThreadBindingsBySessionKeyAsync } from "./thread-bindings-
|
|
2
|
+
import { d as unbindThreadBindingsBySessionKeyAsync, o as listThreadBindingsBySessionKey, s as listThreadBindingsBySessionKeyAsync } from "./thread-bindings-zce4cpu_.mjs";
|
|
3
3
|
import { normalizeOptionalLowercaseString, normalizeOptionalStringifiedId } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
4
|
import { warnPluginSdkDeprecation } from "openclaw/plugin-sdk/thread-bindings-session-runtime";
|
|
5
5
|
//#region extensions/discord/src/subagent-hooks.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { t as discord_exports } from "./discord-DGVSguhx.mjs";
|
|
2
|
+
import { S as formatDiscordUserTag } from "./allow-list-BXrS8-R9.mjs";
|
|
3
3
|
//#region extensions/discord/src/monitor/system-events.ts
|
|
4
4
|
const SYSTEM_EVENT_ACTIONS = /* @__PURE__ */ new Map([
|
|
5
5
|
[discord_exports.MessageType.ChannelPinnedMessage, "pinned a message"],
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.mjs";
|
|
2
|
-
import { l as resolveDiscordAccount, u as resolveDiscordAccountAllowFrom } from "./accounts-
|
|
3
|
-
import {
|
|
4
|
-
import { o as rememberDiscordDirectoryUser, r as listDiscordDirectoryPeersLive } from "./directory-live-
|
|
2
|
+
import { l as resolveDiscordAccount, u as resolveDiscordAccountAllowFrom } from "./accounts-C_25wyxC.mjs";
|
|
3
|
+
import { a as allowFromContainsDiscordUserId } from "./send.receipt-NZDOTZBU.mjs";
|
|
4
|
+
import { o as rememberDiscordDirectoryUser, r as listDiscordDirectoryPeersLive } from "./directory-live-DH3tpS3x.mjs";
|
|
5
5
|
import { t as parseDiscordTarget } from "./target-parsing-C-HyNxcE.mjs";
|
|
6
6
|
import { buildMessagingTarget } from "openclaw/plugin-sdk/channel-targets";
|
|
7
7
|
//#region extensions/discord/src/target-resolver.ts
|
|
@@ -1,31 +1,23 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.mjs";
|
|
2
2
|
import { t as parseDiscordTarget } from "./target-parsing-C-HyNxcE.mjs";
|
|
3
|
-
import "./
|
|
4
|
-
import {
|
|
5
|
-
import { c as resolveThreadBindingPersonaFromRecord, i as createNoopThreadBindingManager, n as getThreadBindingManager, o as resolveChannelIdForBinding, s as resolveThreadBindingPersona, t as createThreadBindingManager } from "./thread-bindings.manager-5Sh7yedN.mjs";
|
|
6
|
-
import { normalizeAccountId } from "openclaw/plugin-sdk/routing";
|
|
3
|
+
import { D as refreshUnboundThreadWebhookIdentity, F as resolveThreadBindingMaxAgeMs, M as resolveThreadBindingIdleTimeoutMs, N as resolveThreadBindingInactivityExpiresAt, P as resolveThreadBindingMaxAgeExpiresAt, S as ensureBindingsLoadedAsync, _ as MANAGERS_BY_ACCOUNT_ID, a as mutateBindingsForTargetSession, g as BINDINGS_BY_THREAD_ID, i as setThreadBindingMaxAgeBySessionKeyAsync, n as setThreadBindingIdleTimeoutBySessionKeyAsync, o as resolveBindingIdsForTargetSession, r as setThreadBindingMaxAgeBySessionKey, t as setThreadBindingIdleTimeoutBySessionKey, u as removeBindingRecordSync, w as getThreadBindingToken, x as ensureBindingsLoaded } from "./thread-bindings.session-updates-D0j7oh8S.mjs";
|
|
4
|
+
import { c as resolveThreadBindingPersonaFromRecord, i as createNoopThreadBindingManager, n as getThreadBindingManager, o as resolveChannelIdForBinding, s as resolveThreadBindingPersona, t as createThreadBindingManager } from "./thread-bindings.manager-NywKzUtc.mjs";
|
|
7
5
|
import { normalizeOptionalLowercaseString, normalizeOptionalString, normalizeOptionalStringifiedId, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
8
|
-
import {
|
|
6
|
+
import { runTasksWithConcurrency } from "openclaw/plugin-sdk/concurrency-runtime";
|
|
7
|
+
import { formatThreadBindingDurationLabel as formatThreadBindingDurationLabel$1, resolveThreadBindingIdleTimeoutMsForChannel, resolveThreadBindingIntroText, resolveThreadBindingIntroText as resolveThreadBindingIntroText$1, resolveThreadBindingMaxAgeMsForChannel, resolveThreadBindingThreadName, resolveThreadBindingThreadName as resolveThreadBindingThreadName$1, resolveThreadBindingsEnabled } from "openclaw/plugin-sdk/conversation-runtime";
|
|
9
8
|
import { warnPluginSdkDeprecation } from "openclaw/plugin-sdk/thread-bindings-session-runtime";
|
|
10
9
|
import { prepareAcpSessionEntryRead, readAcpSessionEntryAsync, rethrowIncognitoSessionError } from "openclaw/plugin-sdk/acp-runtime";
|
|
11
|
-
import { runTasksWithConcurrency } from "openclaw/plugin-sdk/concurrency-runtime";
|
|
12
10
|
//#region extensions/discord/src/monitor/thread-bindings.config.ts
|
|
13
11
|
function resolveDiscordThreadBindingIdleTimeoutMs(params) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
return resolveThreadBindingIdleTimeoutMs({
|
|
18
|
-
channelIdleHoursRaw: account?.idleHours ?? root?.idleHours,
|
|
19
|
-
sessionIdleHoursRaw: params.cfg.session?.threadBindings?.idleHours
|
|
12
|
+
return resolveThreadBindingIdleTimeoutMsForChannel({
|
|
13
|
+
...params,
|
|
14
|
+
channel: "discord"
|
|
20
15
|
});
|
|
21
16
|
}
|
|
22
17
|
function resolveDiscordThreadBindingMaxAgeMs(params) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
return resolveThreadBindingMaxAgeMs({
|
|
27
|
-
channelMaxAgeHoursRaw: account?.maxAgeHours ?? root?.maxAgeHours,
|
|
28
|
-
sessionMaxAgeHoursRaw: params.cfg.session?.threadBindings?.maxAgeHours
|
|
18
|
+
return resolveThreadBindingMaxAgeMsForChannel({
|
|
19
|
+
...params,
|
|
20
|
+
channel: "discord"
|
|
29
21
|
});
|
|
30
22
|
}
|
|
31
23
|
//#endregion
|
|
@@ -247,11 +239,11 @@ var thread_bindings_exports = /* @__PURE__ */ __exportAll({
|
|
|
247
239
|
reconcileAcpThreadBindingsOnStartup: () => reconcileAcpThreadBindingsOnStartup,
|
|
248
240
|
resolveDiscordThreadBindingIdleTimeoutMs: () => resolveDiscordThreadBindingIdleTimeoutMs,
|
|
249
241
|
resolveDiscordThreadBindingMaxAgeMs: () => resolveDiscordThreadBindingMaxAgeMs,
|
|
250
|
-
resolveThreadBindingIdleTimeoutMs: () => resolveThreadBindingIdleTimeoutMs
|
|
242
|
+
resolveThreadBindingIdleTimeoutMs: () => resolveThreadBindingIdleTimeoutMs,
|
|
251
243
|
resolveThreadBindingInactivityExpiresAt: () => resolveThreadBindingInactivityExpiresAt,
|
|
252
244
|
resolveThreadBindingIntroText: () => resolveThreadBindingIntroText$1,
|
|
253
245
|
resolveThreadBindingMaxAgeExpiresAt: () => resolveThreadBindingMaxAgeExpiresAt,
|
|
254
|
-
resolveThreadBindingMaxAgeMs: () => resolveThreadBindingMaxAgeMs
|
|
246
|
+
resolveThreadBindingMaxAgeMs: () => resolveThreadBindingMaxAgeMs,
|
|
255
247
|
resolveThreadBindingPersona: () => resolveThreadBindingPersona,
|
|
256
248
|
resolveThreadBindingPersonaFromRecord: () => resolveThreadBindingPersonaFromRecord,
|
|
257
249
|
resolveThreadBindingThreadName: () => resolveThreadBindingThreadName$1,
|
package/dist/.setup/{thread-bindings.manager-5Sh7yedN.mjs → thread-bindings.manager-NywKzUtc.mjs}
RENAMED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { p as canFallbackDiscordWebhookSend } from "./send.receipt-
|
|
2
|
+
import { N as createDiscordRestClient } from "./send.shared-a_6Oeyg1.mjs";
|
|
3
|
+
import { O as getChannel, q as withDiscordRequestAuthority, t as discord_exports, z as DiscordError } from "./discord-DGVSguhx.mjs";
|
|
4
|
+
import { w as isDiscordThreadChannelType } from "./allow-list-BXrS8-R9.mjs";
|
|
5
|
+
import { p as canFallbackDiscordWebhookSend } from "./send.receipt-NZDOTZBU.mjs";
|
|
6
6
|
import { n as resolveDiscordChannelId } from "./target-parsing-C-HyNxcE.mjs";
|
|
7
|
-
import { c as sendWebhookMessageDiscord, u as createThreadDiscord } from "./send-
|
|
8
|
-
import { t as sendMessageDiscord } from "./send.outbound-
|
|
9
|
-
import { A as
|
|
10
|
-
import {
|
|
7
|
+
import { c as sendWebhookMessageDiscord, u as createThreadDiscord } from "./send-CVW7V-VZ.mjs";
|
|
8
|
+
import { t as sendMessageDiscord } from "./send.outbound-Uzcmh3Yd.mjs";
|
|
9
|
+
import { A as resolveBindingRecordKey, C as forgetThreadBindingToken, D as refreshUnboundThreadWebhookIdentity, E as normalizeThreadBindingDurationMs, F as resolveThreadBindingMaxAgeMs, I as shouldDefaultPersist, L as toBindingRecordKey, M as resolveThreadBindingIdleTimeoutMs, O as rememberThreadBindingToken, R as toReusableWebhookKey, S as ensureBindingsLoadedAsync, T as normalizeTargetKind, _ as MANAGERS_BY_ACCOUNT_ID, b as THREAD_BINDING_TOUCH_PERSIST_MIN_INTERVAL_MS, c as drainThreadBindingAccountOperations, d as runThreadBindingAccountOperation, f as runThreadBindingMutation, g as BINDINGS_BY_THREAD_ID, h as updateBindingRecordSync, j as resolvePreparedThreadBindingLifecycle, k as resolveBindingIdsForSession, l as drainThreadBindingMutations, m as snapshotThreadBindingMetadata, p as shouldPersistAnyBindingState, s as commitBindingRecord, v as PERSIST_BY_ACCOUNT_ID, w as getThreadBindingToken, y as REUSABLE_WEBHOOKS_BY_ACCOUNT_CHANNEL } from "./thread-bindings.session-updates-D0j7oh8S.mjs";
|
|
10
|
+
import { t as resolveDiscordChannelInfoSafe } from "./channel-access-9cyzozUP.mjs";
|
|
11
|
+
import { coerceErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
11
12
|
import { createSubsystemLogger, logVerbose } from "openclaw/plugin-sdk/runtime-env";
|
|
12
13
|
import { normalizeAccountId } from "openclaw/plugin-sdk/routing";
|
|
13
|
-
import { normalizeOptionalString, normalizeOptionalStringifiedId } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
14
|
+
import { asNonArrayRecord, normalizeOptionalString, normalizeOptionalStringifiedId } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
14
15
|
import { getRuntimeConfigSnapshot } from "openclaw/plugin-sdk/runtime-config-snapshot";
|
|
15
|
-
import { parseStrictNonNegativeInteger as parseStrictNonNegativeInteger$1 } from "openclaw/plugin-sdk/number-runtime";
|
|
16
16
|
import { SYSTEM_MARK } from "openclaw/plugin-sdk/text-chunking";
|
|
17
17
|
import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
18
18
|
import { resolveThreadBindingFarewellText, resolveThreadBindingThreadName, unregisterSessionBindingAdapter } from "openclaw/plugin-sdk/conversation-runtime";
|
|
@@ -51,16 +51,11 @@ function normalizeDiscordBindingChannelId(raw) {
|
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
function summarizeDiscordError(err) {
|
|
54
|
-
if (err instanceof Error) return err
|
|
55
|
-
if (typeof err === "string" || typeof err === "number" || typeof err === "boolean" || typeof err === "bigint" || typeof err === "symbol") return String(err);
|
|
54
|
+
if (err instanceof Error || err != null && typeof err !== "object" && typeof err !== "function") return coerceErrorMessage(err);
|
|
56
55
|
return "error";
|
|
57
56
|
}
|
|
58
57
|
function isDiscordThreadGoneError(err) {
|
|
59
|
-
|
|
60
|
-
const candidate = err;
|
|
61
|
-
if ((parseStrictNonNegativeInteger$1(candidate.code) ?? parseStrictNonNegativeInteger$1(candidate.rawError?.code) ?? parseStrictNonNegativeInteger$1(candidate.body?.code) ?? parseStrictNonNegativeInteger$1(candidate.response?.body?.code) ?? parseStrictNonNegativeInteger$1(candidate.response?.data?.code)) === 10003) return true;
|
|
62
|
-
const status = parseStrictNonNegativeInteger$1(candidate.status) ?? parseStrictNonNegativeInteger$1(candidate.statusCode) ?? parseStrictNonNegativeInteger$1(candidate.response?.status);
|
|
63
|
-
return status === 404 || status === 403;
|
|
58
|
+
return err instanceof DiscordError && (err.discordCode === 10003 || err.status === 404 || err.status === 403);
|
|
64
59
|
}
|
|
65
60
|
async function maybeSendBindingMessage(params) {
|
|
66
61
|
const assertCurrent = params.assertCurrent;
|
|
@@ -111,12 +106,13 @@ async function createWebhookForChannel(params) {
|
|
|
111
106
|
accountId: params.accountId,
|
|
112
107
|
token: params.token
|
|
113
108
|
}).rest;
|
|
114
|
-
const
|
|
109
|
+
const rawCreated = await withDiscordRequestAuthority(assertCreateAllowed, () => {
|
|
115
110
|
assertCreateAllowed?.();
|
|
116
|
-
return
|
|
111
|
+
return rest.post(discord_exports.Routes.channelWebhooks(params.channelId), { body: { name: "OpenClaw Agents" } });
|
|
117
112
|
});
|
|
118
|
-
const
|
|
119
|
-
const
|
|
113
|
+
const created = asNonArrayRecord(rawCreated);
|
|
114
|
+
const webhookId = normalizeOptionalString(created.id) ?? "";
|
|
115
|
+
const webhookToken = normalizeOptionalString(created.token) ?? "";
|
|
120
116
|
if (!webhookId || !webhookToken) return {};
|
|
121
117
|
return {
|
|
122
118
|
webhookId,
|
|
@@ -128,21 +124,7 @@ async function createWebhookForChannel(params) {
|
|
|
128
124
|
}
|
|
129
125
|
}
|
|
130
126
|
function findReusableWebhook(params) {
|
|
131
|
-
|
|
132
|
-
const cached = REUSABLE_WEBHOOKS_BY_ACCOUNT_CHANNEL.get(reusableKey);
|
|
133
|
-
if (cached) return {
|
|
134
|
-
webhookId: cached.webhookId,
|
|
135
|
-
webhookToken: cached.webhookToken
|
|
136
|
-
};
|
|
137
|
-
for (const record of BINDINGS_BY_THREAD_ID.values()) {
|
|
138
|
-
if (record.accountId !== params.accountId || record.channelId !== params.channelId || !record.webhookId || !record.webhookToken) continue;
|
|
139
|
-
rememberReusableWebhook(record);
|
|
140
|
-
return {
|
|
141
|
-
webhookId: record.webhookId,
|
|
142
|
-
webhookToken: record.webhookToken
|
|
143
|
-
};
|
|
144
|
-
}
|
|
145
|
-
return {};
|
|
127
|
+
return REUSABLE_WEBHOOKS_BY_ACCOUNT_CHANNEL.get(toReusableWebhookKey(params)) ?? {};
|
|
146
128
|
}
|
|
147
129
|
async function resolveChannelIdForBinding(params) {
|
|
148
130
|
const explicit = normalizeDiscordBindingChannelId(params.channelId);
|
|
@@ -157,7 +139,7 @@ async function resolveChannelIdForBinding(params) {
|
|
|
157
139
|
}).rest;
|
|
158
140
|
const channel = await getChannel(rest, lookupThreadId);
|
|
159
141
|
const channelInfo = resolveDiscordChannelInfoSafe(channel);
|
|
160
|
-
const channelId = normalizeOptionalString(
|
|
142
|
+
const channelId = normalizeOptionalString(channelInfo.id) ?? "";
|
|
161
143
|
const type = channelInfo.type;
|
|
162
144
|
const parentId = normalizeOptionalString(channelInfo.parentId) ?? "";
|
|
163
145
|
if (parentId && isDiscordThreadChannelType(type)) return parentId;
|
|
@@ -320,7 +302,6 @@ function createNoopThreadBindingManager(accountIdRaw) {
|
|
|
320
302
|
getIdleTimeoutMs: () => DEFAULT_THREAD_BINDING_IDLE_TIMEOUT_MS,
|
|
321
303
|
getMaxAgeMs: () => 0,
|
|
322
304
|
getByThreadId: () => void 0,
|
|
323
|
-
getBySessionKey: () => void 0,
|
|
324
305
|
listBySessionKey: () => [],
|
|
325
306
|
listBindings: () => [],
|
|
326
307
|
touchThread: async () => null,
|
|
@@ -513,11 +494,11 @@ function createLoadedThreadBindingManager(params) {
|
|
|
513
494
|
text: resolveThreadBindingFarewellText({
|
|
514
495
|
reason: notification.reason,
|
|
515
496
|
farewellText: notification.farewellText,
|
|
516
|
-
idleTimeoutMs: resolveThreadBindingIdleTimeoutMs
|
|
497
|
+
idleTimeoutMs: resolveThreadBindingIdleTimeoutMs({
|
|
517
498
|
record: removed,
|
|
518
499
|
defaultIdleTimeoutMs: idleTimeoutMs
|
|
519
500
|
}),
|
|
520
|
-
maxAgeMs: resolveThreadBindingMaxAgeMs
|
|
501
|
+
maxAgeMs: resolveThreadBindingMaxAgeMs({
|
|
521
502
|
record: removed,
|
|
522
503
|
defaultMaxAgeMs: maxAgeMs
|
|
523
504
|
})
|
|
@@ -528,7 +509,6 @@ function createLoadedThreadBindingManager(params) {
|
|
|
528
509
|
getIdleTimeoutMs: () => idleTimeoutMs,
|
|
529
510
|
getMaxAgeMs: () => maxAgeMs,
|
|
530
511
|
getByThreadId: (threadId) => getBinding(threadId)?.record,
|
|
531
|
-
getBySessionKey: (targetSessionKey) => manager.listBySessionKey(targetSessionKey)[0],
|
|
532
512
|
listBySessionKey: (targetSessionKey) => resolveBindingIdsForSession({
|
|
533
513
|
targetSessionKey,
|
|
534
514
|
accountId
|
|
@@ -760,7 +740,7 @@ function createLoadedThreadBindingManager(params) {
|
|
|
760
740
|
sweepPromise = void 0;
|
|
761
741
|
});
|
|
762
742
|
}, THREAD_BINDINGS_SWEEP_INTERVAL_MS);
|
|
763
|
-
if (shouldDefaultPersist()) sweepTimer.unref
|
|
743
|
+
if (shouldDefaultPersist()) sweepTimer.unref();
|
|
764
744
|
}
|
|
765
745
|
const sessionBindingAdapter = createThreadBindingSessionAdapter({
|
|
766
746
|
accountId,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { J as stripUndefinedFields } from "./discord-DGVSguhx.mjs";
|
|
1
2
|
import { t as getDiscordRuntime } from "./runtime-DgnVQ7zW.mjs";
|
|
2
3
|
import { logVerbose } from "openclaw/plugin-sdk/runtime-env";
|
|
3
4
|
import { normalizeAccountId, resolveAgentIdFromSessionKey } from "openclaw/plugin-sdk/routing";
|
|
@@ -6,6 +7,7 @@ import { resolveNonNegativeIntegerOption, resolveOptionalIntegerOption } from "o
|
|
|
6
7
|
import { resolveGlobalSingleton } from "openclaw/plugin-sdk/global-singleton";
|
|
7
8
|
import { createPluginStateErrorReporter } from "openclaw/plugin-sdk/plugin-state-runtime";
|
|
8
9
|
import { resolveThreadBindingExpiry, warnPluginSdkDeprecation } from "openclaw/plugin-sdk/thread-bindings-session-runtime";
|
|
10
|
+
import { enqueueKeyedTask } from "openclaw/plugin-sdk/keyed-async-queue";
|
|
9
11
|
import { recordOutboundMessageIdentity } from "openclaw/plugin-sdk/outbound-echo-runtime";
|
|
10
12
|
//#region extensions/discord/src/monitor/thread-bindings.state.ts
|
|
11
13
|
const THREAD_BINDINGS_STATE_KEY = Symbol.for("openclaw.discordThreadBindingsState");
|
|
@@ -26,7 +28,6 @@ function createThreadBindingsGlobalState() {
|
|
|
26
28
|
};
|
|
27
29
|
}
|
|
28
30
|
const THREAD_BINDINGS_STATE = resolveGlobalSingleton(THREAD_BINDINGS_STATE_KEY, createThreadBindingsGlobalState);
|
|
29
|
-
THREAD_BINDINGS_STATE.accountOperationTails ??= /* @__PURE__ */ new WeakMap();
|
|
30
31
|
const MANAGERS_BY_ACCOUNT_ID = THREAD_BINDINGS_STATE.managersByAccountId;
|
|
31
32
|
const BINDINGS_BY_THREAD_ID = THREAD_BINDINGS_STATE.bindingsByThreadId;
|
|
32
33
|
const BINDINGS_BY_SESSION_KEY = THREAD_BINDINGS_STATE.bindingsBySessionKey;
|
|
@@ -284,22 +285,15 @@ function snapshotThreadBindingJson(value) {
|
|
|
284
285
|
return serialized ? JSON.parse(serialized) : void 0;
|
|
285
286
|
}
|
|
286
287
|
function snapshotThreadBindingMetadata(input) {
|
|
287
|
-
return asOptionalObjectRecord(snapshotThreadBindingJson(input.metadata
|
|
288
|
-
}
|
|
289
|
-
function toPersistedBindingRecord(record) {
|
|
290
|
-
return normalizePersistedBinding(record.threadId, snapshotThreadBindingJson(record)) ?? { ...record };
|
|
288
|
+
return asOptionalObjectRecord(snapshotThreadBindingJson(input.metadata));
|
|
291
289
|
}
|
|
292
290
|
function runThreadBindingAccountOperation(managers, operation) {
|
|
293
291
|
if (managers.length === 0) return operation();
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
for (const manager of managers) tails.set(manager, settled);
|
|
299
|
-
settled.then(() => {
|
|
300
|
-
for (const manager of managers) if (tails.get(manager) === settled) tails.delete(manager);
|
|
292
|
+
return enqueueKeyedTask({
|
|
293
|
+
tails: THREAD_BINDINGS_STATE.accountOperationTails,
|
|
294
|
+
keys: managers,
|
|
295
|
+
task: operation
|
|
301
296
|
});
|
|
302
|
-
return result;
|
|
303
297
|
}
|
|
304
298
|
function drainThreadBindingAccountOperations(manager) {
|
|
305
299
|
return THREAD_BINDINGS_STATE.accountOperationTails.get(manager) ?? Promise.resolve();
|
|
@@ -334,8 +328,7 @@ async function commitBindingRecord(params) {
|
|
|
334
328
|
const store = openThreadBindingsStoreAsync();
|
|
335
329
|
for (const [key, record] of records) {
|
|
336
330
|
assertCurrent();
|
|
337
|
-
|
|
338
|
-
await store.register(key, persisted, { assertCurrent });
|
|
331
|
+
await store.register(key, stripUndefinedFields(record), { assertCurrent });
|
|
339
332
|
committedWrites += 1;
|
|
340
333
|
targetCommitted ||= key === params.bindingKey;
|
|
341
334
|
}
|
|
@@ -384,10 +377,10 @@ function persistBindingsSync(update) {
|
|
|
384
377
|
for (const [key, record] of BINDINGS_BY_THREAD_ID) if (key === update?.bindingKey) {
|
|
385
378
|
if (!store.update) throw new Error("Discord synchronous compatibility requires atomic state update");
|
|
386
379
|
const next = update.transform(record);
|
|
387
|
-
store.update(key, () =>
|
|
380
|
+
store.update(key, () => stripUndefinedFields(next));
|
|
388
381
|
updatedRecord = next;
|
|
389
382
|
if (next !== record) setBindingRecord(next);
|
|
390
|
-
} else store.register(key,
|
|
383
|
+
} else store.register(key, stripUndefinedFields(record));
|
|
391
384
|
for (const entry of store.entries()) if (!BINDINGS_BY_THREAD_ID.has(entry.key)) store.delete(entry.key);
|
|
392
385
|
THREAD_BINDINGS_STATE.loadedPersistentBindings = BINDINGS_BY_THREAD_ID.size > 0;
|
|
393
386
|
THREAD_BINDINGS_STATE.lastPersistedAtMs = Date.now();
|
|
@@ -524,4 +517,4 @@ const setThreadBindingIdleTimeoutBySessionKey = idleSetters.set;
|
|
|
524
517
|
/** @deprecated Use setThreadBindingMaxAgeBySessionKeyAsync; compatible through 2026-12-31, removed in the first January 2027 stable. */
|
|
525
518
|
const setThreadBindingMaxAgeBySessionKey = maxAgeSetters.set;
|
|
526
519
|
//#endregion
|
|
527
|
-
export {
|
|
520
|
+
export { resolveBindingRecordKey as A, forgetThreadBindingToken as C, refreshUnboundThreadWebhookIdentity as D, normalizeThreadBindingDurationMs as E, resolveThreadBindingMaxAgeMs as F, shouldDefaultPersist as I, toBindingRecordKey as L, resolveThreadBindingIdleTimeoutMs as M, resolveThreadBindingInactivityExpiresAt as N, rememberThreadBindingToken as O, resolveThreadBindingMaxAgeExpiresAt as P, toReusableWebhookKey as R, ensureBindingsLoadedAsync as S, normalizeTargetKind as T, MANAGERS_BY_ACCOUNT_ID as _, mutateBindingsForTargetSession as a, THREAD_BINDING_TOUCH_PERSIST_MIN_INTERVAL_MS as b, drainThreadBindingAccountOperations as c, runThreadBindingAccountOperation as d, runThreadBindingMutation as f, BINDINGS_BY_THREAD_ID as g, updateBindingRecordSync as h, setThreadBindingMaxAgeBySessionKeyAsync as i, resolvePreparedThreadBindingLifecycle as j, resolveBindingIdsForSession as k, drainThreadBindingMutations as l, snapshotThreadBindingMetadata as m, setThreadBindingIdleTimeoutBySessionKeyAsync as n, resolveBindingIdsForTargetSession as o, shouldPersistAnyBindingState as p, setThreadBindingMaxAgeBySessionKey as r, commitBindingRecord as s, setThreadBindingIdleTimeoutBySessionKey as t, removeBindingRecordSync as u, PERSIST_BY_ACCOUNT_ID as v, getThreadBindingToken as w, ensureBindingsLoaded as x, REUSABLE_WEBHOOKS_BY_ACCOUNT_CHANNEL as y };
|
|
@@ -1,56 +1,25 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import { d as resolveDiscordReplyDeliveryPlan, f as resolveDiscordReplyTarget, g as sanitizeDiscordThreadName, h as resolveDiscordThreadStarter, j as resolveDiscordMessageChannelId, m as resolveDiscordThreadParentInfo, p as resolveDiscordThreadChannel } from "./transcripts-source-
|
|
2
|
+
import { T as createThread, k as getChannelMessage, t as discord_exports } from "./discord-DGVSguhx.mjs";
|
|
3
|
+
import { d as resolveDiscordReplyDeliveryPlan, f as resolveDiscordReplyTarget, g as sanitizeDiscordThreadName, h as resolveDiscordThreadStarter, j as resolveDiscordMessageChannelId, m as resolveDiscordThreadParentInfo, p as resolveDiscordThreadChannel } from "./transcripts-source-ie9GBWaU.mjs";
|
|
4
4
|
import { logVerbose } from "openclaw/plugin-sdk/runtime-env";
|
|
5
5
|
import { buildAgentSessionKey } from "openclaw/plugin-sdk/routing";
|
|
6
6
|
import { normalizeOptionalString, normalizeOptionalStringifiedId } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
7
7
|
import { Routes } from "discord-api-types/v10";
|
|
8
|
-
import {
|
|
8
|
+
import { truncateWithMarker } from "openclaw/plugin-sdk/string-normalization-runtime";
|
|
9
9
|
import { resolveChannelModelOverride } from "openclaw/plugin-sdk/model-session-runtime";
|
|
10
10
|
import { generateConversationLabel } from "openclaw/plugin-sdk/reply-dispatch-runtime";
|
|
11
|
-
//#region extensions/discord/src/monitor/thread
|
|
11
|
+
//#region extensions/discord/src/monitor/threading.auto-thread.ts
|
|
12
12
|
const DEFAULT_THREAD_TITLE_TIMEOUT_MS = 6e4;
|
|
13
13
|
const MAX_THREAD_TITLE_SOURCE_CHARS = 600;
|
|
14
14
|
const MAX_THREAD_TITLE_CHANNEL_NAME_CHARS = 120;
|
|
15
15
|
const MAX_THREAD_TITLE_CHANNEL_DESCRIPTION_CHARS = 320;
|
|
16
16
|
const DISCORD_THREAD_TITLE_SYSTEM_PROMPT = "Generate a concise Discord thread title (3-6 words) in sentence case: capitalize only the first word and words that are always capitalized. Return only the title. Use channel context when provided and avoid redundant channel-name words unless needed for clarity.";
|
|
17
|
-
async function generateThreadTitle(params) {
|
|
18
|
-
const sourceText = params.messageText.trim();
|
|
19
|
-
if (!sourceText) return null;
|
|
20
|
-
try {
|
|
21
|
-
const userMessage = buildThreadTitleCompletionUserMessage({
|
|
22
|
-
sourceText,
|
|
23
|
-
channelName: params.channelName,
|
|
24
|
-
channelDescription: params.channelDescription
|
|
25
|
-
});
|
|
26
|
-
const generated = await generateConversationLabel({
|
|
27
|
-
cfg: params.cfg,
|
|
28
|
-
agentId: params.agentId,
|
|
29
|
-
userMessage,
|
|
30
|
-
prompt: DISCORD_THREAD_TITLE_SYSTEM_PROMPT,
|
|
31
|
-
...params.modelRef ? { modelRef: params.modelRef } : {},
|
|
32
|
-
timeoutMs: Math.max(100, Math.floor(params.timeoutMs ?? DEFAULT_THREAD_TITLE_TIMEOUT_MS)),
|
|
33
|
-
maxLength: MAX_THREAD_TITLE_SOURCE_CHARS
|
|
34
|
-
});
|
|
35
|
-
return generated ? normalizeGeneratedThreadTitle(generated) : null;
|
|
36
|
-
} catch (err) {
|
|
37
|
-
logVerbose(`thread-title: title generation failed for agent ${params.agentId}: ${String(err)}`);
|
|
38
|
-
return null;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
function buildThreadTitleCompletionUserMessage(params) {
|
|
42
|
-
const sourceText = truncateThreadTitleText(params.sourceText, MAX_THREAD_TITLE_SOURCE_CHARS);
|
|
43
|
-
const channelName = normalizeTitleContextField(params.channelName, MAX_THREAD_TITLE_CHANNEL_NAME_CHARS);
|
|
44
|
-
const channelDescription = normalizeTitleContextField(params.channelDescription, MAX_THREAD_TITLE_CHANNEL_DESCRIPTION_CHARS);
|
|
45
|
-
return [
|
|
46
|
-
channelName ? `Channel: ${channelName}` : void 0,
|
|
47
|
-
channelDescription ? `Channel description: ${channelDescription}` : void 0,
|
|
48
|
-
`Message:\n${sourceText}`
|
|
49
|
-
].filter(Boolean).join("\n\n");
|
|
50
|
-
}
|
|
51
17
|
function truncateThreadTitleText(text, maxChars) {
|
|
52
|
-
|
|
53
|
-
|
|
18
|
+
return truncateWithMarker(text, maxChars, {
|
|
19
|
+
marker: "...",
|
|
20
|
+
reserve: 0,
|
|
21
|
+
trimEnd: false
|
|
22
|
+
});
|
|
54
23
|
}
|
|
55
24
|
function normalizeGeneratedThreadTitle(raw) {
|
|
56
25
|
return stripThreadTitleWrappers(raw.replace(/\r/g, "").split("\n").find((line) => line.trim() && !line.trim().startsWith("```")) ?? "");
|
|
@@ -81,8 +50,6 @@ function normalizeTitleContextField(raw, maxChars) {
|
|
|
81
50
|
if (!value) return;
|
|
82
51
|
return truncateThreadTitleText(value.replace(/\s+/g, " "), maxChars);
|
|
83
52
|
}
|
|
84
|
-
//#endregion
|
|
85
|
-
//#region extensions/discord/src/monitor/threading.auto-thread.ts
|
|
86
53
|
function resolveTrimmedDiscordMessageChannelId(params) {
|
|
87
54
|
return (params.messageChannelId || resolveDiscordMessageChannelId({ message: params.message })).trim();
|
|
88
55
|
}
|
|
@@ -131,7 +98,6 @@ async function resolveDiscordAutoThreadReplyPlan(params) {
|
|
|
131
98
|
}) : null;
|
|
132
99
|
return {
|
|
133
100
|
...deliveryPlan,
|
|
134
|
-
createdThreadId,
|
|
135
101
|
autoThreadContext
|
|
136
102
|
};
|
|
137
103
|
}
|
|
@@ -143,10 +109,7 @@ async function maybeCreateDiscordAutoThread(params) {
|
|
|
143
109
|
const findExistingThread = async () => {
|
|
144
110
|
try {
|
|
145
111
|
const existingThreadId = (await getChannelMessage(params.client.rest, messageChannelId, params.message.id))?.thread?.id;
|
|
146
|
-
if (existingThreadId)
|
|
147
|
-
logVerbose(`discord: autoThread reusing existing thread ${existingThreadId} on ${messageChannelId}/${params.message.id}`);
|
|
148
|
-
return existingThreadId;
|
|
149
|
-
}
|
|
112
|
+
if (existingThreadId) return existingThreadId;
|
|
150
113
|
} catch {}
|
|
151
114
|
};
|
|
152
115
|
try {
|
|
@@ -163,27 +126,65 @@ async function maybeCreateDiscordAutoThread(params) {
|
|
|
163
126
|
name: threadName,
|
|
164
127
|
auto_archive_duration: archiveDuration
|
|
165
128
|
} }, params.message.id))?.id || "";
|
|
166
|
-
if (createdId && params.channelConfig?.autoThreadName === "generated"
|
|
167
|
-
const
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
maybeRenameDiscordAutoThread({
|
|
176
|
-
client: params.client,
|
|
177
|
-
threadId: createdId,
|
|
178
|
-
currentName: threadName,
|
|
179
|
-
fallbackId: params.message.id,
|
|
180
|
-
sourceText: rawThreadSource,
|
|
181
|
-
modelRef,
|
|
182
|
-
channelName: params.channelName,
|
|
183
|
-
channelDescription: params.channelDescription,
|
|
184
|
-
cfg: params.cfg,
|
|
185
|
-
agentId: params.agentId
|
|
129
|
+
if (createdId && params.channelConfig?.autoThreadName === "generated") {
|
|
130
|
+
const { client, channelName, channelDescription, cfg, agentId, channel } = params;
|
|
131
|
+
const parentSessionKey = buildAgentSessionKey({
|
|
132
|
+
agentId,
|
|
133
|
+
channel,
|
|
134
|
+
peer: {
|
|
135
|
+
kind: "channel",
|
|
136
|
+
id: messageChannelId
|
|
137
|
+
}
|
|
186
138
|
});
|
|
139
|
+
const channelLabel = channelName?.trim();
|
|
140
|
+
const groupChannel = channelLabel ? `#${channelLabel}` : void 0;
|
|
141
|
+
const modelRef = resolveChannelModelOverride({
|
|
142
|
+
cfg,
|
|
143
|
+
channel,
|
|
144
|
+
groupId: createdId,
|
|
145
|
+
groupChatType: "channel",
|
|
146
|
+
groupChannel,
|
|
147
|
+
groupSubject: groupChannel,
|
|
148
|
+
parentSessionKey
|
|
149
|
+
})?.model;
|
|
150
|
+
const fallbackId = params.message.id;
|
|
151
|
+
(async () => {
|
|
152
|
+
try {
|
|
153
|
+
const fallbackName = sanitizeDiscordThreadName("", fallbackId);
|
|
154
|
+
const sourceText = rawThreadSource.trim();
|
|
155
|
+
const rawChannelName = channelName;
|
|
156
|
+
const rawChannelDescription = channelDescription;
|
|
157
|
+
let generated = null;
|
|
158
|
+
if (sourceText) try {
|
|
159
|
+
const titleSourceText = truncateThreadTitleText(sourceText, MAX_THREAD_TITLE_SOURCE_CHARS);
|
|
160
|
+
const titleChannelName = normalizeTitleContextField(rawChannelName, MAX_THREAD_TITLE_CHANNEL_NAME_CHARS);
|
|
161
|
+
const titleChannelDescription = normalizeTitleContextField(rawChannelDescription, MAX_THREAD_TITLE_CHANNEL_DESCRIPTION_CHARS);
|
|
162
|
+
const userMessage = [
|
|
163
|
+
titleChannelName ? `Channel: ${titleChannelName}` : void 0,
|
|
164
|
+
titleChannelDescription ? `Channel description: ${titleChannelDescription}` : void 0,
|
|
165
|
+
`Message:\n${titleSourceText}`
|
|
166
|
+
].filter(Boolean).join("\n\n");
|
|
167
|
+
const label = await generateConversationLabel({
|
|
168
|
+
cfg,
|
|
169
|
+
agentId,
|
|
170
|
+
userMessage,
|
|
171
|
+
prompt: DISCORD_THREAD_TITLE_SYSTEM_PROMPT,
|
|
172
|
+
...modelRef ? { modelRef } : {},
|
|
173
|
+
timeoutMs: DEFAULT_THREAD_TITLE_TIMEOUT_MS,
|
|
174
|
+
maxLength: MAX_THREAD_TITLE_SOURCE_CHARS
|
|
175
|
+
});
|
|
176
|
+
generated = label ? normalizeGeneratedThreadTitle(label) : null;
|
|
177
|
+
} catch (err) {
|
|
178
|
+
logVerbose(`thread-title: title generation failed for agent ${agentId}: ${String(err)}`);
|
|
179
|
+
}
|
|
180
|
+
if (!generated) return;
|
|
181
|
+
const nextName = sanitizeDiscordThreadName(generated, fallbackId);
|
|
182
|
+
if (!nextName || nextName === threadName || nextName === fallbackName) return;
|
|
183
|
+
await client.rest.patch(Routes.channel(createdId), { body: { name: nextName } });
|
|
184
|
+
} catch (err) {
|
|
185
|
+
logVerbose(`discord: autoThread rename failed for ${createdId}: ${String(err)}`);
|
|
186
|
+
}
|
|
187
|
+
})();
|
|
187
188
|
}
|
|
188
189
|
return createdId || void 0;
|
|
189
190
|
} catch (err) {
|
|
@@ -191,44 +192,6 @@ async function maybeCreateDiscordAutoThread(params) {
|
|
|
191
192
|
return findExistingThread();
|
|
192
193
|
}
|
|
193
194
|
}
|
|
194
|
-
function resolveDiscordThreadTitleModelRef(params) {
|
|
195
|
-
const channel = params.channel?.trim();
|
|
196
|
-
if (!channel) return;
|
|
197
|
-
const parentSessionKey = buildAgentSessionKey({
|
|
198
|
-
agentId: params.agentId,
|
|
199
|
-
channel,
|
|
200
|
-
peer: {
|
|
201
|
-
kind: "channel",
|
|
202
|
-
id: params.messageChannelId
|
|
203
|
-
}
|
|
204
|
-
});
|
|
205
|
-
const channelLabel = params.channelName?.trim();
|
|
206
|
-
const groupChannel = channelLabel ? `#${channelLabel}` : void 0;
|
|
207
|
-
return resolveChannelModelOverride({
|
|
208
|
-
cfg: params.cfg,
|
|
209
|
-
channel,
|
|
210
|
-
groupId: params.threadId,
|
|
211
|
-
groupChatType: "channel",
|
|
212
|
-
groupChannel,
|
|
213
|
-
groupSubject: groupChannel,
|
|
214
|
-
parentSessionKey
|
|
215
|
-
})?.model;
|
|
216
|
-
}
|
|
217
|
-
async function maybeRenameDiscordAutoThread(params) {
|
|
218
|
-
try {
|
|
219
|
-
const fallbackName = sanitizeDiscordThreadName("", params.fallbackId);
|
|
220
|
-
const generated = await generateThreadTitle({
|
|
221
|
-
...params,
|
|
222
|
-
messageText: params.sourceText
|
|
223
|
-
});
|
|
224
|
-
if (!generated) return;
|
|
225
|
-
const nextName = sanitizeDiscordThreadName(generated, params.fallbackId);
|
|
226
|
-
if (!nextName || nextName === params.currentName || nextName === fallbackName) return;
|
|
227
|
-
await params.client.rest.patch(Routes.channel(params.threadId), { body: { name: nextName } });
|
|
228
|
-
} catch (err) {
|
|
229
|
-
logVerbose(`discord: autoThread rename failed for ${params.threadId}: ${String(err)}`);
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
195
|
//#endregion
|
|
233
196
|
//#region extensions/discord/src/monitor/threading.ts
|
|
234
197
|
var threading_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -57,7 +57,7 @@ async function withAbortTimeout(params) {
|
|
|
57
57
|
reject(params.createTimeoutError());
|
|
58
58
|
controller.abort();
|
|
59
59
|
}, timeoutMs);
|
|
60
|
-
timeoutTimer.unref
|
|
60
|
+
timeoutTimer.unref();
|
|
61
61
|
});
|
|
62
62
|
try {
|
|
63
63
|
return await Promise.race([params.run(controller.signal), timeoutPromise]);
|