@openclaw/discord 2026.8.1-beta.2 → 2026.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{account-inspect-CqzrH14k.js → account-inspect-BDfKyuvL.js} +1 -1
- package/dist/account-inspect-api.js +1 -1
- package/dist/{accounts-DJTf1LtA.js → accounts-CfQ-vSyf.js} +34 -1
- package/dist/action-runtime-api.js +1 -1
- package/dist/{activities-api-DS7vpdtp.js → activities-api-Dl-TOyOX.js} +134 -175
- package/dist/activities-api.js +1 -1
- package/dist/api.js +17 -17
- package/dist/{approval-handler.runtime-B6yEV79q.js → approval-handler.runtime-q4Zqo44V.js} +29 -106
- package/dist/{audit-Db-rlntl.js → audit-DgrvFPGt.js} +5 -5
- package/dist/{channel-CnnbJSt5.js → channel-BsQUalPw.js} +72 -50
- package/dist/{channel-actions.runtime-CLKrx6tr.js → channel-actions.runtime-UMGGIfSy.js} +31 -45
- package/dist/channel-config-api.js +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/channel-type-CVLZyGYS.js +7 -0
- package/dist/{channel.setup-BFAO-V1P.js → channel.setup-rPs4dsk_.js} +5 -5
- package/dist/{outbound-session-route-DxLkrgKQ.js → components-Dk35LTf_.js} +34 -76
- package/dist/{config-schema-BgEskFAs.js → config-schema-CxPqtVI1.js} +46 -14
- package/dist/conversation-binding-route-BjvX4e35.js +43 -0
- package/dist/{directory-config-BVX7Cflc.js → directory-config-B7DY_pNG.js} +2 -2
- package/dist/directory-contract-api.js +1 -1
- package/dist/{directory-live-DGIGxpIo.js → directory-live-DuAXKkan.js} +3 -3
- package/dist/doctor-contract-api.js +2 -2
- package/dist/{doctor-BzC-TLnB.js → doctor-zQTtn6hm.js} +33 -12
- package/dist/{handle-action.guild-admin-BNVTUISF.js → handle-action.guild-admin-DZewwLr1.js} +9 -5
- package/dist/index.js +3 -4
- package/dist/ingress-identity-CzZKcPK8.js +60 -0
- package/dist/{message-handler-Unk_f10F.js → message-handler-C5By3yl5.js} +82 -6
- package/dist/{message-handler.preflight-C9zecxR9.js → message-handler.preflight-DrszWuHw.js} +44 -118
- package/dist/{message-handler.process-DWQ6UHHu.js → message-handler.process-DyFPDLCt.js} +205 -235
- package/dist/{message-utils-BSCPVgy0.js → message-text-Ca8M6TU8.js} +43 -42
- package/dist/{outbound-adapter-D9nRivT1.js → outbound-adapter-Dif8p481.js} +118 -91
- package/dist/{outbound-components-cTzwBJ60.js → outbound-components-wjv7yyAj.js} +5 -4
- package/dist/outbound-session-route-Bn4uXaoE.js +665 -0
- package/dist/owner-access-UlYi9t0M.js +107 -0
- package/dist/{pluralkit-DdiJ9KMK.js → pluralkit-9EuEN4UD.js} +1 -1
- package/dist/{probe-Bl-k5_Ku.js → probe-n6ZXxK8V.js} +1 -1
- package/dist/{probe.runtime-M9fREKvp.js → probe.runtime-CN4bdPfZ.js} +1 -1
- package/dist/{provider-DvSNb-2v.js → provider-LXiOcJrH.js} +887 -1350
- package/dist/{provider-session.runtime-BUEqD0rA.js → provider-session.runtime-DSNe7r2W.js} +3 -3
- package/dist/provider.runtime-DiInaDXO.js +2 -0
- package/dist/{realtime-session.runtime-C7wen-aF.js → realtime-session.runtime-DOViOIjY.js} +129 -134
- package/dist/{resolve-allowlist-common-D04lpEzb.js → resolve-allowlist-common-BLoYaxEG.js} +2 -2
- package/dist/{resolve-channels-Dm7jEeg6.js → resolve-channels-D2yl_2CN.js} +5 -4
- package/dist/{resolve-users-bktrCUUU.js → resolve-users-BLxfqajZ.js} +2 -2
- package/dist/{retry-CLpJcXXf.js → retry-DqHCW6PV.js} +187 -19
- package/dist/{runtime-DGsSyDTS.js → runtime-BYamRVPN.js} +89 -86
- package/dist/{runtime-DoHjckYm.js → runtime-DrxVBTtp.js} +9 -10
- package/dist/runtime-api.js +19 -25
- package/dist/{sdk-runtime-QpY8PvCh.js → sdk-runtime-6tfgYDjY.js} +57 -89
- package/dist/{secret-config-contract-B1akrlyY.js → secret-config-contract-B3i6WxV5.js} +53 -25
- package/dist/secret-contract-api.js +1 -1
- package/dist/{security-audit-jGnJF__m.js → security-audit-DKfK-iPY.js} +11 -12
- package/dist/security-audit-contract-api.js +1 -1
- package/dist/{security-audit.runtime-CPN0xFYz.js → security-audit.runtime-sKZyKgpx.js} +1 -1
- package/dist/{send-B7Q6Oc1I.js → send-UJHiAm4C.js} +82 -19
- package/dist/{send.components-iJyFXw9L.js → send.components-CrBJpGT_.js} +22 -39
- package/dist/{send.outbound-DS5tHwfR.js → send.outbound-D7JYmfm9.js} +77 -78
- package/dist/{send.shared-BmwFjW6T.js → send.shared-DZJ1akvQ.js} +136 -121
- package/dist/{sender-identity-QtalnCYv.js → sender-identity-BJtfyise.js} +1 -1
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{shared-BIXIX6uJ.js → shared-Dii2HTn7.js} +41 -14
- package/dist/subagent-hooks-JyGrtQIl.js +49 -0
- package/dist/subagent-hooks-api.js +1 -6
- package/dist/{system-events-CTqDf6_s.js → system-events-BEmcj4xJ.js} +2 -2
- package/dist/{target-resolver-maOKSqO0.js → target-resolver-V-IYae6s.js} +3 -3
- package/dist/targets-CQp53cGj.js +3 -0
- package/dist/{thread-bindings-3L8p82GV.js → thread-bindings-DvYP79fy.js} +28 -26
- package/dist/{thread-bindings.manager-DCIH6WDC.js → thread-bindings.manager-Clm77DBM.js} +11 -14
- package/dist/{thread-bindings.session-updates-bJ2KQFY6.js → thread-bindings.session-updates-CJb-BpPL.js} +1 -1
- package/dist/{thread-bindings.state-aeV8HNgV.js → thread-bindings.state-D8OMdk4O.js} +1 -1
- package/dist/threading-CXuu_7o9.js +478 -0
- package/dist/transcripts-source-BLEMH_yi.js +270 -0
- package/dist/transcripts-source-api.js +7 -2
- package/dist/{typing-CS-nNVoe.js → typing-B9snnwMe.js} +1 -1
- package/dist/{voice-runtime-BEdqNcST.js → voice-runtime-DY6_o73o.js} +250 -150
- package/node_modules/@discord/embedded-app-sdk/node_modules/uuid/README.md +19 -19
- package/node_modules/@discord/embedded-app-sdk/node_modules/uuid/dist/v1.js +7 -3
- package/node_modules/@discord/embedded-app-sdk/node_modules/uuid/dist/v7.js +5 -2
- package/node_modules/@discord/embedded-app-sdk/node_modules/uuid/dist-node/v1.js +7 -3
- package/node_modules/@discord/embedded-app-sdk/node_modules/uuid/dist-node/v7.js +5 -2
- package/node_modules/@discord/embedded-app-sdk/node_modules/uuid/package.json +4 -3
- package/node_modules/@discordjs/voice/node_modules/@types/node/README.md +1 -1
- package/node_modules/@discordjs/voice/node_modules/@types/node/child_process.d.ts +0 -1
- package/node_modules/@discordjs/voice/node_modules/@types/node/crypto.d.ts +6 -6
- package/node_modules/@discordjs/voice/node_modules/@types/node/dns/promises.d.ts +5 -5
- package/node_modules/@discordjs/voice/node_modules/@types/node/dns.d.ts +5 -5
- package/node_modules/@discordjs/voice/node_modules/@types/node/fs.d.ts +7 -0
- package/node_modules/@discordjs/voice/node_modules/@types/node/http.d.ts +30 -0
- package/node_modules/@discordjs/voice/node_modules/@types/node/http2.d.ts +4 -4
- package/node_modules/@discordjs/voice/node_modules/@types/node/os.d.ts +30 -30
- package/node_modules/@discordjs/voice/node_modules/@types/node/package.json +2 -2
- package/node_modules/@discordjs/voice/node_modules/@types/node/perf_hooks.d.ts +2 -1
- package/node_modules/@discordjs/voice/node_modules/@types/node/process.d.ts +42 -43
- package/node_modules/@discordjs/voice/node_modules/@types/node/quic.d.ts +1049 -84
- package/node_modules/@discordjs/voice/node_modules/@types/node/sqlite.d.ts +14 -1
- package/node_modules/@discordjs/voice/node_modules/@types/node/stream/iter.d.ts +3 -2
- package/node_modules/@discordjs/voice/node_modules/@types/node/test.d.ts +61 -0
- package/node_modules/@discordjs/voice/node_modules/@types/node/v8.d.ts +20 -23
- package/node_modules/discord-api-types/CHANGELOG.md +8 -0
- package/node_modules/discord-api-types/package.json +4 -4
- package/node_modules/discord-api-types/payloads/v10/channel.d.ts +2 -2
- package/node_modules/discord-api-types/payloads/v10/channel.d.ts.map +1 -1
- package/node_modules/discord-api-types/payloads/v10/gateway.d.ts +4 -0
- package/node_modules/discord-api-types/payloads/v10/gateway.d.ts.map +1 -1
- package/node_modules/discord-api-types/payloads/v10/gateway.js.map +1 -1
- package/node_modules/discord-api-types/payloads/v10/message.d.ts +4 -1
- package/node_modules/discord-api-types/payloads/v10/message.d.ts.map +1 -1
- package/node_modules/discord-api-types/payloads/v10/message.js +1 -0
- package/node_modules/discord-api-types/payloads/v10/message.js.map +1 -1
- package/node_modules/discord-api-types/payloads/v9/channel.d.ts +2 -2
- package/node_modules/discord-api-types/payloads/v9/channel.d.ts.map +1 -1
- package/node_modules/discord-api-types/payloads/v9/gateway.d.ts +4 -0
- package/node_modules/discord-api-types/payloads/v9/gateway.d.ts.map +1 -1
- package/node_modules/discord-api-types/payloads/v9/gateway.js.map +1 -1
- package/node_modules/discord-api-types/payloads/v9/message.d.ts +4 -1
- package/node_modules/discord-api-types/payloads/v9/message.d.ts.map +1 -1
- package/node_modules/discord-api-types/payloads/v9/message.js +1 -0
- package/node_modules/discord-api-types/payloads/v9/message.js.map +1 -1
- package/node_modules/typebox/build/format/date.d.mts +1 -1
- package/node_modules/typebox/build/format/date.mjs +1 -1
- package/node_modules/typebox/build/format/date_time.d.mts +2 -2
- package/node_modules/typebox/build/format/date_time.mjs +3 -3
- package/node_modules/typebox/build/format/email.d.mts +1 -1
- package/node_modules/typebox/build/format/email.mjs +2 -2
- package/node_modules/typebox/build/format/hostname.mjs +2 -10
- package/node_modules/typebox/build/format/idn_email.d.mts +1 -1
- package/node_modules/typebox/build/format/idn_email.mjs +3 -3
- package/node_modules/typebox/build/format/idn_hostname.d.mts +1 -0
- package/node_modules/typebox/build/format/idn_hostname.mjs +3 -11
- package/node_modules/typebox/build/format/idna/format/bidi.d.mts +3 -0
- package/node_modules/typebox/build/format/idna/format/bidi.mjs +98 -0
- package/node_modules/typebox/build/format/idna/format/puny.d.mts +3 -0
- package/node_modules/typebox/build/format/idna/format/puny.mjs +144 -0
- package/node_modules/typebox/build/format/idna/hostname.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/hostname.mjs +16 -0
- package/node_modules/typebox/build/format/idna/idn-hostname.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/idn-hostname.mjs +23 -0
- package/node_modules/typebox/build/format/idna/index.d.mts +2 -0
- package/node_modules/typebox/build/format/idna/index.mjs +2 -0
- package/node_modules/typebox/build/format/idna/label/ascii.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/label/ascii.mjs +9 -0
- package/node_modules/typebox/build/format/idna/label/puny.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/label/puny.mjs +28 -0
- package/node_modules/typebox/build/format/idna/label/unicode.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/label/unicode.mjs +106 -0
- package/node_modules/typebox/build/format/idna/pattern/pattern.d.mts +30 -0
- package/node_modules/typebox/build/format/idna/pattern/pattern.mjs +70 -0
- package/node_modules/typebox/build/format/ipv4.d.mts +0 -1
- package/node_modules/typebox/build/format/ipv4.mjs +2 -32
- package/node_modules/typebox/build/format/ipv6.mjs +2 -61
- package/node_modules/typebox/build/format/iri.d.mts +2 -2
- package/node_modules/typebox/build/format/iri.mjs +26 -8
- package/node_modules/typebox/build/format/iri_reference.d.mts +2 -2
- package/node_modules/typebox/build/format/iri_reference.mjs +9 -55
- package/node_modules/typebox/build/format/regex.d.mts +1 -2
- package/node_modules/typebox/build/format/regex.mjs +2 -6
- package/node_modules/typebox/build/format/time.d.mts +2 -2
- package/node_modules/typebox/build/format/time.mjs +19 -14
- package/node_modules/typebox/build/format/uri.d.mts +1 -1
- package/node_modules/typebox/build/format/uri.mjs +3 -130
- package/node_modules/typebox/build/format/uri_reference.d.mts +1 -1
- package/node_modules/typebox/build/format/uri_reference.mjs +2 -3
- package/node_modules/typebox/build/format/uri_template.d.mts +2 -3
- package/node_modules/typebox/build/format/uri_template.mjs +4 -5
- package/node_modules/typebox/build/format/url.d.mts +3 -3
- package/node_modules/typebox/build/format/url.mjs +4 -5
- package/node_modules/typebox/build/guard/emit.d.mts +3 -1
- package/node_modules/typebox/build/guard/emit.mjs +12 -5
- package/node_modules/typebox/build/guard/guard.d.mts +8 -2
- package/node_modules/typebox/build/guard/guard.mjs +25 -4
- package/node_modules/typebox/build/guard/string.d.mts +2 -2
- package/node_modules/typebox/build/guard/string.mjs +7 -7
- package/node_modules/typebox/build/schema/engine/_context.mjs +3 -3
- package/node_modules/typebox/build/schema/engine/_functions.mjs +1 -2
- package/node_modules/typebox/build/schema/engine/_regexp.d.mts +2 -0
- package/node_modules/typebox/build/schema/engine/_regexp.mjs +4 -0
- package/node_modules/typebox/build/schema/engine/_stack.mjs +12 -13
- package/node_modules/typebox/build/schema/engine/additionalItems.mjs +17 -7
- package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +4 -3
- package/node_modules/typebox/build/schema/engine/contains.mjs +18 -6
- package/node_modules/typebox/build/schema/engine/enum.mjs +1 -1
- package/node_modules/typebox/build/schema/engine/items.mjs +26 -6
- package/node_modules/typebox/build/schema/engine/maxContains.mjs +3 -3
- package/node_modules/typebox/build/schema/engine/minContains.mjs +14 -4
- package/node_modules/typebox/build/schema/engine/not.mjs +4 -2
- package/node_modules/typebox/build/schema/engine/oneOf.mjs +7 -6
- package/node_modules/typebox/build/schema/engine/pattern.mjs +3 -2
- package/node_modules/typebox/build/schema/engine/patternProperties.mjs +4 -3
- package/node_modules/typebox/build/schema/engine/ref.mjs +1 -7
- package/node_modules/typebox/build/schema/engine/schema.mjs +13 -4
- package/node_modules/typebox/build/schema/engine/type.mjs +1 -1
- package/node_modules/typebox/build/schema/resolve/resolve.d.mts +4 -1
- package/node_modules/typebox/build/schema/resolve/resolve.mjs +202 -1
- package/node_modules/typebox/build/schema/static/propertyNames.d.mts +5 -0
- package/node_modules/typebox/build/schema/static/propertyNames.mjs +3 -0
- package/node_modules/typebox/build/schema/static/schema.d.mts +3 -0
- package/node_modules/typebox/build/schema/types/index.d.mts +0 -2
- package/node_modules/typebox/build/schema/types/index.mjs +0 -2
- package/node_modules/typebox/build/system/memory/clone.mjs +14 -11
- package/node_modules/typebox/build/system/memory/discard.mjs +6 -5
- package/node_modules/typebox/build/system/settings/settings.d.mts +9 -0
- package/node_modules/typebox/build/system/settings/settings.mjs +2 -0
- package/node_modules/typebox/build/type/engine/call/distribute_arguments.d.mts +6 -1
- package/node_modules/typebox/build/type/engine/call/distribute_arguments.mjs +16 -3
- package/node_modules/typebox/build/type/engine/call/instantiate.mjs +34 -4
- package/node_modules/typebox/build/type/engine/evaluate/broaden.d.mts +5 -5
- package/node_modules/typebox/build/type/engine/evaluate/broaden.mjs +20 -26
- package/node_modules/typebox/build/type/engine/evaluate/compare.d.mts +6 -10
- package/node_modules/typebox/build/type/engine/evaluate/compare.mjs +9 -13
- package/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +7 -4
- package/node_modules/typebox/build/type/engine/evaluate/composite.mjs +12 -19
- package/node_modules/typebox/build/type/engine/evaluate/distribute.d.mts +4 -20
- package/node_modules/typebox/build/type/engine/evaluate/distribute.mjs +8 -20
- package/node_modules/typebox/build/type/engine/evaluate/evaluate.d.mts +4 -4
- package/node_modules/typebox/build/type/engine/evaluate/evaluate.mjs +11 -8
- package/node_modules/typebox/build/type/engine/evaluate/flatten.d.mts +1 -1
- package/node_modules/typebox/build/type/engine/evaluate/flatten.mjs +3 -4
- package/node_modules/typebox/build/type/engine/evaluate/narrow.d.mts +17 -2
- package/node_modules/typebox/build/type/engine/evaluate/narrow.mjs +26 -6
- package/node_modules/typebox/build/type/engine/exclude/operation.mjs +3 -4
- package/node_modules/typebox/build/type/engine/extract/operation.d.mts +1 -1
- package/node_modules/typebox/build/type/engine/extract/operation.mjs +3 -4
- package/node_modules/typebox/build/type/engine/priority/priority.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/priority/priority.mjs +3 -4
- package/node_modules/typebox/build/type/script/mapping.d.mts +32 -29
- package/node_modules/typebox/build/type/script/mapping.mjs +18 -25
- package/node_modules/typebox/build/type/script/parser.d.mts +19 -25
- package/node_modules/typebox/build/type/script/parser.mjs +27 -23
- package/node_modules/typebox/build/value/errors/errors.d.mts +2 -2
- package/node_modules/typebox/build/value/errors/errors.mjs +1 -1
- package/node_modules/typebox/package.json +27 -27
- package/node_modules/typebox/readme.md +79 -82
- package/node_modules/undici/docs/docs/api/Client.md +21 -8
- package/node_modules/undici/lib/api/readable.js +33 -43
- package/node_modules/undici/lib/core/connect.js +16 -2
- package/node_modules/undici/lib/core/symbols.js +1 -0
- package/node_modules/undici/lib/dispatcher/client-h1.js +3 -3
- package/node_modules/undici/lib/dispatcher/client-h2.js +179 -10
- package/node_modules/undici/lib/dispatcher/client.js +74 -29
- package/node_modules/undici/lib/dispatcher/env-http-proxy-agent.js +28 -6
- package/node_modules/undici/lib/dispatcher/socks5-proxy-agent.js +15 -1
- package/node_modules/undici/lib/handler/retry-handler.js +7 -2
- package/node_modules/undici/lib/interceptor/cache.js +5 -2
- package/node_modules/undici/lib/interceptor/deduplicate.js +1 -1
- package/node_modules/undici/lib/mock/mock-utils.js +213 -24
- package/node_modules/undici/lib/util/cache.js +2 -4
- package/node_modules/undici/lib/web/websocket/websocket.js +22 -0
- package/node_modules/undici/package.json +1 -1
- package/node_modules/undici/types/client.d.ts +40 -0
- package/node_modules/ws/lib/permessage-deflate.js +3 -1
- package/node_modules/ws/package.json +1 -1
- package/openclaw.plugin.json +24 -10
- package/package.json +8 -10
- package/skills/discord/SKILL.md +1 -1
- package/dist/approval-message-safety-AcIxvrf3.js +0 -140
- package/dist/audit-core-xwjIczO0.js +0 -105
- package/dist/channel-actions-5s_hjYKd.js +0 -208
- package/dist/channel-api-CAJ0wMoV.js +0 -21
- package/dist/inbound-event-delivery-De2qxTrP.js +0 -39
- package/dist/provider.runtime-C9PnJZbZ.js +0 -2
- package/dist/runtime-api.actions.js +0 -3
- package/dist/runtime-api.lookup.js +0 -7
- package/dist/runtime-api.monitor-CHxrFPnW.js +0 -5
- package/dist/runtime-api.monitor.js +0 -8
- package/dist/runtime-api.send.js +0 -7
- package/dist/runtime-api.threads.js +0 -5
- package/dist/send.reactions-BAn0iiVQ.js +0 -78
- package/dist/send.receipt-IPI1p-SP.js +0 -66
- package/dist/subagent-hooks-CTt5KCJr.js +0 -120
- package/dist/subagent-progress-DhaE_h8a.js +0 -109
- package/dist/targets-yUFTHoAx.js +0 -3
- package/dist/transcripts-source-CfFMexGt.js +0 -123
- package/node_modules/p-map/index.d.ts +0 -155
- package/node_modules/p-map/index.js +0 -285
- package/node_modules/p-map/license +0 -9
- package/node_modules/p-map/package.json +0 -57
- package/node_modules/p-map/readme.md +0 -190
- package/node_modules/typebox/build/format/_idna.d.mts +0 -2
- package/node_modules/typebox/build/format/_idna.mjs +0 -246
- package/node_modules/typebox/build/format/_puny.d.mts +0 -1
- package/node_modules/typebox/build/format/_puny.mjs +0 -77
- package/node_modules/typebox/build/schema/resolve/ref.d.mts +0 -3
- package/node_modules/typebox/build/schema/resolve/ref.mjs +0 -146
- package/node_modules/typebox/build/schema/types/contentEncoding.d.mts +0 -9
- package/node_modules/typebox/build/schema/types/contentEncoding.mjs +0 -13
- package/node_modules/typebox/build/schema/types/contentMediaType.d.mts +0 -9
- package/node_modules/typebox/build/schema/types/contentMediaType.mjs +0 -13
- package/dist/{allow-list-DnxIlPP2.js → allow-list-BDMimASD.js} +1 -1
- package/dist/{doctor-contract-DLa-BTiU.js → doctor-contract-DsWvKIXF.js} +1 -1
|
@@ -1,41 +1,42 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { i as discordTextHasBroadcastMention } from "./send.outbound-
|
|
6
|
-
import {
|
|
1
|
+
import { Dt as deleteChannelMessage, a as chunkDiscordTextWithMode, kt as editChannelMessage, v as resolveDiscordChannelId, wt as createChannelMessage, y as discord_exports } from "./retry-DqHCW6PV.js";
|
|
2
|
+
import { p as resolveDiscordMaxLinesPerMessage } from "./accounts-CfQ-vSyf.js";
|
|
3
|
+
import { C as resolveTimestampMs, a as normalizeDiscordSlug, r as normalizeDiscordAllowList } from "./allow-list-BDMimASD.js";
|
|
4
|
+
import { F as createDiscordRuntimeAccountContext, P as createDiscordRestClient, d as resolveDiscordTargetChannelId, k as resolveDiscordMessageFlags } from "./send.shared-DZJ1akvQ.js";
|
|
5
|
+
import { i as discordTextHasBroadcastMention } from "./send.outbound-D7JYmfm9.js";
|
|
6
|
+
import { a as removeReactionDiscord, f as editMessageDiscord, r as reactMessageDiscord } from "./send-UJHiAm4C.js";
|
|
7
7
|
import { n as DISCORD_ATTACHMENT_TOTAL_TIMEOUT_MS, t as DISCORD_ATTACHMENT_IDLE_TIMEOUT_MS } from "./timeouts-B9cy6RvQ.js";
|
|
8
|
-
import
|
|
9
|
-
import "./
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import { n as resolveDiscordWebhookId } from "./sender-identity-QtalnCYv.js";
|
|
8
|
+
import "./targets-CQp53cGj.js";
|
|
9
|
+
import { a as buildDiscordRoutePeer, h as discordInboundEventDelivery, u as resolveDiscordConversationIdentity } from "./outbound-session-route-Bn4uXaoE.js";
|
|
10
|
+
import { t as DISCORD_TEXT_CHUNK_LIMIT } from "./outbound-adapter-Dif8p481.js";
|
|
11
|
+
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-LXiOcJrH.js";
|
|
12
|
+
import { a as formatDiscordMediaText, c as resolveReferencedReplyMediaList, i as resolveDiscordMessageText, u as resolveDiscordMessageStickers } from "./message-text-Ca8M6TU8.js";
|
|
13
|
+
import { a as resolveDiscordThreadStarter, n as resolveDiscordAutoThreadReplyPlan } from "./threading-CXuu_7o9.js";
|
|
14
|
+
import { n as resolveDiscordWebhookId } from "./sender-identity-BJtfyise.js";
|
|
16
15
|
import { t as beginDiscordActiveTurnThreadRoute } from "./active-turn-thread-route-fmHl1HNd.js";
|
|
17
16
|
import { n as filterDiscordHistoryEntriesForContext, t as createDiscordHistorySenderProvenance } from "./message-handler.history-CJOsN9w5.js";
|
|
18
|
-
import { t as sendTyping } from "./typing-
|
|
19
|
-
import { buildAgentSessionKey, resolveThreadSessionKeys } from "openclaw/plugin-sdk/routing";
|
|
17
|
+
import { t as sendTyping } from "./typing-B9snnwMe.js";
|
|
20
18
|
import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
|
|
21
19
|
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
20
|
+
import { buildAgentSessionKey, resolveThreadSessionKeys } from "openclaw/plugin-sdk/routing";
|
|
21
|
+
import { getReplyPayloadTtsSupplement, isReplyPayloadNonTerminalToolErrorWarning, resolveSendableOutboundReplyParts } from "openclaw/plugin-sdk/reply-payload";
|
|
22
22
|
import { danger, logVerbose, shouldLogVerbose, sleepWithAbort } from "openclaw/plugin-sdk/runtime-env";
|
|
23
23
|
import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
24
24
|
import { resolveMarkdownTableMode } from "openclaw/plugin-sdk/markdown-table-runtime";
|
|
25
25
|
import { resolveChunkMode } from "openclaw/plugin-sdk/reply-chunking";
|
|
26
26
|
import { convertMarkdownTables, stripInlineDirectiveTagsForDelivery, stripReasoningTagsFromText } from "openclaw/plugin-sdk/text-chunking";
|
|
27
|
-
import { bindIngressLifecycleToReplyOptions, buildChannelProgressDraftLine, buildChannelProgressDraftLineForEntry, createChannelMessageReplyPipeline, createChannelProgressDraftCompositor,
|
|
27
|
+
import { bindIngressLifecycleToReplyOptions, buildChannelProgressDraftLine, buildChannelProgressDraftLineForEntry, createChannelMessageReplyPipeline, createChannelProgressDraftCompositor, createFinalizableDraftStreamControlsForState, createTypingCallbacks, defineFinalizableLivePreviewAdapter, deliverWithFinalizableLivePreviewAdapter, resolveChannelDraftStreamingChunking, resolveChannelMessageSourceReplyDeliveryMode, resolveChannelPreviewStreamMode, resolveChannelStreamingBlockEnabled, resolveChannelStreamingPreviewCommandText, resolveChannelStreamingPreviewToolProgress, resolveChannelStreamingProgressNarration, resolveChannelStreamingSuppressDefaultToolProgressMessages, resolveTranscriptBackedChannelFinalText } from "openclaw/plugin-sdk/channel-outbound";
|
|
28
28
|
import { getAgentScopedMediaLocalRoots } from "openclaw/plugin-sdk/media-runtime";
|
|
29
|
-
import { getReplyPayloadTtsSupplement, isReplyPayloadNonTerminalToolErrorWarning, resolveSendableOutboundReplyParts } from "openclaw/plugin-sdk/reply-payload";
|
|
30
29
|
import { evaluateSupplementalContextVisibility } from "openclaw/plugin-sdk/security-runtime";
|
|
31
30
|
import { resolvePinnedMainDmOwnerFromAllowlist } from "openclaw/plugin-sdk/conversation-runtime";
|
|
32
|
-
import {
|
|
31
|
+
import { resolveAgentConfig } from "openclaw/plugin-sdk/agent-scope-runtime";
|
|
32
|
+
import { EmbeddedBlockChunker, resolveAckReaction, resolveAgentConfig as resolveAgentConfig$1, resolveHumanDelayConfig } from "openclaw/plugin-sdk/agent-runtime";
|
|
33
33
|
import { isDangerousNameMatchingEnabled } from "openclaw/plugin-sdk/dangerous-name-runtime";
|
|
34
|
-
import { buildChannelInboundEventContext, dispatchChannelInboundTurn, formatInboundEnvelope, formatInboundMediaUnavailableText, hasFinalInboundReplyDispatch, readAgentRunTerminalOutcome, resolveEnvelopeFormatOptions, toHistoryMediaEntries, toInboundMediaFactsWithMetadata } from "openclaw/plugin-sdk/channel-inbound";
|
|
35
34
|
import { getSessionEntry, readSessionUpdatedAt, resolveStorePath } from "openclaw/plugin-sdk/session-store-runtime";
|
|
35
|
+
import { buildChannelInboundEventContext, createCommandTurnContext, dispatchChannelInboundTurn, formatInboundEnvelope, formatInboundMediaUnavailableText, hasFinalInboundReplyDispatch, readAgentRunTerminalOutcome, resolveEnvelopeFormatOptions, toHistoryMediaEntries, toInboundMediaFactsWithMetadata } from "openclaw/plugin-sdk/channel-inbound";
|
|
36
36
|
import { getGlobalHookRunner } from "openclaw/plugin-sdk/plugin-runtime";
|
|
37
37
|
import { buildHistoryContextFromEntries, buildInboundHistoryFromEntries, createChannelHistoryWindow } from "openclaw/plugin-sdk/reply-history";
|
|
38
38
|
import { resolveChannelContextVisibilityMode } from "openclaw/plugin-sdk/context-visibility-runtime";
|
|
39
|
+
import { formatAudioTranscriptForAgent } from "openclaw/plugin-sdk/media-understanding-runtime";
|
|
39
40
|
import { DEFAULT_TIMING, createStatusReactionController, logAckFailure, logTypingFailure, shouldAckReaction } from "openclaw/plugin-sdk/channel-feedback";
|
|
40
41
|
import { readLatestAssistantTextByIdentity } from "openclaw/plugin-sdk/session-transcript-runtime";
|
|
41
42
|
//#region extensions/discord/src/monitor/message-handler.retry.ts
|
|
@@ -78,7 +79,7 @@ function isContextAborted(abortSignal) {
|
|
|
78
79
|
}
|
|
79
80
|
async function buildDiscordMessageProcessContext(params) {
|
|
80
81
|
const { ctx, text, mediaList } = params;
|
|
81
|
-
const { cfg, discordConfig, accountId, runtime, botUserId, mediaMaxBytes, discordRestFetch, abortSignal, guildHistories, historyLimit, replyToMode, message, author, sender, canonicalMessageId, data, client, channelInfo, channelName, messageChannelId, isGuildMessage, isDirectMessage, baseText, preflightAudioTranscript, threadChannel, threadParentId, threadParentName, threadParentType, threadName, displayChannelSlug, guildInfo, guildSlug, memberRoleIds, channelConfig, baseSessionKey, boundSessionKey, route, commandAuthorized, resolveChannelIngress } = ctx;
|
|
82
|
+
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;
|
|
82
83
|
const fromLabel = isDirectMessage ? buildDirectLabel(author) : buildGuildLabel({
|
|
83
84
|
guild: data.guild ?? void 0,
|
|
84
85
|
channelName: channelName ?? messageChannelId,
|
|
@@ -135,6 +136,7 @@ async function buildDiscordMessageProcessContext(params) {
|
|
|
135
136
|
notice: `[discord ${unavailableMediaCount > 1 ? `${unavailableMediaCount} attachments` : "attachment"} unavailable]`
|
|
136
137
|
}) : body;
|
|
137
138
|
const bodyWithMediaNotice = appendMediaUnavailableNotice(text) ?? text;
|
|
139
|
+
const agentFacingBody = preflightAudioTranscript !== void 0 ? formatAudioTranscriptForAgent(preflightAudioTranscript) : baseText ?? text;
|
|
138
140
|
let combinedBody = formatInboundEnvelope({
|
|
139
141
|
channel: "Discord",
|
|
140
142
|
from: fromLabel,
|
|
@@ -195,6 +197,7 @@ async function buildDiscordMessageProcessContext(params) {
|
|
|
195
197
|
const starter = await resolveDiscordThreadStarter({
|
|
196
198
|
channel: threadChannel,
|
|
197
199
|
client,
|
|
200
|
+
accountId,
|
|
198
201
|
parentId: threadParentId,
|
|
199
202
|
parentType: threadParentType,
|
|
200
203
|
resolveTimestampMs
|
|
@@ -216,15 +219,17 @@ async function buildDiscordMessageProcessContext(params) {
|
|
|
216
219
|
if (threadParentId) {
|
|
217
220
|
parentSessionKey = buildAgentSessionKey({
|
|
218
221
|
agentId: route.agentId,
|
|
222
|
+
mainKey: cfg.session?.mainKey,
|
|
219
223
|
channel: route.channel,
|
|
220
224
|
peer: {
|
|
221
225
|
kind: "channel",
|
|
222
226
|
id: threadParentId
|
|
223
|
-
}
|
|
227
|
+
},
|
|
228
|
+
groupScope: route.groupScope
|
|
224
229
|
});
|
|
225
|
-
modelParentSessionKey = parentSessionKey;
|
|
230
|
+
modelParentSessionKey = parentSessionKey === baseSessionKey ? void 0 : parentSessionKey;
|
|
226
231
|
}
|
|
227
|
-
|
|
232
|
+
parentSessionKey = threadParentInheritanceEnabled ? modelParentSessionKey : void 0;
|
|
228
233
|
}
|
|
229
234
|
const preflightAudioIndex = preflightAudioTranscript === void 0 ? -1 : mediaList.findIndex((media) => media.contentType?.startsWith("audio/"));
|
|
230
235
|
const threadKeys = resolveThreadSessionKeys({
|
|
@@ -249,12 +254,15 @@ async function buildDiscordMessageProcessContext(params) {
|
|
|
249
254
|
agentId: route.agentId,
|
|
250
255
|
channel: route.channel,
|
|
251
256
|
cfg,
|
|
257
|
+
parentSessionKey: route.sessionKey,
|
|
258
|
+
groupScope: route.groupScope,
|
|
252
259
|
threadParentInheritanceEnabled
|
|
253
260
|
});
|
|
254
261
|
const deliverTarget = replyPlan.deliverTarget;
|
|
255
262
|
const replyTarget = replyPlan.replyTarget;
|
|
256
263
|
const replyReference = replyPlan.replyReference;
|
|
257
264
|
const autoThreadContext = replyPlan.autoThreadContext;
|
|
265
|
+
const conversationParentId = threadChannel ? threadParentId : autoThreadContext ? messageChannelId : void 0;
|
|
258
266
|
const effectiveFrom = isDirectMessage ? `discord:${author.id}` : autoThreadContext?.From ?? `discord:channel:${messageChannelId}`;
|
|
259
267
|
const dmConversationTarget = isDirectMessage ? resolveDiscordConversationIdentity({
|
|
260
268
|
isDirectMessage,
|
|
@@ -282,7 +290,7 @@ async function buildDiscordMessageProcessContext(params) {
|
|
|
282
290
|
messageId: canonicalMessageId ?? message.id,
|
|
283
291
|
inboundEventKind: ctx.inboundEventKind
|
|
284
292
|
}, {
|
|
285
|
-
parentId:
|
|
293
|
+
parentId: conversationParentId,
|
|
286
294
|
threadId: threadChannel?.id ?? autoThreadContext?.createdThreadId ?? void 0
|
|
287
295
|
});
|
|
288
296
|
const ctxPayload = await (ctx.buildContext ?? buildChannelInboundEventContext)({
|
|
@@ -305,12 +313,19 @@ async function buildDiscordMessageProcessContext(params) {
|
|
|
305
313
|
isBot: author.bot && !sender.isPluralKit ? true : void 0
|
|
306
314
|
},
|
|
307
315
|
conversation: {
|
|
308
|
-
kind: isDirectMessage ? "direct" : "channel",
|
|
316
|
+
kind: isGroupDm ? "group" : isDirectMessage ? "direct" : "channel",
|
|
309
317
|
id: messageChannelId,
|
|
318
|
+
routePeer: buildDiscordRoutePeer({
|
|
319
|
+
isDirectMessage,
|
|
320
|
+
isGroupDm,
|
|
321
|
+
directUserId: author.id,
|
|
322
|
+
conversationId: messageChannelId
|
|
323
|
+
}),
|
|
310
324
|
nativeChannelId: messageChannelId,
|
|
325
|
+
avatar: ctx.conversationAvatar,
|
|
311
326
|
label: fromLabel,
|
|
312
|
-
spaceId: isGuildMessage ? (guildInfo?.id ?? guildSlug) || void 0 : void 0,
|
|
313
|
-
parentId:
|
|
327
|
+
spaceId: isGuildMessage ? (guildInfo?.id ?? data.guild?.id ?? data.guild_id ?? guildSlug) || void 0 : void 0,
|
|
328
|
+
parentId: conversationParentId,
|
|
314
329
|
threadId: threadChannel?.id ?? autoThreadContext?.createdThreadId ?? void 0
|
|
315
330
|
},
|
|
316
331
|
route: {
|
|
@@ -329,9 +344,9 @@ async function buildDiscordMessageProcessContext(params) {
|
|
|
329
344
|
message: {
|
|
330
345
|
inboundEventKind: ctx.inboundEventKind,
|
|
331
346
|
body: combinedBody,
|
|
332
|
-
rawBody:
|
|
333
|
-
bodyForAgent: appendMediaUnavailableNotice(
|
|
334
|
-
commandBody:
|
|
347
|
+
rawBody: baseText,
|
|
348
|
+
bodyForAgent: appendMediaUnavailableNotice(agentFacingBody),
|
|
349
|
+
commandBody: baseText,
|
|
335
350
|
inboundHistory
|
|
336
351
|
},
|
|
337
352
|
sessionTranscript: { historyLimit: shouldIncludeChannelHistory ? historyLimit : 0 },
|
|
@@ -345,12 +360,10 @@ async function buildDiscordMessageProcessContext(params) {
|
|
|
345
360
|
},
|
|
346
361
|
commands: { authorized: commandAuthorized }
|
|
347
362
|
},
|
|
348
|
-
commandTurn: {
|
|
349
|
-
kind: "text-slash",
|
|
350
|
-
source: "text",
|
|
363
|
+
commandTurn: createCommandTurnContext(hasControlCommand ? "text" : "message", {
|
|
351
364
|
authorized: commandAuthorized,
|
|
352
|
-
body:
|
|
353
|
-
},
|
|
365
|
+
body: baseText
|
|
366
|
+
}),
|
|
354
367
|
media: await toInboundMediaFactsWithMetadata(mediaList, { transcribed: (_media, index) => index === preflightAudioIndex }),
|
|
355
368
|
supplemental: {
|
|
356
369
|
quote: replyContext && replyVisible ? {
|
|
@@ -367,7 +380,7 @@ async function buildDiscordMessageProcessContext(params) {
|
|
|
367
380
|
totalTimeoutMs: DISCORD_ATTACHMENT_TOTAL_TIMEOUT_MS,
|
|
368
381
|
abortSignal
|
|
369
382
|
});
|
|
370
|
-
return isContextAborted(abortSignal) ? [] : await toInboundMediaFactsWithMetadata(referencedReplyMediaList);
|
|
383
|
+
return isContextAborted(abortSignal) ? [] : await toInboundMediaFactsWithMetadata(referencedReplyMediaList, { messageId: replyContext.id });
|
|
371
384
|
}
|
|
372
385
|
} : void 0,
|
|
373
386
|
thread: {
|
|
@@ -455,8 +468,7 @@ function createDiscordMessageProgressRuntime(params) {
|
|
|
455
468
|
const { ctx, draftPreview } = params;
|
|
456
469
|
const { cfg, route, abortSignal } = ctx;
|
|
457
470
|
const reasoningLevel = (() => {
|
|
458
|
-
const
|
|
459
|
-
const cfgDefault = cfg.agents?.list?.find((entry) => ((entry?.id ?? "").trim().toLowerCase() || "main") === normalizedAgentId)?.reasoningDefault ?? cfg.agents?.defaults?.reasoningDefault;
|
|
471
|
+
const cfgDefault = resolveAgentConfig(cfg, route.agentId ?? "main")?.reasoningDefault ?? cfg.agents?.defaults?.reasoningDefault;
|
|
460
472
|
const configDefault = cfgDefault === "on" || cfgDefault === "stream" ? cfgDefault : "off";
|
|
461
473
|
if (!params.sessionKey) return configDefault;
|
|
462
474
|
try {
|
|
@@ -475,103 +487,84 @@ function createDiscordMessageProgressRuntime(params) {
|
|
|
475
487
|
const reasoningDurableEnabled = reasoningLevel === "on";
|
|
476
488
|
const reasoningWindowEnabled = reasoningLevel === "stream";
|
|
477
489
|
let shouldYieldDraftCommentary = () => false;
|
|
478
|
-
const progressReceipt = createChannelProgressReceiptTracker();
|
|
479
|
-
const resetTurnState = () => {
|
|
480
|
-
progressReceipt.reset();
|
|
481
|
-
};
|
|
482
490
|
const handleAssistantMessageBoundary = () => {
|
|
483
|
-
if (draftPreview.handleAssistantMessageBoundary())
|
|
484
|
-
resetTurnState();
|
|
485
|
-
params.onTurnReset();
|
|
486
|
-
}
|
|
491
|
+
if (draftPreview.handleAssistantMessageBoundary()) params.onTurnReset();
|
|
487
492
|
};
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
await
|
|
534
|
-
if (payload.phase === "start") progressReceipt.noteToolCall(payload.name);
|
|
535
|
-
return await draftPreview.pushToolEvent(payload);
|
|
536
|
-
},
|
|
537
|
-
onItemEvent: async (payload) => {
|
|
538
|
-
if (isFailedProgress(payload)) return false;
|
|
539
|
-
if (payload.kind === "preamble") {
|
|
540
|
-
if (shouldYieldDraftCommentary()) return;
|
|
541
|
-
return await draftPreview.pushPreambleItemEvent(payload, (itemId, text) => {
|
|
542
|
-
progressReceipt.noteCommentary(itemId, text);
|
|
543
|
-
});
|
|
544
|
-
}
|
|
545
|
-
return await draftPreview.pushItemEvent(payload);
|
|
546
|
-
},
|
|
547
|
-
onPlanUpdate: async (payload) => {
|
|
548
|
-
if (payload.phase === "update") return await draftPreview.pushPlanProgress(payload.steps, { explanation: payload.explanation });
|
|
549
|
-
return false;
|
|
550
|
-
},
|
|
551
|
-
onApprovalEvent: async (payload) => {
|
|
552
|
-
return await draftPreview.pushApprovalEvent(payload);
|
|
553
|
-
},
|
|
554
|
-
onCommandOutput: async (payload) => {
|
|
555
|
-
if (isFailedProgress(payload)) return false;
|
|
556
|
-
return await draftPreview.pushCommandOutputEvent(payload);
|
|
557
|
-
},
|
|
558
|
-
onPatchSummary: async (payload) => {
|
|
559
|
-
return await draftPreview.pushPatchEvent(payload);
|
|
560
|
-
},
|
|
561
|
-
onCompactionStart: async () => {
|
|
562
|
-
if (!isProcessAborted$1(abortSignal)) await params.reactions.controller.setCompacting();
|
|
563
|
-
return false;
|
|
564
|
-
},
|
|
565
|
-
onCompactionEnd: async () => {
|
|
566
|
-
if (!isProcessAborted$1(abortSignal)) {
|
|
567
|
-
params.reactions.controller.cancelPending();
|
|
568
|
-
await params.reactions.controller.setThinking();
|
|
569
|
-
}
|
|
570
|
-
return false;
|
|
493
|
+
return { replyOptions: {
|
|
494
|
+
onAssistantMessageStart: draftPreview.draftStream ? () => {
|
|
495
|
+
handleAssistantMessageBoundary();
|
|
496
|
+
return false;
|
|
497
|
+
} : void 0,
|
|
498
|
+
onReasoningEnd: draftPreview.draftStream ? () => {
|
|
499
|
+
handleAssistantMessageBoundary();
|
|
500
|
+
return false;
|
|
501
|
+
} : void 0,
|
|
502
|
+
onQueuedFollowupAdmitted: draftPreview.draftStream ? () => {
|
|
503
|
+
if (draftPreview.handleQueuedFollowupAdmitted()) params.onTurnReset();
|
|
504
|
+
} : void 0,
|
|
505
|
+
suppressDefaultToolProgressMessages: params.sourceRepliesAreToolOnly && params.reactions.statusReactionsExplicitlyEnabled || draftPreview.suppressDefaultToolProgressMessages ? true : void 0,
|
|
506
|
+
allowToolLifecycleWhenProgressHidden: params.reactions.statusReactionsEnabled ? true : void 0,
|
|
507
|
+
commentaryProgressEnabled: draftPreview.isProgressMode ? draftPreview.commentaryProgressEnabled : void 0,
|
|
508
|
+
progressPreambleEnabled: draftPreview.draftStream && draftPreview.isProgressMode ? true : void 0,
|
|
509
|
+
commentaryPayloadsEnabled: draftPreview.isProgressMode ? draftPreview.commentaryProgressEnabled : void 0,
|
|
510
|
+
shouldDeliverCommentaryPayloads: draftPreview.isProgressMode && draftPreview.commentaryProgressEnabled ? () => shouldYieldDraftCommentary() : void 0,
|
|
511
|
+
reasoningPayloadsEnabled: reasoningDurableEnabled,
|
|
512
|
+
onVerboseProgressVisibility: (isActive) => {
|
|
513
|
+
shouldYieldDraftCommentary = isActive;
|
|
514
|
+
},
|
|
515
|
+
onNarrationUpdate: draftPreview.narrationProgressEnabled ? async (payload) => {
|
|
516
|
+
if (isProcessAborted$1(abortSignal) || shouldYieldDraftCommentary()) return;
|
|
517
|
+
await draftPreview.pushNarrationProgress(payload.text);
|
|
518
|
+
} : void 0,
|
|
519
|
+
onProgressNarratorLifecycle: draftPreview.narrationProgressEnabled ? (lifecycle) => draftPreview.setProgressNarratorLifecycle(lifecycle) : void 0,
|
|
520
|
+
isProgressDraftVisible: draftPreview.narrationProgressEnabled ? () => draftPreview.isProgressDraftVisible : void 0,
|
|
521
|
+
narrationHideCommandText: draftPreview.narrationHideCommandText ? true : void 0,
|
|
522
|
+
onReasoningStream: async (payload) => {
|
|
523
|
+
if (payload?.requiresReasoningProgressOptIn === true && !reasoningWindowEnabled) return false;
|
|
524
|
+
await params.reactions.controller.setThinking();
|
|
525
|
+
return await draftPreview.pushReasoningProgress(payload?.text, { snapshot: payload?.isReasoningSnapshot === true });
|
|
526
|
+
},
|
|
527
|
+
streamReasoningInNonStreamModes: reasoningWindowEnabled,
|
|
528
|
+
onToolStart: async (payload) => {
|
|
529
|
+
if (isProcessAborted$1(abortSignal)) return false;
|
|
530
|
+
await params.reactions.maybeBindToToolReaction(payload);
|
|
531
|
+
await params.reactions.controller.setTool(payload.name);
|
|
532
|
+
return await draftPreview.pushToolEvent(payload);
|
|
533
|
+
},
|
|
534
|
+
onItemEvent: async (payload) => {
|
|
535
|
+
if (isFailedProgress(payload)) return false;
|
|
536
|
+
if (payload.kind === "preamble") {
|
|
537
|
+
if (shouldYieldDraftCommentary()) return;
|
|
538
|
+
return await draftPreview.pushPreambleItemEvent(payload);
|
|
571
539
|
}
|
|
540
|
+
return await draftPreview.pushItemEvent(payload);
|
|
572
541
|
},
|
|
573
|
-
|
|
574
|
-
|
|
542
|
+
onPlanUpdate: async (payload) => {
|
|
543
|
+
if (payload.phase === "update") return await draftPreview.pushPlanProgress(payload.steps, { explanation: payload.explanation });
|
|
544
|
+
return false;
|
|
545
|
+
},
|
|
546
|
+
onApprovalEvent: async (payload) => {
|
|
547
|
+
return await draftPreview.pushApprovalEvent(payload);
|
|
548
|
+
},
|
|
549
|
+
onCommandOutput: async (payload) => {
|
|
550
|
+
if (isFailedProgress(payload)) return false;
|
|
551
|
+
return await draftPreview.pushCommandOutputEvent(payload);
|
|
552
|
+
},
|
|
553
|
+
onPatchSummary: async (payload) => {
|
|
554
|
+
return await draftPreview.pushPatchEvent(payload);
|
|
555
|
+
},
|
|
556
|
+
onCompactionStart: async () => {
|
|
557
|
+
if (!isProcessAborted$1(abortSignal)) await params.reactions.controller.setCompacting();
|
|
558
|
+
return false;
|
|
559
|
+
},
|
|
560
|
+
onCompactionEnd: async () => {
|
|
561
|
+
if (!isProcessAborted$1(abortSignal)) {
|
|
562
|
+
params.reactions.controller.cancelPending();
|
|
563
|
+
await params.reactions.controller.setThinking();
|
|
564
|
+
}
|
|
565
|
+
return false;
|
|
566
|
+
}
|
|
567
|
+
} };
|
|
575
568
|
}
|
|
576
569
|
//#endregion
|
|
577
570
|
//#region extensions/discord/src/monitor/ack-reactions.ts
|
|
@@ -798,7 +791,7 @@ function createDiscordDraftStream(params) {
|
|
|
798
791
|
let streamGeneration = 0;
|
|
799
792
|
let activeCreateGeneration;
|
|
800
793
|
let discardActiveCreate = false;
|
|
801
|
-
let
|
|
794
|
+
let pendingCleanupMessages = [];
|
|
802
795
|
const sendOrEditStreamMessage = async (text) => {
|
|
803
796
|
const generation = streamGeneration;
|
|
804
797
|
if (streamState.stopped && !streamState.final) return false;
|
|
@@ -839,11 +832,11 @@ function createDiscordDraftStream(params) {
|
|
|
839
832
|
activeCreateGeneration = void 0;
|
|
840
833
|
discardActiveCreate = false;
|
|
841
834
|
if (generation !== streamGeneration) {
|
|
842
|
-
if (shouldDiscardStaleCreate && typeof sentMessageId === "string" && sentMessageId)
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
}
|
|
835
|
+
if (shouldDiscardStaleCreate && typeof sentMessageId === "string" && sentMessageId) await deleteCleanupMessage({
|
|
836
|
+
channelId,
|
|
837
|
+
messageId: sentMessageId,
|
|
838
|
+
warnPrefix: "discord stale stream preview cleanup failed"
|
|
839
|
+
});
|
|
847
840
|
return true;
|
|
848
841
|
}
|
|
849
842
|
if (typeof sentMessageId !== "string" || !sentMessageId) {
|
|
@@ -864,24 +857,10 @@ function createDiscordDraftStream(params) {
|
|
|
864
857
|
return false;
|
|
865
858
|
}
|
|
866
859
|
};
|
|
867
|
-
const
|
|
868
|
-
const clearMessageId = () => {
|
|
869
|
-
streamMessageId = void 0;
|
|
870
|
-
};
|
|
871
|
-
const isValidStreamMessageId = (value) => typeof value === "string";
|
|
872
|
-
const deleteStreamMessage = async (messageId) => {
|
|
873
|
-
await deleteChannelMessage(rest, channelId, messageId);
|
|
874
|
-
};
|
|
875
|
-
const { loop, update, stop, clear, discardPending, seal } = createFinalizableDraftLifecycle({
|
|
860
|
+
const { loop, update, stop, discardPending, seal } = createFinalizableDraftStreamControlsForState({
|
|
876
861
|
throttleMs,
|
|
877
862
|
state: streamState,
|
|
878
|
-
sendOrEditStreamMessage
|
|
879
|
-
readMessageId,
|
|
880
|
-
clearMessageId,
|
|
881
|
-
isValidMessageId: isValidStreamMessageId,
|
|
882
|
-
deleteMessage: deleteStreamMessage,
|
|
883
|
-
warn: params.warn,
|
|
884
|
-
warnPrefix: "discord stream preview cleanup failed"
|
|
863
|
+
sendOrEditStreamMessage
|
|
885
864
|
});
|
|
886
865
|
const forceNewMessage = (mode = "preserve") => {
|
|
887
866
|
if (mode === "discard" && activeCreateGeneration !== void 0) discardActiveCreate = true;
|
|
@@ -893,16 +872,19 @@ function createDiscordDraftStream(params) {
|
|
|
893
872
|
loop.resetPending();
|
|
894
873
|
loop.resetThrottleWindow();
|
|
895
874
|
};
|
|
896
|
-
const
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
for (const stale of pending) try {
|
|
900
|
-
await deleteChannelMessage(rest, stale.channelId, stale.messageId);
|
|
875
|
+
const deleteCleanupMessage = async (message) => {
|
|
876
|
+
try {
|
|
877
|
+
await deleteChannelMessage(rest, message.channelId, message.messageId);
|
|
901
878
|
} catch (err) {
|
|
902
|
-
|
|
903
|
-
params.warn?.(
|
|
879
|
+
pendingCleanupMessages.push(message);
|
|
880
|
+
params.warn?.(`${message.warnPrefix}: ${formatErrorMessage(err)}`);
|
|
904
881
|
}
|
|
905
882
|
};
|
|
883
|
+
const cleanupPendingMessages = async () => {
|
|
884
|
+
const pending = pendingCleanupMessages;
|
|
885
|
+
pendingCleanupMessages = [];
|
|
886
|
+
for (const message of pending) await deleteCleanupMessage(message);
|
|
887
|
+
};
|
|
906
888
|
const retarget = async (nextChannelId) => {
|
|
907
889
|
const normalized = nextChannelId.trim();
|
|
908
890
|
if (!normalized || normalized === channelId) return;
|
|
@@ -925,33 +907,33 @@ function createDiscordDraftStream(params) {
|
|
|
925
907
|
if (previousMessageId) {
|
|
926
908
|
const stale = {
|
|
927
909
|
channelId: previousChannelId,
|
|
928
|
-
messageId: previousMessageId
|
|
910
|
+
messageId: previousMessageId,
|
|
911
|
+
warnPrefix: "discord stream preview retarget cleanup failed"
|
|
929
912
|
};
|
|
930
913
|
if (!streamMessageId) {
|
|
931
|
-
|
|
914
|
+
pendingCleanupMessages.push(stale);
|
|
932
915
|
throw new Error("discord stream preview retarget replacement failed");
|
|
933
916
|
}
|
|
934
|
-
|
|
935
|
-
await deleteChannelMessage(rest, previousChannelId, previousMessageId);
|
|
936
|
-
} catch (err) {
|
|
937
|
-
retargetedCleanup.push(stale);
|
|
938
|
-
params.warn?.(`discord stream preview retarget cleanup failed: ${formatErrorMessage(err)}`);
|
|
939
|
-
}
|
|
917
|
+
await deleteCleanupMessage(stale);
|
|
940
918
|
}
|
|
941
919
|
};
|
|
942
920
|
const deleteCurrentMessage = async () => {
|
|
943
921
|
loop.resetPending();
|
|
944
922
|
await loop.waitForInFlight();
|
|
945
|
-
const
|
|
923
|
+
const currentMessage = streamMessageId ? {
|
|
924
|
+
channelId,
|
|
925
|
+
messageId: streamMessageId,
|
|
926
|
+
warnPrefix: "discord stream preview cleanup failed"
|
|
927
|
+
} : void 0;
|
|
946
928
|
streamMessageId = void 0;
|
|
947
929
|
lastSentText = "";
|
|
948
930
|
loop.resetThrottleWindow();
|
|
949
|
-
if (!
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
931
|
+
if (!currentMessage) return;
|
|
932
|
+
await deleteCleanupMessage(currentMessage);
|
|
933
|
+
};
|
|
934
|
+
const clear = async () => {
|
|
935
|
+
await discardPending();
|
|
936
|
+
await deleteCurrentMessage();
|
|
955
937
|
};
|
|
956
938
|
params.log?.(`discord stream preview ready (maxChars=${maxChars}, throttleMs=${throttleMs})`);
|
|
957
939
|
return {
|
|
@@ -964,7 +946,7 @@ function createDiscordDraftStream(params) {
|
|
|
964
946
|
seal,
|
|
965
947
|
stop,
|
|
966
948
|
retarget,
|
|
967
|
-
|
|
949
|
+
cleanupPendingMessages,
|
|
968
950
|
forceNewMessage
|
|
969
951
|
};
|
|
970
952
|
}
|
|
@@ -1004,7 +986,7 @@ function createDiscordDraftPreviewController(params) {
|
|
|
1004
986
|
let draftText = "";
|
|
1005
987
|
let hasStreamedMessage = false;
|
|
1006
988
|
let finalizedViaPreviewMessage = false;
|
|
1007
|
-
let
|
|
989
|
+
let finalReplyError;
|
|
1008
990
|
let progressDraftStartedBeforeFinal = false;
|
|
1009
991
|
let progressDraftCollapsed = false;
|
|
1010
992
|
let progressNarratorLifecycle;
|
|
@@ -1067,7 +1049,7 @@ function createDiscordDraftPreviewController(params) {
|
|
|
1067
1049
|
if (beganNewTurn) {
|
|
1068
1050
|
progressDraftCollapsed = false;
|
|
1069
1051
|
progressDraftStartedBeforeFinal = false;
|
|
1070
|
-
|
|
1052
|
+
finalReplyError = void 0;
|
|
1071
1053
|
finalizedViaPreviewMessage = false;
|
|
1072
1054
|
progressNarratorLifecycle?.beginTurn();
|
|
1073
1055
|
}
|
|
@@ -1110,8 +1092,8 @@ function createDiscordDraftPreviewController(params) {
|
|
|
1110
1092
|
progressDraft.markFinalReplyStarted();
|
|
1111
1093
|
progressNarratorLifecycle?.stopTurn();
|
|
1112
1094
|
},
|
|
1113
|
-
markFinalReplyDelivered() {
|
|
1114
|
-
|
|
1095
|
+
markFinalReplyDelivered(isError = false) {
|
|
1096
|
+
finalReplyError = isError;
|
|
1115
1097
|
progressDraft.markFinalReplyDelivered();
|
|
1116
1098
|
},
|
|
1117
1099
|
markPreviewFinalized() {
|
|
@@ -1120,14 +1102,11 @@ function createDiscordDraftPreviewController(params) {
|
|
|
1120
1102
|
async retarget(channelId) {
|
|
1121
1103
|
await draftStream?.retarget(channelId);
|
|
1122
1104
|
},
|
|
1123
|
-
async
|
|
1105
|
+
async finalizeProgressDraft() {
|
|
1124
1106
|
if (!draftStream || discordStreamMode !== "progress") return false;
|
|
1125
|
-
const receipt = receiptLine.trim();
|
|
1126
|
-
if (!receipt) return false;
|
|
1127
1107
|
const progressText = lastPartialText.trimEnd();
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
draftStream.update(fittedProgressText ? `${fittedProgressText}\n${receipt}` : receipt);
|
|
1108
|
+
if (!progressText) return false;
|
|
1109
|
+
draftStream.update(progressText);
|
|
1131
1110
|
await draftStream.stop();
|
|
1132
1111
|
if (!draftStream.messageId()) return false;
|
|
1133
1112
|
finalizedViaPreviewMessage = true;
|
|
@@ -1152,11 +1131,10 @@ function createDiscordDraftPreviewController(params) {
|
|
|
1152
1131
|
return await progressDraft.pushNarrationProgress(text);
|
|
1153
1132
|
},
|
|
1154
1133
|
pushPreambleHeadline,
|
|
1155
|
-
async pushPreambleItemEvent(payload
|
|
1134
|
+
async pushPreambleItemEvent(payload) {
|
|
1156
1135
|
const headlineAccepted = await pushPreambleHeadline(payload.progressText, { itemId: payload.itemId });
|
|
1157
1136
|
if (!progressDraft.commentaryProgressEnabled) return headlineAccepted;
|
|
1158
1137
|
const commentaryAccepted = await progressDraft.pushCommentaryProgress(payload.progressText, { itemId: payload.itemId });
|
|
1159
|
-
if (commentaryAccepted) noteCommentary(payload.itemId, payload.progressText);
|
|
1160
1138
|
return headlineAccepted || commentaryAccepted;
|
|
1161
1139
|
},
|
|
1162
1140
|
async pushCommentaryProgress(text, options) {
|
|
@@ -1240,9 +1218,9 @@ function createDiscordDraftPreviewController(params) {
|
|
|
1240
1218
|
async cleanup() {
|
|
1241
1219
|
try {
|
|
1242
1220
|
progressDraft.cancel();
|
|
1243
|
-
if (
|
|
1244
|
-
if (!finalizedViaPreviewMessage && draftStream?.messageId()) await draftStream.clear();
|
|
1245
|
-
await draftStream?.
|
|
1221
|
+
if (finalReplyError !== false) await draftStream?.discardPending();
|
|
1222
|
+
if (finalReplyError !== true && !finalizedViaPreviewMessage && draftStream?.messageId()) await draftStream.clear();
|
|
1223
|
+
await draftStream?.cleanupPendingMessages();
|
|
1246
1224
|
} catch (err) {
|
|
1247
1225
|
params.log(`discord: draft cleanup failed: ${String(err)}`);
|
|
1248
1226
|
}
|
|
@@ -1411,16 +1389,6 @@ function createDiscordMessageReplyRuntime(params) {
|
|
|
1411
1389
|
}
|
|
1412
1390
|
//#endregion
|
|
1413
1391
|
//#region extensions/discord/src/monitor/message-handler.process-thread-route.ts
|
|
1414
|
-
async function finalizeDiscordAdoptedThreadProgressReceipt(hasProgressDraft, receipt, finalizeDraft, deliverReceipt, onFinalizeError) {
|
|
1415
|
-
const receiptLine = receipt.trim();
|
|
1416
|
-
if (!hasProgressDraft || !receiptLine) return;
|
|
1417
|
-
try {
|
|
1418
|
-
if (await finalizeDraft(receiptLine)) return;
|
|
1419
|
-
} catch (error) {
|
|
1420
|
-
onFinalizeError?.(error);
|
|
1421
|
-
}
|
|
1422
|
-
await deliverReceipt(receiptLine);
|
|
1423
|
-
}
|
|
1424
1392
|
function createDiscordMessageActiveThreadRoute(params) {
|
|
1425
1393
|
let adoptedThreadId;
|
|
1426
1394
|
let threadReplyDelivered = false;
|
|
@@ -1487,7 +1455,7 @@ async function processDiscordMessageInner(ctx, observer) {
|
|
|
1487
1455
|
}
|
|
1488
1456
|
});
|
|
1489
1457
|
const sourceRepliesAreToolOnly = sourceReplyDeliveryMode === "message_tool_only";
|
|
1490
|
-
const configuredTypingMode = resolveAgentConfig(cfg, route.agentId)?.typingMode ?? cfg.agents?.defaults?.typingMode;
|
|
1458
|
+
const configuredTypingMode = resolveAgentConfig$1(cfg, route.agentId)?.typingMode ?? cfg.agents?.defaults?.typingMode;
|
|
1491
1459
|
const configuredTypingInterval = cfg.agents?.defaults?.typingIntervalSeconds;
|
|
1492
1460
|
const shouldDisableCoreTypingKeepalive = sourceRepliesAreToolOnly && configuredTypingMode === void 0 && configuredTypingInterval === void 0;
|
|
1493
1461
|
const mediaLocalRoots = getAgentScopedMediaLocalRoots(cfg, route.agentId);
|
|
@@ -1547,21 +1515,21 @@ async function processDiscordMessageInner(ctx, observer) {
|
|
|
1547
1515
|
let userFacingFinalDelivered = false;
|
|
1548
1516
|
let userFacingFinalDeliveryFailed = false;
|
|
1549
1517
|
let pendingToolWarningFinal;
|
|
1550
|
-
const
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1518
|
+
const markFinalReplyDelivered = (isError = false) => {
|
|
1519
|
+
draftPreview.markFinalReplyDelivered(isError);
|
|
1520
|
+
if (!isError) {
|
|
1521
|
+
userFacingFinalDelivered = true;
|
|
1522
|
+
userFacingFinalDeliveryFailed = false;
|
|
1523
|
+
pendingToolWarningFinal = void 0;
|
|
1524
|
+
observer?.onFinalReplyDelivered?.();
|
|
1525
|
+
}
|
|
1556
1526
|
};
|
|
1557
|
-
let progressReceiptLine;
|
|
1558
1527
|
let clearProgressDraftAfterFinalDelivery = false;
|
|
1559
1528
|
const resetDeliveryState = () => {
|
|
1560
1529
|
finalReplyStartNotified = false;
|
|
1561
1530
|
userFacingFinalDelivered = false;
|
|
1562
1531
|
userFacingFinalDeliveryFailed = false;
|
|
1563
1532
|
pendingToolWarningFinal = void 0;
|
|
1564
|
-
progressReceiptLine = void 0;
|
|
1565
1533
|
clearProgressDraftAfterFinalDelivery = false;
|
|
1566
1534
|
};
|
|
1567
1535
|
const progress = createDiscordMessageProgressRuntime({
|
|
@@ -1629,7 +1597,8 @@ async function processDiscordMessageInner(ctx, observer) {
|
|
|
1629
1597
|
threadBindings,
|
|
1630
1598
|
mediaLocalRoots,
|
|
1631
1599
|
kind: "block",
|
|
1632
|
-
bindPendingFinalDelivery: info.bindPendingFinalDelivery
|
|
1600
|
+
bindPendingFinalDelivery: info.bindPendingFinalDelivery,
|
|
1601
|
+
onPlatformSendDispatch: info.onPlatformSendDispatch
|
|
1633
1602
|
});
|
|
1634
1603
|
if (result.visibleReplySent) replyReference.markSent();
|
|
1635
1604
|
return result;
|
|
@@ -1666,7 +1635,6 @@ async function processDiscordMessageInner(ctx, observer) {
|
|
|
1666
1635
|
}
|
|
1667
1636
|
if (draftStream && isFinal && draftPreview.isProgressMode && !deliverablePayload.isError && draftPreview.hasProgressDraftToCollapse && draftStream) {
|
|
1668
1637
|
await draftPreview.flush();
|
|
1669
|
-
progressReceiptLine = progress.buildProgressSummaryLine();
|
|
1670
1638
|
clearProgressDraftAfterFinalDelivery = true;
|
|
1671
1639
|
}
|
|
1672
1640
|
if (draftStream && isFinal && !draftPreview.isProgressMode && !deliverablePayload.isError) {
|
|
@@ -1693,7 +1661,7 @@ async function processDiscordMessageInner(ctx, observer) {
|
|
|
1693
1661
|
});
|
|
1694
1662
|
},
|
|
1695
1663
|
onPreviewFinalized: () => {
|
|
1696
|
-
|
|
1664
|
+
markFinalReplyDelivered();
|
|
1697
1665
|
draftPreview.markPreviewFinalized();
|
|
1698
1666
|
replyReference.markSent();
|
|
1699
1667
|
},
|
|
@@ -1729,11 +1697,12 @@ async function processDiscordMessageInner(ctx, observer) {
|
|
|
1729
1697
|
mediaLocalRoots,
|
|
1730
1698
|
allowedMentions,
|
|
1731
1699
|
kind: info.kind,
|
|
1732
|
-
bindPendingFinalDelivery: info.bindPendingFinalDelivery
|
|
1700
|
+
bindPendingFinalDelivery: info.bindPendingFinalDelivery,
|
|
1701
|
+
onPlatformSendDispatch: info.onPlatformSendDispatch
|
|
1733
1702
|
})).visibleReplySent;
|
|
1734
1703
|
},
|
|
1735
1704
|
onNormalDelivered: () => {
|
|
1736
|
-
|
|
1705
|
+
markFinalReplyDelivered();
|
|
1737
1706
|
replyReference.markSent();
|
|
1738
1707
|
}
|
|
1739
1708
|
})).kind !== "normal-skipped") return { visibleReplySent: true };
|
|
@@ -1749,14 +1718,9 @@ async function processDiscordMessageInner(ctx, observer) {
|
|
|
1749
1718
|
}
|
|
1750
1719
|
const replyToId = replyReference.use();
|
|
1751
1720
|
if (isFinal) notifyFinalReplyStart();
|
|
1752
|
-
const receiptLine = isFinal && deliverablePayload.isError !== true ? progressReceiptLine : void 0;
|
|
1753
|
-
const payloadForDelivery = receiptLine ? {
|
|
1754
|
-
...deliverablePayload,
|
|
1755
|
-
text: deliverablePayload.text?.trim() ? `${deliverablePayload.text.trimEnd()}\n${receiptLine}` : receiptLine
|
|
1756
|
-
} : deliverablePayload;
|
|
1757
1721
|
const result = await deliverDiscordReply({
|
|
1758
1722
|
cfg,
|
|
1759
|
-
replies: [
|
|
1723
|
+
replies: [deliverablePayload],
|
|
1760
1724
|
target: deliverTarget,
|
|
1761
1725
|
token,
|
|
1762
1726
|
accountId,
|
|
@@ -1772,18 +1736,16 @@ async function processDiscordMessageInner(ctx, observer) {
|
|
|
1772
1736
|
threadBindings,
|
|
1773
1737
|
mediaLocalRoots,
|
|
1774
1738
|
kind: info.kind,
|
|
1775
|
-
bindPendingFinalDelivery: info.bindPendingFinalDelivery
|
|
1739
|
+
bindPendingFinalDelivery: info.bindPendingFinalDelivery,
|
|
1740
|
+
onPlatformSendDispatch: info.onPlatformSendDispatch
|
|
1776
1741
|
});
|
|
1777
1742
|
if (!result.visibleReplySent) return result;
|
|
1778
1743
|
replyReference.markSent();
|
|
1779
|
-
if (isFinal
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
draftPreview.markProgressDraftCollapsed();
|
|
1783
|
-
}
|
|
1784
|
-
markUserFacingFinalDelivered();
|
|
1785
|
-
if (clearProgressDraftAfterFinalDelivery) {
|
|
1744
|
+
if (isFinal) {
|
|
1745
|
+
markFinalReplyDelivered(deliverablePayload.isError === true);
|
|
1746
|
+
if (deliverablePayload.isError !== true && clearProgressDraftAfterFinalDelivery) {
|
|
1786
1747
|
clearProgressDraftAfterFinalDelivery = false;
|
|
1748
|
+
draftPreview.markProgressDraftCollapsed();
|
|
1787
1749
|
await draftStream?.discardPending();
|
|
1788
1750
|
await draftStream?.clear();
|
|
1789
1751
|
}
|
|
@@ -1880,8 +1842,12 @@ async function processDiscordMessageInner(ctx, observer) {
|
|
|
1880
1842
|
}
|
|
1881
1843
|
if (activeThreadRoute.threadReplyDelivered && !userFacingFinalDelivered) {
|
|
1882
1844
|
draftPreview.markFinalReplyStarted();
|
|
1883
|
-
|
|
1884
|
-
|
|
1845
|
+
if (draftPreview.hasProgressDraftToCollapse) try {
|
|
1846
|
+
await draftPreview.finalizeProgressDraft();
|
|
1847
|
+
} catch (error) {
|
|
1848
|
+
logVerbose(`discord: failed to finalize adopted thread progress (${String(error)})`);
|
|
1849
|
+
}
|
|
1850
|
+
markFinalReplyDelivered();
|
|
1885
1851
|
}
|
|
1886
1852
|
} catch (err) {
|
|
1887
1853
|
if (isProcessAborted(abortSignal)) {
|
|
@@ -1889,14 +1855,18 @@ async function processDiscordMessageInner(ctx, observer) {
|
|
|
1889
1855
|
return;
|
|
1890
1856
|
}
|
|
1891
1857
|
dispatchError = true;
|
|
1892
|
-
if (await completeDiscordSessionConflict(err,
|
|
1858
|
+
if (await completeDiscordSessionConflict(err, (payload, info) => deliverDiscordPayload(payload, {
|
|
1859
|
+
...info,
|
|
1860
|
+
onPlatformSendDispatch: () => Promise.resolve()
|
|
1861
|
+
}), onDiscordDeliveryError)) return;
|
|
1893
1862
|
throw err;
|
|
1894
1863
|
} finally {
|
|
1895
1864
|
activeThreadRoute.end();
|
|
1896
1865
|
endDeliveryCorrelation();
|
|
1897
1866
|
await draftPreview.cleanup();
|
|
1898
1867
|
dispatchError ||= readAgentRunTerminalOutcome(dispatchResult) === "failed";
|
|
1899
|
-
const
|
|
1868
|
+
const finalReceipt = dispatchResult?.settledReceipt?.counts.final;
|
|
1869
|
+
const finalDeliveryFailed = (finalReceipt?.failedBeforeSend ?? 0) + (finalReceipt?.failedAfterSend ?? 0) > 0;
|
|
1900
1870
|
await reactions.finish({
|
|
1901
1871
|
dispatchAborted,
|
|
1902
1872
|
dispatchError,
|
|
@@ -1907,7 +1877,7 @@ async function processDiscordMessageInner(ctx, observer) {
|
|
|
1907
1877
|
const finalDispatchResult = dispatchResult;
|
|
1908
1878
|
if (!finalDispatchResult || !hasFinalInboundReplyDispatch(finalDispatchResult)) return;
|
|
1909
1879
|
if (shouldLogVerbose()) {
|
|
1910
|
-
const finalCount = finalDispatchResult.counts.final;
|
|
1880
|
+
const finalCount = finalDispatchResult.settledReceipt?.counts.final.delivered ?? 0;
|
|
1911
1881
|
logVerbose(`discord: delivered ${finalCount} reply${finalCount === 1 ? "" : "ies"} to ${replyTarget}`);
|
|
1912
1882
|
}
|
|
1913
1883
|
}
|