@openclaw/discord 2026.9.5 → 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/dist/.setup/{activities-api-DBwRt5ES.mjs → activities-api-COU4-0nR.mjs} +4 -4
- package/dist/.setup/{approval-handler.runtime-Du3n5ypX.mjs → approval-handler.runtime-CbBktBb4.mjs} +5 -5
- package/dist/.setup/{approval-message-updates-BN7JtScm.mjs → approval-message-updates-jf9zMaIC.mjs} +1 -1
- package/dist/.setup/{audit-C8uaKoa9.mjs → audit-vKbh-LFR.mjs} +3 -3
- package/dist/.setup/{channel-ChKdlBgH.mjs → channel-Dv4e3Jpc.mjs} +19 -16
- package/dist/.setup/{channel-actions.runtime-CJmiFfps.mjs → channel-actions.runtime-leZuw01r.mjs} +13 -7
- package/dist/.setup/{channel.setup-BlC3-Kzz.mjs → channel.setup-0NX6FFwi.mjs} +1 -1
- package/dist/.setup/{components-MqMWUWnE.mjs → components-yBEb75bB.mjs} +1 -2
- package/dist/.setup/{conversation-binding-route-_rz33QHO.mjs → conversation-binding-route-B7qImK_b.mjs} +6 -3
- package/dist/.setup/{doctor-DxcdkXzz.mjs → doctor-D1R-uFIu.mjs} +2 -2
- package/dist/.setup/{handle-action.guild-admin-DAFyh_yV.mjs → handle-action.guild-admin-DcFa8NwA.mjs} +3 -3
- package/dist/.setup/{message-handler-DnUrDpaU.mjs → message-handler-X6ejmbtY.mjs} +6 -5
- package/dist/.setup/{message-handler.preflight-CtqaF_fb.mjs → message-handler.preflight-DE_POxFc.mjs} +14 -117
- package/dist/.setup/message-handler.preflight-pluralkit-8Xji34AF.mjs +143 -0
- package/dist/.setup/{message-handler.process-Dz1xvuQU.mjs → message-handler.process-CCmIVnxy.mjs} +387 -317
- package/dist/.setup/{outbound-adapter-C8v79z9Z.mjs → outbound-adapter-ClIgmu4F.mjs} +5 -5
- package/dist/.setup/{outbound-session-route-CqWbuMOm.mjs → outbound-session-route-VulUE0yV.mjs} +7 -6
- package/dist/.setup/{preflight-audio-DrnqFA8U.mjs → preflight-audio-DHGIHEpv.mjs} +2 -1
- package/dist/.setup/{provider-72zIvN-i.mjs → provider-iOf73HW-.mjs} +425 -286
- package/dist/.setup/{provider-session.runtime-BW7QrF5C.mjs → provider-session.runtime-DrGAYnZv.mjs} +3 -3
- package/dist/.setup/provider.runtime-BmjW_pIw.mjs +2 -0
- package/dist/.setup/{realtime-session.runtime-DTccTgTM.mjs → realtime-session.runtime-Dz8uVutq.mjs} +338 -297
- package/dist/.setup/receive-recovery-DHst8WRx.mjs +517 -0
- package/dist/.setup/{retry-DBfcEgmO.mjs → retry-BEYkDy0P.mjs} +78 -13
- package/dist/.setup/{runtime-SchNfUsQ.mjs → runtime-B8lJfyrA.mjs} +30 -11
- package/dist/.setup/{runtime-BVoa7hhx.mjs → runtime-DisDbixd.mjs} +1 -1
- package/dist/.setup/{send-CKDczUNL.mjs → send-CIBzvXjS.mjs} +23 -9
- package/dist/.setup/{send.components-DWQjXhPV.mjs → send.components-ChY21qr-.mjs} +4 -4
- package/dist/.setup/{send.outbound-D0hQ7s50.mjs → send.outbound-QTyuFupn.mjs} +15 -16
- package/dist/.setup/{send.shared-Zwx6BxQ5.mjs → send.shared-VNvWfX2T.mjs} +2 -2
- package/dist/.setup/setup-plugin-api-Dvr41dyx.mjs +3 -0
- package/dist/.setup/{shared-CaA3Vv4n.mjs → shared-DHPDaMSx.mjs} +1 -1
- package/dist/.setup/{subagent-hooks-Bired9q6.mjs → subagent-hooks-CjW7r8Pe.mjs} +1 -1
- package/dist/.setup/{target-resolver-B6MrxbYv.mjs → target-resolver-BXpy6VT8.mjs} +1 -1
- package/dist/.setup/targets-CvemhN3i.mjs +3 -0
- package/dist/.setup/{thread-bindings-CK5272V3.mjs → thread-bindings-CEh2dhqP.mjs} +3 -3
- package/dist/.setup/{thread-bindings.manager-eexkKyrG.mjs → thread-bindings.manager-ve-i6oqt.mjs} +94 -45
- package/dist/.setup/{transcripts-source-CuWYgayu.mjs → transcripts-source-DVegW0WI.mjs} +61 -7
- package/dist/.setup/{voice-runtime-DHVQ2mFz.mjs → voice-runtime-elTtjEIG.mjs} +553 -901
- package/dist/action-runtime-api.js +1 -1
- package/dist/activities-api.js +1 -1
- package/dist/api.js +10 -10
- package/dist/channel-plugin-api.js +1 -1
- package/dist/index.js +1 -1
- package/dist/runtime-api.js +12 -12
- package/dist/setup-entry.js +1 -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 +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/package.json +2 -2
- package/node_modules/@types/node/web-globals/streams.d.ts +4 -0
- package/node_modules/zod/README.md +2 -2
- package/node_modules/zod/compile.cjs +19 -0
- package/node_modules/zod/index.cjs +19 -0
- package/node_modules/zod/locales/index.cjs +19 -0
- package/node_modules/zod/mini/index.cjs +19 -0
- package/node_modules/zod/package.json +8 -7
- package/node_modules/zod/src/v3/helpers/errorUtil.ts +1 -1
- package/node_modules/zod/src/v4/classic/external.ts +2 -0
- package/node_modules/zod/src/v4/classic/from-json-schema.ts +248 -25
- package/node_modules/zod/src/v4/classic/schemas.ts +243 -168
- package/node_modules/zod/src/v4/classic/tests/assignability.test.ts +60 -9
- package/node_modules/zod/src/v4/classic/tests/bigint.test.ts +6 -0
- package/node_modules/zod/src/v4/classic/tests/continuability.test.ts +2 -2
- package/node_modules/zod/src/v4/classic/tests/cyclic-data.test.ts +265 -0
- package/node_modules/zod/src/v4/classic/tests/discriminated-unions.test.ts +112 -6
- package/node_modules/zod/src/v4/classic/tests/enum.test.ts +9 -0
- package/node_modules/zod/src/v4/classic/tests/error.test.ts +130 -1
- package/node_modules/zod/src/v4/classic/tests/from-json-schema.test.ts +157 -0
- package/node_modules/zod/src/v4/classic/tests/iban.test.ts +81 -0
- package/node_modules/zod/src/v4/classic/tests/instance-footprint.test.ts +40 -2
- package/node_modules/zod/src/v4/classic/tests/instanceof.test.ts +27 -7
- package/node_modules/zod/src/v4/classic/tests/issue-schema.test.ts +88 -56
- package/node_modules/zod/src/v4/classic/tests/number.test.ts +39 -0
- package/node_modules/zod/src/v4/classic/tests/object.test.ts +56 -0
- package/node_modules/zod/src/v4/classic/tests/optin-ladder.test.ts +3 -2
- package/node_modules/zod/src/v4/classic/tests/prefault.test.ts +70 -0
- package/node_modules/zod/src/v4/classic/tests/properties.test.ts +141 -0
- package/node_modules/zod/src/v4/classic/tests/recursive-types.test.ts +46 -1
- 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 +95 -1
- package/node_modules/zod/src/v4/classic/tests/template-literal.test.ts +33 -1
- package/node_modules/zod/src/v4/classic/tests/to-json-schema.test.ts +234 -38
- package/node_modules/zod/src/v4/classic/tests/validate.test.ts +569 -0
- package/node_modules/zod/src/v4/core/api.ts +44 -28
- package/node_modules/zod/src/v4/core/checks.ts +62 -102
- package/node_modules/zod/src/v4/core/compile.ts +218 -93
- package/node_modules/zod/src/v4/core/core.ts +1 -3
- package/node_modules/zod/src/v4/core/doc.ts +6 -2
- package/node_modules/zod/src/v4/core/errors.ts +3 -6
- package/node_modules/zod/src/v4/core/json-schema-generator.ts +2 -2
- package/node_modules/zod/src/v4/core/json-schema-processors.ts +185 -81
- package/node_modules/zod/src/v4/core/memoizer.ts +75 -28
- package/node_modules/zod/src/v4/core/parse.ts +37 -16
- package/node_modules/zod/src/v4/core/regexes.ts +14 -4
- package/node_modules/zod/src/v4/core/schemas.ts +296 -132
- 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 +35 -0
- package/node_modules/zod/src/v4/core/tests/compile-generative.test.ts +445 -0
- package/node_modules/zod/src/v4/core/tests/compile.test.ts +399 -2
- package/node_modules/zod/src/v4/core/tests/email-regex.test.ts +140 -0
- package/node_modules/zod/src/v4/core/tests/locales/tg.test.ts +85 -0
- package/node_modules/zod/src/v4/core/tests/polyfill-collision.test.ts +46 -0
- package/node_modules/zod/src/v4/core/tests/url-no-canparse.test.ts +118 -16
- package/node_modules/zod/src/v4/core/to-json-schema.ts +9 -7
- package/node_modules/zod/src/v4/core/util.ts +218 -147
- package/node_modules/zod/src/v4/core/versions.ts +2 -2
- package/node_modules/zod/src/v4/locales/ar.ts +2 -0
- package/node_modules/zod/src/v4/locales/az.ts +2 -0
- package/node_modules/zod/src/v4/locales/be.ts +2 -0
- package/node_modules/zod/src/v4/locales/bg.ts +2 -0
- package/node_modules/zod/src/v4/locales/bn.ts +2 -0
- package/node_modules/zod/src/v4/locales/ca.ts +2 -0
- package/node_modules/zod/src/v4/locales/ckb.ts +2 -0
- package/node_modules/zod/src/v4/locales/cs.ts +2 -0
- package/node_modules/zod/src/v4/locales/da.ts +2 -0
- package/node_modules/zod/src/v4/locales/de.ts +2 -0
- package/node_modules/zod/src/v4/locales/el.ts +2 -0
- package/node_modules/zod/src/v4/locales/en.ts +2 -0
- package/node_modules/zod/src/v4/locales/eo.ts +2 -0
- package/node_modules/zod/src/v4/locales/es.ts +2 -0
- package/node_modules/zod/src/v4/locales/fa.ts +2 -0
- package/node_modules/zod/src/v4/locales/fi.ts +2 -0
- package/node_modules/zod/src/v4/locales/fr-CA.ts +2 -0
- package/node_modules/zod/src/v4/locales/fr.ts +2 -0
- package/node_modules/zod/src/v4/locales/gu.ts +2 -0
- package/node_modules/zod/src/v4/locales/he.ts +2 -0
- package/node_modules/zod/src/v4/locales/hi.ts +2 -0
- package/node_modules/zod/src/v4/locales/hr.ts +2 -0
- package/node_modules/zod/src/v4/locales/hu.ts +2 -0
- package/node_modules/zod/src/v4/locales/hy.ts +2 -0
- package/node_modules/zod/src/v4/locales/id.ts +2 -0
- package/node_modules/zod/src/v4/locales/index.ts +1 -0
- package/node_modules/zod/src/v4/locales/is.ts +2 -0
- package/node_modules/zod/src/v4/locales/it.ts +2 -0
- package/node_modules/zod/src/v4/locales/ja.ts +2 -0
- package/node_modules/zod/src/v4/locales/ka.ts +2 -0
- package/node_modules/zod/src/v4/locales/km.ts +2 -0
- package/node_modules/zod/src/v4/locales/kn.ts +2 -0
- package/node_modules/zod/src/v4/locales/ko.ts +2 -0
- package/node_modules/zod/src/v4/locales/lt.ts +2 -0
- package/node_modules/zod/src/v4/locales/mk.ts +2 -0
- package/node_modules/zod/src/v4/locales/ms.ts +2 -0
- package/node_modules/zod/src/v4/locales/ne.ts +2 -0
- package/node_modules/zod/src/v4/locales/nl.ts +2 -0
- package/node_modules/zod/src/v4/locales/nn.ts +2 -0
- package/node_modules/zod/src/v4/locales/no.ts +2 -0
- package/node_modules/zod/src/v4/locales/ota.ts +2 -0
- package/node_modules/zod/src/v4/locales/pl.ts +2 -0
- package/node_modules/zod/src/v4/locales/ps.ts +2 -0
- package/node_modules/zod/src/v4/locales/pt-BR.ts +2 -0
- package/node_modules/zod/src/v4/locales/pt.ts +2 -0
- package/node_modules/zod/src/v4/locales/ro.ts +2 -0
- package/node_modules/zod/src/v4/locales/ru.ts +2 -0
- package/node_modules/zod/src/v4/locales/sk.ts +2 -0
- package/node_modules/zod/src/v4/locales/sl.ts +2 -0
- package/node_modules/zod/src/v4/locales/sv.ts +2 -0
- package/node_modules/zod/src/v4/locales/ta.ts +2 -0
- package/node_modules/zod/src/v4/locales/tg.ts +135 -0
- package/node_modules/zod/src/v4/locales/th.ts +2 -0
- package/node_modules/zod/src/v4/locales/tk.ts +2 -0
- package/node_modules/zod/src/v4/locales/tr.ts +2 -0
- package/node_modules/zod/src/v4/locales/uk.ts +2 -0
- package/node_modules/zod/src/v4/locales/ur.ts +2 -0
- package/node_modules/zod/src/v4/locales/uz.ts +2 -0
- package/node_modules/zod/src/v4/locales/vi.ts +2 -0
- package/node_modules/zod/src/v4/locales/yo.ts +2 -0
- package/node_modules/zod/src/v4/locales/zh-CN.ts +2 -0
- package/node_modules/zod/src/v4/locales/zh-TW.ts +2 -0
- package/node_modules/zod/src/v4/mini/external.ts +2 -0
- package/node_modules/zod/src/v4/mini/schemas.ts +32 -7
- package/node_modules/zod/src/v4/mini/tests/checks.test.ts +1 -1
- package/node_modules/zod/src/v4/mini/tests/computed.test.ts +11 -17
- package/node_modules/zod/src/v4/mini/tests/index.test.ts +86 -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 +23 -0
- package/node_modules/zod/v3/ZodError.cjs +19 -0
- 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 +19 -0
- package/node_modules/zod/v4/classic/checks.cjs +19 -0
- 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/deep-partial.cjs +19 -0
- package/node_modules/zod/v4/classic/errors.cjs +19 -0
- package/node_modules/zod/v4/classic/external.cjs +22 -1
- package/node_modules/zod/v4/classic/external.d.cts +1 -1
- package/node_modules/zod/v4/classic/external.d.ts +1 -1
- package/node_modules/zod/v4/classic/external.js +1 -1
- package/node_modules/zod/v4/classic/from-json-schema.cjs +264 -24
- package/node_modules/zod/v4/classic/from-json-schema.js +245 -24
- package/node_modules/zod/v4/classic/in-out.cjs +19 -0
- package/node_modules/zod/v4/classic/index.cjs +19 -0
- package/node_modules/zod/v4/classic/iso.cjs +19 -0
- package/node_modules/zod/v4/classic/parse.cjs +19 -0
- package/node_modules/zod/v4/classic/schemas.cjs +100 -35
- package/node_modules/zod/v4/classic/schemas.d.cts +15 -1
- package/node_modules/zod/v4/classic/schemas.d.ts +15 -1
- package/node_modules/zod/v4/classic/schemas.js +77 -33
- package/node_modules/zod/v4/core/api.cjs +45 -22
- package/node_modules/zod/v4/core/api.d.cts +12 -6
- package/node_modules/zod/v4/core/api.d.ts +12 -6
- package/node_modules/zod/v4/core/api.js +25 -22
- package/node_modules/zod/v4/core/checks.cjs +51 -97
- package/node_modules/zod/v4/core/checks.d.cts +17 -1
- package/node_modules/zod/v4/core/checks.d.ts +17 -1
- package/node_modules/zod/v4/core/checks.js +31 -96
- package/node_modules/zod/v4/core/compile.cjs +173 -78
- package/node_modules/zod/v4/core/compile.d.cts +18 -4
- package/node_modules/zod/v4/core/compile.d.ts +18 -4
- package/node_modules/zod/v4/core/compile.js +154 -79
- package/node_modules/zod/v4/core/core.cjs +20 -1
- package/node_modules/zod/v4/core/core.js +1 -1
- package/node_modules/zod/v4/core/doc.cjs +26 -2
- package/node_modules/zod/v4/core/doc.js +7 -2
- package/node_modules/zod/v4/core/errors.cjs +21 -5
- package/node_modules/zod/v4/core/errors.js +2 -5
- package/node_modules/zod/v4/core/index.cjs +19 -0
- package/node_modules/zod/v4/core/json-schema-generator.cjs +20 -1
- package/node_modules/zod/v4/core/json-schema-generator.js +2 -2
- package/node_modules/zod/v4/core/json-schema-processors.cjs +188 -72
- 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 +170 -74
- package/node_modules/zod/v4/core/json-schema.cjs +19 -0
- package/node_modules/zod/v4/core/memoizer.cjs +111 -23
- package/node_modules/zod/v4/core/memoizer.js +69 -23
- package/node_modules/zod/v4/core/parse.cjs +56 -16
- package/node_modules/zod/v4/core/parse.js +37 -16
- package/node_modules/zod/v4/core/regexes.cjs +31 -6
- package/node_modules/zod/v4/core/regexes.d.cts +3 -0
- package/node_modules/zod/v4/core/regexes.d.ts +3 -0
- package/node_modules/zod/v4/core/regexes.js +10 -4
- package/node_modules/zod/v4/core/registries.cjs +19 -0
- package/node_modules/zod/v4/core/schemas.cjs +302 -114
- package/node_modules/zod/v4/core/schemas.d.cts +28 -8
- package/node_modules/zod/v4/core/schemas.d.ts +28 -8
- package/node_modules/zod/v4/core/schemas.js +279 -113
- package/node_modules/zod/v4/core/standard-schema.cjs +19 -0
- package/node_modules/zod/v4/core/to-json-schema.cjs +28 -7
- package/node_modules/zod/v4/core/to-json-schema.d.cts +4 -3
- package/node_modules/zod/v4/core/to-json-schema.d.ts +4 -3
- package/node_modules/zod/v4/core/to-json-schema.js +7 -6
- package/node_modules/zod/v4/core/util.cjs +177 -143
- package/node_modules/zod/v4/core/util.d.cts +25 -4
- package/node_modules/zod/v4/core/util.d.ts +25 -4
- package/node_modules/zod/v4/core/util.js +156 -143
- 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 +19 -0
- package/node_modules/zod/v4/index.cjs +19 -0
- package/node_modules/zod/v4/locales/ar.cjs +2 -0
- package/node_modules/zod/v4/locales/ar.js +2 -0
- package/node_modules/zod/v4/locales/az.cjs +2 -0
- package/node_modules/zod/v4/locales/az.js +2 -0
- package/node_modules/zod/v4/locales/be.cjs +2 -0
- package/node_modules/zod/v4/locales/be.js +2 -0
- package/node_modules/zod/v4/locales/bg.cjs +2 -0
- package/node_modules/zod/v4/locales/bg.js +2 -0
- package/node_modules/zod/v4/locales/bn.cjs +2 -0
- package/node_modules/zod/v4/locales/bn.js +2 -0
- package/node_modules/zod/v4/locales/ca.cjs +2 -0
- package/node_modules/zod/v4/locales/ca.js +2 -0
- package/node_modules/zod/v4/locales/ckb.cjs +2 -0
- package/node_modules/zod/v4/locales/ckb.js +2 -0
- package/node_modules/zod/v4/locales/cs.cjs +2 -0
- package/node_modules/zod/v4/locales/cs.js +2 -0
- package/node_modules/zod/v4/locales/da.cjs +2 -0
- package/node_modules/zod/v4/locales/da.js +2 -0
- package/node_modules/zod/v4/locales/de.cjs +2 -0
- package/node_modules/zod/v4/locales/de.js +2 -0
- package/node_modules/zod/v4/locales/el.cjs +2 -0
- package/node_modules/zod/v4/locales/el.js +2 -0
- package/node_modules/zod/v4/locales/en.cjs +2 -0
- package/node_modules/zod/v4/locales/en.js +2 -0
- package/node_modules/zod/v4/locales/eo.cjs +2 -0
- package/node_modules/zod/v4/locales/eo.js +2 -0
- package/node_modules/zod/v4/locales/es.cjs +2 -0
- package/node_modules/zod/v4/locales/es.js +2 -0
- package/node_modules/zod/v4/locales/fa.cjs +2 -0
- package/node_modules/zod/v4/locales/fa.js +2 -0
- package/node_modules/zod/v4/locales/fi.cjs +2 -0
- package/node_modules/zod/v4/locales/fi.js +2 -0
- package/node_modules/zod/v4/locales/fr-CA.cjs +2 -0
- package/node_modules/zod/v4/locales/fr-CA.js +2 -0
- package/node_modules/zod/v4/locales/fr.cjs +2 -0
- package/node_modules/zod/v4/locales/fr.js +2 -0
- package/node_modules/zod/v4/locales/gu.cjs +2 -0
- package/node_modules/zod/v4/locales/gu.js +2 -0
- package/node_modules/zod/v4/locales/he.cjs +2 -0
- package/node_modules/zod/v4/locales/he.js +2 -0
- package/node_modules/zod/v4/locales/hi.cjs +2 -0
- package/node_modules/zod/v4/locales/hi.js +2 -0
- package/node_modules/zod/v4/locales/hr.cjs +2 -0
- package/node_modules/zod/v4/locales/hr.js +2 -0
- package/node_modules/zod/v4/locales/hu.cjs +2 -0
- package/node_modules/zod/v4/locales/hu.js +2 -0
- package/node_modules/zod/v4/locales/hy.cjs +2 -0
- package/node_modules/zod/v4/locales/hy.js +2 -0
- package/node_modules/zod/v4/locales/id.cjs +2 -0
- package/node_modules/zod/v4/locales/id.js +2 -0
- package/node_modules/zod/v4/locales/index.cjs +22 -1
- package/node_modules/zod/v4/locales/index.d.cts +1 -0
- package/node_modules/zod/v4/locales/index.d.ts +1 -0
- package/node_modules/zod/v4/locales/index.js +1 -0
- package/node_modules/zod/v4/locales/is.cjs +2 -0
- package/node_modules/zod/v4/locales/is.js +2 -0
- package/node_modules/zod/v4/locales/it.cjs +2 -0
- package/node_modules/zod/v4/locales/it.js +2 -0
- package/node_modules/zod/v4/locales/ja.cjs +2 -0
- package/node_modules/zod/v4/locales/ja.js +2 -0
- package/node_modules/zod/v4/locales/ka.cjs +2 -0
- package/node_modules/zod/v4/locales/ka.js +2 -0
- package/node_modules/zod/v4/locales/km.cjs +2 -0
- package/node_modules/zod/v4/locales/km.js +2 -0
- package/node_modules/zod/v4/locales/kn.cjs +2 -0
- package/node_modules/zod/v4/locales/kn.js +2 -0
- package/node_modules/zod/v4/locales/ko.cjs +2 -0
- package/node_modules/zod/v4/locales/ko.js +2 -0
- package/node_modules/zod/v4/locales/lt.cjs +2 -0
- package/node_modules/zod/v4/locales/lt.js +2 -0
- package/node_modules/zod/v4/locales/mk.cjs +2 -0
- package/node_modules/zod/v4/locales/mk.js +2 -0
- package/node_modules/zod/v4/locales/ms.cjs +2 -0
- package/node_modules/zod/v4/locales/ms.js +2 -0
- package/node_modules/zod/v4/locales/ne.cjs +2 -0
- package/node_modules/zod/v4/locales/ne.js +2 -0
- package/node_modules/zod/v4/locales/nl.cjs +2 -0
- package/node_modules/zod/v4/locales/nl.js +2 -0
- package/node_modules/zod/v4/locales/nn.cjs +2 -0
- package/node_modules/zod/v4/locales/nn.js +2 -0
- package/node_modules/zod/v4/locales/no.cjs +2 -0
- package/node_modules/zod/v4/locales/no.js +2 -0
- package/node_modules/zod/v4/locales/ota.cjs +2 -0
- package/node_modules/zod/v4/locales/ota.js +2 -0
- package/node_modules/zod/v4/locales/pl.cjs +2 -0
- package/node_modules/zod/v4/locales/pl.js +2 -0
- package/node_modules/zod/v4/locales/ps.cjs +2 -0
- package/node_modules/zod/v4/locales/ps.js +2 -0
- package/node_modules/zod/v4/locales/pt-BR.cjs +2 -0
- package/node_modules/zod/v4/locales/pt-BR.js +2 -0
- package/node_modules/zod/v4/locales/pt.cjs +2 -0
- package/node_modules/zod/v4/locales/pt.js +2 -0
- package/node_modules/zod/v4/locales/ro.cjs +2 -0
- package/node_modules/zod/v4/locales/ro.js +2 -0
- package/node_modules/zod/v4/locales/ru.cjs +2 -0
- package/node_modules/zod/v4/locales/ru.js +2 -0
- package/node_modules/zod/v4/locales/sk.cjs +2 -0
- package/node_modules/zod/v4/locales/sk.js +2 -0
- package/node_modules/zod/v4/locales/sl.cjs +2 -0
- package/node_modules/zod/v4/locales/sl.js +2 -0
- package/node_modules/zod/v4/locales/sv.cjs +2 -0
- package/node_modules/zod/v4/locales/sv.js +2 -0
- package/node_modules/zod/v4/locales/ta.cjs +2 -0
- package/node_modules/zod/v4/locales/ta.js +2 -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 +2 -0
- package/node_modules/zod/v4/locales/th.js +2 -0
- package/node_modules/zod/v4/locales/tk.cjs +2 -0
- package/node_modules/zod/v4/locales/tk.js +2 -0
- package/node_modules/zod/v4/locales/tr.cjs +2 -0
- package/node_modules/zod/v4/locales/tr.js +2 -0
- package/node_modules/zod/v4/locales/uk.cjs +2 -0
- package/node_modules/zod/v4/locales/uk.js +2 -0
- package/node_modules/zod/v4/locales/ur.cjs +2 -0
- package/node_modules/zod/v4/locales/ur.js +2 -0
- package/node_modules/zod/v4/locales/uz.cjs +2 -0
- package/node_modules/zod/v4/locales/uz.js +2 -0
- package/node_modules/zod/v4/locales/vi.cjs +2 -0
- package/node_modules/zod/v4/locales/vi.js +2 -0
- package/node_modules/zod/v4/locales/yo.cjs +2 -0
- package/node_modules/zod/v4/locales/yo.js +2 -0
- package/node_modules/zod/v4/locales/zh-CN.cjs +2 -0
- package/node_modules/zod/v4/locales/zh-CN.js +2 -0
- package/node_modules/zod/v4/locales/zh-TW.cjs +2 -0
- package/node_modules/zod/v4/locales/zh-TW.js +2 -0
- package/node_modules/zod/v4/mini/checks.cjs +19 -0
- package/node_modules/zod/v4/mini/coerce.cjs +19 -0
- package/node_modules/zod/v4/mini/deep-partial.cjs +19 -0
- package/node_modules/zod/v4/mini/external.cjs +22 -1
- package/node_modules/zod/v4/mini/external.d.cts +1 -1
- package/node_modules/zod/v4/mini/external.d.ts +1 -1
- package/node_modules/zod/v4/mini/external.js +1 -1
- package/node_modules/zod/v4/mini/in-out.cjs +19 -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 +19 -0
- package/node_modules/zod/v4/mini/schemas.cjs +44 -8
- package/node_modules/zod/v4/mini/schemas.d.cts +6 -1
- package/node_modules/zod/v4/mini/schemas.d.ts +6 -1
- package/node_modules/zod/v4/mini/schemas.js +21 -6
- package/node_modules/zod/v4-mini/index.cjs +19 -0
- package/package.json +8 -5
- package/dist/.setup/message-handler.history-CJOsN9w5.mjs +0 -28
- package/dist/.setup/provider.runtime-DuhmKdDU.mjs +0 -2
- package/dist/.setup/setup-plugin-api-CINIEBLa.mjs +0 -3
- package/dist/.setup/targets-D1mAB5yO.mjs +0 -3
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
import { D as Message, E as Guild, G as Row, J as StringSelectMenu, L as Button, O as User, P as Modal, Q as BaseMessageInteractiveComponent, T as CommandWithSubcommands, Y as TextDisplay, a as MessageCreateListener, c as PresenceUpdateListener, d as ThreadDeleteListener, f as ThreadUpdateListener, h as Plugin, i as InteractionCreateListener, k as hasDiscordV2Components, l as ReadyListener, m as Client, n as GuildCreateListener, o as MessageReactionAddListener, q as Separator, r as GuildDeleteListener, s as MessageReactionRemoveListener, t as discord_exports, v as RateLimitError, w as Command, z as Container } from "./discord-BXpHW-cu.mjs";
|
|
2
|
-
import { C as parseDiscordActivityCustomIdForInteraction, D as parseDiscordModalCustomIdForInteraction, E as parseDiscordModalCustomId, O as decodeCustomIdComponent, T as parseDiscordComponentCustomIdForInteraction, c as parseExecApprovalData, d as buildDiscordComponentMessage, k as encodeCustomIdComponent, o as parseDiscordQuestionData, w as parseDiscordComponentCustomId, y as buildDiscordActivityCustomId } from "./components-
|
|
2
|
+
import { C as parseDiscordActivityCustomIdForInteraction, D as parseDiscordModalCustomIdForInteraction, E as parseDiscordModalCustomId, O as decodeCustomIdComponent, T as parseDiscordComponentCustomIdForInteraction, c as parseExecApprovalData, d as buildDiscordComponentMessage, k as encodeCustomIdComponent, o as parseDiscordQuestionData, w as parseDiscordComponentCustomId, y as buildDiscordActivityCustomId } from "./components-yBEb75bB.mjs";
|
|
3
3
|
import { C as resolveTimestampMs, E as getDiscordEndpointRuntime, T as assertDiscordEndpointGatewayUrl, a as normalizeDiscordDisplaySlug, b as formatDiscordReactionEmoji, c as resolveDiscordChannelConfig, f as resolveDiscordGuildEntry, g as resolveDiscordOwnerAllowFrom, h as resolveDiscordOwnerAccess, i as normalizeDiscordAllowList, l as resolveDiscordChannelConfigWithFallback, m as resolveDiscordMemberAllowed, o as normalizeDiscordSlug, p as resolveDiscordMemberAccessState, r as isDiscordGroupAllowedByPolicy, s as resolveDiscordAllowListMatch, t as isDiscordThreadChannelType, u as resolveDiscordChannelPolicyCommandAuthorizer, v as resolveGroupDmAllow, x as formatDiscordUserTag, y as shouldEmitDiscordReactionNotification } from "./channel-type-DKnjV1XW.mjs";
|
|
4
4
|
import { c as resolveDiscordAccount, f as resolveDiscordAccountDmPolicy, h as resolveDiscordToken, l as resolveDiscordAccountAllowFrom, m as normalizeDiscordToken, o as mergeDiscordAccountConfig, p as resolveDiscordMaxLinesPerMessage } from "./accounts-CwJQoLjM.mjs";
|
|
5
|
-
import { a as registerDiscordComponentEntries, o as resolveDiscordComponentEntryWithPersistence, s as resolveDiscordModalEntryWithPersistence, t as editDiscordComponentMessage } from "./send.components-
|
|
5
|
+
import { a as registerDiscordComponentEntries, o as resolveDiscordComponentEntryWithPersistence, s as resolveDiscordModalEntryWithPersistence, t as editDiscordComponentMessage } from "./send.components-ChY21qr-.mjs";
|
|
6
6
|
import { t as getDiscordRuntime } from "./runtime-DgnVQ7zW.mjs";
|
|
7
7
|
import { a as isDiscordRateLimitResponseBody, o as summarizeDiscordResponseBody } from "./api-CBK9zcq5.mjs";
|
|
8
|
-
import { o as chunkDiscordTextWithMode } from "./retry-
|
|
9
|
-
import { B as validateDiscordProxyUrl, G as unregisterGateway, P as createDiscordRestClient, R as DISCORD_REST_TIMEOUT_MS, V as withValidatedDiscordProxy, W as registerGateway, b as canViewDiscordGuildChannel, w as hasAnyChannelPermissionDiscord } from "./send.shared-
|
|
10
|
-
import { o as formatMention, t as sendMessageDiscord } from "./send.outbound-
|
|
11
|
-
import { n as getDiscordActivitiesRuntime } from "./runtime-
|
|
8
|
+
import { o as chunkDiscordTextWithMode } from "./retry-BEYkDy0P.mjs";
|
|
9
|
+
import { B as validateDiscordProxyUrl, G as unregisterGateway, P as createDiscordRestClient, R as DISCORD_REST_TIMEOUT_MS, V as withValidatedDiscordProxy, W as registerGateway, b as canViewDiscordGuildChannel, w as hasAnyChannelPermissionDiscord } from "./send.shared-VNvWfX2T.mjs";
|
|
10
|
+
import { o as formatMention, t as sendMessageDiscord } from "./send.outbound-QTyuFupn.mjs";
|
|
11
|
+
import { n as getDiscordActivitiesRuntime } from "./runtime-DisDbixd.mjs";
|
|
12
12
|
import { t as resolveDiscordCommandOwnerAllowFrom } from "./command-owners-D78sAoOz.mjs";
|
|
13
13
|
import { n as resolveDiscordChannelInfoSafe, o as resolveDiscordChannelTopicSafe, r as resolveDiscordChannelNameSafe } from "./channel-access-C12aDZ0p.mjs";
|
|
14
|
-
import {
|
|
14
|
+
import { O as resolveDiscordMessageStickers, c as authorizeDiscordVoiceIngress, d as resolveDiscordThreadLikeChannelContext, f as resolveFetchedDiscordThreadLikeChannelContext, i as setDiscordTranscriptsVoiceManager, l as resolveDiscordVoiceAccess, s as resolveDiscordVoiceEnabled } from "./transcripts-source-DVegW0WI.mjs";
|
|
15
15
|
import { i as setPresence, t as clearPresences } from "./presence-cache-dYSHPWMx.mjs";
|
|
16
|
-
import { _ as readMessagesDiscord, s as sendVoiceMessageDiscord } from "./send-
|
|
16
|
+
import { _ as readMessagesDiscord, s as sendVoiceMessageDiscord } from "./send-CIBzvXjS.mjs";
|
|
17
17
|
import { c as raceWithTimeout, u as withAbortTimeout } from "./timeouts-D86uWLt_.mjs";
|
|
18
|
-
import { D as isDiscordExecApprovalClientEnabled, T as getDiscordExecApprovalApprovers, a as resolveDiscordComponentSpec, c as formatDiscordApprovalDisplayValue, d as resolveDiscordBoundConversationRoute, h as resolveDiscordConversationIdentity, l as buildDiscordConversationRouteContext, n as DISCORD_PRESENTATION_CAPABILITIES, p as resolveDiscordEffectiveRoute, r as buildDiscordPresentationPayload, s as DISCORD_APPROVAL_ALLOWED_MENTIONS } from "./outbound-session-route-
|
|
18
|
+
import { D as isDiscordExecApprovalClientEnabled, T as getDiscordExecApprovalApprovers, a as resolveDiscordComponentSpec, c as formatDiscordApprovalDisplayValue, d as resolveDiscordBoundConversationRoute, h as resolveDiscordConversationIdentity, l as buildDiscordConversationRouteContext, n as DISCORD_PRESENTATION_CAPABILITIES, p as resolveDiscordEffectiveRoute, r as buildDiscordPresentationPayload, s as DISCORD_APPROVAL_ALLOWED_MENTIONS, u as buildDiscordRoutePeer } from "./outbound-session-route-VulUE0yV.mjs";
|
|
19
19
|
import { n as discordIngressIdentity, t as selectDiscordLivePolicyConfig } from "./live-policy-config-eKQ-PLdy.mjs";
|
|
20
20
|
import { t as resolveDiscordChannelAllowlist } from "./resolve-channels-BbvsLQOZ.mjs";
|
|
21
21
|
import { t as resolveDiscordUserAllowlist } from "./resolve-users-ByFlR7LQ.mjs";
|
|
22
|
-
import {
|
|
22
|
+
import { o as isThreadArchived, r as getThreadBindingManager, u as formatThreadBindingDurationLabel } from "./thread-bindings.manager-ve-i6oqt.mjs";
|
|
23
23
|
import { a as probeDiscordApplicationId, r as parseApplicationIdFromToken } from "./probe-CupW4we4.mjs";
|
|
24
24
|
import { i as sanitizeRecentModels, n as normalizeModelRef, r as preferenceTimestampMs, t as buildPreferenceModelKey } from "./model-picker-preference-primitives-BHT1LkR_.mjs";
|
|
25
25
|
import { t as resolveDiscordSenderIdentity } from "./sender-identity-0Ymgvmaj.mjs";
|
|
26
|
-
import { n as hasDiscordApprovalControl, t as discordApprovalMessageUpdates } from "./approval-message-updates-
|
|
26
|
+
import { n as hasDiscordApprovalControl, t as discordApprovalMessageUpdates } from "./approval-message-updates-jf9zMaIC.mjs";
|
|
27
27
|
import { createRequire } from "node:module";
|
|
28
28
|
import { logDebug, logError } from "openclaw/plugin-sdk/logging-core";
|
|
29
29
|
import { ApplicationCommandOptionType, ButtonStyle, ChannelType, ComponentType, GatewayCloseCodes, GatewayCloseCodes as GatewayCloseCodes$1, GatewayDispatchEvents, GatewayIntentBits, GatewayOpcodes, PermissionFlagsBits } from "discord-api-types/v10";
|
|
30
30
|
import { Type } from "typebox";
|
|
31
31
|
import { Check, Errors } from "typebox/value";
|
|
32
32
|
import { createHash, randomUUID } from "node:crypto";
|
|
33
|
-
import { MAX_DATE_TIMESTAMP_MS, MAX_TIMER_TIMEOUT_MS, asDateTimestampMs, asSafeIntegerInRange, parseFiniteNumber, parseStrictInteger, parseStrictPositiveInteger, resolveDateTimestampMs, resolveTimestampMsToIsoString } from "openclaw/plugin-sdk/number-runtime";
|
|
33
|
+
import { MAX_DATE_TIMESTAMP_MS, MAX_TIMER_TIMEOUT_MS, asDateTimestampMs, asSafeIntegerInRange, parseFiniteNumber, parseStrictInteger, parseStrictPositiveInteger, resolveDateTimestampMs, resolvePromptHistoryLimit, resolveTimestampMsToIsoString } from "openclaw/plugin-sdk/number-runtime";
|
|
34
34
|
import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
|
|
35
35
|
import { inspect } from "node:util";
|
|
36
36
|
import { createHttp1EnvHttpProxyAgent, createHttp1ProxyAgent, createNodeProxyAgent, resolveEnvHttpProxyAgentOptions, wrapFetchWithAbortSignal } from "openclaw/plugin-sdk/fetch-runtime";
|
|
@@ -53,24 +53,23 @@ import { buildOutboundSessionContext, listMessageReceiptPlatformIds, resolveChan
|
|
|
53
53
|
import { getAgentScopedMediaLocalRoots } from "openclaw/plugin-sdk/media-runtime";
|
|
54
54
|
import { loadWebMedia } from "openclaw/plugin-sdk/web-media";
|
|
55
55
|
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
56
|
-
import { buildCommandTextFromArgs, findCommandByNativeName, formatCommandArgMenuTitle, listChatCommands, listNativeCommandSpecsForConfig, listSkillCommandsForAgents, resolveCommandAuthorizedFromAuthorizers, resolveEffectiveAgentRuntime, resolveNativeCommandSessionTargets, resolveStoredModelOverride, serializeCommandArgs } from "openclaw/plugin-sdk/command-auth-native";
|
|
56
|
+
import { buildCommandTextFromArgs, findCommandByNativeName, formatCommandArgMenuTitle, listChatCommands, listNativeCommandSpecsForConfig, listSkillCommandsForAgents, resolveCommandAuthorization, resolveCommandAuthorizedFromAuthorizers, resolveEffectiveAgentRuntime, resolveNativeCommandSessionTargets, resolveStoredModelOverride, serializeCommandArgs } from "openclaw/plugin-sdk/command-auth-native";
|
|
57
57
|
import { GROUP_POLICY_BLOCKED_LABEL, resolveDefaultGroupPolicy, resolveOpenProviderRuntimeGroupPolicy, warnMissingProviderGroupPolicyFallbackOnce } from "openclaw/plugin-sdk/runtime-group-policy";
|
|
58
58
|
import { pruneMapToMaxSize } from "openclaw/plugin-sdk/collection-runtime";
|
|
59
|
-
import {
|
|
60
|
-
import { createChannelPartialDeliveryError, createCommandTurnContext, dispatchChannelInboundTurn, formatInboundEnvelope, hasVisibleInboundReplyDispatch, isChannelPartialDeliveryError, resolveEnvelopeFormatOptions, resolveInboundSupplementalSenderAllowed, runChannelInboundEvent } from "openclaw/plugin-sdk/channel-inbound";
|
|
59
|
+
import { buildChannelInboundEventContext, createChannelPartialDeliveryError, createCommandTurnContext, dispatchChannelInboundTurn, formatInboundEnvelope, hasVisibleInboundReplyDispatch, isChannelPartialDeliveryError, resolveEnvelopeFormatOptions, resolveInboundSupplementalSenderAllowed, runChannelInboundEvent } from "openclaw/plugin-sdk/channel-inbound";
|
|
61
60
|
import path from "node:path";
|
|
62
61
|
import { resolvePinnedMainDmOwnerFromAllowlist as resolvePinnedMainDmOwnerFromAllowlist$1 } from "openclaw/plugin-sdk/security-runtime";
|
|
63
62
|
import { createChannelPairingChallengeIssuer } from "openclaw/plugin-sdk/channel-pairing";
|
|
64
63
|
import { CHANNEL_APPROVAL_NATIVE_RUNTIME_CONTEXT_CAPABILITY } from "openclaw/plugin-sdk/approval-handler-adapter-runtime";
|
|
65
64
|
import { buildPairingReply, upsertChannelPairingRequest, upsertChannelPairingRequest as upsertChannelPairingRequest$1 } from "openclaw/plugin-sdk/conversation-runtime";
|
|
66
|
-
import
|
|
65
|
+
import { ensureConfiguredBindingRouteReady, resolveConfiguredBindingRoute } from "openclaw/plugin-sdk/conversation-binding-runtime";
|
|
67
66
|
import { questionGatewayRuntime } from "openclaw/plugin-sdk/question-gateway-runtime";
|
|
68
|
-
import {
|
|
69
|
-
import { clearExpiredCooldowns, ensureAuthProfileStore, formatReasoningMessage, getPreparedModelCatalogSnapshot, isProfileInCooldown, listAgentIds, loadPreparedModelCatalog, resolveAgentAvatar, resolveAgentDir, resolveDefaultModelForAgent, resolveHumanDelayConfig, resolveProfilesUnavailableReason } from "openclaw/plugin-sdk/agent-runtime";
|
|
67
|
+
import { readChannelIngressStoreAllowFromForDmPolicy } from "openclaw/plugin-sdk/channel-ingress-runtime";
|
|
70
68
|
import { isDangerousNameMatchingEnabled } from "openclaw/plugin-sdk/dangerous-name-runtime";
|
|
71
69
|
import { resolveNativeCommandsEnabled, resolveNativeSkillsEnabled } from "openclaw/plugin-sdk/native-command-config-runtime";
|
|
72
70
|
import { requestHeartbeat } from "openclaw/plugin-sdk/heartbeat-runtime";
|
|
73
71
|
import { enqueueRoutedSystemEvent, enqueueRoutedSystemEvent as enqueueRoutedSystemEvent$1 } from "openclaw/plugin-sdk/system-event-runtime";
|
|
72
|
+
import { clearExpiredCooldowns, ensureAuthProfileStore, formatReasoningMessage, getPreparedModelCatalogSnapshot, isProfileInCooldown, listAgentIds, loadPreparedModelCatalog, resolveAgentAvatar, resolveAgentDir, resolveDefaultModelForAgent, resolveHumanDelayConfig, resolveProfilesUnavailableReason } from "openclaw/plugin-sdk/agent-runtime";
|
|
74
73
|
import { deleteSessionEntry, getSessionEntry, listSessionEntries, readSessionUpdatedAt as readSessionUpdatedAt$1, resolveStorePath, resolveStorePath as resolveStorePath$1 } from "openclaw/plugin-sdk/session-store-runtime";
|
|
75
74
|
import { captureHttpExchange, captureWsEvent, resolveDebugProxySettings, resolveEffectiveDebugProxyUrl } from "openclaw/plugin-sdk/proxy-capture";
|
|
76
75
|
import { resolveRequestUrl } from "openclaw/plugin-sdk/request-url";
|
|
@@ -382,7 +381,7 @@ function createDiscordDynamicAccessGroupResolver(params) {
|
|
|
382
381
|
};
|
|
383
382
|
}
|
|
384
383
|
function createDiscordIngressResolver(params) {
|
|
385
|
-
return
|
|
384
|
+
return getDiscordRuntime().channel.inbound.ingress.createResolver({
|
|
386
385
|
channelId: DISCORD_CHANNEL_ID,
|
|
387
386
|
accountId: params.accountId,
|
|
388
387
|
identity: discordIngressIdentity,
|
|
@@ -1973,7 +1972,7 @@ async function deliverDiscordInteractionReply(params) {
|
|
|
1973
1972
|
}
|
|
1974
1973
|
//#endregion
|
|
1975
1974
|
//#region extensions/discord/src/monitor/native-command-route.ts
|
|
1976
|
-
|
|
1975
|
+
function resolveDiscordNativeInteractionRouteState(params) {
|
|
1977
1976
|
const route = resolveDiscordBoundConversationRoute({
|
|
1978
1977
|
cfg: params.cfg,
|
|
1979
1978
|
accountId: params.accountId,
|
|
@@ -1985,7 +1984,7 @@ async function resolveDiscordNativeInteractionRouteState(params) {
|
|
|
1985
1984
|
conversationId: params.conversationId,
|
|
1986
1985
|
parentConversationId: params.parentConversationId
|
|
1987
1986
|
});
|
|
1988
|
-
const configuredRoute = params.threadBinding == null ?
|
|
1987
|
+
const configuredRoute = params.threadBinding == null ? resolveConfiguredBindingRoute({
|
|
1989
1988
|
cfg: params.cfg,
|
|
1990
1989
|
route,
|
|
1991
1990
|
conversation: {
|
|
@@ -2008,17 +2007,14 @@ async function resolveDiscordNativeInteractionRouteState(params) {
|
|
|
2008
2007
|
}),
|
|
2009
2008
|
boundSessionKey,
|
|
2010
2009
|
configuredRoute,
|
|
2011
|
-
configuredBinding
|
|
2012
|
-
bindingReadiness: params.enforceConfiguredBindingReadiness && configuredBinding ? await conversationRuntime.ensureConfiguredBindingRouteReady({
|
|
2013
|
-
cfg: params.cfg,
|
|
2014
|
-
bindingResolution: configuredBinding
|
|
2015
|
-
}) : null
|
|
2010
|
+
configuredBinding
|
|
2016
2011
|
};
|
|
2017
2012
|
}
|
|
2018
2013
|
//#endregion
|
|
2019
2014
|
//#region extensions/discord/src/monitor/native-command.runtime.ts
|
|
2020
2015
|
const nativeCommandRuntime = {
|
|
2021
2016
|
dispatchChannelInboundTurn,
|
|
2017
|
+
ensureConfiguredBindingRouteReady,
|
|
2022
2018
|
resolveDirectStatusReplyForSession,
|
|
2023
2019
|
resolveDiscordNativeInteractionRouteState,
|
|
2024
2020
|
getSessionEntry
|
|
@@ -2194,6 +2190,7 @@ async function handleDiscordCommandArgInteraction(params) {
|
|
|
2194
2190
|
preferFollowUp: true,
|
|
2195
2191
|
threadBindings: ctx.threadBindings,
|
|
2196
2192
|
responseEphemeral: resolveDiscordSlashCommandConfig(ctx.discordConfig?.slashCommand).ephemeral,
|
|
2193
|
+
buildContext: ctx.buildContext,
|
|
2197
2194
|
dispatchReplyFromConfig: ctx.dispatchReplyFromConfig,
|
|
2198
2195
|
pluginCommandDispatch: { kind: "non-plugin" }
|
|
2199
2196
|
});
|
|
@@ -2263,6 +2260,200 @@ function createDiscordCommandArgFallbackButton$1(params) {
|
|
|
2263
2260
|
return new DiscordCommandArgFallbackButton(params);
|
|
2264
2261
|
}
|
|
2265
2262
|
//#endregion
|
|
2263
|
+
//#region extensions/discord/src/monitor/inbound-context.ts
|
|
2264
|
+
function createDiscordSupplementalContextAccessChecker(params) {
|
|
2265
|
+
const userAllowList = params.channelConfig?.users ?? params.guildInfo?.users ?? [];
|
|
2266
|
+
const roleAllowList = params.channelConfig?.roles ?? params.guildInfo?.roles ?? [];
|
|
2267
|
+
const allowFrom = [...userAllowList, ...roleAllowList];
|
|
2268
|
+
return (sender) => {
|
|
2269
|
+
return resolveInboundSupplementalSenderAllowed({
|
|
2270
|
+
isGroup: params.isGuild,
|
|
2271
|
+
groupPolicy: allowFrom.length === 0 ? "open" : "allowlist",
|
|
2272
|
+
allowFrom,
|
|
2273
|
+
isSenderAllowed: () => resolveDiscordMemberAllowed({
|
|
2274
|
+
userAllowList,
|
|
2275
|
+
roleAllowList,
|
|
2276
|
+
memberRoleIds: [...sender.memberRoleIds ?? []],
|
|
2277
|
+
userId: sender.id ?? "",
|
|
2278
|
+
userName: sender.name,
|
|
2279
|
+
userTag: sender.tag,
|
|
2280
|
+
allowNameMatching: params.allowNameMatching
|
|
2281
|
+
})
|
|
2282
|
+
});
|
|
2283
|
+
};
|
|
2284
|
+
}
|
|
2285
|
+
function buildDiscordGroupSystemPrompt(channelConfig) {
|
|
2286
|
+
return channelConfig?.systemPrompt?.trim() || void 0;
|
|
2287
|
+
}
|
|
2288
|
+
function buildDiscordChannelStructuredContext(params) {
|
|
2289
|
+
if (!params.isGuild) return;
|
|
2290
|
+
const entries = [];
|
|
2291
|
+
if (typeof params.channelTopic === "string" && params.channelTopic.trim().length > 0) entries.push({
|
|
2292
|
+
label: "Discord channel metadata",
|
|
2293
|
+
source: "discord",
|
|
2294
|
+
type: "channel_metadata",
|
|
2295
|
+
payload: { topic: params.channelTopic.trim() }
|
|
2296
|
+
});
|
|
2297
|
+
return entries.length > 0 ? entries : void 0;
|
|
2298
|
+
}
|
|
2299
|
+
function buildDiscordInboundAccessContext(params) {
|
|
2300
|
+
return {
|
|
2301
|
+
groupSystemPrompt: params.isGuild ? buildDiscordGroupSystemPrompt(params.channelConfig) : void 0,
|
|
2302
|
+
channelStructuredContext: buildDiscordChannelStructuredContext({
|
|
2303
|
+
isGuild: params.isGuild,
|
|
2304
|
+
channelTopic: params.channelTopic
|
|
2305
|
+
}),
|
|
2306
|
+
ownerAllowFrom: resolveDiscordOwnerAllowFrom({
|
|
2307
|
+
channelConfig: params.channelConfig,
|
|
2308
|
+
guildInfo: params.guildInfo,
|
|
2309
|
+
sender: params.sender,
|
|
2310
|
+
allowNameMatching: params.allowNameMatching
|
|
2311
|
+
})
|
|
2312
|
+
};
|
|
2313
|
+
}
|
|
2314
|
+
//#endregion
|
|
2315
|
+
//#region extensions/discord/src/monitor/native-command-context.ts
|
|
2316
|
+
async function buildDiscordNativeCommandContext(params) {
|
|
2317
|
+
const conversationLabel = params.isDirectMessage ? params.user.globalName ?? params.user.username : params.channelId;
|
|
2318
|
+
const { groupSystemPrompt, ownerAllowFrom, channelStructuredContext } = buildDiscordInboundAccessContext({
|
|
2319
|
+
channelConfig: params.channelConfig,
|
|
2320
|
+
guildInfo: params.guildInfo,
|
|
2321
|
+
sender: params.sender,
|
|
2322
|
+
allowNameMatching: params.allowNameMatching,
|
|
2323
|
+
isGuild: params.isGuild,
|
|
2324
|
+
channelTopic: params.channelTopic
|
|
2325
|
+
});
|
|
2326
|
+
const conversation = {
|
|
2327
|
+
kind: params.isDirectMessage ? "direct" : params.isGroupDm ? "group" : "channel",
|
|
2328
|
+
id: params.channelId,
|
|
2329
|
+
parentId: params.isThreadChannel ? params.threadParentId : void 0,
|
|
2330
|
+
threadId: params.isThreadChannel ? params.channelId : void 0
|
|
2331
|
+
};
|
|
2332
|
+
const allowFrom = params.commandAuthorized ? [`user:${params.user.id}`] : [];
|
|
2333
|
+
const channelIngress = await getDiscordRuntime().channel.inbound.ingress.createResolver({
|
|
2334
|
+
channelId: "discord",
|
|
2335
|
+
accountId: params.accountId,
|
|
2336
|
+
identity: discordIngressIdentity,
|
|
2337
|
+
useDefaultPairingStore: false
|
|
2338
|
+
}).command({
|
|
2339
|
+
subject: {
|
|
2340
|
+
stableId: params.user.id,
|
|
2341
|
+
aliases: { participantKind: "user" }
|
|
2342
|
+
},
|
|
2343
|
+
conversation,
|
|
2344
|
+
contextBinding: {
|
|
2345
|
+
agentId: params.agentId,
|
|
2346
|
+
sessionKey: params.sessionKey,
|
|
2347
|
+
nativeChannelId: params.channelId,
|
|
2348
|
+
messageId: params.interactionId,
|
|
2349
|
+
inboundEventKind: "user_request"
|
|
2350
|
+
},
|
|
2351
|
+
event: {
|
|
2352
|
+
kind: "native-command",
|
|
2353
|
+
mayPair: false
|
|
2354
|
+
},
|
|
2355
|
+
dmPolicy: "allowlist",
|
|
2356
|
+
groupPolicy: "allowlist",
|
|
2357
|
+
allowFrom,
|
|
2358
|
+
groupAllowFrom: allowFrom,
|
|
2359
|
+
command: { modeWhenAccessGroupsOff: "configured" }
|
|
2360
|
+
});
|
|
2361
|
+
return await (params.buildContext ?? buildChannelInboundEventContext)({
|
|
2362
|
+
channel: "discord",
|
|
2363
|
+
channelIngress,
|
|
2364
|
+
accountId: params.accountId,
|
|
2365
|
+
messageId: params.interactionId,
|
|
2366
|
+
timestamp: params.timestampMs ?? Date.now(),
|
|
2367
|
+
from: params.isDirectMessage ? `discord:${params.user.id}` : params.isGroupDm ? `discord:group:${params.channelId}` : `discord:channel:${params.channelId}`,
|
|
2368
|
+
sender: {
|
|
2369
|
+
id: params.user.id,
|
|
2370
|
+
name: params.user.globalName ?? params.user.username,
|
|
2371
|
+
username: params.user.username,
|
|
2372
|
+
tag: params.sender.tag,
|
|
2373
|
+
roles: params.memberRoleIds
|
|
2374
|
+
},
|
|
2375
|
+
conversation: {
|
|
2376
|
+
...conversation,
|
|
2377
|
+
nativeChannelId: params.channelId,
|
|
2378
|
+
routePeer: buildDiscordRoutePeer({
|
|
2379
|
+
isDirectMessage: params.isDirectMessage,
|
|
2380
|
+
isGroupDm: params.isGroupDm,
|
|
2381
|
+
directUserId: params.user.id,
|
|
2382
|
+
conversationId: params.channelId
|
|
2383
|
+
}),
|
|
2384
|
+
label: conversationLabel,
|
|
2385
|
+
spaceId: params.isGuild ? params.guildInfo?.id ?? params.guildInfo?.slug ?? params.guildId : void 0
|
|
2386
|
+
},
|
|
2387
|
+
route: {
|
|
2388
|
+
agentId: params.agentId,
|
|
2389
|
+
accountId: params.accountId,
|
|
2390
|
+
routeSessionKey: params.commandTargetSessionKey,
|
|
2391
|
+
dispatchSessionKey: params.sessionKey
|
|
2392
|
+
},
|
|
2393
|
+
reply: {
|
|
2394
|
+
to: `slash:${params.user.id}`,
|
|
2395
|
+
originatingTo: resolveDiscordConversationIdentity({
|
|
2396
|
+
isDirectMessage: params.isDirectMessage,
|
|
2397
|
+
userId: params.user.id,
|
|
2398
|
+
channelId: params.channelId
|
|
2399
|
+
}) ?? (params.isDirectMessage ? `user:${params.user.id}` : `channel:${params.channelId}`)
|
|
2400
|
+
},
|
|
2401
|
+
message: { rawBody: params.prompt },
|
|
2402
|
+
access: {
|
|
2403
|
+
mentions: {
|
|
2404
|
+
canDetectMention: true,
|
|
2405
|
+
wasMentioned: true
|
|
2406
|
+
},
|
|
2407
|
+
commands: { authorized: params.commandAuthorized }
|
|
2408
|
+
},
|
|
2409
|
+
commandTurn: {
|
|
2410
|
+
kind: "native",
|
|
2411
|
+
source: "native",
|
|
2412
|
+
authorized: params.commandAuthorized,
|
|
2413
|
+
body: params.prompt
|
|
2414
|
+
},
|
|
2415
|
+
supplemental: { groupSystemPrompt },
|
|
2416
|
+
extra: {
|
|
2417
|
+
CommandArgs: params.commandArgs,
|
|
2418
|
+
CommandTargetSessionKey: params.commandTargetSessionKey,
|
|
2419
|
+
CommandSource: "native",
|
|
2420
|
+
GroupSubject: params.isGuild ? params.guildName : void 0,
|
|
2421
|
+
ChannelStructuredContext: channelStructuredContext,
|
|
2422
|
+
OwnerAllowFrom: ownerAllowFrom
|
|
2423
|
+
}
|
|
2424
|
+
});
|
|
2425
|
+
}
|
|
2426
|
+
async function buildDiscordNativeInteractionContext(params) {
|
|
2427
|
+
const { interaction, route, boundSessionKey, sessionPrefix, channelContext, ...context } = params;
|
|
2428
|
+
const targets = resolveNativeCommandSessionTargets({
|
|
2429
|
+
agentId: route.agentId,
|
|
2430
|
+
sessionPrefix,
|
|
2431
|
+
userId: context.user.id,
|
|
2432
|
+
targetSessionKey: route.sessionKey,
|
|
2433
|
+
boundSessionKey
|
|
2434
|
+
});
|
|
2435
|
+
return {
|
|
2436
|
+
ctxPayload: await buildDiscordNativeCommandContext({
|
|
2437
|
+
...context,
|
|
2438
|
+
...targets,
|
|
2439
|
+
agentId: route.agentId,
|
|
2440
|
+
accountId: route.accountId,
|
|
2441
|
+
interactionId: interaction.rawData.id,
|
|
2442
|
+
channelId: channelContext.rawChannelId || "unknown",
|
|
2443
|
+
threadParentId: channelContext.threadParentId,
|
|
2444
|
+
memberRoleIds: Array.isArray(interaction.rawData.member?.roles) ? interaction.rawData.member.roles : [],
|
|
2445
|
+
guildId: interaction.guild?.id,
|
|
2446
|
+
guildName: interaction.guild?.name,
|
|
2447
|
+
channelTopic: resolveDiscordChannelTopicSafe(interaction.channel),
|
|
2448
|
+
isGuild: Boolean(interaction.guild),
|
|
2449
|
+
isDirectMessage: channelContext.isDirectMessage,
|
|
2450
|
+
isGroupDm: channelContext.isGroupDm,
|
|
2451
|
+
isThreadChannel: channelContext.isThreadChannel
|
|
2452
|
+
}),
|
|
2453
|
+
...targets
|
|
2454
|
+
};
|
|
2455
|
+
}
|
|
2456
|
+
//#endregion
|
|
2266
2457
|
//#region extensions/discord/src/monitor/native-interaction-channel-context.ts
|
|
2267
2458
|
async function resolveDiscordNativeInteractionChannelContext(params) {
|
|
2268
2459
|
const channelContext = await resolveDiscordThreadLikeChannelContext({
|
|
@@ -2286,6 +2477,62 @@ async function resolveDiscordNativeInteractionChannelContext(params) {
|
|
|
2286
2477
|
}
|
|
2287
2478
|
//#endregion
|
|
2288
2479
|
//#region extensions/discord/src/monitor/native-command-auth.ts
|
|
2480
|
+
function resolveDiscordNativePolicyReader(params) {
|
|
2481
|
+
return params.readPolicy ?? createDiscordLivePolicyReader({
|
|
2482
|
+
...params,
|
|
2483
|
+
readConfig: () => getRuntimeConfigSnapshot() ?? params.cfg,
|
|
2484
|
+
resolvedAllowlist: {
|
|
2485
|
+
guildEntries: params.discordConfig?.guilds,
|
|
2486
|
+
allowFrom: params.discordConfig?.allowFrom ?? resolveDiscordAccountAllowFrom(params)
|
|
2487
|
+
}
|
|
2488
|
+
});
|
|
2489
|
+
}
|
|
2490
|
+
function createDiscordNativeCommandAuthority(params) {
|
|
2491
|
+
const assertAdmittedOwner = resolveCommandAuthorization(params).assertOwnerCurrent;
|
|
2492
|
+
const readAuthorization = () => {
|
|
2493
|
+
const cfg = getRuntimeConfigSnapshot() ?? params.cfg;
|
|
2494
|
+
const owners = resolveDiscordCommandOwnerAllowFrom(cfg);
|
|
2495
|
+
const senderIsOwner = params.isPolicyCurrent?.() !== false && (resolveDiscordOwnerAccess({
|
|
2496
|
+
allowFrom: owners,
|
|
2497
|
+
sender: params.sender,
|
|
2498
|
+
allowNameMatching: params.allowNameMatching
|
|
2499
|
+
}).ownerAllowed || resolveCommandAuthorization({
|
|
2500
|
+
...params,
|
|
2501
|
+
cfg
|
|
2502
|
+
}).senderIsOwner);
|
|
2503
|
+
const commands = resolveDiscordNativeCommandAllowlistAccess({
|
|
2504
|
+
cfg,
|
|
2505
|
+
accountId: params.accountId,
|
|
2506
|
+
sender: params.sender,
|
|
2507
|
+
chatType: params.ctx.ChatType === "direct" ? "direct" : "channel",
|
|
2508
|
+
guildId: params.guildId
|
|
2509
|
+
});
|
|
2510
|
+
return {
|
|
2511
|
+
senderIsOwner,
|
|
2512
|
+
allowed: (!commands.configured || commands.allowed) && (!owners || owners.includes("*") || senderIsOwner || commands.allowed || params.commandName === "status" || params.pluginCommand)
|
|
2513
|
+
};
|
|
2514
|
+
};
|
|
2515
|
+
const assertActive = () => {
|
|
2516
|
+
assertAdmittedOwner?.();
|
|
2517
|
+
if (params.isPolicyCurrent?.() === false || !readAuthorization().allowed) throw new Error("Discord command authority changed; send a new request.");
|
|
2518
|
+
};
|
|
2519
|
+
return {
|
|
2520
|
+
assertActive,
|
|
2521
|
+
assertOwnerCurrent: () => {
|
|
2522
|
+
assertActive();
|
|
2523
|
+
if (!readAuthorization().senderIsOwner) throw new Error("Discord owner authority changed; send a new request.");
|
|
2524
|
+
},
|
|
2525
|
+
senderIsOwner: () => readAuthorization().senderIsOwner,
|
|
2526
|
+
isAllowed: () => {
|
|
2527
|
+
try {
|
|
2528
|
+
assertActive();
|
|
2529
|
+
return true;
|
|
2530
|
+
} catch {
|
|
2531
|
+
return false;
|
|
2532
|
+
}
|
|
2533
|
+
}
|
|
2534
|
+
};
|
|
2535
|
+
}
|
|
2289
2536
|
function resolveDiscordNativeCommandAllowlistAccess(params) {
|
|
2290
2537
|
const commandsAllowFrom = params.cfg.commands?.allowFrom;
|
|
2291
2538
|
if (!commandsAllowFrom || typeof commandsAllowFrom !== "object") return {
|
|
@@ -2425,12 +2672,13 @@ async function resolveDiscordNativeAutocompleteAuthorized(params) {
|
|
|
2425
2672
|
author: user,
|
|
2426
2673
|
pluralkitInfo: null
|
|
2427
2674
|
});
|
|
2428
|
-
const
|
|
2675
|
+
const channelContext = await resolveDiscordNativeInteractionChannelContext({
|
|
2429
2676
|
channel: interaction.channel,
|
|
2430
2677
|
client: interaction.client,
|
|
2431
2678
|
hasGuild: Boolean(interaction.guild),
|
|
2432
2679
|
channelIdFallback: interaction.rawData.channel_id ?? ""
|
|
2433
2680
|
});
|
|
2681
|
+
const { isDirectMessage, isGroupDm, isThreadChannel, channelName, channelSlug, rawChannelId, threadParentId, threadParentName, threadParentSlug } = channelContext;
|
|
2434
2682
|
if (params.isPolicyCurrent?.() === false) return false;
|
|
2435
2683
|
const memberRoleIds = Array.isArray(interaction.rawData.member?.roles) ? interaction.rawData.member.roles.map((roleId) => roleId) : [];
|
|
2436
2684
|
const allowNameMatching = isDangerousNameMatchingEnabled(discordConfig);
|
|
@@ -2507,162 +2755,75 @@ async function resolveDiscordNativeAutocompleteAuthorized(params) {
|
|
|
2507
2755
|
channelName,
|
|
2508
2756
|
channelSlug
|
|
2509
2757
|
}).allowed) return false;
|
|
2510
|
-
if (
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2758
|
+
if (!isDirectMessage) {
|
|
2759
|
+
if (!await resolveDiscordGuildNativeCommandAuthorized({
|
|
2760
|
+
cfg,
|
|
2761
|
+
accountId,
|
|
2762
|
+
discordConfig,
|
|
2763
|
+
useAccessGroups,
|
|
2764
|
+
commandsAllowFromAccess,
|
|
2765
|
+
guildInfo,
|
|
2766
|
+
channelConfig,
|
|
2767
|
+
memberRoleIds,
|
|
2768
|
+
sender,
|
|
2769
|
+
allowNameMatching,
|
|
2770
|
+
ownerAllowListConfigured: ownerAllowList != null,
|
|
2771
|
+
ownerAllowed: ownerOk
|
|
2772
|
+
})) return false;
|
|
2523
2773
|
}
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
discordConfig,
|
|
2528
|
-
useAccessGroups,
|
|
2529
|
-
commandsAllowFromAccess,
|
|
2530
|
-
guildInfo,
|
|
2531
|
-
channelConfig,
|
|
2532
|
-
memberRoleIds,
|
|
2774
|
+
const commandOwnerAllowFrom = resolveDiscordCommandOwnerAllowFrom(cfg);
|
|
2775
|
+
if (params.skipCommandOwnerAllowFrom !== true && commandOwnerAllowFrom && !commandOwnerAllowFrom.includes("*") && !commandsAllowFromAccess.allowed && !resolveDiscordOwnerAccess({
|
|
2776
|
+
allowFrom: commandOwnerAllowFrom,
|
|
2533
2777
|
sender,
|
|
2534
|
-
allowNameMatching
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2778
|
+
allowNameMatching
|
|
2779
|
+
}).ownerAllowed) {
|
|
2780
|
+
const routeState = resolveDiscordNativeInteractionRouteState({
|
|
2781
|
+
cfg,
|
|
2782
|
+
accountId,
|
|
2783
|
+
guildId: interaction.guild?.id,
|
|
2784
|
+
memberRoleIds,
|
|
2785
|
+
isDirectMessage,
|
|
2786
|
+
isGroupDm,
|
|
2787
|
+
directUserId: user.id,
|
|
2788
|
+
conversationId: rawChannelId,
|
|
2789
|
+
parentConversationId: threadParentId,
|
|
2790
|
+
threadBinding: isThreadChannel ? params.threadBindings?.getByThreadId(rawChannelId) : void 0
|
|
2791
|
+
});
|
|
2792
|
+
const { ctxPayload } = await buildDiscordNativeInteractionContext({
|
|
2793
|
+
buildContext: params.buildContext,
|
|
2794
|
+
interaction,
|
|
2795
|
+
channelContext,
|
|
2796
|
+
route: routeState.effectiveRoute,
|
|
2797
|
+
boundSessionKey: routeState.boundSessionKey,
|
|
2798
|
+
sessionPrefix: params.sessionPrefix ?? "discord:slash",
|
|
2799
|
+
channelConfig,
|
|
2800
|
+
guildInfo,
|
|
2801
|
+
allowNameMatching,
|
|
2802
|
+
commandAuthorized: true,
|
|
2803
|
+
user,
|
|
2804
|
+
sender,
|
|
2805
|
+
prompt: "",
|
|
2806
|
+
commandArgs: {}
|
|
2807
|
+
});
|
|
2808
|
+
if (!resolveCommandAuthorization({
|
|
2809
|
+
ctx: ctxPayload,
|
|
2810
|
+
cfg,
|
|
2811
|
+
commandAuthorized: true
|
|
2812
|
+
}).senderIsOwner) return false;
|
|
2813
|
+
}
|
|
2538
2814
|
return params.isPolicyCurrent?.() !== false;
|
|
2539
2815
|
}
|
|
2540
2816
|
//#endregion
|
|
2541
2817
|
//#region extensions/discord/src/monitor/native-command-bypass.ts
|
|
2542
2818
|
function shouldBypassConfiguredAcpEnsure(commandName) {
|
|
2543
|
-
|
|
2819
|
+
const command = commandName.trim().toLowerCase();
|
|
2820
|
+
return command === "acp" || command === "status";
|
|
2544
2821
|
}
|
|
2545
2822
|
function shouldBypassConfiguredAcpGuildGuards(commandName) {
|
|
2546
2823
|
const command = commandName.trim().toLowerCase();
|
|
2547
2824
|
return command === "new" || command === "reset";
|
|
2548
2825
|
}
|
|
2549
2826
|
//#endregion
|
|
2550
|
-
//#region extensions/discord/src/monitor/inbound-context.ts
|
|
2551
|
-
function createDiscordSupplementalContextAccessChecker(params) {
|
|
2552
|
-
const userAllowList = params.channelConfig?.users ?? params.guildInfo?.users ?? [];
|
|
2553
|
-
const roleAllowList = params.channelConfig?.roles ?? params.guildInfo?.roles ?? [];
|
|
2554
|
-
const allowFrom = [...userAllowList, ...roleAllowList];
|
|
2555
|
-
return (sender) => {
|
|
2556
|
-
return resolveInboundSupplementalSenderAllowed({
|
|
2557
|
-
isGroup: params.isGuild,
|
|
2558
|
-
groupPolicy: allowFrom.length === 0 ? "open" : "allowlist",
|
|
2559
|
-
allowFrom,
|
|
2560
|
-
isSenderAllowed: () => resolveDiscordMemberAllowed({
|
|
2561
|
-
userAllowList,
|
|
2562
|
-
roleAllowList,
|
|
2563
|
-
memberRoleIds: [...sender.memberRoleIds ?? []],
|
|
2564
|
-
userId: sender.id ?? "",
|
|
2565
|
-
userName: sender.name,
|
|
2566
|
-
userTag: sender.tag,
|
|
2567
|
-
allowNameMatching: params.allowNameMatching
|
|
2568
|
-
})
|
|
2569
|
-
});
|
|
2570
|
-
};
|
|
2571
|
-
}
|
|
2572
|
-
function buildDiscordGroupSystemPrompt(channelConfig) {
|
|
2573
|
-
return channelConfig?.systemPrompt?.trim() || void 0;
|
|
2574
|
-
}
|
|
2575
|
-
function buildDiscordChannelStructuredContext(params) {
|
|
2576
|
-
if (!params.isGuild) return;
|
|
2577
|
-
const entries = [];
|
|
2578
|
-
if (typeof params.channelTopic === "string" && params.channelTopic.trim().length > 0) entries.push({
|
|
2579
|
-
label: "Discord channel metadata",
|
|
2580
|
-
source: "discord",
|
|
2581
|
-
type: "channel_metadata",
|
|
2582
|
-
payload: { topic: params.channelTopic.trim() }
|
|
2583
|
-
});
|
|
2584
|
-
return entries.length > 0 ? entries : void 0;
|
|
2585
|
-
}
|
|
2586
|
-
function buildDiscordInboundAccessContext(params) {
|
|
2587
|
-
return {
|
|
2588
|
-
groupSystemPrompt: params.isGuild ? buildDiscordGroupSystemPrompt(params.channelConfig) : void 0,
|
|
2589
|
-
channelStructuredContext: buildDiscordChannelStructuredContext({
|
|
2590
|
-
isGuild: params.isGuild,
|
|
2591
|
-
channelTopic: params.channelTopic
|
|
2592
|
-
}),
|
|
2593
|
-
ownerAllowFrom: resolveDiscordOwnerAllowFrom({
|
|
2594
|
-
channelConfig: params.channelConfig,
|
|
2595
|
-
guildInfo: params.guildInfo,
|
|
2596
|
-
sender: params.sender,
|
|
2597
|
-
allowNameMatching: params.allowNameMatching
|
|
2598
|
-
})
|
|
2599
|
-
};
|
|
2600
|
-
}
|
|
2601
|
-
//#endregion
|
|
2602
|
-
//#region extensions/discord/src/monitor/native-command-context.ts
|
|
2603
|
-
function buildDiscordNativeCommandContext(params) {
|
|
2604
|
-
const conversationLabel = params.isDirectMessage ? params.user.globalName ?? params.user.username : params.channelId;
|
|
2605
|
-
const { groupSystemPrompt, ownerAllowFrom, channelStructuredContext } = buildDiscordInboundAccessContext({
|
|
2606
|
-
channelConfig: params.channelConfig,
|
|
2607
|
-
guildInfo: params.guildInfo,
|
|
2608
|
-
sender: params.sender,
|
|
2609
|
-
allowNameMatching: params.allowNameMatching,
|
|
2610
|
-
isGuild: params.isGuild,
|
|
2611
|
-
channelTopic: params.channelTopic
|
|
2612
|
-
});
|
|
2613
|
-
return finalizeInboundContext({
|
|
2614
|
-
Body: params.prompt,
|
|
2615
|
-
BodyForAgent: params.prompt,
|
|
2616
|
-
RawBody: params.prompt,
|
|
2617
|
-
CommandBody: params.prompt,
|
|
2618
|
-
CommandArgs: params.commandArgs,
|
|
2619
|
-
From: params.isDirectMessage ? `discord:${params.user.id}` : params.isGroupDm ? `discord:group:${params.channelId}` : `discord:channel:${params.channelId}`,
|
|
2620
|
-
To: `slash:${params.user.id}`,
|
|
2621
|
-
SessionKey: params.sessionKey,
|
|
2622
|
-
CommandTargetSessionKey: params.commandTargetSessionKey,
|
|
2623
|
-
AccountId: params.accountId ?? void 0,
|
|
2624
|
-
ChatType: params.isDirectMessage ? "direct" : params.isGroupDm ? "group" : "channel",
|
|
2625
|
-
...buildDiscordConversationRouteContext({
|
|
2626
|
-
isDirectMessage: params.isDirectMessage,
|
|
2627
|
-
isGroupDm: params.isGroupDm,
|
|
2628
|
-
directUserId: params.user.id,
|
|
2629
|
-
conversationId: params.channelId,
|
|
2630
|
-
isThread: params.isThreadChannel,
|
|
2631
|
-
parentConversationId: params.threadParentId
|
|
2632
|
-
}),
|
|
2633
|
-
ConversationLabel: conversationLabel,
|
|
2634
|
-
GroupSubject: params.isGuild ? params.guildName : void 0,
|
|
2635
|
-
GroupSpace: params.isGuild ? params.guildInfo?.id ?? params.guildInfo?.slug ?? params.guildId : void 0,
|
|
2636
|
-
MemberRoleIds: params.memberRoleIds,
|
|
2637
|
-
GroupSystemPrompt: groupSystemPrompt,
|
|
2638
|
-
ChannelStructuredContext: channelStructuredContext,
|
|
2639
|
-
OwnerAllowFrom: ownerAllowFrom,
|
|
2640
|
-
SenderName: params.user.globalName ?? params.user.username,
|
|
2641
|
-
SenderId: params.user.id,
|
|
2642
|
-
SenderUsername: params.user.username,
|
|
2643
|
-
SenderTag: params.sender.tag,
|
|
2644
|
-
Provider: "discord",
|
|
2645
|
-
Surface: "discord",
|
|
2646
|
-
WasMentioned: true,
|
|
2647
|
-
MessageSid: params.interactionId,
|
|
2648
|
-
Timestamp: params.timestampMs ?? Date.now(),
|
|
2649
|
-
CommandAuthorized: params.commandAuthorized,
|
|
2650
|
-
CommandTurn: {
|
|
2651
|
-
kind: "native",
|
|
2652
|
-
source: "native",
|
|
2653
|
-
authorized: params.commandAuthorized,
|
|
2654
|
-
body: params.prompt
|
|
2655
|
-
},
|
|
2656
|
-
CommandSource: "native",
|
|
2657
|
-
OriginatingChannel: "discord",
|
|
2658
|
-
OriginatingTo: resolveDiscordConversationIdentity({
|
|
2659
|
-
isDirectMessage: params.isDirectMessage,
|
|
2660
|
-
userId: params.user.id,
|
|
2661
|
-
channelId: params.channelId
|
|
2662
|
-
}) ?? (params.isDirectMessage ? `user:${params.user.id}` : `channel:${params.channelId}`)
|
|
2663
|
-
});
|
|
2664
|
-
}
|
|
2665
|
-
//#endregion
|
|
2666
2827
|
//#region extensions/discord/src/monitor/model-picker-preferences.ts
|
|
2667
2828
|
const DEFAULT_RECENT_LIMIT = 5;
|
|
2668
2829
|
const PREFERENCE_MAX_ENTRIES = 2e3;
|
|
@@ -3662,6 +3823,7 @@ async function applyDiscordModelPickerSelection(params) {
|
|
|
3662
3823
|
preferFollowUp: true,
|
|
3663
3824
|
threadBindings: params.threadBindings,
|
|
3664
3825
|
suppressReplies: true,
|
|
3826
|
+
buildContext: params.buildContext,
|
|
3665
3827
|
dispatchReplyFromConfig: params.dispatchReplyFromConfig,
|
|
3666
3828
|
pluginCommandDispatch: { kind: "non-plugin" }
|
|
3667
3829
|
}), 12e3);
|
|
@@ -3756,7 +3918,7 @@ async function resolveDiscordModelPickerRouteState(params) {
|
|
|
3756
3918
|
});
|
|
3757
3919
|
const memberRoleIds = Array.isArray(interaction.rawData.member?.roles) ? interaction.rawData.member.roles.map((roleId) => roleId) : [];
|
|
3758
3920
|
const threadBinding = isThreadChannel ? params.threadBindings.getByThreadId(rawChannelId) : void 0;
|
|
3759
|
-
return
|
|
3921
|
+
return resolveDiscordNativeInteractionRouteState({
|
|
3760
3922
|
cfg,
|
|
3761
3923
|
accountId,
|
|
3762
3924
|
guildId: interaction.guild?.id ?? void 0,
|
|
@@ -3766,8 +3928,7 @@ async function resolveDiscordModelPickerRouteState(params) {
|
|
|
3766
3928
|
directUserId: interaction.user?.id ?? rawChannelId,
|
|
3767
3929
|
conversationId: rawChannelId,
|
|
3768
3930
|
parentConversationId: threadParentId,
|
|
3769
|
-
threadBinding
|
|
3770
|
-
enforceConfiguredBindingReadiness: params.enforceConfiguredBindingReadiness
|
|
3931
|
+
threadBinding
|
|
3771
3932
|
});
|
|
3772
3933
|
}
|
|
3773
3934
|
async function resolveDiscordModelPickerRoute(params) {
|
|
@@ -3775,15 +3936,7 @@ async function resolveDiscordModelPickerRoute(params) {
|
|
|
3775
3936
|
}
|
|
3776
3937
|
async function resolveDiscordNativeChoiceContext(params) {
|
|
3777
3938
|
try {
|
|
3778
|
-
const
|
|
3779
|
-
interaction: params.interaction,
|
|
3780
|
-
cfg: params.cfg,
|
|
3781
|
-
accountId: params.accountId,
|
|
3782
|
-
threadBindings: params.threadBindings,
|
|
3783
|
-
enforceConfiguredBindingReadiness: true
|
|
3784
|
-
});
|
|
3785
|
-
if (resolved.bindingReadiness && !resolved.bindingReadiness.ok) return null;
|
|
3786
|
-
const route = resolved.effectiveRoute;
|
|
3939
|
+
const route = params.route ?? await resolveDiscordModelPickerRoute(params);
|
|
3787
3940
|
const fallback = resolveDefaultModelForAgent({
|
|
3788
3941
|
cfg: params.cfg,
|
|
3789
3942
|
agentId: route.agentId
|
|
@@ -4364,16 +4517,11 @@ async function handleDiscordModelPickerInteraction(params) {
|
|
|
4364
4517
|
return;
|
|
4365
4518
|
}
|
|
4366
4519
|
const applyResult = await applyDiscordModelPickerSelection({
|
|
4520
|
+
...ctx,
|
|
4367
4521
|
interaction,
|
|
4368
4522
|
selectionCommand,
|
|
4369
4523
|
dispatchCommandInteraction: params.dispatchCommandInteraction,
|
|
4370
4524
|
cfg,
|
|
4371
|
-
discordConfig: ctx.discordConfig,
|
|
4372
|
-
readPolicy: ctx.readPolicy,
|
|
4373
|
-
accountId: ctx.accountId,
|
|
4374
|
-
sessionPrefix: ctx.sessionPrefix,
|
|
4375
|
-
threadBindings: ctx.threadBindings,
|
|
4376
|
-
dispatchReplyFromConfig: ctx.dispatchReplyFromConfig,
|
|
4377
4525
|
route,
|
|
4378
4526
|
resolvedModelRef,
|
|
4379
4527
|
selectedRuntime,
|
|
@@ -4597,18 +4745,8 @@ function buildDiscordCommandOptions(params) {
|
|
|
4597
4745
|
//#region extensions/discord/src/monitor/native-command.ts
|
|
4598
4746
|
const log = createSubsystemLogger("discord/native-command");
|
|
4599
4747
|
const NON_PLUGIN_COMMAND_DISPATCH = Object.freeze({ kind: "non-plugin" });
|
|
4600
|
-
function resolveDiscordNativePolicyReader(params) {
|
|
4601
|
-
return params.readPolicy ?? createDiscordLivePolicyReader({
|
|
4602
|
-
...params,
|
|
4603
|
-
readConfig: () => getRuntimeConfigSnapshot() ?? params.cfg,
|
|
4604
|
-
resolvedAllowlist: {
|
|
4605
|
-
guildEntries: params.discordConfig?.guilds,
|
|
4606
|
-
allowFrom: params.discordConfig?.allowFrom ?? resolveDiscordAccountAllowFrom(params)
|
|
4607
|
-
}
|
|
4608
|
-
});
|
|
4609
|
-
}
|
|
4610
4748
|
function createDiscordNativeCommand(params) {
|
|
4611
|
-
const { command, cfg, discordConfig, accountId, sessionPrefix, ephemeralDefault, threadBindings, dispatchReplyFromConfig } = params;
|
|
4749
|
+
const { command, cfg, discordConfig, accountId, sessionPrefix, ephemeralDefault, threadBindings, buildContext, dispatchReplyFromConfig } = params;
|
|
4612
4750
|
const fallbackCommandDefinition = createNativeCommandDefinition(command);
|
|
4613
4751
|
const pluginCommandCandidate = "prepareDispatch" in command ? command : void 0;
|
|
4614
4752
|
const commandDefinition = pluginCommandCandidate ? fallbackCommandDefinition : findCommandByNativeName$1(command.name, "discord", { includeBundledChannelFallback: false }) ?? fallbackCommandDefinition;
|
|
@@ -4627,6 +4765,9 @@ function createDiscordNativeCommand(params) {
|
|
|
4627
4765
|
...policy,
|
|
4628
4766
|
isPolicyCurrent: policy.isCurrent,
|
|
4629
4767
|
accountId,
|
|
4768
|
+
sessionPrefix,
|
|
4769
|
+
threadBindings,
|
|
4770
|
+
buildContext,
|
|
4630
4771
|
skipCommandOwnerAllowFrom: pluginCommandCandidate !== void 0
|
|
4631
4772
|
});
|
|
4632
4773
|
},
|
|
@@ -4681,6 +4822,7 @@ function createDiscordNativeCommand(params) {
|
|
|
4681
4822
|
preferFollowUp: true,
|
|
4682
4823
|
threadBindings,
|
|
4683
4824
|
responseEphemeral: ephemeralDefault,
|
|
4825
|
+
buildContext,
|
|
4684
4826
|
dispatchReplyFromConfig,
|
|
4685
4827
|
pluginCommandDispatch: preparedPluginCommand ?? NON_PLUGIN_COMMAND_DISPATCH
|
|
4686
4828
|
});
|
|
@@ -4688,7 +4830,7 @@ function createDiscordNativeCommand(params) {
|
|
|
4688
4830
|
}();
|
|
4689
4831
|
}
|
|
4690
4832
|
async function dispatchDiscordCommandInteraction(params) {
|
|
4691
|
-
const { interaction, prompt, command, commandArgs, cfg: inputConfig, discordConfig: inputDiscordConfig, accountId, sessionPrefix, preferFollowUp, threadBindings, responseEphemeral, suppressReplies, dispatchReplyFromConfig } = params;
|
|
4833
|
+
const { interaction, prompt, command, commandArgs, cfg: inputConfig, discordConfig: inputDiscordConfig, accountId, sessionPrefix, preferFollowUp, threadBindings, responseEphemeral, suppressReplies, buildContext, dispatchReplyFromConfig } = params;
|
|
4692
4834
|
const policy = await params.readPolicy?.();
|
|
4693
4835
|
const cfg = policy?.cfg ?? getRuntimeConfigSnapshot() ?? inputConfig;
|
|
4694
4836
|
const discordConfig = policy?.discordConfig ?? inputDiscordConfig;
|
|
@@ -4715,12 +4857,13 @@ async function dispatchDiscordCommandInteraction(params) {
|
|
|
4715
4857
|
pluralkitInfo: null
|
|
4716
4858
|
});
|
|
4717
4859
|
const channel = interaction.channel;
|
|
4718
|
-
const
|
|
4860
|
+
const channelContext = await resolveDiscordNativeInteractionChannelContext({
|
|
4719
4861
|
channel,
|
|
4720
4862
|
client: interaction.client,
|
|
4721
4863
|
hasGuild: Boolean(interaction.guild),
|
|
4722
4864
|
channelIdFallback: interaction.rawData.channel_id ?? ""
|
|
4723
4865
|
});
|
|
4866
|
+
const { isDirectMessage, isGroupDm, isThreadChannel, channelName, channelSlug, rawChannelId, threadParentId, threadParentName, threadParentSlug } = channelContext;
|
|
4724
4867
|
if (policy?.isCurrent() === false) {
|
|
4725
4868
|
await respond("Access policy changed. Try this interaction again.", { ephemeral: true });
|
|
4726
4869
|
return { accepted: false };
|
|
@@ -4731,7 +4874,6 @@ async function dispatchDiscordCommandInteraction(params) {
|
|
|
4731
4874
|
cfg,
|
|
4732
4875
|
accountId
|
|
4733
4876
|
}) ?? [];
|
|
4734
|
-
const commandOwnerAllowFrom = resolveDiscordCommandOwnerAllowFrom(cfg);
|
|
4735
4877
|
const { ownerAllowList: discordOwnerAllowList, ownerAllowed: discordOwnerOk } = resolveDiscordOwnerAccess({
|
|
4736
4878
|
allowFrom: configuredDmAllowFrom,
|
|
4737
4879
|
sender: {
|
|
@@ -4741,18 +4883,6 @@ async function dispatchDiscordCommandInteraction(params) {
|
|
|
4741
4883
|
},
|
|
4742
4884
|
allowNameMatching
|
|
4743
4885
|
});
|
|
4744
|
-
const { ownerAllowed: commandOwnerOk } = resolveDiscordOwnerAccess({
|
|
4745
|
-
allowFrom: commandOwnerAllowFrom,
|
|
4746
|
-
sender: {
|
|
4747
|
-
id: sender.id,
|
|
4748
|
-
name: sender.name,
|
|
4749
|
-
tag: sender.tag
|
|
4750
|
-
},
|
|
4751
|
-
allowNameMatching
|
|
4752
|
-
});
|
|
4753
|
-
const commandOwnerAllowAll = commandOwnerAllowFrom?.includes("*") === true;
|
|
4754
|
-
const senderIsCommandOwner = commandOwnerOk;
|
|
4755
|
-
const commandOwnerAccessAllowed = senderIsCommandOwner || commandOwnerAllowAll;
|
|
4756
4886
|
const ownerAllowListConfigured = discordOwnerAllowList != null;
|
|
4757
4887
|
const ownerOk = discordOwnerOk;
|
|
4758
4888
|
const { commandsAllowFromAccess, guildInfo, channelConfig } = resolveDiscordNativeCommandChannelAccessContext({
|
|
@@ -4770,8 +4900,8 @@ async function dispatchDiscordCommandInteraction(params) {
|
|
|
4770
4900
|
threadParentName,
|
|
4771
4901
|
threadParentSlug
|
|
4772
4902
|
});
|
|
4773
|
-
let
|
|
4774
|
-
const getNativeRouteState = () =>
|
|
4903
|
+
let nativeRouteState;
|
|
4904
|
+
const getNativeRouteState = () => nativeRouteState ??= nativeCommandRuntime.resolveDiscordNativeInteractionRouteState({
|
|
4775
4905
|
cfg,
|
|
4776
4906
|
accountId,
|
|
4777
4907
|
guildId: interaction.guild?.id ?? void 0,
|
|
@@ -4781,19 +4911,18 @@ async function dispatchDiscordCommandInteraction(params) {
|
|
|
4781
4911
|
directUserId: user.id,
|
|
4782
4912
|
conversationId: rawChannelId || "unknown",
|
|
4783
4913
|
parentConversationId: threadParentId,
|
|
4784
|
-
threadBinding: isThreadChannel ? threadBindings.getByThreadId(rawChannelId) : void 0
|
|
4785
|
-
enforceConfiguredBindingReadiness: !shouldBypassConfiguredAcpEnsure(commandName)
|
|
4914
|
+
threadBinding: isThreadChannel ? threadBindings.getByThreadId(rawChannelId) : void 0
|
|
4786
4915
|
});
|
|
4787
|
-
const canBypassConfiguredAcpGuildGuards =
|
|
4916
|
+
const canBypassConfiguredAcpGuildGuards = () => {
|
|
4788
4917
|
if (!interaction.guild || !shouldBypassConfiguredAcpGuildGuards(commandName)) return false;
|
|
4789
|
-
const routeState =
|
|
4790
|
-
return routeState.effectiveRoute.matchedBy === "binding.channel" || routeState.boundSessionKey != null || routeState.configuredBinding != null
|
|
4918
|
+
const routeState = getNativeRouteState();
|
|
4919
|
+
return routeState.effectiveRoute.matchedBy === "binding.channel" || routeState.boundSessionKey != null || routeState.configuredBinding != null;
|
|
4791
4920
|
};
|
|
4792
|
-
if (channelConfig?.enabled === false && !
|
|
4921
|
+
if (channelConfig?.enabled === false && !canBypassConfiguredAcpGuildGuards()) {
|
|
4793
4922
|
await respond("This channel is disabled.");
|
|
4794
4923
|
return { accepted: false };
|
|
4795
4924
|
}
|
|
4796
|
-
if (interaction.guild && channelConfig?.allowed === false && !
|
|
4925
|
+
if (interaction.guild && channelConfig?.allowed === false && !canBypassConfiguredAcpGuildGuards()) {
|
|
4797
4926
|
await respond("This channel is not allowed.");
|
|
4798
4927
|
return { accepted: false };
|
|
4799
4928
|
}
|
|
@@ -4807,7 +4936,7 @@ async function dispatchDiscordCommandInteraction(params) {
|
|
|
4807
4936
|
groupPolicy,
|
|
4808
4937
|
guildInfo,
|
|
4809
4938
|
channelConfig
|
|
4810
|
-
}).allowed && !
|
|
4939
|
+
}).allowed && !canBypassConfiguredAcpGuildGuards()) {
|
|
4811
4940
|
await respond("This channel is not allowed.");
|
|
4812
4941
|
return { accepted: false };
|
|
4813
4942
|
}
|
|
@@ -4895,7 +5024,7 @@ async function dispatchDiscordCommandInteraction(params) {
|
|
|
4895
5024
|
ownerAllowListConfigured,
|
|
4896
5025
|
ownerAllowed: ownerOk
|
|
4897
5026
|
});
|
|
4898
|
-
if (!commandAuthorized && !
|
|
5027
|
+
if (!commandAuthorized && !canBypassConfiguredAcpGuildGuards()) {
|
|
4899
5028
|
await respond("You are not authorized to use this command.", { ephemeral: true });
|
|
4900
5029
|
return { accepted: false };
|
|
4901
5030
|
}
|
|
@@ -4904,18 +5033,63 @@ async function dispatchDiscordCommandInteraction(params) {
|
|
|
4904
5033
|
await respond("Access policy changed. Try this interaction again.", { ephemeral: true });
|
|
4905
5034
|
return { accepted: false };
|
|
4906
5035
|
}
|
|
4907
|
-
|
|
5036
|
+
const routeState = getNativeRouteState();
|
|
5037
|
+
const effectiveRoute = routeState.effectiveRoute;
|
|
5038
|
+
const { ctxPayload, sessionKey, commandTargetSessionKey } = await buildDiscordNativeInteractionContext({
|
|
5039
|
+
buildContext,
|
|
5040
|
+
interaction,
|
|
5041
|
+
channelContext,
|
|
5042
|
+
route: effectiveRoute,
|
|
5043
|
+
boundSessionKey: routeState.boundSessionKey,
|
|
5044
|
+
sessionPrefix,
|
|
5045
|
+
prompt,
|
|
5046
|
+
commandArgs: commandArgs ?? {},
|
|
5047
|
+
channelConfig,
|
|
5048
|
+
guildInfo,
|
|
5049
|
+
allowNameMatching,
|
|
5050
|
+
commandAuthorized,
|
|
5051
|
+
user,
|
|
5052
|
+
sender
|
|
5053
|
+
});
|
|
5054
|
+
const mediaLocalRoots = getAgentScopedMediaLocalRoots(cfg, effectiveRoute.agentId);
|
|
5055
|
+
if (policy?.isCurrent() === false) {
|
|
5056
|
+
await respond("Access policy changed. Try this interaction again.", { ephemeral: true });
|
|
5057
|
+
return { accepted: false };
|
|
5058
|
+
}
|
|
5059
|
+
const authority = createDiscordNativeCommandAuthority({
|
|
5060
|
+
cfg,
|
|
5061
|
+
ctx: ctxPayload,
|
|
5062
|
+
commandAuthorized,
|
|
5063
|
+
sender,
|
|
5064
|
+
allowNameMatching,
|
|
5065
|
+
isPolicyCurrent: policy?.isCurrent,
|
|
5066
|
+
accountId,
|
|
5067
|
+
guildId: interaction.guild?.id,
|
|
5068
|
+
commandName,
|
|
5069
|
+
pluginCommand: params.pluginCommandDispatch.kind === "plugin"
|
|
5070
|
+
});
|
|
5071
|
+
if (!authority.isAllowed()) {
|
|
5072
|
+
await respond("You are not authorized to use this command.", { ephemeral: true });
|
|
5073
|
+
return { accepted: false };
|
|
5074
|
+
}
|
|
5075
|
+
const bindingReadiness = routeState.configuredBinding && !shouldBypassConfiguredAcpEnsure(commandName) ? await nativeCommandRuntime.ensureConfiguredBindingRouteReady({
|
|
5076
|
+
cfg,
|
|
5077
|
+
bindingResolution: routeState.configuredBinding,
|
|
5078
|
+
assertActive: authority.assertActive
|
|
5079
|
+
}) : null;
|
|
5080
|
+
if (!authority.isAllowed()) {
|
|
4908
5081
|
await respond("You are not authorized to use this command.", { ephemeral: true });
|
|
4909
5082
|
return { accepted: false };
|
|
4910
5083
|
}
|
|
4911
5084
|
const isGuild = Boolean(interaction.guild);
|
|
4912
5085
|
const channelId = rawChannelId || "unknown";
|
|
4913
5086
|
const menuNeedsModelContext = !(commandArgs?.raw && !commandArgs.values) && command.args?.some((arg) => typeof arg.choices === "function" && commandArgs?.values?.[arg.name] == null);
|
|
4914
|
-
const menuModelContext = menuNeedsModelContext ? await resolveDiscordNativeChoiceContext({
|
|
5087
|
+
const menuModelContext = menuNeedsModelContext && bindingReadiness?.ok !== false ? await resolveDiscordNativeChoiceContext({
|
|
4915
5088
|
interaction,
|
|
4916
5089
|
cfg,
|
|
4917
5090
|
accountId,
|
|
4918
|
-
threadBindings
|
|
5091
|
+
threadBindings,
|
|
5092
|
+
route: effectiveRoute
|
|
4919
5093
|
}) : null;
|
|
4920
5094
|
const menuModelCatalog = command.key === "think" && menuNeedsModelContext ? await loadPreparedModelCatalog({
|
|
4921
5095
|
config: cfg,
|
|
@@ -4925,17 +5099,20 @@ async function dispatchDiscordCommandInteraction(params) {
|
|
|
4925
5099
|
} : {},
|
|
4926
5100
|
readOnly: true
|
|
4927
5101
|
}) : void 0;
|
|
4928
|
-
const
|
|
4929
|
-
const menu = menuRouteState?.bindingReadiness?.ok === false ? null : resolveCommandArgMenu({
|
|
5102
|
+
const menu = command.key === "verbose" && bindingReadiness?.ok === false ? null : resolveCommandArgMenu({
|
|
4930
5103
|
command,
|
|
4931
5104
|
args: commandArgs,
|
|
4932
5105
|
cfg,
|
|
4933
|
-
session:
|
|
5106
|
+
session: command.key === "verbose" ? effectiveRoute : void 0,
|
|
4934
5107
|
provider: menuModelContext?.provider,
|
|
4935
5108
|
model: menuModelContext?.model,
|
|
4936
5109
|
agentRuntime: menuModelContext?.agentRuntime,
|
|
4937
5110
|
catalog: menuModelCatalog
|
|
4938
5111
|
});
|
|
5112
|
+
if (policy?.isCurrent() === false) {
|
|
5113
|
+
await respond("Access policy changed. Try this interaction again.", { ephemeral: true });
|
|
5114
|
+
return { accepted: false };
|
|
5115
|
+
}
|
|
4939
5116
|
if (menu) {
|
|
4940
5117
|
const menuPayload = buildDiscordCommandArgMenu({
|
|
4941
5118
|
command,
|
|
@@ -4947,6 +5124,7 @@ async function dispatchDiscordCommandInteraction(params) {
|
|
|
4947
5124
|
accountId,
|
|
4948
5125
|
sessionPrefix,
|
|
4949
5126
|
threadBindings,
|
|
5127
|
+
buildContext,
|
|
4950
5128
|
dispatchReplyFromConfig
|
|
4951
5129
|
},
|
|
4952
5130
|
safeInteractionCall: safeDiscordInteractionCall,
|
|
@@ -4974,19 +5152,20 @@ async function dispatchDiscordCommandInteraction(params) {
|
|
|
4974
5152
|
}
|
|
4975
5153
|
const messageThreadId = !isDirectMessage && isThreadChannel ? channelId : void 0;
|
|
4976
5154
|
const pluginThreadParentId = !isDirectMessage && isThreadChannel ? threadParentId : void 0;
|
|
4977
|
-
const routeState = await getNativeRouteState();
|
|
4978
|
-
const { effectiveRoute } = routeState;
|
|
4979
5155
|
const pluginCommandAgentId = (isThreadChannel ? threadBindings.getByThreadId(rawChannelId)?.agentId : void 0) || routeState.configuredBinding?.statefulTarget.agentId || effectiveRoute.agentId;
|
|
4980
5156
|
const targetSessionEntry = nativeCommandRuntime.getSessionEntry({
|
|
4981
5157
|
agentId: pluginCommandAgentId,
|
|
4982
5158
|
sessionKey: effectiveRoute.sessionKey
|
|
4983
5159
|
});
|
|
5160
|
+
authority.assertActive();
|
|
5161
|
+
const senderIsOwner = authority.senderIsOwner();
|
|
4984
5162
|
const pluginReply = await params.pluginCommandDispatch.execute({
|
|
4985
5163
|
senderId: sender.id,
|
|
4986
5164
|
channel: "discord",
|
|
4987
5165
|
channelId,
|
|
4988
5166
|
isAuthorizedSender: commandAuthorized,
|
|
4989
|
-
senderIsOwner
|
|
5167
|
+
senderIsOwner,
|
|
5168
|
+
...senderIsOwner ? { assertOwnerCurrent: authority.assertOwnerCurrent } : {},
|
|
4990
5169
|
agentId: pluginCommandAgentId,
|
|
4991
5170
|
sessionKey: effectiveRoute.sessionKey,
|
|
4992
5171
|
authProfileId: targetSessionEntry?.authProfileOverride,
|
|
@@ -5047,58 +5226,14 @@ async function dispatchDiscordCommandInteraction(params) {
|
|
|
5047
5226
|
});
|
|
5048
5227
|
return { accepted: true };
|
|
5049
5228
|
}
|
|
5050
|
-
|
|
5051
|
-
const routeState = await getNativeRouteState();
|
|
5052
|
-
if (routeState.bindingReadiness && !routeState.bindingReadiness.ok) {
|
|
5229
|
+
if (bindingReadiness && !bindingReadiness.ok) {
|
|
5053
5230
|
const configuredBinding = routeState.configuredBinding;
|
|
5054
5231
|
if (configuredBinding) {
|
|
5055
|
-
logVerbose(`discord native command: configured ACP binding unavailable for channel ${configuredBinding.record.conversation.conversationId}: ${
|
|
5232
|
+
logVerbose(`discord native command: configured ACP binding unavailable for channel ${configuredBinding.record.conversation.conversationId}: ${bindingReadiness.error}`);
|
|
5056
5233
|
await respond("Configured ACP binding is unavailable right now. Please try again.");
|
|
5057
5234
|
return { accepted: false };
|
|
5058
5235
|
}
|
|
5059
5236
|
}
|
|
5060
|
-
const boundSessionKey = routeState.boundSessionKey;
|
|
5061
|
-
const effectiveRoute = routeState.effectiveRoute;
|
|
5062
|
-
const { sessionKey, commandTargetSessionKey } = resolveNativeCommandSessionTargets({
|
|
5063
|
-
agentId: effectiveRoute.agentId,
|
|
5064
|
-
sessionPrefix,
|
|
5065
|
-
userId: user.id,
|
|
5066
|
-
targetSessionKey: effectiveRoute.sessionKey,
|
|
5067
|
-
boundSessionKey
|
|
5068
|
-
});
|
|
5069
|
-
const mediaLocalRoots = getAgentScopedMediaLocalRoots(cfg, effectiveRoute.agentId);
|
|
5070
|
-
const ctxPayload = buildDiscordNativeCommandContext({
|
|
5071
|
-
prompt,
|
|
5072
|
-
commandArgs: commandArgs ?? {},
|
|
5073
|
-
sessionKey,
|
|
5074
|
-
commandTargetSessionKey,
|
|
5075
|
-
accountId: effectiveRoute.accountId,
|
|
5076
|
-
interactionId,
|
|
5077
|
-
channelId,
|
|
5078
|
-
threadParentId,
|
|
5079
|
-
memberRoleIds,
|
|
5080
|
-
guildId: interaction.guild?.id,
|
|
5081
|
-
guildName: interaction.guild?.name,
|
|
5082
|
-
channelTopic: resolveDiscordChannelTopicSafe(channel),
|
|
5083
|
-
channelConfig,
|
|
5084
|
-
guildInfo,
|
|
5085
|
-
allowNameMatching,
|
|
5086
|
-
commandAuthorized,
|
|
5087
|
-
isDirectMessage,
|
|
5088
|
-
isGroupDm,
|
|
5089
|
-
isGuild,
|
|
5090
|
-
isThreadChannel,
|
|
5091
|
-
user: {
|
|
5092
|
-
id: user.id,
|
|
5093
|
-
username: user.username,
|
|
5094
|
-
globalName: user.globalName
|
|
5095
|
-
},
|
|
5096
|
-
sender: {
|
|
5097
|
-
id: sender.id,
|
|
5098
|
-
name: sender.name,
|
|
5099
|
-
tag: sender.tag
|
|
5100
|
-
}
|
|
5101
|
-
});
|
|
5102
5237
|
const directStatusResult = await maybeDeliverDiscordDirectStatus({
|
|
5103
5238
|
commandName,
|
|
5104
5239
|
suppressReplies,
|
|
@@ -5110,7 +5245,7 @@ async function dispatchDiscordCommandInteraction(params) {
|
|
|
5110
5245
|
commandTargetSessionKey,
|
|
5111
5246
|
channel: "discord",
|
|
5112
5247
|
senderId: sender.id,
|
|
5113
|
-
senderIsOwner:
|
|
5248
|
+
senderIsOwner: authority.senderIsOwner(),
|
|
5114
5249
|
isAuthorizedSender: commandAuthorized,
|
|
5115
5250
|
isGroup: isGuild || isGroupDm,
|
|
5116
5251
|
defaultGroupActivation: () => !isGuild ? "always" : channelConfig?.requireMention === false ? "always" : "mention",
|
|
@@ -7096,7 +7231,7 @@ async function runDiscordGatewayLifecycle(params) {
|
|
|
7096
7231
|
let discordVoiceRuntimePromise;
|
|
7097
7232
|
let discordProviderSessionRuntimePromise;
|
|
7098
7233
|
async function loadDiscordVoiceRuntime() {
|
|
7099
|
-
const promise = discordVoiceRuntimePromise ?? import("./voice-runtime-
|
|
7234
|
+
const promise = discordVoiceRuntimePromise ?? import("./voice-runtime-elTtjEIG.mjs").then((n) => n.t);
|
|
7100
7235
|
discordVoiceRuntimePromise = promise;
|
|
7101
7236
|
try {
|
|
7102
7237
|
return await promise;
|
|
@@ -7106,7 +7241,7 @@ async function loadDiscordVoiceRuntime() {
|
|
|
7106
7241
|
}
|
|
7107
7242
|
}
|
|
7108
7243
|
async function loadDiscordProviderSessionRuntime() {
|
|
7109
|
-
const promise = discordProviderSessionRuntimePromise ?? import("./provider-session.runtime-
|
|
7244
|
+
const promise = discordProviderSessionRuntimePromise ?? import("./provider-session.runtime-DrGAYnZv.mjs");
|
|
7110
7245
|
discordProviderSessionRuntimePromise = promise;
|
|
7111
7246
|
try {
|
|
7112
7247
|
return await promise;
|
|
@@ -9157,7 +9292,7 @@ async function dispatchPluginDiscordInteractiveEvent(params) {
|
|
|
9157
9292
|
}
|
|
9158
9293
|
//#endregion
|
|
9159
9294
|
//#region extensions/discord/src/monitor/agent-components.handlers.ts
|
|
9160
|
-
const loadComponentsRuntime = createLazyRuntimeModule(() => import("./components-
|
|
9295
|
+
const loadComponentsRuntime = createLazyRuntimeModule(() => import("./components-yBEb75bB.mjs").then((n) => n.t));
|
|
9161
9296
|
async function handleDiscordComponentEvent(params) {
|
|
9162
9297
|
const parsed = parseDiscordComponentData(params.data, resolveInteractionCustomId(params.interaction));
|
|
9163
9298
|
if (!parsed) {
|
|
@@ -9874,6 +10009,7 @@ function createDiscordProviderInteractionSurface(params) {
|
|
|
9874
10009
|
sessionPrefix: params.sessionPrefix,
|
|
9875
10010
|
ephemeralDefault: params.ephemeralDefault,
|
|
9876
10011
|
threadBindings: params.threadBindings,
|
|
10012
|
+
buildContext: params.channelRuntime?.inbound.buildContext,
|
|
9877
10013
|
dispatchReplyFromConfig: params.channelRuntime?.reply?.dispatchReplyFromConfig
|
|
9878
10014
|
});
|
|
9879
10015
|
});
|
|
@@ -9922,6 +10058,7 @@ function createDiscordProviderInteractionSurface(params) {
|
|
|
9922
10058
|
accountId: params.accountId,
|
|
9923
10059
|
sessionPrefix: params.sessionPrefix,
|
|
9924
10060
|
threadBindings: params.threadBindings,
|
|
10061
|
+
buildContext: params.channelRuntime?.inbound.buildContext,
|
|
9925
10062
|
dispatchReplyFromConfig: params.channelRuntime?.reply?.dispatchReplyFromConfig
|
|
9926
10063
|
}),
|
|
9927
10064
|
createDiscordModelPickerFallbackButton({
|
|
@@ -9931,6 +10068,7 @@ function createDiscordProviderInteractionSurface(params) {
|
|
|
9931
10068
|
accountId: params.accountId,
|
|
9932
10069
|
sessionPrefix: params.sessionPrefix,
|
|
9933
10070
|
threadBindings: params.threadBindings,
|
|
10071
|
+
buildContext: params.channelRuntime?.inbound.buildContext,
|
|
9934
10072
|
dispatchReplyFromConfig: params.channelRuntime?.reply?.dispatchReplyFromConfig
|
|
9935
10073
|
}),
|
|
9936
10074
|
createDiscordModelPickerFallbackSelect({
|
|
@@ -9940,6 +10078,7 @@ function createDiscordProviderInteractionSurface(params) {
|
|
|
9940
10078
|
accountId: params.accountId,
|
|
9941
10079
|
sessionPrefix: params.sessionPrefix,
|
|
9942
10080
|
threadBindings: params.threadBindings,
|
|
10081
|
+
buildContext: params.channelRuntime?.inbound.buildContext,
|
|
9943
10082
|
dispatchReplyFromConfig: params.channelRuntime?.reply?.dispatchReplyFromConfig
|
|
9944
10083
|
})
|
|
9945
10084
|
];
|
|
@@ -10015,7 +10154,7 @@ var VoicePlugin = class extends Plugin {
|
|
|
10015
10154
|
}
|
|
10016
10155
|
},
|
|
10017
10156
|
destroy: () => {
|
|
10018
|
-
this.adapters.delete(guildId);
|
|
10157
|
+
if (this.adapters.get(guildId) === methods) this.adapters.delete(guildId);
|
|
10019
10158
|
}
|
|
10020
10159
|
};
|
|
10021
10160
|
};
|
|
@@ -10456,7 +10595,7 @@ async function monitorDiscordProvider(opts = {}) {
|
|
|
10456
10595
|
let allowFrom = configuredDmAllowFrom ?? [];
|
|
10457
10596
|
const mediaMaxBytes = (opts.mediaMaxMb ?? discordCfg.mediaMaxMb ?? DEFAULT_DISCORD_MEDIA_MAX_MB) * 1024 * 1024;
|
|
10458
10597
|
const textLimit = resolveTextChunkLimit(cfg, "discord", account.accountId, { fallbackLimit: 2e3 });
|
|
10459
|
-
const historyLimit =
|
|
10598
|
+
const historyLimit = resolvePromptHistoryLimit(opts.historyLimit ?? discordCfg.historyLimit ?? cfg.messages?.groupChat?.historyLimit, 20);
|
|
10460
10599
|
const replyToMode = opts.replyToMode ?? discordCfg.replyToMode ?? "off";
|
|
10461
10600
|
const dmEnabled = dmConfig?.enabled ?? true;
|
|
10462
10601
|
const dmPolicy = resolveDiscordAccountDmPolicy({
|