@openclaw/discord 2026.9.3 → 2026.9.5
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/assets/activity.svg +40 -0
- package/assets/icon.png +0 -0
- package/dist/{account-inspect-BY-ve3yH.js → .setup/account-inspect-BwQj24ht.mjs} +1 -1
- package/dist/{activities-api-D--xtQQu.js → .setup/activities-api-DBwRt5ES.mjs} +93 -31
- package/dist/{api-LIV--eMq.js → .setup/api-CBK9zcq5.mjs} +7 -4
- package/dist/{approval-handler.runtime-CUNkTLDO.js → .setup/approval-handler.runtime-Du3n5ypX.mjs} +8 -7
- package/dist/.setup/approval-message-updates-BN7JtScm.mjs +17 -0
- package/dist/{audit-DzHj2Z4w.js → .setup/audit-C8uaKoa9.mjs} +5 -5
- package/dist/{channel-aAywxCij.js → .setup/channel-ChKdlBgH.mjs} +28 -25
- package/dist/{channel-actions.runtime-rmse1yrM.js → .setup/channel-actions.runtime-CJmiFfps.mjs} +18 -11
- package/dist/{allow-list-DWEio925.js → .setup/channel-type-DKnjV1XW.mjs} +161 -1
- package/dist/{channel.setup-CpAwAiS0.js → .setup/channel.setup-BlC3-Kzz.mjs} +4 -4
- package/dist/{components-kvIwhN7i.js → .setup/components-MqMWUWnE.mjs} +4 -3
- package/dist/{config-schema-r38UkM_J.js → .setup/config-schema-CiZz-mtA.mjs} +1 -1
- package/dist/{conversation-binding-route-qfe7oPy5.js → .setup/conversation-binding-route-_rz33QHO.mjs} +1 -1
- package/dist/{directory-config-D1uDGbWh.js → .setup/directory-config-BytTftz-.mjs} +2 -2
- package/dist/{directory-live-C5o1uKlw.js → .setup/directory-live--EGTH0DC.mjs} +4 -4
- package/dist/{discord-CmL3ati-.js → .setup/discord-BXpHW-cu.mjs} +89 -39
- package/dist/{doctor-DgKMH6N7.js → .setup/doctor-DxcdkXzz.mjs} +6 -6
- package/dist/{handle-action.guild-admin-D4XdoA8-.js → .setup/handle-action.guild-admin-DAFyh_yV.mjs} +9 -4
- package/dist/{live-policy-config-BblutQAq.js → .setup/live-policy-config-eKQ-PLdy.mjs} +1 -1
- package/dist/{message-handler-B0DbuhWz.js → .setup/message-handler-DnUrDpaU.mjs} +25 -14
- package/dist/{message-handler.preflight-BkHVlYis.js → .setup/message-handler.preflight-CtqaF_fb.mjs} +34 -20
- package/dist/{message-handler.process-CWh432Ak.js → .setup/message-handler.process-Dz1xvuQU.mjs} +72 -82
- package/dist/{outbound-adapter-CO2BRlRl.js → .setup/outbound-adapter-C8v79z9Z.mjs} +13 -9
- package/dist/{outbound-session-route-DZBYPGTR.js → .setup/outbound-session-route-CqWbuMOm.mjs} +137 -11
- package/dist/{pluralkit-BiUW53Yn.js → .setup/pluralkit-CdAt1G0P.mjs} +2 -2
- package/dist/{presence-cache-z1N8MbJ3.js → .setup/presence-cache-dYSHPWMx.mjs} +1 -1
- package/dist/{probe-BcoN44eK.js → .setup/probe-CupW4we4.mjs} +14 -10
- package/dist/{probe.runtime-BnuED0fI.js → .setup/probe.runtime-DBQ_AGPe.mjs} +1 -1
- package/dist/{provider-PI8UiejY.js → .setup/provider-72zIvN-i.mjs} +484 -288
- package/dist/{provider-session.runtime-BejUb3gm.js → .setup/provider-session.runtime-BW7QrF5C.mjs} +4 -4
- package/dist/.setup/provider.runtime-DuhmKdDU.mjs +2 -0
- package/dist/{realtime-session.runtime-MqPrvmQ1.js → .setup/realtime-session.runtime-DTccTgTM.mjs} +758 -336
- package/dist/{resolve-allowlist-common-ChPf0Qy7.js → .setup/resolve-allowlist-common-CwMBzbx9.mjs} +3 -3
- package/dist/{resolve-channels-VbpLmUS8.js → .setup/resolve-channels-BbvsLQOZ.mjs} +4 -5
- package/dist/{resolve-users-D-wRFsd5.js → .setup/resolve-users-ByFlR7LQ.mjs} +3 -3
- package/dist/{retry-B0lQ1Ado.js → .setup/retry-DBfcEgmO.mjs} +37 -10
- package/dist/{runtime-D-ZFlMQ2.js → .setup/runtime-BVoa7hhx.mjs} +2 -2
- package/dist/{runtime-Cv8GdXSO.js → .setup/runtime-SchNfUsQ.mjs} +92 -139
- package/dist/{security-audit-DKfK-iPY.js → .setup/security-audit-s5w50-Ly.mjs} +1 -1
- package/dist/{security-audit.runtime-sKZyKgpx.js → .setup/security-audit.runtime-DHtYenx9.mjs} +1 -1
- package/dist/{send-Bdp3zZH5.js → .setup/send-CKDczUNL.mjs} +60 -31
- package/dist/{send.components-Bj22B3_O.js → .setup/send.components-DWQjXhPV.mjs} +103 -106
- package/dist/{send.outbound-DF0P3C9J.js → .setup/send.outbound-D0hQ7s50.mjs} +17 -7
- package/dist/{send.shared-D4BAjlRo.js → .setup/send.shared-Zwx6BxQ5.mjs} +15 -12
- package/dist/{sender-identity-f3l5OYgV.js → .setup/sender-identity-0Ymgvmaj.mjs} +1 -1
- package/dist/.setup/setup-plugin-api-CINIEBLa.mjs +3 -0
- package/dist/{shared-CPPR0Xo4.js → .setup/shared-CaA3Vv4n.mjs} +11 -11
- package/dist/{subagent-hooks-BAwybBDC.js → .setup/subagent-hooks-Bired9q6.mjs} +16 -4
- package/dist/{system-events-B6HkUhF_.js → .setup/system-events-B2YEEMbS.mjs} +2 -2
- package/dist/{target-resolver-BgKUUwLy.js → .setup/target-resolver-B6MrxbYv.mjs} +4 -4
- package/dist/.setup/targets-D1mAB5yO.mjs +3 -0
- package/dist/{thread-bindings-B0wnEg_y.js → .setup/thread-bindings-CK5272V3.mjs} +6 -6
- package/dist/{thread-bindings.manager-DM7M3vzn.js → .setup/thread-bindings.manager-eexkKyrG.mjs} +14 -9
- package/dist/{thread-bindings.session-updates-CSBmgCcx.js → .setup/thread-bindings.session-updates-DCQq1WZ5.mjs} +1 -1
- package/dist/{thread-bindings.state-jNRrsgzV.js → .setup/thread-bindings.state-BThFQEga.mjs} +48 -30
- package/dist/{transcripts-source-VkgenQv-.js → .setup/transcripts-source-CuWYgayu.mjs} +62 -25
- package/dist/{typing-DuBg1U8Q.js → .setup/typing-BKZL5fGj.mjs} +2 -2
- package/dist/{voice-runtime-BhRqlbEt.js → .setup/voice-runtime-DHVQ2mFz.mjs} +529 -181
- package/dist/account-inspect-api.js +1 -1
- package/dist/action-runtime-api.js +1 -1
- package/dist/activities-api.js +1 -1
- package/dist/api.js +19 -19
- package/dist/channel-config-api.js +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/contract-api.js +1 -1
- package/dist/directory-contract-api.js +1 -1
- package/dist/doctor-contract-api.js +5 -4
- package/dist/index.js +1 -1
- package/dist/runtime-api.js +22 -22
- package/dist/runtime-setter-api.js +1 -1
- package/dist/secret-contract-api.js +1 -1
- package/dist/security-audit-contract-api.js +1 -1
- package/dist/security-contract-api.js +1 -1
- package/dist/session-key-api.js +1 -1
- package/dist/setup-entry.js +2 -1
- package/dist/setup-plugin-api.js +1 -1
- package/dist/subagent-hooks-api.js +5 -4
- package/dist/thread-binding-api.js +1 -1
- package/dist/transcripts-source-api.js +1 -1
- package/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/node/buffer.d.ts +1 -0
- package/node_modules/@types/node/diagnostics_channel.d.ts +4 -4
- package/node_modules/@types/node/ffi.d.ts +1 -1
- package/node_modules/@types/node/http.d.ts +1 -1
- package/node_modules/@types/node/package.json +3 -3
- package/node_modules/@types/node/perf_hooks.d.ts +31 -19
- package/node_modules/@types/node/quic.d.ts +6 -4
- package/node_modules/@types/node/stream/web.d.ts +20 -0
- package/node_modules/@types/node/tls.d.ts +26 -15
- package/node_modules/@types/node/vfs.d.ts +7 -6
- package/node_modules/@types/node/zlib.d.ts +17 -0
- package/node_modules/discord-api-types/README.md +3 -2
- package/node_modules/discord-api-types/package.json +46 -46
- package/node_modules/discord-api-types/rest/v10/interactions.d.ts +1 -0
- package/node_modules/discord-api-types/rest/v10/interactions.d.ts.map +1 -1
- package/node_modules/discord-api-types/rest/v9/interactions.d.ts +1 -0
- package/node_modules/discord-api-types/rest/v9/interactions.d.ts.map +1 -1
- package/node_modules/libopus-wasm/CHANGELOG.md +15 -0
- package/node_modules/libopus-wasm/README.md +1 -1
- package/node_modules/libopus-wasm/dist/discordjs.d.ts.map +1 -1
- package/node_modules/libopus-wasm/dist/generated/libopus.generated.mjs +0 -0
- package/node_modules/libopus-wasm/dist/index.d.ts.map +1 -1
- package/node_modules/libopus-wasm/dist/index.js +37 -18
- package/node_modules/libopus-wasm/package.json +13 -13
- package/node_modules/typebox/build/compile/validator.d.mts +1 -1
- package/node_modules/typebox/build/compile/validator.mjs +1 -1
- package/node_modules/typebox/build/format/idna/idn-hostname.mjs +7 -5
- package/node_modules/typebox/build/format/iri.mjs +5 -1
- package/node_modules/typebox/build/guard/emit.mjs +2 -4
- package/node_modules/typebox/build/guard/guard.mjs +6 -18
- package/node_modules/typebox/build/guard/string.mjs +16 -24
- package/node_modules/typebox/build/schema/build.mjs +2 -2
- package/node_modules/typebox/build/schema/check.mjs +1 -1
- package/node_modules/typebox/build/schema/compile.d.mts +3 -2
- package/node_modules/typebox/build/schema/compile.mjs +8 -8
- package/node_modules/typebox/build/schema/engine/_context.d.mts +6 -7
- package/node_modules/typebox/build/schema/engine/_context.mjs +23 -15
- package/node_modules/typebox/build/schema/engine/_functions.d.mts +2 -2
- package/node_modules/typebox/build/schema/engine/_functions.mjs +1 -1
- package/node_modules/typebox/build/schema/engine/_reducer.d.mts +3 -3
- package/node_modules/typebox/build/schema/engine/_refine.d.mts +5 -5
- package/node_modules/typebox/build/schema/engine/_refine.mjs +4 -7
- package/node_modules/typebox/build/schema/engine/_stack.d.mts +34 -16
- package/node_modules/typebox/build/schema/engine/_stack.mjs +148 -104
- package/node_modules/typebox/build/schema/engine/additionalItems.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/additionalProperties.d.mts +8 -8
- package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +26 -18
- package/node_modules/typebox/build/schema/engine/allOf.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/allOf.mjs +3 -3
- package/node_modules/typebox/build/schema/engine/anyOf.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/anyOf.mjs +5 -10
- package/node_modules/typebox/build/schema/engine/boolean.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/boolean.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/const.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/const.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/contains.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/contains.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/dependencies.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/dependencies.mjs +3 -6
- package/node_modules/typebox/build/schema/engine/dependentRequired.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/dependentRequired.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/dependentSchemas.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/dynamicRef.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/dynamicRef.mjs +11 -7
- package/node_modules/typebox/build/schema/engine/enum.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/enum.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/exclusiveMaximum.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/exclusiveMaximum.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/exclusiveMinimum.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/exclusiveMinimum.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/format.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/format.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/if.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/if.mjs +7 -15
- package/node_modules/typebox/build/schema/engine/items.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/items.mjs +1 -1
- package/node_modules/typebox/build/schema/engine/maxContains.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/maxContains.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/maxItems.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/maxItems.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/maxLength.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/maxLength.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/maxProperties.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/maxProperties.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/maximum.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/maximum.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/minContains.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/minContains.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/minItems.d.mts +5 -5
- package/node_modules/typebox/build/schema/engine/minItems.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/minLength.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/minLength.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/minProperties.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/minProperties.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/minimum.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/minimum.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/multipleOf.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/multipleOf.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/not.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/not.mjs +4 -8
- package/node_modules/typebox/build/schema/engine/oneOf.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/oneOf.mjs +6 -11
- package/node_modules/typebox/build/schema/engine/pattern.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/pattern.mjs +3 -7
- package/node_modules/typebox/build/schema/engine/patternProperties.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/patternProperties.mjs +1 -1
- package/node_modules/typebox/build/schema/engine/prefixItems.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/prefixItems.mjs +1 -1
- package/node_modules/typebox/build/schema/engine/properties.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/properties.mjs +1 -1
- package/node_modules/typebox/build/schema/engine/propertyNames.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/propertyNames.mjs +4 -10
- package/node_modules/typebox/build/schema/engine/recursiveRef.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/recursiveRef.mjs +11 -7
- package/node_modules/typebox/build/schema/engine/ref.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/ref.mjs +19 -15
- package/node_modules/typebox/build/schema/engine/required.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/required.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/schema.d.mts +7 -7
- package/node_modules/typebox/build/schema/engine/schema.mjs +137 -133
- package/node_modules/typebox/build/schema/engine/type.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/type.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/unevaluatedItems.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/unevaluatedItems.mjs +5 -9
- package/node_modules/typebox/build/schema/engine/unevaluatedProperties.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/unevaluatedProperties.mjs +5 -9
- package/node_modules/typebox/build/schema/engine/uniqueItems.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/uniqueItems.mjs +2 -6
- package/node_modules/typebox/build/schema/errors.d.mts +2 -2
- package/node_modules/typebox/build/schema/errors.mjs +8 -14
- package/node_modules/typebox/build/schema/intern/index.d.mts +1 -0
- package/node_modules/typebox/build/schema/intern/index.mjs +1 -0
- package/node_modules/typebox/build/schema/intern/intern.d.mts +11 -0
- package/node_modules/typebox/build/schema/intern/intern.mjs +293 -0
- package/node_modules/typebox/build/schema/meta/draft_2019_09.d.mts +2 -0
- package/node_modules/typebox/build/schema/meta/draft_2019_09.mjs +288 -0
- package/node_modules/typebox/build/schema/meta/draft_2020_12.d.mts +2 -0
- package/node_modules/typebox/build/schema/meta/draft_2020_12.mjs +300 -0
- package/node_modules/typebox/build/schema/meta/draft_3.d.mts +2 -0
- package/node_modules/typebox/build/schema/meta/draft_3.mjs +143 -0
- package/node_modules/typebox/build/schema/meta/draft_4.d.mts +2 -0
- package/node_modules/typebox/build/schema/meta/draft_4.mjs +149 -0
- package/node_modules/typebox/build/schema/meta/draft_6.d.mts +2 -0
- package/node_modules/typebox/build/schema/meta/draft_6.mjs +155 -0
- package/node_modules/typebox/build/schema/meta/draft_7.d.mts +2 -0
- package/node_modules/typebox/build/schema/meta/draft_7.mjs +172 -0
- package/node_modules/typebox/build/schema/meta/index.d.mts +2 -0
- package/node_modules/typebox/build/schema/meta/index.mjs +2 -0
- package/node_modules/typebox/build/schema/meta/meta.d.mts +9 -0
- package/node_modules/typebox/build/schema/meta/meta.mjs +15 -0
- package/node_modules/typebox/build/schema/meta/schema.d.mts +6 -0
- package/node_modules/typebox/build/schema/meta/schema.mjs +1 -0
- package/node_modules/typebox/build/schema/parse.d.mts +1 -0
- package/node_modules/typebox/build/schema/parse.mjs +10 -5
- package/node_modules/typebox/build/schema/resolve/resolve.d.mts +8 -3
- package/node_modules/typebox/build/schema/resolve/resolve.mjs +268 -139
- package/node_modules/typebox/build/schema/schema.d.mts +2 -0
- package/node_modules/typebox/build/schema/schema.mjs +2 -0
- package/node_modules/typebox/build/value/errors/errors.d.mts +2 -12
- package/node_modules/typebox/build/value/errors/errors.mjs +2 -7
- package/node_modules/typebox/package.json +1 -1
- package/node_modules/typebox/readme.md +59 -89
- package/node_modules/undici-types/client.d.ts +8 -3
- package/node_modules/undici-types/connector.d.ts +1 -0
- package/node_modules/undici-types/cookies.d.ts +1 -1
- package/node_modules/undici-types/dispatcher.d.ts +3 -3
- package/node_modules/undici-types/errors.d.ts +10 -0
- package/node_modules/undici-types/fetch.d.ts +5 -1
- package/node_modules/undici-types/handlers.d.ts +2 -0
- package/node_modules/undici-types/interceptors.d.ts +1 -1
- package/node_modules/undici-types/mock-interceptor.d.ts +5 -1
- package/node_modules/undici-types/package.json +1 -1
- package/node_modules/undici-types/proxy-agent.d.ts +7 -0
- package/node_modules/zod/README.md +27 -0
- package/node_modules/zod/compile.cjs +77 -0
- package/node_modules/zod/compile.d.cts +1 -0
- package/node_modules/zod/compile.d.ts +1 -0
- package/node_modules/zod/compile.js +52 -0
- package/node_modules/zod/index.cjs +2 -2
- package/node_modules/zod/index.d.cts +1 -2
- package/node_modules/zod/index.d.ts +1 -2
- package/node_modules/zod/index.js +5 -2
- package/node_modules/zod/package.json +13 -2
- package/node_modules/zod/src/compile.ts +56 -0
- package/node_modules/zod/src/index.ts +5 -2
- package/node_modules/zod/src/v3/ZodError.ts +22 -12
- package/node_modules/zod/src/v3/tests/error.test.ts +35 -0
- package/node_modules/zod/src/v3/tests/intersection.test.ts +18 -0
- package/node_modules/zod/src/v3/tests/language-server.test.ts +1 -2
- package/node_modules/zod/src/v3/tests/object.test.ts +3 -6
- package/node_modules/zod/src/v3/tests/readonly.test.ts +0 -80
- package/node_modules/zod/src/v3/tests/string.test.ts +6 -0
- package/node_modules/zod/src/v3/types.ts +5 -5
- package/node_modules/zod/src/v4/classic/checks.ts +1 -0
- package/node_modules/zod/src/v4/classic/compat.ts +26 -18
- package/node_modules/zod/src/v4/classic/deep-partial.ts +76 -0
- package/node_modules/zod/src/v4/classic/errors.ts +59 -44
- package/node_modules/zod/src/v4/classic/external.ts +12 -9
- package/node_modules/zod/src/v4/classic/from-json-schema.ts +140 -78
- package/node_modules/zod/src/v4/classic/in-out.ts +45 -0
- package/node_modules/zod/src/v4/classic/index.ts +2 -2
- package/node_modules/zod/src/v4/classic/iso.ts +2 -72
- package/node_modules/zod/src/v4/classic/parse.ts +10 -4
- package/node_modules/zod/src/v4/classic/schemas.ts +452 -262
- package/node_modules/zod/src/v4/classic/tests/apply.test.ts +27 -0
- package/node_modules/zod/src/v4/classic/tests/array.test.ts +2 -2
- package/node_modules/zod/src/v4/classic/tests/assignability.test.ts +135 -0
- package/node_modules/zod/src/v4/classic/tests/bigint.test.ts +30 -1
- package/node_modules/zod/src/v4/classic/tests/catch.test.ts +278 -0
- package/node_modules/zod/src/v4/classic/tests/codec-examples.test.ts +1 -2
- package/node_modules/zod/src/v4/classic/tests/codec.test.ts +2 -1
- package/node_modules/zod/src/v4/classic/tests/continuability.test.ts +2 -2
- package/node_modules/zod/src/v4/classic/tests/credit-card.test.ts +76 -0
- package/node_modules/zod/src/v4/classic/tests/cyclic-data.test.ts +720 -0
- package/node_modules/zod/src/v4/classic/tests/date.test.ts +30 -0
- package/node_modules/zod/src/v4/classic/tests/datetime.test.ts +32 -18
- package/node_modules/zod/src/v4/classic/tests/deep-partial.test.ts +380 -0
- package/node_modules/zod/src/v4/classic/tests/default-locale.test.ts +32 -0
- package/node_modules/zod/src/v4/classic/tests/default.test.ts +46 -0
- package/node_modules/zod/src/v4/classic/tests/detached-methods.test.ts +31 -7
- package/node_modules/zod/src/v4/classic/tests/discriminated-unions.test.ts +155 -13
- package/node_modules/zod/src/v4/classic/tests/enum.test.ts +11 -0
- package/node_modules/zod/src/v4/classic/tests/error-utils.test.ts +112 -2
- package/node_modules/zod/src/v4/classic/tests/error.test.ts +274 -6
- package/node_modules/zod/src/v4/classic/tests/from-json-schema.test.ts +425 -10
- package/node_modules/zod/src/v4/classic/tests/function.test.ts +31 -0
- package/node_modules/zod/src/v4/classic/tests/global-config.test.ts +2 -9
- package/node_modules/zod/src/v4/classic/tests/hash.test.ts +1 -2
- package/node_modules/zod/src/v4/classic/tests/in-out.test.ts +159 -0
- package/node_modules/zod/src/v4/classic/tests/index.test.ts +21 -2
- package/node_modules/zod/src/v4/classic/tests/instance-footprint.test.ts +281 -0
- package/node_modules/zod/src/v4/classic/tests/instanceof.test.ts +47 -0
- package/node_modules/zod/src/v4/classic/tests/intersection.test.ts +136 -0
- package/node_modules/zod/src/v4/classic/tests/issue-schema.test.ts +183 -0
- package/node_modules/zod/src/v4/classic/tests/jitless-allows-eval.test.ts +3 -10
- package/node_modules/zod/src/v4/classic/tests/lazy.test.ts +36 -1
- package/node_modules/zod/src/v4/classic/tests/literal.test.ts +12 -1
- package/node_modules/zod/src/v4/classic/tests/map.test.ts +12 -0
- package/node_modules/zod/src/v4/classic/tests/number.test.ts +46 -9
- package/node_modules/zod/src/v4/classic/tests/object.test.ts +245 -12
- package/node_modules/zod/src/v4/classic/tests/optin-ladder.test.ts +234 -0
- package/node_modules/zod/src/v4/classic/tests/optional.test.ts +49 -16
- package/node_modules/zod/src/v4/classic/tests/partial.test.ts +51 -4
- package/node_modules/zod/src/v4/classic/tests/preprocess-types.test.ts +20 -2
- package/node_modules/zod/src/v4/classic/tests/readonly.test.ts +0 -68
- package/node_modules/zod/src/v4/classic/tests/record.test.ts +186 -18
- package/node_modules/zod/src/v4/classic/tests/recursive-types.test.ts +33 -2
- package/node_modules/zod/src/v4/classic/tests/redos.test.ts +68 -0
- package/node_modules/zod/src/v4/classic/tests/refine.test.ts +60 -0
- package/node_modules/zod/src/v4/classic/tests/set.test.ts +9 -0
- package/node_modules/zod/src/v4/classic/tests/string.test.ts +127 -5
- package/node_modules/zod/src/v4/classic/tests/stringbool.test.ts +18 -0
- package/node_modules/zod/src/v4/classic/tests/template-literal.test.ts +11 -2
- package/node_modules/zod/src/v4/classic/tests/to-json-schema.test.ts +1585 -173
- package/node_modules/zod/src/v4/classic/tests/tuple.test.ts +45 -30
- package/node_modules/zod/src/v4/classic/tests/union.test.ts +39 -2
- package/node_modules/zod/src/v4/classic/tests/validate.test.ts +76 -0
- package/node_modules/zod/src/v4/classic/tests/validations.test.ts +2 -2
- package/node_modules/zod/src/v4/core/api.ts +48 -12
- package/node_modules/zod/src/v4/core/checks.ts +57 -44
- package/node_modules/zod/src/v4/core/compile.ts +2188 -0
- package/node_modules/zod/src/v4/core/core.ts +98 -19
- package/node_modules/zod/src/v4/core/doc.ts +11 -7
- package/node_modules/zod/src/v4/core/errors.ts +115 -24
- package/node_modules/zod/src/v4/core/index.ts +3 -0
- package/node_modules/zod/src/v4/core/json-schema-generator.ts +6 -1
- package/node_modules/zod/src/v4/core/json-schema-processors.ts +257 -93
- package/node_modules/zod/src/v4/core/json-schema.ts +2 -1
- package/node_modules/zod/src/v4/core/memoizer.ts +284 -0
- package/node_modules/zod/src/v4/core/parse.ts +131 -38
- package/node_modules/zod/src/v4/core/regexes.ts +30 -13
- package/node_modules/zod/src/v4/core/registries.ts +2 -2
- package/node_modules/zod/src/v4/core/schemas.ts +759 -461
- package/node_modules/zod/src/v4/core/tests/compile-differential.test.ts +969 -0
- package/node_modules/zod/src/v4/core/tests/compile-global.test.ts +89 -0
- package/node_modules/zod/src/v4/core/tests/compile-off-by-default.test.ts +26 -0
- package/node_modules/zod/src/v4/core/tests/compile-stats.test.ts +34 -0
- package/node_modules/zod/src/v4/core/tests/compile.test.ts +1639 -0
- package/node_modules/zod/src/v4/core/tests/locales/el.test.ts +1 -2
- package/node_modules/zod/src/v4/core/tests/locales/es.test.ts +1 -2
- package/node_modules/zod/src/v4/core/tests/locales/fr.test.ts +3 -3
- package/node_modules/zod/src/v4/core/tests/locales/parity.test.ts +42 -0
- package/node_modules/zod/src/v4/core/tests/locales/tk.test.ts +69 -0
- package/node_modules/zod/src/v4/core/tests/treeshake.test.ts +51 -0
- package/node_modules/zod/src/v4/core/tests/url-no-canparse.test.ts +31 -0
- package/node_modules/zod/src/v4/core/to-json-schema.ts +275 -42
- package/node_modules/zod/src/v4/core/util.ts +268 -42
- package/node_modules/zod/src/v4/core/versions.ts +2 -2
- package/node_modules/zod/src/v4/core/visit.ts +193 -0
- package/node_modules/zod/src/v4/index.ts +3 -3
- package/node_modules/zod/src/v4/locales/ar.ts +3 -0
- package/node_modules/zod/src/v4/locales/az.ts +3 -0
- package/node_modules/zod/src/v4/locales/be.ts +10 -0
- package/node_modules/zod/src/v4/locales/bg.ts +3 -0
- package/node_modules/zod/src/v4/locales/bn.ts +121 -0
- package/node_modules/zod/src/v4/locales/ca.ts +3 -0
- package/node_modules/zod/src/v4/locales/ckb.ts +138 -0
- package/node_modules/zod/src/v4/locales/cs.ts +3 -0
- package/node_modules/zod/src/v4/locales/da.ts +5 -2
- package/node_modules/zod/src/v4/locales/de.ts +3 -0
- package/node_modules/zod/src/v4/locales/el.ts +1 -0
- package/node_modules/zod/src/v4/locales/en.ts +15 -4
- package/node_modules/zod/src/v4/locales/eo.ts +3 -0
- package/node_modules/zod/src/v4/locales/es.ts +2 -0
- package/node_modules/zod/src/v4/locales/fa.ts +3 -0
- package/node_modules/zod/src/v4/locales/fi.ts +3 -0
- package/node_modules/zod/src/v4/locales/fr-CA.ts +3 -0
- package/node_modules/zod/src/v4/locales/fr.ts +19 -14
- package/node_modules/zod/src/v4/locales/gu.ts +121 -0
- package/node_modules/zod/src/v4/locales/he.ts +6 -1
- package/node_modules/zod/src/v4/locales/hi.ts +124 -0
- package/node_modules/zod/src/v4/locales/hr.ts +2 -0
- package/node_modules/zod/src/v4/locales/hu.ts +3 -0
- package/node_modules/zod/src/v4/locales/hy.ts +9 -0
- package/node_modules/zod/src/v4/locales/id.ts +3 -0
- package/node_modules/zod/src/v4/locales/index.ts +10 -0
- package/node_modules/zod/src/v4/locales/is.ts +3 -0
- package/node_modules/zod/src/v4/locales/it.ts +3 -0
- package/node_modules/zod/src/v4/locales/ja.ts +3 -0
- package/node_modules/zod/src/v4/locales/ka.ts +3 -0
- package/node_modules/zod/src/v4/locales/km.ts +3 -0
- package/node_modules/zod/src/v4/locales/kn.ts +124 -0
- package/node_modules/zod/src/v4/locales/ko.ts +3 -0
- package/node_modules/zod/src/v4/locales/lt.ts +2 -0
- package/node_modules/zod/src/v4/locales/mk.ts +3 -0
- package/node_modules/zod/src/v4/locales/ms.ts +3 -0
- package/node_modules/zod/src/v4/locales/ne.ts +126 -0
- package/node_modules/zod/src/v4/locales/nl.ts +3 -0
- package/node_modules/zod/src/v4/locales/nn.ts +119 -0
- package/node_modules/zod/src/v4/locales/no.ts +5 -2
- package/node_modules/zod/src/v4/locales/ota.ts +3 -0
- package/node_modules/zod/src/v4/locales/pl.ts +3 -0
- package/node_modules/zod/src/v4/locales/ps.ts +3 -0
- package/node_modules/zod/src/v4/locales/pt-BR.ts +159 -0
- package/node_modules/zod/src/v4/locales/pt.ts +99 -58
- package/node_modules/zod/src/v4/locales/ro.ts +1 -0
- package/node_modules/zod/src/v4/locales/ru.ts +10 -0
- package/node_modules/zod/src/v4/locales/sk.ts +121 -0
- package/node_modules/zod/src/v4/locales/sl.ts +3 -0
- package/node_modules/zod/src/v4/locales/sv.ts +5 -2
- package/node_modules/zod/src/v4/locales/ta.ts +3 -0
- package/node_modules/zod/src/v4/locales/th.ts +3 -0
- package/node_modules/zod/src/v4/locales/tk.ts +111 -0
- package/node_modules/zod/src/v4/locales/tr.ts +3 -0
- package/node_modules/zod/src/v4/locales/uk.ts +3 -0
- package/node_modules/zod/src/v4/locales/ur.ts +3 -0
- package/node_modules/zod/src/v4/locales/uz.ts +1 -0
- package/node_modules/zod/src/v4/locales/vi.ts +3 -0
- package/node_modules/zod/src/v4/locales/yo.ts +3 -0
- package/node_modules/zod/src/v4/locales/zh-CN.ts +3 -0
- package/node_modules/zod/src/v4/locales/zh-TW.ts +3 -0
- package/node_modules/zod/src/v4/mini/checks.ts +1 -0
- package/node_modules/zod/src/v4/mini/deep-partial.ts +73 -0
- package/node_modules/zod/src/v4/mini/external.ts +10 -1
- package/node_modules/zod/src/v4/mini/in-out.ts +45 -0
- package/node_modules/zod/src/v4/mini/parse.ts +2 -0
- package/node_modules/zod/src/v4/mini/schemas.ts +135 -56
- package/node_modules/zod/src/v4/mini/tests/apply.test.ts +33 -0
- package/node_modules/zod/src/v4/mini/tests/assignability.test.ts +62 -1
- package/node_modules/zod/src/v4/mini/tests/checks.test.ts +14 -0
- package/node_modules/zod/src/v4/mini/tests/codec.test.ts +35 -1
- package/node_modules/zod/src/v4/mini/tests/cyclic-data.test.ts +84 -0
- package/node_modules/zod/src/v4/mini/tests/deep-partial.test.ts +54 -0
- package/node_modules/zod/src/v4/mini/tests/error.test.ts +23 -4
- package/node_modules/zod/src/v4/mini/tests/functions.test.ts +9 -0
- package/node_modules/zod/src/v4/mini/tests/index.test.ts +72 -5
- package/node_modules/zod/src/v4/mini/tests/number.test.ts +14 -0
- package/node_modules/zod/src/v4/mini/tests/object.test.ts +65 -0
- package/node_modules/zod/src/v4/mini/tests/string.test.ts +21 -0
- package/node_modules/zod/v3/ZodError.cjs +22 -12
- package/node_modules/zod/v3/ZodError.d.cts +1 -1
- package/node_modules/zod/v3/ZodError.d.ts +1 -1
- package/node_modules/zod/v3/ZodError.js +22 -12
- package/node_modules/zod/v3/types.cjs +7 -5
- package/node_modules/zod/v3/types.js +7 -5
- package/node_modules/zod/v4/classic/checks.cjs +2 -1
- package/node_modules/zod/v4/classic/checks.d.cts +1 -1
- package/node_modules/zod/v4/classic/checks.d.ts +1 -1
- package/node_modules/zod/v4/classic/checks.js +1 -1
- package/node_modules/zod/v4/classic/compat.d.cts +9 -11
- package/node_modules/zod/v4/classic/compat.d.ts +9 -11
- package/node_modules/zod/v4/classic/deep-partial.cjs +39 -0
- package/node_modules/zod/v4/classic/deep-partial.d.cts +14 -0
- package/node_modules/zod/v4/classic/deep-partial.d.ts +14 -0
- package/node_modules/zod/v4/classic/deep-partial.js +13 -0
- package/node_modules/zod/v4/classic/errors.cjs +43 -34
- package/node_modules/zod/v4/classic/errors.d.cts +3 -4
- package/node_modules/zod/v4/classic/errors.d.ts +3 -4
- package/node_modules/zod/v4/classic/errors.js +43 -34
- package/node_modules/zod/v4/classic/external.cjs +30 -27
- package/node_modules/zod/v4/classic/external.d.cts +5 -2
- package/node_modules/zod/v4/classic/external.d.ts +5 -2
- package/node_modules/zod/v4/classic/external.js +5 -8
- package/node_modules/zod/v4/classic/from-json-schema.cjs +136 -75
- package/node_modules/zod/v4/classic/from-json-schema.js +136 -75
- package/node_modules/zod/v4/classic/in-out.cjs +63 -0
- package/node_modules/zod/v4/classic/in-out.d.cts +8 -0
- package/node_modules/zod/v4/classic/in-out.d.ts +8 -0
- package/node_modules/zod/v4/classic/in-out.js +36 -0
- package/node_modules/zod/v4/classic/index.cjs +2 -2
- package/node_modules/zod/v4/classic/index.d.cts +1 -2
- package/node_modules/zod/v4/classic/index.d.ts +1 -2
- package/node_modules/zod/v4/classic/index.js +2 -2
- package/node_modules/zod/v4/classic/iso.cjs +11 -22
- package/node_modules/zod/v4/classic/iso.d.cts +2 -17
- package/node_modules/zod/v4/classic/iso.d.ts +2 -17
- package/node_modules/zod/v4/classic/iso.js +2 -17
- package/node_modules/zod/v4/classic/parse.cjs +4 -1
- package/node_modules/zod/v4/classic/parse.d.cts +17 -4
- package/node_modules/zod/v4/classic/parse.d.ts +17 -4
- package/node_modules/zod/v4/classic/parse.js +1 -0
- package/node_modules/zod/v4/classic/schemas.cjs +498 -398
- package/node_modules/zod/v4/classic/schemas.d.cts +53 -18
- package/node_modules/zod/v4/classic/schemas.d.ts +53 -18
- package/node_modules/zod/v4/classic/schemas.js +492 -396
- package/node_modules/zod/v4/core/api.cjs +23 -4
- package/node_modules/zod/v4/core/api.d.cts +13 -9
- package/node_modules/zod/v4/core/api.d.ts +13 -9
- package/node_modules/zod/v4/core/api.js +21 -4
- package/node_modules/zod/v4/core/checks.cjs +37 -31
- package/node_modules/zod/v4/core/checks.d.cts +13 -13
- package/node_modules/zod/v4/core/checks.d.ts +13 -13
- package/node_modules/zod/v4/core/checks.js +37 -31
- package/node_modules/zod/v4/core/compile.cjs +1813 -0
- package/node_modules/zod/v4/core/compile.d.cts +51 -0
- package/node_modules/zod/v4/core/compile.d.ts +51 -0
- package/node_modules/zod/v4/core/compile.js +1783 -0
- package/node_modules/zod/v4/core/core.cjs +81 -18
- package/node_modules/zod/v4/core/core.d.cts +16 -4
- package/node_modules/zod/v4/core/core.d.ts +16 -4
- package/node_modules/zod/v4/core/core.js +82 -19
- package/node_modules/zod/v4/core/doc.cjs +5 -7
- package/node_modules/zod/v4/core/doc.d.cts +3 -1
- package/node_modules/zod/v4/core/doc.d.ts +3 -1
- package/node_modules/zod/v4/core/doc.js +5 -7
- package/node_modules/zod/v4/core/errors.cjs +110 -25
- package/node_modules/zod/v4/core/errors.d.cts +4 -0
- package/node_modules/zod/v4/core/errors.d.ts +4 -0
- package/node_modules/zod/v4/core/errors.js +110 -25
- package/node_modules/zod/v4/core/index.cjs +5 -1
- package/node_modules/zod/v4/core/index.d.cts +3 -0
- package/node_modules/zod/v4/core/index.d.ts +3 -0
- package/node_modules/zod/v4/core/index.js +3 -0
- package/node_modules/zod/v4/core/json-schema-generator.cjs +4 -0
- package/node_modules/zod/v4/core/json-schema-generator.d.cts +2 -2
- package/node_modules/zod/v4/core/json-schema-generator.d.ts +2 -2
- package/node_modules/zod/v4/core/json-schema-generator.js +4 -0
- package/node_modules/zod/v4/core/json-schema-processors.cjs +264 -95
- package/node_modules/zod/v4/core/json-schema-processors.js +243 -97
- package/node_modules/zod/v4/core/json-schema.d.cts +2 -1
- package/node_modules/zod/v4/core/json-schema.d.ts +2 -1
- package/node_modules/zod/v4/core/memoizer.cjs +272 -0
- package/node_modules/zod/v4/core/memoizer.d.cts +15 -0
- package/node_modules/zod/v4/core/memoizer.d.ts +15 -0
- package/node_modules/zod/v4/core/memoizer.js +265 -0
- package/node_modules/zod/v4/core/parse.cjs +96 -34
- package/node_modules/zod/v4/core/parse.d.cts +14 -11
- package/node_modules/zod/v4/core/parse.d.ts +14 -11
- package/node_modules/zod/v4/core/parse.js +94 -33
- package/node_modules/zod/v4/core/regexes.cjs +27 -15
- package/node_modules/zod/v4/core/regexes.d.cts +2 -0
- package/node_modules/zod/v4/core/regexes.d.ts +2 -0
- package/node_modules/zod/v4/core/regexes.js +24 -13
- package/node_modules/zod/v4/core/registries.js +2 -2
- package/node_modules/zod/v4/core/schemas.cjs +537 -326
- package/node_modules/zod/v4/core/schemas.d.cts +100 -31
- package/node_modules/zod/v4/core/schemas.d.ts +100 -31
- package/node_modules/zod/v4/core/schemas.js +526 -325
- package/node_modules/zod/v4/core/to-json-schema.cjs +242 -39
- package/node_modules/zod/v4/core/to-json-schema.d.cts +42 -3
- package/node_modules/zod/v4/core/to-json-schema.d.ts +42 -3
- package/node_modules/zod/v4/core/to-json-schema.js +241 -39
- package/node_modules/zod/v4/core/util.cjs +212 -31
- package/node_modules/zod/v4/core/util.d.cts +58 -1
- package/node_modules/zod/v4/core/util.d.ts +58 -1
- package/node_modules/zod/v4/core/util.js +202 -30
- package/node_modules/zod/v4/core/versions.cjs +2 -2
- package/node_modules/zod/v4/core/versions.d.cts +1 -1
- package/node_modules/zod/v4/core/versions.d.ts +1 -1
- package/node_modules/zod/v4/core/versions.js +2 -2
- package/node_modules/zod/v4/core/visit.cjs +195 -0
- package/node_modules/zod/v4/core/visit.d.cts +30 -0
- package/node_modules/zod/v4/core/visit.d.ts +30 -0
- package/node_modules/zod/v4/core/visit.js +169 -0
- package/node_modules/zod/v4/index.cjs +15 -5
- package/node_modules/zod/v4/index.d.cts +2 -2
- package/node_modules/zod/v4/index.d.ts +2 -2
- package/node_modules/zod/v4/index.js +3 -2
- package/node_modules/zod/v4/locales/ar.cjs +3 -0
- package/node_modules/zod/v4/locales/ar.js +3 -0
- package/node_modules/zod/v4/locales/az.cjs +3 -0
- package/node_modules/zod/v4/locales/az.js +3 -0
- package/node_modules/zod/v4/locales/be.cjs +10 -0
- package/node_modules/zod/v4/locales/be.js +10 -0
- package/node_modules/zod/v4/locales/bg.cjs +3 -0
- package/node_modules/zod/v4/locales/bg.js +3 -0
- package/node_modules/zod/v4/locales/bn.cjs +138 -0
- package/node_modules/zod/v4/locales/bn.d.cts +5 -0
- package/node_modules/zod/v4/locales/bn.d.ts +4 -0
- package/node_modules/zod/v4/locales/bn.js +111 -0
- package/node_modules/zod/v4/locales/ca.cjs +3 -0
- package/node_modules/zod/v4/locales/ca.js +3 -0
- package/node_modules/zod/v4/locales/ckb.cjs +158 -0
- package/node_modules/zod/v4/locales/ckb.d.cts +5 -0
- package/node_modules/zod/v4/locales/ckb.d.ts +4 -0
- package/node_modules/zod/v4/locales/ckb.js +131 -0
- package/node_modules/zod/v4/locales/cs.cjs +3 -0
- package/node_modules/zod/v4/locales/cs.js +3 -0
- package/node_modules/zod/v4/locales/da.cjs +5 -2
- package/node_modules/zod/v4/locales/da.js +5 -2
- package/node_modules/zod/v4/locales/de.cjs +3 -0
- package/node_modules/zod/v4/locales/de.js +3 -0
- package/node_modules/zod/v4/locales/el.cjs +1 -0
- package/node_modules/zod/v4/locales/el.js +1 -0
- package/node_modules/zod/v4/locales/en.cjs +14 -4
- package/node_modules/zod/v4/locales/en.js +14 -4
- package/node_modules/zod/v4/locales/eo.cjs +3 -0
- package/node_modules/zod/v4/locales/eo.js +3 -0
- package/node_modules/zod/v4/locales/es.cjs +2 -0
- package/node_modules/zod/v4/locales/es.js +2 -0
- package/node_modules/zod/v4/locales/fa.cjs +3 -0
- package/node_modules/zod/v4/locales/fa.js +3 -0
- package/node_modules/zod/v4/locales/fi.cjs +3 -0
- package/node_modules/zod/v4/locales/fi.js +3 -0
- package/node_modules/zod/v4/locales/fr-CA.cjs +3 -0
- package/node_modules/zod/v4/locales/fr-CA.js +3 -0
- package/node_modules/zod/v4/locales/fr.cjs +16 -14
- package/node_modules/zod/v4/locales/fr.js +16 -14
- package/node_modules/zod/v4/locales/gu.cjs +138 -0
- package/node_modules/zod/v4/locales/gu.d.cts +5 -0
- package/node_modules/zod/v4/locales/gu.d.ts +4 -0
- package/node_modules/zod/v4/locales/gu.js +111 -0
- package/node_modules/zod/v4/locales/he.cjs +5 -0
- package/node_modules/zod/v4/locales/he.js +5 -0
- package/node_modules/zod/v4/locales/hi.cjs +136 -0
- package/node_modules/zod/v4/locales/hi.d.cts +5 -0
- package/node_modules/zod/v4/locales/hi.d.ts +4 -0
- package/node_modules/zod/v4/locales/hi.js +109 -0
- package/node_modules/zod/v4/locales/hr.cjs +2 -0
- package/node_modules/zod/v4/locales/hr.js +2 -0
- package/node_modules/zod/v4/locales/hu.cjs +3 -0
- package/node_modules/zod/v4/locales/hu.js +3 -0
- package/node_modules/zod/v4/locales/hy.cjs +9 -0
- package/node_modules/zod/v4/locales/hy.js +9 -0
- package/node_modules/zod/v4/locales/id.cjs +3 -0
- package/node_modules/zod/v4/locales/id.js +3 -0
- package/node_modules/zod/v4/locales/index.cjs +22 -2
- package/node_modules/zod/v4/locales/index.d.cts +10 -0
- package/node_modules/zod/v4/locales/index.d.ts +10 -0
- package/node_modules/zod/v4/locales/index.js +10 -0
- package/node_modules/zod/v4/locales/is.cjs +3 -0
- package/node_modules/zod/v4/locales/is.js +3 -0
- package/node_modules/zod/v4/locales/it.cjs +3 -0
- package/node_modules/zod/v4/locales/it.js +3 -0
- package/node_modules/zod/v4/locales/ja.cjs +3 -0
- package/node_modules/zod/v4/locales/ja.js +3 -0
- package/node_modules/zod/v4/locales/ka.cjs +3 -0
- package/node_modules/zod/v4/locales/ka.js +3 -0
- package/node_modules/zod/v4/locales/km.cjs +3 -0
- package/node_modules/zod/v4/locales/km.js +3 -0
- package/node_modules/zod/v4/locales/kn.cjs +141 -0
- package/node_modules/zod/v4/locales/kn.d.cts +5 -0
- package/node_modules/zod/v4/locales/kn.d.ts +4 -0
- package/node_modules/zod/v4/locales/kn.js +114 -0
- package/node_modules/zod/v4/locales/ko.cjs +3 -0
- package/node_modules/zod/v4/locales/ko.js +3 -0
- package/node_modules/zod/v4/locales/lt.cjs +2 -0
- package/node_modules/zod/v4/locales/lt.js +2 -0
- package/node_modules/zod/v4/locales/mk.cjs +3 -0
- package/node_modules/zod/v4/locales/mk.js +3 -0
- package/node_modules/zod/v4/locales/ms.cjs +3 -0
- package/node_modules/zod/v4/locales/ms.js +3 -0
- package/node_modules/zod/v4/locales/ne.cjs +136 -0
- package/node_modules/zod/v4/locales/ne.d.cts +5 -0
- package/node_modules/zod/v4/locales/ne.d.ts +4 -0
- package/node_modules/zod/v4/locales/ne.js +109 -0
- package/node_modules/zod/v4/locales/nl.cjs +3 -0
- package/node_modules/zod/v4/locales/nl.js +3 -0
- package/node_modules/zod/v4/locales/nn.cjs +138 -0
- package/node_modules/zod/v4/locales/nn.d.cts +5 -0
- package/node_modules/zod/v4/locales/nn.d.ts +4 -0
- package/node_modules/zod/v4/locales/nn.js +111 -0
- package/node_modules/zod/v4/locales/no.cjs +5 -2
- package/node_modules/zod/v4/locales/no.js +5 -2
- package/node_modules/zod/v4/locales/ota.cjs +3 -0
- package/node_modules/zod/v4/locales/ota.js +3 -0
- package/node_modules/zod/v4/locales/pl.cjs +3 -0
- package/node_modules/zod/v4/locales/pl.js +3 -0
- package/node_modules/zod/v4/locales/ps.cjs +3 -0
- package/node_modules/zod/v4/locales/ps.js +3 -0
- package/node_modules/zod/v4/locales/pt-BR.cjs +168 -0
- package/node_modules/zod/v4/locales/pt-BR.d.cts +5 -0
- package/node_modules/zod/v4/locales/pt-BR.d.ts +4 -0
- package/node_modules/zod/v4/locales/pt-BR.js +141 -0
- package/node_modules/zod/v4/locales/pt.cjs +87 -55
- package/node_modules/zod/v4/locales/pt.js +87 -55
- package/node_modules/zod/v4/locales/ro.cjs +1 -0
- package/node_modules/zod/v4/locales/ro.js +1 -0
- package/node_modules/zod/v4/locales/ru.cjs +10 -0
- package/node_modules/zod/v4/locales/ru.js +10 -0
- package/node_modules/zod/v4/locales/sk.cjs +141 -0
- package/node_modules/zod/v4/locales/sk.d.cts +5 -0
- package/node_modules/zod/v4/locales/sk.d.ts +4 -0
- package/node_modules/zod/v4/locales/sk.js +114 -0
- package/node_modules/zod/v4/locales/sl.cjs +3 -0
- package/node_modules/zod/v4/locales/sl.js +3 -0
- package/node_modules/zod/v4/locales/sv.cjs +5 -2
- package/node_modules/zod/v4/locales/sv.js +5 -2
- package/node_modules/zod/v4/locales/ta.cjs +3 -0
- package/node_modules/zod/v4/locales/ta.js +3 -0
- package/node_modules/zod/v4/locales/th.cjs +3 -0
- package/node_modules/zod/v4/locales/th.js +3 -0
- package/node_modules/zod/v4/locales/tk.cjs +132 -0
- package/node_modules/zod/v4/locales/tk.d.cts +5 -0
- package/node_modules/zod/v4/locales/tk.d.ts +4 -0
- package/node_modules/zod/v4/locales/tk.js +105 -0
- package/node_modules/zod/v4/locales/tr.cjs +3 -0
- package/node_modules/zod/v4/locales/tr.js +3 -0
- package/node_modules/zod/v4/locales/uk.cjs +3 -0
- package/node_modules/zod/v4/locales/uk.js +3 -0
- package/node_modules/zod/v4/locales/ur.cjs +3 -0
- package/node_modules/zod/v4/locales/ur.js +3 -0
- package/node_modules/zod/v4/locales/uz.cjs +1 -0
- package/node_modules/zod/v4/locales/uz.js +1 -0
- package/node_modules/zod/v4/locales/vi.cjs +3 -0
- package/node_modules/zod/v4/locales/vi.js +3 -0
- package/node_modules/zod/v4/locales/yo.cjs +3 -0
- package/node_modules/zod/v4/locales/yo.js +3 -0
- package/node_modules/zod/v4/locales/zh-CN.cjs +3 -0
- package/node_modules/zod/v4/locales/zh-CN.js +3 -0
- package/node_modules/zod/v4/locales/zh-TW.cjs +3 -0
- package/node_modules/zod/v4/locales/zh-TW.js +3 -0
- package/node_modules/zod/v4/mini/checks.cjs +2 -1
- package/node_modules/zod/v4/mini/checks.d.cts +1 -1
- package/node_modules/zod/v4/mini/checks.d.ts +1 -1
- package/node_modules/zod/v4/mini/checks.js +1 -1
- package/node_modules/zod/v4/mini/deep-partial.cjs +39 -0
- package/node_modules/zod/v4/mini/deep-partial.d.cts +14 -0
- package/node_modules/zod/v4/mini/deep-partial.d.ts +14 -0
- package/node_modules/zod/v4/mini/deep-partial.js +13 -0
- package/node_modules/zod/v4/mini/external.cjs +12 -1
- package/node_modules/zod/v4/mini/external.d.cts +5 -2
- package/node_modules/zod/v4/mini/external.d.ts +5 -2
- package/node_modules/zod/v4/mini/external.js +3 -1
- package/node_modules/zod/v4/mini/in-out.cjs +63 -0
- package/node_modules/zod/v4/mini/in-out.d.cts +8 -0
- package/node_modules/zod/v4/mini/in-out.d.ts +8 -0
- package/node_modules/zod/v4/mini/in-out.js +36 -0
- package/node_modules/zod/v4/mini/parse.cjs +3 -1
- package/node_modules/zod/v4/mini/parse.d.cts +1 -1
- package/node_modules/zod/v4/mini/parse.d.ts +1 -1
- package/node_modules/zod/v4/mini/parse.js +1 -1
- package/node_modules/zod/v4/mini/schemas.cjs +75 -47
- package/node_modules/zod/v4/mini/schemas.d.cts +43 -13
- package/node_modules/zod/v4/mini/schemas.d.ts +43 -13
- package/node_modules/zod/v4/mini/schemas.js +71 -45
- package/openclaw.plugin.json +5 -2
- package/package.json +11 -8
- package/dist/channel-type-CVLZyGYS.js +0 -7
- package/dist/outbound-components-BvskBqEN.js +0 -100
- package/dist/provider.runtime-C-Oh3OHA.js +0 -2
- package/dist/targets-fCxslBZ3.js +0 -3
- package/node_modules/discord-api-types/CHANGELOG.md +0 -2514
- package/node_modules/discord-api-types/scripts/versions.mjs +0 -46
- package/node_modules/zod/src/v4/core/config.ts +0 -15
- /package/dist/{accounts-CwJQoLjM.js → .setup/accounts-CwJQoLjM.mjs} +0 -0
- /package/dist/{active-turn-thread-route-fmHl1HNd.js → .setup/active-turn-thread-route-fmHl1HNd.mjs} +0 -0
- /package/dist/{agent-components.runtime-CEPrf2SY.js → .setup/agent-components.runtime-CEPrf2SY.mjs} +0 -0
- /package/dist/{channel-access-C12aDZ0p.js → .setup/channel-access-C12aDZ0p.mjs} +0 -0
- /package/dist/{command-deploy-store-DFkBTViB.js → .setup/command-deploy-store-DFkBTViB.mjs} +0 -0
- /package/dist/{command-owners-D78sAoOz.js → .setup/command-owners-D78sAoOz.mjs} +0 -0
- /package/dist/{doctor-contract-Co5vRCZ6.js → .setup/doctor-contract-Co5vRCZ6.mjs} +0 -0
- /package/dist/{message-handler.history-CJOsN9w5.js → .setup/message-handler.history-CJOsN9w5.mjs} +0 -0
- /package/dist/{model-picker-preference-primitives-BHT1LkR_.js → .setup/model-picker-preference-primitives-BHT1LkR_.mjs} +0 -0
- /package/dist/{preflight-audio-DrnqFA8U.js → .setup/preflight-audio-DrnqFA8U.mjs} +0 -0
- /package/dist/{runtime-DgnVQ7zW.js → .setup/runtime-DgnVQ7zW.mjs} +0 -0
- /package/dist/{secret-config-contract-DFu9hfU8.js → .setup/secret-config-contract-DFu9hfU8.mjs} +0 -0
- /package/dist/{security-contract-DSHk7I2w.js → .setup/security-contract-DSHk7I2w.mjs} +0 -0
- /package/dist/{security-doctor-nGgPm65L.js → .setup/security-doctor-nGgPm65L.mjs} +0 -0
- /package/dist/{session-contract-BO5tlIdl.js → .setup/session-contract-BO5tlIdl.mjs} +0 -0
- /package/dist/{session-key-normalization-wJgsKPNF.js → .setup/session-key-normalization-wJgsKPNF.mjs} +0 -0
- /package/dist/{thread-binding-api-BDZJD4na.js → .setup/thread-binding-api-BDZJD4na.mjs} +0 -0
- /package/dist/{timeouts-D86uWLt_.js → .setup/timeouts-D86uWLt_.mjs} +0 -0
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { C as parseDiscordActivityCustomIdForInteraction, D as parseDiscordModalCustomIdForInteraction, E as parseDiscordModalCustomId, O as decodeCustomIdComponent, T as parseDiscordComponentCustomIdForInteraction, c as parseExecApprovalData, k as encodeCustomIdComponent, o as parseDiscordQuestionData, w as parseDiscordComponentCustomId, y as buildDiscordActivityCustomId } from "./components-
|
|
3
|
-
import {
|
|
4
|
-
import { c as resolveDiscordAccount, f as resolveDiscordAccountDmPolicy, h as resolveDiscordToken, l as resolveDiscordAccountAllowFrom, m as normalizeDiscordToken, o as mergeDiscordAccountConfig, p as resolveDiscordMaxLinesPerMessage } from "./accounts-CwJQoLjM.
|
|
5
|
-
import { a as
|
|
6
|
-
import { t as getDiscordRuntime } from "./runtime-DgnVQ7zW.
|
|
7
|
-
import { a as isDiscordRateLimitResponseBody, o as summarizeDiscordResponseBody } from "./api-
|
|
8
|
-
import { o as chunkDiscordTextWithMode } from "./retry-
|
|
9
|
-
import { B as validateDiscordProxyUrl, G as unregisterGateway, P as createDiscordRestClient, R as DISCORD_REST_TIMEOUT_MS, V as withValidatedDiscordProxy, W as registerGateway, b as canViewDiscordGuildChannel, w as hasAnyChannelPermissionDiscord } from "./send.shared-
|
|
10
|
-
import { o as formatMention, t as sendMessageDiscord } from "./send.outbound-
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import { c as
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import { t as
|
|
22
|
-
import {
|
|
23
|
-
import { a as
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import { t as
|
|
1
|
+
import { D as Message, E as Guild, G as Row, J as StringSelectMenu, L as Button, O as User, P as Modal, Q as BaseMessageInteractiveComponent, T as CommandWithSubcommands, Y as TextDisplay, a as MessageCreateListener, c as PresenceUpdateListener, d as ThreadDeleteListener, f as ThreadUpdateListener, h as Plugin, i as InteractionCreateListener, k as hasDiscordV2Components, l as ReadyListener, m as Client, n as GuildCreateListener, o as MessageReactionAddListener, q as Separator, r as GuildDeleteListener, s as MessageReactionRemoveListener, t as discord_exports, v as RateLimitError, w as Command, z as Container } from "./discord-BXpHW-cu.mjs";
|
|
2
|
+
import { C as parseDiscordActivityCustomIdForInteraction, D as parseDiscordModalCustomIdForInteraction, E as parseDiscordModalCustomId, O as decodeCustomIdComponent, T as parseDiscordComponentCustomIdForInteraction, c as parseExecApprovalData, d as buildDiscordComponentMessage, k as encodeCustomIdComponent, o as parseDiscordQuestionData, w as parseDiscordComponentCustomId, y as buildDiscordActivityCustomId } from "./components-MqMWUWnE.mjs";
|
|
3
|
+
import { C as resolveTimestampMs, E as getDiscordEndpointRuntime, T as assertDiscordEndpointGatewayUrl, a as normalizeDiscordDisplaySlug, b as formatDiscordReactionEmoji, c as resolveDiscordChannelConfig, f as resolveDiscordGuildEntry, g as resolveDiscordOwnerAllowFrom, h as resolveDiscordOwnerAccess, i as normalizeDiscordAllowList, l as resolveDiscordChannelConfigWithFallback, m as resolveDiscordMemberAllowed, o as normalizeDiscordSlug, p as resolveDiscordMemberAccessState, r as isDiscordGroupAllowedByPolicy, s as resolveDiscordAllowListMatch, t as isDiscordThreadChannelType, u as resolveDiscordChannelPolicyCommandAuthorizer, v as resolveGroupDmAllow, x as formatDiscordUserTag, y as shouldEmitDiscordReactionNotification } from "./channel-type-DKnjV1XW.mjs";
|
|
4
|
+
import { c as resolveDiscordAccount, f as resolveDiscordAccountDmPolicy, h as resolveDiscordToken, l as resolveDiscordAccountAllowFrom, m as normalizeDiscordToken, o as mergeDiscordAccountConfig, p as resolveDiscordMaxLinesPerMessage } from "./accounts-CwJQoLjM.mjs";
|
|
5
|
+
import { a as registerDiscordComponentEntries, o as resolveDiscordComponentEntryWithPersistence, s as resolveDiscordModalEntryWithPersistence, t as editDiscordComponentMessage } from "./send.components-DWQjXhPV.mjs";
|
|
6
|
+
import { t as getDiscordRuntime } from "./runtime-DgnVQ7zW.mjs";
|
|
7
|
+
import { a as isDiscordRateLimitResponseBody, o as summarizeDiscordResponseBody } from "./api-CBK9zcq5.mjs";
|
|
8
|
+
import { o as chunkDiscordTextWithMode } from "./retry-DBfcEgmO.mjs";
|
|
9
|
+
import { B as validateDiscordProxyUrl, G as unregisterGateway, P as createDiscordRestClient, R as DISCORD_REST_TIMEOUT_MS, V as withValidatedDiscordProxy, W as registerGateway, b as canViewDiscordGuildChannel, w as hasAnyChannelPermissionDiscord } from "./send.shared-Zwx6BxQ5.mjs";
|
|
10
|
+
import { o as formatMention, t as sendMessageDiscord } from "./send.outbound-D0hQ7s50.mjs";
|
|
11
|
+
import { n as getDiscordActivitiesRuntime } from "./runtime-BVoa7hhx.mjs";
|
|
12
|
+
import { t as resolveDiscordCommandOwnerAllowFrom } from "./command-owners-D78sAoOz.mjs";
|
|
13
|
+
import { n as resolveDiscordChannelInfoSafe, o as resolveDiscordChannelTopicSafe, r as resolveDiscordChannelNameSafe } from "./channel-access-C12aDZ0p.mjs";
|
|
14
|
+
import { D as resolveDiscordMessageStickers, c as resolveDiscordVoiceAccess, d as resolveFetchedDiscordThreadLikeChannelContext, o as resolveDiscordVoiceEnabled, r as setDiscordTranscriptsVoiceManager, s as authorizeDiscordVoiceIngress, u as resolveDiscordThreadLikeChannelContext } from "./transcripts-source-CuWYgayu.mjs";
|
|
15
|
+
import { i as setPresence, t as clearPresences } from "./presence-cache-dYSHPWMx.mjs";
|
|
16
|
+
import { _ as readMessagesDiscord, s as sendVoiceMessageDiscord } from "./send-CKDczUNL.mjs";
|
|
17
|
+
import { c as raceWithTimeout, u as withAbortTimeout } from "./timeouts-D86uWLt_.mjs";
|
|
18
|
+
import { D as isDiscordExecApprovalClientEnabled, T as getDiscordExecApprovalApprovers, a as resolveDiscordComponentSpec, c as formatDiscordApprovalDisplayValue, d as resolveDiscordBoundConversationRoute, h as resolveDiscordConversationIdentity, l as buildDiscordConversationRouteContext, n as DISCORD_PRESENTATION_CAPABILITIES, p as resolveDiscordEffectiveRoute, r as buildDiscordPresentationPayload, s as DISCORD_APPROVAL_ALLOWED_MENTIONS } from "./outbound-session-route-CqWbuMOm.mjs";
|
|
19
|
+
import { n as discordIngressIdentity, t as selectDiscordLivePolicyConfig } from "./live-policy-config-eKQ-PLdy.mjs";
|
|
20
|
+
import { t as resolveDiscordChannelAllowlist } from "./resolve-channels-BbvsLQOZ.mjs";
|
|
21
|
+
import { t as resolveDiscordUserAllowlist } from "./resolve-users-ByFlR7LQ.mjs";
|
|
22
|
+
import { i as getThreadBindingManager, o as isThreadArchived, u as formatThreadBindingDurationLabel } from "./thread-bindings.manager-eexkKyrG.mjs";
|
|
23
|
+
import { a as probeDiscordApplicationId, r as parseApplicationIdFromToken } from "./probe-CupW4we4.mjs";
|
|
24
|
+
import { i as sanitizeRecentModels, n as normalizeModelRef, r as preferenceTimestampMs, t as buildPreferenceModelKey } from "./model-picker-preference-primitives-BHT1LkR_.mjs";
|
|
25
|
+
import { t as resolveDiscordSenderIdentity } from "./sender-identity-0Ymgvmaj.mjs";
|
|
26
|
+
import { n as hasDiscordApprovalControl, t as discordApprovalMessageUpdates } from "./approval-message-updates-BN7JtScm.mjs";
|
|
27
27
|
import { createRequire } from "node:module";
|
|
28
28
|
import { logDebug, logError } from "openclaw/plugin-sdk/logging-core";
|
|
29
29
|
import { ApplicationCommandOptionType, ButtonStyle, ChannelType, ComponentType, GatewayCloseCodes, GatewayCloseCodes as GatewayCloseCodes$1, GatewayDispatchEvents, GatewayIntentBits, GatewayOpcodes, PermissionFlagsBits } from "discord-api-types/v10";
|
|
@@ -33,15 +33,16 @@ import { createHash, randomUUID } from "node:crypto";
|
|
|
33
33
|
import { MAX_DATE_TIMESTAMP_MS, MAX_TIMER_TIMEOUT_MS, asDateTimestampMs, asSafeIntegerInRange, parseFiniteNumber, parseStrictInteger, parseStrictPositiveInteger, resolveDateTimestampMs, resolveTimestampMsToIsoString } from "openclaw/plugin-sdk/number-runtime";
|
|
34
34
|
import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
|
|
35
35
|
import { inspect } from "node:util";
|
|
36
|
+
import { createHttp1EnvHttpProxyAgent, createHttp1ProxyAgent, createNodeProxyAgent, resolveEnvHttpProxyAgentOptions, wrapFetchWithAbortSignal } from "openclaw/plugin-sdk/fetch-runtime";
|
|
36
37
|
import { readResponseWithLimit } from "openclaw/plugin-sdk/response-limit-runtime";
|
|
37
|
-
import {
|
|
38
|
-
import {
|
|
38
|
+
import { fetchWithSsrFGuard, formatErrorMessage, resolvePinnedHostnameWithPolicy } from "openclaw/plugin-sdk/ssrf-runtime";
|
|
39
|
+
import { PlatformMessageNotDispatchedError, formatErrorMessage as formatErrorMessage$1, toErrorObject } from "openclaw/plugin-sdk/error-runtime";
|
|
39
40
|
import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
40
41
|
import { resolveAgentRoute } from "openclaw/plugin-sdk/routing";
|
|
41
42
|
import { asFiniteNumber, asOptionalRecord, normalizeLowercaseStringOrEmpty, normalizeOptionalLowercaseString, normalizeOptionalString, normalizeStringEntries, parseFiniteNumber as parseFiniteNumber$1, parseStrictNonNegativeInteger as parseStrictNonNegativeInteger$1, summarizeStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
42
43
|
import { createRuntimeConfigReader, getRuntimeConfig, getRuntimeConfigSnapshot } from "openclaw/plugin-sdk/runtime-config-snapshot";
|
|
43
|
-
import {
|
|
44
|
-
import {
|
|
44
|
+
import { renderPresentationForDelivery } from "openclaw/plugin-sdk/interactive-runtime";
|
|
45
|
+
import { hasOutboundReplyContent, resolveSendableOutboundReplyParts, resolveTextChunksWithFallback } from "openclaw/plugin-sdk/reply-payload";
|
|
45
46
|
import { createNonExitingRuntime, createSubsystemLogger, danger, formatDurationSeconds, isVerbose, logVerbose, shouldLogVerbose, sleepWithAbort, warn } from "openclaw/plugin-sdk/runtime-env";
|
|
46
47
|
import { sliceUtf16Safe, truncateUtf16Safe, withTimeout } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
47
48
|
import { addAllowlistUserEntriesFromConfigEntry, buildAllowlistResolutionSummary, canonicalizeAllowlistWithResolvedIds, patchAllowlistUsersInConfigEntries, summarizeMapping } from "openclaw/plugin-sdk/allow-from";
|
|
@@ -54,8 +55,9 @@ import { loadWebMedia } from "openclaw/plugin-sdk/web-media";
|
|
|
54
55
|
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
55
56
|
import { buildCommandTextFromArgs, findCommandByNativeName, formatCommandArgMenuTitle, listChatCommands, listNativeCommandSpecsForConfig, listSkillCommandsForAgents, resolveCommandAuthorizedFromAuthorizers, resolveEffectiveAgentRuntime, resolveNativeCommandSessionTargets, resolveStoredModelOverride, serializeCommandArgs } from "openclaw/plugin-sdk/command-auth-native";
|
|
56
57
|
import { GROUP_POLICY_BLOCKED_LABEL, resolveDefaultGroupPolicy, resolveOpenProviderRuntimeGroupPolicy, warnMissingProviderGroupPolicyFallbackOnce } from "openclaw/plugin-sdk/runtime-group-policy";
|
|
58
|
+
import { pruneMapToMaxSize } from "openclaw/plugin-sdk/collection-runtime";
|
|
57
59
|
import { finalizeInboundContext } from "openclaw/plugin-sdk/reply-dispatch-runtime";
|
|
58
|
-
import { createChannelPartialDeliveryError, dispatchChannelInboundTurn, formatInboundEnvelope, hasVisibleInboundReplyDispatch, isChannelPartialDeliveryError, resolveEnvelopeFormatOptions, resolveInboundSupplementalSenderAllowed, runChannelInboundEvent } from "openclaw/plugin-sdk/channel-inbound";
|
|
60
|
+
import { createChannelPartialDeliveryError, createCommandTurnContext, dispatchChannelInboundTurn, formatInboundEnvelope, hasVisibleInboundReplyDispatch, isChannelPartialDeliveryError, resolveEnvelopeFormatOptions, resolveInboundSupplementalSenderAllowed, runChannelInboundEvent } from "openclaw/plugin-sdk/channel-inbound";
|
|
59
61
|
import path from "node:path";
|
|
60
62
|
import { resolvePinnedMainDmOwnerFromAllowlist as resolvePinnedMainDmOwnerFromAllowlist$1 } from "openclaw/plugin-sdk/security-runtime";
|
|
61
63
|
import { createChannelPairingChallengeIssuer } from "openclaw/plugin-sdk/channel-pairing";
|
|
@@ -78,6 +80,7 @@ import * as dns from "node:dns";
|
|
|
78
80
|
import { buildCommandTextFromArgs as buildCommandTextFromArgs$1, findCommandByNativeName as findCommandByNativeName$1, mergeNativeCommandSpecs, parseCommandArgs, resolveCommandArgChoices, resolveCommandArgMenu, serializeCommandArgs as serializeCommandArgs$1 } from "openclaw/plugin-sdk/native-command-registry";
|
|
79
81
|
import { PLUGIN_COMMAND_DISPATCH } from "openclaw/plugin-sdk/plugin-command-runtime";
|
|
80
82
|
import { resolveDirectStatusReplyForSession } from "openclaw/plugin-sdk/command-status-runtime";
|
|
83
|
+
import * as modelsProviderRuntime from "openclaw/plugin-sdk/models-provider-runtime";
|
|
81
84
|
import { normalizeProviderId } from "openclaw/plugin-sdk/provider-model-shared";
|
|
82
85
|
import { EventEmitter } from "node:events";
|
|
83
86
|
import { Agent as Agent$1 } from "node:https";
|
|
@@ -176,7 +179,7 @@ function resolveDiscordOnlinePresenceEvent(params) {
|
|
|
176
179
|
//#region extensions/discord/src/monitor/presence-cooldown-store.ts
|
|
177
180
|
const DISCORD_PRESENCE_COOLDOWN_MAX_ENTRIES = 25e3;
|
|
178
181
|
function openDiscordPresenceCooldownStore() {
|
|
179
|
-
return getDiscordRuntime().state.
|
|
182
|
+
return getDiscordRuntime().state.openKeyedStore({
|
|
180
183
|
namespace: "presence-greeting-cooldowns",
|
|
181
184
|
maxEntries: DISCORD_PRESENCE_COOLDOWN_MAX_ENTRIES,
|
|
182
185
|
overflowPolicy: "reject-new",
|
|
@@ -909,11 +912,21 @@ var DiscordPresenceListener = class extends PresenceUpdateListener {
|
|
|
909
912
|
this.pendingGuildSeeds = /* @__PURE__ */ new Map();
|
|
910
913
|
this.guildPresenceState = /* @__PURE__ */ new Map();
|
|
911
914
|
this.gatewayGeneration = 0;
|
|
915
|
+
this.stopped = false;
|
|
916
|
+
this.activeRuns = /* @__PURE__ */ new Set();
|
|
912
917
|
this.cooldownStore = params.cooldownStore ?? openDiscordPresenceCooldownStore();
|
|
913
918
|
this.presenceBaseline = params.presenceBaseline ?? new DiscordPresenceBaselineCache();
|
|
914
919
|
this.emissionGate = params.emissionGate ?? new DiscordPresenceEmissionGate();
|
|
915
920
|
}
|
|
916
921
|
async seedGuildSnapshot(data) {
|
|
922
|
+
if (this.stopped) return;
|
|
923
|
+
if (data.unavailable !== true && "presences" in data && Array.isArray(data.presences)) for (const presence of data.presences) {
|
|
924
|
+
const userId = presence.user?.id;
|
|
925
|
+
if (userId) setPresence(this.params.accountId, userId, {
|
|
926
|
+
...presence,
|
|
927
|
+
guild_id: data.id
|
|
928
|
+
});
|
|
929
|
+
}
|
|
917
930
|
if (!this.params.readPolicy) {
|
|
918
931
|
this.seedGuildSnapshotWithPolicy(data, this.params.guildEntries);
|
|
919
932
|
return;
|
|
@@ -962,24 +975,32 @@ var DiscordPresenceListener = class extends PresenceUpdateListener {
|
|
|
962
975
|
}
|
|
963
976
|
}
|
|
964
977
|
async handle(data, client) {
|
|
965
|
-
const pendingSeed = this.pendingGuildSeeds.get(data.guild_id);
|
|
966
|
-
if (pendingSeed && !await pendingSeed) return;
|
|
967
978
|
const userId = data.user?.id;
|
|
968
|
-
if (!userId) return;
|
|
979
|
+
if (!userId || this.stopped) return;
|
|
969
980
|
setPresence(this.params.accountId, userId, data);
|
|
981
|
+
const pendingSeed = this.pendingGuildSeeds.get(data.guild_id);
|
|
982
|
+
if (pendingSeed && !await pendingSeed) return;
|
|
983
|
+
if (this.stopped) return;
|
|
970
984
|
const presenceKey = `${this.params.accountId}:${data.guild_id}:${userId}`;
|
|
971
985
|
const gatewayGeneration = this.gatewayGeneration;
|
|
972
986
|
const guildGeneration = this.guildPresenceState.get(data.guild_id)?.generation ?? 0;
|
|
973
987
|
const run = (this.pendingByGuildUser.get(presenceKey) ?? Promise.resolve()).then(() => this.handleSerial(data, client, userId, presenceKey, gatewayGeneration, guildGeneration), () => this.handleSerial(data, client, userId, presenceKey, gatewayGeneration, guildGeneration));
|
|
974
988
|
this.pendingByGuildUser.set(presenceKey, run);
|
|
989
|
+
this.activeRuns.add(run);
|
|
975
990
|
try {
|
|
976
991
|
await run;
|
|
977
992
|
} catch (err) {
|
|
978
993
|
(this.params.logger ?? discordEventQueueLog).error(danger(`discord presence handler failed: ${String(err)}`));
|
|
979
994
|
} finally {
|
|
995
|
+
this.activeRuns.delete(run);
|
|
980
996
|
if (this.pendingByGuildUser.get(presenceKey) === run) this.pendingByGuildUser.delete(presenceKey);
|
|
981
997
|
}
|
|
982
998
|
}
|
|
999
|
+
async stop() {
|
|
1000
|
+
this.stopped = true;
|
|
1001
|
+
this.resetGatewaySession();
|
|
1002
|
+
await Promise.allSettled(this.activeRuns);
|
|
1003
|
+
}
|
|
983
1004
|
resetGatewaySession() {
|
|
984
1005
|
this.gatewayGeneration += 1;
|
|
985
1006
|
this.emissionGate.noteGatewaySessionReset(this.params.nowMs?.() ?? Date.now());
|
|
@@ -1014,6 +1035,8 @@ var DiscordPresenceListener = class extends PresenceUpdateListener {
|
|
|
1014
1035
|
})?.presenceEvents;
|
|
1015
1036
|
if (!config || config.enabled === false) return;
|
|
1016
1037
|
if (config.users !== void 0 && !config.users.includes(userId)) return;
|
|
1038
|
+
const lastEmittedAtMs = await this.cooldownStore.lookup(presenceKey);
|
|
1039
|
+
if (!this.isCurrentGeneration(data.guild_id, gatewayGeneration, guildGeneration) || policy?.isCurrent() === false) return;
|
|
1017
1040
|
const nowMs = this.params.nowMs?.() ?? Date.now();
|
|
1018
1041
|
const presenceScope = data.guild_id;
|
|
1019
1042
|
const presenceEvent = resolveDiscordOnlinePresenceEvent({
|
|
@@ -1022,7 +1045,7 @@ var DiscordPresenceListener = class extends PresenceUpdateListener {
|
|
|
1022
1045
|
availabilityKind: this.presenceBaseline.isOffline(presenceScope, presenceKey) ? "observed-offline" : this.guildPresenceState.get(data.guild_id)?.inferUnknownAsNewlyAvailable === true && !this.presenceBaseline.isOnline(presenceScope, presenceKey) ? "first-seen-after-snapshot" : null,
|
|
1023
1046
|
botUserId: this.params.botUserId,
|
|
1024
1047
|
nowMs,
|
|
1025
|
-
lastEmittedAtMs
|
|
1048
|
+
lastEmittedAtMs
|
|
1026
1049
|
});
|
|
1027
1050
|
if (!presenceEvent) {
|
|
1028
1051
|
if (isDiscordOfflineStatus(data.status)) this.recordPresenceBaseline(data.guild_id, presenceKey, "offline");
|
|
@@ -1083,7 +1106,8 @@ var DiscordPresenceListener = class extends PresenceUpdateListener {
|
|
|
1083
1106
|
}
|
|
1084
1107
|
});
|
|
1085
1108
|
try {
|
|
1086
|
-
cooldownReserved = this.cooldownStore.registerIfAbsent(presenceKey, nowMs, { ttlMs: DISCORD_PRESENCE_GREETING_COOLDOWN_MS });
|
|
1109
|
+
cooldownReserved = await this.cooldownStore.registerIfAbsent(presenceKey, nowMs, { ttlMs: DISCORD_PRESENCE_GREETING_COOLDOWN_MS });
|
|
1110
|
+
if (!this.isCurrentGeneration(data.guild_id, gatewayGeneration, guildGeneration) || policy?.isCurrent() === false) return;
|
|
1087
1111
|
if (!cooldownReserved) {
|
|
1088
1112
|
this.recordPresenceBaseline(data.guild_id, presenceKey, "online");
|
|
1089
1113
|
return;
|
|
@@ -1117,11 +1141,11 @@ var DiscordPresenceListener = class extends PresenceUpdateListener {
|
|
|
1117
1141
|
});
|
|
1118
1142
|
} finally {
|
|
1119
1143
|
if (!burstCommitted) this.emissionGate.releaseBurst(data.guild_id, burstReservation);
|
|
1120
|
-
if (cooldownReserved && !burstCommitted
|
|
1144
|
+
if (cooldownReserved && !burstCommitted) await this.cooldownStore.deleteIfEqual?.(presenceKey, nowMs);
|
|
1121
1145
|
}
|
|
1122
1146
|
}
|
|
1123
1147
|
isCurrentGeneration(guildId, gatewayGeneration, guildGeneration) {
|
|
1124
|
-
return gatewayGeneration === this.gatewayGeneration && guildGeneration === (this.guildPresenceState.get(guildId)?.generation ?? 0);
|
|
1148
|
+
return !this.stopped && gatewayGeneration === this.gatewayGeneration && guildGeneration === (this.guildPresenceState.get(guildId)?.generation ?? 0);
|
|
1125
1149
|
}
|
|
1126
1150
|
recordPresenceBaseline(guildId, key, status) {
|
|
1127
1151
|
const evictedGuildId = status === "offline" ? this.presenceBaseline.observeOffline(guildId, key) : this.presenceBaseline.observeOnline(guildId, key);
|
|
@@ -1157,30 +1181,49 @@ var DiscordPresenceReadyListener = class extends ReadyListener {
|
|
|
1157
1181
|
this.presenceListener.resetGatewaySession();
|
|
1158
1182
|
}
|
|
1159
1183
|
};
|
|
1184
|
+
const DISCORD_THREAD_REJOIN_CLAIM_MAX_ENTRIES = 1e4;
|
|
1160
1185
|
var DiscordThreadUpdateListener = class extends ThreadUpdateListener {
|
|
1161
1186
|
constructor(cfg, logger) {
|
|
1162
1187
|
super();
|
|
1163
1188
|
this.cfg = cfg;
|
|
1164
1189
|
this.logger = logger;
|
|
1190
|
+
this.rejoinClaims = /* @__PURE__ */ new Map();
|
|
1165
1191
|
}
|
|
1166
|
-
|
|
1192
|
+
resetGatewaySession() {
|
|
1193
|
+
this.rejoinClaims.clear();
|
|
1194
|
+
}
|
|
1195
|
+
async handle(data, client) {
|
|
1167
1196
|
await runDiscordListenerWithSlowLog({
|
|
1168
1197
|
logger: this.logger,
|
|
1169
1198
|
listener: this.constructor.name,
|
|
1170
1199
|
event: this.type,
|
|
1171
1200
|
run: async () => {
|
|
1172
|
-
if (!isThreadArchived(data)) return;
|
|
1173
1201
|
const threadId = "id" in data && typeof data.id === "string" ? data.id : void 0;
|
|
1174
1202
|
if (!threadId) return;
|
|
1175
1203
|
const logger = this.logger ?? discordEventQueueLog;
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
count
|
|
1183
|
-
|
|
1204
|
+
if (isThreadArchived(data)) {
|
|
1205
|
+
this.rejoinClaims.delete(threadId);
|
|
1206
|
+
const count = await closeDiscordThreadSessions({
|
|
1207
|
+
cfg: this.cfg,
|
|
1208
|
+
threadId
|
|
1209
|
+
});
|
|
1210
|
+
if (count > 0) logger.info("Discord thread archived — reset sessions", {
|
|
1211
|
+
threadId,
|
|
1212
|
+
count
|
|
1213
|
+
});
|
|
1214
|
+
return;
|
|
1215
|
+
}
|
|
1216
|
+
if (this.rejoinClaims.has(threadId)) return;
|
|
1217
|
+
const claim = Symbol(threadId);
|
|
1218
|
+
this.rejoinClaims.set(threadId, claim);
|
|
1219
|
+
pruneMapToMaxSize(this.rejoinClaims, DISCORD_THREAD_REJOIN_CLAIM_MAX_ENTRIES);
|
|
1220
|
+
try {
|
|
1221
|
+
await client.rest.put(`/channels/${threadId}/thread-members/@me`);
|
|
1222
|
+
logger.info("Discord active thread — rejoined thread", { threadId });
|
|
1223
|
+
} catch (err) {
|
|
1224
|
+
if (this.rejoinClaims.get(threadId) === claim) this.rejoinClaims.delete(threadId);
|
|
1225
|
+
logger.warn(danger(`discord thread rejoin failed: ${String(err)}`), { threadId });
|
|
1226
|
+
}
|
|
1184
1227
|
},
|
|
1185
1228
|
onError: (err) => {
|
|
1186
1229
|
(this.logger ?? discordEventQueueLog).error(danger(`discord thread-update handler failed: ${String(err)}`));
|
|
@@ -1188,6 +1231,15 @@ var DiscordThreadUpdateListener = class extends ThreadUpdateListener {
|
|
|
1188
1231
|
});
|
|
1189
1232
|
}
|
|
1190
1233
|
};
|
|
1234
|
+
var DiscordThreadReadyListener = class extends ReadyListener {
|
|
1235
|
+
constructor(threadUpdateListener) {
|
|
1236
|
+
super();
|
|
1237
|
+
this.threadUpdateListener = threadUpdateListener;
|
|
1238
|
+
}
|
|
1239
|
+
handle() {
|
|
1240
|
+
this.threadUpdateListener.resetGatewaySession();
|
|
1241
|
+
}
|
|
1242
|
+
};
|
|
1191
1243
|
var DiscordThreadDeleteListener = class extends ThreadDeleteListener {
|
|
1192
1244
|
constructor(cfg, accountId, logger) {
|
|
1193
1245
|
super();
|
|
@@ -1431,7 +1483,7 @@ async function resolveGuildEntriesByChannelAllowlist(params) {
|
|
|
1431
1483
|
summarizeMapping("discord channels", mapping, unresolved, params.runtime);
|
|
1432
1484
|
return nextGuilds;
|
|
1433
1485
|
} catch (err) {
|
|
1434
|
-
params.runtime.log?.(`discord channel resolve failed; using config entries. ${formatErrorMessage
|
|
1486
|
+
params.runtime.log?.(`discord channel resolve failed; using config entries. ${formatErrorMessage(err)}`);
|
|
1435
1487
|
return params.guildEntries;
|
|
1436
1488
|
}
|
|
1437
1489
|
}
|
|
@@ -1455,7 +1507,7 @@ async function resolveAllowFromByUserAllowlist(params) {
|
|
|
1455
1507
|
summarizeMapping("discord users", mapping, unresolved, params.runtime);
|
|
1456
1508
|
return allowFrom;
|
|
1457
1509
|
} catch (err) {
|
|
1458
|
-
params.runtime.log?.(`discord user resolve failed; using config entries. ${formatErrorMessage
|
|
1510
|
+
params.runtime.log?.(`discord user resolve failed; using config entries. ${formatErrorMessage(err)}`);
|
|
1459
1511
|
return params.allowFrom;
|
|
1460
1512
|
}
|
|
1461
1513
|
}
|
|
@@ -1502,7 +1554,7 @@ async function resolveGuildEntriesByUserAllowlist(params) {
|
|
|
1502
1554
|
summarizeMapping("discord channel users", mapping, unresolved, params.runtime);
|
|
1503
1555
|
return nextGuilds;
|
|
1504
1556
|
} catch (err) {
|
|
1505
|
-
params.runtime.log?.(`discord channel user resolve failed; using config entries. ${formatErrorMessage
|
|
1557
|
+
params.runtime.log?.(`discord channel user resolve failed; using config entries. ${formatErrorMessage(err)}`);
|
|
1506
1558
|
return params.guildEntries;
|
|
1507
1559
|
}
|
|
1508
1560
|
}
|
|
@@ -1588,6 +1640,19 @@ function createDiscordDnsLookup() {
|
|
|
1588
1640
|
});
|
|
1589
1641
|
};
|
|
1590
1642
|
}
|
|
1643
|
+
function createDiscordEndpointDnsLookup(endpointHostname) {
|
|
1644
|
+
const normalizedEndpointHostname = normalizeHostname(endpointHostname);
|
|
1645
|
+
if (!normalizedEndpointHostname) throw new Error("Discord endpoint Gateway hostname is required");
|
|
1646
|
+
const policy = {
|
|
1647
|
+
allowedHostnames: [normalizedEndpointHostname],
|
|
1648
|
+
hostnameAllowlist: [normalizedEndpointHostname]
|
|
1649
|
+
};
|
|
1650
|
+
return (hostname, options, callback) => {
|
|
1651
|
+
resolvePinnedHostnameWithPolicy(hostname, { policy }).then((pinned) => pinned.lookup(pinned.hostname, options, callback), (error) => {
|
|
1652
|
+
callback(error instanceof Error ? error : new Error(String(error)), "", 4);
|
|
1653
|
+
});
|
|
1654
|
+
};
|
|
1655
|
+
}
|
|
1591
1656
|
//#endregion
|
|
1592
1657
|
//#region extensions/discord/src/monitor/rest-fetch.ts
|
|
1593
1658
|
const discordDnsLookup$1 = createDiscordDnsLookup();
|
|
@@ -1606,7 +1671,7 @@ function createEnvProxyDiscordRestDispatcher(runtime) {
|
|
|
1606
1671
|
connect: { lookup: discordDnsLookup$1 }
|
|
1607
1672
|
});
|
|
1608
1673
|
} catch (err) {
|
|
1609
|
-
runtime.error?.(danger(`discord: env proxy unavailable for REST fetch; using direct dispatcher: ${formatErrorMessage(err)}`));
|
|
1674
|
+
runtime.error?.(danger(`discord: env proxy unavailable for REST fetch; using direct dispatcher: ${formatErrorMessage$1(err)}`));
|
|
1610
1675
|
return;
|
|
1611
1676
|
}
|
|
1612
1677
|
}
|
|
@@ -1800,7 +1865,7 @@ function resolveDiscordInteractionMessageParts(payload) {
|
|
|
1800
1865
|
}
|
|
1801
1866
|
function hasRenderableReplyPayload(payload) {
|
|
1802
1867
|
const { components, embeds } = resolveDiscordInteractionMessageParts(payload);
|
|
1803
|
-
return
|
|
1868
|
+
return hasOutboundReplyContent(payload) || Boolean(components || embeds);
|
|
1804
1869
|
}
|
|
1805
1870
|
async function safeDiscordInteractionCall(label, fn) {
|
|
1806
1871
|
try {
|
|
@@ -1818,9 +1883,24 @@ async function settleDiscordInteractionWithoutVisibleReply(interaction) {
|
|
|
1818
1883
|
await safeDiscordInteractionCall("interaction delete deferred reply", () => interaction.deleteReply());
|
|
1819
1884
|
}
|
|
1820
1885
|
async function deliverDiscordInteractionReply(params) {
|
|
1821
|
-
const { interaction,
|
|
1886
|
+
const { interaction, textLimit, maxLinesPerMessage, preferFollowUp, chunkMode } = params;
|
|
1887
|
+
const nativeParts = resolveDiscordInteractionMessageParts(params.payload);
|
|
1888
|
+
const preserveNativeParts = resolveSendableOutboundReplyParts(params.payload).hasMedia || Boolean(nativeParts.components || nativeParts.embeds);
|
|
1889
|
+
const payload = await renderPresentationForDelivery({
|
|
1890
|
+
presentationCapabilities: DISCORD_PRESENTATION_CAPABILITIES,
|
|
1891
|
+
renderPresentation: (adapted) => preserveNativeParts ? null : buildDiscordPresentationPayload({
|
|
1892
|
+
payload: adapted,
|
|
1893
|
+
presentation: adapted.presentation
|
|
1894
|
+
})
|
|
1895
|
+
}, params.payload);
|
|
1896
|
+
const componentSpec = preserveNativeParts ? void 0 : await resolveDiscordComponentSpec(payload);
|
|
1897
|
+
let componentBuild = componentSpec ? buildDiscordComponentMessage({
|
|
1898
|
+
spec: componentSpec,
|
|
1899
|
+
...params.componentRoute
|
|
1900
|
+
}) : void 0;
|
|
1822
1901
|
const reply = resolveSendableOutboundReplyParts(payload);
|
|
1823
1902
|
let { components: firstMessageComponents, embeds: firstMessageEmbeds } = resolveDiscordInteractionMessageParts(payload);
|
|
1903
|
+
if (componentBuild) firstMessageComponents = componentBuild.components;
|
|
1824
1904
|
let payloadDelivered = false;
|
|
1825
1905
|
const sendMessage = async (content, files, components, embeds) => {
|
|
1826
1906
|
const hasV2 = hasDiscordV2Components(components);
|
|
@@ -1834,11 +1914,19 @@ async function deliverDiscordInteractionReply(params) {
|
|
|
1834
1914
|
let result;
|
|
1835
1915
|
try {
|
|
1836
1916
|
result = await safeDiscordInteractionCall("interaction send", async () => {
|
|
1837
|
-
|
|
1838
|
-
else await interaction.followUp(payloadLocal);
|
|
1917
|
+
const sent = !preferFollowUp && !payloadDelivered ? await interaction.reply(payloadLocal) : await interaction.followUp(payloadLocal);
|
|
1839
1918
|
payloadDelivered = true;
|
|
1840
1919
|
firstMessageComponents = void 0;
|
|
1841
1920
|
firstMessageEmbeds = void 0;
|
|
1921
|
+
if (componentBuild) {
|
|
1922
|
+
const messageId = sent && typeof sent === "object" && "id" in sent && typeof sent.id === "string" ? sent.id : void 0;
|
|
1923
|
+
await registerDiscordComponentEntries({
|
|
1924
|
+
entries: componentBuild.entries,
|
|
1925
|
+
modals: componentBuild.modals,
|
|
1926
|
+
messageId
|
|
1927
|
+
});
|
|
1928
|
+
componentBuild = void 0;
|
|
1929
|
+
}
|
|
1842
1930
|
});
|
|
1843
1931
|
} catch (error) {
|
|
1844
1932
|
if (!payloadDelivered) throw error;
|
|
@@ -1961,6 +2049,11 @@ async function dispatchDiscordNativeAgentReply(params) {
|
|
|
1961
2049
|
const payloadDelivered = await deliverDiscordInteractionReply({
|
|
1962
2050
|
interaction: params.interaction,
|
|
1963
2051
|
payload,
|
|
2052
|
+
componentRoute: {
|
|
2053
|
+
accountId: params.effectiveRoute.accountId,
|
|
2054
|
+
agentId: params.effectiveRoute.agentId,
|
|
2055
|
+
sessionKey: params.ctxPayload.CommandTargetSessionKey ?? params.effectiveRoute.sessionKey
|
|
2056
|
+
},
|
|
1964
2057
|
mediaLocalRoots: params.mediaLocalRoots,
|
|
1965
2058
|
textLimit: resolveTextChunkLimit(params.cfg, "discord", params.accountId, { fallbackLimit: 2e3 }),
|
|
1966
2059
|
maxLinesPerMessage: resolveDiscordMaxLinesPerMessage({
|
|
@@ -2336,7 +2429,7 @@ async function resolveDiscordNativeAutocompleteAuthorized(params) {
|
|
|
2336
2429
|
channel: interaction.channel,
|
|
2337
2430
|
client: interaction.client,
|
|
2338
2431
|
hasGuild: Boolean(interaction.guild),
|
|
2339
|
-
channelIdFallback: ""
|
|
2432
|
+
channelIdFallback: interaction.rawData.channel_id ?? ""
|
|
2340
2433
|
});
|
|
2341
2434
|
if (params.isPolicyCurrent?.() === false) return false;
|
|
2342
2435
|
const memberRoleIds = Array.isArray(interaction.rawData.member?.roles) ? interaction.rawData.member.roles.map((roleId) => roleId) : [];
|
|
@@ -2658,6 +2751,16 @@ async function recordDiscordModelPickerRecentModel(params) {
|
|
|
2658
2751
|
} catch {}
|
|
2659
2752
|
}
|
|
2660
2753
|
//#endregion
|
|
2754
|
+
//#region extensions/discord/src/monitor/model-picker.runtime.ts
|
|
2755
|
+
const hostSdk = modelsProviderRuntime;
|
|
2756
|
+
const MODEL_PICKER_CHANGED_MESSAGE = hostSdk.MODEL_PICKER_CHANGED_MESSAGE ?? "Available models changed. Open /models and choose again.";
|
|
2757
|
+
function supportsDiscordModelPickerRuntimeChoices() {
|
|
2758
|
+
return hostSdk.getModelsRuntimeChoices !== void 0;
|
|
2759
|
+
}
|
|
2760
|
+
function getDiscordModelPickerRuntimeChoices(...args) {
|
|
2761
|
+
return hostSdk.getModelsRuntimeChoices?.(...args);
|
|
2762
|
+
}
|
|
2763
|
+
//#endregion
|
|
2661
2764
|
//#region extensions/discord/src/monitor/model-picker.state.ts
|
|
2662
2765
|
const DISCORD_MODEL_PICKER_CUSTOM_ID_KEY = "mdlpk";
|
|
2663
2766
|
const DISCORD_CUSTOM_ID_MAX_CHARS = 100;
|
|
@@ -2694,10 +2797,13 @@ const PICKER_VIEWS = [
|
|
|
2694
2797
|
const DISCORD_MODEL_PICKER_BUCKET_THRESHOLD = DISCORD_COMPONENT_MAX_SELECT_OPTIONS;
|
|
2695
2798
|
/** Target items per alpha bucket. Discord caps selects at 25 options. */
|
|
2696
2799
|
const DISCORD_MODEL_PICKER_BUCKET_TARGET_SIZE = 20;
|
|
2697
|
-
const
|
|
2800
|
+
const DISCORD_MODEL_PICKER_TOKEN_PATTERN = /^[A-Za-z0-9_-]{8}$/u;
|
|
2698
2801
|
function createDiscordModelPickerModelToken(provider, model) {
|
|
2699
2802
|
return createHash("sha256").update(JSON.stringify([normalizeProviderId(provider), model]), "utf8").digest("base64url").slice(0, 8);
|
|
2700
2803
|
}
|
|
2804
|
+
function createDiscordModelPickerRuntimeToken(runtime) {
|
|
2805
|
+
return createHash("sha256").update(runtime, "utf8").digest("base64url").slice(0, 8);
|
|
2806
|
+
}
|
|
2701
2807
|
const loadModelsProviderRuntime = createLazyRuntimeModule(() => import("openclaw/plugin-sdk/models-provider-runtime"));
|
|
2702
2808
|
function isValidCommandContext(value) {
|
|
2703
2809
|
return COMMAND_CONTEXTS.includes(value);
|
|
@@ -2747,9 +2853,9 @@ function paginateItems(params) {
|
|
|
2747
2853
|
hasNext: page < totalPages
|
|
2748
2854
|
};
|
|
2749
2855
|
}
|
|
2750
|
-
async function loadDiscordModelPickerData(cfg, agentId) {
|
|
2856
|
+
async function loadDiscordModelPickerData(cfg, agentId, options) {
|
|
2751
2857
|
const { buildPreparedModelsProviderData } = await loadModelsProviderRuntime();
|
|
2752
|
-
return buildPreparedModelsProviderData(cfg, agentId);
|
|
2858
|
+
return buildPreparedModelsProviderData(cfg, agentId, options);
|
|
2753
2859
|
}
|
|
2754
2860
|
function buildDiscordModelPickerCustomId(params) {
|
|
2755
2861
|
const userId = params.userId.trim();
|
|
@@ -2760,7 +2866,7 @@ function buildDiscordModelPickerCustomId(params) {
|
|
|
2760
2866
|
const modelIndex = normalizeOptionalModelPickerIndex(params.modelIndex);
|
|
2761
2867
|
const recentSlot = normalizeOptionalModelPickerIndex(params.recentSlot);
|
|
2762
2868
|
const modelToken = params.modelToken?.trim();
|
|
2763
|
-
if (modelToken && !
|
|
2869
|
+
if (modelToken && !DISCORD_MODEL_PICKER_TOKEN_PATTERN.test(modelToken)) throw new Error("Discord model picker model token is invalid");
|
|
2764
2870
|
const parts = [
|
|
2765
2871
|
`${DISCORD_MODEL_PICKER_CUSTOM_ID_KEY}:c=${encodeCustomIdComponent(params.command)}`,
|
|
2766
2872
|
`a=${encodeCustomIdComponent(params.action)}`,
|
|
@@ -2771,6 +2877,9 @@ function buildDiscordModelPickerCustomId(params) {
|
|
|
2771
2877
|
if (normalizedProvider) parts.push(`p=${encodeCustomIdComponent(normalizedProvider)}`);
|
|
2772
2878
|
const runtime = params.runtime?.trim();
|
|
2773
2879
|
if (runtime) parts.push(`r=${encodeCustomIdComponent(runtime)}`);
|
|
2880
|
+
const runtimeToken = params.runtimeToken?.trim();
|
|
2881
|
+
if (runtimeToken && !DISCORD_MODEL_PICKER_TOKEN_PATTERN.test(runtimeToken)) throw new Error("Discord model picker runtime token is invalid");
|
|
2882
|
+
if (runtimeToken) parts.push(`rt=${runtimeToken}`);
|
|
2774
2883
|
const runtimeIndex = normalizeOptionalModelPickerIndex(params.runtimeIndex);
|
|
2775
2884
|
if (runtimeIndex) parts.push(`ri=${String(runtimeIndex)}`);
|
|
2776
2885
|
if (providerPage) parts.push(`pp=${String(providerPage)}`);
|
|
@@ -2783,6 +2892,13 @@ function buildDiscordModelPickerCustomId(params) {
|
|
|
2783
2892
|
if (providerBucket) parts.push(`pb=${encodeCustomIdComponent(providerBucket)}`);
|
|
2784
2893
|
const modelBucket = params.modelBucket?.trim().toLowerCase();
|
|
2785
2894
|
if (modelBucket) parts.push(`mb=${encodeCustomIdComponent(modelBucket)}`);
|
|
2895
|
+
if (parts.join(";").length > DISCORD_CUSTOM_ID_MAX_CHARS) {
|
|
2896
|
+
for (let index = parts.length - 1; index >= 0; index -= 1) if (parts[index] === "g=1" || parts[index] === "pp=1") parts.splice(index, 1);
|
|
2897
|
+
}
|
|
2898
|
+
if (modelToken && parts.join(";").length > DISCORD_CUSTOM_ID_MAX_CHARS) {
|
|
2899
|
+
const providerPart = parts.findIndex((part) => part.startsWith("p="));
|
|
2900
|
+
if (providerPart >= 0) parts.splice(providerPart, 1);
|
|
2901
|
+
}
|
|
2786
2902
|
const customId = parts.join(";");
|
|
2787
2903
|
if (customId.length > DISCORD_CUSTOM_ID_MAX_CHARS) throw new Error(`Discord model picker custom_id exceeds ${DISCORD_CUSTOM_ID_MAX_CHARS} chars (${customId.length})`);
|
|
2788
2904
|
return customId;
|
|
@@ -2796,11 +2912,18 @@ function parseDiscordModelPickerData(data) {
|
|
|
2796
2912
|
const providerRaw = decodeCustomIdComponent(coerceString(data.p));
|
|
2797
2913
|
const runtimeRaw = decodeCustomIdComponent(coerceString(data.r));
|
|
2798
2914
|
const runtimeIndex = parseStrictPositiveInteger(data.ri);
|
|
2915
|
+
const runtimeTokenRaw = coerceString(data.rt).trim();
|
|
2916
|
+
if (runtimeTokenRaw && !DISCORD_MODEL_PICKER_TOKEN_PATTERN.test(runtimeTokenRaw)) return null;
|
|
2917
|
+
if ([
|
|
2918
|
+
runtimeRaw.trim(),
|
|
2919
|
+
runtimeTokenRaw,
|
|
2920
|
+
runtimeIndex
|
|
2921
|
+
].filter(Boolean).length > 1) return null;
|
|
2799
2922
|
const page = parseRawPage(data.g ?? data.pg);
|
|
2800
2923
|
const providerPage = parseStrictPositiveInteger(data.pp);
|
|
2801
2924
|
const modelIndex = parseStrictPositiveInteger(data.mi);
|
|
2802
2925
|
const modelTokenRaw = coerceString(data.m).trim();
|
|
2803
|
-
const modelToken =
|
|
2926
|
+
const modelToken = DISCORD_MODEL_PICKER_TOKEN_PATTERN.test(modelTokenRaw) ? modelTokenRaw : void 0;
|
|
2804
2927
|
const recentSlot = parseStrictPositiveInteger(data.rs);
|
|
2805
2928
|
const providerBucketRaw = decodeCustomIdComponent(coerceString(data.pb)).trim().toLowerCase();
|
|
2806
2929
|
const modelBucketRaw = decodeCustomIdComponent(coerceString(data.mb)).trim().toLowerCase();
|
|
@@ -2814,6 +2937,7 @@ function parseDiscordModelPickerData(data) {
|
|
|
2814
2937
|
userId: trimmedUserId,
|
|
2815
2938
|
provider: providerRaw ? normalizeProviderId(providerRaw) : void 0,
|
|
2816
2939
|
runtime: runtimeRaw.trim() || void 0,
|
|
2940
|
+
...runtimeTokenRaw ? { runtimeToken: runtimeTokenRaw } : {},
|
|
2817
2941
|
...typeof runtimeIndex === "number" ? { runtimeIndex } : {},
|
|
2818
2942
|
page,
|
|
2819
2943
|
...typeof providerPage === "number" ? { providerPage } : {},
|
|
@@ -3056,7 +3180,7 @@ function buildBucketSelectRow(params) {
|
|
|
3056
3180
|
page: 1,
|
|
3057
3181
|
provider: params.provider,
|
|
3058
3182
|
runtime: params.runtime,
|
|
3059
|
-
|
|
3183
|
+
runtimeToken: params.runtimeToken,
|
|
3060
3184
|
providerPage: params.providerPage,
|
|
3061
3185
|
modelIndex: params.modelIndex
|
|
3062
3186
|
}),
|
|
@@ -3066,54 +3190,29 @@ function buildBucketSelectRow(params) {
|
|
|
3066
3190
|
return new Row([select]);
|
|
3067
3191
|
}
|
|
3068
3192
|
function getRuntimeChoices(params) {
|
|
3069
|
-
const
|
|
3070
|
-
|
|
3071
|
-
return [{
|
|
3072
|
-
id: "openclaw",
|
|
3073
|
-
label: "OpenClaw Default",
|
|
3074
|
-
description: "Use the built-in OpenClaw runtime."
|
|
3075
|
-
}];
|
|
3076
|
-
}
|
|
3077
|
-
function resolveSelectedRuntime(params) {
|
|
3078
|
-
const choices = getRuntimeChoices({
|
|
3079
|
-
data: params.data,
|
|
3080
|
-
provider: params.provider
|
|
3081
|
-
});
|
|
3082
|
-
const allowed = new Set(choices.map((choice) => choice.id));
|
|
3083
|
-
const pending = params.pendingRuntime?.trim();
|
|
3084
|
-
if (pending && allowed.has(pending)) return pending;
|
|
3085
|
-
const current = params.currentRuntime?.trim();
|
|
3086
|
-
if (current && allowed.has(current)) return current;
|
|
3087
|
-
return choices[0]?.id ?? "openclaw";
|
|
3193
|
+
const model = parseCurrentModelRef(params.modelRef);
|
|
3194
|
+
return getDiscordModelPickerRuntimeChoices(params.data, params.provider, model?.provider === normalizeProviderId(params.provider) ? model.model : void 0);
|
|
3088
3195
|
}
|
|
3089
3196
|
function resolveExplicitRuntimeState(params) {
|
|
3090
|
-
const
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3197
|
+
const runtime = params.pendingRuntime?.trim() || params.currentRuntime?.trim();
|
|
3198
|
+
return runtime && runtime !== "auto" && runtime !== "default" ? runtime : void 0;
|
|
3199
|
+
}
|
|
3200
|
+
function resolveSelectedRuntime(params) {
|
|
3201
|
+
const choices = getRuntimeChoices(params);
|
|
3202
|
+
const explicit = resolveExplicitRuntimeState(params);
|
|
3203
|
+
return explicit ? choices?.find((choice) => choice.id === explicit)?.id : choices?.[0]?.id;
|
|
3095
3204
|
}
|
|
3096
3205
|
function getActiveBucketId(bucket) {
|
|
3097
3206
|
return bucket && bucket.id !== "all" ? bucket.id : void 0;
|
|
3098
3207
|
}
|
|
3099
3208
|
function resolveCompactRuntimeState(params) {
|
|
3100
|
-
|
|
3101
|
-
const
|
|
3102
|
-
|
|
3103
|
-
return stateRuntime ? { runtime: stateRuntime } : {};
|
|
3209
|
+
if (!supportsDiscordModelPickerRuntimeChoices()) return {};
|
|
3210
|
+
const runtime = resolveExplicitRuntimeState(params);
|
|
3211
|
+
return runtime ? { runtimeToken: createDiscordModelPickerRuntimeToken(runtime) } : {};
|
|
3104
3212
|
}
|
|
3105
3213
|
function buildRenderedShell(params) {
|
|
3106
|
-
if (params.layout === "classic") return {
|
|
3107
|
-
layout: "classic",
|
|
3108
|
-
content: [
|
|
3109
|
-
params.title,
|
|
3110
|
-
...params.detailLines,
|
|
3111
|
-
"",
|
|
3112
|
-
params.footer
|
|
3113
|
-
].filter(Boolean).join("\n"),
|
|
3114
|
-
components: params.rows
|
|
3115
|
-
};
|
|
3116
3214
|
const containerComponents = [new TextDisplay(`## ${params.title}`)];
|
|
3215
|
+
if (params.refreshWarning) containerComponents.push(new TextDisplay(params.refreshWarning));
|
|
3117
3216
|
if (params.detailLines.length > 0) containerComponents.push(new TextDisplay(params.detailLines.join("\n")));
|
|
3118
3217
|
containerComponents.push(new Separator({
|
|
3119
3218
|
divider: true,
|
|
@@ -3135,10 +3234,7 @@ function buildRenderedShell(params) {
|
|
|
3135
3234
|
}));
|
|
3136
3235
|
containerComponents.push(new TextDisplay(`-# ${params.footer}`));
|
|
3137
3236
|
}
|
|
3138
|
-
return {
|
|
3139
|
-
layout: "v2",
|
|
3140
|
-
components: [new Container(containerComponents)]
|
|
3141
|
-
};
|
|
3237
|
+
return { components: [new Container(containerComponents)] };
|
|
3142
3238
|
}
|
|
3143
3239
|
function buildProviderSelectRow(params) {
|
|
3144
3240
|
if (params.page.items.length === 0) return null;
|
|
@@ -3219,20 +3315,22 @@ function buildModelRows(params) {
|
|
|
3219
3315
|
})]));
|
|
3220
3316
|
const runtimeChoices = getRuntimeChoices({
|
|
3221
3317
|
data: params.data,
|
|
3222
|
-
provider: params.modelPage.provider
|
|
3318
|
+
provider: params.modelPage.provider,
|
|
3319
|
+
modelRef: params.pendingModel ?? params.currentModel
|
|
3223
3320
|
});
|
|
3321
|
+
const currentRuntime = parsedCurrentModel?.provider === params.modelPage.provider ? params.currentRuntime : void 0;
|
|
3224
3322
|
const selectedRuntime = resolveSelectedRuntime({
|
|
3225
3323
|
data: params.data,
|
|
3226
3324
|
provider: params.modelPage.provider,
|
|
3227
|
-
|
|
3325
|
+
modelRef: params.pendingModel ?? params.currentModel,
|
|
3326
|
+
currentRuntime,
|
|
3228
3327
|
pendingRuntime: params.pendingRuntime
|
|
3229
3328
|
});
|
|
3230
3329
|
const compactRuntime = resolveCompactRuntimeState({
|
|
3231
|
-
|
|
3232
|
-
currentRuntime: params.currentRuntime,
|
|
3330
|
+
currentRuntime,
|
|
3233
3331
|
pendingRuntime: params.pendingRuntime
|
|
3234
3332
|
});
|
|
3235
|
-
if (runtimeChoices.length > 1) rows.push(new Row([createModelSelect({
|
|
3333
|
+
if (runtimeChoices && (runtimeChoices.length > 1 || runtimeChoices.length === 1 && selectedRuntime === void 0)) rows.push(new Row([createModelSelect({
|
|
3236
3334
|
customId: buildDiscordModelPickerCustomId({
|
|
3237
3335
|
command: params.command,
|
|
3238
3336
|
action: "runtime",
|
|
@@ -3254,7 +3352,7 @@ function buildModelRows(params) {
|
|
|
3254
3352
|
if (choice.description) option.description = choice.description;
|
|
3255
3353
|
return option;
|
|
3256
3354
|
}),
|
|
3257
|
-
placeholder: "
|
|
3355
|
+
placeholder: "Choose how to run this model"
|
|
3258
3356
|
})]));
|
|
3259
3357
|
const selectedModelRef = parsedPendingModel ?? parsedCurrentModel;
|
|
3260
3358
|
const modelOptions = params.modelPage.items.map((model) => ({
|
|
@@ -3345,7 +3443,7 @@ function buildModelRows(params) {
|
|
|
3345
3443
|
buttonRowItems.push(createModelPickerButton({
|
|
3346
3444
|
label: "Submit",
|
|
3347
3445
|
style: ButtonStyle.Primary,
|
|
3348
|
-
disabled: !hasPendingSelection,
|
|
3446
|
+
disabled: !hasPendingSelection || supportsDiscordModelPickerRuntimeChoices() && selectedRuntime === void 0,
|
|
3349
3447
|
customId: buildDiscordModelPickerCustomId({
|
|
3350
3448
|
...modelActionState,
|
|
3351
3449
|
action: "submit",
|
|
@@ -3399,8 +3497,8 @@ function renderDiscordModelPickerProvidersView(params) {
|
|
|
3399
3497
|
const detailLines = [formatCurrentModelLine(params.currentModel), page.bucket && page.bucket.id !== "all" ? `Select a provider (${page.totalItems} in ${page.bucket.label}, ${totalProviders} total).` : `Select a provider (${page.totalItems} available).`];
|
|
3400
3498
|
const footer = page.totalPages > 1 ? `Showing page ${page.page}/${page.totalPages} · ${page.totalItems} providers total` : `All ${page.totalItems} providers shown`;
|
|
3401
3499
|
return buildRenderedShell({
|
|
3402
|
-
layout: params.layout ?? "v2",
|
|
3403
3500
|
title: "Model Picker",
|
|
3501
|
+
refreshWarning: params.data.refreshWarning,
|
|
3404
3502
|
detailLines,
|
|
3405
3503
|
rows,
|
|
3406
3504
|
footer
|
|
@@ -3426,8 +3524,8 @@ function renderDiscordModelPickerModelsView(params) {
|
|
|
3426
3524
|
})
|
|
3427
3525
|
})])];
|
|
3428
3526
|
return buildRenderedShell({
|
|
3429
|
-
layout: params.layout ?? "v2",
|
|
3430
3527
|
title: "Model Picker",
|
|
3528
|
+
refreshWarning: params.data.refreshWarning,
|
|
3431
3529
|
detailLines: [formatCurrentModelLine(params.currentModel), `Provider not found: ${normalizeProviderId(params.provider)}`],
|
|
3432
3530
|
rows,
|
|
3433
3531
|
footer: "Choose a different provider."
|
|
@@ -3447,12 +3545,7 @@ function renderDiscordModelPickerModelsView(params) {
|
|
|
3447
3545
|
quickModels: params.quickModels,
|
|
3448
3546
|
providerBucket: params.providerBucket
|
|
3449
3547
|
});
|
|
3450
|
-
const runtimeChoices = getRuntimeChoices({
|
|
3451
|
-
data: params.data,
|
|
3452
|
-
provider: modelPage.provider
|
|
3453
|
-
});
|
|
3454
3548
|
const pendingRuntime = params.pendingRuntime?.trim();
|
|
3455
|
-
const pendingRuntimeIndex = pendingRuntime ? runtimeChoices.findIndex((choice) => choice.id === pendingRuntime) : -1;
|
|
3456
3549
|
const rows = [];
|
|
3457
3550
|
const bucketRow = buildBucketSelectRow({
|
|
3458
3551
|
command: params.command,
|
|
@@ -3461,24 +3554,32 @@ function renderDiscordModelPickerModelsView(params) {
|
|
|
3461
3554
|
buckets: modelPage.buckets,
|
|
3462
3555
|
currentBucketId: modelPage.bucket?.id,
|
|
3463
3556
|
provider: modelPage.provider,
|
|
3464
|
-
|
|
3557
|
+
runtimeToken: pendingRuntime ? createDiscordModelPickerRuntimeToken(pendingRuntime) : void 0,
|
|
3465
3558
|
providerPage,
|
|
3466
3559
|
providerBucket: params.providerBucket
|
|
3467
3560
|
});
|
|
3468
3561
|
if (bucketRow) rows.push(bucketRow);
|
|
3469
3562
|
rows.push(...modelRows);
|
|
3470
3563
|
const defaultModel = `${params.data.resolvedDefault.provider}/${params.data.resolvedDefault.model}`;
|
|
3471
|
-
const
|
|
3564
|
+
const choices = getRuntimeChoices({
|
|
3472
3565
|
data: params.data,
|
|
3473
3566
|
provider: modelPage.provider,
|
|
3474
|
-
|
|
3567
|
+
modelRef: params.pendingModel ?? params.currentModel
|
|
3568
|
+
});
|
|
3569
|
+
const selectedRuntime = resolveSelectedRuntime({
|
|
3570
|
+
data: params.data,
|
|
3571
|
+
provider: modelPage.provider,
|
|
3572
|
+
modelRef: params.pendingModel ?? params.currentModel,
|
|
3573
|
+
currentRuntime: parseCurrentModelRef(params.currentModel)?.provider === modelPage.provider ? params.currentRuntime : void 0,
|
|
3475
3574
|
pendingRuntime: params.pendingRuntime
|
|
3476
|
-
})
|
|
3575
|
+
});
|
|
3576
|
+
const selectedRuntimeLabel = choices?.find((choice) => choice.id === selectedRuntime)?.label;
|
|
3577
|
+
const pendingLine = !params.pendingModel ? "Select a model, then press Submit." : !supportsDiscordModelPickerRuntimeChoices() ? `Selected: ${params.pendingModel} (press Submit)` : choices === void 0 ? "Could not confirm how to run this model. Open /models to try again." : choices.length === 0 ? "This model cannot run with your current connections. Choose another model." : selectedRuntimeLabel ? `Selected: ${params.pendingModel} · ${selectedRuntimeLabel} (press Submit)` : "Choose how to run this model, then press Submit.";
|
|
3477
3578
|
const detailLines = [formatCurrentModelLine(params.currentModel), `Default: ${defaultModel}`];
|
|
3478
3579
|
if (modelPage.totalPages > 1) detailLines.push(`${modelPage.provider}: page ${modelPage.page}/${modelPage.totalPages} · ${modelPage.totalItems} models`);
|
|
3479
3580
|
return buildRenderedShell({
|
|
3480
|
-
layout: params.layout ?? "v2",
|
|
3481
3581
|
title: "Model Picker",
|
|
3582
|
+
refreshWarning: params.data.refreshWarning,
|
|
3482
3583
|
detailLines,
|
|
3483
3584
|
preRowText: pendingLine,
|
|
3484
3585
|
rows,
|
|
@@ -3509,7 +3610,7 @@ function renderDiscordModelPickerRecentsView(params) {
|
|
|
3509
3610
|
modelToken: createModelRefToken(modelRef),
|
|
3510
3611
|
provider: params.provider,
|
|
3511
3612
|
runtime: params.runtime,
|
|
3512
|
-
|
|
3613
|
+
runtimeToken: params.runtimeToken,
|
|
3513
3614
|
page: params.page,
|
|
3514
3615
|
providerPage: params.providerPage,
|
|
3515
3616
|
userId: params.userId
|
|
@@ -3523,7 +3624,7 @@ function renderDiscordModelPickerRecentsView(params) {
|
|
|
3523
3624
|
view: "models",
|
|
3524
3625
|
provider: params.provider,
|
|
3525
3626
|
runtime: params.runtime,
|
|
3526
|
-
|
|
3627
|
+
runtimeToken: params.runtimeToken,
|
|
3527
3628
|
page: params.page,
|
|
3528
3629
|
providerPage: params.providerPage,
|
|
3529
3630
|
modelBucket: params.modelBucket,
|
|
@@ -3531,21 +3632,14 @@ function renderDiscordModelPickerRecentsView(params) {
|
|
|
3531
3632
|
})
|
|
3532
3633
|
})]);
|
|
3533
3634
|
return buildRenderedShell({
|
|
3534
|
-
layout: params.layout ?? "v2",
|
|
3535
3635
|
title: "Recents",
|
|
3636
|
+
refreshWarning: params.data.refreshWarning,
|
|
3536
3637
|
detailLines: ["Models you've previously selected appear here.", formatCurrentModelLine(params.currentModel)],
|
|
3537
3638
|
preRowText: "Tap a model to switch.",
|
|
3538
3639
|
rows,
|
|
3539
3640
|
trailingRows: [backRow]
|
|
3540
3641
|
});
|
|
3541
3642
|
}
|
|
3542
|
-
function toDiscordModelPickerMessagePayload(view) {
|
|
3543
|
-
if (view.layout === "classic") return {
|
|
3544
|
-
content: view.content,
|
|
3545
|
-
components: view.components
|
|
3546
|
-
};
|
|
3547
|
-
return { components: view.components };
|
|
3548
|
-
}
|
|
3549
3643
|
//#endregion
|
|
3550
3644
|
//#region extensions/discord/src/monitor/native-command-model-picker-apply.ts
|
|
3551
3645
|
function normalizeExpectedRuntime(value) {
|
|
@@ -3658,7 +3752,7 @@ async function resolveDiscordModelPickerRouteState(params) {
|
|
|
3658
3752
|
channel: interaction.channel,
|
|
3659
3753
|
client: interaction.client,
|
|
3660
3754
|
hasGuild: Boolean(interaction.guild),
|
|
3661
|
-
channelIdFallback: "unknown"
|
|
3755
|
+
channelIdFallback: interaction.rawData.channel_id ?? "unknown"
|
|
3662
3756
|
});
|
|
3663
3757
|
const memberRoleIds = Array.isArray(interaction.rawData.member?.roles) ? interaction.rawData.member.roles.map((roleId) => roleId) : [];
|
|
3664
3758
|
const threadBinding = isThreadChannel ? params.threadBindings.getByThreadId(rawChannelId) : void 0;
|
|
@@ -3773,7 +3867,12 @@ async function replyWithDiscordModelPickerProviders(params) {
|
|
|
3773
3867
|
accountId: params.accountId,
|
|
3774
3868
|
threadBindings: params.threadBindings
|
|
3775
3869
|
});
|
|
3776
|
-
const
|
|
3870
|
+
const sessionEntry = getSessionEntry({
|
|
3871
|
+
storePath: resolveStorePath(params.cfg.session?.store, { agentId: route.agentId }),
|
|
3872
|
+
sessionKey: route.sessionKey,
|
|
3873
|
+
readConsistency: "latest"
|
|
3874
|
+
});
|
|
3875
|
+
const data = await loadDiscordModelPickerData(params.cfg, route.agentId, { sessionEntry });
|
|
3777
3876
|
const currentModel = resolveDiscordModelPickerCurrentModel({
|
|
3778
3877
|
cfg: params.cfg,
|
|
3779
3878
|
route,
|
|
@@ -3803,7 +3902,7 @@ async function replyWithDiscordModelPickerProviders(params) {
|
|
|
3803
3902
|
const initialModelBucket = initialResolved.bucket;
|
|
3804
3903
|
const initialProviderLocation = findProviderBucketLocation(data, initialProvider);
|
|
3805
3904
|
const payload = {
|
|
3806
|
-
...
|
|
3905
|
+
...renderDiscordModelPickerModelsView({
|
|
3807
3906
|
command: params.command,
|
|
3808
3907
|
userId: params.userId,
|
|
3809
3908
|
data,
|
|
@@ -3815,7 +3914,7 @@ async function replyWithDiscordModelPickerProviders(params) {
|
|
|
3815
3914
|
currentModel,
|
|
3816
3915
|
currentRuntime,
|
|
3817
3916
|
quickModels
|
|
3818
|
-
})
|
|
3917
|
+
}),
|
|
3819
3918
|
ephemeral: true
|
|
3820
3919
|
};
|
|
3821
3920
|
await params.safeInteractionCall("model picker reply", async () => {
|
|
@@ -3847,9 +3946,10 @@ function resolveModelPickerSelectionValue(interaction) {
|
|
|
3847
3946
|
if (typeof first !== "string") return null;
|
|
3848
3947
|
return first.trim() || null;
|
|
3849
3948
|
}
|
|
3850
|
-
function
|
|
3851
|
-
if (!
|
|
3852
|
-
|
|
3949
|
+
function resolveRuntimeToken(choices, token) {
|
|
3950
|
+
if (!token) return;
|
|
3951
|
+
const matches = choices?.filter((choice) => createDiscordModelPickerRuntimeToken(choice.id) === token);
|
|
3952
|
+
return matches?.length === 1 ? matches[0]?.id : void 0;
|
|
3853
3953
|
}
|
|
3854
3954
|
function resolveModelPickerProvider(params) {
|
|
3855
3955
|
return params.parsedProvider ?? splitDiscordModelRef(params.currentModelRef ?? "")?.provider ?? params.data.resolvedDefault.provider;
|
|
@@ -3859,20 +3959,7 @@ function resolveSelectedBucket(interaction) {
|
|
|
3859
3959
|
return raw && raw !== "all" ? raw : void 0;
|
|
3860
3960
|
}
|
|
3861
3961
|
function resolvePendingRuntime(params) {
|
|
3862
|
-
return params.parsed.runtime ??
|
|
3863
|
-
data: params.data,
|
|
3864
|
-
provider: params.provider,
|
|
3865
|
-
runtimeIndex: params.parsed.runtimeIndex
|
|
3866
|
-
});
|
|
3867
|
-
}
|
|
3868
|
-
function resolveParsedRuntimeForSubmission(params) {
|
|
3869
|
-
if (params.parsed.runtime) return params.parsed.runtime;
|
|
3870
|
-
if (params.parsed.provider !== params.selectedProvider) return;
|
|
3871
|
-
return resolveModelPickerRuntimeByIndex({
|
|
3872
|
-
data: params.data,
|
|
3873
|
-
provider: params.selectedProvider,
|
|
3874
|
-
runtimeIndex: params.parsed.runtimeIndex
|
|
3875
|
-
});
|
|
3962
|
+
return params.parsed.runtime ?? resolveRuntimeToken(getDiscordModelPickerRuntimeChoices(params.data, params.provider), params.parsed.runtimeToken);
|
|
3876
3963
|
}
|
|
3877
3964
|
function resolveSubmittedModelRef(params) {
|
|
3878
3965
|
if (params.parsed.action === "reset") return `${params.data.resolvedDefault.provider}/${params.data.resolvedDefault.model}`;
|
|
@@ -3940,22 +4027,6 @@ function resolveDiscordModelPickerModelSelection(params) {
|
|
|
3940
4027
|
if (params.requireModelToken || !params.modelIndex || params.modelIndex < 1) return null;
|
|
3941
4028
|
return models[params.modelIndex - 1] ?? null;
|
|
3942
4029
|
}
|
|
3943
|
-
function resolveDiscordModelPickerRuntimeForProvider(params) {
|
|
3944
|
-
const runtime = normalizeOptionalString(params.runtime);
|
|
3945
|
-
if (!runtime) return;
|
|
3946
|
-
if (runtime === "auto" || runtime === "default") return params.allowResetRuntime ? runtime : void 0;
|
|
3947
|
-
const choices = params.data.runtimeChoicesByProvider?.get(params.provider);
|
|
3948
|
-
if (!choices?.length) return runtime === "openclaw" ? runtime : void 0;
|
|
3949
|
-
return choices.some((choice) => choice.id === runtime) ? runtime : void 0;
|
|
3950
|
-
}
|
|
3951
|
-
function resolveDiscordModelPickerSubmissionRuntime(params) {
|
|
3952
|
-
return resolveDiscordModelPickerRuntimeForProvider({
|
|
3953
|
-
data: params.data,
|
|
3954
|
-
provider: params.provider,
|
|
3955
|
-
runtime: params.parsedRuntime,
|
|
3956
|
-
allowResetRuntime: true
|
|
3957
|
-
});
|
|
3958
|
-
}
|
|
3959
4030
|
async function handleDiscordModelPickerInteraction(params) {
|
|
3960
4031
|
const { interaction, data, ctx } = params;
|
|
3961
4032
|
const parsed = parseDiscordModelPickerData(data);
|
|
@@ -3980,7 +4051,14 @@ async function handleDiscordModelPickerInteraction(params) {
|
|
|
3980
4051
|
accountId: ctx.accountId,
|
|
3981
4052
|
threadBindings: ctx.threadBindings
|
|
3982
4053
|
});
|
|
3983
|
-
const
|
|
4054
|
+
const sessionEntry = getSessionEntry({
|
|
4055
|
+
storePath: resolveStorePath(cfg.session?.store, { agentId: route.agentId }),
|
|
4056
|
+
sessionKey: route.sessionKey,
|
|
4057
|
+
readConsistency: "latest"
|
|
4058
|
+
});
|
|
4059
|
+
const pickerData = await loadDiscordModelPickerData(cfg, route.agentId, { sessionEntry });
|
|
4060
|
+
const tokenModel = parsed.modelToken ? resolveDiscordModelPickerModelRefByToken(pickerData, parsed.modelToken) : null;
|
|
4061
|
+
const parsedProvider = parsed.provider ?? splitDiscordModelRef(tokenModel ?? "")?.provider;
|
|
3984
4062
|
const currentModelRef = resolveDiscordModelPickerCurrentModel({
|
|
3985
4063
|
cfg,
|
|
3986
4064
|
route,
|
|
@@ -4017,39 +4095,60 @@ async function handleDiscordModelPickerInteraction(params) {
|
|
|
4017
4095
|
quickModels,
|
|
4018
4096
|
...state
|
|
4019
4097
|
});
|
|
4020
|
-
return await updatePicker(
|
|
4098
|
+
return await updatePicker(rendered);
|
|
4021
4099
|
};
|
|
4100
|
+
if (parsed.action !== "cancel" && pickerData.isCurrent?.() === false) {
|
|
4101
|
+
await showNotice("That model picker expired. Reopen /model to try again.");
|
|
4102
|
+
return;
|
|
4103
|
+
}
|
|
4104
|
+
if (parsed.runtimeIndex !== void 0 && parsed.action !== "cancel") {
|
|
4105
|
+
await showNotice("That runtime selection expired. Reopen /model and choose a runtime again.");
|
|
4106
|
+
return;
|
|
4107
|
+
}
|
|
4108
|
+
if (parsed.runtimeToken && ![
|
|
4109
|
+
"submit",
|
|
4110
|
+
"reset",
|
|
4111
|
+
"quick",
|
|
4112
|
+
"cancel"
|
|
4113
|
+
].includes(parsed.action) && parsedProvider && !resolvePendingRuntime({
|
|
4114
|
+
data: pickerData,
|
|
4115
|
+
provider: parsedProvider,
|
|
4116
|
+
parsed
|
|
4117
|
+
})) {
|
|
4118
|
+
await showNotice("That runtime selection expired. Reopen /model and choose a runtime again.");
|
|
4119
|
+
return;
|
|
4120
|
+
}
|
|
4022
4121
|
if (parsed.action === "recents") {
|
|
4023
|
-
await updatePicker(
|
|
4122
|
+
await updatePicker(renderDiscordModelPickerRecentsView({
|
|
4024
4123
|
command: parsed.command,
|
|
4025
4124
|
userId: parsed.userId,
|
|
4026
4125
|
data: pickerData,
|
|
4027
4126
|
quickModels,
|
|
4028
4127
|
currentModel: currentModelRef,
|
|
4029
4128
|
runtime: parsed.runtime,
|
|
4030
|
-
|
|
4129
|
+
runtimeToken: parsed.runtimeToken,
|
|
4031
4130
|
provider: parsed.provider,
|
|
4032
4131
|
page: parsed.page,
|
|
4033
4132
|
providerPage: parsed.providerPage,
|
|
4034
4133
|
modelBucket: parsed.modelBucket
|
|
4035
|
-
}))
|
|
4134
|
+
}));
|
|
4036
4135
|
return;
|
|
4037
4136
|
}
|
|
4038
4137
|
if (parsed.view === "providers" && (parsed.action === "back" || parsed.action === "nav" || parsed.action === "bucket")) {
|
|
4039
4138
|
const selectingBucket = parsed.action === "bucket";
|
|
4040
|
-
await updatePicker(
|
|
4139
|
+
await updatePicker(renderDiscordModelPickerProvidersView({
|
|
4041
4140
|
command: parsed.command,
|
|
4042
4141
|
userId: parsed.userId,
|
|
4043
4142
|
data: pickerData,
|
|
4044
4143
|
page: selectingBucket ? 1 : parsed.page,
|
|
4045
4144
|
providerBucket: selectingBucket ? resolveSelectedBucket(interaction) : parsed.providerBucket,
|
|
4046
4145
|
currentModel: currentModelRef
|
|
4047
|
-
}))
|
|
4146
|
+
}));
|
|
4048
4147
|
return;
|
|
4049
4148
|
}
|
|
4050
4149
|
if (parsed.action === "bucket" && parsed.view === "models") {
|
|
4051
4150
|
const provider = resolveModelPickerProvider({
|
|
4052
|
-
parsedProvider
|
|
4151
|
+
parsedProvider,
|
|
4053
4152
|
currentModelRef,
|
|
4054
4153
|
data: pickerData
|
|
4055
4154
|
});
|
|
@@ -4066,7 +4165,7 @@ async function handleDiscordModelPickerInteraction(params) {
|
|
|
4066
4165
|
}
|
|
4067
4166
|
if (parsed.action === "nav" && parsed.view === "models") {
|
|
4068
4167
|
const provider = resolveModelPickerProvider({
|
|
4069
|
-
parsedProvider
|
|
4168
|
+
parsedProvider,
|
|
4070
4169
|
currentModelRef,
|
|
4071
4170
|
data: pickerData
|
|
4072
4171
|
});
|
|
@@ -4078,7 +4177,7 @@ async function handleDiscordModelPickerInteraction(params) {
|
|
|
4078
4177
|
requireModelToken
|
|
4079
4178
|
});
|
|
4080
4179
|
if ((parsed.modelIndex || parsed.modelToken) && !pendingModel) {
|
|
4081
|
-
await showNotice(
|
|
4180
|
+
await showNotice(MODEL_PICKER_CHANGED_MESSAGE);
|
|
4082
4181
|
return;
|
|
4083
4182
|
}
|
|
4084
4183
|
const pendingModelIndex = pendingModel ? resolveDiscordModelPickerModelIndex({
|
|
@@ -4100,7 +4199,7 @@ async function handleDiscordModelPickerInteraction(params) {
|
|
|
4100
4199
|
}
|
|
4101
4200
|
if (parsed.action === "back" && parsed.view === "models") {
|
|
4102
4201
|
const provider = resolveModelPickerProvider({
|
|
4103
|
-
parsedProvider
|
|
4202
|
+
parsedProvider,
|
|
4104
4203
|
currentModelRef,
|
|
4105
4204
|
data: pickerData
|
|
4106
4205
|
});
|
|
@@ -4117,7 +4216,7 @@ async function handleDiscordModelPickerInteraction(params) {
|
|
|
4117
4216
|
if (parsed.action === "provider") {
|
|
4118
4217
|
const selectedProvider = resolveModelPickerSelectionValue(interaction) ?? parsed.provider;
|
|
4119
4218
|
if (!selectedProvider || !pickerData.byProvider.has(selectedProvider)) {
|
|
4120
|
-
await showNotice(
|
|
4219
|
+
await showNotice(MODEL_PICKER_CHANGED_MESSAGE);
|
|
4121
4220
|
return;
|
|
4122
4221
|
}
|
|
4123
4222
|
await updateModelsView(selectedProvider, {
|
|
@@ -4128,9 +4227,9 @@ async function handleDiscordModelPickerInteraction(params) {
|
|
|
4128
4227
|
}
|
|
4129
4228
|
if (parsed.action === "model") {
|
|
4130
4229
|
const selectedModel = resolveModelPickerSelectionValue(interaction);
|
|
4131
|
-
const provider =
|
|
4230
|
+
const provider = parsedProvider;
|
|
4132
4231
|
if (!provider || !selectedModel) {
|
|
4133
|
-
await showNotice(
|
|
4232
|
+
await showNotice(MODEL_PICKER_CHANGED_MESSAGE);
|
|
4134
4233
|
return;
|
|
4135
4234
|
}
|
|
4136
4235
|
const modelIndex = resolveDiscordModelPickerModelIndex({
|
|
@@ -4139,7 +4238,7 @@ async function handleDiscordModelPickerInteraction(params) {
|
|
|
4139
4238
|
model: selectedModel
|
|
4140
4239
|
});
|
|
4141
4240
|
if (!modelIndex) {
|
|
4142
|
-
await showNotice(
|
|
4241
|
+
await showNotice(MODEL_PICKER_CHANGED_MESSAGE);
|
|
4143
4242
|
return;
|
|
4144
4243
|
}
|
|
4145
4244
|
const modelRef = `${provider}/${selectedModel}`;
|
|
@@ -4156,10 +4255,10 @@ async function handleDiscordModelPickerInteraction(params) {
|
|
|
4156
4255
|
return;
|
|
4157
4256
|
}
|
|
4158
4257
|
if (parsed.action === "runtime") {
|
|
4159
|
-
const selectedRuntime = resolveModelPickerSelectionValue(interaction) ?? parsed.runtime
|
|
4160
|
-
const provider =
|
|
4258
|
+
const selectedRuntime = resolveModelPickerSelectionValue(interaction) ?? parsed.runtime;
|
|
4259
|
+
const provider = parsedProvider;
|
|
4161
4260
|
if (!provider || !pickerData.byProvider.has(provider)) {
|
|
4162
|
-
await showNotice(
|
|
4261
|
+
await showNotice(MODEL_PICKER_CHANGED_MESSAGE);
|
|
4163
4262
|
return;
|
|
4164
4263
|
}
|
|
4165
4264
|
const selectedModel = resolveDiscordModelPickerModelSelection({
|
|
@@ -4170,7 +4269,13 @@ async function handleDiscordModelPickerInteraction(params) {
|
|
|
4170
4269
|
requireModelToken
|
|
4171
4270
|
});
|
|
4172
4271
|
if ((parsed.modelIndex || parsed.modelToken) && !selectedModel) {
|
|
4173
|
-
await showNotice(
|
|
4272
|
+
await showNotice(MODEL_PICKER_CHANGED_MESSAGE);
|
|
4273
|
+
return;
|
|
4274
|
+
}
|
|
4275
|
+
const currentModel = splitDiscordModelRef(currentModelRef ?? "");
|
|
4276
|
+
const choices = getDiscordModelPickerRuntimeChoices(pickerData, provider, selectedModel ?? (currentModel?.provider === provider ? currentModel.model : void 0));
|
|
4277
|
+
if (!selectedRuntime || !choices?.some((choice) => choice.id === selectedRuntime)) {
|
|
4278
|
+
await showNotice("That runtime is not available for this model. Choose a runtime again.");
|
|
4174
4279
|
return;
|
|
4175
4280
|
}
|
|
4176
4281
|
const pendingModel = selectedModel ? `${provider}/${selectedModel}` : void 0;
|
|
@@ -4197,19 +4302,50 @@ async function handleDiscordModelPickerInteraction(params) {
|
|
|
4197
4302
|
});
|
|
4198
4303
|
const parsedModelRef = modelRef ? splitDiscordModelRef(modelRef) : null;
|
|
4199
4304
|
if (!parsedModelRef || !pickerData.byProvider.get(parsedModelRef.provider)?.has(parsedModelRef.model)) {
|
|
4200
|
-
await showNotice(
|
|
4305
|
+
await showNotice(MODEL_PICKER_CHANGED_MESSAGE);
|
|
4201
4306
|
return;
|
|
4202
4307
|
}
|
|
4203
4308
|
const resolvedModelRef = `${parsedModelRef.provider}/${parsedModelRef.model}`;
|
|
4204
|
-
const
|
|
4205
|
-
|
|
4206
|
-
|
|
4207
|
-
|
|
4208
|
-
|
|
4209
|
-
|
|
4210
|
-
|
|
4211
|
-
})
|
|
4212
|
-
|
|
4309
|
+
const choices = getDiscordModelPickerRuntimeChoices(pickerData, parsedModelRef.provider, parsedModelRef.model);
|
|
4310
|
+
const modelOnlyHost = !supportsDiscordModelPickerRuntimeChoices();
|
|
4311
|
+
const supportsModelOnlySelection = () => {
|
|
4312
|
+
const currentEntry = getSessionEntry({
|
|
4313
|
+
storePath: resolveStorePath(cfg.session?.store, { agentId: route.agentId }),
|
|
4314
|
+
sessionKey: route.sessionKey,
|
|
4315
|
+
readConsistency: "latest"
|
|
4316
|
+
});
|
|
4317
|
+
const override = currentEntry?.agentRuntimeOverride?.trim();
|
|
4318
|
+
if (override && ![
|
|
4319
|
+
"auto",
|
|
4320
|
+
"default",
|
|
4321
|
+
"openclaw"
|
|
4322
|
+
].includes(override)) return false;
|
|
4323
|
+
const model = pickerData.modelCatalog?.find((entry) => entry.provider === parsedModelRef.provider && entry.id === parsedModelRef.model);
|
|
4324
|
+
return resolveEffectiveAgentRuntime({
|
|
4325
|
+
cfg,
|
|
4326
|
+
provider: parsedModelRef.provider,
|
|
4327
|
+
modelId: parsedModelRef.model,
|
|
4328
|
+
modelApi: model?.api,
|
|
4329
|
+
modelBaseUrl: model?.baseUrl,
|
|
4330
|
+
agentId: route.agentId,
|
|
4331
|
+
sessionKey: route.sessionKey,
|
|
4332
|
+
sessionEntry: currentEntry
|
|
4333
|
+
}) === "openclaw";
|
|
4334
|
+
};
|
|
4335
|
+
const legacyRuntimeNotice = "This OpenClaw version supports model-only selection here. Update OpenClaw to change runtimes in the picker.";
|
|
4336
|
+
if (modelOnlyHost && (parsed.runtime || parsed.runtimeToken || !supportsModelOnlySelection())) {
|
|
4337
|
+
await showNotice(legacyRuntimeNotice);
|
|
4338
|
+
return;
|
|
4339
|
+
}
|
|
4340
|
+
if (!modelOnlyHost && choices === void 0) {
|
|
4341
|
+
await showNotice("Runtime availability is not confirmed. Reopen /model to try again.");
|
|
4342
|
+
return;
|
|
4343
|
+
}
|
|
4344
|
+
const selectedRuntime = normalizeOptionalString(parsed.runtime) ?? resolveRuntimeToken(choices, parsed.runtimeToken);
|
|
4345
|
+
if (choices?.length === 0 || parsed.runtimeToken && selectedRuntime === void 0 || selectedRuntime && selectedRuntime !== "auto" && selectedRuntime !== "default" && !choices?.some((choice) => choice.id === selectedRuntime)) {
|
|
4346
|
+
await showNotice("That runtime is not available for this model. Reopen /model and choose again.");
|
|
4347
|
+
return;
|
|
4348
|
+
}
|
|
4213
4349
|
const selectionCommand = buildDiscordModelPickerSelectionCommand({
|
|
4214
4350
|
modelRef: resolvedModelRef,
|
|
4215
4351
|
runtime: selectedRuntime
|
|
@@ -4219,6 +4355,14 @@ async function handleDiscordModelPickerInteraction(params) {
|
|
|
4219
4355
|
return;
|
|
4220
4356
|
}
|
|
4221
4357
|
if (await showNotice(`Applying model change to ${resolvedModelRef}...`) === null) return;
|
|
4358
|
+
if (pickerData.isCurrent?.() === false) {
|
|
4359
|
+
await showNotice("That model picker expired. Reopen /model to try again.");
|
|
4360
|
+
return;
|
|
4361
|
+
}
|
|
4362
|
+
if (modelOnlyHost && !supportsModelOnlySelection()) {
|
|
4363
|
+
await showNotice(legacyRuntimeNotice);
|
|
4364
|
+
return;
|
|
4365
|
+
}
|
|
4222
4366
|
const applyResult = await applyDiscordModelPickerSelection({
|
|
4223
4367
|
interaction,
|
|
4224
4368
|
selectionCommand,
|
|
@@ -4387,22 +4531,13 @@ function buildDiscordCommandOptions(params) {
|
|
|
4387
4531
|
if (!args || args.length === 0) return;
|
|
4388
4532
|
return args.map((arg) => {
|
|
4389
4533
|
const required = arg.required ?? false;
|
|
4390
|
-
if (arg.type === "number") return {
|
|
4391
|
-
name: arg.name,
|
|
4392
|
-
description: truncateDiscordCommandDescription({
|
|
4393
|
-
value: arg.description,
|
|
4394
|
-
label: `command:${commandLabel} arg:${arg.name}`
|
|
4395
|
-
}),
|
|
4396
|
-
type: ApplicationCommandOptionType.Number,
|
|
4397
|
-
required
|
|
4398
|
-
};
|
|
4399
|
-
if (arg.type === "boolean") return {
|
|
4534
|
+
if (arg.type === "number" || arg.type === "boolean") return {
|
|
4400
4535
|
name: arg.name,
|
|
4401
4536
|
description: truncateDiscordCommandDescription({
|
|
4402
4537
|
value: arg.description,
|
|
4403
4538
|
label: `command:${commandLabel} arg:${arg.name}`
|
|
4404
4539
|
}),
|
|
4405
|
-
type: ApplicationCommandOptionType.Boolean,
|
|
4540
|
+
type: arg.type === "number" ? ApplicationCommandOptionType.Number : ApplicationCommandOptionType.Boolean,
|
|
4406
4541
|
required
|
|
4407
4542
|
};
|
|
4408
4543
|
const resolvedChoices = resolveCommandArgChoices({
|
|
@@ -4433,7 +4568,7 @@ function buildDiscordCommandOptions(params) {
|
|
|
4433
4568
|
provider: context?.provider,
|
|
4434
4569
|
model: context?.model,
|
|
4435
4570
|
agentRuntime: context?.agentRuntime,
|
|
4436
|
-
|
|
4571
|
+
catalog: choiceCatalog
|
|
4437
4572
|
});
|
|
4438
4573
|
const filtered = focusValue ? choices.filter((choice) => normalizeLowercaseStringOrEmpty(choice.label).includes(focusValue)) : choices;
|
|
4439
4574
|
await interaction.respond(filtered.slice(0, 25).map((choice) => ({
|
|
@@ -4584,7 +4719,7 @@ async function dispatchDiscordCommandInteraction(params) {
|
|
|
4584
4719
|
channel,
|
|
4585
4720
|
client: interaction.client,
|
|
4586
4721
|
hasGuild: Boolean(interaction.guild),
|
|
4587
|
-
channelIdFallback: ""
|
|
4722
|
+
channelIdFallback: interaction.rawData.channel_id ?? ""
|
|
4588
4723
|
});
|
|
4589
4724
|
if (policy?.isCurrent() === false) {
|
|
4590
4725
|
await respond("Access policy changed. Try this interaction again.", { ephemeral: true });
|
|
@@ -4799,7 +4934,7 @@ async function dispatchDiscordCommandInteraction(params) {
|
|
|
4799
4934
|
provider: menuModelContext?.provider,
|
|
4800
4935
|
model: menuModelContext?.model,
|
|
4801
4936
|
agentRuntime: menuModelContext?.agentRuntime,
|
|
4802
|
-
|
|
4937
|
+
catalog: menuModelCatalog
|
|
4803
4938
|
});
|
|
4804
4939
|
if (menu) {
|
|
4805
4940
|
const menuPayload = buildDiscordCommandArgMenu({
|
|
@@ -5968,7 +6103,7 @@ function parseDiscordGatewayInfoBody(body) {
|
|
|
5968
6103
|
async function fetchDiscordGatewayInfo(params) {
|
|
5969
6104
|
let response;
|
|
5970
6105
|
try {
|
|
5971
|
-
response = await params.fetchImpl(DISCORD_GATEWAY_BOT_URL, {
|
|
6106
|
+
response = await params.fetchImpl(params.gatewayBotUrl ?? DISCORD_GATEWAY_BOT_URL, {
|
|
5972
6107
|
...params.fetchInit,
|
|
5973
6108
|
headers: {
|
|
5974
6109
|
...params.fetchInit?.headers,
|
|
@@ -5977,7 +6112,7 @@ async function fetchDiscordGatewayInfo(params) {
|
|
|
5977
6112
|
});
|
|
5978
6113
|
} catch (error) {
|
|
5979
6114
|
throw createGatewayMetadataError({
|
|
5980
|
-
detail: formatErrorMessage(error),
|
|
6115
|
+
detail: formatErrorMessage$1(error),
|
|
5981
6116
|
transient: true,
|
|
5982
6117
|
cause: error
|
|
5983
6118
|
});
|
|
@@ -5987,7 +6122,7 @@ async function fetchDiscordGatewayInfo(params) {
|
|
|
5987
6122
|
body = await response.text();
|
|
5988
6123
|
} catch (error) {
|
|
5989
6124
|
throw createGatewayMetadataError({
|
|
5990
|
-
detail: formatErrorMessage(error),
|
|
6125
|
+
detail: formatErrorMessage$1(error),
|
|
5991
6126
|
transient: true,
|
|
5992
6127
|
cause: error
|
|
5993
6128
|
});
|
|
@@ -6002,7 +6137,7 @@ async function fetchDiscordGatewayInfo(params) {
|
|
|
6002
6137
|
return parseDiscordGatewayInfoBody(body);
|
|
6003
6138
|
} catch (error) {
|
|
6004
6139
|
throw createGatewayMetadataError({
|
|
6005
|
-
detail: `Discord API /gateway/bot returned invalid metadata: ${formatErrorMessage(error)} (${summary})`,
|
|
6140
|
+
detail: `Discord API /gateway/bot returned invalid metadata: ${formatErrorMessage$1(error)} (${summary})`,
|
|
6006
6141
|
transient,
|
|
6007
6142
|
cause: error
|
|
6008
6143
|
});
|
|
@@ -6019,6 +6154,7 @@ async function fetchDiscordGatewayInfoWithTimeout(params) {
|
|
|
6019
6154
|
}),
|
|
6020
6155
|
run: async (signal) => await fetchDiscordGatewayInfo({
|
|
6021
6156
|
token: params.token,
|
|
6157
|
+
gatewayBotUrl: params.gatewayBotUrl,
|
|
6022
6158
|
fetchImpl: params.fetchImpl,
|
|
6023
6159
|
fetchInit: {
|
|
6024
6160
|
...params.fetchInit,
|
|
@@ -6029,7 +6165,7 @@ async function fetchDiscordGatewayInfoWithTimeout(params) {
|
|
|
6029
6165
|
}
|
|
6030
6166
|
function resolveGatewayInfoWithFallback(params) {
|
|
6031
6167
|
if (!isTransientGatewayMetadataError(params.error)) throw params.error;
|
|
6032
|
-
const message = formatErrorMessage(params.error);
|
|
6168
|
+
const message = formatErrorMessage$1(params.error);
|
|
6033
6169
|
const now = Date.now();
|
|
6034
6170
|
if (params.runtime) {
|
|
6035
6171
|
const previous = gatewayMetadataFallbackLogLastAt.get(params.runtime);
|
|
@@ -6172,16 +6308,20 @@ function createGatewayPlugin(params) {
|
|
|
6172
6308
|
if (!this.gatewayInfo || this.gatewayInfoUsedFallback) {
|
|
6173
6309
|
const resolved = await fetchDiscordGatewayInfoWithTimeout({
|
|
6174
6310
|
token: client.options.token,
|
|
6311
|
+
...params.endpoint ? { gatewayBotUrl: params.endpoint.gatewayBotUrl } : {},
|
|
6175
6312
|
fetchImpl: params.fetchImpl,
|
|
6176
6313
|
fetchInit: params.fetchInit,
|
|
6177
6314
|
timeoutMs: params.gatewayInfoTimeoutMs
|
|
6178
6315
|
}).then((info) => ({
|
|
6179
6316
|
info,
|
|
6180
6317
|
usedFallback: false
|
|
6181
|
-
})).catch((error) =>
|
|
6182
|
-
|
|
6183
|
-
|
|
6184
|
-
|
|
6318
|
+
})).catch((error) => {
|
|
6319
|
+
if (params.endpoint) throw error;
|
|
6320
|
+
return resolveGatewayInfoWithFallback({
|
|
6321
|
+
runtime: params.runtime,
|
|
6322
|
+
error
|
|
6323
|
+
});
|
|
6324
|
+
});
|
|
6185
6325
|
this.gatewayInfo = resolved.info;
|
|
6186
6326
|
this.gatewayInfoUsedFallback = resolved.usedFallback;
|
|
6187
6327
|
}
|
|
@@ -6194,6 +6334,7 @@ function createGatewayPlugin(params) {
|
|
|
6194
6334
|
}
|
|
6195
6335
|
createWebSocket(url) {
|
|
6196
6336
|
if (!url) throw new Error("Gateway URL is required");
|
|
6337
|
+
assertDiscordEndpointGatewayUrl(url, params.endpoint?.gatewayOrigin);
|
|
6197
6338
|
const wsFlowId = randomUUID();
|
|
6198
6339
|
const socket = new ((params.testing?.webSocketCtor) ?? WebSocket)(url, {
|
|
6199
6340
|
...DISCORD_GATEWAY_WS_CLIENT_OPTIONS,
|
|
@@ -6267,13 +6408,21 @@ function createGatewayPlugin(params) {
|
|
|
6267
6408
|
}
|
|
6268
6409
|
return new OpenClawGatewayPlugin();
|
|
6269
6410
|
}
|
|
6270
|
-
function createDiscordGatewayMetadataFetch(debugCaptureEnabled,
|
|
6411
|
+
function createDiscordGatewayMetadataFetch(debugCaptureEnabled, transport) {
|
|
6412
|
+
const endpoint = transport?.endpoint;
|
|
6413
|
+
if (endpoint) return (input, init) => {
|
|
6414
|
+
const signal = init?.signal instanceof AbortSignal ? init.signal : void 0;
|
|
6415
|
+
return endpoint.fetch(input, {
|
|
6416
|
+
...init?.headers ? { headers: init.headers } : {},
|
|
6417
|
+
...signal ? { signal } : {}
|
|
6418
|
+
});
|
|
6419
|
+
};
|
|
6271
6420
|
return (input, init) => fetchDiscordGatewayMetadataGuarded(input, init, {
|
|
6272
6421
|
...debugCaptureEnabled ? {} : { capture: {
|
|
6273
6422
|
flowId: randomUUID(),
|
|
6274
6423
|
meta: { subsystem: "discord-gateway-metadata" }
|
|
6275
6424
|
} },
|
|
6276
|
-
...proxyUrl ? { proxyUrl } : {}
|
|
6425
|
+
...transport?.proxyUrl ? { proxyUrl: transport.proxyUrl } : {}
|
|
6277
6426
|
});
|
|
6278
6427
|
}
|
|
6279
6428
|
function waitForDiscordGatewayPluginRegistration(plugin) {
|
|
@@ -6288,16 +6437,23 @@ function createDiscordGatewayPlugin(params) {
|
|
|
6288
6437
|
const proxy = resolveEffectiveDebugProxyUrl(params.discordConfig?.proxy);
|
|
6289
6438
|
const debugProxySettings = resolveDebugProxySettings();
|
|
6290
6439
|
const gatewayInfoTimeoutMs = resolveDiscordGatewayInfoTimeoutMs({ env: process.env });
|
|
6291
|
-
|
|
6292
|
-
|
|
6293
|
-
|
|
6440
|
+
const endpointRuntime = getDiscordEndpointRuntime();
|
|
6441
|
+
const endpoint = endpointRuntime ? {
|
|
6442
|
+
gatewayBotUrl: endpointRuntime.descriptor.gatewayBotUrl,
|
|
6443
|
+
gatewayOrigin: endpointRuntime.descriptor.gatewayOrigin,
|
|
6444
|
+
fetch: endpointRuntime.fetch
|
|
6445
|
+
} : void 0;
|
|
6446
|
+
const endpointGatewayUrl = endpoint ? new URL(endpoint.gatewayOrigin) : void 0;
|
|
6447
|
+
let fetchImpl = createDiscordGatewayMetadataFetch(debugProxySettings.enabled, endpoint ? { endpoint } : void 0);
|
|
6448
|
+
let wsAgent = endpointGatewayUrl?.protocol === "ws:" ? void 0 : new Agent$1({ lookup: endpointGatewayUrl ? createDiscordEndpointDnsLookup(endpointGatewayUrl.hostname) : discordDnsLookup });
|
|
6449
|
+
if (proxy && !endpoint) try {
|
|
6294
6450
|
validateDiscordProxyUrl(proxy);
|
|
6295
6451
|
wsAgent = params.testing?.createProxyAgent?.(proxy) ?? createNodeProxyAgent({
|
|
6296
6452
|
mode: "explicit",
|
|
6297
6453
|
proxyUrl: proxy,
|
|
6298
6454
|
protocol: "https"
|
|
6299
6455
|
});
|
|
6300
|
-
fetchImpl = createDiscordGatewayMetadataFetch(debugProxySettings.enabled, proxy);
|
|
6456
|
+
fetchImpl = createDiscordGatewayMetadataFetch(debugProxySettings.enabled, { proxyUrl: proxy });
|
|
6301
6457
|
params.runtime.log?.("discord: gateway proxy enabled");
|
|
6302
6458
|
} catch (err) {
|
|
6303
6459
|
params.runtime.error?.(danger(`discord: invalid gateway proxy: ${String(err)}`));
|
|
@@ -6310,6 +6466,7 @@ function createDiscordGatewayPlugin(params) {
|
|
|
6310
6466
|
autoInteractions: false
|
|
6311
6467
|
},
|
|
6312
6468
|
gatewayInfoTimeoutMs,
|
|
6469
|
+
...endpoint ? { endpoint } : {},
|
|
6313
6470
|
fetchImpl,
|
|
6314
6471
|
runtime: params.runtime,
|
|
6315
6472
|
testing: params.testing,
|
|
@@ -6355,12 +6512,12 @@ function readFirstStackFrame(err) {
|
|
|
6355
6512
|
return frame ? frame.replace(/^at\s+/, "") : void 0;
|
|
6356
6513
|
}
|
|
6357
6514
|
function formatDiscordGatewayErrorMessage(err) {
|
|
6358
|
-
if (!(err instanceof Error)) return formatErrorMessage
|
|
6515
|
+
if (!(err instanceof Error)) return formatErrorMessage(err);
|
|
6359
6516
|
if (err.message) {
|
|
6360
|
-
const detail = formatErrorMessage
|
|
6517
|
+
const detail = formatErrorMessage(err);
|
|
6361
6518
|
return err.name ? `${err.name}: ${detail}` : detail;
|
|
6362
6519
|
}
|
|
6363
|
-
const detail = formatErrorMessage
|
|
6520
|
+
const detail = formatErrorMessage(err);
|
|
6364
6521
|
const firstFrame = readFirstStackFrame(err);
|
|
6365
6522
|
if (firstFrame && detail === (err.name || "Error")) return `${detail} @ ${firstFrame}`;
|
|
6366
6523
|
return detail;
|
|
@@ -6894,7 +7051,7 @@ async function runDiscordGatewayLifecycle(params) {
|
|
|
6894
7051
|
});
|
|
6895
7052
|
try {
|
|
6896
7053
|
if (drainPendingGatewayErrors() === "stop") return;
|
|
6897
|
-
if (gatewayReadyAtLifecycleStart && params.voiceManager) params.voiceManager.autoJoin().catch((err) => params.runtime.error?.(danger(`discord voice: autoJoin failed: ${formatErrorMessage
|
|
7054
|
+
if (gatewayReadyAtLifecycleStart && params.voiceManager) params.voiceManager.autoJoin().catch((err) => params.runtime.error?.(danger(`discord voice: autoJoin failed: ${formatErrorMessage(err)}`)));
|
|
6898
7055
|
await waitForGatewayReady({
|
|
6899
7056
|
gateway,
|
|
6900
7057
|
abortSignal: params.abortSignal,
|
|
@@ -6939,7 +7096,7 @@ async function runDiscordGatewayLifecycle(params) {
|
|
|
6939
7096
|
let discordVoiceRuntimePromise;
|
|
6940
7097
|
let discordProviderSessionRuntimePromise;
|
|
6941
7098
|
async function loadDiscordVoiceRuntime() {
|
|
6942
|
-
const promise = discordVoiceRuntimePromise ?? import("./voice-runtime-
|
|
7099
|
+
const promise = discordVoiceRuntimePromise ?? import("./voice-runtime-DHVQ2mFz.mjs").then((n) => n.t);
|
|
6943
7100
|
discordVoiceRuntimePromise = promise;
|
|
6944
7101
|
try {
|
|
6945
7102
|
return await promise;
|
|
@@ -6949,7 +7106,7 @@ async function loadDiscordVoiceRuntime() {
|
|
|
6949
7106
|
}
|
|
6950
7107
|
}
|
|
6951
7108
|
async function loadDiscordProviderSessionRuntime() {
|
|
6952
|
-
const promise = discordProviderSessionRuntimePromise ?? import("./provider-session.runtime-
|
|
7109
|
+
const promise = discordProviderSessionRuntimePromise ?? import("./provider-session.runtime-BW7QrF5C.mjs");
|
|
6953
7110
|
discordProviderSessionRuntimePromise = promise;
|
|
6954
7111
|
try {
|
|
6955
7112
|
return await promise;
|
|
@@ -6983,13 +7140,13 @@ function isLegacyMissingSessionError(message) {
|
|
|
6983
7140
|
function classifyAcpStatusProbeError(params) {
|
|
6984
7141
|
if (params.isAcpRuntimeError(params.error) && ["SESSION_OWNER_MIGRATION_REQUIRED", "SESSION_OWNER_UNSUPPORTED"].includes(params.error.detailCode ?? "")) return {
|
|
6985
7142
|
status: "uncertain",
|
|
6986
|
-
reason: formatErrorMessage
|
|
7143
|
+
reason: formatErrorMessage(params.error)
|
|
6987
7144
|
};
|
|
6988
7145
|
if (params.isAcpRuntimeError(params.error) && params.error.code === "ACP_SESSION_INIT_FAILED") return {
|
|
6989
7146
|
status: "stale",
|
|
6990
7147
|
reason: "session-init-failed"
|
|
6991
7148
|
};
|
|
6992
|
-
if (isLegacyMissingSessionError(formatErrorMessage
|
|
7149
|
+
if (isLegacyMissingSessionError(formatErrorMessage(params.error))) return {
|
|
6993
7150
|
status: "stale",
|
|
6994
7151
|
reason: "session-missing"
|
|
6995
7152
|
};
|
|
@@ -7053,7 +7210,12 @@ async function probeDiscordAcpBindingHealth(params) {
|
|
|
7053
7210
|
//#endregion
|
|
7054
7211
|
//#region extensions/discord/src/monitor/provider.cleanup.ts
|
|
7055
7212
|
async function cleanupDiscordProviderStartup(params) {
|
|
7056
|
-
|
|
7213
|
+
const listenersStopped = params.stopMonitorListeners?.();
|
|
7214
|
+
try {
|
|
7215
|
+
await params.deactivateMessageHandler?.();
|
|
7216
|
+
} finally {
|
|
7217
|
+
await listenersStopped;
|
|
7218
|
+
}
|
|
7057
7219
|
params.autoPresenceController?.stop();
|
|
7058
7220
|
params.setStatus?.({ connected: false });
|
|
7059
7221
|
if (params.onEarlyGatewayDebug) params.earlyGatewayEmitter?.removeListener("debug", params.onEarlyGatewayDebug);
|
|
@@ -7435,7 +7597,7 @@ function readDiscordDeployObjectField(value, field) {
|
|
|
7435
7597
|
function isAbortLikeError(err) {
|
|
7436
7598
|
if (!err || typeof err !== "object") return false;
|
|
7437
7599
|
const name = "name" in err && typeof err.name === "string" ? err.name : void 0;
|
|
7438
|
-
const message = formatErrorMessage
|
|
7600
|
+
const message = formatErrorMessage(err);
|
|
7439
7601
|
return name === "AbortError" || message === "This operation was aborted" || message === "The operation was aborted" || /\boperation was aborted\b/i.test(message);
|
|
7440
7602
|
}
|
|
7441
7603
|
function formatDiscordDeployRestOperation(err) {
|
|
@@ -7447,7 +7609,7 @@ function formatDiscordDeployRestOperation(err) {
|
|
|
7447
7609
|
return "request";
|
|
7448
7610
|
}
|
|
7449
7611
|
function formatDiscordDeployErrorMessage(err) {
|
|
7450
|
-
if (!isAbortLikeError(err)) return formatErrorMessage
|
|
7612
|
+
if (!isAbortLikeError(err)) return formatErrorMessage(err);
|
|
7451
7613
|
const deployErr = err && typeof err === "object" ? err : {};
|
|
7452
7614
|
const requestMs = parseFiniteNumber$1(deployErr.deployRequestMs);
|
|
7453
7615
|
const timeoutMs = parseFiniteNumber$1(deployErr.deployTimeoutMs);
|
|
@@ -7556,7 +7718,7 @@ function isDiscordDeployDailyCreateLimit(err) {
|
|
|
7556
7718
|
const deployErr = err;
|
|
7557
7719
|
const discordCode = parseStrictNonNegativeInteger$1(deployErr.discordCode);
|
|
7558
7720
|
const rawCode = parseStrictNonNegativeInteger$1(readDiscordDeployObjectField(deployErr.rawBody, "code"));
|
|
7559
|
-
return (discordCode === 30034 || rawCode === 30034) && /daily application command creates/i.test(formatErrorMessage
|
|
7721
|
+
return (discordCode === 30034 || rawCode === 30034) && /daily application command creates/i.test(formatErrorMessage(err));
|
|
7560
7722
|
}
|
|
7561
7723
|
//#endregion
|
|
7562
7724
|
//#region extensions/discord/src/monitor/provider.startup-log.ts
|
|
@@ -7691,7 +7853,7 @@ function runDiscordCommandDeployInBackground(params) {
|
|
|
7691
7853
|
isVerbose: params.isVerbose
|
|
7692
7854
|
});
|
|
7693
7855
|
}).catch((err) => {
|
|
7694
|
-
params.runtime.log?.(warn(`[${params.accountId}] slash command deploy failed in background (message send/receive unaffected): ${formatErrorMessage
|
|
7856
|
+
params.runtime.log?.(warn(`[${params.accountId}] slash command deploy failed in background (message send/receive unaffected): ${formatErrorMessage(err)}`));
|
|
7695
7857
|
});
|
|
7696
7858
|
}
|
|
7697
7859
|
//#endregion
|
|
@@ -8589,8 +8751,8 @@ async function deliverDiscordReply(params) {
|
|
|
8589
8751
|
}
|
|
8590
8752
|
//#endregion
|
|
8591
8753
|
//#region extensions/discord/src/monitor/agent-components.dispatch.ts
|
|
8592
|
-
const loadConversationRuntime$1 = createLazyRuntimeModule(() => import("./agent-components.runtime-CEPrf2SY.
|
|
8593
|
-
const loadTypingRuntime = createLazyRuntimeModule(() => import("./typing-
|
|
8754
|
+
const loadConversationRuntime$1 = createLazyRuntimeModule(() => import("./agent-components.runtime-CEPrf2SY.mjs"));
|
|
8755
|
+
const loadTypingRuntime = createLazyRuntimeModule(() => import("./typing-BKZL5fGj.mjs").then((n) => n.n));
|
|
8594
8756
|
function buildDiscordComponentConversationLabel(params) {
|
|
8595
8757
|
if (params.interactionCtx.isDirectMessage) return buildDirectLabel(params.interactionCtx.user);
|
|
8596
8758
|
if (params.interactionCtx.isGroupDm) return `Group DM #${params.channelCtx.channelName ?? params.interactionCtx.channelId} channel id:${params.interactionCtx.channelId}`;
|
|
@@ -8735,13 +8897,11 @@ async function dispatchDiscordComponentEvent(params) {
|
|
|
8735
8897
|
Surface: "discord",
|
|
8736
8898
|
WasMentioned: true,
|
|
8737
8899
|
CommandAuthorized: commandAuthorized,
|
|
8738
|
-
CommandTurn: {
|
|
8739
|
-
kind: "text-slash",
|
|
8740
|
-
source: "text",
|
|
8900
|
+
CommandTurn: createCommandTurnContext(params.commandSource ?? "text", {
|
|
8741
8901
|
authorized: commandAuthorized,
|
|
8742
8902
|
body: eventText
|
|
8743
|
-
},
|
|
8744
|
-
CommandSource: "text",
|
|
8903
|
+
}),
|
|
8904
|
+
CommandSource: params.commandSource ?? "text",
|
|
8745
8905
|
MessageSid: interaction.rawData.id,
|
|
8746
8906
|
Timestamp: timestamp,
|
|
8747
8907
|
OriginatingChannel: "discord",
|
|
@@ -8874,7 +9034,7 @@ async function dispatchDiscordPluginInteractiveHandler(params) {
|
|
|
8874
9034
|
}
|
|
8875
9035
|
//#endregion
|
|
8876
9036
|
//#region extensions/discord/src/monitor/agent-components.plugin-interactive.ts
|
|
8877
|
-
const loadConversationRuntime = createLazyRuntimeModule(() => import("./agent-components.runtime-CEPrf2SY.
|
|
9037
|
+
const loadConversationRuntime = createLazyRuntimeModule(() => import("./agent-components.runtime-CEPrf2SY.mjs"));
|
|
8878
9038
|
async function dispatchPluginDiscordInteractiveEvent(params) {
|
|
8879
9039
|
const normalizedConversationId = params.interactionCtx.rawGuildId || params.channelCtx.channelType === ChannelType.GroupDM ? `channel:${params.interactionCtx.channelId}` : `user:${params.interactionCtx.userId}`;
|
|
8880
9040
|
let responded = false;
|
|
@@ -8997,7 +9157,7 @@ async function dispatchPluginDiscordInteractiveEvent(params) {
|
|
|
8997
9157
|
}
|
|
8998
9158
|
//#endregion
|
|
8999
9159
|
//#region extensions/discord/src/monitor/agent-components.handlers.ts
|
|
9000
|
-
const loadComponentsRuntime = createLazyRuntimeModule(() => import("./components-
|
|
9160
|
+
const loadComponentsRuntime = createLazyRuntimeModule(() => import("./components-MqMWUWnE.mjs").then((n) => n.t));
|
|
9001
9161
|
async function handleDiscordComponentEvent(params) {
|
|
9002
9162
|
const parsed = parseDiscordComponentData(params.data, resolveInteractionCustomId(params.interaction));
|
|
9003
9163
|
if (!parsed) {
|
|
@@ -9083,6 +9243,7 @@ async function handleDiscordComponentEvent(params) {
|
|
|
9083
9243
|
channelCtx,
|
|
9084
9244
|
guildInfo,
|
|
9085
9245
|
eventText,
|
|
9246
|
+
commandSource: consumed.callbackDataKind === "command" && (buttonCallbackFallback || selectedCommandFallback) ? "native" : void 0,
|
|
9086
9247
|
replyToId: consumed.messageId ?? params.interaction.message?.id,
|
|
9087
9248
|
routeOverrides: {
|
|
9088
9249
|
sessionKey: consumed.sessionKey,
|
|
@@ -9575,11 +9736,14 @@ var ExecApprovalButton = class extends Button {
|
|
|
9575
9736
|
const terminalLabel = resolveTerminalLabel(result.resolution.approval);
|
|
9576
9737
|
let terminalized = false;
|
|
9577
9738
|
try {
|
|
9578
|
-
await interaction.
|
|
9579
|
-
|
|
9580
|
-
|
|
9581
|
-
|
|
9582
|
-
|
|
9739
|
+
if (interaction.message) terminalized = await discordApprovalMessageUpdates.enqueue(interaction.message.id, async () => {
|
|
9740
|
+
if (!hasDiscordApprovalControl(await interaction.fetchReply(), parsed)) return false;
|
|
9741
|
+
await interaction.editReply(buildTerminalPayload({
|
|
9742
|
+
approval: result.resolution.approval,
|
|
9743
|
+
applied: result.resolution.applied
|
|
9744
|
+
}));
|
|
9745
|
+
return true;
|
|
9746
|
+
});
|
|
9583
9747
|
} catch {}
|
|
9584
9748
|
if (!terminalized || !result.resolution.applied) try {
|
|
9585
9749
|
await interaction.followUp({
|
|
@@ -9930,9 +10094,13 @@ var DiscordGuildJoinIntroductionListener = class extends GuildCreateListener {
|
|
|
9930
10094
|
constructor(params) {
|
|
9931
10095
|
super();
|
|
9932
10096
|
this.params = params;
|
|
10097
|
+
this.stopped = false;
|
|
10098
|
+
this.pendingReports = /* @__PURE__ */ new Set();
|
|
9933
10099
|
}
|
|
9934
10100
|
async handle(data, client) {
|
|
10101
|
+
if (this.stopped) return;
|
|
9935
10102
|
const policy = await this.params.readPolicy?.();
|
|
10103
|
+
if (this.stopped) return;
|
|
9936
10104
|
const params = {
|
|
9937
10105
|
...this.params,
|
|
9938
10106
|
...policy
|
|
@@ -9980,6 +10148,7 @@ var DiscordGuildJoinIntroductionListener = class extends GuildCreateListener {
|
|
|
9980
10148
|
break;
|
|
9981
10149
|
}
|
|
9982
10150
|
}
|
|
10151
|
+
if (this.stopped) return;
|
|
9983
10152
|
if (policy?.isCurrent() === false) {
|
|
9984
10153
|
params.logger?.info("Discord guild join introduction skipped: access policy changed", {
|
|
9985
10154
|
guildId: data.id,
|
|
@@ -9995,7 +10164,7 @@ var DiscordGuildJoinIntroductionListener = class extends GuildCreateListener {
|
|
|
9995
10164
|
return;
|
|
9996
10165
|
}
|
|
9997
10166
|
const selectedChannel = targetChannel;
|
|
9998
|
-
|
|
10167
|
+
const report = reportChannelRoomJoin({
|
|
9999
10168
|
cfg: params.cfg,
|
|
10000
10169
|
channel: "discord",
|
|
10001
10170
|
accountId: params.accountId,
|
|
@@ -10031,6 +10200,16 @@ var DiscordGuildJoinIntroductionListener = class extends GuildCreateListener {
|
|
|
10031
10200
|
}
|
|
10032
10201
|
}
|
|
10033
10202
|
});
|
|
10203
|
+
this.pendingReports.add(report);
|
|
10204
|
+
try {
|
|
10205
|
+
await report;
|
|
10206
|
+
} finally {
|
|
10207
|
+
this.pendingReports.delete(report);
|
|
10208
|
+
}
|
|
10209
|
+
}
|
|
10210
|
+
async stop() {
|
|
10211
|
+
this.stopped = true;
|
|
10212
|
+
await Promise.allSettled(this.pendingReports);
|
|
10034
10213
|
}
|
|
10035
10214
|
};
|
|
10036
10215
|
//#endregion
|
|
@@ -10158,7 +10337,7 @@ async function fetchDiscordBotIdentity(params) {
|
|
|
10158
10337
|
function registerDiscordMonitorListeners(params) {
|
|
10159
10338
|
registerDiscordListener(params.client.listeners, new DiscordInteractionListener(params.logger, params.trackInboundEvent));
|
|
10160
10339
|
registerDiscordListener(params.client.listeners, new DiscordMessageListener(params.messageHandler, params.logger, params.trackInboundEvent));
|
|
10161
|
-
|
|
10340
|
+
const guildJoinListener = new DiscordGuildJoinIntroductionListener({
|
|
10162
10341
|
readPolicy: params.readPolicy,
|
|
10163
10342
|
cfg: params.cfg,
|
|
10164
10343
|
accountId: params.accountId,
|
|
@@ -10166,7 +10345,8 @@ function registerDiscordMonitorListeners(params) {
|
|
|
10166
10345
|
groupPolicy: params.groupPolicy,
|
|
10167
10346
|
guildEntries: params.guildEntries,
|
|
10168
10347
|
logger: params.logger
|
|
10169
|
-
})
|
|
10348
|
+
});
|
|
10349
|
+
registerDiscordListener(params.client.listeners, guildJoinListener);
|
|
10170
10350
|
const reactionListenerOptions = {
|
|
10171
10351
|
readPolicy: params.readPolicy,
|
|
10172
10352
|
cfg: params.cfg,
|
|
@@ -10186,10 +10366,13 @@ function registerDiscordMonitorListeners(params) {
|
|
|
10186
10366
|
};
|
|
10187
10367
|
registerDiscordListener(params.client.listeners, new DiscordReactionListener(reactionListenerOptions));
|
|
10188
10368
|
registerDiscordListener(params.client.listeners, new DiscordReactionRemoveListener(reactionListenerOptions));
|
|
10189
|
-
|
|
10369
|
+
const threadUpdateListener = new DiscordThreadUpdateListener(params.cfg, params.logger);
|
|
10370
|
+
registerDiscordListener(params.client.listeners, threadUpdateListener);
|
|
10371
|
+
registerDiscordListener(params.client.listeners, new DiscordThreadReadyListener(threadUpdateListener));
|
|
10190
10372
|
registerDiscordListener(params.client.listeners, new DiscordThreadDeleteListener(params.cfg, params.accountId, params.logger));
|
|
10373
|
+
let presenceListener;
|
|
10191
10374
|
if (params.discordConfig.intents?.presence) {
|
|
10192
|
-
|
|
10375
|
+
presenceListener = new DiscordPresenceListener({
|
|
10193
10376
|
readPolicy: params.readPolicy,
|
|
10194
10377
|
cfg: params.cfg,
|
|
10195
10378
|
logger: params.logger,
|
|
@@ -10203,6 +10386,14 @@ function registerDiscordMonitorListeners(params) {
|
|
|
10203
10386
|
registerDiscordListener(params.client.listeners, new DiscordPresenceReadyListener(presenceListener));
|
|
10204
10387
|
params.runtime.log?.("discord: GuildPresences intent enabled — presence listener registered");
|
|
10205
10388
|
}
|
|
10389
|
+
return async () => {
|
|
10390
|
+
const introductionsStopped = guildJoinListener.stop();
|
|
10391
|
+
try {
|
|
10392
|
+
await presenceListener?.stop();
|
|
10393
|
+
} finally {
|
|
10394
|
+
await introductionsStopped;
|
|
10395
|
+
}
|
|
10396
|
+
};
|
|
10206
10397
|
}
|
|
10207
10398
|
//#endregion
|
|
10208
10399
|
//#region extensions/discord/src/monitor/startup-status.ts
|
|
@@ -10223,7 +10414,7 @@ function logDiscordStartupPhase(params) {
|
|
|
10223
10414
|
const DISCORD_DISALLOWED_INTENTS_CODE = GatewayCloseCodes$1.DisallowedIntents;
|
|
10224
10415
|
function isDiscordDisallowedIntentsError(err) {
|
|
10225
10416
|
if (!err) return false;
|
|
10226
|
-
return formatErrorMessage
|
|
10417
|
+
return formatErrorMessage(err).includes(String(DISCORD_DISALLOWED_INTENTS_CODE));
|
|
10227
10418
|
}
|
|
10228
10419
|
async function monitorDiscordProvider(opts = {}) {
|
|
10229
10420
|
const startupStartedAt = Date.now();
|
|
@@ -10302,6 +10493,7 @@ async function monitorDiscordProvider(opts = {}) {
|
|
|
10302
10493
|
const sessionPrefix = "discord:slash";
|
|
10303
10494
|
const ephemeralDefault = slashCommand.ephemeral;
|
|
10304
10495
|
const voiceEnabled = resolveDiscordVoiceEnabled(discordCfg.voice);
|
|
10496
|
+
if (voiceEnabled && getDiscordEndpointRuntime()) throw new Error("Discord voice transport is unavailable while DISCORD_API_URL is configured");
|
|
10305
10497
|
const allowlistResolved = await resolveDiscordAllowlistConfig({
|
|
10306
10498
|
token,
|
|
10307
10499
|
guildEntries,
|
|
@@ -10354,7 +10546,7 @@ async function monitorDiscordProvider(opts = {}) {
|
|
|
10354
10546
|
if (applicationIdProbe.kind !== "resolved") {
|
|
10355
10547
|
const at = Date.now();
|
|
10356
10548
|
const terminal = applicationIdProbe.kind === "rejected";
|
|
10357
|
-
const probeError = formatErrorMessage
|
|
10549
|
+
const probeError = formatErrorMessage(applicationIdProbe.error);
|
|
10358
10550
|
const message = `Failed to resolve Discord application id: ${probeError}`;
|
|
10359
10551
|
opts.setStatus?.({
|
|
10360
10552
|
connected: false,
|
|
@@ -10388,43 +10580,46 @@ async function monitorDiscordProvider(opts = {}) {
|
|
|
10388
10580
|
listNativeCommandSpecsForConfig: discordProviderRuntime.listNativeCommandSpecsForConfig
|
|
10389
10581
|
});
|
|
10390
10582
|
const voiceManagerRef = { current: null };
|
|
10391
|
-
const threadBindings = threadBindingsEnabled ? discordProviderSessionRuntime.createThreadBindingManager({
|
|
10583
|
+
const threadBindings = threadBindingsEnabled ? await discordProviderSessionRuntime.createThreadBindingManager({
|
|
10392
10584
|
accountId: account.accountId,
|
|
10393
10585
|
token,
|
|
10394
10586
|
cfg,
|
|
10395
10587
|
idleTimeoutMs: threadBindingIdleTimeoutMs,
|
|
10396
10588
|
maxAgeMs: threadBindingMaxAgeMs
|
|
10397
10589
|
}) : discordProviderSessionRuntime.createNoopThreadBindingManager(account.accountId);
|
|
10398
|
-
if (threadBindingsEnabled) {
|
|
10399
|
-
const uncertainProbeKeys = /* @__PURE__ */ new Set();
|
|
10400
|
-
const reconciliation = await discordProviderSessionRuntime.reconcileAcpThreadBindingsOnStartup({
|
|
10401
|
-
cfg,
|
|
10402
|
-
accountId: account.accountId,
|
|
10403
|
-
sendFarewell: false,
|
|
10404
|
-
healthProbe: async ({ sessionKey, session }) => {
|
|
10405
|
-
const probe = await probeDiscordAcpBindingHealth({
|
|
10406
|
-
cfg,
|
|
10407
|
-
sessionKey,
|
|
10408
|
-
agentId: session.agentId,
|
|
10409
|
-
storedState: session.acp?.state,
|
|
10410
|
-
lastActivityAt: session.acp?.lastActivityAt,
|
|
10411
|
-
providerSessionRuntime: discordProviderSessionRuntime
|
|
10412
|
-
});
|
|
10413
|
-
if (probe.status === "uncertain") uncertainProbeKeys.add(`${sessionKey}${probe.reason ? ` (${probe.reason})` : ""}`);
|
|
10414
|
-
return probe;
|
|
10415
|
-
}
|
|
10416
|
-
});
|
|
10417
|
-
if (reconciliation.removed > 0) logVerbose(`discord: removed ${reconciliation.removed}/${reconciliation.checked} stale ACP thread bindings on startup for account ${account.accountId}: ${reconciliation.staleSessionKeys.join(", ")}`);
|
|
10418
|
-
if (uncertainProbeKeys.size > 0) logVerbose(`discord: ACP thread-binding health probe uncertain for account ${account.accountId}: ${[...uncertainProbeKeys].join(", ")}`);
|
|
10419
|
-
}
|
|
10420
10590
|
let lifecycleStarted = false;
|
|
10421
10591
|
let gatewaySupervisor;
|
|
10422
10592
|
let deactivateMessageHandler;
|
|
10593
|
+
let stopMonitorListeners;
|
|
10423
10594
|
let autoPresenceController = null;
|
|
10424
10595
|
let lifecycleGateway;
|
|
10425
10596
|
let earlyGatewayEmitter = gatewaySupervisor?.emitter;
|
|
10426
10597
|
let onEarlyGatewayDebug;
|
|
10427
10598
|
try {
|
|
10599
|
+
if (opts.abortSignal?.aborted) return;
|
|
10600
|
+
if (threadBindingsEnabled) {
|
|
10601
|
+
const uncertainProbeKeys = /* @__PURE__ */ new Set();
|
|
10602
|
+
const reconciliation = await discordProviderSessionRuntime.reconcileAcpThreadBindingsOnStartup({
|
|
10603
|
+
cfg,
|
|
10604
|
+
accountId: account.accountId,
|
|
10605
|
+
sendFarewell: false,
|
|
10606
|
+
healthProbe: async ({ sessionKey, session }) => {
|
|
10607
|
+
const probe = await probeDiscordAcpBindingHealth({
|
|
10608
|
+
cfg,
|
|
10609
|
+
sessionKey,
|
|
10610
|
+
agentId: session.agentId,
|
|
10611
|
+
storedState: session.acp?.state,
|
|
10612
|
+
lastActivityAt: session.acp?.lastActivityAt,
|
|
10613
|
+
providerSessionRuntime: discordProviderSessionRuntime
|
|
10614
|
+
});
|
|
10615
|
+
if (probe.status === "uncertain") uncertainProbeKeys.add(`${sessionKey}${probe.reason ? ` (${probe.reason})` : ""}`);
|
|
10616
|
+
return probe;
|
|
10617
|
+
}
|
|
10618
|
+
});
|
|
10619
|
+
if (reconciliation.removed > 0) logVerbose(`discord: removed ${reconciliation.removed}/${reconciliation.checked} stale ACP thread bindings on startup for account ${account.accountId}: ${reconciliation.staleSessionKeys.join(", ")}`);
|
|
10620
|
+
if (uncertainProbeKeys.size > 0) logVerbose(`discord: ACP thread-binding health probe uncertain for account ${account.accountId}: ${[...uncertainProbeKeys].join(", ")}`);
|
|
10621
|
+
}
|
|
10622
|
+
if (opts.abortSignal?.aborted) return;
|
|
10428
10623
|
const pluginChannelRuntime = opts.channelRuntime;
|
|
10429
10624
|
const { commands, components, modals } = createDiscordProviderInteractionSurface({
|
|
10430
10625
|
readPolicy,
|
|
@@ -10565,7 +10760,7 @@ async function monitorDiscordProvider(opts = {}) {
|
|
|
10565
10760
|
lastInboundAt: at
|
|
10566
10761
|
});
|
|
10567
10762
|
} : void 0;
|
|
10568
|
-
registerDiscordMonitorListeners({
|
|
10763
|
+
stopMonitorListeners = registerDiscordMonitorListeners({
|
|
10569
10764
|
readPolicy,
|
|
10570
10765
|
cfg,
|
|
10571
10766
|
client,
|
|
@@ -10615,6 +10810,7 @@ async function monitorDiscordProvider(opts = {}) {
|
|
|
10615
10810
|
} finally {
|
|
10616
10811
|
await cleanupDiscordProviderStartup({
|
|
10617
10812
|
deactivateMessageHandler,
|
|
10813
|
+
stopMonitorListeners,
|
|
10618
10814
|
autoPresenceController,
|
|
10619
10815
|
setStatus: opts.setStatus,
|
|
10620
10816
|
onEarlyGatewayDebug,
|