@openclaw/discord 2026.9.4 → 2026.9.6
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-w8j7Elou.js → .setup/activities-api-COU4-0nR.mjs} +93 -31
- package/dist/{api-LIV--eMq.js → .setup/api-CBK9zcq5.mjs} +7 -4
- package/dist/{approval-handler.runtime-BnPUU5NK.js → .setup/approval-handler.runtime-CbBktBb4.mjs} +8 -7
- package/dist/.setup/approval-message-updates-jf9zMaIC.mjs +17 -0
- package/dist/{audit-BgAgIzwo.js → .setup/audit-vKbh-LFR.mjs} +5 -5
- package/dist/{channel-C_OFFR5Y.js → .setup/channel-Dv4e3Jpc.mjs} +34 -29
- package/dist/{channel-actions.runtime-tShzmemq.js → .setup/channel-actions.runtime-leZuw01r.mjs} +25 -12
- package/dist/{allow-list-DWEio925.js → .setup/channel-type-DKnjV1XW.mjs} +161 -1
- package/dist/{channel.setup-CpAwAiS0.js → .setup/channel.setup-0NX6FFwi.mjs} +4 -4
- package/dist/{components-DBFTIN6P.js → .setup/components-yBEb75bB.mjs} +4 -5
- package/dist/{config-schema-r38UkM_J.js → .setup/config-schema-CiZz-mtA.mjs} +1 -1
- package/dist/{conversation-binding-route-CB9PRqgi.js → .setup/conversation-binding-route-B7qImK_b.mjs} +6 -3
- 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-D1R-uFIu.mjs} +6 -6
- package/dist/{handle-action.guild-admin-CpEwox_X.js → .setup/handle-action.guild-admin-DcFa8NwA.mjs} +10 -5
- package/dist/{live-policy-config-BblutQAq.js → .setup/live-policy-config-eKQ-PLdy.mjs} +1 -1
- package/dist/{message-handler-C7FZGKa8.js → .setup/message-handler-X6ejmbtY.mjs} +25 -14
- package/dist/{message-handler.preflight-DFpwDW2W.js → .setup/message-handler.preflight-DE_POxFc.mjs} +35 -125
- package/dist/.setup/message-handler.preflight-pluralkit-8Xji34AF.mjs +143 -0
- package/dist/{message-handler.process-ZKrmmA9D.js → .setup/message-handler.process-CCmIVnxy.mjs} +438 -378
- package/dist/{outbound-adapter-C8PTt7_p.js → .setup/outbound-adapter-ClIgmu4F.mjs} +13 -9
- package/dist/{outbound-session-route-B0N6os97.js → .setup/outbound-session-route-VulUE0yV.mjs} +138 -11
- package/dist/{pluralkit-BiUW53Yn.js → .setup/pluralkit-CdAt1G0P.mjs} +2 -2
- package/dist/{preflight-audio-DrnqFA8U.js → .setup/preflight-audio-DHGIHEpv.mjs} +2 -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-DmRHCZ_K.js → .setup/provider-iOf73HW-.mjs} +885 -557
- package/dist/{provider-session.runtime-U1M8_EYY.js → .setup/provider-session.runtime-DrGAYnZv.mjs} +4 -4
- package/dist/.setup/provider.runtime-BmjW_pIw.mjs +2 -0
- package/dist/{realtime-session.runtime-Bjsk9Q5t.js → .setup/realtime-session.runtime-Dz8uVutq.mjs} +977 -514
- package/dist/.setup/receive-recovery-DHst8WRx.mjs +517 -0
- 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-DKeoT7UO.js → .setup/retry-BEYkDy0P.mjs} +106 -19
- package/dist/{runtime-Dxl-ZOvg.js → .setup/runtime-B8lJfyrA.mjs} +113 -141
- package/dist/{runtime-CbknwoBH.js → .setup/runtime-DisDbixd.mjs} +2 -2
- 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-CLpzfzJe.js → .setup/send-CIBzvXjS.mjs} +80 -37
- package/dist/{send.components-BWnkX4QN.js → .setup/send.components-ChY21qr-.mjs} +87 -65
- package/dist/{send.outbound-BVTWrl_4.js → .setup/send.outbound-QTyuFupn.mjs} +30 -21
- package/dist/{send.shared-BHPM3CSl.js → .setup/send.shared-VNvWfX2T.mjs} +15 -12
- package/dist/{sender-identity-f3l5OYgV.js → .setup/sender-identity-0Ymgvmaj.mjs} +1 -1
- package/dist/.setup/setup-plugin-api-Dvr41dyx.mjs +3 -0
- package/dist/{shared-CPPR0Xo4.js → .setup/shared-DHPDaMSx.mjs} +11 -11
- package/dist/{subagent-hooks-DfsiwCec.js → .setup/subagent-hooks-CjW7r8Pe.mjs} +16 -4
- package/dist/{system-events-B6HkUhF_.js → .setup/system-events-B2YEEMbS.mjs} +2 -2
- package/dist/{target-resolver-CoFQ7iSX.js → .setup/target-resolver-BXpy6VT8.mjs} +4 -4
- package/dist/.setup/targets-CvemhN3i.mjs +3 -0
- package/dist/{thread-bindings-uudC_0TY.js → .setup/thread-bindings-CEh2dhqP.mjs} +6 -6
- package/dist/{thread-bindings.manager-BeUxc8nr.js → .setup/thread-bindings.manager-ve-i6oqt.mjs} +100 -46
- package/dist/{thread-bindings.session-updates-BwkXpcy0.js → .setup/thread-bindings.session-updates-DCQq1WZ5.mjs} +1 -1
- package/dist/{thread-bindings.state-dDn-dwBw.js → .setup/thread-bindings.state-BThFQEga.mjs} +46 -14
- package/dist/{transcripts-source-VkgenQv-.js → .setup/transcripts-source-DVegW0WI.mjs} +121 -30
- package/dist/{typing-DuBg1U8Q.js → .setup/typing-BKZL5fGj.mjs} +2 -2
- package/dist/{voice-runtime-DMYDMkJx.js → .setup/voice-runtime-elTtjEIG.mjs} +773 -773
- 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 +4 -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/src/voice/audio-worker.runtime.js +1065 -0
- 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/@napi-rs/wasm-runtime/dist/emnapi-plugins.cjs +8 -4
- package/node_modules/@napi-rs/wasm-runtime/dist/emnapi-plugins.js +8 -4
- package/node_modules/@napi-rs/wasm-runtime/dist/fs-proxy.cjs +1 -1
- package/node_modules/@napi-rs/wasm-runtime/dist/fs.js +770 -695
- package/node_modules/@napi-rs/wasm-runtime/fs-proxy.js +3 -2
- package/node_modules/@napi-rs/wasm-runtime/package.json +1 -1
- package/node_modules/@tybys/wasm-util/LICENSE +21 -0
- package/node_modules/@tybys/wasm-util/package.json +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/web-globals/streams.d.ts +4 -0
- 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 +29 -2
- package/node_modules/zod/compile.cjs +96 -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 +21 -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/locales/index.cjs +19 -0
- package/node_modules/zod/mini/index.cjs +19 -0
- package/node_modules/zod/package.json +20 -8
- 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/helpers/errorUtil.ts +1 -1
- 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 +14 -9
- package/node_modules/zod/src/v4/classic/from-json-schema.ts +363 -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 +640 -375
- 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 +186 -0
- package/node_modules/zod/src/v4/classic/tests/bigint.test.ts +36 -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 +3 -3
- 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 +985 -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 +261 -13
- package/node_modules/zod/src/v4/classic/tests/enum.test.ts +20 -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 +403 -6
- package/node_modules/zod/src/v4/classic/tests/from-json-schema.test.ts +582 -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/iban.test.ts +81 -0
- 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 +319 -0
- package/node_modules/zod/src/v4/classic/tests/instanceof.test.ts +67 -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 +215 -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 +85 -9
- package/node_modules/zod/src/v4/classic/tests/object.test.ts +301 -12
- package/node_modules/zod/src/v4/classic/tests/optin-ladder.test.ts +235 -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/prefault.test.ts +70 -0
- package/node_modules/zod/src/v4/classic/tests/preprocess-types.test.ts +20 -2
- package/node_modules/zod/src/v4/classic/tests/properties.test.ts +141 -0
- 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 +79 -3
- 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/standard-schema.test.ts +19 -0
- package/node_modules/zod/src/v4/classic/tests/string.test.ts +222 -6
- 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 +44 -3
- package/node_modules/zod/src/v4/classic/tests/to-json-schema.test.ts +1812 -204
- 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 +645 -0
- package/node_modules/zod/src/v4/classic/tests/validations.test.ts +2 -2
- package/node_modules/zod/src/v4/core/api.ts +87 -35
- package/node_modules/zod/src/v4/core/checks.ts +119 -146
- package/node_modules/zod/src/v4/core/compile.ts +2313 -0
- package/node_modules/zod/src/v4/core/core.ts +99 -22
- package/node_modules/zod/src/v4/core/doc.ts +17 -9
- package/node_modules/zod/src/v4/core/errors.ts +113 -25
- package/node_modules/zod/src/v4/core/index.ts +3 -0
- package/node_modules/zod/src/v4/core/json-schema-generator.ts +8 -3
- package/node_modules/zod/src/v4/core/json-schema-processors.ts +424 -156
- package/node_modules/zod/src/v4/core/json-schema.ts +2 -1
- package/node_modules/zod/src/v4/core/memoizer.ts +331 -0
- package/node_modules/zod/src/v4/core/parse.ts +164 -50
- package/node_modules/zod/src/v4/core/regexes.ts +42 -15
- package/node_modules/zod/src/v4/core/registries.ts +2 -2
- package/node_modules/zod/src/v4/core/schemas.ts +1000 -538
- package/node_modules/zod/src/v4/core/tests/cached.test.ts +54 -0
- package/node_modules/zod/src/v4/core/tests/compile-differential.test.ts +1004 -0
- package/node_modules/zod/src/v4/core/tests/compile-generative.test.ts +445 -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 +2036 -0
- package/node_modules/zod/src/v4/core/tests/email-regex.test.ts +140 -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/tg.test.ts +85 -0
- package/node_modules/zod/src/v4/core/tests/locales/tk.test.ts +69 -0
- package/node_modules/zod/src/v4/core/tests/polyfill-collision.test.ts +46 -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 +133 -0
- package/node_modules/zod/src/v4/core/to-json-schema.ts +283 -48
- package/node_modules/zod/src/v4/core/util.ts +454 -157
- 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 +5 -0
- package/node_modules/zod/src/v4/locales/az.ts +5 -0
- package/node_modules/zod/src/v4/locales/be.ts +12 -0
- package/node_modules/zod/src/v4/locales/bg.ts +5 -0
- package/node_modules/zod/src/v4/locales/bn.ts +123 -0
- package/node_modules/zod/src/v4/locales/ca.ts +5 -0
- package/node_modules/zod/src/v4/locales/ckb.ts +140 -0
- package/node_modules/zod/src/v4/locales/cs.ts +5 -0
- package/node_modules/zod/src/v4/locales/da.ts +7 -2
- package/node_modules/zod/src/v4/locales/de.ts +5 -0
- package/node_modules/zod/src/v4/locales/el.ts +3 -0
- package/node_modules/zod/src/v4/locales/en.ts +17 -4
- package/node_modules/zod/src/v4/locales/eo.ts +5 -0
- package/node_modules/zod/src/v4/locales/es.ts +4 -0
- package/node_modules/zod/src/v4/locales/fa.ts +5 -0
- package/node_modules/zod/src/v4/locales/fi.ts +5 -0
- package/node_modules/zod/src/v4/locales/fr-CA.ts +5 -0
- package/node_modules/zod/src/v4/locales/fr.ts +21 -14
- package/node_modules/zod/src/v4/locales/gu.ts +123 -0
- package/node_modules/zod/src/v4/locales/he.ts +8 -1
- package/node_modules/zod/src/v4/locales/hi.ts +126 -0
- package/node_modules/zod/src/v4/locales/hr.ts +4 -0
- package/node_modules/zod/src/v4/locales/hu.ts +5 -0
- package/node_modules/zod/src/v4/locales/hy.ts +11 -0
- package/node_modules/zod/src/v4/locales/id.ts +5 -0
- package/node_modules/zod/src/v4/locales/index.ts +11 -0
- package/node_modules/zod/src/v4/locales/is.ts +5 -0
- package/node_modules/zod/src/v4/locales/it.ts +5 -0
- package/node_modules/zod/src/v4/locales/ja.ts +5 -0
- package/node_modules/zod/src/v4/locales/ka.ts +5 -0
- package/node_modules/zod/src/v4/locales/km.ts +5 -0
- package/node_modules/zod/src/v4/locales/kn.ts +126 -0
- package/node_modules/zod/src/v4/locales/ko.ts +5 -0
- package/node_modules/zod/src/v4/locales/lt.ts +4 -0
- package/node_modules/zod/src/v4/locales/mk.ts +5 -0
- package/node_modules/zod/src/v4/locales/ms.ts +5 -0
- package/node_modules/zod/src/v4/locales/ne.ts +128 -0
- package/node_modules/zod/src/v4/locales/nl.ts +5 -0
- package/node_modules/zod/src/v4/locales/nn.ts +121 -0
- package/node_modules/zod/src/v4/locales/no.ts +7 -2
- package/node_modules/zod/src/v4/locales/ota.ts +5 -0
- package/node_modules/zod/src/v4/locales/pl.ts +5 -0
- package/node_modules/zod/src/v4/locales/ps.ts +5 -0
- package/node_modules/zod/src/v4/locales/pt-BR.ts +161 -0
- package/node_modules/zod/src/v4/locales/pt.ts +101 -58
- package/node_modules/zod/src/v4/locales/ro.ts +3 -0
- package/node_modules/zod/src/v4/locales/ru.ts +12 -0
- package/node_modules/zod/src/v4/locales/sk.ts +123 -0
- package/node_modules/zod/src/v4/locales/sl.ts +5 -0
- package/node_modules/zod/src/v4/locales/sv.ts +7 -2
- package/node_modules/zod/src/v4/locales/ta.ts +5 -0
- package/node_modules/zod/src/v4/locales/tg.ts +135 -0
- package/node_modules/zod/src/v4/locales/th.ts +5 -0
- package/node_modules/zod/src/v4/locales/tk.ts +113 -0
- package/node_modules/zod/src/v4/locales/tr.ts +5 -0
- package/node_modules/zod/src/v4/locales/uk.ts +5 -0
- package/node_modules/zod/src/v4/locales/ur.ts +5 -0
- package/node_modules/zod/src/v4/locales/uz.ts +3 -0
- package/node_modules/zod/src/v4/locales/vi.ts +5 -0
- package/node_modules/zod/src/v4/locales/yo.ts +5 -0
- package/node_modules/zod/src/v4/locales/zh-CN.ts +5 -0
- package/node_modules/zod/src/v4/locales/zh-TW.ts +5 -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 +12 -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 +167 -63
- 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/computed.test.ts +11 -17
- 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 +158 -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/recursive-types.test.ts +16 -0
- package/node_modules/zod/src/v4/mini/tests/string.test.ts +44 -0
- package/node_modules/zod/v3/ZodError.cjs +41 -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/errors.cjs +19 -0
- package/node_modules/zod/v3/external.cjs +19 -0
- package/node_modules/zod/v3/helpers/enumUtil.cjs +19 -0
- package/node_modules/zod/v3/helpers/errorUtil.cjs +20 -1
- package/node_modules/zod/v3/helpers/errorUtil.js +1 -1
- package/node_modules/zod/v3/helpers/parseUtil.cjs +19 -0
- package/node_modules/zod/v3/helpers/partialUtil.cjs +19 -0
- package/node_modules/zod/v3/helpers/typeAliases.cjs +19 -0
- package/node_modules/zod/v3/helpers/util.cjs +19 -0
- package/node_modules/zod/v3/index.cjs +19 -0
- package/node_modules/zod/v3/standard-schema.cjs +19 -0
- package/node_modules/zod/v3/types.cjs +26 -5
- package/node_modules/zod/v3/types.js +7 -5
- package/node_modules/zod/v4/classic/checks.cjs +21 -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/coerce.cjs +19 -0
- package/node_modules/zod/v4/classic/compat.cjs +19 -0
- 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 +58 -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 +62 -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 +51 -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 +376 -75
- package/node_modules/zod/v4/classic/from-json-schema.js +357 -75
- package/node_modules/zod/v4/classic/in-out.cjs +82 -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 +21 -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 +30 -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 +23 -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 +591 -426
- package/node_modules/zod/v4/classic/schemas.d.cts +68 -19
- package/node_modules/zod/v4/classic/schemas.d.ts +68 -19
- package/node_modules/zod/v4/classic/schemas.js +564 -424
- package/node_modules/zod/v4/core/api.cjs +66 -24
- package/node_modules/zod/v4/core/api.d.cts +22 -12
- package/node_modules/zod/v4/core/api.d.ts +22 -12
- package/node_modules/zod/v4/core/api.js +44 -24
- package/node_modules/zod/v4/core/checks.cjs +88 -128
- package/node_modules/zod/v4/core/checks.d.cts +29 -13
- package/node_modules/zod/v4/core/checks.d.ts +29 -13
- package/node_modules/zod/v4/core/checks.js +68 -127
- package/node_modules/zod/v4/core/compile.cjs +1908 -0
- package/node_modules/zod/v4/core/compile.d.cts +65 -0
- package/node_modules/zod/v4/core/compile.d.ts +65 -0
- package/node_modules/zod/v4/core/compile.js +1858 -0
- package/node_modules/zod/v4/core/core.cjs +101 -19
- 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 +83 -20
- package/node_modules/zod/v4/core/doc.cjs +31 -9
- 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 +12 -9
- package/node_modules/zod/v4/core/errors.cjs +126 -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 +107 -25
- package/node_modules/zod/v4/core/index.cjs +24 -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 +24 -1
- 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 +6 -2
- package/node_modules/zod/v4/core/json-schema-processors.cjs +441 -156
- package/node_modules/zod/v4/core/json-schema-processors.d.cts +16 -0
- package/node_modules/zod/v4/core/json-schema-processors.d.ts +16 -0
- package/node_modules/zod/v4/core/json-schema-processors.js +400 -158
- package/node_modules/zod/v4/core/json-schema.cjs +19 -0
- 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 +360 -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 +311 -0
- package/node_modules/zod/v4/core/parse.cjs +148 -46
- 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 +127 -45
- package/node_modules/zod/v4/core/regexes.cjs +54 -17
- package/node_modules/zod/v4/core/regexes.d.cts +5 -0
- package/node_modules/zod/v4/core/regexes.d.ts +5 -0
- package/node_modules/zod/v4/core/regexes.js +32 -15
- package/node_modules/zod/v4/core/registries.cjs +19 -0
- package/node_modules/zod/v4/core/registries.js +2 -2
- package/node_modules/zod/v4/core/schemas.cjs +785 -386
- package/node_modules/zod/v4/core/schemas.d.cts +123 -34
- package/node_modules/zod/v4/core/schemas.d.ts +123 -34
- package/node_modules/zod/v4/core/schemas.js +753 -386
- package/node_modules/zod/v4/core/standard-schema.cjs +19 -0
- package/node_modules/zod/v4/core/to-json-schema.cjs +269 -45
- package/node_modules/zod/v4/core/to-json-schema.d.cts +45 -5
- package/node_modules/zod/v4/core/to-json-schema.d.ts +45 -5
- package/node_modules/zod/v4/core/to-json-schema.js +247 -44
- package/node_modules/zod/v4/core/util.cjs +372 -157
- package/node_modules/zod/v4/core/util.d.cts +79 -1
- package/node_modules/zod/v4/core/util.d.ts +79 -1
- package/node_modules/zod/v4/core/util.js +341 -156
- package/node_modules/zod/v4/core/versions.cjs +21 -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 +214 -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 +34 -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 +5 -0
- package/node_modules/zod/v4/locales/ar.js +5 -0
- package/node_modules/zod/v4/locales/az.cjs +5 -0
- package/node_modules/zod/v4/locales/az.js +5 -0
- package/node_modules/zod/v4/locales/be.cjs +12 -0
- package/node_modules/zod/v4/locales/be.js +12 -0
- package/node_modules/zod/v4/locales/bg.cjs +5 -0
- package/node_modules/zod/v4/locales/bg.js +5 -0
- package/node_modules/zod/v4/locales/bn.cjs +140 -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 +113 -0
- package/node_modules/zod/v4/locales/ca.cjs +5 -0
- package/node_modules/zod/v4/locales/ca.js +5 -0
- package/node_modules/zod/v4/locales/ckb.cjs +160 -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 +133 -0
- package/node_modules/zod/v4/locales/cs.cjs +5 -0
- package/node_modules/zod/v4/locales/cs.js +5 -0
- package/node_modules/zod/v4/locales/da.cjs +7 -2
- package/node_modules/zod/v4/locales/da.js +7 -2
- package/node_modules/zod/v4/locales/de.cjs +5 -0
- package/node_modules/zod/v4/locales/de.js +5 -0
- package/node_modules/zod/v4/locales/el.cjs +3 -0
- package/node_modules/zod/v4/locales/el.js +3 -0
- package/node_modules/zod/v4/locales/en.cjs +16 -4
- package/node_modules/zod/v4/locales/en.js +16 -4
- package/node_modules/zod/v4/locales/eo.cjs +5 -0
- package/node_modules/zod/v4/locales/eo.js +5 -0
- package/node_modules/zod/v4/locales/es.cjs +4 -0
- package/node_modules/zod/v4/locales/es.js +4 -0
- package/node_modules/zod/v4/locales/fa.cjs +5 -0
- package/node_modules/zod/v4/locales/fa.js +5 -0
- package/node_modules/zod/v4/locales/fi.cjs +5 -0
- package/node_modules/zod/v4/locales/fi.js +5 -0
- package/node_modules/zod/v4/locales/fr-CA.cjs +5 -0
- package/node_modules/zod/v4/locales/fr-CA.js +5 -0
- package/node_modules/zod/v4/locales/fr.cjs +18 -14
- package/node_modules/zod/v4/locales/fr.js +18 -14
- package/node_modules/zod/v4/locales/gu.cjs +140 -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 +113 -0
- package/node_modules/zod/v4/locales/he.cjs +7 -0
- package/node_modules/zod/v4/locales/he.js +7 -0
- package/node_modules/zod/v4/locales/hi.cjs +138 -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 +111 -0
- package/node_modules/zod/v4/locales/hr.cjs +4 -0
- package/node_modules/zod/v4/locales/hr.js +4 -0
- package/node_modules/zod/v4/locales/hu.cjs +5 -0
- package/node_modules/zod/v4/locales/hu.js +5 -0
- package/node_modules/zod/v4/locales/hy.cjs +11 -0
- package/node_modules/zod/v4/locales/hy.js +11 -0
- package/node_modules/zod/v4/locales/id.cjs +5 -0
- package/node_modules/zod/v4/locales/id.js +5 -0
- package/node_modules/zod/v4/locales/index.cjs +43 -2
- package/node_modules/zod/v4/locales/index.d.cts +11 -0
- package/node_modules/zod/v4/locales/index.d.ts +11 -0
- package/node_modules/zod/v4/locales/index.js +11 -0
- package/node_modules/zod/v4/locales/is.cjs +5 -0
- package/node_modules/zod/v4/locales/is.js +5 -0
- package/node_modules/zod/v4/locales/it.cjs +5 -0
- package/node_modules/zod/v4/locales/it.js +5 -0
- package/node_modules/zod/v4/locales/ja.cjs +5 -0
- package/node_modules/zod/v4/locales/ja.js +5 -0
- package/node_modules/zod/v4/locales/ka.cjs +5 -0
- package/node_modules/zod/v4/locales/ka.js +5 -0
- package/node_modules/zod/v4/locales/km.cjs +5 -0
- package/node_modules/zod/v4/locales/km.js +5 -0
- package/node_modules/zod/v4/locales/kn.cjs +143 -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 +116 -0
- package/node_modules/zod/v4/locales/ko.cjs +5 -0
- package/node_modules/zod/v4/locales/ko.js +5 -0
- package/node_modules/zod/v4/locales/lt.cjs +4 -0
- package/node_modules/zod/v4/locales/lt.js +4 -0
- package/node_modules/zod/v4/locales/mk.cjs +5 -0
- package/node_modules/zod/v4/locales/mk.js +5 -0
- package/node_modules/zod/v4/locales/ms.cjs +5 -0
- package/node_modules/zod/v4/locales/ms.js +5 -0
- package/node_modules/zod/v4/locales/ne.cjs +138 -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 +111 -0
- package/node_modules/zod/v4/locales/nl.cjs +5 -0
- package/node_modules/zod/v4/locales/nl.js +5 -0
- package/node_modules/zod/v4/locales/nn.cjs +140 -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 +113 -0
- package/node_modules/zod/v4/locales/no.cjs +7 -2
- package/node_modules/zod/v4/locales/no.js +7 -2
- package/node_modules/zod/v4/locales/ota.cjs +5 -0
- package/node_modules/zod/v4/locales/ota.js +5 -0
- package/node_modules/zod/v4/locales/pl.cjs +5 -0
- package/node_modules/zod/v4/locales/pl.js +5 -0
- package/node_modules/zod/v4/locales/ps.cjs +5 -0
- package/node_modules/zod/v4/locales/ps.js +5 -0
- package/node_modules/zod/v4/locales/pt-BR.cjs +170 -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 +143 -0
- package/node_modules/zod/v4/locales/pt.cjs +89 -55
- package/node_modules/zod/v4/locales/pt.js +89 -55
- package/node_modules/zod/v4/locales/ro.cjs +3 -0
- package/node_modules/zod/v4/locales/ro.js +3 -0
- package/node_modules/zod/v4/locales/ru.cjs +12 -0
- package/node_modules/zod/v4/locales/ru.js +12 -0
- package/node_modules/zod/v4/locales/sk.cjs +143 -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 +116 -0
- package/node_modules/zod/v4/locales/sl.cjs +5 -0
- package/node_modules/zod/v4/locales/sl.js +5 -0
- package/node_modules/zod/v4/locales/sv.cjs +7 -2
- package/node_modules/zod/v4/locales/sv.js +7 -2
- package/node_modules/zod/v4/locales/ta.cjs +5 -0
- package/node_modules/zod/v4/locales/ta.js +5 -0
- package/node_modules/zod/v4/locales/tg.cjs +144 -0
- package/node_modules/zod/v4/locales/tg.d.cts +5 -0
- package/node_modules/zod/v4/locales/tg.d.ts +4 -0
- package/node_modules/zod/v4/locales/tg.js +117 -0
- package/node_modules/zod/v4/locales/th.cjs +5 -0
- package/node_modules/zod/v4/locales/th.js +5 -0
- package/node_modules/zod/v4/locales/tk.cjs +134 -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 +107 -0
- package/node_modules/zod/v4/locales/tr.cjs +5 -0
- package/node_modules/zod/v4/locales/tr.js +5 -0
- package/node_modules/zod/v4/locales/uk.cjs +5 -0
- package/node_modules/zod/v4/locales/uk.js +5 -0
- package/node_modules/zod/v4/locales/ur.cjs +5 -0
- package/node_modules/zod/v4/locales/ur.js +5 -0
- package/node_modules/zod/v4/locales/uz.cjs +3 -0
- package/node_modules/zod/v4/locales/uz.js +3 -0
- package/node_modules/zod/v4/locales/vi.cjs +5 -0
- package/node_modules/zod/v4/locales/vi.js +5 -0
- package/node_modules/zod/v4/locales/yo.cjs +5 -0
- package/node_modules/zod/v4/locales/yo.js +5 -0
- package/node_modules/zod/v4/locales/zh-CN.cjs +5 -0
- package/node_modules/zod/v4/locales/zh-CN.js +5 -0
- package/node_modules/zod/v4/locales/zh-TW.cjs +5 -0
- package/node_modules/zod/v4/locales/zh-TW.js +5 -0
- package/node_modules/zod/v4/mini/checks.cjs +21 -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/coerce.cjs +19 -0
- package/node_modules/zod/v4/mini/deep-partial.cjs +58 -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 +33 -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 +82 -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/index.cjs +19 -0
- package/node_modules/zod/v4/mini/iso.cjs +19 -0
- package/node_modules/zod/v4/mini/parse.cjs +22 -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 +117 -53
- package/node_modules/zod/v4/mini/schemas.d.cts +49 -14
- package/node_modules/zod/v4/mini/schemas.d.ts +49 -14
- package/node_modules/zod/v4/mini/schemas.js +92 -51
- package/node_modules/zod/v4-mini/index.cjs +19 -0
- package/openclaw.plugin.json +3 -4
- package/package.json +13 -8
- package/dist/channel-type-CVLZyGYS.js +0 -7
- package/dist/message-handler.history-CJOsN9w5.js +0 -28
- package/dist/outbound-components-DrlHcWfM.js +0 -100
- package/dist/provider.runtime-CqfE-RvC.js +0 -2
- package/dist/targets-Cm6aV9nJ.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/{model-picker-preference-primitives-BHT1LkR_.js → .setup/model-picker-preference-primitives-BHT1LkR_.mjs} +0 -0
- /package/dist/{presence-cache-dYSHPWMx.js → .setup/presence-cache-dYSHPWMx.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
package/dist/{message-handler.process-ZKrmmA9D.js → .setup/message-handler.process-CCmIVnxy.mjs}
RENAMED
|
@@ -1,21 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { p as resolveDiscordMaxLinesPerMessage } from "./accounts-CwJQoLjM.
|
|
4
|
-
import {
|
|
5
|
-
import { F as createDiscordRuntimeAccountContext, P as createDiscordRestClient, d as resolveDiscordTargetChannelId, k as resolveDiscordMessageFlags } from "./send.shared-
|
|
6
|
-
import { a as discordTextHasBroadcastMention } from "./send.outbound-
|
|
7
|
-
import { S as
|
|
8
|
-
import { a as removeReactionDiscord,
|
|
9
|
-
import { n as DISCORD_ATTACHMENT_TOTAL_TIMEOUT_MS, t as DISCORD_ATTACHMENT_IDLE_TIMEOUT_MS } from "./timeouts-D86uWLt_.
|
|
10
|
-
import "./targets-
|
|
11
|
-
import {
|
|
12
|
-
import { t as DISCORD_TEXT_CHUNK_LIMIT } from "./outbound-adapter-
|
|
13
|
-
import { a as formatDiscordReplySkip, c as buildGuildLabel, g as createDiscordSupplementalContextAccessChecker, h as buildDiscordInboundAccessContext, i as formatDiscordReplyDeliveryFailure, l as resolveReplyContext, o as sanitizeDiscordFrontChannelReplyPayloads, r as deliverDiscordReply, s as buildDirectLabel } from "./provider-
|
|
14
|
-
import { n as resolveDiscordWebhookId } from "./sender-identity-
|
|
15
|
-
import { t as beginDiscordActiveTurnThreadRoute } from "./active-turn-thread-route-fmHl1HNd.
|
|
16
|
-
import {
|
|
17
|
-
import { t as sendTyping } from "./typing-
|
|
18
|
-
import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
|
|
1
|
+
import { C as withDiscordRequestAuthority, D as Message, _t as listChannelMessages, ft as editChannelMessage, jt as getGuildMember, st as createChannelMessage, t as discord_exports, ut as deleteChannelMessage } from "./discord-BXpHW-cu.mjs";
|
|
2
|
+
import { C as resolveTimestampMs, i as normalizeDiscordAllowList, o as normalizeDiscordSlug } from "./channel-type-DKnjV1XW.mjs";
|
|
3
|
+
import { p as resolveDiscordMaxLinesPerMessage } from "./accounts-CwJQoLjM.mjs";
|
|
4
|
+
import { b as resolveDiscordChannelId, o as chunkDiscordTextWithMode } from "./retry-BEYkDy0P.mjs";
|
|
5
|
+
import { F as createDiscordRuntimeAccountContext, P as createDiscordRestClient, d as resolveDiscordTargetChannelId, k as resolveDiscordMessageFlags } from "./send.shared-VNvWfX2T.mjs";
|
|
6
|
+
import { a as discordTextHasBroadcastMention } from "./send.outbound-QTyuFupn.mjs";
|
|
7
|
+
import { O as resolveDiscordMessageStickers, S as formatDiscordMediaText, T as resolveReferencedReplyMediaList, b as resolveDiscordMessageMentionDocuments, g as resolveDiscordThreadStarter, m as resolveDiscordAutoThreadReplyPlan, x as resolveDiscordMessageText, y as resolveDiscordMessageHistoryText } from "./transcripts-source-DVegW0WI.mjs";
|
|
8
|
+
import { a as removeReactionDiscord, r as reactMessageDiscord } from "./send-CIBzvXjS.mjs";
|
|
9
|
+
import { n as DISCORD_ATTACHMENT_TOTAL_TIMEOUT_MS, t as DISCORD_ATTACHMENT_IDLE_TIMEOUT_MS } from "./timeouts-D86uWLt_.mjs";
|
|
10
|
+
import "./targets-CvemhN3i.mjs";
|
|
11
|
+
import { b as discordInboundEventDelivery, h as resolveDiscordConversationIdentity, u as buildDiscordRoutePeer } from "./outbound-session-route-VulUE0yV.mjs";
|
|
12
|
+
import { t as DISCORD_TEXT_CHUNK_LIMIT } from "./outbound-adapter-ClIgmu4F.mjs";
|
|
13
|
+
import { a as formatDiscordReplySkip, c as buildGuildLabel, g as createDiscordSupplementalContextAccessChecker, h as buildDiscordInboundAccessContext, i as formatDiscordReplyDeliveryFailure, l as resolveReplyContext, o as sanitizeDiscordFrontChannelReplyPayloads, r as deliverDiscordReply, s as buildDirectLabel } from "./provider-iOf73HW-.mjs";
|
|
14
|
+
import { n as resolveDiscordWebhookId, t as resolveDiscordSenderIdentity } from "./sender-identity-0Ymgvmaj.mjs";
|
|
15
|
+
import { t as beginDiscordActiveTurnThreadRoute } from "./active-turn-thread-route-fmHl1HNd.mjs";
|
|
16
|
+
import { a as createDiscordHistorySenderProvenance, c as hasRawDiscordUserMention, d as matchesActiveDiscordMentionPatterns, h as shouldIgnoreBoundThreadWebhookMessage, l as isBoundThreadBotSystemMessage, o as filterDiscordHistoryEntriesForContext, s as resolveDiscordHistoryMediaIds, t as resolveDiscordPreflightPluralKitInfo } from "./message-handler.preflight-pluralkit-8Xji34AF.mjs";
|
|
17
|
+
import { t as sendTyping } from "./typing-BKZL5fGj.mjs";
|
|
19
18
|
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
20
19
|
import { buildAgentSessionKey, resolveThreadSessionKeys } from "openclaw/plugin-sdk/routing";
|
|
21
20
|
import { getReplyPayloadTtsSupplement, isReplyPayloadNonTerminalToolErrorWarning, resolveSendableOutboundReplyParts } from "openclaw/plugin-sdk/reply-payload";
|
|
@@ -23,15 +22,15 @@ import { danger, logVerbose, shouldLogVerbose, sleepWithAbort } from "openclaw/p
|
|
|
23
22
|
import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
24
23
|
import { resolveChunkMode } from "openclaw/plugin-sdk/reply-chunking";
|
|
25
24
|
import { resolveMarkdownTableMode } from "openclaw/plugin-sdk/markdown-table-runtime";
|
|
26
|
-
import {
|
|
27
|
-
import { bindIngressLifecycleToReplyOptions, createChannelMessageReplyPipeline, createChannelProgressDraftCompositor,
|
|
25
|
+
import { stripInlineDirectiveTagsForDelivery, stripReasoningTagsFromText } from "openclaw/plugin-sdk/text-chunking";
|
|
26
|
+
import { bindIngressLifecycleToReplyOptions, createChannelMessageReplyPipeline, createChannelProgressDraftCompositor, createFinalizableDraftLifecycle, createLivePreviewLifecycle, createTypingCallbacks, isRecentOutboundMessageIdentity, resolveChannelDraftStreamingChunking, resolveChannelMessageSourceReplyDeliveryMode, resolveChannelPreviewStreamMode, resolveChannelStreamingBlockEnabled, resolveChannelStreamingPreviewCommandText, resolveChannelStreamingProgressNarration, resolveTranscriptBackedChannelFinalText } from "openclaw/plugin-sdk/channel-outbound";
|
|
28
27
|
import { getAgentScopedMediaLocalRoots } from "openclaw/plugin-sdk/media-runtime";
|
|
29
|
-
import { buildChannelInboundEventContext, createCommandTurnContext, dispatchChannelInboundTurn, formatInboundEnvelope, formatInboundMediaUnavailableText, hasFinalInboundReplyDispatch, readAgentRunTerminalOutcome, resolveEnvelopeFormatOptions, toHistoryMediaEntries, toInboundMediaFactsWithMetadata } from "openclaw/plugin-sdk/channel-inbound";
|
|
28
|
+
import { buildChannelInboundEventContext, buildMentionRegexes, createCommandTurnContext, dispatchChannelInboundTurn, formatInboundEnvelope, formatInboundMediaUnavailableText, getGroupThreadDeliverySession, hasFinalInboundReplyDispatch, readAgentRunTerminalOutcome, resolveEnvelopeFormatOptions, toHistoryMediaEntries, toInboundMediaFactsWithMetadata } from "openclaw/plugin-sdk/channel-inbound";
|
|
30
29
|
import { evaluateSupplementalContextVisibility } from "openclaw/plugin-sdk/security-runtime";
|
|
31
30
|
import { resolvePinnedMainDmOwnerFromAllowlist } from "openclaw/plugin-sdk/conversation-runtime";
|
|
32
31
|
import { resolveAgentConfig } from "openclaw/plugin-sdk/agent-scope-runtime";
|
|
33
|
-
import { EmbeddedBlockChunker, resolveAckReaction, resolveAgentConfig as resolveAgentConfig$1, resolveHumanDelayConfig } from "openclaw/plugin-sdk/agent-runtime";
|
|
34
32
|
import { isDangerousNameMatchingEnabled } from "openclaw/plugin-sdk/dangerous-name-runtime";
|
|
33
|
+
import { EmbeddedBlockChunker, resolveAckReaction, resolveAgentConfig as resolveAgentConfig$1, resolveHumanDelayConfig } from "openclaw/plugin-sdk/agent-runtime";
|
|
35
34
|
import { getSessionEntry, readSessionUpdatedAt, resolveStorePath } from "openclaw/plugin-sdk/session-store-runtime";
|
|
36
35
|
import { getGlobalHookRunner } from "openclaw/plugin-sdk/plugin-runtime";
|
|
37
36
|
import { buildHistoryContextFromEntries, buildInboundHistoryFromEntries, createChannelHistoryWindow } from "openclaw/plugin-sdk/reply-history";
|
|
@@ -39,6 +38,127 @@ import { resolveChannelContextVisibilityMode } from "openclaw/plugin-sdk/context
|
|
|
39
38
|
import { formatAudioTranscriptForAgent } from "openclaw/plugin-sdk/media-understanding-runtime";
|
|
40
39
|
import { createStatusReactionController, logAckFailure, logTypingFailure, shouldAckReaction } from "openclaw/plugin-sdk/channel-feedback";
|
|
41
40
|
import { readLatestAssistantTextByIdentity } from "openclaw/plugin-sdk/session-transcript-runtime";
|
|
41
|
+
//#region extensions/discord/src/monitor/message-handler.recent-history.ts
|
|
42
|
+
/** Fetch a physical recent window, never walking older pages to refill filtered rows. */
|
|
43
|
+
async function recoverDiscordChannelHistory(params) {
|
|
44
|
+
const { ctx, isCurrent } = params;
|
|
45
|
+
if (ctx.historyLimit <= 0 || !isCurrent()) return [];
|
|
46
|
+
const excludedIds = /* @__PURE__ */ new Set([ctx.message.id, ...ctx.sourceMessageIds ?? []]);
|
|
47
|
+
if (ctx.canonicalMessageId) excludedIds.add(ctx.canonicalMessageId);
|
|
48
|
+
let remaining = ctx.historyLimit + excludedIds.size - 1;
|
|
49
|
+
let before = ctx.message.id;
|
|
50
|
+
const triggerTimestamp = resolveTimestampMs(ctx.message.timestamp);
|
|
51
|
+
const guildId = ctx.data.guild?.id ?? ctx.data.guild_id;
|
|
52
|
+
const cachedMedia = new Map((ctx.guildHistories.get(ctx.messageChannelId) ?? []).map((entry) => [entry.messageId, entry]));
|
|
53
|
+
const members = /* @__PURE__ */ new Map();
|
|
54
|
+
const roleAllowList = ctx.channelConfig?.roles ?? ctx.guildInfo?.roles ?? [];
|
|
55
|
+
const mentionRegexes = ctx.discordConfig?.allowBots === "mentions" ? buildMentionRegexes(ctx.cfg, ctx.route.agentId, {
|
|
56
|
+
provider: "discord",
|
|
57
|
+
conversationId: ctx.messageChannelId,
|
|
58
|
+
providerPolicy: ctx.discordConfig.mentionPatterns
|
|
59
|
+
}) : [];
|
|
60
|
+
const entries = [];
|
|
61
|
+
try {
|
|
62
|
+
while (remaining > 0 && isCurrent()) {
|
|
63
|
+
const limit = Math.min(100, remaining);
|
|
64
|
+
const page = await listChannelMessages(ctx.client.rest, ctx.messageChannelId, {
|
|
65
|
+
before,
|
|
66
|
+
limit
|
|
67
|
+
});
|
|
68
|
+
if (!isCurrent()) return [];
|
|
69
|
+
const window = page.slice(0, limit);
|
|
70
|
+
remaining -= window.length;
|
|
71
|
+
for (const raw of window) {
|
|
72
|
+
const row = raw;
|
|
73
|
+
const timestamp = resolveTimestampMs(row.timestamp);
|
|
74
|
+
if (row.channel_id !== ctx.messageChannelId || row.guild_id && row.guild_id !== guildId || excludedIds.has(row.id) || /^\d+$/u.test(row.id) && /^\d+$/u.test(ctx.message.id) && BigInt(row.id) >= BigInt(ctx.message.id) || timestamp === void 0 || triggerTimestamp !== void 0 && timestamp > triggerTimestamp || params.sessionStartedAt !== void 0 && timestamp < params.sessionStartedAt || row.type === discord_exports.MessageType.ChatInputCommand || row.type === discord_exports.MessageType.ContextMenuCommand || row.author.id === ctx.botUserId) continue;
|
|
75
|
+
excludedIds.add(row.id);
|
|
76
|
+
const message = new Message(ctx.client, row);
|
|
77
|
+
let body = resolveDiscordMessageHistoryText(message, { includeForwarded: true });
|
|
78
|
+
if (!body || isRecentOutboundMessageIdentity({
|
|
79
|
+
channel: "discord",
|
|
80
|
+
accountId: ctx.accountId,
|
|
81
|
+
conversationId: ctx.messageChannelId,
|
|
82
|
+
messageId: row.id,
|
|
83
|
+
...row.webhook_id ? { sourceId: row.webhook_id } : {}
|
|
84
|
+
}) || shouldIgnoreBoundThreadWebhookMessage({
|
|
85
|
+
threadId: ctx.messageChannelId,
|
|
86
|
+
webhookId: message.webhookId,
|
|
87
|
+
threadBinding: ctx.threadBinding
|
|
88
|
+
}) || isBoundThreadBotSystemMessage({
|
|
89
|
+
isBoundThreadSession: Boolean(ctx.threadBinding && ctx.threadChannel),
|
|
90
|
+
isBotAuthor: Boolean(row.author.bot),
|
|
91
|
+
text: body
|
|
92
|
+
})) continue;
|
|
93
|
+
const needsPluralKitLookup = Boolean(ctx.discordConfig?.pluralkit?.enabled && message.webhookId);
|
|
94
|
+
const pluralkitInfo = needsPluralKitLookup ? await resolveDiscordPreflightPluralKitInfo({
|
|
95
|
+
message,
|
|
96
|
+
webhookId: message.webhookId,
|
|
97
|
+
config: ctx.discordConfig?.pluralkit,
|
|
98
|
+
abortSignal: ctx.abortSignal
|
|
99
|
+
}) : null;
|
|
100
|
+
if (needsPluralKitLookup && !isCurrent()) return [];
|
|
101
|
+
const sender = resolveDiscordSenderIdentity({
|
|
102
|
+
author: message.author,
|
|
103
|
+
member: row.member,
|
|
104
|
+
pluralkitInfo
|
|
105
|
+
});
|
|
106
|
+
if (row.author.bot && !sender.isPluralKit) {
|
|
107
|
+
const allowBots = ctx.discordConfig?.allowBots;
|
|
108
|
+
if (!allowBots) continue;
|
|
109
|
+
if (allowBots === "mentions") {
|
|
110
|
+
const documents = resolveDiscordMessageMentionDocuments(message);
|
|
111
|
+
if (!(row.mentions.some((user) => user.id === ctx.botUserId) && (row.type !== discord_exports.MessageType.Reply || documents.some((text) => hasRawDiscordUserMention(text, ctx.botUserId)))) && !documents.some((text) => matchesActiveDiscordMentionPatterns(text, mentionRegexes))) continue;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
let member = row.member;
|
|
115
|
+
if (params.mode !== "all" && roleAllowList.length > 0 && !member && guildId && !params.isSenderAllowed({
|
|
116
|
+
...sender,
|
|
117
|
+
memberRoleIds: []
|
|
118
|
+
})) {
|
|
119
|
+
member = members.get(row.author.id);
|
|
120
|
+
if (!member) {
|
|
121
|
+
member = await getGuildMember(ctx.client.rest, guildId, row.author.id);
|
|
122
|
+
if (!isCurrent()) return [];
|
|
123
|
+
members.set(row.author.id, member);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
const senderProvenance = createDiscordHistorySenderProvenance({
|
|
127
|
+
sender,
|
|
128
|
+
memberRoleIds: member?.roles ?? []
|
|
129
|
+
});
|
|
130
|
+
const mediaIds = resolveDiscordHistoryMediaIds(message);
|
|
131
|
+
const cached = cachedMedia.get(row.id);
|
|
132
|
+
const media = mediaIds.length > 0 && cached?.mediaIds?.length === mediaIds.length && cached.mediaIds.every((id, index) => id === mediaIds[index]) ? cached.media : void 0;
|
|
133
|
+
if (mediaIds.length > (media?.length ?? 0)) body = formatInboundMediaUnavailableText({
|
|
134
|
+
body,
|
|
135
|
+
notice: "[discord historical attachment unavailable]"
|
|
136
|
+
});
|
|
137
|
+
entries.push({
|
|
138
|
+
sender: sender.label,
|
|
139
|
+
body,
|
|
140
|
+
timestamp,
|
|
141
|
+
messageId: row.id,
|
|
142
|
+
senderProvenance,
|
|
143
|
+
...media?.length ? { media } : {}
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
const nextBefore = window.at(-1)?.id;
|
|
147
|
+
if (window.length < limit || !nextBefore || nextBefore === before || /^\d+$/u.test(nextBefore) && /^\d+$/u.test(before) && BigInt(nextBefore) >= BigInt(before)) break;
|
|
148
|
+
before = nextBefore;
|
|
149
|
+
}
|
|
150
|
+
if (!isCurrent()) return [];
|
|
151
|
+
return filterDiscordHistoryEntriesForContext({
|
|
152
|
+
entries: entries.toReversed(),
|
|
153
|
+
mode: params.mode,
|
|
154
|
+
isSenderAllowed: params.isSenderAllowed
|
|
155
|
+
}).entries.slice(-ctx.historyLimit);
|
|
156
|
+
} catch (error) {
|
|
157
|
+
ctx.runtime.error(danger(`discord: recent history omitted for ${ctx.messageChannelId}: ${String(error)}`));
|
|
158
|
+
return [];
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
//#endregion
|
|
42
162
|
//#region extensions/discord/src/monitor/message-handler.retry.ts
|
|
43
163
|
const REPLY_SESSION_INIT_CONFLICT_MESSAGE_RE = /^reply session initialization conflicted for \S+$/u;
|
|
44
164
|
const DISCORD_SESSION_CONFLICT_FAILURE_TEXT = "⚠️ Couldn't process this message because the session stayed busy. Please try again in a moment.";
|
|
@@ -74,6 +194,7 @@ function normalizeDiscordDmOwnerEntry(entry) {
|
|
|
74
194
|
async function buildDiscordMessageProcessContext(params) {
|
|
75
195
|
const { ctx, text, mediaList } = params;
|
|
76
196
|
const { cfg, discordConfig, accountId, runtime, botUserId, mediaMaxBytes, discordRestFetch, abortSignal, guildHistories, historyLimit, replyToMode, message, author, sender, canonicalMessageId, data, client, channelInfo, channelName, messageChannelId, isGuildMessage, isDirectMessage, isGroupDm, baseText, preflightAudioTranscript, threadChannel, threadParentId, threadParentName, threadParentType, threadName, displayChannelSlug, guildInfo, guildSlug, memberRoleIds, channelConfig, baseSessionKey, boundSessionKey, route, commandAuthorized, hasControlCommand, resolveChannelIngress } = ctx;
|
|
197
|
+
if (abortSignal?.aborted || ctx.isPolicyCurrent?.() === false) return null;
|
|
77
198
|
const fromLabel = isDirectMessage ? buildDirectLabel(author) : buildGuildLabel({
|
|
78
199
|
guild: data.guild ?? void 0,
|
|
79
200
|
channelName: channelName ?? messageChannelId,
|
|
@@ -119,10 +240,28 @@ async function buildDiscordMessageProcessContext(params) {
|
|
|
119
240
|
});
|
|
120
241
|
const storePath = resolveStorePath(cfg.session?.store, { agentId: route.agentId });
|
|
121
242
|
const envelopeOptions = resolveEnvelopeFormatOptions(cfg);
|
|
122
|
-
const
|
|
243
|
+
const routeSession = getSessionEntry({
|
|
244
|
+
agentId: route.agentId,
|
|
123
245
|
storePath,
|
|
124
|
-
sessionKey: route.sessionKey
|
|
246
|
+
sessionKey: route.sessionKey,
|
|
247
|
+
readConsistency: "latest"
|
|
125
248
|
});
|
|
249
|
+
const previousTimestamp = routeSession?.updatedAt;
|
|
250
|
+
const shouldIncludeChannelHistory = !isDirectMessage && (ctx.inboundEventKind === "room_event" || !(isGuildMessage && channelConfig?.autoThread && !threadChannel));
|
|
251
|
+
const recoversHistory = shouldIncludeChannelHistory && isGuildMessage && historyLimit > 0;
|
|
252
|
+
const historySessionScope = {
|
|
253
|
+
agentId: route.agentId,
|
|
254
|
+
storePath,
|
|
255
|
+
sessionKey: boundSessionKey ?? route.sessionKey,
|
|
256
|
+
readConsistency: "latest"
|
|
257
|
+
};
|
|
258
|
+
const historySession = recoversHistory ? historySessionScope.sessionKey === route.sessionKey ? routeSession : getSessionEntry(historySessionScope) : void 0;
|
|
259
|
+
const isHistoryCurrent = () => {
|
|
260
|
+
if (abortSignal?.aborted || ctx.isPolicyCurrent?.() === false) return false;
|
|
261
|
+
if (!recoversHistory) return true;
|
|
262
|
+
const current = getSessionEntry(historySessionScope);
|
|
263
|
+
return current?.sessionId === historySession?.sessionId && current?.lifecycleRevision === historySession?.lifecycleRevision && current?.sessionStartedAt === historySession?.sessionStartedAt && current?.updatedAt === 0 === (historySession?.updatedAt === 0);
|
|
264
|
+
};
|
|
126
265
|
const channelHistory = createChannelHistoryWindow({ historyMap: guildHistories });
|
|
127
266
|
let visibleChannelHistory;
|
|
128
267
|
const unavailableMediaCount = mediaList.filter((media) => !media.path).length;
|
|
@@ -142,20 +281,26 @@ async function buildDiscordMessageProcessContext(params) {
|
|
|
142
281
|
previousTimestamp,
|
|
143
282
|
envelope: envelopeOptions
|
|
144
283
|
});
|
|
145
|
-
const shouldIncludeChannelHistory = !isDirectMessage && (ctx.inboundEventKind === "room_event" || !(isGuildMessage && channelConfig?.autoThread && !threadChannel));
|
|
146
284
|
if (shouldIncludeChannelHistory) {
|
|
147
285
|
removeDiscordReplayHistoryEntry(guildHistories, messageChannelId, message.id);
|
|
148
286
|
if (historyLimit > 0) {
|
|
149
|
-
|
|
150
|
-
|
|
287
|
+
if (isGuildMessage) visibleChannelHistory = historySession?.updatedAt === 0 ? [] : await recoverDiscordChannelHistory({
|
|
288
|
+
ctx,
|
|
289
|
+
sessionStartedAt: historySession?.sessionStartedAt,
|
|
290
|
+
isCurrent: isHistoryCurrent,
|
|
151
291
|
mode: contextVisibilityMode,
|
|
152
292
|
isSenderAllowed: isSupplementalContextSenderAllowed
|
|
153
293
|
});
|
|
154
|
-
visibleChannelHistory =
|
|
155
|
-
|
|
294
|
+
else visibleChannelHistory = filterDiscordHistoryEntriesForContext({
|
|
295
|
+
entries: guildHistories.get(messageChannelId) ?? [],
|
|
296
|
+
mode: contextVisibilityMode,
|
|
297
|
+
isSenderAllowed: isSupplementalContextSenderAllowed
|
|
298
|
+
}).entries.slice(-historyLimit);
|
|
299
|
+
if (!isHistoryCurrent()) return null;
|
|
156
300
|
combinedBody = buildHistoryContextFromEntries({
|
|
157
301
|
entries: visibleChannelHistory,
|
|
158
302
|
currentMessage: combinedBody,
|
|
303
|
+
historyKind: isGuildMessage ? "recent" : "pending",
|
|
159
304
|
formatEntry: (entry) => formatInboundEnvelope({
|
|
160
305
|
channel: "Discord",
|
|
161
306
|
from: fromLabel,
|
|
@@ -176,12 +321,6 @@ async function buildDiscordMessageProcessContext(params) {
|
|
|
176
321
|
tag: replyContext.senderTag,
|
|
177
322
|
memberRoleIds: replyContext.memberRoleIds
|
|
178
323
|
}) : true;
|
|
179
|
-
const replyVisible = evaluateSupplementalContextVisibility({
|
|
180
|
-
mode: contextVisibilityMode,
|
|
181
|
-
kind: "quote",
|
|
182
|
-
senderAllowed: replySenderAllowed
|
|
183
|
-
}).include;
|
|
184
|
-
if (replyContext && !replyVisible && isGuildMessage) logVerbose(`discord: drop reply context (mode=${contextVisibilityMode})`);
|
|
185
324
|
if (forumContextLine) combinedBody = `${combinedBody}\n${forumContextLine}`;
|
|
186
325
|
let threadStarterBody;
|
|
187
326
|
let threadLabel;
|
|
@@ -197,6 +336,7 @@ async function buildDiscordMessageProcessContext(params) {
|
|
|
197
336
|
parentType: threadParentType,
|
|
198
337
|
resolveTimestampMs
|
|
199
338
|
});
|
|
339
|
+
if (!isHistoryCurrent()) return null;
|
|
200
340
|
if (starter?.text) {
|
|
201
341
|
if (evaluateSupplementalContextVisibility({
|
|
202
342
|
mode: contextVisibilityMode,
|
|
@@ -235,6 +375,7 @@ async function buildDiscordMessageProcessContext(params) {
|
|
|
235
375
|
parentSessionKey,
|
|
236
376
|
useSuffix: false
|
|
237
377
|
});
|
|
378
|
+
if (!isHistoryCurrent()) return null;
|
|
238
379
|
const replyPlan = await resolveDiscordAutoThreadReplyPlan({
|
|
239
380
|
client,
|
|
240
381
|
message,
|
|
@@ -255,6 +396,7 @@ async function buildDiscordMessageProcessContext(params) {
|
|
|
255
396
|
groupScope: route.groupScope,
|
|
256
397
|
threadParentInheritanceEnabled
|
|
257
398
|
});
|
|
399
|
+
if (!isHistoryCurrent()) return null;
|
|
258
400
|
const deliverTarget = replyPlan.deliverTarget;
|
|
259
401
|
const replyTarget = replyPlan.replyTarget;
|
|
260
402
|
const replyReference = replyPlan.replyReference;
|
|
@@ -284,16 +426,19 @@ async function buildDiscordMessageProcessContext(params) {
|
|
|
284
426
|
const channelIngress = await resolveChannelIngress({
|
|
285
427
|
agentId: route.agentId,
|
|
286
428
|
sessionKey: effectiveSessionKey,
|
|
429
|
+
nativeChannelId: messageChannelId,
|
|
287
430
|
messageId: canonicalMessageId ?? message.id,
|
|
288
431
|
inboundEventKind: ctx.inboundEventKind
|
|
289
432
|
}, {
|
|
290
433
|
parentId: conversationParentId,
|
|
291
434
|
threadId: threadChannel?.id ?? autoThreadContext?.createdThreadId ?? void 0
|
|
292
435
|
});
|
|
436
|
+
if (!isHistoryCurrent()) return null;
|
|
293
437
|
const ctxPayload = await (ctx.buildContext ?? buildChannelInboundEventContext)({
|
|
294
438
|
channelIngress,
|
|
295
439
|
channel: "discord",
|
|
296
440
|
resolveSupplementalMedia: true,
|
|
441
|
+
suppressSelfQuoteBody: false,
|
|
297
442
|
contextVisibility: contextVisibilityMode,
|
|
298
443
|
accountId: route.accountId,
|
|
299
444
|
messageId: canonicalMessageId ?? message.id,
|
|
@@ -326,9 +471,7 @@ async function buildDiscordMessageProcessContext(params) {
|
|
|
326
471
|
threadId: threadChannel?.id ?? autoThreadContext?.createdThreadId ?? void 0
|
|
327
472
|
},
|
|
328
473
|
route: {
|
|
329
|
-
|
|
330
|
-
dmScope: route.dmScope,
|
|
331
|
-
accountId: route.accountId,
|
|
474
|
+
...route,
|
|
332
475
|
routeSessionKey: route.sessionKey,
|
|
333
476
|
dispatchSessionKey: effectiveSessionKey,
|
|
334
477
|
parentSessionKey: autoThreadContext?.ParentSessionKey ?? threadKeys.parentSessionKey,
|
|
@@ -346,7 +489,10 @@ async function buildDiscordMessageProcessContext(params) {
|
|
|
346
489
|
commandBody: baseText,
|
|
347
490
|
inboundHistory
|
|
348
491
|
},
|
|
349
|
-
sessionTranscript: {
|
|
492
|
+
sessionTranscript: {
|
|
493
|
+
historyLimit: shouldIncludeChannelHistory ? historyLimit : 0,
|
|
494
|
+
historyKind: isGuildMessage ? "recent" : "pending"
|
|
495
|
+
},
|
|
350
496
|
access: {
|
|
351
497
|
mentions: {
|
|
352
498
|
canDetectMention: ctx.canDetectMention,
|
|
@@ -363,7 +509,7 @@ async function buildDiscordMessageProcessContext(params) {
|
|
|
363
509
|
}),
|
|
364
510
|
media: await toInboundMediaFactsWithMetadata(mediaList, { transcribed: (_media, index) => index === preflightAudioIndex }),
|
|
365
511
|
supplemental: {
|
|
366
|
-
quote: replyContext
|
|
512
|
+
quote: replyContext ? {
|
|
367
513
|
id: replyContext.id,
|
|
368
514
|
body: replyContext.body,
|
|
369
515
|
sender: replyContext.sender,
|
|
@@ -388,6 +534,7 @@ async function buildDiscordMessageProcessContext(params) {
|
|
|
388
534
|
groupSystemPrompt: isGuildMessage ? groupSystemPrompt : void 0
|
|
389
535
|
},
|
|
390
536
|
extra: {
|
|
537
|
+
GroupThread: ctx.groupThread,
|
|
391
538
|
...preflightAudioTranscript !== void 0 ? { Transcript: preflightAudioTranscript } : {},
|
|
392
539
|
GroupSubject: isDirectMessage ? void 0 : groupChannel,
|
|
393
540
|
GroupChannel: groupChannel,
|
|
@@ -396,6 +543,7 @@ async function buildDiscordMessageProcessContext(params) {
|
|
|
396
543
|
OwnerAllowFrom: ownerAllowFrom
|
|
397
544
|
}
|
|
398
545
|
});
|
|
546
|
+
if (!isHistoryCurrent()) return null;
|
|
399
547
|
const persistedSessionKey = ctxPayload.SessionKey ?? route.sessionKey;
|
|
400
548
|
if (ctx.inboundEventKind === "room_event" && shouldIncludeChannelHistory) {
|
|
401
549
|
const historyText = [text, formatDiscordMediaText({
|
|
@@ -410,6 +558,7 @@ async function buildDiscordMessageProcessContext(params) {
|
|
|
410
558
|
body: historyText,
|
|
411
559
|
timestamp: resolveTimestampMs(message.timestamp),
|
|
412
560
|
messageId: message.id,
|
|
561
|
+
mediaIds: resolveDiscordHistoryMediaIds(message),
|
|
413
562
|
senderProvenance: createDiscordHistorySenderProvenance({
|
|
414
563
|
sender,
|
|
415
564
|
memberRoleIds
|
|
@@ -523,25 +672,19 @@ function createDiscordMessageProgressRuntime(params) {
|
|
|
523
672
|
return await draftPreview.pushToolEvent(payload);
|
|
524
673
|
},
|
|
525
674
|
onItemEvent: async (payload) => {
|
|
526
|
-
if (payload.kind === "preamble")
|
|
527
|
-
if (shouldYieldDraftCommentary()) return;
|
|
528
|
-
return await draftPreview.pushPreambleItemEvent(payload);
|
|
529
|
-
}
|
|
675
|
+
if (payload.kind === "preamble" && shouldYieldDraftCommentary()) return;
|
|
530
676
|
return await draftPreview.pushItemEvent(payload);
|
|
531
677
|
},
|
|
532
678
|
onPlanUpdate: async (payload) => {
|
|
533
|
-
if (payload.phase === "update") return await draftPreview.pushPlanProgress(payload.steps, {
|
|
679
|
+
if (payload.phase === "update") return await draftPreview.pushPlanProgress(payload.steps, {
|
|
680
|
+
explanation: payload.explanation,
|
|
681
|
+
explanationFormat: payload.explanationFormat
|
|
682
|
+
});
|
|
534
683
|
return false;
|
|
535
684
|
},
|
|
536
685
|
onApprovalEvent: async (payload) => {
|
|
537
686
|
return await draftPreview.pushApprovalEvent(payload);
|
|
538
687
|
},
|
|
539
|
-
onCommandOutput: async (payload) => {
|
|
540
|
-
return await draftPreview.pushCommandOutputEvent(payload);
|
|
541
|
-
},
|
|
542
|
-
onPatchSummary: async (payload) => {
|
|
543
|
-
return await draftPreview.pushPatchEvent(payload);
|
|
544
|
-
},
|
|
545
688
|
onCompactionStart: async () => {
|
|
546
689
|
if (!abortSignal?.aborted) await params.reactions.controller.setCompacting();
|
|
547
690
|
return false;
|
|
@@ -772,14 +915,14 @@ function createDiscordDraftStream(params) {
|
|
|
772
915
|
stopped: false,
|
|
773
916
|
final: false
|
|
774
917
|
};
|
|
775
|
-
let
|
|
918
|
+
let streamMessage;
|
|
776
919
|
let lastSentText = "";
|
|
777
920
|
let streamGeneration = 0;
|
|
778
921
|
let activeCreateGeneration;
|
|
779
922
|
let discardActiveCreate = false;
|
|
780
|
-
let pendingCleanupMessages = [];
|
|
781
923
|
const sendOrEditStreamMessage = async ({ text, complete }) => {
|
|
782
924
|
const generation = streamGeneration;
|
|
925
|
+
const targetChannelId = channelId;
|
|
783
926
|
if (streamState.stopped && !streamState.final) return false;
|
|
784
927
|
const trimmed = text.trimEnd();
|
|
785
928
|
if (!trimmed) return false;
|
|
@@ -789,17 +932,17 @@ function createDiscordDraftStream(params) {
|
|
|
789
932
|
return false;
|
|
790
933
|
}
|
|
791
934
|
if (trimmed === lastSentText) return true;
|
|
792
|
-
if (
|
|
935
|
+
if (streamMessage === void 0 && minInitialChars != null && !streamState.final && !complete) {
|
|
793
936
|
if (trimmed.length < minInitialChars) return false;
|
|
794
937
|
}
|
|
795
|
-
lastSentText = trimmed;
|
|
796
938
|
try {
|
|
797
|
-
if (
|
|
798
|
-
await editChannelMessage(rest, channelId,
|
|
939
|
+
if (streamMessage !== void 0) {
|
|
940
|
+
await editChannelMessage(rest, streamMessage.channelId, streamMessage.messageId, { body: {
|
|
799
941
|
content: trimmed,
|
|
800
942
|
allowed_mentions: DISCORD_PREVIEW_ALLOWED_MENTIONS,
|
|
801
943
|
...flags ? { flags } : {}
|
|
802
944
|
} });
|
|
945
|
+
if (generation === streamGeneration) lastSentText = trimmed;
|
|
803
946
|
return true;
|
|
804
947
|
}
|
|
805
948
|
const replyToMessageId = resolveReplyToMessageId()?.trim();
|
|
@@ -808,7 +951,7 @@ function createDiscordDraftStream(params) {
|
|
|
808
951
|
fail_if_not_exists: false
|
|
809
952
|
} : void 0;
|
|
810
953
|
activeCreateGeneration = generation;
|
|
811
|
-
const sentMessageId = (await createChannelMessage(rest,
|
|
954
|
+
const sentMessageId = (await createChannelMessage(rest, targetChannelId, { body: {
|
|
812
955
|
content: trimmed,
|
|
813
956
|
allowed_mentions: DISCORD_PREVIEW_ALLOWED_MENTIONS,
|
|
814
957
|
...flags ? { flags } : {},
|
|
@@ -818,10 +961,9 @@ function createDiscordDraftStream(params) {
|
|
|
818
961
|
activeCreateGeneration = void 0;
|
|
819
962
|
discardActiveCreate = false;
|
|
820
963
|
if (generation !== streamGeneration) {
|
|
821
|
-
if (shouldDiscardStaleCreate && typeof sentMessageId === "string" && sentMessageId) await
|
|
822
|
-
channelId,
|
|
823
|
-
messageId: sentMessageId
|
|
824
|
-
warnPrefix: "discord stale stream preview cleanup failed"
|
|
964
|
+
if (shouldDiscardStaleCreate && typeof sentMessageId === "string" && sentMessageId) await lifecycle.retire({
|
|
965
|
+
channelId: targetChannelId,
|
|
966
|
+
messageId: sentMessageId
|
|
825
967
|
});
|
|
826
968
|
return true;
|
|
827
969
|
}
|
|
@@ -830,7 +972,11 @@ function createDiscordDraftStream(params) {
|
|
|
830
972
|
params.warn?.("discord stream preview stopped (missing message id from send)");
|
|
831
973
|
return false;
|
|
832
974
|
}
|
|
833
|
-
|
|
975
|
+
streamMessage = {
|
|
976
|
+
channelId: targetChannelId,
|
|
977
|
+
messageId: sentMessageId
|
|
978
|
+
};
|
|
979
|
+
lastSentText = trimmed;
|
|
834
980
|
return true;
|
|
835
981
|
} catch (err) {
|
|
836
982
|
if (activeCreateGeneration === generation) {
|
|
@@ -843,7 +989,12 @@ function createDiscordDraftStream(params) {
|
|
|
843
989
|
return false;
|
|
844
990
|
}
|
|
845
991
|
};
|
|
846
|
-
const
|
|
992
|
+
const clearMessageId = () => {
|
|
993
|
+
streamMessage = void 0;
|
|
994
|
+
lastSentText = "";
|
|
995
|
+
loop.resetThrottleWindow();
|
|
996
|
+
};
|
|
997
|
+
const lifecycle = createFinalizableDraftLifecycle({
|
|
847
998
|
throttleMs,
|
|
848
999
|
coalesceInFlight: true,
|
|
849
1000
|
state: streamState,
|
|
@@ -852,8 +1003,15 @@ function createDiscordDraftStream(params) {
|
|
|
852
1003
|
text: "",
|
|
853
1004
|
complete: false
|
|
854
1005
|
},
|
|
855
|
-
isEmpty: (value) => !value.text
|
|
1006
|
+
isEmpty: (value) => !value.text,
|
|
1007
|
+
readMessageId: () => streamMessage,
|
|
1008
|
+
clearMessageId,
|
|
1009
|
+
isValidMessageId: (value) => value !== void 0,
|
|
1010
|
+
deleteMessage: (message) => deleteChannelMessage(rest, message.channelId, message.messageId),
|
|
1011
|
+
warn: params.warn,
|
|
1012
|
+
warnPrefix: "discord stream preview cleanup failed"
|
|
856
1013
|
});
|
|
1014
|
+
const { loop, update: updateDraft, stop, discardPending, seal } = lifecycle;
|
|
857
1015
|
const update = (text, options) => updateDraft({
|
|
858
1016
|
text,
|
|
859
1017
|
complete: options?.complete === true
|
|
@@ -863,35 +1021,21 @@ function createDiscordDraftStream(params) {
|
|
|
863
1021
|
streamGeneration += 1;
|
|
864
1022
|
streamState.stopped = false;
|
|
865
1023
|
streamState.final = false;
|
|
866
|
-
|
|
1024
|
+
streamMessage = void 0;
|
|
867
1025
|
lastSentText = "";
|
|
868
1026
|
loop.resetPending();
|
|
869
1027
|
loop.resetThrottleWindow();
|
|
870
1028
|
};
|
|
871
|
-
const deleteCleanupMessage = async (message) => {
|
|
872
|
-
try {
|
|
873
|
-
await deleteChannelMessage(rest, message.channelId, message.messageId);
|
|
874
|
-
} catch (err) {
|
|
875
|
-
pendingCleanupMessages.push(message);
|
|
876
|
-
params.warn?.(`${message.warnPrefix}: ${formatErrorMessage(err)}`);
|
|
877
|
-
}
|
|
878
|
-
};
|
|
879
|
-
const cleanupPendingMessages = async () => {
|
|
880
|
-
const pending = pendingCleanupMessages;
|
|
881
|
-
pendingCleanupMessages = [];
|
|
882
|
-
for (const message of pending) await deleteCleanupMessage(message);
|
|
883
|
-
};
|
|
884
1029
|
const retarget = async (nextChannelId) => {
|
|
885
1030
|
const normalized = nextChannelId.trim();
|
|
886
1031
|
if (!normalized || normalized === channelId) return;
|
|
887
1032
|
await loop.waitForInFlight();
|
|
888
1033
|
const pending = loop.takePending();
|
|
889
|
-
const
|
|
890
|
-
const previousMessageId = streamMessageId;
|
|
1034
|
+
const previousMessage = streamMessage;
|
|
891
1035
|
const previousText = pending.text || lastSentText;
|
|
892
1036
|
streamGeneration += 1;
|
|
893
1037
|
channelId = normalized;
|
|
894
|
-
|
|
1038
|
+
streamMessage = void 0;
|
|
895
1039
|
lastSentText = "";
|
|
896
1040
|
streamState.stopped = false;
|
|
897
1041
|
streamState.final = false;
|
|
@@ -900,49 +1044,40 @@ function createDiscordDraftStream(params) {
|
|
|
900
1044
|
update(previousText, { complete: pending.text ? pending.complete : true });
|
|
901
1045
|
await loop.flush();
|
|
902
1046
|
}
|
|
903
|
-
if (
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
messageId: previousMessageId,
|
|
907
|
-
warnPrefix: "discord stream preview retarget cleanup failed"
|
|
908
|
-
};
|
|
909
|
-
if (!streamMessageId) {
|
|
910
|
-
pendingCleanupMessages.push(stale);
|
|
1047
|
+
if (previousMessage) {
|
|
1048
|
+
if (!streamMessage) {
|
|
1049
|
+
await lifecycle.retire(previousMessage, { defer: true });
|
|
911
1050
|
throw new Error("discord stream preview retarget replacement failed");
|
|
912
1051
|
}
|
|
913
|
-
await
|
|
1052
|
+
await lifecycle.retire(previousMessage);
|
|
914
1053
|
}
|
|
915
1054
|
};
|
|
916
|
-
const
|
|
917
|
-
|
|
918
|
-
await
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
} : void 0;
|
|
924
|
-
streamMessageId = void 0;
|
|
925
|
-
lastSentText = "";
|
|
926
|
-
loop.resetThrottleWindow();
|
|
927
|
-
if (!currentMessage) return;
|
|
928
|
-
await deleteCleanupMessage(currentMessage);
|
|
929
|
-
};
|
|
930
|
-
const clear = async () => {
|
|
931
|
-
await discardPending();
|
|
932
|
-
await deleteCurrentMessage();
|
|
1055
|
+
const retireCurrentMessage = async (stopForClear) => {
|
|
1056
|
+
const generation = streamGeneration;
|
|
1057
|
+
await stopForClear();
|
|
1058
|
+
if (generation !== streamGeneration) return;
|
|
1059
|
+
const message = streamMessage;
|
|
1060
|
+
clearMessageId();
|
|
1061
|
+
if (message) await lifecycle.retire(message);
|
|
933
1062
|
};
|
|
934
1063
|
params.log?.(`discord stream preview ready (maxChars=${maxChars}, throttleMs=${throttleMs})`);
|
|
935
1064
|
return {
|
|
936
1065
|
update,
|
|
937
1066
|
flush: loop.flush,
|
|
938
|
-
messageId: () =>
|
|
939
|
-
|
|
940
|
-
|
|
1067
|
+
messageId: () => streamMessage?.messageId,
|
|
1068
|
+
lastDeliveredText: () => lastSentText,
|
|
1069
|
+
clear: () => retireCurrentMessage(discardPending),
|
|
1070
|
+
deleteCurrentMessage: () => retireCurrentMessage(async () => {
|
|
1071
|
+
loop.resetPending();
|
|
1072
|
+
await loop.waitForInFlight();
|
|
1073
|
+
}),
|
|
941
1074
|
discardPending,
|
|
942
1075
|
seal,
|
|
943
1076
|
stop,
|
|
944
1077
|
retarget,
|
|
945
|
-
cleanupPendingMessages
|
|
1078
|
+
cleanupPendingMessages: async () => {
|
|
1079
|
+
await lifecycle.cleanupPending();
|
|
1080
|
+
},
|
|
946
1081
|
forceNewMessage
|
|
947
1082
|
};
|
|
948
1083
|
}
|
|
@@ -956,7 +1091,7 @@ function resolveDiscordPreviewStreamMode(params = {}) {
|
|
|
956
1091
|
function createDiscordDraftPreviewController(params) {
|
|
957
1092
|
const discordStreamMode = resolveDiscordPreviewStreamMode(params.discordConfig);
|
|
958
1093
|
const hookRunner = getGlobalHookRunner();
|
|
959
|
-
const allowProviderPreview = !((hookRunner?.hasHooks("reply_payload_sending") ?? false) || (hookRunner?.hasHooks("message_sending") ?? false));
|
|
1094
|
+
const allowProviderPreview = !params.groupThread && !((hookRunner?.hasHooks("reply_payload_sending") ?? false) || (hookRunner?.hasHooks("message_sending") ?? false));
|
|
960
1095
|
const draftMaxChars = Math.min(params.textLimit, 2e3);
|
|
961
1096
|
const canStreamProgressDraftForToolOnlySource = params.sourceRepliesAreToolOnly && discordStreamMode === "progress";
|
|
962
1097
|
const previewAvailable = allowProviderPreview && (!params.sourceRepliesAreToolOnly || canStreamProgressDraftForToolOnlySource) && discordStreamMode !== "off";
|
|
@@ -981,15 +1116,12 @@ function createDiscordDraftPreviewController(params) {
|
|
|
981
1116
|
let lastPartialText = "";
|
|
982
1117
|
let draftText = "";
|
|
983
1118
|
let hasStreamedAssistantText = false;
|
|
984
|
-
let finalizedViaPreviewMessage = false;
|
|
985
|
-
let finalReplyError;
|
|
986
|
-
let progressDraftStartedBeforeFinal = false;
|
|
987
|
-
let progressDraftCollapsed = false;
|
|
988
1119
|
let progressNarratorLifecycle;
|
|
989
1120
|
const narrationProgressEnabled = Boolean(draftStream) && discordStreamMode === "progress" && resolveChannelStreamingProgressNarration(params.discordConfig);
|
|
990
1121
|
const narrationHideCommandText = narrationProgressEnabled && resolveChannelStreamingPreviewCommandText(params.discordConfig) === "status";
|
|
991
1122
|
const progressSeed = `${params.accountId}:${params.deliverChannelId}`;
|
|
992
1123
|
const progressDraft = createChannelProgressDraftCompositor({
|
|
1124
|
+
preparedItems: true,
|
|
993
1125
|
entry: params.discordConfig,
|
|
994
1126
|
mode: discordStreamMode,
|
|
995
1127
|
active: Boolean(draftStream),
|
|
@@ -1015,6 +1147,44 @@ function createDiscordDraftPreviewController(params) {
|
|
|
1015
1147
|
isEmptyLine: isEmptyDiscordProgressLine,
|
|
1016
1148
|
shouldStartNow: shouldStartDiscordProgressDraftNow
|
|
1017
1149
|
});
|
|
1150
|
+
const freezeProgress = () => {
|
|
1151
|
+
progressDraft.markFinalReplyStarted();
|
|
1152
|
+
progressNarratorLifecycle?.stopTurn();
|
|
1153
|
+
};
|
|
1154
|
+
const flush = async () => {
|
|
1155
|
+
if (!draftStream) return;
|
|
1156
|
+
if (draftChunker?.hasBuffered()) {
|
|
1157
|
+
draftChunker.drain({
|
|
1158
|
+
force: true,
|
|
1159
|
+
emit: (chunk) => {
|
|
1160
|
+
draftText += chunk;
|
|
1161
|
+
}
|
|
1162
|
+
});
|
|
1163
|
+
draftChunker.reset();
|
|
1164
|
+
if (draftText) draftStream.update(draftText);
|
|
1165
|
+
}
|
|
1166
|
+
await draftStream.flush();
|
|
1167
|
+
};
|
|
1168
|
+
const lifecycle = createLivePreviewLifecycle({
|
|
1169
|
+
draft: draftStream ? {
|
|
1170
|
+
flush,
|
|
1171
|
+
id: draftStream.messageId,
|
|
1172
|
+
seal: draftStream.seal,
|
|
1173
|
+
discardPending: draftStream.discardPending,
|
|
1174
|
+
clear: draftStream.clear
|
|
1175
|
+
} : void 0,
|
|
1176
|
+
retainOnError: true,
|
|
1177
|
+
cleanupUndelivered: true,
|
|
1178
|
+
onFinalStarted: () => {
|
|
1179
|
+
freezeProgress();
|
|
1180
|
+
params.onFinalReplyStart?.();
|
|
1181
|
+
},
|
|
1182
|
+
onFinalDelivered: () => {
|
|
1183
|
+
progressDraft.markFinalReplyDelivered();
|
|
1184
|
+
params.onFinalReplyDelivered?.();
|
|
1185
|
+
},
|
|
1186
|
+
onCleanupFailure: (err) => params.log(`discord: draft cleanup failed: ${String(err)}`)
|
|
1187
|
+
});
|
|
1018
1188
|
const resetProgressState = () => {
|
|
1019
1189
|
lastPartialText = "";
|
|
1020
1190
|
draftText = "";
|
|
@@ -1032,10 +1202,7 @@ function createDiscordDraftPreviewController(params) {
|
|
|
1032
1202
|
const beganNewTurn = progressDraft.beginNewTurn(options);
|
|
1033
1203
|
if (!beganNewTurn) progressDraft.beginAssistantMessage();
|
|
1034
1204
|
if (beganNewTurn) {
|
|
1035
|
-
|
|
1036
|
-
progressDraftStartedBeforeFinal = false;
|
|
1037
|
-
finalReplyError = void 0;
|
|
1038
|
-
finalizedViaPreviewMessage = false;
|
|
1205
|
+
lifecycle.reset();
|
|
1039
1206
|
progressNarratorLifecycle?.beginTurn();
|
|
1040
1207
|
}
|
|
1041
1208
|
if (discordStreamMode === "progress") {
|
|
@@ -1045,6 +1212,7 @@ function createDiscordDraftPreviewController(params) {
|
|
|
1045
1212
|
};
|
|
1046
1213
|
return {
|
|
1047
1214
|
draftStream,
|
|
1215
|
+
lifecycle,
|
|
1048
1216
|
narrationProgressEnabled,
|
|
1049
1217
|
narrationHideCommandText,
|
|
1050
1218
|
commentaryProgressEnabled: progressDraft.commentaryProgressEnabled,
|
|
@@ -1052,36 +1220,48 @@ function createDiscordDraftPreviewController(params) {
|
|
|
1052
1220
|
get isProgressMode() {
|
|
1053
1221
|
return discordStreamMode === "progress";
|
|
1054
1222
|
},
|
|
1055
|
-
get hasProgressDraftStarted() {
|
|
1056
|
-
return progressDraft.hasStarted;
|
|
1057
|
-
},
|
|
1058
1223
|
get isProgressDraftVisible() {
|
|
1059
1224
|
return progressDraft.isVisible;
|
|
1060
1225
|
},
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
},
|
|
1064
|
-
markProgressDraftCollapsed() {
|
|
1065
|
-
progressDraftCollapsed = true;
|
|
1066
|
-
progressDraftStartedBeforeFinal = false;
|
|
1226
|
+
setProgressNarratorLifecycle(narratorLifecycle) {
|
|
1227
|
+
progressNarratorLifecycle = narratorLifecycle;
|
|
1067
1228
|
},
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1229
|
+
freezeProgress,
|
|
1230
|
+
async adoptProgressContinuation(payload, info, target) {
|
|
1231
|
+
const adopt = info.adoptProgressContinuation;
|
|
1232
|
+
if (!draftStream || discordStreamMode !== "progress" || !adopt || info.kind !== "final" || payload.isError || payload.isCommentary || resolveSendableOutboundReplyParts(payload).hasMedia || payload.interactive !== void 0 || payload.presentation !== void 0 || payload.channelData !== void 0) return false;
|
|
1233
|
+
const snapshot = progressDraft.getSnapshot();
|
|
1234
|
+
if (!snapshot.statusHeadline && !snapshot.plan?.length && !snapshot.lines.length) return false;
|
|
1235
|
+
const assertCurrent = () => {
|
|
1236
|
+
params.abortSignal?.throwIfAborted();
|
|
1237
|
+
info.assertPlatformSendAuthorized?.();
|
|
1238
|
+
};
|
|
1239
|
+
return await withDiscordRequestAuthority(assertCurrent, async () => {
|
|
1240
|
+
assertCurrent();
|
|
1241
|
+
freezeProgress();
|
|
1242
|
+
const text = progressDraft.getText().trimEnd();
|
|
1243
|
+
draftStream.update(text, { complete: true });
|
|
1244
|
+
await draftStream.flush();
|
|
1245
|
+
assertCurrent();
|
|
1246
|
+
const messageId = draftStream.messageId();
|
|
1247
|
+
if (!messageId || !text || draftStream.lastDeliveredText() !== text) return false;
|
|
1248
|
+
if (!await adopt({
|
|
1249
|
+
channel: "discord",
|
|
1250
|
+
accountId: params.accountId,
|
|
1251
|
+
...target,
|
|
1252
|
+
messageId,
|
|
1253
|
+
text,
|
|
1254
|
+
snapshot
|
|
1255
|
+
})) return false;
|
|
1256
|
+
if (draftStream.messageId() === messageId) {
|
|
1257
|
+
lifecycle.retainPreview();
|
|
1258
|
+
draftStream.forceNewMessage();
|
|
1259
|
+
progressDraft.markFinalReplyDelivered();
|
|
1260
|
+
resetProgressState();
|
|
1261
|
+
await draftStream.discardPending();
|
|
1262
|
+
}
|
|
1263
|
+
return true;
|
|
1264
|
+
});
|
|
1085
1265
|
},
|
|
1086
1266
|
async retarget(channelId) {
|
|
1087
1267
|
await draftStream?.retarget(channelId);
|
|
@@ -1090,43 +1270,18 @@ function createDiscordDraftPreviewController(params) {
|
|
|
1090
1270
|
if (!draftStream || discordStreamMode !== "progress") return false;
|
|
1091
1271
|
const progressText = lastPartialText.trimEnd();
|
|
1092
1272
|
if (!progressText) return false;
|
|
1273
|
+
lifecycle.retainPreview();
|
|
1093
1274
|
draftStream.update(progressText);
|
|
1094
1275
|
await draftStream.stop();
|
|
1095
|
-
|
|
1096
|
-
finalizedViaPreviewMessage = true;
|
|
1097
|
-
return true;
|
|
1276
|
+
return Boolean(draftStream.messageId());
|
|
1098
1277
|
},
|
|
1099
1278
|
disableBlockStreamingForDraft: draftStream ? true : void 0,
|
|
1100
1279
|
pushToolEvent: progressDraft.pushToolEvent,
|
|
1101
|
-
pushItemEvent: progressDraft.pushItemEvent,
|
|
1280
|
+
pushItemEvent: progressDraft.pushItemEvent.bind(progressDraft),
|
|
1102
1281
|
pushApprovalEvent: progressDraft.pushApprovalEvent.bind(progressDraft),
|
|
1103
|
-
pushCommandOutputEvent: progressDraft.pushCommandOutputEvent,
|
|
1104
|
-
pushPatchEvent: progressDraft.pushPatchEvent,
|
|
1105
1282
|
pushPlanProgress: progressDraft.pushPlanProgress.bind(progressDraft),
|
|
1106
1283
|
pushReasoningProgress: progressDraft.pushReasoningProgress.bind(progressDraft),
|
|
1107
1284
|
pushNarrationProgress: progressDraft.pushNarrationProgress.bind(progressDraft),
|
|
1108
|
-
async pushPreambleItemEvent(payload) {
|
|
1109
|
-
const headlineAccepted = await progressDraft.pushPreambleHeadline(payload.progressText, { itemId: payload.itemId });
|
|
1110
|
-
if (!progressDraft.commentaryProgressEnabled) return headlineAccepted;
|
|
1111
|
-
const commentaryAccepted = await progressDraft.pushCommentaryProgress(payload.progressText, { itemId: payload.itemId });
|
|
1112
|
-
return headlineAccepted || commentaryAccepted;
|
|
1113
|
-
},
|
|
1114
|
-
resolvePreviewFinalText(text) {
|
|
1115
|
-
if (typeof text !== "string") return;
|
|
1116
|
-
const formatted = convertMarkdownTables(stripInlineDirectiveTagsForDelivery(text).text, params.tableMode);
|
|
1117
|
-
const chunks = chunkDiscordTextWithMode(formatted, {
|
|
1118
|
-
maxChars: draftMaxChars,
|
|
1119
|
-
maxLines: params.maxLinesPerMessage,
|
|
1120
|
-
chunkMode: params.chunkMode
|
|
1121
|
-
});
|
|
1122
|
-
if (!chunks.length && formatted) chunks.push(formatted);
|
|
1123
|
-
if (chunks.length !== 1) return;
|
|
1124
|
-
const trimmed = expectDefined(chunks.at(0), "single Discord preview chunk").trim();
|
|
1125
|
-
if (!trimmed) return;
|
|
1126
|
-
const currentPreviewText = discordStreamMode === "block" ? draftText : lastPartialText;
|
|
1127
|
-
if (currentPreviewText && currentPreviewText.startsWith(trimmed) && trimmed.length < currentPreviewText.length) return;
|
|
1128
|
-
return trimmed;
|
|
1129
|
-
},
|
|
1130
1285
|
updateFromPartial(text) {
|
|
1131
1286
|
if (!draftStream || !text) return;
|
|
1132
1287
|
const cleaned = stripInlineDirectiveTagsForDelivery(stripReasoningTagsFromText(text, {
|
|
@@ -1173,25 +1328,11 @@ function createDiscordDraftPreviewController(params) {
|
|
|
1173
1328
|
handleQueuedFollowupAdmitted() {
|
|
1174
1329
|
return beginNewProgressTurn({ force: true });
|
|
1175
1330
|
},
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
if (draftChunker?.hasBuffered()) {
|
|
1179
|
-
draftChunker.drain({
|
|
1180
|
-
force: true,
|
|
1181
|
-
emit: (chunk) => {
|
|
1182
|
-
draftText += chunk;
|
|
1183
|
-
}
|
|
1184
|
-
});
|
|
1185
|
-
draftChunker.reset();
|
|
1186
|
-
if (draftText) draftStream.update(draftText);
|
|
1187
|
-
}
|
|
1188
|
-
await draftStream.flush();
|
|
1189
|
-
},
|
|
1190
|
-
async cleanup({ finalDeliveryFailed = false } = {}) {
|
|
1331
|
+
flush,
|
|
1332
|
+
async cleanup({ failed = false } = {}) {
|
|
1191
1333
|
try {
|
|
1192
1334
|
progressDraft.cancel();
|
|
1193
|
-
|
|
1194
|
-
if (!(discordStreamMode === "progress" && finalDeliveryFailed) && finalReplyError !== true && !finalizedViaPreviewMessage && draftStream?.messageId()) await draftStream.clear();
|
|
1335
|
+
await lifecycle.cleanup({ failed });
|
|
1195
1336
|
await draftStream?.cleanupPendingMessages();
|
|
1196
1337
|
} catch (err) {
|
|
1197
1338
|
params.log(`discord: draft cleanup failed: ${String(err)}`);
|
|
@@ -1234,6 +1375,9 @@ function createDiscordReplyTypingFeedback(params) {
|
|
|
1234
1375
|
}
|
|
1235
1376
|
//#endregion
|
|
1236
1377
|
//#region extensions/discord/src/monitor/message-handler.process-reply-runtime.ts
|
|
1378
|
+
function formatDiscordGroupThreadReply(text, participant) {
|
|
1379
|
+
return `**${participant.name.replace(/[\\`*_{}[\]()<>#!|]/g, "\\$&").replace(/\s+/g, " ")}**\n${text}`;
|
|
1380
|
+
}
|
|
1237
1381
|
function formatDiscordReasoningQuote(quoteText) {
|
|
1238
1382
|
const lines = quoteText.split("\n").map((line) => line.trim()).filter(Boolean);
|
|
1239
1383
|
if (!lines.length) return;
|
|
@@ -1253,7 +1397,7 @@ function createDiscordBeforePayloadDelivery(params) {
|
|
|
1253
1397
|
}
|
|
1254
1398
|
if (payload.isReasoning || payload.isCommentary) return payload;
|
|
1255
1399
|
if (params.draftPreview.draftStream && params.draftPreview.isProgressMode && info.kind === "block" && !resolveSendableOutboundReplyParts(payload).hasMedia && !payload.isError) return null;
|
|
1256
|
-
if (info.kind === "final" && !params.isFallbackOnlyToolWarningFinal(payload)) params.draftPreview.
|
|
1400
|
+
if (info.kind === "final" && !params.isFallbackOnlyToolWarningFinal(payload)) params.draftPreview.freezeProgress();
|
|
1257
1401
|
return payload;
|
|
1258
1402
|
};
|
|
1259
1403
|
}
|
|
@@ -1341,19 +1485,19 @@ function createDiscordMessageReplyRuntime(params) {
|
|
|
1341
1485
|
beginQueuedDeliveryCorrelation: beginDeliveryCorrelation,
|
|
1342
1486
|
endDeliveryCorrelation,
|
|
1343
1487
|
resolveCurrentTurnTranscriptFinalText,
|
|
1344
|
-
deliverChannelId,
|
|
1345
1488
|
draftPreview: createDiscordDraftPreviewController({
|
|
1489
|
+
groupThread: Boolean(ctxPayload.GroupThread),
|
|
1346
1490
|
cfg,
|
|
1347
1491
|
discordConfig,
|
|
1348
1492
|
accountId,
|
|
1493
|
+
abortSignal: ctx.abortSignal,
|
|
1349
1494
|
sourceRepliesAreToolOnly: params.sourceRepliesAreToolOnly,
|
|
1350
1495
|
textLimit,
|
|
1351
1496
|
deliveryRest: params.deliveryRest,
|
|
1352
1497
|
deliverChannelId,
|
|
1353
1498
|
replyReference,
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
chunkMode,
|
|
1499
|
+
onFinalReplyStart: params.onFinalReplyStart,
|
|
1500
|
+
onFinalReplyDelivered: params.onFinalReplyDelivered,
|
|
1357
1501
|
log: logVerbose
|
|
1358
1502
|
}),
|
|
1359
1503
|
resolvedBlockStreamingEnabled: resolveChannelStreamingBlockEnabled(discordConfig)
|
|
@@ -1403,9 +1547,6 @@ function isFallbackOnlyToolWarningFinal(payload) {
|
|
|
1403
1547
|
return !resolveSendableOutboundReplyParts(payload).hasMedia;
|
|
1404
1548
|
}
|
|
1405
1549
|
async function processDiscordMessage(ctx, observer) {
|
|
1406
|
-
await processDiscordMessageInner(ctx, observer);
|
|
1407
|
-
}
|
|
1408
|
-
async function processDiscordMessageInner(ctx, observer) {
|
|
1409
1550
|
const dispatchStartedAt = Date.now();
|
|
1410
1551
|
const { cfg, accountId, token, runtime, textLimit, replyToMode, message, messageChannelId, isGuildMessage, isDirectMessage, isGroupDm, messageText, threadBindings, route, abortSignal, turnAdoptionLifecycle, preparedMedia: mediaList } = ctx;
|
|
1411
1552
|
if (abortSignal?.aborted) return;
|
|
@@ -1455,7 +1596,7 @@ async function processDiscordMessageInner(ctx, observer) {
|
|
|
1455
1596
|
createdThreadId: replyPlan.createdThreadId,
|
|
1456
1597
|
sessionKey: persistedSessionKey
|
|
1457
1598
|
});
|
|
1458
|
-
const { replyPipeline, onModelSelected, tableMode, maxLinesPerMessage, chunkMode, beginQueuedDeliveryCorrelation, endDeliveryCorrelation, resolveCurrentTurnTranscriptFinalText,
|
|
1599
|
+
const { replyPipeline, onModelSelected, tableMode, maxLinesPerMessage, chunkMode, beginQueuedDeliveryCorrelation, endDeliveryCorrelation, resolveCurrentTurnTranscriptFinalText, draftPreview, resolvedBlockStreamingEnabled } = createDiscordMessageReplyRuntime({
|
|
1459
1600
|
ctx,
|
|
1460
1601
|
processContext: {
|
|
1461
1602
|
...processContext,
|
|
@@ -1466,40 +1607,29 @@ async function processDiscordMessageInner(ctx, observer) {
|
|
|
1466
1607
|
isRoomEvent,
|
|
1467
1608
|
dispatchStartedAt,
|
|
1468
1609
|
feedbackRest: reactions.feedbackRest,
|
|
1469
|
-
deliveryRest: reactions.deliveryRest
|
|
1610
|
+
deliveryRest: reactions.deliveryRest,
|
|
1611
|
+
onFinalReplyStart: observer?.onFinalReplyStart,
|
|
1612
|
+
onFinalReplyDelivered: observer?.onFinalReplyDelivered
|
|
1470
1613
|
});
|
|
1471
|
-
let
|
|
1614
|
+
let deliverThreadId = ctxPayload.MessageThreadId;
|
|
1472
1615
|
activeThreadRoute.bindThreadAdoption(async (threadId) => {
|
|
1473
1616
|
deliverTarget = `channel:${threadId}`;
|
|
1474
|
-
|
|
1617
|
+
deliverThreadId = threadId;
|
|
1475
1618
|
await draftPreview.retarget(threadId);
|
|
1476
1619
|
});
|
|
1477
|
-
|
|
1478
|
-
const
|
|
1479
|
-
if (
|
|
1480
|
-
|
|
1481
|
-
draftPreview.
|
|
1482
|
-
|
|
1620
|
+
const { lifecycle } = draftPreview;
|
|
1621
|
+
const observeFinalDelivery = async () => {
|
|
1622
|
+
if (lifecycle.finalSucceeded) return;
|
|
1623
|
+
draftPreview.freezeProgress();
|
|
1624
|
+
const retainedProgress = activeThreadRoute.threadReplyDelivered && !lifecycle.previewFinalized ? draftPreview.finalizeProgressDraft().catch((error) => {
|
|
1625
|
+
logVerbose(`discord: failed to finalize adopted thread progress (${String(error)})`);
|
|
1626
|
+
}) : void 0;
|
|
1627
|
+
await lifecycle.observeDelivery({ visibleReplySent: true });
|
|
1628
|
+
await retainedProgress;
|
|
1483
1629
|
};
|
|
1484
|
-
let userFacingFinalDelivered = false;
|
|
1485
|
-
let userFacingFinalDeliveryFailed = false;
|
|
1486
1630
|
let pendingToolWarningFinal;
|
|
1487
|
-
const markFinalReplyDelivered = (isError = false) => {
|
|
1488
|
-
draftPreview.markFinalReplyDelivered(isError);
|
|
1489
|
-
if (!isError) {
|
|
1490
|
-
userFacingFinalDelivered = true;
|
|
1491
|
-
userFacingFinalDeliveryFailed = false;
|
|
1492
|
-
pendingToolWarningFinal = void 0;
|
|
1493
|
-
observer?.onFinalReplyDelivered?.();
|
|
1494
|
-
}
|
|
1495
|
-
};
|
|
1496
|
-
let clearProgressDraftAfterFinalDelivery = false;
|
|
1497
1631
|
const resetDeliveryState = () => {
|
|
1498
|
-
finalReplyStartNotified = false;
|
|
1499
|
-
userFacingFinalDelivered = false;
|
|
1500
|
-
userFacingFinalDeliveryFailed = false;
|
|
1501
1632
|
pendingToolWarningFinal = void 0;
|
|
1502
|
-
clearProgressDraftAfterFinalDelivery = false;
|
|
1503
1633
|
};
|
|
1504
1634
|
const progress = createDiscordMessageProgressRuntime({
|
|
1505
1635
|
ctx,
|
|
@@ -1523,7 +1653,7 @@ async function processDiscordMessageInner(ctx, observer) {
|
|
|
1523
1653
|
draftPreview,
|
|
1524
1654
|
isFallbackOnlyToolWarningFinal
|
|
1525
1655
|
});
|
|
1526
|
-
const deliverDiscordPayload = async (
|
|
1656
|
+
const deliverDiscordPayload = async (incomingPayload, info, options) => {
|
|
1527
1657
|
if (abortSignal?.aborted) {
|
|
1528
1658
|
logVerbose(formatDiscordReplySkip({
|
|
1529
1659
|
kind: info.kind,
|
|
@@ -1533,6 +1663,30 @@ async function processDiscordMessageInner(ctx, observer) {
|
|
|
1533
1663
|
}));
|
|
1534
1664
|
return { visibleReplySent: false };
|
|
1535
1665
|
}
|
|
1666
|
+
const deliverySession = options?.deliverySession ?? getGroupThreadDeliverySession();
|
|
1667
|
+
const deliveryOptions = {
|
|
1668
|
+
cfg,
|
|
1669
|
+
token,
|
|
1670
|
+
accountId,
|
|
1671
|
+
rest: reactions.deliveryRest,
|
|
1672
|
+
runtime,
|
|
1673
|
+
replyToMode,
|
|
1674
|
+
textLimit,
|
|
1675
|
+
maxLinesPerMessage,
|
|
1676
|
+
tableMode,
|
|
1677
|
+
chunkMode,
|
|
1678
|
+
sessionKey: deliverySession?.sessionKey ?? ctxPayload.SessionKey,
|
|
1679
|
+
threadBindings,
|
|
1680
|
+
mediaLocalRoots: deliverySession ? getAgentScopedMediaLocalRoots(cfg, deliverySession.agentId) : mediaLocalRoots,
|
|
1681
|
+
bindPendingFinalDelivery: info.bindPendingFinalDelivery,
|
|
1682
|
+
onPlatformSendDispatch: info.onPlatformSendDispatch,
|
|
1683
|
+
assertPlatformSendAuthorized: info.assertPlatformSendAuthorized
|
|
1684
|
+
};
|
|
1685
|
+
let payload = incomingPayload;
|
|
1686
|
+
if (info.participant && (payload.text || payload.mediaUrl || payload.mediaUrls?.length)) payload = {
|
|
1687
|
+
...payload,
|
|
1688
|
+
text: formatDiscordGroupThreadReply(payload.text ?? "", info.participant)
|
|
1689
|
+
};
|
|
1536
1690
|
const isFinal = info.kind === "final";
|
|
1537
1691
|
if (payload.isReasoning) {
|
|
1538
1692
|
const raw = (payload.text ?? "").trim();
|
|
@@ -1550,39 +1704,26 @@ async function processDiscordMessageInner(ctx, observer) {
|
|
|
1550
1704
|
}));
|
|
1551
1705
|
if (!replies.length) return { visibleReplySent: false };
|
|
1552
1706
|
const result = await deliverDiscordReply({
|
|
1553
|
-
|
|
1707
|
+
...deliveryOptions,
|
|
1554
1708
|
replies,
|
|
1555
1709
|
target: deliverTarget,
|
|
1556
|
-
token,
|
|
1557
|
-
accountId,
|
|
1558
|
-
rest: reactions.deliveryRest,
|
|
1559
|
-
runtime,
|
|
1560
1710
|
replyToId: replyReference.use(),
|
|
1561
|
-
|
|
1562
|
-
textLimit,
|
|
1563
|
-
maxLinesPerMessage,
|
|
1564
|
-
tableMode,
|
|
1565
|
-
chunkMode,
|
|
1566
|
-
sessionKey: ctxPayload.SessionKey,
|
|
1567
|
-
threadBindings,
|
|
1568
|
-
mediaLocalRoots,
|
|
1569
|
-
kind: "block",
|
|
1570
|
-
bindPendingFinalDelivery: info.bindPendingFinalDelivery,
|
|
1571
|
-
onPlatformSendDispatch: info.onPlatformSendDispatch,
|
|
1572
|
-
assertPlatformSendAuthorized: info.assertPlatformSendAuthorized
|
|
1711
|
+
kind: "block"
|
|
1573
1712
|
});
|
|
1574
1713
|
if (result.visibleReplySent) replyReference.markSent();
|
|
1575
1714
|
return result;
|
|
1576
1715
|
}
|
|
1577
1716
|
if (isFinal && !options?.allowFallbackOnlyToolWarning && isFallbackOnlyToolWarningFinal(payload)) {
|
|
1578
|
-
if (!
|
|
1717
|
+
if (!lifecycle.finalSucceeded && !lifecycle.previewFinalized && (!lifecycle.finalStarted || lifecycle.finalFailed)) pendingToolWarningFinal = {
|
|
1579
1718
|
payload,
|
|
1580
|
-
info
|
|
1719
|
+
info,
|
|
1720
|
+
deliverySession
|
|
1581
1721
|
};
|
|
1582
1722
|
return { visibleReplySent: false };
|
|
1583
1723
|
}
|
|
1584
|
-
if (isFinal) draftPreview.
|
|
1585
|
-
const finalText = isFinal && typeof payload.text === "string" ? await resolveTranscriptBackedChannelFinalText({
|
|
1724
|
+
if (isFinal) draftPreview.freezeProgress();
|
|
1725
|
+
const finalText = isFinal && !ctxPayload.GroupThread && typeof payload.text === "string" ? await resolveTranscriptBackedChannelFinalText({
|
|
1726
|
+
payload,
|
|
1586
1727
|
finalText: payload.text,
|
|
1587
1728
|
resolveCandidateText: resolveCurrentTurnTranscriptFinalText
|
|
1588
1729
|
}) : payload.text;
|
|
@@ -1600,134 +1741,56 @@ async function processDiscordMessageInner(ctx, observer) {
|
|
|
1600
1741
|
}));
|
|
1601
1742
|
return { visibleReplySent: false };
|
|
1602
1743
|
}
|
|
1744
|
+
if (await draftPreview.adoptProgressContinuation(deliverablePayload, info, {
|
|
1745
|
+
to: isDirectMessage ? ctxPayload.OriginatingTo ?? ctxPayload.To ?? deliverTarget : deliverTarget,
|
|
1746
|
+
threadId: deliverThreadId
|
|
1747
|
+
})) {
|
|
1748
|
+
replyReference.markSent();
|
|
1749
|
+
return { visibleReplySent: true };
|
|
1750
|
+
}
|
|
1603
1751
|
if (isFinal && !replyLifecycleStarted && !isRoomEvent && configuredTypingMode !== "never") await onDiscordReplyStart();
|
|
1604
1752
|
const draftStream = draftPreview.draftStream;
|
|
1605
1753
|
if (draftStream && draftPreview.isProgressMode && info.kind === "block" && !deliverablePayload.isCommentary && !options?.allowProgressBlock) {
|
|
1606
1754
|
if (!resolveSendableOutboundReplyParts(deliverablePayload).hasMedia && !deliverablePayload.isError) return { visibleReplySent: false };
|
|
1607
1755
|
}
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
payload: deliverablePayload,
|
|
1617
|
-
adapter: defineFinalizableLivePreviewAdapter({
|
|
1618
|
-
draft: {
|
|
1619
|
-
flush: () => draftPreview.flush(),
|
|
1620
|
-
clear: () => draftStream.clear(),
|
|
1621
|
-
discardPending: () => draftStream.discardPending(),
|
|
1622
|
-
seal: () => draftStream.seal(),
|
|
1623
|
-
id: draftStream.messageId
|
|
1624
|
-
},
|
|
1625
|
-
buildFinalEdit: () => {},
|
|
1626
|
-
editFinal: async (previewMessageId, edit) => {
|
|
1627
|
-
if (abortSignal?.aborted) throw new Error("process aborted");
|
|
1628
|
-
notifyFinalReplyStart();
|
|
1629
|
-
await editMessageDiscord(deliverChannelId, previewMessageId, edit, {
|
|
1630
|
-
cfg,
|
|
1631
|
-
accountId,
|
|
1632
|
-
rest: reactions.deliveryRest
|
|
1633
|
-
});
|
|
1634
|
-
},
|
|
1635
|
-
onPreviewFinalized: () => {
|
|
1636
|
-
markFinalReplyDelivered();
|
|
1637
|
-
draftPreview.markPreviewFinalized();
|
|
1638
|
-
replyReference.markSent();
|
|
1639
|
-
},
|
|
1640
|
-
logPreviewEditFailure: (err) => {
|
|
1641
|
-
logVerbose(`discord: preview final edit failed; falling back to standard send (${String(err)})`);
|
|
1642
|
-
}
|
|
1643
|
-
}),
|
|
1644
|
-
deliverNormally: async () => {
|
|
1645
|
-
if (abortSignal?.aborted) return false;
|
|
1646
|
-
const fallbackPayload = ttsSupplement && ttsSupplement.visibleTextAlreadyDelivered !== true && !deliverablePayload.text?.trim() ? {
|
|
1647
|
-
...deliverablePayload,
|
|
1648
|
-
text: ttsSupplement.spokenText
|
|
1649
|
-
} : deliverablePayload;
|
|
1650
|
-
const allowedMentions = discordTextHasBroadcastMention(fallbackPayload.text ?? "") ? TARGETED_ONLY_ALLOWED_MENTIONS : void 0;
|
|
1651
|
-
const replyToId = replyReference.use();
|
|
1652
|
-
notifyFinalReplyStart();
|
|
1653
|
-
return (await deliverDiscordReply({
|
|
1654
|
-
cfg,
|
|
1655
|
-
replies: [fallbackPayload],
|
|
1656
|
-
target: deliverTarget,
|
|
1657
|
-
token,
|
|
1658
|
-
accountId,
|
|
1659
|
-
rest: reactions.deliveryRest,
|
|
1660
|
-
runtime,
|
|
1661
|
-
replyToId,
|
|
1662
|
-
replyToMode,
|
|
1663
|
-
textLimit,
|
|
1664
|
-
maxLinesPerMessage,
|
|
1665
|
-
tableMode,
|
|
1666
|
-
chunkMode,
|
|
1667
|
-
sessionKey: ctxPayload.SessionKey,
|
|
1668
|
-
threadBindings,
|
|
1669
|
-
mediaLocalRoots,
|
|
1670
|
-
allowedMentions,
|
|
1756
|
+
let deliveryResult = { visibleReplySent: false };
|
|
1757
|
+
await lifecycle.deliver({
|
|
1758
|
+
kind: info.kind,
|
|
1759
|
+
payload: deliverablePayload,
|
|
1760
|
+
isError: deliverablePayload.isError === true,
|
|
1761
|
+
deliverNormally: async () => {
|
|
1762
|
+
if (abortSignal?.aborted) {
|
|
1763
|
+
logVerbose(formatDiscordReplySkip({
|
|
1671
1764
|
kind: info.kind,
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
}))
|
|
1676
|
-
|
|
1677
|
-
onNormalDelivered: () => {
|
|
1678
|
-
markFinalReplyDelivered();
|
|
1679
|
-
replyReference.markSent();
|
|
1765
|
+
reason: "aborted before delivery",
|
|
1766
|
+
target: deliverTarget,
|
|
1767
|
+
sessionKey: ctxPayload.SessionKey
|
|
1768
|
+
}));
|
|
1769
|
+
return deliveryResult;
|
|
1680
1770
|
}
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
accountId,
|
|
1700
|
-
rest: reactions.deliveryRest,
|
|
1701
|
-
runtime,
|
|
1702
|
-
replyToId,
|
|
1703
|
-
replyToMode,
|
|
1704
|
-
textLimit,
|
|
1705
|
-
maxLinesPerMessage,
|
|
1706
|
-
tableMode,
|
|
1707
|
-
chunkMode,
|
|
1708
|
-
sessionKey: ctxPayload.SessionKey,
|
|
1709
|
-
threadBindings,
|
|
1710
|
-
mediaLocalRoots,
|
|
1711
|
-
kind: info.kind,
|
|
1712
|
-
bindPendingFinalDelivery: info.bindPendingFinalDelivery,
|
|
1713
|
-
onPlatformSendDispatch: info.onPlatformSendDispatch,
|
|
1714
|
-
assertPlatformSendAuthorized: info.assertPlatformSendAuthorized
|
|
1771
|
+
const freshPreviewFinal = draftStream && isFinal && !draftPreview.isProgressMode && !deliverablePayload.isError;
|
|
1772
|
+
const ttsSupplement = freshPreviewFinal ? getReplyPayloadTtsSupplement(deliverablePayload) : void 0;
|
|
1773
|
+
const finalPayload = ttsSupplement && ttsSupplement.visibleTextAlreadyDelivered !== true && !deliverablePayload.text?.trim() ? {
|
|
1774
|
+
...deliverablePayload,
|
|
1775
|
+
text: ttsSupplement.spokenText
|
|
1776
|
+
} : deliverablePayload;
|
|
1777
|
+
const allowedMentions = freshPreviewFinal && discordTextHasBroadcastMention(finalPayload.text ?? "") ? TARGETED_ONLY_ALLOWED_MENTIONS : void 0;
|
|
1778
|
+
deliveryResult = await deliverDiscordReply({
|
|
1779
|
+
...deliveryOptions,
|
|
1780
|
+
replies: [finalPayload],
|
|
1781
|
+
target: deliverTarget,
|
|
1782
|
+
replyToId: replyReference.use(),
|
|
1783
|
+
allowedMentions,
|
|
1784
|
+
kind: info.kind
|
|
1785
|
+
});
|
|
1786
|
+
return deliveryResult;
|
|
1787
|
+
},
|
|
1788
|
+
onNormalDelivered: () => replyReference.markSent()
|
|
1715
1789
|
});
|
|
1716
|
-
|
|
1717
|
-
replyReference.markSent();
|
|
1718
|
-
if (isFinal) {
|
|
1719
|
-
markFinalReplyDelivered(deliverablePayload.isError === true);
|
|
1720
|
-
if (deliverablePayload.isError !== true && clearProgressDraftAfterFinalDelivery) {
|
|
1721
|
-
clearProgressDraftAfterFinalDelivery = false;
|
|
1722
|
-
draftPreview.markProgressDraftCollapsed();
|
|
1723
|
-
await draftStream?.discardPending();
|
|
1724
|
-
await draftStream?.clear();
|
|
1725
|
-
}
|
|
1726
|
-
}
|
|
1727
|
-
return result;
|
|
1790
|
+
return deliveryResult;
|
|
1728
1791
|
};
|
|
1729
1792
|
const onDiscordDeliveryError = (err, info) => {
|
|
1730
|
-
if (info.kind === "final"
|
|
1793
|
+
if (info.kind === "final") lifecycle.observeFailure();
|
|
1731
1794
|
runtime.error(danger(formatDiscordReplyDeliveryFailure({
|
|
1732
1795
|
kind: info.kind,
|
|
1733
1796
|
err,
|
|
@@ -1739,11 +1802,14 @@ async function processDiscordMessageInner(ctx, observer) {
|
|
|
1739
1802
|
let dispatchError = false;
|
|
1740
1803
|
let dispatchAborted = false;
|
|
1741
1804
|
const deliverPendingToolWarningFinalIfNeeded = async () => {
|
|
1742
|
-
if (!pendingToolWarningFinal ||
|
|
1805
|
+
if (!pendingToolWarningFinal || lifecycle.finalSucceeded || lifecycle.previewFinalized || abortSignal?.aborted) return;
|
|
1743
1806
|
const pending = pendingToolWarningFinal;
|
|
1744
1807
|
pendingToolWarningFinal = void 0;
|
|
1745
1808
|
try {
|
|
1746
|
-
return await deliverDiscordPayload(pending.payload, pending.info, {
|
|
1809
|
+
return await deliverDiscordPayload(pending.payload, pending.info, {
|
|
1810
|
+
allowFallbackOnlyToolWarning: true,
|
|
1811
|
+
deliverySession: pending.deliverySession
|
|
1812
|
+
});
|
|
1747
1813
|
} catch (err) {
|
|
1748
1814
|
dispatchError = true;
|
|
1749
1815
|
onDiscordDeliveryError(err, pending.info);
|
|
@@ -1794,6 +1860,7 @@ async function processDiscordMessageInner(ctx, observer) {
|
|
|
1794
1860
|
limit: ctx.historyLimit
|
|
1795
1861
|
},
|
|
1796
1862
|
replyOptions: {
|
|
1863
|
+
groupThreadReplyFormatter: formatDiscordGroupThreadReply,
|
|
1797
1864
|
...turnAdoptionLifecycle ? bindIngressLifecycleToReplyOptions(turnAdoptionLifecycle) : {},
|
|
1798
1865
|
abortSignal,
|
|
1799
1866
|
skillFilter: ctx.channelConfig?.skills,
|
|
@@ -1805,6 +1872,7 @@ async function processDiscordMessageInner(ctx, observer) {
|
|
|
1805
1872
|
disableBlockStreaming: sourceRepliesAreToolOnly ? true : draftPreview.disableBlockStreamingForDraft ?? (typeof resolvedBlockStreamingEnabled === "boolean" ? !resolvedBlockStreamingEnabled : void 0),
|
|
1806
1873
|
onPartialReply: draftPreview.draftStream && !draftPreview.isProgressMode ? (payload) => draftPreview.updateFromPartial(payload.text) : void 0,
|
|
1807
1874
|
...progress.replyOptions,
|
|
1875
|
+
onObservedReplyDelivery: observeFinalDelivery,
|
|
1808
1876
|
onModelSelected
|
|
1809
1877
|
}
|
|
1810
1878
|
});
|
|
@@ -1814,15 +1882,7 @@ async function processDiscordMessageInner(ctx, observer) {
|
|
|
1814
1882
|
dispatchAborted = true;
|
|
1815
1883
|
return;
|
|
1816
1884
|
}
|
|
1817
|
-
if (activeThreadRoute.threadReplyDelivered
|
|
1818
|
-
draftPreview.markFinalReplyStarted();
|
|
1819
|
-
if (draftPreview.hasProgressDraftToCollapse) try {
|
|
1820
|
-
await draftPreview.finalizeProgressDraft();
|
|
1821
|
-
} catch (error) {
|
|
1822
|
-
logVerbose(`discord: failed to finalize adopted thread progress (${String(error)})`);
|
|
1823
|
-
}
|
|
1824
|
-
markFinalReplyDelivered();
|
|
1825
|
-
}
|
|
1885
|
+
if (activeThreadRoute.threadReplyDelivered) await observeFinalDelivery();
|
|
1826
1886
|
} catch (err) {
|
|
1827
1887
|
if (abortSignal?.aborted) {
|
|
1828
1888
|
dispatchAborted = true;
|
|
@@ -1842,10 +1902,10 @@ async function processDiscordMessageInner(ctx, observer) {
|
|
|
1842
1902
|
} finally {
|
|
1843
1903
|
activeThreadRoute.end();
|
|
1844
1904
|
endDeliveryCorrelation();
|
|
1845
|
-
await draftPreview.cleanup({ finalDeliveryFailed: userFacingFinalDeliveryFailed });
|
|
1846
1905
|
dispatchError ||= readAgentRunTerminalOutcome(dispatchResult) === "failed";
|
|
1847
1906
|
const finalReceipt = dispatchResult?.settledReceipt?.counts.final;
|
|
1848
1907
|
const finalDeliveryFailed = (finalReceipt?.failedBeforeSend ?? 0) + (finalReceipt?.failedAfterSend ?? 0) > 0;
|
|
1908
|
+
await draftPreview.cleanup({ failed: finalDeliveryFailed || dispatchError });
|
|
1849
1909
|
await reactions.finish({
|
|
1850
1910
|
dispatchAborted,
|
|
1851
1911
|
dispatchError,
|