@openclaw/matrix 2026.7.2-beta.4 → 2026.7.2-beta.7
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/README.md +1 -1
- package/dist/accounts-DfngqebB.js +130 -0
- package/dist/api.js +4 -4
- package/dist/{approval-handler.runtime-AsawryfP.js → approval-handler.runtime-DSeaIsGa.js} +4 -4
- package/dist/{approval-ids-XAMP8vN9.js → approval-ids-BdJGPAJT.js} +1 -1
- package/dist/{approval-reaction-auth-DButmM13.js → approval-reaction-auth-BjOpELxu.js} +2 -2
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel-MBtrY36B.js → channel-vj788dNZ.js} +29 -32
- package/dist/{channel.runtime-Bi4Dgy2P.js → channel.runtime-CLoF2S9T.js} +34 -40
- package/dist/{cli-CcPuMyCk.js → cli-DMqfDE-q.js} +864 -843
- package/dist/{cli-metadata-DAhDhbYX.js → cli-metadata-C7D53SND.js} +1 -1
- package/dist/cli-metadata.js +1 -1
- package/dist/{client-BwX6rURh.js → client-6eRENr7k.js} +2 -2
- package/dist/{client-Dg8dk8NW.js → client-Dbso3-0V.js} +2 -2
- package/dist/{client-bootstrap-ZAaO9fZ-.js → client-bootstrap-XsIkHNt0.js} +1 -1
- package/dist/{config-schema-CggnuwnJ.js → config-schema-Djxw3C6b.js} +17 -3
- package/dist/contract-api.js +2 -2
- package/dist/{create-client-Und1YmJ2.js → create-client-BmSU-q-D.js} +3 -3
- package/dist/{crypto-runtime-_j7TpS7k.js → crypto-runtime-D9_6J5tZ.js} +2 -2
- package/dist/{device-health-D4LBxuPq.js → device-health-B4-YXtJR.js} +6 -1
- package/dist/{directory-live-B6fbX6jf.js → directory-live-C8dVBiCc.js} +3 -3
- package/dist/{doctor-C0LPJGTz.js → doctor-CM8ijNpW.js} +1 -1
- package/dist/{doctor-contract-CWVdlRQR.js → doctor-contract-BMSJkkAE.js} +21 -37
- package/dist/doctor-contract-api.js +4 -4
- package/dist/{draft-stream-BfibauH1.js → draft-stream-CtvOXq0Z.js} +6 -1
- package/dist/{file-sync-store-DUEWCEjb.js → file-sync-store-DiiFsayX.js} +1 -1
- package/dist/{http-client-DOyTG9l2.js → http-client-CycYxU9-.js} +1 -1
- package/dist/{idb-persistence-C6zQfW2w.js → idb-persistence-B6x7dMsF.js} +5 -11
- package/dist/index.js +1 -1
- package/dist/{logging-QH-48Gr6.js → logging-DV-p52N0.js} +8 -1
- package/dist/{media-text-Cv1VIHXW.js → media-text-BTwzADS_.js} +1 -1
- package/dist/{messages-ClTgfFl6.js → messages-DxQJkhxs.js} +65 -13
- package/dist/{monitor-2BjKS9RV.js → monitor-VyWlSLwo.js} +2159 -1797
- package/dist/plugin-entry.handlers.runtime.js +1 -1
- package/dist/probe.runtime-BuieqmS3.js +3 -0
- package/dist/{profile-update-C2My3TML.js → profile-update-CffmyW_4.js} +2 -2
- package/dist/{reaction-events-Cj6thhmc.js → reaction-events-B00WSi98.js} +2 -2
- package/dist/{recovery-key-store-0O8ARdT_.js → recovery-key-store-BNnHvXdk.js} +1 -1
- package/dist/{resolve-targets-Dn11HT76.js → resolve-targets-nm2L48sh.js} +1 -1
- package/dist/{resolver.runtime-Zguh0hH9.js → resolver.runtime-DS6uPaEe.js} +1 -1
- package/dist/{room-info-B6vKD5DF.js → room-info-CAFZ3Z9J.js} +13 -12
- package/dist/{sdk-DiRXiRRf.js → sdk-bUytQHx7.js} +227 -181
- package/dist/{send-CZCmDQu8.js → send-BldGYG8g.js} +644 -121
- package/dist/session-binding-contract-api.js +1 -1
- package/dist/{setup-bootstrap-C9w01xQK.js → setup-bootstrap-Deleiibz.js} +2 -2
- package/dist/{setup-core-D6gyoyeg.js → setup-core-BVfBv2ai.js} +48 -169
- package/dist/setup-plugin-api.js +4 -3
- package/dist/{setup-surface-DZIEWtQC.js → setup-surface-BBq3WeqX.js} +24 -77
- package/dist/{shared-C7Vm9RxI.js → shared-CUMWxcMz.js} +25 -22
- package/dist/{startup-verification-D1nscMh8.js → startup-verification-wm3_i88s.js} +1 -1
- package/dist/{storage-BrkTJZov.js → storage-BvAkgzvT.js} +20 -20
- package/dist/{thread-bindings-BcYBELC7.js → thread-bindings-DGbl3vDW.js} +4 -3
- package/dist/{tool-actions.runtime-Dbco_Vwn.js → tool-actions.runtime-uu9blSqO.js} +29 -17
- package/dist/{verification-DhMBWxOJ.js → verification-DYMQ1QpI.js} +1 -1
- package/node_modules/@matrix-org/matrix-sdk-crypto-wasm/package.json +1 -1
- package/node_modules/@matrix-org/matrix-sdk-crypto-wasm/pkg/matrix_sdk_crypto_wasm.d.ts +14 -2
- package/node_modules/@matrix-org/matrix-sdk-crypto-wasm/pkg/matrix_sdk_crypto_wasm_bg.cjs +409 -384
- package/node_modules/@matrix-org/matrix-sdk-crypto-wasm/pkg/matrix_sdk_crypto_wasm_bg.js +246 -224
- package/node_modules/@matrix-org/matrix-sdk-crypto-wasm/pkg/matrix_sdk_crypto_wasm_bg.wasm +0 -0
- package/node_modules/@matrix-org/matrix-sdk-crypto-wasm/pkg/matrix_sdk_crypto_wasm_bg.wasm.d.ts +59 -58
- package/node_modules/markdown-it/node_modules/mdurl/lib/index.d.ts +28 -0
- package/node_modules/markdown-it/node_modules/mdurl/package.json +43 -0
- package/node_modules/matrix-js-sdk/CHANGELOG.md +11 -0
- package/node_modules/matrix-js-sdk/package.json +1 -1
- package/node_modules/music-metadata/node_modules/content-type/LICENSE +22 -0
- package/node_modules/music-metadata/node_modules/content-type/README.md +69 -0
- package/node_modules/music-metadata/node_modules/content-type/dist/index.d.ts +26 -0
- package/node_modules/music-metadata/node_modules/content-type/dist/index.js +170 -0
- package/node_modules/music-metadata/node_modules/content-type/dist/index.js.map +1 -0
- package/node_modules/music-metadata/node_modules/content-type/package.json +52 -0
- package/node_modules/music-metadata/node_modules/debug/LICENSE +20 -0
- package/node_modules/music-metadata/node_modules/debug/README.md +481 -0
- package/node_modules/music-metadata/node_modules/debug/package.json +64 -0
- package/node_modules/music-metadata/node_modules/debug/src/browser.js +272 -0
- package/node_modules/music-metadata/node_modules/debug/src/common.js +292 -0
- package/node_modules/music-metadata/node_modules/debug/src/index.js +10 -0
- package/node_modules/music-metadata/node_modules/debug/src/node.js +263 -0
- package/node_modules/music-metadata/node_modules/ms/index.js +162 -0
- package/node_modules/music-metadata/node_modules/ms/license.md +21 -0
- package/node_modules/music-metadata/node_modules/ms/package.json +38 -0
- package/node_modules/music-metadata/node_modules/ms/readme.md +59 -0
- package/openclaw.plugin.json +9 -1
- package/package.json +7 -8
- package/dist/probe.runtime-BWkgfbiE.js +0 -3
- package/node_modules/mdurl/package.json +0 -37
- package/npm-shrinkwrap.json +0 -557
- /package/node_modules/{agent-base → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/agent-base}/LICENSE +0 -0
- /package/node_modules/{agent-base → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/agent-base}/README.md +0 -0
- /package/node_modules/{agent-base → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/agent-base}/dist/helpers.d.ts +0 -0
- /package/node_modules/{agent-base → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/agent-base}/dist/helpers.d.ts.map +0 -0
- /package/node_modules/{agent-base → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/agent-base}/dist/helpers.js +0 -0
- /package/node_modules/{agent-base → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/agent-base}/dist/helpers.js.map +0 -0
- /package/node_modules/{agent-base → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/agent-base}/dist/index.d.ts +0 -0
- /package/node_modules/{agent-base → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/agent-base}/dist/index.d.ts.map +0 -0
- /package/node_modules/{agent-base → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/agent-base}/dist/index.js +0 -0
- /package/node_modules/{agent-base → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/agent-base}/dist/index.js.map +0 -0
- /package/node_modules/{agent-base → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/agent-base}/package.json +0 -0
- /package/node_modules/{debug → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/debug}/LICENSE +0 -0
- /package/node_modules/{debug → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/debug}/README.md +0 -0
- /package/node_modules/{debug → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/debug}/package.json +0 -0
- /package/node_modules/{debug → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/debug}/src/browser.js +0 -0
- /package/node_modules/{debug → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/debug}/src/common.js +0 -0
- /package/node_modules/{debug → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/debug}/src/index.js +0 -0
- /package/node_modules/{debug → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/debug}/src/node.js +0 -0
- /package/node_modules/{https-proxy-agent → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/https-proxy-agent}/LICENSE +0 -0
- /package/node_modules/{https-proxy-agent → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/https-proxy-agent}/README.md +0 -0
- /package/node_modules/{https-proxy-agent → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/https-proxy-agent}/dist/index.d.ts +0 -0
- /package/node_modules/{https-proxy-agent → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/https-proxy-agent}/dist/index.d.ts.map +0 -0
- /package/node_modules/{https-proxy-agent → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/https-proxy-agent}/dist/index.js +0 -0
- /package/node_modules/{https-proxy-agent → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/https-proxy-agent}/dist/index.js.map +0 -0
- /package/node_modules/{https-proxy-agent → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/https-proxy-agent}/dist/parse-proxy-response.d.ts +0 -0
- /package/node_modules/{https-proxy-agent → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/https-proxy-agent}/dist/parse-proxy-response.d.ts.map +0 -0
- /package/node_modules/{https-proxy-agent → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/https-proxy-agent}/dist/parse-proxy-response.js +0 -0
- /package/node_modules/{https-proxy-agent → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/https-proxy-agent}/dist/parse-proxy-response.js.map +0 -0
- /package/node_modules/{https-proxy-agent → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/https-proxy-agent}/package.json +0 -0
- /package/node_modules/{ms → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/ms}/index.js +0 -0
- /package/node_modules/{ms → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/ms}/license.md +0 -0
- /package/node_modules/{ms → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/ms}/package.json +0 -0
- /package/node_modules/{ms → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/ms}/readme.md +0 -0
- /package/node_modules/{node-downloader-helper → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/node-downloader-helper}/LICENSE +0 -0
- /package/node_modules/{node-downloader-helper → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/node-downloader-helper}/README.md +0 -0
- /package/node_modules/{node-downloader-helper → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/node-downloader-helper}/bin/helpers.js +0 -0
- /package/node_modules/{node-downloader-helper → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/node-downloader-helper}/bin/ndh +0 -0
- /package/node_modules/{node-downloader-helper → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/node-downloader-helper}/dist/index.js +0 -0
- /package/node_modules/{node-downloader-helper → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/node-downloader-helper}/package.json +0 -0
- /package/node_modules/{node-downloader-helper → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/node-downloader-helper}/types/index.d.ts +0 -0
- /package/node_modules/{argparse → markdown-it/node_modules/argparse}/CHANGELOG.md +0 -0
- /package/node_modules/{argparse → markdown-it/node_modules/argparse}/LICENSE +0 -0
- /package/node_modules/{argparse → markdown-it/node_modules/argparse}/README.md +0 -0
- /package/node_modules/{argparse → markdown-it/node_modules/argparse}/argparse.js +0 -0
- /package/node_modules/{argparse → markdown-it/node_modules/argparse}/lib/sub.js +0 -0
- /package/node_modules/{argparse → markdown-it/node_modules/argparse}/lib/textwrap.js +0 -0
- /package/node_modules/{argparse → markdown-it/node_modules/argparse}/package.json +0 -0
- /package/node_modules/{entities → markdown-it/node_modules/entities}/LICENSE +0 -0
- /package/node_modules/{entities → markdown-it/node_modules/entities}/lib/decode.d.ts +0 -0
- /package/node_modules/{entities → markdown-it/node_modules/entities}/lib/decode.d.ts.map +0 -0
- /package/node_modules/{entities → markdown-it/node_modules/entities}/lib/decode.js +0 -0
- /package/node_modules/{entities → markdown-it/node_modules/entities}/lib/decode.js.map +0 -0
- /package/node_modules/{entities → markdown-it/node_modules/entities}/lib/decode_codepoint.d.ts +0 -0
- /package/node_modules/{entities → markdown-it/node_modules/entities}/lib/decode_codepoint.d.ts.map +0 -0
- /package/node_modules/{entities → markdown-it/node_modules/entities}/lib/decode_codepoint.js +0 -0
- /package/node_modules/{entities → markdown-it/node_modules/entities}/lib/decode_codepoint.js.map +0 -0
- /package/node_modules/{entities → markdown-it/node_modules/entities}/lib/encode.d.ts +0 -0
- /package/node_modules/{entities → markdown-it/node_modules/entities}/lib/encode.d.ts.map +0 -0
- /package/node_modules/{entities → markdown-it/node_modules/entities}/lib/encode.js +0 -0
- /package/node_modules/{entities → markdown-it/node_modules/entities}/lib/encode.js.map +0 -0
- /package/node_modules/{entities → markdown-it/node_modules/entities}/lib/escape.d.ts +0 -0
- /package/node_modules/{entities → markdown-it/node_modules/entities}/lib/escape.d.ts.map +0 -0
- /package/node_modules/{entities → markdown-it/node_modules/entities}/lib/escape.js +0 -0
- /package/node_modules/{entities → markdown-it/node_modules/entities}/lib/escape.js.map +0 -0
- /package/node_modules/{entities → markdown-it/node_modules/entities}/lib/esm/decode.d.ts +0 -0
- /package/node_modules/{entities → markdown-it/node_modules/entities}/lib/esm/decode.d.ts.map +0 -0
- /package/node_modules/{entities → markdown-it/node_modules/entities}/lib/esm/decode.js +0 -0
- /package/node_modules/{entities → markdown-it/node_modules/entities}/lib/esm/decode.js.map +0 -0
- /package/node_modules/{entities → markdown-it/node_modules/entities}/lib/esm/decode_codepoint.d.ts +0 -0
- /package/node_modules/{entities → markdown-it/node_modules/entities}/lib/esm/decode_codepoint.d.ts.map +0 -0
- /package/node_modules/{entities → markdown-it/node_modules/entities}/lib/esm/decode_codepoint.js +0 -0
- /package/node_modules/{entities → markdown-it/node_modules/entities}/lib/esm/decode_codepoint.js.map +0 -0
- /package/node_modules/{entities → markdown-it/node_modules/entities}/lib/esm/encode.d.ts +0 -0
- /package/node_modules/{entities → markdown-it/node_modules/entities}/lib/esm/encode.d.ts.map +0 -0
- /package/node_modules/{entities → markdown-it/node_modules/entities}/lib/esm/encode.js +0 -0
- /package/node_modules/{entities → markdown-it/node_modules/entities}/lib/esm/encode.js.map +0 -0
- /package/node_modules/{entities → markdown-it/node_modules/entities}/lib/esm/escape.d.ts +0 -0
- /package/node_modules/{entities → markdown-it/node_modules/entities}/lib/esm/escape.d.ts.map +0 -0
- /package/node_modules/{entities → markdown-it/node_modules/entities}/lib/esm/escape.js +0 -0
- /package/node_modules/{entities → markdown-it/node_modules/entities}/lib/esm/escape.js.map +0 -0
- /package/node_modules/{entities → markdown-it/node_modules/entities}/lib/esm/generated/decode-data-html.d.ts +0 -0
- /package/node_modules/{entities → markdown-it/node_modules/entities}/lib/esm/generated/decode-data-html.d.ts.map +0 -0
- /package/node_modules/{entities → markdown-it/node_modules/entities}/lib/esm/generated/decode-data-html.js +0 -0
- /package/node_modules/{entities → markdown-it/node_modules/entities}/lib/esm/generated/decode-data-html.js.map +0 -0
- /package/node_modules/{entities → markdown-it/node_modules/entities}/lib/esm/generated/decode-data-xml.d.ts +0 -0
- /package/node_modules/{entities → markdown-it/node_modules/entities}/lib/esm/generated/decode-data-xml.d.ts.map +0 -0
- /package/node_modules/{entities → markdown-it/node_modules/entities}/lib/esm/generated/decode-data-xml.js +0 -0
- /package/node_modules/{entities → markdown-it/node_modules/entities}/lib/esm/generated/decode-data-xml.js.map +0 -0
- /package/node_modules/{entities → markdown-it/node_modules/entities}/lib/esm/generated/encode-html.d.ts +0 -0
- /package/node_modules/{entities → markdown-it/node_modules/entities}/lib/esm/generated/encode-html.d.ts.map +0 -0
- /package/node_modules/{entities → markdown-it/node_modules/entities}/lib/esm/generated/encode-html.js +0 -0
- /package/node_modules/{entities → markdown-it/node_modules/entities}/lib/esm/generated/encode-html.js.map +0 -0
- /package/node_modules/{entities → markdown-it/node_modules/entities}/lib/esm/index.d.ts +0 -0
- /package/node_modules/{entities → markdown-it/node_modules/entities}/lib/esm/index.d.ts.map +0 -0
- /package/node_modules/{entities → markdown-it/node_modules/entities}/lib/esm/index.js +0 -0
- /package/node_modules/{entities → markdown-it/node_modules/entities}/lib/esm/index.js.map +0 -0
- /package/node_modules/{entities → markdown-it/node_modules/entities}/lib/esm/package.json +0 -0
- /package/node_modules/{entities → markdown-it/node_modules/entities}/lib/generated/decode-data-html.d.ts +0 -0
- /package/node_modules/{entities → markdown-it/node_modules/entities}/lib/generated/decode-data-html.d.ts.map +0 -0
- /package/node_modules/{entities → markdown-it/node_modules/entities}/lib/generated/decode-data-html.js +0 -0
- /package/node_modules/{entities → markdown-it/node_modules/entities}/lib/generated/decode-data-html.js.map +0 -0
- /package/node_modules/{entities → markdown-it/node_modules/entities}/lib/generated/decode-data-xml.d.ts +0 -0
- /package/node_modules/{entities → markdown-it/node_modules/entities}/lib/generated/decode-data-xml.d.ts.map +0 -0
- /package/node_modules/{entities → markdown-it/node_modules/entities}/lib/generated/decode-data-xml.js +0 -0
- /package/node_modules/{entities → markdown-it/node_modules/entities}/lib/generated/decode-data-xml.js.map +0 -0
- /package/node_modules/{entities → markdown-it/node_modules/entities}/lib/generated/encode-html.d.ts +0 -0
- /package/node_modules/{entities → markdown-it/node_modules/entities}/lib/generated/encode-html.d.ts.map +0 -0
- /package/node_modules/{entities → markdown-it/node_modules/entities}/lib/generated/encode-html.js +0 -0
- /package/node_modules/{entities → markdown-it/node_modules/entities}/lib/generated/encode-html.js.map +0 -0
- /package/node_modules/{entities → markdown-it/node_modules/entities}/lib/index.d.ts +0 -0
- /package/node_modules/{entities → markdown-it/node_modules/entities}/lib/index.d.ts.map +0 -0
- /package/node_modules/{entities → markdown-it/node_modules/entities}/lib/index.js +0 -0
- /package/node_modules/{entities → markdown-it/node_modules/entities}/lib/index.js.map +0 -0
- /package/node_modules/{entities → markdown-it/node_modules/entities}/package.json +0 -0
- /package/node_modules/{entities → markdown-it/node_modules/entities}/readme.md +0 -0
- /package/node_modules/{linkify-it → markdown-it/node_modules/linkify-it}/LICENSE +0 -0
- /package/node_modules/{linkify-it → markdown-it/node_modules/linkify-it}/README.md +0 -0
- /package/node_modules/{linkify-it → markdown-it/node_modules/linkify-it}/build/index.cjs.js +0 -0
- /package/node_modules/{linkify-it → markdown-it/node_modules/linkify-it}/index.mjs +0 -0
- /package/node_modules/{linkify-it → markdown-it/node_modules/linkify-it}/lib/re.mjs +0 -0
- /package/node_modules/{linkify-it → markdown-it/node_modules/linkify-it}/package.json +0 -0
- /package/node_modules/{mdurl → markdown-it/node_modules/mdurl}/LICENSE +0 -0
- /package/node_modules/{mdurl → markdown-it/node_modules/mdurl}/README.md +0 -0
- /package/node_modules/{mdurl → markdown-it/node_modules/mdurl}/build/index.cjs.js +0 -0
- /package/node_modules/{mdurl → markdown-it/node_modules/mdurl}/index.mjs +0 -0
- /package/node_modules/{mdurl → markdown-it/node_modules/mdurl}/lib/decode.mjs +0 -0
- /package/node_modules/{mdurl → markdown-it/node_modules/mdurl}/lib/encode.mjs +0 -0
- /package/node_modules/{mdurl → markdown-it/node_modules/mdurl}/lib/format.mjs +0 -0
- /package/node_modules/{mdurl → markdown-it/node_modules/mdurl}/lib/parse.mjs +0 -0
- /package/node_modules/{punycode.js → markdown-it/node_modules/punycode.js}/LICENSE-MIT.txt +0 -0
- /package/node_modules/{punycode.js → markdown-it/node_modules/punycode.js}/README.md +0 -0
- /package/node_modules/{punycode.js → markdown-it/node_modules/punycode.js}/package.json +0 -0
- /package/node_modules/{punycode.js → markdown-it/node_modules/punycode.js}/punycode.es6.js +0 -0
- /package/node_modules/{punycode.js → markdown-it/node_modules/punycode.js}/punycode.js +0 -0
- /package/node_modules/{uc.micro → markdown-it/node_modules/uc.micro}/LICENSE.txt +0 -0
- /package/node_modules/{uc.micro → markdown-it/node_modules/uc.micro}/README.md +0 -0
- /package/node_modules/{uc.micro → markdown-it/node_modules/uc.micro}/build/index.cjs.js +0 -0
- /package/node_modules/{uc.micro → markdown-it/node_modules/uc.micro}/categories/Cc/regex.mjs +0 -0
- /package/node_modules/{uc.micro → markdown-it/node_modules/uc.micro}/categories/Cf/regex.mjs +0 -0
- /package/node_modules/{uc.micro → markdown-it/node_modules/uc.micro}/categories/P/regex.mjs +0 -0
- /package/node_modules/{uc.micro → markdown-it/node_modules/uc.micro}/categories/S/regex.mjs +0 -0
- /package/node_modules/{uc.micro → markdown-it/node_modules/uc.micro}/categories/Z/regex.mjs +0 -0
- /package/node_modules/{uc.micro → markdown-it/node_modules/uc.micro}/index.mjs +0 -0
- /package/node_modules/{uc.micro → markdown-it/node_modules/uc.micro}/package.json +0 -0
- /package/node_modules/{uc.micro → markdown-it/node_modules/uc.micro}/properties/Any/regex.mjs +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/LICENSE +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/README.md +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/OverloadYield.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/applyDecoratedDescriptor.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/applyDecs2311.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/arrayLikeToArray.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/arrayWithHoles.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/arrayWithoutHoles.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/assertClassBrand.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/assertThisInitialized.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/asyncGeneratorDelegate.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/asyncIterator.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/asyncToGenerator.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/awaitAsyncGenerator.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/callSuper.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/checkInRHS.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/checkPrivateRedeclaration.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/classCallCheck.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/classNameTDZError.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/classPrivateFieldGet2.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/classPrivateFieldInitSpec.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/classPrivateFieldLooseBase.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/classPrivateFieldLooseKey.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/classPrivateFieldSet2.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/classPrivateGetter.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/classPrivateMethodInitSpec.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/classPrivateSetter.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/classStaticPrivateMethodGet.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/construct.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/createClass.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/createForOfIteratorHelper.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/createForOfIteratorHelperLoose.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/createSuper.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/defaults.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/defineAccessor.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/defineProperty.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/OverloadYield.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/applyDecoratedDescriptor.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/applyDecs2311.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/arrayLikeToArray.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/arrayWithHoles.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/arrayWithoutHoles.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/assertClassBrand.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/assertThisInitialized.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/asyncGeneratorDelegate.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/asyncIterator.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/asyncToGenerator.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/awaitAsyncGenerator.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/callSuper.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/checkInRHS.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/checkPrivateRedeclaration.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/classCallCheck.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/classNameTDZError.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/classPrivateFieldGet2.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/classPrivateFieldInitSpec.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/classPrivateFieldLooseBase.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/classPrivateFieldLooseKey.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/classPrivateFieldSet2.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/classPrivateGetter.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/classPrivateMethodInitSpec.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/classPrivateSetter.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/classStaticPrivateMethodGet.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/construct.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/createClass.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/createForOfIteratorHelper.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/createForOfIteratorHelperLoose.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/createSuper.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/defaults.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/defineAccessor.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/defineProperty.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/extends.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/get.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/getPrototypeOf.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/identity.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/importDeferProxy.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/inherits.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/inheritsLoose.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/initializerDefineProperty.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/initializerWarningHelper.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/instanceof.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/interopRequireDefault.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/interopRequireWildcard.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/isNativeFunction.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/isNativeReflectConstruct.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/iterableToArray.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/iterableToArrayLimit.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/jsx.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/maybeArrayLike.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/newArrowCheck.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/nonIterableRest.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/nonIterableSpread.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/nullishReceiverError.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/objectDestructuringEmpty.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/objectSpread2.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/objectWithoutProperties.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/objectWithoutPropertiesLoose.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/package.json +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/possibleConstructorReturn.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/readOnlyError.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/regenerator.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/regeneratorAsync.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/regeneratorAsyncGen.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/regeneratorAsyncIterator.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/regeneratorDefine.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/regeneratorKeys.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/regeneratorValues.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/set.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/setFunctionName.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/setPrototypeOf.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/skipFirstGeneratorNext.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/slicedToArray.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/superPropBase.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/superPropGet.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/superPropSet.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/taggedTemplateLiteral.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/taggedTemplateLiteralLoose.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/tdz.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/temporalRef.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/temporalUndefined.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/toArray.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/toConsumableArray.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/toPrimitive.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/toPropertyKey.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/toSetter.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/tsRewriteRelativeImportExtensions.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/typeof.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/unsupportedIterableToArray.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/usingCtx.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/wrapAsyncGenerator.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/wrapNativeSuper.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/wrapRegExp.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/writeOnlyError.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/extends.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/get.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/getPrototypeOf.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/identity.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/importDeferProxy.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/inherits.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/inheritsLoose.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/initializerDefineProperty.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/initializerWarningHelper.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/instanceof.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/interopRequireDefault.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/interopRequireWildcard.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/isNativeFunction.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/isNativeReflectConstruct.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/iterableToArray.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/iterableToArrayLimit.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/jsx.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/maybeArrayLike.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/newArrowCheck.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/nonIterableRest.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/nonIterableSpread.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/nullishReceiverError.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/objectDestructuringEmpty.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/objectSpread2.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/objectWithoutProperties.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/objectWithoutPropertiesLoose.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/possibleConstructorReturn.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/readOnlyError.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/regenerator.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/regeneratorAsync.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/regeneratorAsyncGen.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/regeneratorAsyncIterator.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/regeneratorDefine.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/regeneratorKeys.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/regeneratorValues.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/set.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/setFunctionName.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/setPrototypeOf.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/skipFirstGeneratorNext.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/slicedToArray.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/superPropBase.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/superPropGet.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/superPropSet.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/taggedTemplateLiteral.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/taggedTemplateLiteralLoose.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/tdz.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/temporalRef.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/temporalUndefined.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/toArray.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/toConsumableArray.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/toPrimitive.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/toPropertyKey.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/toSetter.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/tsRewriteRelativeImportExtensions.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/typeof.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/unsupportedIterableToArray.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/usingCtx.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/wrapAsyncGenerator.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/wrapNativeSuper.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/wrapRegExp.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/writeOnlyError.js +0 -0
- /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/package.json +0 -0
- /package/node_modules/{@types → matrix-js-sdk/node_modules/@types}/events/LICENSE +0 -0
- /package/node_modules/{@types → matrix-js-sdk/node_modules/@types}/events/README.md +0 -0
- /package/node_modules/{@types → matrix-js-sdk/node_modules/@types}/events/index.d.ts +0 -0
- /package/node_modules/{@types → matrix-js-sdk/node_modules/@types}/events/package.json +0 -0
- /package/node_modules/{another-json → matrix-js-sdk/node_modules/another-json}/.jshint +0 -0
- /package/node_modules/{another-json → matrix-js-sdk/node_modules/another-json}/.npmignore +0 -0
- /package/node_modules/{another-json → matrix-js-sdk/node_modules/another-json}/.travis.yml +0 -0
- /package/node_modules/{another-json → matrix-js-sdk/node_modules/another-json}/LICENSE +0 -0
- /package/node_modules/{another-json → matrix-js-sdk/node_modules/another-json}/README.md +0 -0
- /package/node_modules/{another-json → matrix-js-sdk/node_modules/another-json}/another-json.js +0 -0
- /package/node_modules/{another-json → matrix-js-sdk/node_modules/another-json}/package.json +0 -0
- /package/node_modules/{another-json → matrix-js-sdk/node_modules/another-json}/spec/another-json-spec.js +0 -0
- /package/node_modules/{base-x → matrix-js-sdk/node_modules/base-x}/LICENSE.md +0 -0
- /package/node_modules/{base-x → matrix-js-sdk/node_modules/base-x}/README.md +0 -0
- /package/node_modules/{base-x → matrix-js-sdk/node_modules/base-x}/package.json +0 -0
- /package/node_modules/{base-x → matrix-js-sdk/node_modules/base-x}/src/cjs/index.cjs +0 -0
- /package/node_modules/{base-x → matrix-js-sdk/node_modules/base-x}/src/cjs/index.d.ts +0 -0
- /package/node_modules/{base-x → matrix-js-sdk/node_modules/base-x}/src/esm/index.js +0 -0
- /package/node_modules/{bs58 → matrix-js-sdk/node_modules/bs58}/LICENSE +0 -0
- /package/node_modules/{bs58 → matrix-js-sdk/node_modules/bs58}/README.md +0 -0
- /package/node_modules/{bs58 → matrix-js-sdk/node_modules/bs58}/package.json +0 -0
- /package/node_modules/{bs58 → matrix-js-sdk/node_modules/bs58}/src/cjs/index.cjs +0 -0
- /package/node_modules/{bs58 → matrix-js-sdk/node_modules/bs58}/src/cjs/index.d.ts +0 -0
- /package/node_modules/{bs58 → matrix-js-sdk/node_modules/bs58}/src/esm/index.js +0 -0
- /package/node_modules/{content-type → matrix-js-sdk/node_modules/content-type}/LICENSE +0 -0
- /package/node_modules/{content-type → matrix-js-sdk/node_modules/content-type}/README.md +0 -0
- /package/node_modules/{content-type → matrix-js-sdk/node_modules/content-type}/dist/index.d.ts +0 -0
- /package/node_modules/{content-type → matrix-js-sdk/node_modules/content-type}/dist/index.js +0 -0
- /package/node_modules/{content-type → matrix-js-sdk/node_modules/content-type}/dist/index.js.map +0 -0
- /package/node_modules/{content-type → matrix-js-sdk/node_modules/content-type}/package.json +0 -0
- /package/node_modules/{events → matrix-js-sdk/node_modules/events}/.airtap.yml +0 -0
- /package/node_modules/{events → matrix-js-sdk/node_modules/events}/.github/FUNDING.yml +0 -0
- /package/node_modules/{events → matrix-js-sdk/node_modules/events}/.travis.yml +0 -0
- /package/node_modules/{events → matrix-js-sdk/node_modules/events}/History.md +0 -0
- /package/node_modules/{events → matrix-js-sdk/node_modules/events}/LICENSE +0 -0
- /package/node_modules/{events → matrix-js-sdk/node_modules/events}/Readme.md +0 -0
- /package/node_modules/{events → matrix-js-sdk/node_modules/events}/events.js +0 -0
- /package/node_modules/{events → matrix-js-sdk/node_modules/events}/package.json +0 -0
- /package/node_modules/{events → matrix-js-sdk/node_modules/events}/security.md +0 -0
- /package/node_modules/{events → matrix-js-sdk/node_modules/events}/tests/add-listeners.js +0 -0
- /package/node_modules/{events → matrix-js-sdk/node_modules/events}/tests/check-listener-leaks.js +0 -0
- /package/node_modules/{events → matrix-js-sdk/node_modules/events}/tests/common.js +0 -0
- /package/node_modules/{events → matrix-js-sdk/node_modules/events}/tests/errors.js +0 -0
- /package/node_modules/{events → matrix-js-sdk/node_modules/events}/tests/events-list.js +0 -0
- /package/node_modules/{events → matrix-js-sdk/node_modules/events}/tests/events-once.js +0 -0
- /package/node_modules/{events → matrix-js-sdk/node_modules/events}/tests/index.js +0 -0
- /package/node_modules/{events → matrix-js-sdk/node_modules/events}/tests/legacy-compat.js +0 -0
- /package/node_modules/{events → matrix-js-sdk/node_modules/events}/tests/listener-count.js +0 -0
- /package/node_modules/{events → matrix-js-sdk/node_modules/events}/tests/listeners-side-effects.js +0 -0
- /package/node_modules/{events → matrix-js-sdk/node_modules/events}/tests/listeners.js +0 -0
- /package/node_modules/{events → matrix-js-sdk/node_modules/events}/tests/max-listeners.js +0 -0
- /package/node_modules/{events → matrix-js-sdk/node_modules/events}/tests/method-names.js +0 -0
- /package/node_modules/{events → matrix-js-sdk/node_modules/events}/tests/modify-in-emit.js +0 -0
- /package/node_modules/{events → matrix-js-sdk/node_modules/events}/tests/num-args.js +0 -0
- /package/node_modules/{events → matrix-js-sdk/node_modules/events}/tests/once.js +0 -0
- /package/node_modules/{events → matrix-js-sdk/node_modules/events}/tests/prepend.js +0 -0
- /package/node_modules/{events → matrix-js-sdk/node_modules/events}/tests/remove-all-listeners.js +0 -0
- /package/node_modules/{events → matrix-js-sdk/node_modules/events}/tests/remove-listeners.js +0 -0
- /package/node_modules/{events → matrix-js-sdk/node_modules/events}/tests/set-max-listeners-side-effects.js +0 -0
- /package/node_modules/{events → matrix-js-sdk/node_modules/events}/tests/special-event-names.js +0 -0
- /package/node_modules/{events → matrix-js-sdk/node_modules/events}/tests/subclass.js +0 -0
- /package/node_modules/{events → matrix-js-sdk/node_modules/events}/tests/symbols.js +0 -0
- /package/node_modules/{is-network-error → matrix-js-sdk/node_modules/is-network-error}/index.d.ts +0 -0
- /package/node_modules/{is-network-error → matrix-js-sdk/node_modules/is-network-error}/index.js +0 -0
- /package/node_modules/{file-type → matrix-js-sdk/node_modules/is-network-error}/license +0 -0
- /package/node_modules/{is-network-error → matrix-js-sdk/node_modules/is-network-error}/package.json +0 -0
- /package/node_modules/{is-network-error → matrix-js-sdk/node_modules/is-network-error}/readme.md +0 -0
- /package/node_modules/{jwt-decode → matrix-js-sdk/node_modules/jwt-decode}/LICENSE +0 -0
- /package/node_modules/{jwt-decode → matrix-js-sdk/node_modules/jwt-decode}/README.md +0 -0
- /package/node_modules/{jwt-decode → matrix-js-sdk/node_modules/jwt-decode}/build/cjs/index.d.ts +0 -0
- /package/node_modules/{jwt-decode → matrix-js-sdk/node_modules/jwt-decode}/build/cjs/index.js +0 -0
- /package/node_modules/{jwt-decode → matrix-js-sdk/node_modules/jwt-decode}/build/cjs/package.json +0 -0
- /package/node_modules/{jwt-decode → matrix-js-sdk/node_modules/jwt-decode}/build/esm/index.d.ts +0 -0
- /package/node_modules/{jwt-decode → matrix-js-sdk/node_modules/jwt-decode}/build/esm/index.js +0 -0
- /package/node_modules/{jwt-decode → matrix-js-sdk/node_modules/jwt-decode}/package.json +0 -0
- /package/node_modules/{loglevel → matrix-js-sdk/node_modules/loglevel}/.editorconfig +0 -0
- /package/node_modules/{loglevel → matrix-js-sdk/node_modules/loglevel}/CONTRIBUTING.md +0 -0
- /package/node_modules/{loglevel → matrix-js-sdk/node_modules/loglevel}/Gruntfile.js +0 -0
- /package/node_modules/{loglevel → matrix-js-sdk/node_modules/loglevel}/LICENSE-MIT +0 -0
- /package/node_modules/{loglevel → matrix-js-sdk/node_modules/loglevel}/README.md +0 -0
- /package/node_modules/{loglevel → matrix-js-sdk/node_modules/loglevel}/_config.yml +0 -0
- /package/node_modules/{loglevel → matrix-js-sdk/node_modules/loglevel}/bower.json +0 -0
- /package/node_modules/{loglevel → matrix-js-sdk/node_modules/loglevel}/demo/index.html +0 -0
- /package/node_modules/{loglevel → matrix-js-sdk/node_modules/loglevel}/demo/script.js +0 -0
- /package/node_modules/{loglevel → matrix-js-sdk/node_modules/loglevel}/demo/styles.css +0 -0
- /package/node_modules/{loglevel → matrix-js-sdk/node_modules/loglevel}/dist/loglevel.js +0 -0
- /package/node_modules/{loglevel → matrix-js-sdk/node_modules/loglevel}/dist/loglevel.min.js +0 -0
- /package/node_modules/{loglevel → matrix-js-sdk/node_modules/loglevel}/index.d.ts +0 -0
- /package/node_modules/{loglevel → matrix-js-sdk/node_modules/loglevel}/lib/loglevel.js +0 -0
- /package/node_modules/{loglevel → matrix-js-sdk/node_modules/loglevel}/package.json +0 -0
- /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/LICENSE +0 -0
- /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/README.md +0 -0
- /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/ExtensibleEvents.d.ts +0 -0
- /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/ExtensibleEvents.js +0 -0
- /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/IPartialEvent.d.ts +0 -0
- /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/IPartialEvent.js +0 -0
- /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/InvalidEventError.d.ts +0 -0
- /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/InvalidEventError.js +0 -0
- /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/NamespacedMap.d.ts +0 -0
- /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/NamespacedMap.js +0 -0
- /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/NamespacedValue.d.ts +0 -0
- /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/NamespacedValue.js +0 -0
- /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/events/EmoteEvent.d.ts +0 -0
- /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/events/EmoteEvent.js +0 -0
- /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/events/ExtensibleEvent.d.ts +0 -0
- /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/events/ExtensibleEvent.js +0 -0
- /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/events/MessageEvent.d.ts +0 -0
- /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/events/MessageEvent.js +0 -0
- /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/events/NoticeEvent.d.ts +0 -0
- /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/events/NoticeEvent.js +0 -0
- /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/events/PollEndEvent.d.ts +0 -0
- /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/events/PollEndEvent.js +0 -0
- /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/events/PollResponseEvent.d.ts +0 -0
- /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/events/PollResponseEvent.js +0 -0
- /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/events/PollStartEvent.d.ts +0 -0
- /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/events/PollStartEvent.js +0 -0
- /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/events/message_types.d.ts +0 -0
- /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/events/message_types.js +0 -0
- /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/events/poll_types.d.ts +0 -0
- /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/events/poll_types.js +0 -0
- /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/events/relationship_types.d.ts +0 -0
- /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/events/relationship_types.js +0 -0
- /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/index.d.ts +0 -0
- /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/index.js +0 -0
- /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/interpreters/legacy/MRoomMessage.d.ts +0 -0
- /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/interpreters/legacy/MRoomMessage.js +0 -0
- /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/interpreters/modern/MMessage.d.ts +0 -0
- /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/interpreters/modern/MMessage.js +0 -0
- /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/interpreters/modern/MPoll.d.ts +0 -0
- /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/interpreters/modern/MPoll.js +0 -0
- /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/types.d.ts +0 -0
- /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/types.js +0 -0
- /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/utility/MessageMatchers.d.ts +0 -0
- /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/utility/MessageMatchers.js +0 -0
- /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/utility/events.d.ts +0 -0
- /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/utility/events.js +0 -0
- /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/package.json +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/LICENSE +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/README.md +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/dist/api.js +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/dist/api.min.js +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/ClientWidgetApi.d.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/ClientWidgetApi.js +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/ClientWidgetApi.js.map +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/Symbols.d.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/Symbols.js +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/Symbols.js.map +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/WidgetApi.d.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/WidgetApi.js +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/WidgetApi.js.map +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/driver/WidgetDriver.d.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/driver/WidgetDriver.js +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/driver/WidgetDriver.js.map +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/index.d.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/index.js +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/index.js.map +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/ApiVersion.d.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/ApiVersion.js +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/ApiVersion.js.map +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/Capabilities.d.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/Capabilities.js +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/Capabilities.js.map +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/CapabilitiesAction.d.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/CapabilitiesAction.js +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/CapabilitiesAction.js.map +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/ContentLoadedAction.d.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/ContentLoadedAction.js +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/ContentLoadedAction.js.map +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/DownloadFileAction.d.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/DownloadFileAction.js +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/DownloadFileAction.js.map +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/GetMediaConfigAction.d.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/GetMediaConfigAction.js +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/GetMediaConfigAction.js.map +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/GetOpenIDAction.d.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/GetOpenIDAction.js +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/GetOpenIDAction.js.map +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/ICustomWidgetData.d.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/ICustomWidgetData.js +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/ICustomWidgetData.js.map +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/IJitsiWidgetData.d.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/IJitsiWidgetData.js +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/IJitsiWidgetData.js.map +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/IRoomAccountData.d.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/IRoomAccountData.js +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/IRoomAccountData.js.map +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/IRoomEvent.d.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/IRoomEvent.js +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/IRoomEvent.js.map +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/IStickerpickerWidgetData.d.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/IStickerpickerWidgetData.js +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/IStickerpickerWidgetData.js.map +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/IToDeviceMessage.d.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/IToDeviceMessage.js +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/IToDeviceMessage.js.map +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/IWidget.d.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/IWidget.js +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/IWidget.js.map +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/IWidgetApiErrorResponse.d.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/IWidgetApiErrorResponse.js +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/IWidgetApiErrorResponse.js.map +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/IWidgetApiRequest.d.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/IWidgetApiRequest.js +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/IWidgetApiRequest.js.map +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/IWidgetApiResponse.d.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/IWidgetApiResponse.js +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/IWidgetApiResponse.js.map +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/LanguageChangeAction.d.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/LanguageChangeAction.js +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/LanguageChangeAction.js.map +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/ModalButtonKind.d.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/ModalButtonKind.js +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/ModalButtonKind.js.map +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/ModalWidgetActions.d.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/ModalWidgetActions.js +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/ModalWidgetActions.js.map +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/NavigateAction.d.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/NavigateAction.js +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/NavigateAction.js.map +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/OpenIDCredentialsAction.d.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/OpenIDCredentialsAction.js +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/OpenIDCredentialsAction.js.map +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/ReadEventAction.d.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/ReadEventAction.js +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/ReadEventAction.js.map +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/ReadRelationsAction.d.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/ReadRelationsAction.js +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/ReadRelationsAction.js.map +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/ReadRoomAccountDataAction.d.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/ReadRoomAccountDataAction.js +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/ReadRoomAccountDataAction.js.map +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/ScreenshotAction.d.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/ScreenshotAction.js +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/ScreenshotAction.js.map +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/SendEventAction.d.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/SendEventAction.js +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/SendEventAction.js.map +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/SendToDeviceAction.d.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/SendToDeviceAction.js +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/SendToDeviceAction.js.map +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/SetModalButtonEnabledAction.d.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/SetModalButtonEnabledAction.js +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/SetModalButtonEnabledAction.js.map +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/StickerAction.d.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/StickerAction.js +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/StickerAction.js.map +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/StickyAction.d.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/StickyAction.js +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/StickyAction.js.map +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/SupportedVersionsAction.d.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/SupportedVersionsAction.js +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/SupportedVersionsAction.js.map +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/ThemeChangeAction.d.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/ThemeChangeAction.js +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/ThemeChangeAction.js.map +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/TurnServerActions.d.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/TurnServerActions.js +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/TurnServerActions.js.map +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/UpdateDelayedEventAction.d.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/UpdateDelayedEventAction.js +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/UpdateDelayedEventAction.js.map +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/UpdateStateAction.d.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/UpdateStateAction.js +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/UpdateStateAction.js.map +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/UploadFileAction.d.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/UploadFileAction.js +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/UploadFileAction.js.map +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/UserDirectorySearchAction.d.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/UserDirectorySearchAction.js +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/UserDirectorySearchAction.js.map +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/VisibilityAction.d.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/VisibilityAction.js +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/VisibilityAction.js.map +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/WidgetApiAction.d.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/WidgetApiAction.js +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/WidgetApiAction.js.map +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/WidgetApiDirection.d.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/WidgetApiDirection.js +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/WidgetApiDirection.js.map +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/WidgetConfigAction.d.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/WidgetConfigAction.js +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/WidgetConfigAction.js.map +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/WidgetKind.d.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/WidgetKind.js +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/WidgetKind.js.map +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/WidgetType.d.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/WidgetType.js +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/WidgetType.js.map +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/models/Widget.d.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/models/Widget.js +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/models/Widget.js.map +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/models/WidgetEventCapability.d.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/models/WidgetEventCapability.js +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/models/WidgetEventCapability.js.map +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/models/WidgetParser.d.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/models/WidgetParser.js +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/models/WidgetParser.js.map +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/models/validation/url.d.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/models/validation/url.js +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/models/validation/url.js.map +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/models/validation/utils.d.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/models/validation/utils.js +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/models/validation/utils.js.map +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/templating/url-template.d.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/templating/url-template.js +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/templating/url-template.js.map +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/transport/ITransport.d.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/transport/ITransport.js +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/transport/ITransport.js.map +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/transport/PostmessageTransport.d.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/transport/PostmessageTransport.js +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/transport/PostmessageTransport.js.map +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/util/SimpleObservable.d.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/util/SimpleObservable.js +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/util/SimpleObservable.js.map +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/package.json +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/ClientWidgetApi.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/Symbols.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/WidgetApi.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/driver/WidgetDriver.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/index.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/ApiVersion.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/Capabilities.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/CapabilitiesAction.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/ContentLoadedAction.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/DownloadFileAction.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/GetMediaConfigAction.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/GetOpenIDAction.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/ICustomWidgetData.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/IJitsiWidgetData.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/IRoomAccountData.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/IRoomEvent.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/IStickerpickerWidgetData.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/IToDeviceMessage.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/IWidget.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/IWidgetApiErrorResponse.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/IWidgetApiRequest.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/IWidgetApiResponse.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/LanguageChangeAction.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/ModalButtonKind.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/ModalWidgetActions.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/NavigateAction.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/OpenIDCredentialsAction.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/ReadEventAction.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/ReadRelationsAction.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/ReadRoomAccountDataAction.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/ScreenshotAction.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/SendEventAction.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/SendToDeviceAction.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/SetModalButtonEnabledAction.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/StickerAction.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/StickyAction.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/SupportedVersionsAction.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/ThemeChangeAction.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/TurnServerActions.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/UpdateDelayedEventAction.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/UpdateStateAction.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/UploadFileAction.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/UserDirectorySearchAction.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/VisibilityAction.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/WidgetApiAction.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/WidgetApiDirection.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/WidgetConfigAction.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/WidgetKind.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/WidgetType.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/models/Widget.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/models/WidgetEventCapability.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/models/WidgetParser.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/models/validation/url.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/models/validation/utils.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/templating/url-template.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/transport/ITransport.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/transport/PostmessageTransport.ts +0 -0
- /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/util/SimpleObservable.ts +0 -0
- /package/node_modules/{oidc-client-ts → matrix-js-sdk/node_modules/oidc-client-ts}/LICENSE +0 -0
- /package/node_modules/{oidc-client-ts → matrix-js-sdk/node_modules/oidc-client-ts}/README.md +0 -0
- /package/node_modules/{oidc-client-ts → matrix-js-sdk/node_modules/oidc-client-ts}/dist/browser/oidc-client-ts.js +0 -0
- /package/node_modules/{oidc-client-ts → matrix-js-sdk/node_modules/oidc-client-ts}/dist/browser/oidc-client-ts.js.map +0 -0
- /package/node_modules/{oidc-client-ts → matrix-js-sdk/node_modules/oidc-client-ts}/dist/browser/oidc-client-ts.min.js +0 -0
- /package/node_modules/{oidc-client-ts → matrix-js-sdk/node_modules/oidc-client-ts}/dist/browser/oidc-client-ts.min.js.map +0 -0
- /package/node_modules/{oidc-client-ts → matrix-js-sdk/node_modules/oidc-client-ts}/dist/esm/oidc-client-ts.js +0 -0
- /package/node_modules/{oidc-client-ts → matrix-js-sdk/node_modules/oidc-client-ts}/dist/esm/oidc-client-ts.js.map +0 -0
- /package/node_modules/{oidc-client-ts → matrix-js-sdk/node_modules/oidc-client-ts}/dist/esm/package.json +0 -0
- /package/node_modules/{oidc-client-ts → matrix-js-sdk/node_modules/oidc-client-ts}/dist/types/oidc-client-ts.d.ts +0 -0
- /package/node_modules/{oidc-client-ts → matrix-js-sdk/node_modules/oidc-client-ts}/dist/types/tsdoc-metadata.json +0 -0
- /package/node_modules/{oidc-client-ts → matrix-js-sdk/node_modules/oidc-client-ts}/dist/umd/oidc-client-ts.js +0 -0
- /package/node_modules/{oidc-client-ts → matrix-js-sdk/node_modules/oidc-client-ts}/dist/umd/oidc-client-ts.js.map +0 -0
- /package/node_modules/{oidc-client-ts → matrix-js-sdk/node_modules/oidc-client-ts}/package.json +0 -0
- /package/node_modules/{p-retry → matrix-js-sdk/node_modules/p-retry}/index.d.ts +0 -0
- /package/node_modules/{p-retry → matrix-js-sdk/node_modules/p-retry}/index.js +0 -0
- /package/node_modules/{is-network-error → matrix-js-sdk/node_modules/p-retry}/license +0 -0
- /package/node_modules/{p-retry → matrix-js-sdk/node_modules/p-retry}/package.json +0 -0
- /package/node_modules/{p-retry → matrix-js-sdk/node_modules/p-retry}/readme.md +0 -0
- /package/node_modules/{sdp-transform → matrix-js-sdk/node_modules/sdp-transform}/.eslintrc.js +0 -0
- /package/node_modules/{sdp-transform → matrix-js-sdk/node_modules/sdp-transform}/.github/FUNDING.yml +0 -0
- /package/node_modules/{sdp-transform → matrix-js-sdk/node_modules/sdp-transform}/.github/codecov.yml +0 -0
- /package/node_modules/{sdp-transform → matrix-js-sdk/node_modules/sdp-transform}/.github/dependabot.yml +0 -0
- /package/node_modules/{sdp-transform → matrix-js-sdk/node_modules/sdp-transform}/.github/workflows/ci.yml +0 -0
- /package/node_modules/{sdp-transform → matrix-js-sdk/node_modules/sdp-transform}/CHANGELOG.md +0 -0
- /package/node_modules/{sdp-transform → matrix-js-sdk/node_modules/sdp-transform}/LICENSE +0 -0
- /package/node_modules/{sdp-transform → matrix-js-sdk/node_modules/sdp-transform}/README.md +0 -0
- /package/node_modules/{sdp-transform → matrix-js-sdk/node_modules/sdp-transform}/checker.js +0 -0
- /package/node_modules/{sdp-transform → matrix-js-sdk/node_modules/sdp-transform}/lib/grammar.js +0 -0
- /package/node_modules/{sdp-transform → matrix-js-sdk/node_modules/sdp-transform}/lib/index.js +0 -0
- /package/node_modules/{sdp-transform → matrix-js-sdk/node_modules/sdp-transform}/lib/parser.js +0 -0
- /package/node_modules/{sdp-transform → matrix-js-sdk/node_modules/sdp-transform}/lib/writer.js +0 -0
- /package/node_modules/{sdp-transform → matrix-js-sdk/node_modules/sdp-transform}/package.json +0 -0
- /package/node_modules/{unhomoglyph → matrix-js-sdk/node_modules/unhomoglyph}/CHANGELOG.md +0 -0
- /package/node_modules/{unhomoglyph → matrix-js-sdk/node_modules/unhomoglyph}/LICENSE +0 -0
- /package/node_modules/{unhomoglyph → matrix-js-sdk/node_modules/unhomoglyph}/README.md +0 -0
- /package/node_modules/{unhomoglyph → matrix-js-sdk/node_modules/unhomoglyph}/data.json +0 -0
- /package/node_modules/{unhomoglyph → matrix-js-sdk/node_modules/unhomoglyph}/index.d.ts +0 -0
- /package/node_modules/{unhomoglyph → matrix-js-sdk/node_modules/unhomoglyph}/index.js +0 -0
- /package/node_modules/{unhomoglyph → matrix-js-sdk/node_modules/unhomoglyph}/package.json +0 -0
- /package/node_modules/{@borewit → music-metadata/node_modules/@borewit}/text-codec/LICENSE.txt +0 -0
- /package/node_modules/{@borewit → music-metadata/node_modules/@borewit}/text-codec/README.md +0 -0
- /package/node_modules/{@borewit → music-metadata/node_modules/@borewit}/text-codec/lib/index.d.ts +0 -0
- /package/node_modules/{@borewit → music-metadata/node_modules/@borewit}/text-codec/lib/index.js +0 -0
- /package/node_modules/{@borewit → music-metadata/node_modules/@borewit}/text-codec/package.json +0 -0
- /package/node_modules/{@tokenizer → music-metadata/node_modules/@tokenizer}/inflate/LICENSE +0 -0
- /package/node_modules/{@tokenizer → music-metadata/node_modules/@tokenizer}/inflate/README.md +0 -0
- /package/node_modules/{@tokenizer → music-metadata/node_modules/@tokenizer}/inflate/lib/GzipHandler.d.ts +0 -0
- /package/node_modules/{@tokenizer → music-metadata/node_modules/@tokenizer}/inflate/lib/GzipHandler.js +0 -0
- /package/node_modules/{@tokenizer → music-metadata/node_modules/@tokenizer}/inflate/lib/ZipHandler.d.ts +0 -0
- /package/node_modules/{@tokenizer → music-metadata/node_modules/@tokenizer}/inflate/lib/ZipHandler.js +0 -0
- /package/node_modules/{@tokenizer → music-metadata/node_modules/@tokenizer}/inflate/lib/ZipToken.d.ts +0 -0
- /package/node_modules/{@tokenizer → music-metadata/node_modules/@tokenizer}/inflate/lib/ZipToken.js +0 -0
- /package/node_modules/{@tokenizer → music-metadata/node_modules/@tokenizer}/inflate/lib/index.d.ts +0 -0
- /package/node_modules/{@tokenizer → music-metadata/node_modules/@tokenizer}/inflate/lib/index.js +0 -0
- /package/node_modules/{@tokenizer → music-metadata/node_modules/@tokenizer}/inflate/package.json +0 -0
- /package/node_modules/{@tokenizer → music-metadata/node_modules/@tokenizer}/token/README.md +0 -0
- /package/node_modules/{@tokenizer → music-metadata/node_modules/@tokenizer}/token/index.d.ts +0 -0
- /package/node_modules/{@tokenizer → music-metadata/node_modules/@tokenizer}/token/package.json +0 -0
- /package/node_modules/{p-retry → music-metadata/node_modules/file-type}/license +0 -0
- /package/node_modules/{file-type → music-metadata/node_modules/file-type}/package.json +0 -0
- /package/node_modules/{file-type → music-metadata/node_modules/file-type}/readme.md +0 -0
- /package/node_modules/{file-type → music-metadata/node_modules/file-type}/source/detectors/asf.js +0 -0
- /package/node_modules/{file-type → music-metadata/node_modules/file-type}/source/detectors/ebml.js +0 -0
- /package/node_modules/{file-type → music-metadata/node_modules/file-type}/source/detectors/png.js +0 -0
- /package/node_modules/{file-type → music-metadata/node_modules/file-type}/source/detectors/zip.js +0 -0
- /package/node_modules/{file-type → music-metadata/node_modules/file-type}/source/index.d.ts +0 -0
- /package/node_modules/{file-type → music-metadata/node_modules/file-type}/source/index.js +0 -0
- /package/node_modules/{file-type → music-metadata/node_modules/file-type}/source/index.test-d.ts +0 -0
- /package/node_modules/{file-type → music-metadata/node_modules/file-type}/source/parser.js +0 -0
- /package/node_modules/{file-type → music-metadata/node_modules/file-type}/source/supported.js +0 -0
- /package/node_modules/{file-type → music-metadata/node_modules/file-type}/source/tokens.js +0 -0
- /package/node_modules/{ieee754 → music-metadata/node_modules/ieee754}/LICENSE +0 -0
- /package/node_modules/{ieee754 → music-metadata/node_modules/ieee754}/README.md +0 -0
- /package/node_modules/{ieee754 → music-metadata/node_modules/ieee754}/index.d.ts +0 -0
- /package/node_modules/{ieee754 → music-metadata/node_modules/ieee754}/index.js +0 -0
- /package/node_modules/{ieee754 → music-metadata/node_modules/ieee754}/package.json +0 -0
- /package/node_modules/{media-typer → music-metadata/node_modules/media-typer}/LICENSE +0 -0
- /package/node_modules/{media-typer → music-metadata/node_modules/media-typer}/README.md +0 -0
- /package/node_modules/{media-typer → music-metadata/node_modules/media-typer}/dist/index.d.ts +0 -0
- /package/node_modules/{media-typer → music-metadata/node_modules/media-typer}/dist/index.js +0 -0
- /package/node_modules/{media-typer → music-metadata/node_modules/media-typer}/dist/index.js.map +0 -0
- /package/node_modules/{media-typer → music-metadata/node_modules/media-typer}/package.json +0 -0
- /package/node_modules/{strtok3 → music-metadata/node_modules/strtok3}/LICENSE.txt +0 -0
- /package/node_modules/{strtok3 → music-metadata/node_modules/strtok3}/README.md +0 -0
- /package/node_modules/{strtok3 → music-metadata/node_modules/strtok3}/lib/AbstractTokenizer.d.ts +0 -0
- /package/node_modules/{strtok3 → music-metadata/node_modules/strtok3}/lib/AbstractTokenizer.js +0 -0
- /package/node_modules/{strtok3 → music-metadata/node_modules/strtok3}/lib/BlobTokenizer.d.ts +0 -0
- /package/node_modules/{strtok3 → music-metadata/node_modules/strtok3}/lib/BlobTokenizer.js +0 -0
- /package/node_modules/{strtok3 → music-metadata/node_modules/strtok3}/lib/BufferTokenizer.d.ts +0 -0
- /package/node_modules/{strtok3 → music-metadata/node_modules/strtok3}/lib/BufferTokenizer.js +0 -0
- /package/node_modules/{strtok3 → music-metadata/node_modules/strtok3}/lib/FileTokenizer.d.ts +0 -0
- /package/node_modules/{strtok3 → music-metadata/node_modules/strtok3}/lib/FileTokenizer.js +0 -0
- /package/node_modules/{strtok3 → music-metadata/node_modules/strtok3}/lib/ReadStreamTokenizer.d.ts +0 -0
- /package/node_modules/{strtok3 → music-metadata/node_modules/strtok3}/lib/ReadStreamTokenizer.js +0 -0
- /package/node_modules/{strtok3 → music-metadata/node_modules/strtok3}/lib/core.d.ts +0 -0
- /package/node_modules/{strtok3 → music-metadata/node_modules/strtok3}/lib/core.js +0 -0
- /package/node_modules/{strtok3 → music-metadata/node_modules/strtok3}/lib/index.d.ts +0 -0
- /package/node_modules/{strtok3 → music-metadata/node_modules/strtok3}/lib/index.js +0 -0
- /package/node_modules/{strtok3 → music-metadata/node_modules/strtok3}/lib/stream/AbstractStreamReader.d.ts +0 -0
- /package/node_modules/{strtok3 → music-metadata/node_modules/strtok3}/lib/stream/AbstractStreamReader.js +0 -0
- /package/node_modules/{strtok3 → music-metadata/node_modules/strtok3}/lib/stream/Deferred.d.ts +0 -0
- /package/node_modules/{strtok3 → music-metadata/node_modules/strtok3}/lib/stream/Deferred.js +0 -0
- /package/node_modules/{strtok3 → music-metadata/node_modules/strtok3}/lib/stream/Errors.d.ts +0 -0
- /package/node_modules/{strtok3 → music-metadata/node_modules/strtok3}/lib/stream/Errors.js +0 -0
- /package/node_modules/{strtok3 → music-metadata/node_modules/strtok3}/lib/stream/StreamReader.d.ts +0 -0
- /package/node_modules/{strtok3 → music-metadata/node_modules/strtok3}/lib/stream/StreamReader.js +0 -0
- /package/node_modules/{strtok3 → music-metadata/node_modules/strtok3}/lib/stream/WebStreamByobReader.d.ts +0 -0
- /package/node_modules/{strtok3 → music-metadata/node_modules/strtok3}/lib/stream/WebStreamByobReader.js +0 -0
- /package/node_modules/{strtok3 → music-metadata/node_modules/strtok3}/lib/stream/WebStreamDefaultReader.d.ts +0 -0
- /package/node_modules/{strtok3 → music-metadata/node_modules/strtok3}/lib/stream/WebStreamDefaultReader.js +0 -0
- /package/node_modules/{strtok3 → music-metadata/node_modules/strtok3}/lib/stream/WebStreamReader.d.ts +0 -0
- /package/node_modules/{strtok3 → music-metadata/node_modules/strtok3}/lib/stream/WebStreamReader.js +0 -0
- /package/node_modules/{strtok3 → music-metadata/node_modules/strtok3}/lib/stream/WebStreamReaderFactory.d.ts +0 -0
- /package/node_modules/{strtok3 → music-metadata/node_modules/strtok3}/lib/stream/WebStreamReaderFactory.js +0 -0
- /package/node_modules/{strtok3 → music-metadata/node_modules/strtok3}/lib/stream/index.d.ts +0 -0
- /package/node_modules/{strtok3 → music-metadata/node_modules/strtok3}/lib/stream/index.js +0 -0
- /package/node_modules/{strtok3 → music-metadata/node_modules/strtok3}/lib/types.d.ts +0 -0
- /package/node_modules/{strtok3 → music-metadata/node_modules/strtok3}/lib/types.js +0 -0
- /package/node_modules/{strtok3 → music-metadata/node_modules/strtok3}/package.json +0 -0
- /package/node_modules/{token-types → music-metadata/node_modules/token-types}/LICENSE.txt +0 -0
- /package/node_modules/{token-types → music-metadata/node_modules/token-types}/README.md +0 -0
- /package/node_modules/{token-types → music-metadata/node_modules/token-types}/lib/index.d.ts +0 -0
- /package/node_modules/{token-types → music-metadata/node_modules/token-types}/lib/index.js +0 -0
- /package/node_modules/{token-types → music-metadata/node_modules/token-types}/package.json +0 -0
- /package/node_modules/{uint8array-extras → music-metadata/node_modules/uint8array-extras}/index.d.ts +0 -0
- /package/node_modules/{uint8array-extras → music-metadata/node_modules/uint8array-extras}/index.js +0 -0
- /package/node_modules/{uint8array-extras → music-metadata/node_modules/uint8array-extras}/license +0 -0
- /package/node_modules/{uint8array-extras → music-metadata/node_modules/uint8array-extras}/package.json +0 -0
- /package/node_modules/{uint8array-extras → music-metadata/node_modules/uint8array-extras}/readme.md +0 -0
- /package/node_modules/{win-guid → music-metadata/node_modules/win-guid}/LICENSE.txt +0 -0
- /package/node_modules/{win-guid → music-metadata/node_modules/win-guid}/README.md +0 -0
- /package/node_modules/{win-guid → music-metadata/node_modules/win-guid}/lib/guid.d.ts +0 -0
- /package/node_modules/{win-guid → music-metadata/node_modules/win-guid}/lib/guid.js +0 -0
- /package/node_modules/{win-guid → music-metadata/node_modules/win-guid}/package.json +0 -0
|
@@ -1,48 +1,50 @@
|
|
|
1
1
|
import { a as resolveMatrixAccountConfig, i as resolveMatrixAccountAllowlistConfig } from "./account-config-BZWN9tGS.js";
|
|
2
2
|
import { t as getMatrixRuntime } from "./runtime-6S3DNFNv.js";
|
|
3
|
-
import {
|
|
4
|
-
import { a as buildAllowlistResolutionSummary, c as createTypingCallbacks, d as logInboundDrop, f as logTypingFailure, h as toLocationContext, i as addAllowlistUserEntriesFromConfigEntry, l as formatLocationText, m as summarizeMapping, n as resolveMatrixStoredSessionMeta, o as canonicalizeAllowlistWithResolvedIds, p as patchAllowlistUsersInConfigEntries, r as resolveMatrixRoomConfig, s as createReplyPrefixOptions, u as getAgentScopedMediaLocalRoots } from "./channel-
|
|
5
|
-
import { a as normalizeMatrixUserId, i as normalizeMatrixAllowList, o as resolveMatrixAllowListMatch } from "./config-schema-
|
|
3
|
+
import { n as resolveConfiguredMatrixBotUserIds } from "./accounts-DfngqebB.js";
|
|
4
|
+
import { a as buildAllowlistResolutionSummary, c as createTypingCallbacks, d as logInboundDrop, f as logTypingFailure, h as toLocationContext, i as addAllowlistUserEntriesFromConfigEntry, l as formatLocationText, m as summarizeMapping, n as resolveMatrixStoredSessionMeta, o as canonicalizeAllowlistWithResolvedIds, p as patchAllowlistUsersInConfigEntries, r as resolveMatrixRoomConfig, s as createReplyPrefixOptions, u as getAgentScopedMediaLocalRoots } from "./channel-vj788dNZ.js";
|
|
5
|
+
import { a as normalizeMatrixUserId, i as normalizeMatrixAllowList, o as resolveMatrixAllowListMatch } from "./config-schema-Djxw3C6b.js";
|
|
6
6
|
import { t as isMatrixQualifiedUserId } from "./target-ids-B-5aQxwn.js";
|
|
7
7
|
import { t as formatMatrixErrorMessage } from "./errors-C47hvAF8.js";
|
|
8
|
-
import { D as parsePollStartContent, S as formatPollAsText, T as isPollStartType,
|
|
9
|
-
import { t as createMatrixThreadBindingManager } from "./thread-bindings-
|
|
8
|
+
import { D as parsePollStartContent, S as formatPollAsText, T as isPollStartType, g as MATRIX_OPENCLAW_FINALIZED_PREVIEW_KEY, h as readJoinedMatrixMembers, m as isStrictDirectMembership, p as hasDirectMatrixMemberFlag, r as sendMessageMatrix, u as promoteMatrixDirectRoomCandidate, v as chunkMatrixText, w as isPollEventType } from "./send-BldGYG8g.js";
|
|
9
|
+
import { t as createMatrixThreadBindingManager } from "./thread-bindings-DGbl3vDW.js";
|
|
10
10
|
import { i as createMatrixInboundEventDeduper } from "./inbound-dedupe-CaBLblef.js";
|
|
11
|
-
import { a as resolveMatrixMessageAttachment, c as fetchMatrixPollSnapshot, i as isLikelyBareFilename, n as formatMatrixMediaUnavailableText, o as resolveMatrixMessageBody, r as formatMatrixMessageText, t as formatMatrixMediaTooLargeText } from "./media-text-
|
|
11
|
+
import { a as resolveMatrixMessageAttachment, c as fetchMatrixPollSnapshot, i as isLikelyBareFilename, n as formatMatrixMediaUnavailableText, o as resolveMatrixMessageBody, r as formatMatrixMessageText, t as formatMatrixMediaTooLargeText } from "./media-text-BTwzADS_.js";
|
|
12
12
|
import { n as setActiveMatrixClient } from "./active-client-DXvz2gCo.js";
|
|
13
13
|
import { t as isBunRuntime } from "./runtime-BefyhPWv.js";
|
|
14
|
-
import { d as backfillMatrixAuthDeviceIdAfterStartup, f as resolveMatrixAuth, i as resolveSharedMatrixClient, l as isMatrixStartupAbortError, n as releaseSharedClientInstance, p as resolveMatrixAuthContext, u as throwIfMatrixStartupAborted } from "./shared-
|
|
15
|
-
import "./client-
|
|
16
|
-
import { i as isMatrixMediaSizeLimitError, r as MatrixMediaSizeLimitError } from "./http-client-
|
|
14
|
+
import { d as backfillMatrixAuthDeviceIdAfterStartup, f as resolveMatrixAuth, i as resolveSharedMatrixClient, l as isMatrixStartupAbortError, n as releaseSharedClientInstance, p as resolveMatrixAuthContext, u as throwIfMatrixStartupAborted } from "./shared-CUMWxcMz.js";
|
|
15
|
+
import "./client-Dbso3-0V.js";
|
|
16
|
+
import { i as isMatrixMediaSizeLimitError, r as MatrixMediaSizeLimitError } from "./http-client-CycYxU9-.js";
|
|
17
17
|
import { d as resolveAllowlistProviderRuntimeGroupPolicy, f as resolveDefaultGroupPolicy, g as warnMissingProviderGroupPolicyFallbackOnce, h as resolveThreadBindingMaxAgeMsForChannel, m as resolveThreadBindingIdleTimeoutMsForChannel, t as GROUP_POLICY_BLOCKED_LABEL } from "./runtime-api-D1xI_cvh.js";
|
|
18
|
-
import { t as resolveMatrixTargets } from "./resolve-targets-
|
|
18
|
+
import { t as resolveMatrixTargets } from "./resolve-targets-nm2L48sh.js";
|
|
19
19
|
import { t as formatMatrixEncryptedEventDisabledWarning } from "./encryption-guidance-CbEFe38F.js";
|
|
20
20
|
import { n as isMatrixReadySyncState, r as isMatrixTerminalSyncState, t as isMatrixDisconnectedSyncState } from "./sync-state-CWbp0QSY.js";
|
|
21
|
+
import { n as setBoundedMap, t as createMatrixRoomInfoResolver } from "./room-info-CAFZ3Z9J.js";
|
|
21
22
|
import { a as EventType, i as resolveMatrixThreadRouting, n as resolveMatrixReplyToEventId, o as RelationType, r as resolveMatrixThreadRootId, t as resolveMatrixInboundRoute } from "./route-DY6at4qJ.js";
|
|
22
|
-
import { t as createMatrixRoomInfoResolver } from "./room-info-B6vKD5DF.js";
|
|
23
23
|
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
24
|
-
import { buildChannelProgressDraftLineForEntry, createChannelProgressDraftGate, createPreviewMessageReceipt, defineFinalizableLivePreviewAdapter, deliverWithFinalizableLivePreviewAdapter, formatChannelProgressDraftLine, formatChannelProgressDraftText, isChannelProgressDraftWorkToolName, mergeChannelProgressDraftLine, normalizeChannelProgressDraftLineIdentity, resolveChannelProgressDraftMaxLines, resolveChannelStreamingBlockEnabled, waitUntilAbort } from "openclaw/plugin-sdk/channel-outbound";
|
|
25
|
-
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeStringifiedEntries, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
24
|
+
import { buildChannelProgressDraftLineForEntry, createChannelProgressDraftGate, createMessageReceiptFromOutboundResults, createPreviewMessageReceipt, defineFinalizableLivePreviewAdapter, deliverWithFinalizableLivePreviewAdapter, formatChannelProgressDraftLine, formatChannelProgressDraftText, isChannelProgressDraftWorkToolName, listMessageReceiptPlatformIds, mergeChannelProgressDraftLine, normalizeChannelProgressDraftLineIdentity, resolveChannelProgressDraftMaxLines, resolveChannelStreamingBlockEnabled, waitUntilAbort } from "openclaw/plugin-sdk/channel-outbound";
|
|
25
|
+
import { normalizeLowercaseStringOrEmpty, normalizeNullableString, normalizeOptionalString, normalizeStringifiedEntries, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
26
|
+
import { stripReasoningTagsFromText } from "openclaw/plugin-sdk/text-chunking";
|
|
26
27
|
import { CHANNEL_APPROVAL_NATIVE_RUNTIME_CONTEXT_CAPABILITY } from "openclaw/plugin-sdk/approval-handler-adapter-runtime";
|
|
27
28
|
import { resolveInboundLastRouteSessionKey } from "openclaw/plugin-sdk/routing";
|
|
28
|
-
import { buildChannelInboundEventContext, createChannelInboundEnvelopeBuilder, hasFinalInboundReplyDispatch, resolveInboundMentionDecision,
|
|
29
|
+
import { buildChannelInboundEventContext, createChannelInboundEnvelopeBuilder, createChannelPartialDeliveryError, hasFinalInboundReplyDispatch, isChannelPartialDeliveryError, resolveInboundMentionDecision, toInboundMediaFactsWithMetadata } from "openclaw/plugin-sdk/channel-inbound";
|
|
29
30
|
import { getSessionEntry, resolveStorePath } from "openclaw/plugin-sdk/session-store-runtime";
|
|
30
31
|
import { isFutureDateTimestampMs, parseStrictFiniteNumber, resolveExpiresAtMsFromDurationMs, resolveOptionalIntegerOption } from "openclaw/plugin-sdk/number-runtime";
|
|
32
|
+
import { resolveHumanDelayConfig } from "openclaw/plugin-sdk/agent-runtime";
|
|
31
33
|
import { KeyedAsyncQueue } from "openclaw/plugin-sdk/keyed-async-queue";
|
|
32
34
|
import { format } from "node:util";
|
|
35
|
+
import { logVerbose } from "openclaw/plugin-sdk/runtime-env";
|
|
33
36
|
import { escapeRegExp, sliceUtf16Safe, truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
34
37
|
import { buildTtsSupplementMediaPayload, getReplyPayloadTtsSupplement } from "openclaw/plugin-sdk/reply-payload";
|
|
35
38
|
import { resolveAckReaction } from "openclaw/plugin-sdk/channel-feedback";
|
|
36
39
|
import { registerChannelRuntimeContext } from "openclaw/plugin-sdk/channel-runtime-context";
|
|
37
40
|
import { isDangerousNameMatchingEnabled } from "openclaw/plugin-sdk/dangerous-name-runtime";
|
|
38
41
|
import { createChannelIngressResolver, defineStableChannelIngressIdentity } from "openclaw/plugin-sdk/channel-ingress-runtime";
|
|
39
|
-
import { resolveHumanDelayConfig } from "openclaw/plugin-sdk/agent-runtime";
|
|
40
42
|
import { evaluateSupplementalContextVisibility, resolveChannelContextVisibilityMode } from "openclaw/plugin-sdk/context-visibility-runtime";
|
|
43
|
+
import { getGlobalHookRunner } from "openclaw/plugin-sdk/plugin-runtime";
|
|
44
|
+
import { resolvePinnedMainDmOwnerFromAllowlist } from "openclaw/plugin-sdk/security-runtime";
|
|
41
45
|
import { mergePairLoopGuardConfig } from "openclaw/plugin-sdk/pair-loop-guard-runtime";
|
|
42
46
|
import { buildInboundHistoryFromEntries } from "openclaw/plugin-sdk/reply-history";
|
|
43
|
-
import { resolvePinnedMainDmOwnerFromAllowlist } from "openclaw/plugin-sdk/security-runtime";
|
|
44
47
|
import { decodeHtmlEntities } from "openclaw/plugin-sdk/html-entity-runtime";
|
|
45
|
-
import { logVerbose } from "openclaw/plugin-sdk/runtime-env";
|
|
46
48
|
import { createConnectedChannelStatusPatch, createTransportActivityStatusPatch } from "openclaw/plugin-sdk/gateway-runtime";
|
|
47
49
|
//#region extensions/matrix/src/matrix/monitor/auto-join.ts
|
|
48
50
|
function registerMatrixAutoJoin(params) {
|
|
@@ -466,15 +468,8 @@ async function resolveMatrixMonitorConfig(params) {
|
|
|
466
468
|
//#region extensions/matrix/src/matrix/monitor/direct.ts
|
|
467
469
|
const DM_CACHE_TTL_MS = 3e4;
|
|
468
470
|
const RECENT_INVITE_TTL_MS = 3e4;
|
|
469
|
-
const
|
|
470
|
-
const
|
|
471
|
-
function rememberBounded(map, key, value, maxSize = MAX_TRACKED_DM_ROOMS) {
|
|
472
|
-
map.set(key, value);
|
|
473
|
-
if (map.size > maxSize) {
|
|
474
|
-
const oldest = map.keys().next().value;
|
|
475
|
-
if (typeof oldest === "string") map.delete(oldest);
|
|
476
|
-
}
|
|
477
|
-
}
|
|
471
|
+
const MAX_DM_ROOMS = 1024;
|
|
472
|
+
const MAX_DM_MEMBER_FLAGS = 2048;
|
|
478
473
|
function createDirectRoomTracker(client, opts = {}) {
|
|
479
474
|
const log = opts.log ?? (() => {});
|
|
480
475
|
let lastDmUpdateMs = 0;
|
|
@@ -506,10 +501,10 @@ function createDirectRoomTracker(client, opts = {}) {
|
|
|
506
501
|
try {
|
|
507
502
|
const normalized = await readJoinedMatrixMembers(client, roomId);
|
|
508
503
|
if (!normalized) throw new Error("membership unavailable");
|
|
509
|
-
|
|
504
|
+
setBoundedMap(joinedMembersCache, roomId, {
|
|
510
505
|
members: normalized,
|
|
511
506
|
ts: now
|
|
512
|
-
});
|
|
507
|
+
}, MAX_DM_ROOMS);
|
|
513
508
|
return normalized;
|
|
514
509
|
} catch (err) {
|
|
515
510
|
log(`matrix: dm member lookup failed room=${roomId} (${String(err)})`);
|
|
@@ -524,10 +519,10 @@ function createDirectRoomTracker(client, opts = {}) {
|
|
|
524
519
|
const now = Date.now();
|
|
525
520
|
if (cached && now - cached.ts < DM_CACHE_TTL_MS) return cached.isDirect;
|
|
526
521
|
const isDirect = await hasDirectMatrixMemberFlag(client, roomId, normalizedUserId);
|
|
527
|
-
|
|
522
|
+
setBoundedMap(directMemberFlagCache, cacheKey, {
|
|
528
523
|
isDirect,
|
|
529
524
|
ts: now
|
|
530
|
-
},
|
|
525
|
+
}, MAX_DM_MEMBER_FLAGS);
|
|
531
526
|
return isDirect;
|
|
532
527
|
};
|
|
533
528
|
const hasRecentInviteCandidate = (roomId, remoteUserId) => {
|
|
@@ -581,7 +576,7 @@ function createDirectRoomTracker(client, opts = {}) {
|
|
|
581
576
|
const rememberLocallyPromotedDirectRoom = (roomId, remoteUserId) => {
|
|
582
577
|
const normalizedRemoteUserId = remoteUserId.trim();
|
|
583
578
|
if (!normalizedRemoteUserId) return;
|
|
584
|
-
|
|
579
|
+
setBoundedMap(locallyPromotedDirectRooms, roomId, { remoteUserId: normalizedRemoteUserId }, MAX_DM_ROOMS);
|
|
585
580
|
};
|
|
586
581
|
return {
|
|
587
582
|
invalidateRoom: (roomId) => {
|
|
@@ -593,10 +588,10 @@ function createDirectRoomTracker(client, opts = {}) {
|
|
|
593
588
|
rememberInvite: (roomId, remoteUserId) => {
|
|
594
589
|
const normalizedRemoteUserId = remoteUserId.trim();
|
|
595
590
|
if (!normalizedRemoteUserId) return;
|
|
596
|
-
|
|
591
|
+
setBoundedMap(recentInviteCandidates, roomId, {
|
|
597
592
|
remoteUserId: normalizedRemoteUserId,
|
|
598
593
|
ts: Date.now()
|
|
599
|
-
});
|
|
594
|
+
}, MAX_DM_ROOMS);
|
|
600
595
|
log(`matrix: remembered invite candidate room=${roomId} sender=${normalizedRemoteUserId}`);
|
|
601
596
|
},
|
|
602
597
|
isDirectMessage: async (params) => {
|
|
@@ -793,21 +788,21 @@ const VERIFICATION_NOTICE_PREFIXES = [
|
|
|
793
788
|
"Matrix verification cancelled by ",
|
|
794
789
|
"Matrix verification SAS with "
|
|
795
790
|
];
|
|
796
|
-
function trimMaybeString
|
|
791
|
+
function trimMaybeString(input) {
|
|
797
792
|
return normalizeOptionalString(input) ?? "";
|
|
798
793
|
}
|
|
799
794
|
function isMatrixVerificationEventType(type) {
|
|
800
|
-
return trimMaybeString
|
|
795
|
+
return trimMaybeString(type).startsWith(VERIFICATION_EVENT_PREFIX);
|
|
801
796
|
}
|
|
802
797
|
function isMatrixVerificationRequestMsgType(msgtype) {
|
|
803
|
-
return trimMaybeString
|
|
798
|
+
return trimMaybeString(msgtype) === VERIFICATION_REQUEST_MSGTYPE;
|
|
804
799
|
}
|
|
805
800
|
function isMatrixVerificationNoticeBody(body) {
|
|
806
|
-
const text = trimMaybeString
|
|
801
|
+
const text = trimMaybeString(body);
|
|
807
802
|
return VERIFICATION_NOTICE_PREFIXES.some((prefix) => text.startsWith(prefix));
|
|
808
803
|
}
|
|
809
804
|
function isMatrixVerificationRoomMessage(content) {
|
|
810
|
-
return isMatrixVerificationRequestMsgType(content.msgtype) || trimMaybeString
|
|
805
|
+
return isMatrixVerificationRequestMsgType(content.msgtype) || trimMaybeString(content.msgtype) === "m.notice" && isMatrixVerificationNoticeBody(content.body);
|
|
811
806
|
}
|
|
812
807
|
const matrixVerificationConstants = {
|
|
813
808
|
eventPrefix: VERIFICATION_EVENT_PREFIX,
|
|
@@ -818,27 +813,22 @@ const matrixVerificationConstants = {
|
|
|
818
813
|
const MAX_TRACKED_VERIFICATION_EVENTS = 1024;
|
|
819
814
|
const SAS_NOTICE_RETRY_DELAY_MS = 750;
|
|
820
815
|
const VERIFICATION_EVENT_STARTUP_GRACE_MS = 3e4;
|
|
821
|
-
const loadMatrixDirectRoomDeps = createLazyRuntimeModule(() => Promise.all([import("./send-
|
|
816
|
+
const loadMatrixDirectRoomDeps = createLazyRuntimeModule(() => Promise.all([import("./send-BldGYG8g.js").then((n) => n.l), import("./send-BldGYG8g.js").then((n) => n.f)]).then(([directManagementModule, directRoomModule]) => ({
|
|
822
817
|
inspectMatrixDirectRooms: directManagementModule.inspectMatrixDirectRooms,
|
|
823
818
|
isStrictDirectRoom: directRoomModule.isStrictDirectRoom
|
|
824
819
|
})));
|
|
825
|
-
function trimMaybeString(input) {
|
|
826
|
-
if (typeof input !== "string") return null;
|
|
827
|
-
const trimmed = input.trim();
|
|
828
|
-
return trimmed.length > 0 ? trimmed : null;
|
|
829
|
-
}
|
|
830
820
|
function readVerificationSignal(event) {
|
|
831
|
-
const type =
|
|
821
|
+
const type = normalizeNullableString(event?.type) ?? "";
|
|
832
822
|
const content = event?.content ?? {};
|
|
833
|
-
const msgtype =
|
|
834
|
-
const relatedEventId =
|
|
835
|
-
const transactionId =
|
|
823
|
+
const msgtype = normalizeNullableString(content.msgtype) ?? "";
|
|
824
|
+
const relatedEventId = normalizeNullableString(content["m.relates_to"]?.event_id);
|
|
825
|
+
const transactionId = normalizeNullableString(content.transaction_id);
|
|
836
826
|
if (type === EventType.RoomMessage && isMatrixVerificationRequestMsgType(msgtype)) return {
|
|
837
827
|
stage: "request",
|
|
838
|
-
flowId:
|
|
828
|
+
flowId: normalizeNullableString(event.event_id) ?? transactionId ?? relatedEventId
|
|
839
829
|
};
|
|
840
830
|
if (!isMatrixVerificationEventType(type)) return null;
|
|
841
|
-
const flowId = transactionId ?? relatedEventId ??
|
|
831
|
+
const flowId = transactionId ?? relatedEventId ?? normalizeNullableString(event.event_id);
|
|
842
832
|
if (type === `${matrixVerificationConstants.eventPrefix}request`) return {
|
|
843
833
|
stage: "request",
|
|
844
834
|
flowId
|
|
@@ -873,8 +863,8 @@ function formatVerificationStageNotice(params) {
|
|
|
873
863
|
case "start": return `Matrix verification started with ${senderId}.`;
|
|
874
864
|
case "done": return `Matrix verification completed with ${senderId}.`;
|
|
875
865
|
case "cancel": {
|
|
876
|
-
const code =
|
|
877
|
-
const reason =
|
|
866
|
+
const code = normalizeNullableString(content.code);
|
|
867
|
+
const reason = normalizeNullableString(content.reason);
|
|
878
868
|
if (code && reason) return `Matrix verification cancelled by ${senderId} (${code}: ${reason}).`;
|
|
879
869
|
if (reason) return `Matrix verification cancelled by ${senderId} (${reason}).`;
|
|
880
870
|
return `Matrix verification cancelled by ${senderId}.`;
|
|
@@ -885,7 +875,7 @@ function formatVerificationStageNotice(params) {
|
|
|
885
875
|
function formatVerificationSasNotice(summary) {
|
|
886
876
|
const sas = summary.sas;
|
|
887
877
|
if (!sas) return null;
|
|
888
|
-
const emojiLine = Array.isArray(sas.emoji) && sas.emoji.length > 0 ? `SAS emoji: ${sas.emoji.map(([emoji, name]) => `${
|
|
878
|
+
const emojiLine = Array.isArray(sas.emoji) && sas.emoji.length > 0 ? `SAS emoji: ${sas.emoji.map(([emoji, name]) => `${normalizeNullableString(emoji) ?? "?"} ${normalizeNullableString(name) ?? "?"}`).join(" | ")}` : null;
|
|
889
879
|
const decimalLine = Array.isArray(sas.decimal) && sas.decimal.length === 3 ? `SAS decimal: ${sas.decimal.join(" ")}` : null;
|
|
890
880
|
if (!emojiLine && !decimalLine) return null;
|
|
891
881
|
const lines = [`Matrix verification SAS with ${summary.otherUserId}:`];
|
|
@@ -899,7 +889,7 @@ function resolveVerificationFlowCandidates(params) {
|
|
|
899
889
|
const content = event.content;
|
|
900
890
|
const candidates = /* @__PURE__ */ new Set();
|
|
901
891
|
const add = (value) => {
|
|
902
|
-
const normalized =
|
|
892
|
+
const normalized = normalizeNullableString(value);
|
|
903
893
|
if (normalized) candidates.add(normalized);
|
|
904
894
|
};
|
|
905
895
|
add(flowId);
|
|
@@ -933,7 +923,7 @@ async function resolveVerificationSummaryForSignal(client, params) {
|
|
|
933
923
|
const byTransactionId = list.find((entry) => candidates.some((candidate) => entry.transactionId === candidate));
|
|
934
924
|
if (byTransactionId) return byTransactionId;
|
|
935
925
|
const { inspectMatrixDirectRooms, isStrictDirectRoom } = await loadMatrixDirectRoomDeps();
|
|
936
|
-
const activeRoomId =
|
|
926
|
+
const activeRoomId = normalizeNullableString((await inspectMatrixDirectRooms({
|
|
937
927
|
client,
|
|
938
928
|
remoteUserId: params.senderId
|
|
939
929
|
}).catch(() => null))?.activeRoomId);
|
|
@@ -946,7 +936,7 @@ async function resolveVerificationSummaryForSignal(client, params) {
|
|
|
946
936
|
})) return null;
|
|
947
937
|
const activeByUser = list.filter((entry) => entry.otherUserId === params.senderId && isActiveVerificationSummary(entry)).toSorted((a, b) => resolveSummaryRecency(b) - resolveSummaryRecency(a));
|
|
948
938
|
const activeInRoom = activeByUser.filter((entry) => {
|
|
949
|
-
return
|
|
939
|
+
return normalizeNullableString(entry.roomId) === params.roomId;
|
|
950
940
|
});
|
|
951
941
|
if (activeInRoom.length > 0) return activeInRoom[0] ?? null;
|
|
952
942
|
return activeByUser[0] ?? null;
|
|
@@ -977,7 +967,7 @@ function trackBounded(set, value) {
|
|
|
977
967
|
return true;
|
|
978
968
|
}
|
|
979
969
|
async function sendVerificationNotice(params) {
|
|
980
|
-
const roomId =
|
|
970
|
+
const roomId = normalizeNullableString(params.roomId);
|
|
981
971
|
if (!roomId) return;
|
|
982
972
|
try {
|
|
983
973
|
await params.client.sendMessage(roomId, {
|
|
@@ -1016,7 +1006,7 @@ function createMatrixVerificationEventRouter(params) {
|
|
|
1016
1006
|
const verificationUserRooms = /* @__PURE__ */ new Map();
|
|
1017
1007
|
async function resolveActiveDirectRoomId(remoteUserId) {
|
|
1018
1008
|
const { inspectMatrixDirectRooms } = await loadMatrixDirectRoomDeps();
|
|
1019
|
-
return
|
|
1009
|
+
return normalizeNullableString((await inspectMatrixDirectRooms({
|
|
1020
1010
|
client: params.client,
|
|
1021
1011
|
remoteUserId
|
|
1022
1012
|
}).catch(() => null))?.activeRoomId);
|
|
@@ -1039,8 +1029,8 @@ function createMatrixVerificationEventRouter(params) {
|
|
|
1039
1029
|
}
|
|
1040
1030
|
}
|
|
1041
1031
|
function rememberVerificationUserRoom(remoteUserId, roomId) {
|
|
1042
|
-
const normalizedUserId =
|
|
1043
|
-
const normalizedRoomId =
|
|
1032
|
+
const normalizedUserId = normalizeNullableString(remoteUserId);
|
|
1033
|
+
const normalizedRoomId = normalizeNullableString(roomId);
|
|
1044
1034
|
if (!normalizedUserId || !normalizedRoomId) return;
|
|
1045
1035
|
verificationUserRooms.delete(normalizedUserId);
|
|
1046
1036
|
verificationUserRooms.set(normalizedUserId, normalizedRoomId);
|
|
@@ -1050,11 +1040,11 @@ function createMatrixVerificationEventRouter(params) {
|
|
|
1050
1040
|
}
|
|
1051
1041
|
}
|
|
1052
1042
|
async function resolveSummaryRoomId(summary) {
|
|
1053
|
-
const mappedRoomId =
|
|
1043
|
+
const mappedRoomId = normalizeNullableString(summary.roomId) ?? normalizeNullableString(summary.transactionId ? verificationFlowRooms.get(summary.transactionId) : null) ?? normalizeNullableString(verificationFlowRooms.get(summary.id));
|
|
1054
1044
|
if (mappedRoomId) return mappedRoomId;
|
|
1055
|
-
const remoteUserId =
|
|
1045
|
+
const remoteUserId = normalizeNullableString(summary.otherUserId);
|
|
1056
1046
|
if (!remoteUserId) return null;
|
|
1057
|
-
const recentRoomId =
|
|
1047
|
+
const recentRoomId = normalizeNullableString(verificationUserRooms.get(remoteUserId));
|
|
1058
1048
|
const activeRoomId = await resolveActiveDirectRoomId(remoteUserId);
|
|
1059
1049
|
if (recentRoomId && activeRoomId && recentRoomId === activeRoomId) return recentRoomId;
|
|
1060
1050
|
if (activeRoomId) return activeRoomId;
|
|
@@ -1096,7 +1086,7 @@ function createMatrixVerificationEventRouter(params) {
|
|
|
1096
1086
|
});
|
|
1097
1087
|
}
|
|
1098
1088
|
function routeVerificationEvent(roomId, event) {
|
|
1099
|
-
const senderId =
|
|
1089
|
+
const senderId = normalizeNullableString(event?.sender);
|
|
1100
1090
|
if (!senderId) return false;
|
|
1101
1091
|
const signal = readVerificationSignal(event);
|
|
1102
1092
|
if (!signal) return false;
|
|
@@ -1107,7 +1097,7 @@ function createMatrixVerificationEventRouter(params) {
|
|
|
1107
1097
|
return;
|
|
1108
1098
|
}
|
|
1109
1099
|
const flowId = signal.flowId;
|
|
1110
|
-
const sourceFingerprint =
|
|
1100
|
+
const sourceFingerprint = normalizeNullableString(event?.event_id) ?? `${senderId}:${event.type}:${flowId ?? "none"}`;
|
|
1111
1101
|
if (!await (await loadMatrixDirectRoomDeps()).isStrictDirectRoom({
|
|
1112
1102
|
client: params.client,
|
|
1113
1103
|
roomId,
|
|
@@ -1413,246 +1403,6 @@ function resolveMatrixAckReactionConfig(params) {
|
|
|
1413
1403
|
};
|
|
1414
1404
|
}
|
|
1415
1405
|
//#endregion
|
|
1416
|
-
//#region extensions/matrix/src/matrix/monitor/location.ts
|
|
1417
|
-
function decodeGeoUriParamValue(value) {
|
|
1418
|
-
try {
|
|
1419
|
-
return decodeURIComponent(value);
|
|
1420
|
-
} catch {
|
|
1421
|
-
return value;
|
|
1422
|
-
}
|
|
1423
|
-
}
|
|
1424
|
-
function parseGeoUri(value) {
|
|
1425
|
-
const trimmed = value.trim();
|
|
1426
|
-
if (!trimmed) return null;
|
|
1427
|
-
if (!normalizeLowercaseStringOrEmpty(trimmed).startsWith("geo:")) return null;
|
|
1428
|
-
const [coordsPart, ...paramParts] = trimmed.slice(4).split(";");
|
|
1429
|
-
if (!coordsPart) return null;
|
|
1430
|
-
const coords = coordsPart.split(",");
|
|
1431
|
-
if (coords.length < 2) return null;
|
|
1432
|
-
const latitude = parseStrictFiniteNumber(coords[0] ?? "");
|
|
1433
|
-
const longitude = parseStrictFiniteNumber(coords[1] ?? "");
|
|
1434
|
-
if (latitude === void 0 || longitude === void 0) return null;
|
|
1435
|
-
const params = /* @__PURE__ */ new Map();
|
|
1436
|
-
for (const part of paramParts) {
|
|
1437
|
-
const segment = part.trim();
|
|
1438
|
-
if (!segment) continue;
|
|
1439
|
-
const eqIndex = segment.indexOf("=");
|
|
1440
|
-
const rawKey = eqIndex === -1 ? segment : segment.slice(0, eqIndex);
|
|
1441
|
-
const rawValue = eqIndex === -1 ? "" : segment.slice(eqIndex + 1);
|
|
1442
|
-
const key = normalizeLowercaseStringOrEmpty(rawKey);
|
|
1443
|
-
if (!key) continue;
|
|
1444
|
-
const valuePart = rawValue.trim();
|
|
1445
|
-
params.set(key, valuePart ? decodeGeoUriParamValue(valuePart) : "");
|
|
1446
|
-
}
|
|
1447
|
-
const accuracyRaw = params.get("u");
|
|
1448
|
-
return {
|
|
1449
|
-
latitude,
|
|
1450
|
-
longitude,
|
|
1451
|
-
accuracy: accuracyRaw ? parseStrictFiniteNumber(accuracyRaw) : void 0
|
|
1452
|
-
};
|
|
1453
|
-
}
|
|
1454
|
-
function resolveMatrixLocation(params) {
|
|
1455
|
-
const { eventType, content } = params;
|
|
1456
|
-
if (!(eventType === EventType.Location || eventType === EventType.RoomMessage && content.msgtype === EventType.Location)) return null;
|
|
1457
|
-
const geoUri = normalizeOptionalString(content.geo_uri) ?? "";
|
|
1458
|
-
if (!geoUri) return null;
|
|
1459
|
-
const parsed = parseGeoUri(geoUri);
|
|
1460
|
-
if (!parsed) return null;
|
|
1461
|
-
const caption = normalizeOptionalString(content.body) ?? "";
|
|
1462
|
-
const location = {
|
|
1463
|
-
latitude: parsed.latitude,
|
|
1464
|
-
longitude: parsed.longitude,
|
|
1465
|
-
accuracy: parsed.accuracy,
|
|
1466
|
-
caption: caption || void 0,
|
|
1467
|
-
source: "pin",
|
|
1468
|
-
isLive: false
|
|
1469
|
-
};
|
|
1470
|
-
return {
|
|
1471
|
-
text: formatLocationText(location),
|
|
1472
|
-
context: toLocationContext(location)
|
|
1473
|
-
};
|
|
1474
|
-
}
|
|
1475
|
-
//#endregion
|
|
1476
|
-
//#region extensions/matrix/src/matrix/monitor/media.ts
|
|
1477
|
-
const MATRIX_MEDIA_DOWNLOAD_IDLE_TIMEOUT_MS = 3e4;
|
|
1478
|
-
async function fetchMatrixMediaBuffer(params) {
|
|
1479
|
-
try {
|
|
1480
|
-
return { buffer: await params.client.downloadContent(params.mxcUrl, {
|
|
1481
|
-
maxBytes: params.maxBytes,
|
|
1482
|
-
readIdleTimeoutMs: MATRIX_MEDIA_DOWNLOAD_IDLE_TIMEOUT_MS
|
|
1483
|
-
}) };
|
|
1484
|
-
} catch (err) {
|
|
1485
|
-
if (isMatrixMediaSizeLimitError(err)) throw err;
|
|
1486
|
-
throw new Error(`Matrix media download failed: ${String(err)}`, { cause: err });
|
|
1487
|
-
}
|
|
1488
|
-
}
|
|
1489
|
-
/**
|
|
1490
|
-
* Download and decrypt encrypted media from a Matrix room.
|
|
1491
|
-
* Uses the Matrix crypto adapter's decryptMedia helper.
|
|
1492
|
-
*/
|
|
1493
|
-
async function fetchEncryptedMediaBuffer(params) {
|
|
1494
|
-
if (!params.client.crypto) throw new Error("Cannot decrypt media: crypto not enabled");
|
|
1495
|
-
const decrypted = await params.client.crypto.decryptMedia(params.file, {
|
|
1496
|
-
maxBytes: params.maxBytes,
|
|
1497
|
-
readIdleTimeoutMs: MATRIX_MEDIA_DOWNLOAD_IDLE_TIMEOUT_MS
|
|
1498
|
-
});
|
|
1499
|
-
if (decrypted.byteLength > params.maxBytes) throw new MatrixMediaSizeLimitError();
|
|
1500
|
-
return { buffer: decrypted };
|
|
1501
|
-
}
|
|
1502
|
-
async function downloadMatrixMedia(params) {
|
|
1503
|
-
let fetched;
|
|
1504
|
-
if (typeof params.sizeBytes === "number" && params.sizeBytes > params.maxBytes) throw new MatrixMediaSizeLimitError();
|
|
1505
|
-
if (params.file) fetched = await fetchEncryptedMediaBuffer({
|
|
1506
|
-
client: params.client,
|
|
1507
|
-
file: params.file,
|
|
1508
|
-
maxBytes: params.maxBytes
|
|
1509
|
-
});
|
|
1510
|
-
else fetched = await fetchMatrixMediaBuffer({
|
|
1511
|
-
client: params.client,
|
|
1512
|
-
mxcUrl: params.mxcUrl,
|
|
1513
|
-
maxBytes: params.maxBytes
|
|
1514
|
-
});
|
|
1515
|
-
if (!fetched) return null;
|
|
1516
|
-
const headerType = params.contentType ?? void 0;
|
|
1517
|
-
const saved = await getMatrixRuntime().channel.media.saveMediaBuffer(fetched.buffer, headerType, "inbound", params.maxBytes, params.originalFilename);
|
|
1518
|
-
return {
|
|
1519
|
-
path: saved.path,
|
|
1520
|
-
contentType: saved.contentType,
|
|
1521
|
-
placeholder: "[matrix media]"
|
|
1522
|
-
};
|
|
1523
|
-
}
|
|
1524
|
-
//#endregion
|
|
1525
|
-
//#region extensions/matrix/src/matrix/monitor/mentions.ts
|
|
1526
|
-
const MATRIX_HTML_ENTITY_RE = /&(?:#x?[0-9a-f]+|amp|apos|gt|lt|nbsp|quot);/gi;
|
|
1527
|
-
function decodeVisibleHtmlEntities(value) {
|
|
1528
|
-
return value.replace(MATRIX_HTML_ENTITY_RE, (entity) => {
|
|
1529
|
-
const decoded = decodeHtmlEntities(entity.startsWith("&#") ? entity : entity.toLowerCase());
|
|
1530
|
-
return decoded === "\xA0" ? " " : decoded;
|
|
1531
|
-
});
|
|
1532
|
-
}
|
|
1533
|
-
function normalizeVisibleMentionText(value) {
|
|
1534
|
-
return normalizeLowercaseStringOrEmpty(decodeVisibleHtmlEntities(value.replace(/<[^>]+>/g, " ").replace(/[\u200b-\u200f\u202a-\u202e\u2060-\u206f]/g, "")).replace(/\s+/g, " "));
|
|
1535
|
-
}
|
|
1536
|
-
function extractVisibleMentionText(value) {
|
|
1537
|
-
return normalizeVisibleMentionText(value ?? "");
|
|
1538
|
-
}
|
|
1539
|
-
function resolveMatrixUserLocalpart(userId) {
|
|
1540
|
-
const trimmed = userId.trim();
|
|
1541
|
-
if (!trimmed.startsWith("@")) return null;
|
|
1542
|
-
const colonIndex = trimmed.indexOf(":");
|
|
1543
|
-
if (colonIndex <= 1) return null;
|
|
1544
|
-
return trimmed.slice(1, colonIndex).trim() || null;
|
|
1545
|
-
}
|
|
1546
|
-
function resolveMatrixMentionPrefixCandidates(params) {
|
|
1547
|
-
const candidates = [];
|
|
1548
|
-
const seen = /* @__PURE__ */ new Set();
|
|
1549
|
-
const append = (candidate) => {
|
|
1550
|
-
const trimmed = candidate?.trim();
|
|
1551
|
-
if (!trimmed) return;
|
|
1552
|
-
const normalized = normalizeLowercaseStringOrEmpty(trimmed);
|
|
1553
|
-
if (seen.has(normalized)) return;
|
|
1554
|
-
seen.add(normalized);
|
|
1555
|
-
candidates.push(trimmed);
|
|
1556
|
-
};
|
|
1557
|
-
append(params.userId);
|
|
1558
|
-
const localpart = params.userId ? resolveMatrixUserLocalpart(params.userId) : null;
|
|
1559
|
-
append(localpart ? `@${localpart}` : null);
|
|
1560
|
-
append(params.displayName);
|
|
1561
|
-
append(params.displayName ? `@${params.displayName}` : null);
|
|
1562
|
-
append(params.displayName ? `@[${params.displayName}]` : null);
|
|
1563
|
-
return candidates;
|
|
1564
|
-
}
|
|
1565
|
-
function stripMatchedMatrixMentionPrefix(text, pattern) {
|
|
1566
|
-
const match = text.match(pattern);
|
|
1567
|
-
if (!match) return null;
|
|
1568
|
-
return text.slice(match[0].length).trimStart();
|
|
1569
|
-
}
|
|
1570
|
-
function stripNativeMatrixMentionPrefix(text, candidate) {
|
|
1571
|
-
return stripMatchedMatrixMentionPrefix(text, new RegExp(`^\\s*${escapeRegExp(candidate)}(?:\\s*[:,])?(?:\\s+|$)`, "i"));
|
|
1572
|
-
}
|
|
1573
|
-
function stripRegexMatrixMentionPrefix(text, pattern) {
|
|
1574
|
-
const flags = pattern.flags.replace(/[gy]/g, "");
|
|
1575
|
-
return stripMatchedMatrixMentionPrefix(text, new RegExp(`^\\s*(?:${pattern.source})(?:\\s*[:,])?(?:\\s+|$)`, flags));
|
|
1576
|
-
}
|
|
1577
|
-
function stripMatrixMentionPrefix(params) {
|
|
1578
|
-
const text = params.text;
|
|
1579
|
-
if (!text) return text;
|
|
1580
|
-
for (const candidate of resolveMatrixMentionPrefixCandidates(params)) {
|
|
1581
|
-
const stripped = stripNativeMatrixMentionPrefix(text, candidate);
|
|
1582
|
-
if (stripped !== null) return stripped;
|
|
1583
|
-
}
|
|
1584
|
-
for (const pattern of params.mentionRegexes ?? []) {
|
|
1585
|
-
const stripped = stripRegexMatrixMentionPrefix(text, pattern);
|
|
1586
|
-
if (stripped !== null) return stripped;
|
|
1587
|
-
}
|
|
1588
|
-
return text;
|
|
1589
|
-
}
|
|
1590
|
-
function isVisibleMentionLabel(params) {
|
|
1591
|
-
const cleaned = extractVisibleMentionText(params.text);
|
|
1592
|
-
if (!cleaned) return false;
|
|
1593
|
-
if (params.mentionRegexes.some((pattern) => pattern.test(cleaned))) return true;
|
|
1594
|
-
const localpart = resolveMatrixUserLocalpart(params.userId);
|
|
1595
|
-
return [
|
|
1596
|
-
extractVisibleMentionText(params.userId),
|
|
1597
|
-
localpart ? extractVisibleMentionText(localpart) : null,
|
|
1598
|
-
localpart ? extractVisibleMentionText(`@${localpart}`) : null,
|
|
1599
|
-
params.displayName ? extractVisibleMentionText(params.displayName) : null,
|
|
1600
|
-
params.displayName ? extractVisibleMentionText(`@${params.displayName}`) : null,
|
|
1601
|
-
params.displayName ? extractVisibleMentionText(`@[${params.displayName}]`) : null
|
|
1602
|
-
].filter((value) => Boolean(value)).includes(cleaned);
|
|
1603
|
-
}
|
|
1604
|
-
function hasVisibleRoomMention(value) {
|
|
1605
|
-
const cleaned = extractVisibleMentionText(value);
|
|
1606
|
-
return /(^|[^a-z0-9_])@room\b/i.test(cleaned);
|
|
1607
|
-
}
|
|
1608
|
-
/**
|
|
1609
|
-
* Check if formatted_body contains a matrix.to link whose visible label still
|
|
1610
|
-
* looks like a real mention for the given user. Do not trust href alone, since
|
|
1611
|
-
* senders can hide arbitrary matrix.to links behind unrelated link text.
|
|
1612
|
-
* Many Matrix clients (including Element) use HTML links in formatted_body instead of
|
|
1613
|
-
* or in addition to the m.mentions field.
|
|
1614
|
-
*/
|
|
1615
|
-
function checkFormattedBodyMention(params) {
|
|
1616
|
-
if (!params.formattedBody || !params.userId) return false;
|
|
1617
|
-
for (const match of params.formattedBody.matchAll(/<a\b[^>]*href=(["'])(https:\/\/matrix\.to\/#[^"']+)\1[^>]*>(.*?)<\/a>/gis)) {
|
|
1618
|
-
const href = match[2];
|
|
1619
|
-
const visibleLabel = match[3] ?? "";
|
|
1620
|
-
if (!href) continue;
|
|
1621
|
-
try {
|
|
1622
|
-
const parsed = new URL(href);
|
|
1623
|
-
if (decodeURIComponent(parsed.hash.replace(/^#\/?/, "").trim()) !== params.userId.trim()) continue;
|
|
1624
|
-
if (isVisibleMentionLabel({
|
|
1625
|
-
text: visibleLabel,
|
|
1626
|
-
userId: params.userId,
|
|
1627
|
-
mentionRegexes: params.mentionRegexes,
|
|
1628
|
-
displayName: params.displayName
|
|
1629
|
-
})) return true;
|
|
1630
|
-
} catch {
|
|
1631
|
-
continue;
|
|
1632
|
-
}
|
|
1633
|
-
}
|
|
1634
|
-
return false;
|
|
1635
|
-
}
|
|
1636
|
-
function resolveMentions(params) {
|
|
1637
|
-
const mentions = params.content["m.mentions"];
|
|
1638
|
-
const mentionedUsers = Array.isArray(mentions?.user_ids) ? new Set(mentions.user_ids) : /* @__PURE__ */ new Set();
|
|
1639
|
-
const textMentioned = getMatrixRuntime().channel.mentions.matchesMentionPatterns(params.text ?? "", params.mentionRegexes);
|
|
1640
|
-
const visibleRoomMention = hasVisibleRoomMention(params.text) || hasVisibleRoomMention(params.content.formatted_body);
|
|
1641
|
-
const mentionedInFormattedBody = params.userId ? checkFormattedBodyMention({
|
|
1642
|
-
formattedBody: params.content.formatted_body,
|
|
1643
|
-
userId: params.userId,
|
|
1644
|
-
displayName: params.displayName,
|
|
1645
|
-
mentionRegexes: params.mentionRegexes
|
|
1646
|
-
}) : false;
|
|
1647
|
-
const metadataBackedUserMention = Boolean(params.userId && mentionedUsers.has(params.userId) && (mentionedInFormattedBody || textMentioned));
|
|
1648
|
-
const metadataBackedRoomMention = Boolean(mentions?.room) && visibleRoomMention;
|
|
1649
|
-
const explicitMention = mentionedInFormattedBody || metadataBackedUserMention || metadataBackedRoomMention;
|
|
1650
|
-
return {
|
|
1651
|
-
wasMentioned: explicitMention || textMentioned || visibleRoomMention,
|
|
1652
|
-
hasExplicitMention: explicitMention
|
|
1653
|
-
};
|
|
1654
|
-
}
|
|
1655
|
-
//#endregion
|
|
1656
1406
|
//#region extensions/matrix/src/matrix/monitor/preflight-audio.ts
|
|
1657
1407
|
const MATRIX_DEFAULT_ECHO_TRANSCRIPT_FORMAT = "📝 \"{transcript}\"";
|
|
1658
1408
|
const loadMatrixPreflightAudioRuntime = createLazyRuntimeModule(() => import("./preflight-audio.runtime-BZxxQsxY.js"));
|
|
@@ -1734,102 +1484,134 @@ async function sendMatrixPreflightAudioTranscriptEcho(params) {
|
|
|
1734
1484
|
}
|
|
1735
1485
|
}
|
|
1736
1486
|
//#endregion
|
|
1737
|
-
//#region extensions/matrix/src/matrix/monitor/
|
|
1738
|
-
const
|
|
1739
|
-
const
|
|
1740
|
-
function
|
|
1741
|
-
if (
|
|
1742
|
-
|
|
1743
|
-
if (
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1487
|
+
//#region extensions/matrix/src/matrix/monitor/handler-helpers.ts
|
|
1488
|
+
const MATRIX_TOOL_PROGRESS_MAX_CHARS = 300;
|
|
1489
|
+
const MAX_TRACKED_SHARED_DM_CONTEXT_NOTICES = 512;
|
|
1490
|
+
function resolveMatrixMentionPrecheckText(params) {
|
|
1491
|
+
if (params.locationText?.trim()) return params.locationText.trim();
|
|
1492
|
+
if (typeof params.content.body === "string" && params.content.body.trim()) return params.content.body.trim();
|
|
1493
|
+
if (isPollStartType(params.eventType)) {
|
|
1494
|
+
const parsed = parsePollStartContent(params.content);
|
|
1495
|
+
if (parsed) return formatPollAsText(parsed);
|
|
1496
|
+
}
|
|
1497
|
+
return "";
|
|
1498
|
+
}
|
|
1499
|
+
function hasBundledMatrixReplacementRelation(event) {
|
|
1500
|
+
const relations = event.unsigned?.["m.relations"];
|
|
1501
|
+
if (!relations || typeof relations !== "object") return false;
|
|
1502
|
+
return relations[RelationType.Replace] !== void 0;
|
|
1503
|
+
}
|
|
1504
|
+
function resolveMatrixInboundBodyText(params) {
|
|
1505
|
+
if (params.mediaPlaceholder) return params.rawBody || params.mediaPlaceholder;
|
|
1506
|
+
if (!params.mediaDownloadFailed || !params.hadMediaUrl) return params.rawBody;
|
|
1507
|
+
if (params.mediaSizeLimitExceeded) return formatMatrixMediaTooLargeText({
|
|
1508
|
+
body: params.rawBody,
|
|
1509
|
+
filename: params.filename,
|
|
1510
|
+
msgtype: params.msgtype
|
|
1758
1511
|
});
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
const
|
|
1770
|
-
if (
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
const
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
if (
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
client: params.client,
|
|
1796
|
-
cfg: params.cfg,
|
|
1797
|
-
replyToId: replyToIdForReply,
|
|
1798
|
-
threadId: params.threadId,
|
|
1799
|
-
accountId: params.accountId
|
|
1800
|
-
});
|
|
1801
|
-
deliveredAny = true;
|
|
1802
|
-
sentTextChunk = true;
|
|
1803
|
-
}
|
|
1804
|
-
if (replyToIdForReply && !hasReplied && sentTextChunk) hasReplied = true;
|
|
1805
|
-
continue;
|
|
1806
|
-
}
|
|
1807
|
-
let first = true;
|
|
1808
|
-
for (const mediaUrl of mediaList) {
|
|
1809
|
-
const caption = first ? rawText : "";
|
|
1810
|
-
await sendMessageMatrix(params.roomId, caption, {
|
|
1811
|
-
client: params.client,
|
|
1812
|
-
cfg: params.cfg,
|
|
1813
|
-
mediaUrl,
|
|
1814
|
-
mediaLocalRoots: params.mediaLocalRoots,
|
|
1815
|
-
replyToId: replyToIdForReply,
|
|
1816
|
-
threadId: params.threadId,
|
|
1817
|
-
audioAsVoice: reply.audioAsVoice,
|
|
1818
|
-
accountId: params.accountId
|
|
1819
|
-
});
|
|
1820
|
-
deliveredAny = true;
|
|
1821
|
-
first = false;
|
|
1822
|
-
}
|
|
1823
|
-
if (replyToIdForReply && !hasReplied) hasReplied = true;
|
|
1512
|
+
return formatMatrixMediaUnavailableText({
|
|
1513
|
+
body: params.rawBody,
|
|
1514
|
+
filename: params.filename,
|
|
1515
|
+
msgtype: params.msgtype
|
|
1516
|
+
});
|
|
1517
|
+
}
|
|
1518
|
+
function markTrackedRoomIfFirst(set, roomId) {
|
|
1519
|
+
if (set.has(roomId)) return false;
|
|
1520
|
+
set.add(roomId);
|
|
1521
|
+
if (set.size > MAX_TRACKED_SHARED_DM_CONTEXT_NOTICES) {
|
|
1522
|
+
const oldest = set.keys().next().value;
|
|
1523
|
+
if (typeof oldest === "string") set.delete(oldest);
|
|
1524
|
+
}
|
|
1525
|
+
return true;
|
|
1526
|
+
}
|
|
1527
|
+
function resolveMatrixSharedDmContextNotice(params) {
|
|
1528
|
+
if ((params.dmSessionScope ?? "per-user") === "per-room") return null;
|
|
1529
|
+
if (params.sentRooms.has(params.roomId)) return null;
|
|
1530
|
+
try {
|
|
1531
|
+
const currentSession = resolveMatrixStoredSessionMeta(getSessionEntry({
|
|
1532
|
+
storePath: params.storePath,
|
|
1533
|
+
sessionKey: params.sessionKey
|
|
1534
|
+
}));
|
|
1535
|
+
if (!currentSession) return null;
|
|
1536
|
+
if (currentSession.channel && currentSession.channel !== "matrix") return null;
|
|
1537
|
+
if (currentSession.accountId && currentSession.accountId !== params.accountId) return null;
|
|
1538
|
+
if (!currentSession.directUserId) return null;
|
|
1539
|
+
if (!currentSession.roomId || currentSession.roomId === params.roomId) return null;
|
|
1540
|
+
return [
|
|
1541
|
+
"This Matrix DM is sharing a session with another Matrix DM room.",
|
|
1542
|
+
"Use /focus here for a one-off isolated thread session when thread bindings are enabled, or set",
|
|
1543
|
+
"channels.matrix.dm.sessionScope to per-room to isolate each Matrix DM room."
|
|
1544
|
+
].join(" ");
|
|
1545
|
+
} catch (err) {
|
|
1546
|
+
params.logVerboseMessage(`matrix: failed checking shared DM session notice room=${params.roomId} (${String(err)})`);
|
|
1547
|
+
return null;
|
|
1824
1548
|
}
|
|
1825
|
-
|
|
1549
|
+
}
|
|
1550
|
+
function resolveMatrixPendingHistoryText(params) {
|
|
1551
|
+
if (params.mentionPrecheckText) return params.mentionPrecheckText;
|
|
1552
|
+
if (!params.mediaUrl) return "";
|
|
1553
|
+
const body = typeof params.content.body === "string" ? params.content.body.trim() : void 0;
|
|
1554
|
+
const filename = typeof params.content.filename === "string" ? params.content.filename.trim() : void 0;
|
|
1555
|
+
const msgtype = typeof params.content.msgtype === "string" ? params.content.msgtype : void 0;
|
|
1556
|
+
return formatMatrixMessageText({
|
|
1557
|
+
body: resolveMatrixMessageBody({
|
|
1558
|
+
body,
|
|
1559
|
+
filename,
|
|
1560
|
+
msgtype
|
|
1561
|
+
}),
|
|
1562
|
+
attachment: resolveMatrixMessageAttachment({
|
|
1563
|
+
body,
|
|
1564
|
+
filename,
|
|
1565
|
+
msgtype
|
|
1566
|
+
})
|
|
1567
|
+
}) ?? "";
|
|
1568
|
+
}
|
|
1569
|
+
function isMatrixAudioMediaEnabled(cfg) {
|
|
1570
|
+
return cfg.tools?.media?.audio?.enabled !== false;
|
|
1571
|
+
}
|
|
1572
|
+
function shouldDeferMatrixAudioPreflightForRoomIngress(params) {
|
|
1573
|
+
if (!isMatrixAudioMediaEnabled(params.cfg)) return false;
|
|
1574
|
+
const content = params.content;
|
|
1575
|
+
const contentUrl = "url" in content && typeof content.url === "string" ? content.url : void 0;
|
|
1576
|
+
const contentFile = "file" in content && content.file && typeof content.file === "object" ? content.file : void 0;
|
|
1577
|
+
const mediaUrl = contentUrl ?? contentFile?.url;
|
|
1578
|
+
const contentInfo = "info" in content && content.info && typeof content.info === "object" ? content.info : void 0;
|
|
1579
|
+
return mediaUrl?.startsWith("mxc://") === true && isMatrixAudioContent({
|
|
1580
|
+
msgtype: typeof content.msgtype === "string" ? content.msgtype : void 0,
|
|
1581
|
+
mimetype: contentInfo?.mimetype
|
|
1582
|
+
});
|
|
1583
|
+
}
|
|
1584
|
+
function resolveMatrixAllowBotsMode(value) {
|
|
1585
|
+
if (value === true) return "all";
|
|
1586
|
+
if (value === "mentions") return "mentions";
|
|
1587
|
+
return "off";
|
|
1588
|
+
}
|
|
1589
|
+
function formatMatrixToolProgressMarkdownCode(text) {
|
|
1590
|
+
return `\`${(text.length <= MATRIX_TOOL_PROGRESS_MAX_CHARS ? text : `${truncateUtf16Safe(text, MATRIX_TOOL_PROGRESS_MAX_CHARS - 1).trimEnd()}...`).replaceAll("`", "'")}\``;
|
|
1826
1591
|
}
|
|
1827
1592
|
//#endregion
|
|
1828
|
-
//#region extensions/matrix/src/matrix/monitor/
|
|
1829
|
-
function
|
|
1830
|
-
|
|
1831
|
-
|
|
1593
|
+
//#region extensions/matrix/src/matrix/monitor/handler-runtime.ts
|
|
1594
|
+
async function redactMatrixDraftEvent(client, roomId, draftEventId) {
|
|
1595
|
+
return await client.redactEvent(roomId, draftEventId).then(() => true, () => false);
|
|
1596
|
+
}
|
|
1597
|
+
function buildMatrixFinalizedPreviewContent() {
|
|
1598
|
+
return { [MATRIX_OPENCLAW_FINALIZED_PREVIEW_KEY]: true };
|
|
1599
|
+
}
|
|
1600
|
+
const loadMatrixSendModule = createLazyRuntimeModule(() => import("./send-BldGYG8g.js").then((n) => n.s));
|
|
1601
|
+
const loadAcpBindingRuntime = createLazyRuntimeModule(() => import("openclaw/plugin-sdk/acp-binding-runtime"));
|
|
1602
|
+
const loadSessionBindingRuntime = createLazyRuntimeModule(() => import("openclaw/plugin-sdk/session-binding-runtime"));
|
|
1603
|
+
const loadMatrixReactionEvents = createLazyRuntimeModule(() => import("./reaction-events-B00WSi98.js"));
|
|
1604
|
+
const loadMatrixDraftStream = createLazyRuntimeModule(() => import("./draft-stream-CtvOXq0Z.js"));
|
|
1605
|
+
async function matrixTextWouldActivateMentions(client, text) {
|
|
1606
|
+
const { resolveMatrixMentionsForBody } = await loadMatrixSendModule();
|
|
1607
|
+
const mentions = await resolveMatrixMentionsForBody({
|
|
1608
|
+
client,
|
|
1609
|
+
body: text
|
|
1610
|
+
});
|
|
1611
|
+
return mentions.room === true || (mentions.user_ids?.length ?? 0) > 0;
|
|
1832
1612
|
}
|
|
1613
|
+
//#endregion
|
|
1614
|
+
//#region extensions/matrix/src/matrix/monitor/context-summary.ts
|
|
1833
1615
|
function summarizeMatrixMessageContextEvent(event) {
|
|
1834
1616
|
if (isPollStartType(event.type)) {
|
|
1835
1617
|
const pollSummary = parsePollStartContent(event.content);
|
|
@@ -1838,14 +1620,14 @@ function summarizeMatrixMessageContextEvent(event) {
|
|
|
1838
1620
|
const content = event.content;
|
|
1839
1621
|
return formatMatrixMessageText({
|
|
1840
1622
|
body: resolveMatrixMessageBody({
|
|
1841
|
-
body:
|
|
1842
|
-
filename:
|
|
1843
|
-
msgtype:
|
|
1623
|
+
body: normalizeOptionalString(content.body),
|
|
1624
|
+
filename: normalizeOptionalString(content.filename),
|
|
1625
|
+
msgtype: normalizeOptionalString(content.msgtype)
|
|
1844
1626
|
}),
|
|
1845
1627
|
attachment: resolveMatrixMessageAttachment({
|
|
1846
|
-
body:
|
|
1847
|
-
filename:
|
|
1848
|
-
msgtype:
|
|
1628
|
+
body: normalizeOptionalString(content.body),
|
|
1629
|
+
filename: normalizeOptionalString(content.filename),
|
|
1630
|
+
msgtype: normalizeOptionalString(content.msgtype)
|
|
1849
1631
|
})
|
|
1850
1632
|
});
|
|
1851
1633
|
}
|
|
@@ -1893,7 +1675,7 @@ function createMatrixReplyContextResolver(params) {
|
|
|
1893
1675
|
if (rawEvent.unsigned?.redacted_because) return remember(cacheKey, {});
|
|
1894
1676
|
const replyToBody = summarizeMatrixReplyEvent(rawEvent);
|
|
1895
1677
|
if (!replyToBody) return remember(cacheKey, {});
|
|
1896
|
-
const senderId =
|
|
1678
|
+
const senderId = normalizeOptionalString(rawEvent.sender);
|
|
1897
1679
|
const senderName = senderId && await params.getMemberDisplayName(input.roomId, senderId).catch(() => void 0);
|
|
1898
1680
|
return remember(cacheKey, {
|
|
1899
1681
|
replyToBody,
|
|
@@ -1903,38 +1685,542 @@ function createMatrixReplyContextResolver(params) {
|
|
|
1903
1685
|
};
|
|
1904
1686
|
}
|
|
1905
1687
|
//#endregion
|
|
1906
|
-
//#region extensions/matrix/src/matrix/monitor/
|
|
1907
|
-
|
|
1908
|
-
const
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
const
|
|
1915
|
-
|
|
1916
|
-
const
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1688
|
+
//#region extensions/matrix/src/matrix/monitor/thread-context.ts
|
|
1689
|
+
const MAX_TRACKED_THREAD_STARTERS = 256;
|
|
1690
|
+
const MAX_THREAD_STARTER_BODY_LENGTH = 500;
|
|
1691
|
+
function truncateThreadStarterBody(value) {
|
|
1692
|
+
if (value.length <= MAX_THREAD_STARTER_BODY_LENGTH) return value;
|
|
1693
|
+
return `${sliceUtf16Safe(value, 0, MAX_THREAD_STARTER_BODY_LENGTH - 3)}...`;
|
|
1694
|
+
}
|
|
1695
|
+
function summarizeMatrixThreadStarterEvent(event) {
|
|
1696
|
+
const body = summarizeMatrixMessageContextEvent(event);
|
|
1697
|
+
if (body) return truncateThreadStarterBody(body);
|
|
1698
|
+
const content = event.content;
|
|
1699
|
+
const msgtype = normalizeOptionalString(content.msgtype);
|
|
1700
|
+
if (msgtype) return `Matrix ${msgtype} message`;
|
|
1701
|
+
const eventType = normalizeOptionalString(event.type);
|
|
1702
|
+
return eventType ? `Matrix ${eventType} event` : void 0;
|
|
1703
|
+
}
|
|
1704
|
+
function formatMatrixThreadStarterBody(params) {
|
|
1705
|
+
const senderLabel = params.senderName ?? params.senderId ?? "unknown sender";
|
|
1706
|
+
const lines = [`Matrix thread root ${params.threadRootId} from ${senderLabel}:`];
|
|
1707
|
+
if (params.summary) lines.push(params.summary);
|
|
1708
|
+
return lines.join("\n");
|
|
1709
|
+
}
|
|
1710
|
+
function createMatrixThreadContextResolver(params) {
|
|
1711
|
+
const cache = /* @__PURE__ */ new Map();
|
|
1712
|
+
const remember = (key, value) => {
|
|
1713
|
+
cache.set(key, value);
|
|
1714
|
+
if (cache.size > MAX_TRACKED_THREAD_STARTERS) {
|
|
1715
|
+
const oldest = cache.keys().next().value;
|
|
1716
|
+
if (typeof oldest === "string") cache.delete(oldest);
|
|
1717
|
+
}
|
|
1718
|
+
return value;
|
|
1719
|
+
};
|
|
1720
|
+
return async (input) => {
|
|
1721
|
+
const cacheKey = `${input.roomId}:${input.threadRootId}`;
|
|
1722
|
+
const cached = cache.get(cacheKey);
|
|
1723
|
+
if (cached) return cached;
|
|
1724
|
+
const rootEvent = await params.client.getEvent(input.roomId, input.threadRootId).catch((err) => {
|
|
1725
|
+
params.logVerboseMessage(`matrix: failed resolving thread root room=${input.roomId} id=${input.threadRootId}: ${String(err)}`);
|
|
1726
|
+
return null;
|
|
1727
|
+
});
|
|
1728
|
+
if (!rootEvent) return { threadStarterBody: `Matrix thread root ${input.threadRootId}` };
|
|
1729
|
+
const rawEvent = rootEvent;
|
|
1730
|
+
const senderId = normalizeOptionalString(rawEvent.sender);
|
|
1731
|
+
const senderName = senderId && await params.getMemberDisplayName(input.roomId, senderId).catch(() => void 0);
|
|
1732
|
+
const senderLabel = senderName ?? senderId;
|
|
1733
|
+
const summary = summarizeMatrixThreadStarterEvent(rawEvent);
|
|
1734
|
+
return remember(cacheKey, {
|
|
1735
|
+
threadStarterBody: formatMatrixThreadStarterBody({
|
|
1736
|
+
threadRootId: input.threadRootId,
|
|
1737
|
+
senderId,
|
|
1738
|
+
senderName,
|
|
1739
|
+
summary
|
|
1740
|
+
}),
|
|
1741
|
+
senderId,
|
|
1742
|
+
senderLabel,
|
|
1743
|
+
summary
|
|
1744
|
+
});
|
|
1745
|
+
};
|
|
1746
|
+
}
|
|
1747
|
+
//#endregion
|
|
1748
|
+
//#region extensions/matrix/src/matrix/monitor/handler-context.ts
|
|
1749
|
+
async function resolveMatrixInboundContext(config) {
|
|
1750
|
+
const { client, core, cfg, accountId, runtime, logVerboseMessage, roomId, event, eventTs, route: _route, isDirectMessage, isRoom, effectiveRoomUsers, groupPolicy, effectiveGroupAllowFrom, contextVisibilityMode, resolveThreadContext, resolveReplyContext, threadRootId, thread, getRoomInfo, senderId, senderName, bodyText, commandBodyText, roomConfig, messageId, inboundHistory, wasMentioned, effectiveWasMentioned, shouldBypassMention, canDetectMention, shouldRequireMention, commandAuthorized, locationPayload, media, preflightAudioTranscript, historyLimit, hasExplicitSessionBinding, dmSessionScope, sharedDmContextNoticeRooms, resolveStorePath: resolveStorePathImpl, createChannelInboundEnvelopeBuilder: createChannelInboundEnvelopeBuilderImpl, finalizeInboundContext } = config;
|
|
1751
|
+
const replyToEventId = resolveMatrixReplyToEventId(event.content);
|
|
1752
|
+
const threadTarget = thread.threadId;
|
|
1753
|
+
const isRoomContextSenderAllowed = (contextSenderId) => {
|
|
1754
|
+
if (!isRoom || !contextSenderId) return true;
|
|
1755
|
+
if (effectiveRoomUsers.length > 0) return resolveMatrixAllowListMatch({
|
|
1756
|
+
allowList: effectiveRoomUsers,
|
|
1757
|
+
userId: contextSenderId
|
|
1758
|
+
}).allowed;
|
|
1759
|
+
if (groupPolicy === "allowlist" && effectiveGroupAllowFrom.length > 0) return resolveMatrixAllowListMatch({
|
|
1760
|
+
allowList: effectiveGroupAllowFrom,
|
|
1761
|
+
userId: contextSenderId
|
|
1762
|
+
}).allowed;
|
|
1763
|
+
return true;
|
|
1764
|
+
};
|
|
1765
|
+
const shouldIncludeRoomContextSender = (kind, contextSenderId) => evaluateSupplementalContextVisibility({
|
|
1766
|
+
mode: contextVisibilityMode,
|
|
1767
|
+
kind,
|
|
1768
|
+
senderAllowed: isRoomContextSenderAllowed(contextSenderId)
|
|
1769
|
+
}).include;
|
|
1770
|
+
let threadContext = threadRootId ? await resolveThreadContext({
|
|
1771
|
+
roomId,
|
|
1772
|
+
threadRootId
|
|
1773
|
+
}) : void 0;
|
|
1774
|
+
let threadContextBlockedByPolicy = false;
|
|
1775
|
+
if (threadContext?.senderId && !shouldIncludeRoomContextSender("thread", threadContext.senderId)) {
|
|
1776
|
+
logVerboseMessage(`matrix: drop thread root context (mode=${contextVisibilityMode})`);
|
|
1777
|
+
threadContextBlockedByPolicy = true;
|
|
1778
|
+
threadContext = void 0;
|
|
1924
1779
|
}
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1780
|
+
let replyContext;
|
|
1781
|
+
if (replyToEventId && replyToEventId === threadRootId && threadContext?.summary) replyContext = {
|
|
1782
|
+
replyToBody: threadContext.summary,
|
|
1783
|
+
replyToSender: threadContext.senderLabel,
|
|
1784
|
+
replyToSenderId: threadContext.senderId
|
|
1785
|
+
};
|
|
1786
|
+
else if (replyToEventId && replyToEventId === threadRootId && threadContextBlockedByPolicy) replyContext = await resolveReplyContext({
|
|
1787
|
+
roomId,
|
|
1788
|
+
eventId: replyToEventId
|
|
1789
|
+
});
|
|
1790
|
+
else replyContext = replyToEventId ? await resolveReplyContext({
|
|
1791
|
+
roomId,
|
|
1792
|
+
eventId: replyToEventId
|
|
1793
|
+
}) : void 0;
|
|
1794
|
+
const replySenderAllowed = !replyContext?.replyToSenderId || isRoomContextSenderAllowed(replyContext.replyToSenderId);
|
|
1795
|
+
const roomName = (isRoom ? await getRoomInfo(roomId) : void 0)?.name;
|
|
1796
|
+
const envelopeFrom = isDirectMessage ? senderName : roomName ?? roomId;
|
|
1797
|
+
const textWithId = `${bodyText}\n[matrix event id: ${messageId} room: ${roomId}]`;
|
|
1798
|
+
const storePath = resolveStorePathImpl(cfg.session?.store, { agentId: _route.agentId });
|
|
1799
|
+
const buildEnvelope = createChannelInboundEnvelopeBuilderImpl({
|
|
1800
|
+
cfg,
|
|
1801
|
+
route: _route
|
|
1802
|
+
});
|
|
1803
|
+
const sharedDmNoticeSessionKey = threadTarget ? _route.mainSessionKey || _route.sessionKey : _route.sessionKey;
|
|
1804
|
+
const sharedDmContextNotice = isDirectMessage ? hasExplicitSessionBinding ? null : resolveMatrixSharedDmContextNotice({
|
|
1805
|
+
storePath,
|
|
1806
|
+
sessionKey: sharedDmNoticeSessionKey,
|
|
1807
|
+
roomId,
|
|
1808
|
+
accountId: _route.accountId,
|
|
1809
|
+
dmSessionScope,
|
|
1810
|
+
sentRooms: sharedDmContextNoticeRooms,
|
|
1811
|
+
logVerboseMessage
|
|
1812
|
+
}) : null;
|
|
1813
|
+
const body = buildEnvelope({
|
|
1814
|
+
channel: "Matrix",
|
|
1815
|
+
from: envelopeFrom,
|
|
1816
|
+
timestamp: eventTs ?? void 0,
|
|
1817
|
+
body: textWithId
|
|
1818
|
+
});
|
|
1819
|
+
const groupSystemPrompt = normalizeOptionalString(roomConfig?.systemPrompt);
|
|
1820
|
+
const quoteHidden = Boolean(replyContext && !evaluateSupplementalContextVisibility({
|
|
1821
|
+
mode: contextVisibilityMode,
|
|
1822
|
+
kind: "quote",
|
|
1823
|
+
senderAllowed: replySenderAllowed
|
|
1824
|
+
}).include);
|
|
1825
|
+
const ctxPayload = buildChannelInboundEventContext({
|
|
1826
|
+
channel: "matrix",
|
|
1827
|
+
contextVisibility: contextVisibilityMode,
|
|
1828
|
+
finalize: finalizeInboundContext,
|
|
1829
|
+
supplemental: {
|
|
1830
|
+
quote: replyContext ? {
|
|
1831
|
+
id: threadTarget ? void 0 : replyToEventId ?? void 0,
|
|
1832
|
+
body: replyContext.replyToBody,
|
|
1833
|
+
sender: replyContext.replyToSender,
|
|
1834
|
+
senderAllowed: replySenderAllowed
|
|
1835
|
+
} : void 0,
|
|
1836
|
+
thread: {
|
|
1837
|
+
starterBody: threadContext?.threadStarterBody,
|
|
1838
|
+
senderAllowed: threadContext ? true : void 0
|
|
1839
|
+
},
|
|
1840
|
+
groupSystemPrompt: isRoom ? groupSystemPrompt : void 0
|
|
1841
|
+
},
|
|
1842
|
+
media: await toInboundMediaFactsWithMetadata(media ? [{
|
|
1843
|
+
path: media.path,
|
|
1844
|
+
url: media.path,
|
|
1845
|
+
contentType: media.contentType,
|
|
1846
|
+
transcribed: preflightAudioTranscript !== void 0
|
|
1847
|
+
}] : void 0),
|
|
1848
|
+
messageId,
|
|
1849
|
+
timestamp: eventTs ?? void 0,
|
|
1850
|
+
from: isDirectMessage ? `matrix:${senderId}` : `matrix:channel:${roomId}`,
|
|
1851
|
+
sender: {
|
|
1852
|
+
id: senderId,
|
|
1853
|
+
name: senderName,
|
|
1854
|
+
username: senderId.split(":")[0]?.replace(/^@/, "")
|
|
1855
|
+
},
|
|
1856
|
+
conversation: {
|
|
1857
|
+
kind: isDirectMessage ? "direct" : "channel",
|
|
1858
|
+
id: roomId,
|
|
1859
|
+
label: envelopeFrom,
|
|
1860
|
+
nativeChannelId: roomId,
|
|
1861
|
+
threadId: threadTarget
|
|
1862
|
+
},
|
|
1863
|
+
route: {
|
|
1864
|
+
agentId: _route.agentId,
|
|
1865
|
+
dmScope: _route.dmScope,
|
|
1866
|
+
accountId: _route.accountId,
|
|
1867
|
+
routeSessionKey: _route.sessionKey
|
|
1868
|
+
},
|
|
1869
|
+
reply: {
|
|
1870
|
+
to: `room:${roomId}`,
|
|
1871
|
+
replyToId: threadTarget ? void 0 : replyToEventId ?? void 0,
|
|
1872
|
+
messageThreadId: threadTarget,
|
|
1873
|
+
nativeChannelId: roomId
|
|
1874
|
+
},
|
|
1875
|
+
message: {
|
|
1876
|
+
body,
|
|
1877
|
+
rawBody: bodyText,
|
|
1878
|
+
commandBody: commandBodyText,
|
|
1879
|
+
bodyForAgent: bodyText,
|
|
1880
|
+
inboundHistory: inboundHistory && inboundHistory.length > 0 ? inboundHistory : void 0
|
|
1881
|
+
},
|
|
1882
|
+
sessionTranscript: { historyLimit: isRoom ? historyLimit : 0 },
|
|
1883
|
+
access: {
|
|
1884
|
+
...isRoom ? { mentions: {
|
|
1885
|
+
canDetectMention: true,
|
|
1886
|
+
wasMentioned,
|
|
1887
|
+
requireMention: shouldRequireMention
|
|
1888
|
+
} } : {},
|
|
1889
|
+
commands: { authorized: commandAuthorized }
|
|
1890
|
+
},
|
|
1891
|
+
extra: {
|
|
1892
|
+
GroupSubject: isRoom ? roomName ?? roomId : void 0,
|
|
1893
|
+
GroupId: isRoom ? roomId : void 0,
|
|
1894
|
+
GroupChannel: isRoom ? roomId : void 0,
|
|
1895
|
+
...locationPayload?.context,
|
|
1896
|
+
CommandSource: "text",
|
|
1897
|
+
NativeDirectUserId: isDirectMessage ? senderId : void 0
|
|
1929
1898
|
}
|
|
1899
|
+
});
|
|
1900
|
+
if (quoteHidden) logVerboseMessage(`matrix: drop reply context (mode=${contextVisibilityMode})`);
|
|
1901
|
+
logVerboseMessage(`matrix inbound: room=${roomId} from=${senderId} preview="${truncateUtf16Safe(bodyText, 200).replace(/\n/g, "\\n")}"`);
|
|
1902
|
+
const replyTarget = ctxPayload.To;
|
|
1903
|
+
if (!replyTarget) {
|
|
1904
|
+
runtime.error?.("matrix: missing reply target");
|
|
1905
|
+
return null;
|
|
1930
1906
|
}
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1907
|
+
const { ackReaction, ackReactionScope: ackScope } = resolveMatrixAckReactionConfig({
|
|
1908
|
+
cfg,
|
|
1909
|
+
agentId: _route.agentId,
|
|
1910
|
+
accountId
|
|
1911
|
+
});
|
|
1912
|
+
const shouldAckReaction = () => Boolean(ackReaction && core.channel.reactions.shouldAckReaction({
|
|
1913
|
+
scope: ackScope,
|
|
1914
|
+
isDirect: isDirectMessage,
|
|
1915
|
+
isGroup: isRoom,
|
|
1916
|
+
isMentionableGroup: isRoom,
|
|
1917
|
+
canDetectMention,
|
|
1918
|
+
effectiveWasMentioned,
|
|
1919
|
+
shouldBypassMention
|
|
1920
|
+
}));
|
|
1921
|
+
if (shouldAckReaction() && messageId) loadMatrixSendModule().then(({ reactMatrixMessage }) => reactMatrixMessage(roomId, messageId, ackReaction, client)).catch((err) => {
|
|
1922
|
+
logVerboseMessage(`matrix react failed for room ${roomId}: ${String(err)}`);
|
|
1923
|
+
});
|
|
1924
|
+
if (messageId) loadMatrixSendModule().then(({ sendReadReceiptMatrix }) => sendReadReceiptMatrix(roomId, messageId, client)).catch((err) => {
|
|
1925
|
+
logVerboseMessage(`matrix: read receipt failed room=${roomId} id=${messageId}: ${String(err)}`);
|
|
1926
|
+
});
|
|
1927
|
+
return {
|
|
1928
|
+
replyToEventId,
|
|
1929
|
+
threadTarget,
|
|
1930
|
+
storePath,
|
|
1931
|
+
ctxPayload,
|
|
1932
|
+
replyTarget,
|
|
1933
|
+
sharedDmContextNotice
|
|
1934
|
+
};
|
|
1935
|
+
}
|
|
1936
|
+
//#endregion
|
|
1937
|
+
//#region extensions/matrix/src/matrix/monitor/handler-draft-controller.ts
|
|
1938
|
+
async function createMatrixDraftController(params) {
|
|
1939
|
+
const { streaming, previewToolProgressEnabled, replyToMode, messageId, threadTarget, accountConfig, cfg, accountId, roomId, client, logVerboseMessage } = params;
|
|
1940
|
+
let draftConsumed = false;
|
|
1941
|
+
const draftStreamingEnabled = streaming !== "off";
|
|
1942
|
+
const quietDraftStreaming = streaming === "quiet" || streaming === "progress";
|
|
1943
|
+
const progressDraftStreaming = streaming === "progress";
|
|
1944
|
+
const draftReplyToId = replyToMode !== "off" && !threadTarget ? messageId : void 0;
|
|
1945
|
+
const draftStream = draftStreamingEnabled ? await loadMatrixDraftStream().then(({ createMatrixDraftStream }) => createMatrixDraftStream({
|
|
1946
|
+
roomId,
|
|
1947
|
+
client,
|
|
1948
|
+
cfg,
|
|
1949
|
+
mode: quietDraftStreaming ? "quiet" : "partial",
|
|
1950
|
+
threadId: threadTarget,
|
|
1951
|
+
replyToId: draftReplyToId,
|
|
1952
|
+
preserveReplyId: replyToMode === "all",
|
|
1953
|
+
accountId,
|
|
1954
|
+
log: logVerboseMessage
|
|
1955
|
+
})) : void 0;
|
|
1956
|
+
const shouldStreamPreviewToolProgress = Boolean(draftStream) && previewToolProgressEnabled;
|
|
1957
|
+
const shouldSuppressDefaultToolProgressMessages = Boolean(draftStream) && (shouldStreamPreviewToolProgress || params.streaming === "progress");
|
|
1958
|
+
let currentDraftMessageGeneration = 0;
|
|
1959
|
+
let currentDraftBlockOffset = 0;
|
|
1960
|
+
let latestDraftFullText = "";
|
|
1961
|
+
const pendingDraftBoundaries = [];
|
|
1962
|
+
const latestQueuedDraftBoundaryOffsets = /* @__PURE__ */ new Map();
|
|
1963
|
+
let currentDraftReplyToId = draftReplyToId;
|
|
1964
|
+
let previewToolProgressSuppressed = false;
|
|
1965
|
+
let previewToolProgressLines = [];
|
|
1966
|
+
let latestPlan;
|
|
1967
|
+
let latestPlanExplanation;
|
|
1968
|
+
const progressConfigEntry = accountConfig ?? cfg.channels?.matrix;
|
|
1969
|
+
const progressSeed = `${accountId}:${roomId}`;
|
|
1970
|
+
const renderProgressDraft = () => {
|
|
1971
|
+
if (!draftStream) return;
|
|
1972
|
+
const previewText = formatChannelProgressDraftText({
|
|
1973
|
+
entry: progressConfigEntry,
|
|
1974
|
+
lines: previewToolProgressLines,
|
|
1975
|
+
seed: progressSeed,
|
|
1976
|
+
formatLine: formatMatrixToolProgressMarkdownCode,
|
|
1977
|
+
bullet: "-",
|
|
1978
|
+
narration: latestPlanExplanation,
|
|
1979
|
+
plan: latestPlan
|
|
1980
|
+
});
|
|
1981
|
+
if (!previewText) return;
|
|
1982
|
+
draftStream.update(previewText);
|
|
1983
|
+
};
|
|
1984
|
+
const progressDraftGate = createChannelProgressDraftGate({ onStart: renderProgressDraft });
|
|
1985
|
+
const pushPreviewToolProgress = async (line, options) => {
|
|
1986
|
+
if (!draftStream) return;
|
|
1987
|
+
if (options?.toolName !== void 0 && !isChannelProgressDraftWorkToolName(options.toolName)) return;
|
|
1988
|
+
const normalized = normalizeChannelProgressDraftLineIdentity(line);
|
|
1989
|
+
const progressLine = typeof line === "object" && line !== void 0 ? line : normalized;
|
|
1990
|
+
if (!progressDraftStreaming) {
|
|
1991
|
+
if (!shouldStreamPreviewToolProgress || previewToolProgressSuppressed || !normalized) return;
|
|
1992
|
+
const nextLines = mergeChannelProgressDraftLine(previewToolProgressLines, progressLine, { maxLines: resolveChannelProgressDraftMaxLines(progressConfigEntry) });
|
|
1993
|
+
if (nextLines === previewToolProgressLines) return;
|
|
1994
|
+
previewToolProgressLines = nextLines;
|
|
1995
|
+
draftStream.update(formatChannelProgressDraftText({
|
|
1996
|
+
entry: progressConfigEntry,
|
|
1997
|
+
lines: previewToolProgressLines,
|
|
1998
|
+
seed: progressSeed,
|
|
1999
|
+
formatLine: formatMatrixToolProgressMarkdownCode,
|
|
2000
|
+
bullet: "-",
|
|
2001
|
+
narration: latestPlanExplanation,
|
|
2002
|
+
plan: latestPlan
|
|
2003
|
+
}));
|
|
2004
|
+
return;
|
|
2005
|
+
}
|
|
2006
|
+
if (shouldStreamPreviewToolProgress && !previewToolProgressSuppressed && normalized) previewToolProgressLines = mergeChannelProgressDraftLine(previewToolProgressLines, progressLine, { maxLines: resolveChannelProgressDraftMaxLines(progressConfigEntry) });
|
|
2007
|
+
const alreadyStarted = progressDraftGate.hasStarted;
|
|
2008
|
+
const progressActive = await progressDraftGate.noteWork();
|
|
2009
|
+
if ((alreadyStarted || progressActive) && progressDraftGate.hasStarted) renderProgressDraft();
|
|
2010
|
+
};
|
|
2011
|
+
const pushPlanProgress = async (steps, explanation) => {
|
|
2012
|
+
latestPlan = steps?.length ? steps.map((entry) => ({ ...entry })) : void 0;
|
|
2013
|
+
latestPlanExplanation = explanation?.replace(/\s+/g, " ").trim() || void 0;
|
|
2014
|
+
if (!draftStream || previewToolProgressSuppressed) return;
|
|
2015
|
+
if (!progressDraftStreaming) {
|
|
2016
|
+
renderProgressDraft();
|
|
2017
|
+
return;
|
|
2018
|
+
}
|
|
2019
|
+
const alreadyStarted = progressDraftGate.hasStarted;
|
|
2020
|
+
await progressDraftGate.startNow();
|
|
2021
|
+
if (alreadyStarted && progressDraftGate.hasStarted) renderProgressDraft();
|
|
2022
|
+
};
|
|
2023
|
+
const suppressPreviewToolProgressForAnswerText = (text) => {
|
|
2024
|
+
if (!text?.trim()) return;
|
|
2025
|
+
previewToolProgressSuppressed = true;
|
|
2026
|
+
previewToolProgressLines = [];
|
|
2027
|
+
latestPlan = void 0;
|
|
2028
|
+
latestPlanExplanation = void 0;
|
|
2029
|
+
};
|
|
2030
|
+
const resetPreviewToolProgress = () => {
|
|
2031
|
+
previewToolProgressSuppressed = false;
|
|
2032
|
+
previewToolProgressLines = [];
|
|
2033
|
+
latestPlan = void 0;
|
|
2034
|
+
latestPlanExplanation = void 0;
|
|
2035
|
+
};
|
|
2036
|
+
const buildPreviewToolProgressReplyOptions = () => {
|
|
2037
|
+
if (!shouldSuppressDefaultToolProgressMessages) return {};
|
|
2038
|
+
const options = { suppressDefaultToolProgressMessages: true };
|
|
2039
|
+
if (!shouldStreamPreviewToolProgress) return options;
|
|
2040
|
+
return {
|
|
2041
|
+
...options,
|
|
2042
|
+
onToolStart: async (payload) => {
|
|
2043
|
+
const toolName = payload.name?.trim();
|
|
2044
|
+
await pushPreviewToolProgress(buildChannelProgressDraftLineForEntry(progressConfigEntry, {
|
|
2045
|
+
event: "tool",
|
|
2046
|
+
itemId: payload.itemId,
|
|
2047
|
+
toolCallId: payload.toolCallId,
|
|
2048
|
+
name: toolName,
|
|
2049
|
+
phase: payload.phase,
|
|
2050
|
+
args: payload.args
|
|
2051
|
+
}, payload.detailMode ? { detailMode: payload.detailMode } : void 0), { toolName });
|
|
2052
|
+
},
|
|
2053
|
+
onItemEvent: async (payload) => {
|
|
2054
|
+
await pushPreviewToolProgress(buildChannelProgressDraftLineForEntry(progressConfigEntry, {
|
|
2055
|
+
event: "item",
|
|
2056
|
+
itemId: payload.itemId,
|
|
2057
|
+
toolCallId: payload.toolCallId,
|
|
2058
|
+
itemKind: payload.kind,
|
|
2059
|
+
title: payload.title,
|
|
2060
|
+
name: payload.name,
|
|
2061
|
+
phase: payload.phase,
|
|
2062
|
+
status: payload.status,
|
|
2063
|
+
summary: payload.summary,
|
|
2064
|
+
progressText: payload.progressText,
|
|
2065
|
+
meta: payload.meta
|
|
2066
|
+
}));
|
|
2067
|
+
},
|
|
2068
|
+
onPlanUpdate: async (payload) => {
|
|
2069
|
+
if (payload.phase !== "update") return;
|
|
2070
|
+
await pushPlanProgress(payload.steps, payload.explanation);
|
|
2071
|
+
},
|
|
2072
|
+
onApprovalEvent: async (payload) => {
|
|
2073
|
+
if (payload.phase !== "requested") return;
|
|
2074
|
+
await pushPreviewToolProgress(formatChannelProgressDraftLine({
|
|
2075
|
+
event: "approval",
|
|
2076
|
+
phase: payload.phase,
|
|
2077
|
+
title: payload.title,
|
|
2078
|
+
command: payload.command,
|
|
2079
|
+
reason: payload.reason,
|
|
2080
|
+
message: payload.message
|
|
2081
|
+
}));
|
|
2082
|
+
},
|
|
2083
|
+
onCommandOutput: async (payload) => {
|
|
2084
|
+
if (payload.phase !== "end") return;
|
|
2085
|
+
await pushPreviewToolProgress(buildChannelProgressDraftLineForEntry(progressConfigEntry, {
|
|
2086
|
+
event: "command-output",
|
|
2087
|
+
itemId: payload.itemId,
|
|
2088
|
+
toolCallId: payload.toolCallId,
|
|
2089
|
+
phase: payload.phase,
|
|
2090
|
+
title: payload.title,
|
|
2091
|
+
name: payload.name,
|
|
2092
|
+
status: payload.status,
|
|
2093
|
+
exitCode: payload.exitCode
|
|
2094
|
+
}));
|
|
2095
|
+
},
|
|
2096
|
+
onPatchSummary: async (payload) => {
|
|
2097
|
+
if (payload.phase !== "end") return;
|
|
2098
|
+
await pushPreviewToolProgress(buildChannelProgressDraftLineForEntry(progressConfigEntry, {
|
|
2099
|
+
event: "patch",
|
|
2100
|
+
itemId: payload.itemId,
|
|
2101
|
+
toolCallId: payload.toolCallId,
|
|
2102
|
+
phase: payload.phase,
|
|
2103
|
+
title: payload.title,
|
|
2104
|
+
name: payload.name,
|
|
2105
|
+
added: payload.added,
|
|
2106
|
+
modified: payload.modified,
|
|
2107
|
+
deleted: payload.deleted,
|
|
2108
|
+
summary: payload.summary
|
|
2109
|
+
}));
|
|
2110
|
+
}
|
|
2111
|
+
};
|
|
2112
|
+
};
|
|
2113
|
+
const getDisplayableDraftText = () => {
|
|
2114
|
+
const nextDraftBoundaryOffset = pendingDraftBoundaries.find((boundary) => boundary.messageGeneration === currentDraftMessageGeneration)?.endOffset;
|
|
2115
|
+
if (nextDraftBoundaryOffset === void 0) return latestDraftFullText.slice(currentDraftBlockOffset);
|
|
2116
|
+
return latestDraftFullText.slice(currentDraftBlockOffset, nextDraftBoundaryOffset);
|
|
2117
|
+
};
|
|
2118
|
+
const updateDraftFromLatestFullText = () => {
|
|
2119
|
+
const blockText = getDisplayableDraftText();
|
|
2120
|
+
if (blockText) draftStream?.update(blockText);
|
|
2121
|
+
};
|
|
2122
|
+
const queueDraftBlockBoundary = (payload, context) => {
|
|
2123
|
+
const payloadTextLength = payload.text?.length ?? 0;
|
|
2124
|
+
const messageGeneration = context?.assistantMessageIndex ?? currentDraftMessageGeneration;
|
|
2125
|
+
const nextDraftBoundaryOffset = (latestQueuedDraftBoundaryOffsets.get(messageGeneration) ?? 0) + payloadTextLength;
|
|
2126
|
+
latestQueuedDraftBoundaryOffsets.set(messageGeneration, nextDraftBoundaryOffset);
|
|
2127
|
+
pendingDraftBoundaries.push({
|
|
2128
|
+
messageGeneration,
|
|
2129
|
+
endOffset: nextDraftBoundaryOffset
|
|
2130
|
+
});
|
|
2131
|
+
};
|
|
2132
|
+
const advanceDraftBlockBoundary = (options) => {
|
|
2133
|
+
const completedBoundary = pendingDraftBoundaries.shift();
|
|
2134
|
+
if (completedBoundary) {
|
|
2135
|
+
if (!pendingDraftBoundaries.some((entry) => entry.messageGeneration === completedBoundary.messageGeneration)) latestQueuedDraftBoundaryOffsets.delete(completedBoundary.messageGeneration);
|
|
2136
|
+
if (completedBoundary.messageGeneration === currentDraftMessageGeneration) currentDraftBlockOffset = completedBoundary.endOffset;
|
|
2137
|
+
return;
|
|
2138
|
+
}
|
|
2139
|
+
if (options?.fallbackToLatestEnd) currentDraftBlockOffset = latestDraftFullText.length;
|
|
2140
|
+
};
|
|
2141
|
+
const resetDraftBlockOffsets = () => {
|
|
2142
|
+
currentDraftMessageGeneration += 1;
|
|
2143
|
+
currentDraftBlockOffset = 0;
|
|
2144
|
+
latestDraftFullText = "";
|
|
2145
|
+
};
|
|
2146
|
+
const resetDraftDeliveryState = async () => {
|
|
2147
|
+
await draftStream?.discardPending();
|
|
2148
|
+
draftStream?.reset();
|
|
2149
|
+
draftConsumed = false;
|
|
2150
|
+
currentDraftMessageGeneration = 0;
|
|
2151
|
+
currentDraftBlockOffset = 0;
|
|
2152
|
+
latestDraftFullText = "";
|
|
2153
|
+
pendingDraftBoundaries.length = 0;
|
|
2154
|
+
latestQueuedDraftBoundaryOffsets.clear();
|
|
2155
|
+
currentDraftReplyToId = draftReplyToId;
|
|
2156
|
+
progressDraftGate.reset();
|
|
2157
|
+
resetPreviewToolProgress();
|
|
2158
|
+
};
|
|
2159
|
+
return {
|
|
2160
|
+
draftStream,
|
|
2161
|
+
progressDraftGate,
|
|
2162
|
+
buildPreviewToolProgressReplyOptions,
|
|
2163
|
+
queueDraftBlockBoundary,
|
|
2164
|
+
advanceDraftBlockBoundary,
|
|
2165
|
+
resetDraftBlockOffsets,
|
|
2166
|
+
resetPreviewToolProgress,
|
|
2167
|
+
resetDraftDeliveryState,
|
|
2168
|
+
updateDraftFromLatestFullText,
|
|
2169
|
+
isDraftConsumed: () => draftConsumed,
|
|
2170
|
+
markDraftConsumed: () => {
|
|
2171
|
+
draftConsumed = true;
|
|
2172
|
+
},
|
|
2173
|
+
clearDraftConsumed: () => {
|
|
2174
|
+
draftConsumed = false;
|
|
2175
|
+
},
|
|
2176
|
+
currentReplyToId: () => currentDraftReplyToId,
|
|
2177
|
+
setCurrentReplyToId: (replyToId) => {
|
|
2178
|
+
currentDraftReplyToId = replyToId;
|
|
2179
|
+
},
|
|
2180
|
+
resetReplyToIdForNextBlock: () => {
|
|
2181
|
+
currentDraftReplyToId = replyToMode === "all" ? draftReplyToId : void 0;
|
|
2182
|
+
},
|
|
2183
|
+
onPartialReply: (text) => {
|
|
2184
|
+
if (progressDraftStreaming) return;
|
|
2185
|
+
latestDraftFullText = text;
|
|
2186
|
+
suppressPreviewToolProgressForAnswerText(text);
|
|
2187
|
+
updateDraftFromLatestFullText();
|
|
2188
|
+
}
|
|
2189
|
+
};
|
|
2190
|
+
}
|
|
2191
|
+
//#endregion
|
|
2192
|
+
//#region extensions/matrix/src/matrix/monitor/room-history.ts
|
|
2193
|
+
/** Maximum entries retained per room (hard cap to bound memory). */
|
|
2194
|
+
const DEFAULT_MAX_QUEUE_SIZE = 200;
|
|
2195
|
+
/** Maximum number of rooms to retain queues for (FIFO eviction beyond this). */
|
|
2196
|
+
const DEFAULT_MAX_ROOM_QUEUES = 1e3;
|
|
2197
|
+
/** Maximum number of (agentId, roomId) watermark entries to retain. */
|
|
2198
|
+
const MAX_WATERMARK_ENTRIES = 5e3;
|
|
2199
|
+
/** Maximum prepared trigger snapshots retained per room for retry reuse. */
|
|
2200
|
+
const MAX_PREPARED_TRIGGER_ENTRIES = 500;
|
|
2201
|
+
/** Maximum thread queues retained per room (FIFO eviction beyond this). */
|
|
2202
|
+
const MAX_THREAD_QUEUES_PER_ROOM = 200;
|
|
2203
|
+
function createRoomHistoryTrackerInternal(maxQueueSize = DEFAULT_MAX_QUEUE_SIZE, maxRoomQueues = DEFAULT_MAX_ROOM_QUEUES, maxWatermarkEntries = MAX_WATERMARK_ENTRIES, maxPreparedTriggerEntries = MAX_PREPARED_TRIGGER_ENTRIES) {
|
|
2204
|
+
const roomQueues = /* @__PURE__ */ new Map();
|
|
2205
|
+
/** Maps `{agentId, roomId, scope}` → absolute consumed-up-to index */
|
|
2206
|
+
const agentWatermarks = /* @__PURE__ */ new Map();
|
|
2207
|
+
let nextQueueGeneration = 1;
|
|
2208
|
+
function clearRoomWatermarks(roomId) {
|
|
2209
|
+
for (const key of agentWatermarks.keys()) if (JSON.parse(key)?.roomId === roomId) agentWatermarks.delete(key);
|
|
2210
|
+
}
|
|
2211
|
+
function clearThreadWatermarks(roomId, threadRootId) {
|
|
2212
|
+
for (const key of agentWatermarks.keys()) {
|
|
2213
|
+
const parsed = JSON.parse(key);
|
|
2214
|
+
if (parsed?.roomId === roomId && parsed.scope === threadRootId) agentWatermarks.delete(key);
|
|
2215
|
+
}
|
|
2216
|
+
}
|
|
2217
|
+
function createHistoryQueue() {
|
|
2218
|
+
return {
|
|
2219
|
+
entries: [],
|
|
2220
|
+
baseIndex: 0,
|
|
2221
|
+
generation: nextQueueGeneration++,
|
|
2222
|
+
preparedTriggers: /* @__PURE__ */ new Map()
|
|
2223
|
+
};
|
|
1938
2224
|
}
|
|
1939
2225
|
function getOrCreateQueue(roomId) {
|
|
1940
2226
|
let queue = roomQueues.get(roomId);
|
|
@@ -2143,200 +2429,1248 @@ function createRoomHistoryTracker(maxQueueSize = DEFAULT_MAX_QUEUE_SIZE, maxRoom
|
|
|
2143
2429
|
};
|
|
2144
2430
|
}
|
|
2145
2431
|
//#endregion
|
|
2146
|
-
//#region extensions/matrix/src/matrix/monitor/
|
|
2147
|
-
|
|
2148
|
-
const
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
const
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
const
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
if (cache.size > MAX_TRACKED_THREAD_STARTERS) {
|
|
2173
|
-
const oldest = cache.keys().next().value;
|
|
2174
|
-
if (typeof oldest === "string") cache.delete(oldest);
|
|
2432
|
+
//#region extensions/matrix/src/matrix/monitor/handler-ingress-access.ts
|
|
2433
|
+
async function resolveMatrixIngressAccess(config) {
|
|
2434
|
+
const { handler, params: paramsLocal, roomId, event, eventTs, senderId, isReactionEvent, readStoreAllowFrom, shouldSendPairingReply, resolveLiveAccountAllowlists, roomHistoryTracker, commitInboundEventIfClaimed } = config;
|
|
2435
|
+
const { core, cfg, accountId, accountConfig, client, logVerboseMessage, groupPolicy, dmEnabled, dmPolicy, dmThreadReplies, threadReplies, roomsConfig, accountAllowBots, configuredBotUserIds, needsRoomAliasesForConfig, getRoomInfo, getMemberDisplayName } = handler;
|
|
2436
|
+
const content = paramsLocal.content;
|
|
2437
|
+
const isDirectMessage = paramsLocal.isDirectMessage;
|
|
2438
|
+
const isRoom = !isDirectMessage;
|
|
2439
|
+
const { audioPreflightMode, locationPayload, reservedHistorySlot, selfUserId } = paramsLocal;
|
|
2440
|
+
const messageId = event.event_id ?? "";
|
|
2441
|
+
const threadRootId = resolveMatrixThreadRootId({
|
|
2442
|
+
event,
|
|
2443
|
+
content
|
|
2444
|
+
});
|
|
2445
|
+
const thread = resolveMatrixThreadRouting({
|
|
2446
|
+
isDirectMessage,
|
|
2447
|
+
threadReplies,
|
|
2448
|
+
dmThreadReplies,
|
|
2449
|
+
messageId,
|
|
2450
|
+
threadRootId
|
|
2451
|
+
});
|
|
2452
|
+
const historyThreadId = threadRootId ? thread.threadId : void 0;
|
|
2453
|
+
let reservedHistorySlotConsumed = false;
|
|
2454
|
+
const discardReservedHistorySlot = () => {
|
|
2455
|
+
if (reservedHistorySlot && !reservedHistorySlotConsumed) {
|
|
2456
|
+
roomHistoryTracker.discardPending(roomId, reservedHistorySlot, historyThreadId);
|
|
2457
|
+
reservedHistorySlotConsumed = true;
|
|
2175
2458
|
}
|
|
2176
|
-
return value;
|
|
2177
2459
|
};
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2460
|
+
const markReservedHistorySlotConsumed = () => {
|
|
2461
|
+
reservedHistorySlotConsumed = true;
|
|
2462
|
+
};
|
|
2463
|
+
const commitInboundEventIfClaimedAndDiscardReserved = async () => {
|
|
2464
|
+
discardReservedHistorySlot();
|
|
2465
|
+
await commitInboundEventIfClaimed();
|
|
2466
|
+
};
|
|
2467
|
+
if (isRoom && groupPolicy === "disabled") {
|
|
2468
|
+
await commitInboundEventIfClaimedAndDiscardReserved();
|
|
2469
|
+
return;
|
|
2470
|
+
}
|
|
2471
|
+
const roomInfoForConfig = isRoom && needsRoomAliasesForConfig ? await getRoomInfo(roomId, { includeAliases: true }) : void 0;
|
|
2472
|
+
const roomAliasesForConfig = roomInfoForConfig ? [roomInfoForConfig.canonicalAlias ?? "", ...roomInfoForConfig.altAliases].filter(Boolean) : [];
|
|
2473
|
+
const roomConfigInfo = isRoom ? resolveMatrixRoomConfig({
|
|
2474
|
+
rooms: roomsConfig,
|
|
2475
|
+
roomId,
|
|
2476
|
+
aliases: roomAliasesForConfig
|
|
2477
|
+
}) : void 0;
|
|
2478
|
+
const roomConfig = roomConfigInfo?.config;
|
|
2479
|
+
const allowBotsMode = resolveMatrixAllowBotsMode(roomConfig?.allowBots ?? accountAllowBots);
|
|
2480
|
+
const isConfiguredBotSender = configuredBotUserIds.has(senderId);
|
|
2481
|
+
const roomMatchMeta = roomConfigInfo ? `matchKey=${roomConfigInfo.matchKey ?? "none"} matchSource=${roomConfigInfo.matchSource ?? "none"}` : "matchKey=none matchSource=none";
|
|
2482
|
+
if (isConfiguredBotSender && allowBotsMode === "off") {
|
|
2483
|
+
logVerboseMessage(`matrix: drop configured bot sender=${senderId} (allowBots=false${isDirectMessage ? "" : `, ${roomMatchMeta}`})`);
|
|
2484
|
+
await commitInboundEventIfClaimedAndDiscardReserved();
|
|
2485
|
+
return;
|
|
2486
|
+
}
|
|
2487
|
+
const botLoopProtection = isConfiguredBotSender && senderId !== selfUserId ? {
|
|
2488
|
+
scopeId: accountId,
|
|
2489
|
+
conversationId: roomId,
|
|
2490
|
+
senderId,
|
|
2491
|
+
receiverId: selfUserId,
|
|
2492
|
+
config: mergePairLoopGuardConfig(accountConfig?.botLoopProtection, roomConfig?.botLoopProtection),
|
|
2493
|
+
defaultsConfig: cfg.channels?.defaults?.botLoopProtection,
|
|
2494
|
+
defaultEnabled: true,
|
|
2495
|
+
nowMs: eventTs ?? void 0
|
|
2496
|
+
} : void 0;
|
|
2497
|
+
if (isRoom && roomConfig && !roomConfigInfo?.allowed) {
|
|
2498
|
+
logVerboseMessage(`matrix: room disabled room=${roomId} (${roomMatchMeta})`);
|
|
2499
|
+
await commitInboundEventIfClaimedAndDiscardReserved();
|
|
2500
|
+
return;
|
|
2501
|
+
}
|
|
2502
|
+
if (isRoom && groupPolicy === "allowlist") {
|
|
2503
|
+
if (!roomConfigInfo?.allowlistConfigured) {
|
|
2504
|
+
logVerboseMessage(`matrix: drop room message (no allowlist, ${roomMatchMeta})`);
|
|
2505
|
+
await commitInboundEventIfClaimedAndDiscardReserved();
|
|
2506
|
+
return;
|
|
2507
|
+
}
|
|
2508
|
+
if (!roomConfig) {
|
|
2509
|
+
logVerboseMessage(`matrix: drop room message (not in allowlist, ${roomMatchMeta})`);
|
|
2510
|
+
await commitInboundEventIfClaimedAndDiscardReserved();
|
|
2511
|
+
return;
|
|
2512
|
+
}
|
|
2513
|
+
}
|
|
2514
|
+
let senderNamePromise = null;
|
|
2515
|
+
const getSenderName = async () => {
|
|
2516
|
+
senderNamePromise ??= getMemberDisplayName(roomId, senderId).catch(() => senderId);
|
|
2517
|
+
return await senderNamePromise;
|
|
2518
|
+
};
|
|
2519
|
+
const storeAllowFrom = isDirectMessage && dmPolicy !== "allowlist" && dmPolicy !== "open" ? await readStoreAllowFrom() : [];
|
|
2520
|
+
const roomUsers = roomConfig?.users ?? [];
|
|
2521
|
+
const { liveDmAllowFrom, liveGroupAllowFrom } = await resolveLiveAccountAllowlists();
|
|
2522
|
+
const accessState = await resolveMatrixMonitorAccessState({
|
|
2523
|
+
allowFrom: liveDmAllowFrom,
|
|
2524
|
+
storeAllowFrom,
|
|
2525
|
+
dmPolicy,
|
|
2526
|
+
groupPolicy,
|
|
2527
|
+
groupAllowFrom: liveGroupAllowFrom,
|
|
2528
|
+
roomUsers,
|
|
2529
|
+
senderId,
|
|
2530
|
+
isRoom,
|
|
2531
|
+
accountId,
|
|
2532
|
+
eventKind: isReactionEvent ? "reaction" : "message"
|
|
2533
|
+
});
|
|
2534
|
+
const { effectiveGroupAllowFrom, effectiveRoomUsers, messageIngress } = accessState;
|
|
2535
|
+
const ingressDecision = messageIngress.ingress;
|
|
2536
|
+
if (isDirectMessage) {
|
|
2537
|
+
if (!dmEnabled || dmPolicy === "disabled") {
|
|
2538
|
+
await commitInboundEventIfClaimedAndDiscardReserved();
|
|
2539
|
+
return;
|
|
2540
|
+
}
|
|
2541
|
+
const senderReason = messageIngress.senderAccess.reasonCode;
|
|
2542
|
+
if (ingressDecision.decision !== "allow") {
|
|
2543
|
+
if (ingressDecision.admission === "pairing-required") {
|
|
2544
|
+
const senderName = await getSenderName();
|
|
2545
|
+
const { code, created } = await core.channel.pairing.upsertPairingRequest({
|
|
2546
|
+
channel: "matrix",
|
|
2547
|
+
id: senderId,
|
|
2548
|
+
accountId,
|
|
2549
|
+
meta: { name: senderName }
|
|
2550
|
+
});
|
|
2551
|
+
if (shouldSendPairingReply(senderId, created)) {
|
|
2552
|
+
const pairingReply = core.channel.pairing.buildPairingReply({
|
|
2553
|
+
channel: "matrix",
|
|
2554
|
+
idLine: `Your Matrix user id: ${senderId}`,
|
|
2555
|
+
code
|
|
2556
|
+
});
|
|
2557
|
+
logVerboseMessage(created ? `matrix pairing request sender=${senderId} name=${senderName ?? "unknown"} (reason=${senderReason})` : `matrix pairing reminder sender=${senderId} name=${senderName ?? "unknown"} (reason=${senderReason})`);
|
|
2558
|
+
try {
|
|
2559
|
+
const { sendMessageMatrix } = await loadMatrixSendModule();
|
|
2560
|
+
await sendMessageMatrix(`room:${roomId}`, created ? pairingReply : `${pairingReply}\n\nPairing request is still pending approval. Reusing existing code.`, {
|
|
2561
|
+
client,
|
|
2562
|
+
cfg,
|
|
2563
|
+
accountId
|
|
2564
|
+
});
|
|
2565
|
+
await commitInboundEventIfClaimed();
|
|
2566
|
+
} catch (err) {
|
|
2567
|
+
logVerboseMessage(`matrix pairing reply failed for ${senderId}: ${String(err)}`);
|
|
2568
|
+
discardReservedHistorySlot();
|
|
2569
|
+
return;
|
|
2570
|
+
}
|
|
2571
|
+
} else {
|
|
2572
|
+
logVerboseMessage(`matrix pairing reminder suppressed sender=${senderId} (cooldown)`);
|
|
2573
|
+
await commitInboundEventIfClaimedAndDiscardReserved();
|
|
2574
|
+
}
|
|
2575
|
+
}
|
|
2576
|
+
if (isReactionEvent || dmPolicy !== "pairing") {
|
|
2577
|
+
logVerboseMessage(`matrix: blocked ${isReactionEvent ? "reaction" : "dm"} sender ${senderId} (dmPolicy=${dmPolicy}, reason=${senderReason})`);
|
|
2578
|
+
await commitInboundEventIfClaimedAndDiscardReserved();
|
|
2579
|
+
}
|
|
2580
|
+
return;
|
|
2581
|
+
}
|
|
2582
|
+
}
|
|
2583
|
+
if (isRoom && ingressDecision.decision !== "allow") {
|
|
2584
|
+
logVerboseMessage(`matrix: blocked sender ${senderId} (ingress=${ingressDecision.reasonCode}, ${roomMatchMeta})`);
|
|
2585
|
+
await commitInboundEventIfClaimedAndDiscardReserved();
|
|
2586
|
+
return;
|
|
2587
|
+
}
|
|
2588
|
+
if (isRoom) logVerboseMessage(`matrix: allow room ${roomId} (${roomMatchMeta})`);
|
|
2589
|
+
if (isReactionEvent) {
|
|
2590
|
+
const senderName = await getSenderName();
|
|
2591
|
+
const { handleInboundMatrixReaction } = await loadMatrixReactionEvents();
|
|
2592
|
+
await handleInboundMatrixReaction({
|
|
2593
|
+
client,
|
|
2594
|
+
core,
|
|
2595
|
+
cfg,
|
|
2596
|
+
accountId,
|
|
2597
|
+
roomId,
|
|
2598
|
+
event,
|
|
2199
2599
|
senderId,
|
|
2200
|
-
senderLabel,
|
|
2201
|
-
|
|
2600
|
+
senderLabel: senderName,
|
|
2601
|
+
selfUserId,
|
|
2602
|
+
isDirectMessage,
|
|
2603
|
+
logVerboseMessage
|
|
2202
2604
|
});
|
|
2605
|
+
await commitInboundEventIfClaimedAndDiscardReserved();
|
|
2606
|
+
return;
|
|
2607
|
+
}
|
|
2608
|
+
return {
|
|
2609
|
+
content,
|
|
2610
|
+
messageId,
|
|
2611
|
+
audioPreflightMode,
|
|
2612
|
+
isDirectMessage,
|
|
2613
|
+
isRoom,
|
|
2614
|
+
locationPayload,
|
|
2615
|
+
reservedHistorySlot,
|
|
2616
|
+
threadRootId,
|
|
2617
|
+
thread,
|
|
2618
|
+
historyThreadId,
|
|
2619
|
+
discardReservedHistorySlot,
|
|
2620
|
+
markReservedHistorySlotConsumed,
|
|
2621
|
+
commitInboundEventIfClaimedAndDiscardReserved,
|
|
2622
|
+
roomConfig,
|
|
2623
|
+
allowBotsMode,
|
|
2624
|
+
isConfiguredBotSender,
|
|
2625
|
+
selfUserId,
|
|
2626
|
+
botLoopProtection,
|
|
2627
|
+
roomMatchMeta,
|
|
2628
|
+
getSenderName,
|
|
2629
|
+
accessState,
|
|
2630
|
+
effectiveGroupAllowFrom,
|
|
2631
|
+
effectiveRoomUsers
|
|
2203
2632
|
};
|
|
2204
2633
|
}
|
|
2205
2634
|
//#endregion
|
|
2206
|
-
//#region extensions/matrix/src/matrix/monitor/
|
|
2207
|
-
const
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
const mentions = await resolveMatrixMentionsForBody({
|
|
2218
|
-
client,
|
|
2219
|
-
body: text
|
|
2220
|
-
});
|
|
2221
|
-
return mentions.room === true || (mentions.user_ids?.length ?? 0) > 0;
|
|
2222
|
-
}
|
|
2223
|
-
const MAX_TRACKED_PAIRING_REPLY_SENDERS = 512;
|
|
2224
|
-
const MAX_TRACKED_SHARED_DM_CONTEXT_NOTICES = 512;
|
|
2225
|
-
async function redactMatrixDraftEvent(client, roomId, draftEventId) {
|
|
2226
|
-
await client.redactEvent(roomId, draftEventId).catch(() => {});
|
|
2227
|
-
}
|
|
2228
|
-
function buildMatrixFinalizedPreviewContent() {
|
|
2229
|
-
return { [MATRIX_OPENCLAW_FINALIZED_PREVIEW_KEY]: true };
|
|
2230
|
-
}
|
|
2231
|
-
function resolveMatrixMentionPrecheckText(params) {
|
|
2232
|
-
if (params.locationText?.trim()) return params.locationText.trim();
|
|
2233
|
-
if (typeof params.content.body === "string" && params.content.body.trim()) return params.content.body.trim();
|
|
2234
|
-
if (isPollStartType(params.eventType)) {
|
|
2235
|
-
const parsed = parsePollStartContent(params.content);
|
|
2236
|
-
if (parsed) return formatPollAsText(parsed);
|
|
2635
|
+
//#region extensions/matrix/src/matrix/monitor/media.ts
|
|
2636
|
+
const MATRIX_MEDIA_DOWNLOAD_IDLE_TIMEOUT_MS = 3e4;
|
|
2637
|
+
async function fetchMatrixMediaBuffer(params) {
|
|
2638
|
+
try {
|
|
2639
|
+
return { buffer: await params.client.downloadContent(params.mxcUrl, {
|
|
2640
|
+
maxBytes: params.maxBytes,
|
|
2641
|
+
readIdleTimeoutMs: MATRIX_MEDIA_DOWNLOAD_IDLE_TIMEOUT_MS
|
|
2642
|
+
}) };
|
|
2643
|
+
} catch (err) {
|
|
2644
|
+
if (isMatrixMediaSizeLimitError(err)) throw err;
|
|
2645
|
+
throw new Error(`Matrix media download failed: ${String(err)}`, { cause: err });
|
|
2237
2646
|
}
|
|
2238
|
-
return "";
|
|
2239
|
-
}
|
|
2240
|
-
function hasBundledMatrixReplacementRelation(event) {
|
|
2241
|
-
const relations = event.unsigned?.["m.relations"];
|
|
2242
|
-
if (!relations || typeof relations !== "object") return false;
|
|
2243
|
-
return relations[RelationType.Replace] !== void 0;
|
|
2244
2647
|
}
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
body: params.rawBody,
|
|
2255
|
-
filename: params.filename,
|
|
2256
|
-
msgtype: params.msgtype
|
|
2648
|
+
/**
|
|
2649
|
+
* Download and decrypt encrypted media from a Matrix room.
|
|
2650
|
+
* Uses the Matrix crypto adapter's decryptMedia helper.
|
|
2651
|
+
*/
|
|
2652
|
+
async function fetchEncryptedMediaBuffer(params) {
|
|
2653
|
+
if (!params.client.crypto) throw new Error("Cannot decrypt media: crypto not enabled");
|
|
2654
|
+
const decrypted = await params.client.crypto.decryptMedia(params.file, {
|
|
2655
|
+
maxBytes: params.maxBytes,
|
|
2656
|
+
readIdleTimeoutMs: MATRIX_MEDIA_DOWNLOAD_IDLE_TIMEOUT_MS
|
|
2257
2657
|
});
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2658
|
+
if (decrypted.byteLength > params.maxBytes) throw new MatrixMediaSizeLimitError();
|
|
2659
|
+
return { buffer: decrypted };
|
|
2660
|
+
}
|
|
2661
|
+
async function downloadMatrixMedia(params) {
|
|
2662
|
+
let fetched;
|
|
2663
|
+
if (typeof params.sizeBytes === "number" && params.sizeBytes > params.maxBytes) throw new MatrixMediaSizeLimitError();
|
|
2664
|
+
if (params.file) fetched = await fetchEncryptedMediaBuffer({
|
|
2665
|
+
client: params.client,
|
|
2666
|
+
file: params.file,
|
|
2667
|
+
maxBytes: params.maxBytes
|
|
2668
|
+
});
|
|
2669
|
+
else fetched = await fetchMatrixMediaBuffer({
|
|
2670
|
+
client: params.client,
|
|
2671
|
+
mxcUrl: params.mxcUrl,
|
|
2672
|
+
maxBytes: params.maxBytes
|
|
2673
|
+
});
|
|
2674
|
+
if (!fetched) return null;
|
|
2675
|
+
const headerType = params.contentType ?? void 0;
|
|
2676
|
+
const saved = await getMatrixRuntime().channel.media.saveMediaBuffer(fetched.buffer, headerType, "inbound", params.maxBytes, params.originalFilename);
|
|
2677
|
+
return {
|
|
2678
|
+
path: saved.path,
|
|
2679
|
+
contentType: saved.contentType,
|
|
2680
|
+
placeholder: "[matrix media]"
|
|
2681
|
+
};
|
|
2682
|
+
}
|
|
2683
|
+
//#endregion
|
|
2684
|
+
//#region extensions/matrix/src/matrix/monitor/mentions.ts
|
|
2685
|
+
const MATRIX_HTML_ENTITY_RE = /&(?:#x?[0-9a-f]+|amp|apos|gt|lt|nbsp|quot);/gi;
|
|
2686
|
+
function decodeVisibleHtmlEntities(value) {
|
|
2687
|
+
return value.replace(MATRIX_HTML_ENTITY_RE, (entity) => {
|
|
2688
|
+
const decoded = decodeHtmlEntities(entity.startsWith("&#") ? entity : entity.toLowerCase());
|
|
2689
|
+
return decoded === "\xA0" ? " " : decoded;
|
|
2690
|
+
});
|
|
2691
|
+
}
|
|
2692
|
+
function normalizeVisibleMentionText(value) {
|
|
2693
|
+
return normalizeLowercaseStringOrEmpty(decodeVisibleHtmlEntities(value.replace(/<[^>]+>/g, " ").replace(/[\u200b-\u200f\u202a-\u202e\u2060-\u206f]/g, "")).replace(/\s+/g, " "));
|
|
2694
|
+
}
|
|
2695
|
+
function extractVisibleMentionText(value) {
|
|
2696
|
+
return normalizeVisibleMentionText(value ?? "");
|
|
2697
|
+
}
|
|
2698
|
+
function resolveMatrixUserLocalpart(userId) {
|
|
2699
|
+
const trimmed = userId.trim();
|
|
2700
|
+
if (!trimmed.startsWith("@")) return null;
|
|
2701
|
+
const colonIndex = trimmed.indexOf(":");
|
|
2702
|
+
if (colonIndex <= 1) return null;
|
|
2703
|
+
return trimmed.slice(1, colonIndex).trim() || null;
|
|
2704
|
+
}
|
|
2705
|
+
function resolveMatrixMentionPrefixCandidates(params) {
|
|
2706
|
+
const candidates = [];
|
|
2707
|
+
const seen = /* @__PURE__ */ new Set();
|
|
2708
|
+
const append = (candidate) => {
|
|
2709
|
+
const trimmed = candidate?.trim();
|
|
2710
|
+
if (!trimmed) return;
|
|
2711
|
+
const normalized = normalizeLowercaseStringOrEmpty(trimmed);
|
|
2712
|
+
if (seen.has(normalized)) return;
|
|
2713
|
+
seen.add(normalized);
|
|
2714
|
+
candidates.push(trimmed);
|
|
2715
|
+
};
|
|
2716
|
+
append(params.userId);
|
|
2717
|
+
const localpart = params.userId ? resolveMatrixUserLocalpart(params.userId) : null;
|
|
2718
|
+
append(localpart ? `@${localpart}` : null);
|
|
2719
|
+
append(params.displayName);
|
|
2720
|
+
append(params.displayName ? `@${params.displayName}` : null);
|
|
2721
|
+
append(params.displayName ? `@[${params.displayName}]` : null);
|
|
2722
|
+
return candidates;
|
|
2723
|
+
}
|
|
2724
|
+
function stripMatchedMatrixMentionPrefix(text, pattern) {
|
|
2725
|
+
const match = text.match(pattern);
|
|
2726
|
+
if (!match) return null;
|
|
2727
|
+
return text.slice(match[0].length).trimStart();
|
|
2728
|
+
}
|
|
2729
|
+
function stripNativeMatrixMentionPrefix(text, candidate) {
|
|
2730
|
+
return stripMatchedMatrixMentionPrefix(text, new RegExp(`^\\s*${escapeRegExp(candidate)}(?:\\s*[:,])?(?:\\s+|$)`, "i"));
|
|
2731
|
+
}
|
|
2732
|
+
function stripRegexMatrixMentionPrefix(text, pattern) {
|
|
2733
|
+
const flags = pattern.flags.replace(/[gy]/g, "");
|
|
2734
|
+
return stripMatchedMatrixMentionPrefix(text, new RegExp(`^\\s*(?:${pattern.source})(?:\\s*[:,])?(?:\\s+|$)`, flags));
|
|
2735
|
+
}
|
|
2736
|
+
function stripMatrixMentionPrefix(params) {
|
|
2737
|
+
const text = params.text;
|
|
2738
|
+
if (!text) return text;
|
|
2739
|
+
for (const candidate of resolveMatrixMentionPrefixCandidates(params)) {
|
|
2740
|
+
const stripped = stripNativeMatrixMentionPrefix(text, candidate);
|
|
2741
|
+
if (stripped !== null) return stripped;
|
|
2265
2742
|
}
|
|
2266
|
-
|
|
2743
|
+
for (const pattern of params.mentionRegexes ?? []) {
|
|
2744
|
+
const stripped = stripRegexMatrixMentionPrefix(text, pattern);
|
|
2745
|
+
if (stripped !== null) return stripped;
|
|
2746
|
+
}
|
|
2747
|
+
return text;
|
|
2267
2748
|
}
|
|
2268
|
-
function
|
|
2269
|
-
|
|
2270
|
-
if (
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2749
|
+
function isVisibleMentionLabel(params) {
|
|
2750
|
+
const cleaned = extractVisibleMentionText(params.text);
|
|
2751
|
+
if (!cleaned) return false;
|
|
2752
|
+
if (params.mentionRegexes.some((pattern) => pattern.test(cleaned))) return true;
|
|
2753
|
+
const localpart = resolveMatrixUserLocalpart(params.userId);
|
|
2754
|
+
return [
|
|
2755
|
+
extractVisibleMentionText(params.userId),
|
|
2756
|
+
localpart ? extractVisibleMentionText(localpart) : null,
|
|
2757
|
+
localpart ? extractVisibleMentionText(`@${localpart}`) : null,
|
|
2758
|
+
params.displayName ? extractVisibleMentionText(params.displayName) : null,
|
|
2759
|
+
params.displayName ? extractVisibleMentionText(`@${params.displayName}`) : null,
|
|
2760
|
+
params.displayName ? extractVisibleMentionText(`@[${params.displayName}]`) : null
|
|
2761
|
+
].filter((value) => Boolean(value)).includes(cleaned);
|
|
2762
|
+
}
|
|
2763
|
+
function hasVisibleRoomMention(value) {
|
|
2764
|
+
const cleaned = extractVisibleMentionText(value);
|
|
2765
|
+
return /(^|[^a-z0-9_])@room\b/i.test(cleaned);
|
|
2766
|
+
}
|
|
2767
|
+
/**
|
|
2768
|
+
* Check if formatted_body contains a matrix.to link whose visible label still
|
|
2769
|
+
* looks like a real mention for the given user. Do not trust href alone, since
|
|
2770
|
+
* senders can hide arbitrary matrix.to links behind unrelated link text.
|
|
2771
|
+
* Many Matrix clients (including Element) use HTML links in formatted_body instead of
|
|
2772
|
+
* or in addition to the m.mentions field.
|
|
2773
|
+
*/
|
|
2774
|
+
function checkFormattedBodyMention(params) {
|
|
2775
|
+
if (!params.formattedBody || !params.userId) return false;
|
|
2776
|
+
for (const match of params.formattedBody.matchAll(/<a\b[^>]*href=(["'])(https:\/\/matrix\.to\/#[^"']+)\1[^>]*>(.*?)<\/a>/gis)) {
|
|
2777
|
+
const href = match[2];
|
|
2778
|
+
const visibleLabel = match[3] ?? "";
|
|
2779
|
+
if (!href) continue;
|
|
2780
|
+
try {
|
|
2781
|
+
const parsed = new URL(href);
|
|
2782
|
+
if (decodeURIComponent(parsed.hash.replace(/^#\/?/, "").trim()) !== params.userId.trim()) continue;
|
|
2783
|
+
if (isVisibleMentionLabel({
|
|
2784
|
+
text: visibleLabel,
|
|
2785
|
+
userId: params.userId,
|
|
2786
|
+
mentionRegexes: params.mentionRegexes,
|
|
2787
|
+
displayName: params.displayName
|
|
2788
|
+
})) return true;
|
|
2789
|
+
} catch {
|
|
2790
|
+
continue;
|
|
2791
|
+
}
|
|
2792
|
+
}
|
|
2793
|
+
return false;
|
|
2794
|
+
}
|
|
2795
|
+
function resolveMentions(params) {
|
|
2796
|
+
const mentions = params.content["m.mentions"];
|
|
2797
|
+
const mentionedUsers = Array.isArray(mentions?.user_ids) ? new Set(mentions.user_ids) : /* @__PURE__ */ new Set();
|
|
2798
|
+
const textMentioned = getMatrixRuntime().channel.mentions.matchesMentionPatterns(params.text ?? "", params.mentionRegexes);
|
|
2799
|
+
const visibleRoomMention = hasVisibleRoomMention(params.text) || hasVisibleRoomMention(params.content.formatted_body);
|
|
2800
|
+
const mentionedInFormattedBody = params.userId ? checkFormattedBodyMention({
|
|
2801
|
+
formattedBody: params.content.formatted_body,
|
|
2802
|
+
userId: params.userId,
|
|
2803
|
+
displayName: params.displayName,
|
|
2804
|
+
mentionRegexes: params.mentionRegexes
|
|
2805
|
+
}) : false;
|
|
2806
|
+
const metadataBackedUserMention = Boolean(params.userId && mentionedUsers.has(params.userId) && (mentionedInFormattedBody || textMentioned));
|
|
2807
|
+
const metadataBackedRoomMention = Boolean(mentions?.room) && visibleRoomMention;
|
|
2808
|
+
const explicitMention = mentionedInFormattedBody || metadataBackedUserMention || metadataBackedRoomMention;
|
|
2809
|
+
return {
|
|
2810
|
+
wasMentioned: explicitMention || textMentioned || visibleRoomMention,
|
|
2811
|
+
hasExplicitMention: explicitMention
|
|
2812
|
+
};
|
|
2813
|
+
}
|
|
2814
|
+
//#endregion
|
|
2815
|
+
//#region extensions/matrix/src/matrix/monitor/handler-ingress-content.ts
|
|
2816
|
+
async function resolveMatrixIngressContent(config) {
|
|
2817
|
+
const { handler, params: paramsLocal, access, roomId, event, eventType, isPollEvent, eventTs, senderId, roomHistoryTracker, commitInboundEventIfClaimed } = config;
|
|
2818
|
+
const { client, core, cfg, accountId, accountConfig, logger, logVerboseMessage, historyLimit, mediaMaxBytes, dmSessionScope, getMemberDisplayName } = handler;
|
|
2819
|
+
const { content: accessContent, messageId, audioPreflightMode, isDirectMessage, isRoom, locationPayload, reservedHistorySlot, threadRootId, thread, historyThreadId, discardReservedHistorySlot, markReservedHistorySlotConsumed, commitInboundEventIfClaimedAndDiscardReserved, roomConfig, allowBotsMode, isConfiguredBotSender, selfUserId, botLoopProtection, roomMatchMeta, getSenderName, accessState, effectiveGroupAllowFrom, effectiveRoomUsers } = access;
|
|
2820
|
+
let content = accessContent;
|
|
2821
|
+
let pollSnapshotPromise = null;
|
|
2822
|
+
const getPollSnapshot = async () => {
|
|
2823
|
+
if (!isPollEvent) return null;
|
|
2824
|
+
pollSnapshotPromise ??= fetchMatrixPollSnapshot(client, roomId, event).catch((err) => {
|
|
2825
|
+
logVerboseMessage(`matrix: failed resolving poll snapshot room=${roomId} id=${event.event_id ?? "unknown"}: ${String(err)}`);
|
|
2826
|
+
return null;
|
|
2827
|
+
});
|
|
2828
|
+
return await pollSnapshotPromise;
|
|
2829
|
+
};
|
|
2830
|
+
const mentionPrecheckText = resolveMatrixMentionPrecheckText({
|
|
2831
|
+
eventType,
|
|
2832
|
+
content,
|
|
2833
|
+
locationText: locationPayload?.text
|
|
2834
|
+
});
|
|
2835
|
+
const contentUrl = "url" in content && typeof content.url === "string" ? content.url : void 0;
|
|
2836
|
+
const contentFile = "file" in content && content.file && typeof content.file === "object" ? content.file : void 0;
|
|
2837
|
+
const mediaUrl = contentUrl ?? contentFile?.url;
|
|
2838
|
+
const earlyContentInfo = "info" in content && content.info && typeof content.info === "object" ? content.info : void 0;
|
|
2839
|
+
const earlyContentType = earlyContentInfo?.mimetype;
|
|
2840
|
+
const earlyContentSize = typeof earlyContentInfo?.size === "number" ? earlyContentInfo.size : void 0;
|
|
2841
|
+
const earlyContentBody = typeof content.body === "string" ? content.body.trim() : "";
|
|
2842
|
+
const earlyOriginalFilename = (typeof content.filename === "string" ? content.filename.trim() : "") || earlyContentBody || void 0;
|
|
2843
|
+
const pendingHistoryText = resolveMatrixPendingHistoryText({
|
|
2844
|
+
mentionPrecheckText,
|
|
2845
|
+
content,
|
|
2846
|
+
mediaUrl
|
|
2847
|
+
});
|
|
2848
|
+
const pendingHistoryPollText = !pendingHistoryText && isPollEvent && historyLimit > 0 ? (await getPollSnapshot())?.text : "";
|
|
2849
|
+
if (!mentionPrecheckText && !mediaUrl && !isPollEvent) {
|
|
2850
|
+
await commitInboundEventIfClaimedAndDiscardReserved();
|
|
2851
|
+
return;
|
|
2852
|
+
}
|
|
2853
|
+
let preflightMedia = null;
|
|
2854
|
+
let preflightMediaDownloadFailed = false;
|
|
2855
|
+
let preflightMediaSizeLimitExceeded = false;
|
|
2856
|
+
let preflightAudioTranscript;
|
|
2857
|
+
const { route: _route, configuredBinding: _configuredBinding, runtimeBindingId: _runtimeBindingId } = resolveMatrixInboundRoute({
|
|
2858
|
+
cfg,
|
|
2859
|
+
accountId,
|
|
2860
|
+
roomId,
|
|
2861
|
+
senderId,
|
|
2862
|
+
isDirectMessage,
|
|
2863
|
+
dmSessionScope,
|
|
2864
|
+
threadId: thread.threadId,
|
|
2865
|
+
eventTs: eventTs ?? void 0,
|
|
2866
|
+
resolveAgentRoute: core.channel.routing.resolveAgentRoute
|
|
2867
|
+
});
|
|
2868
|
+
const hasExplicitSessionBinding = _configuredBinding !== null || _runtimeBindingId !== null;
|
|
2869
|
+
const preflightAudioMediaUrl = mediaUrl?.startsWith("mxc://") ? mediaUrl : void 0;
|
|
2870
|
+
const shouldRunMatrixAudioPreflight = isMatrixAudioContent({
|
|
2871
|
+
msgtype: typeof content.msgtype === "string" ? content.msgtype : void 0,
|
|
2872
|
+
mimetype: earlyContentType
|
|
2873
|
+
}) && isMatrixAudioMediaEnabled(cfg) && preflightAudioMediaUrl !== void 0;
|
|
2874
|
+
if (shouldRunMatrixAudioPreflight && audioPreflightMode === "defer" && isRoom && historyLimit > 0 && !reservedHistorySlot) {
|
|
2875
|
+
const reserved = roomHistoryTracker.reservePending(_route.agentId, roomId, {
|
|
2876
|
+
sender: senderId,
|
|
2877
|
+
body: pendingHistoryText,
|
|
2878
|
+
timestamp: eventTs ?? void 0,
|
|
2879
|
+
messageId
|
|
2880
|
+
}, historyThreadId);
|
|
2881
|
+
return { deferredPrefix: {
|
|
2882
|
+
...paramsLocal,
|
|
2883
|
+
audioPreflightMode: "run",
|
|
2884
|
+
reservedHistorySlot: reserved
|
|
2885
|
+
} };
|
|
2886
|
+
}
|
|
2887
|
+
if (shouldRunMatrixAudioPreflight) {
|
|
2888
|
+
try {
|
|
2889
|
+
preflightMedia = await downloadMatrixMedia({
|
|
2890
|
+
client,
|
|
2891
|
+
mxcUrl: preflightAudioMediaUrl,
|
|
2892
|
+
contentType: earlyContentType,
|
|
2893
|
+
sizeBytes: earlyContentSize,
|
|
2894
|
+
maxBytes: mediaMaxBytes,
|
|
2895
|
+
file: contentFile,
|
|
2896
|
+
originalFilename: earlyOriginalFilename
|
|
2897
|
+
});
|
|
2898
|
+
} catch (err) {
|
|
2899
|
+
preflightMediaDownloadFailed = true;
|
|
2900
|
+
if (isMatrixMediaSizeLimitError(err)) preflightMediaSizeLimitExceeded = true;
|
|
2901
|
+
const errorText = formatMatrixErrorMessage(err);
|
|
2902
|
+
logVerboseMessage(`matrix: media download failed room=${roomId} id=${event.event_id ?? "unknown"} type=${content.msgtype} error=${errorText}`);
|
|
2903
|
+
logger.warn("matrix media download failed", {
|
|
2904
|
+
roomId,
|
|
2905
|
+
eventId: event.event_id,
|
|
2906
|
+
msgtype: content.msgtype,
|
|
2907
|
+
encrypted: Boolean(contentFile),
|
|
2908
|
+
error: errorText
|
|
2909
|
+
});
|
|
2910
|
+
}
|
|
2911
|
+
if (preflightMedia) preflightAudioTranscript = await resolveMatrixPreflightAudioTranscript({
|
|
2912
|
+
mediaPath: preflightMedia.path,
|
|
2913
|
+
mediaContentType: preflightMedia.contentType,
|
|
2914
|
+
cfg,
|
|
2915
|
+
accountId,
|
|
2916
|
+
chatType: isDirectMessage ? "direct" : "channel",
|
|
2917
|
+
originatingTo: `room:${roomId}`,
|
|
2918
|
+
messageThreadId: thread.threadId,
|
|
2919
|
+
sessionKey: _route.sessionKey
|
|
2920
|
+
});
|
|
2921
|
+
}
|
|
2922
|
+
const agentMentionRegexes = core.channel.mentions.buildMentionRegexes(cfg, _route.agentId, {
|
|
2923
|
+
provider: "matrix",
|
|
2924
|
+
conversationId: roomId,
|
|
2925
|
+
providerPolicy: accountConfig?.mentionPatterns
|
|
2926
|
+
});
|
|
2927
|
+
const selfDisplayName = content.formatted_body ? await getMemberDisplayName(roomId, selfUserId).catch(() => void 0) : void 0;
|
|
2928
|
+
const mentionPrecheckTextWithTranscript = preflightAudioTranscript ? [mentionPrecheckText, preflightAudioTranscript].filter(Boolean).join("\n").trim() : mentionPrecheckText;
|
|
2929
|
+
const { wasMentioned, hasExplicitMention } = resolveMentions({
|
|
2930
|
+
content,
|
|
2931
|
+
userId: selfUserId,
|
|
2932
|
+
displayName: selfDisplayName,
|
|
2933
|
+
text: mentionPrecheckTextWithTranscript,
|
|
2934
|
+
mentionRegexes: agentMentionRegexes
|
|
2935
|
+
});
|
|
2936
|
+
if (isConfiguredBotSender && allowBotsMode === "mentions" && !isDirectMessage && !wasMentioned) {
|
|
2937
|
+
logVerboseMessage(`matrix: drop configured bot sender=${senderId} (allowBots=mentions, missing mention, ${roomMatchMeta})`);
|
|
2938
|
+
await commitInboundEventIfClaimedAndDiscardReserved();
|
|
2939
|
+
return;
|
|
2940
|
+
}
|
|
2941
|
+
const allowTextCommands = core.channel.commands.shouldHandleTextCommands({
|
|
2942
|
+
cfg,
|
|
2943
|
+
surface: "matrix"
|
|
2944
|
+
});
|
|
2945
|
+
const useAccessGroups = true;
|
|
2946
|
+
const commandCheckText = stripMatrixMentionPrefix({
|
|
2947
|
+
text: mentionPrecheckText,
|
|
2948
|
+
userId: selfUserId,
|
|
2949
|
+
displayName: selfDisplayName,
|
|
2950
|
+
mentionRegexes: agentMentionRegexes
|
|
2951
|
+
});
|
|
2952
|
+
const hasControlCommandInMessage = core.channel.text.hasControlCommand(commandCheckText, cfg);
|
|
2953
|
+
const commandAccess = await resolveMatrixMonitorCommandAccess(accessState, {
|
|
2954
|
+
useAccessGroups,
|
|
2955
|
+
allowTextCommands,
|
|
2956
|
+
hasControlCommand: hasControlCommandInMessage
|
|
2957
|
+
});
|
|
2958
|
+
const commandAuthorized = commandAccess.authorized;
|
|
2959
|
+
if (isRoom && commandAccess.shouldBlockControlCommand) {
|
|
2960
|
+
logInboundDrop({
|
|
2961
|
+
log: logVerboseMessage,
|
|
2962
|
+
channel: "matrix",
|
|
2963
|
+
reason: "control command (unauthorized)",
|
|
2964
|
+
target: senderId
|
|
2965
|
+
});
|
|
2966
|
+
await commitInboundEventIfClaimedAndDiscardReserved();
|
|
2967
|
+
return;
|
|
2968
|
+
}
|
|
2969
|
+
const shouldRequireMention = isRoom ? roomConfig?.autoReply === true ? false : roomConfig?.autoReply === false ? true : typeof roomConfig?.requireMention === "boolean" ? roomConfig?.requireMention : true : false;
|
|
2970
|
+
const mentionDecision = resolveInboundMentionDecision({
|
|
2971
|
+
facts: {
|
|
2972
|
+
canDetectMention: true,
|
|
2973
|
+
wasMentioned,
|
|
2974
|
+
hasAnyMention: hasExplicitMention
|
|
2975
|
+
},
|
|
2976
|
+
policy: {
|
|
2977
|
+
isGroup: isRoom,
|
|
2978
|
+
requireMention: shouldRequireMention,
|
|
2979
|
+
allowTextCommands,
|
|
2980
|
+
hasControlCommand: hasControlCommandInMessage,
|
|
2981
|
+
commandAuthorized
|
|
2982
|
+
}
|
|
2983
|
+
});
|
|
2984
|
+
const { effectiveWasMentioned, shouldBypassMention } = mentionDecision;
|
|
2985
|
+
const canDetectMention = agentMentionRegexes.length > 0 || hasExplicitMention;
|
|
2986
|
+
if (mentionDecision.shouldSkip) {
|
|
2987
|
+
const pendingHistoryBody = preflightAudioTranscript ? formatMatrixAudioTranscript(preflightAudioTranscript) : pendingHistoryText || pendingHistoryPollText;
|
|
2988
|
+
if (historyLimit > 0 && pendingHistoryBody) {
|
|
2989
|
+
const pendingEntry = {
|
|
2990
|
+
sender: senderId,
|
|
2991
|
+
body: pendingHistoryBody,
|
|
2992
|
+
timestamp: eventTs ?? void 0,
|
|
2993
|
+
messageId
|
|
2994
|
+
};
|
|
2995
|
+
if (reservedHistorySlot) {
|
|
2996
|
+
roomHistoryTracker.finalizePending(roomId, reservedHistorySlot, pendingEntry, historyThreadId);
|
|
2997
|
+
markReservedHistorySlotConsumed();
|
|
2998
|
+
} else roomHistoryTracker.recordPending(roomId, pendingEntry, historyThreadId);
|
|
2999
|
+
}
|
|
3000
|
+
logger.info("skipping room message", {
|
|
3001
|
+
roomId,
|
|
3002
|
+
reason: "no-mention"
|
|
3003
|
+
});
|
|
3004
|
+
await commitInboundEventIfClaimed();
|
|
3005
|
+
return;
|
|
3006
|
+
}
|
|
3007
|
+
if (preflightAudioTranscript) await sendMatrixPreflightAudioTranscriptEcho({
|
|
3008
|
+
transcript: preflightAudioTranscript,
|
|
3009
|
+
cfg,
|
|
3010
|
+
accountId,
|
|
3011
|
+
originatingTo: `room:${roomId}`,
|
|
3012
|
+
messageThreadId: thread.threadId
|
|
3013
|
+
});
|
|
3014
|
+
if (isPollEvent) {
|
|
3015
|
+
const pollSnapshot = await getPollSnapshot();
|
|
3016
|
+
if (!pollSnapshot) {
|
|
3017
|
+
discardReservedHistorySlot();
|
|
3018
|
+
return;
|
|
3019
|
+
}
|
|
3020
|
+
content = {
|
|
3021
|
+
msgtype: "m.text",
|
|
3022
|
+
body: pollSnapshot.text
|
|
3023
|
+
};
|
|
3024
|
+
}
|
|
3025
|
+
let media = preflightMedia;
|
|
3026
|
+
let mediaDownloadFailed = preflightMediaDownloadFailed;
|
|
3027
|
+
let mediaSizeLimitExceeded = preflightMediaSizeLimitExceeded;
|
|
3028
|
+
const finalContentUrl = "url" in content && typeof content.url === "string" ? content.url : void 0;
|
|
3029
|
+
const finalContentFile = "file" in content && content.file && typeof content.file === "object" ? content.file : void 0;
|
|
3030
|
+
const finalMediaUrl = finalContentUrl ?? finalContentFile?.url;
|
|
3031
|
+
const contentBody = typeof content.body === "string" ? content.body.trim() : "";
|
|
3032
|
+
const originalFilename = (typeof content.filename === "string" ? content.filename.trim() : "") || contentBody || void 0;
|
|
3033
|
+
const contentInfo = "info" in content && content.info && typeof content.info === "object" ? content.info : void 0;
|
|
3034
|
+
const contentType = contentInfo?.mimetype;
|
|
3035
|
+
const contentSize = typeof contentInfo?.size === "number" ? contentInfo.size : void 0;
|
|
3036
|
+
if (!media && !mediaDownloadFailed && finalMediaUrl?.startsWith("mxc://")) try {
|
|
3037
|
+
media = await downloadMatrixMedia({
|
|
3038
|
+
client,
|
|
3039
|
+
mxcUrl: finalMediaUrl,
|
|
3040
|
+
contentType,
|
|
3041
|
+
sizeBytes: contentSize,
|
|
3042
|
+
maxBytes: mediaMaxBytes,
|
|
3043
|
+
file: finalContentFile,
|
|
3044
|
+
originalFilename
|
|
3045
|
+
});
|
|
2286
3046
|
} catch (err) {
|
|
2287
|
-
|
|
2288
|
-
|
|
3047
|
+
mediaDownloadFailed = true;
|
|
3048
|
+
if (isMatrixMediaSizeLimitError(err)) mediaSizeLimitExceeded = true;
|
|
3049
|
+
const errorText = formatMatrixErrorMessage(err);
|
|
3050
|
+
logVerboseMessage(`matrix: media download failed room=${roomId} id=${event.event_id ?? "unknown"} type=${content.msgtype} error=${errorText}`);
|
|
3051
|
+
logger.warn("matrix media download failed", {
|
|
3052
|
+
roomId,
|
|
3053
|
+
eventId: event.event_id,
|
|
3054
|
+
msgtype: content.msgtype,
|
|
3055
|
+
encrypted: Boolean(finalContentFile),
|
|
3056
|
+
error: errorText
|
|
3057
|
+
});
|
|
3058
|
+
}
|
|
3059
|
+
let bodyText = resolveMatrixInboundBodyText({
|
|
3060
|
+
rawBody: locationPayload?.text ?? contentBody,
|
|
3061
|
+
filename: typeof content.filename === "string" ? content.filename : void 0,
|
|
3062
|
+
mediaPlaceholder: media?.placeholder,
|
|
3063
|
+
msgtype: content.msgtype,
|
|
3064
|
+
hadMediaUrl: Boolean(finalMediaUrl),
|
|
3065
|
+
mediaDownloadFailed,
|
|
3066
|
+
mediaSizeLimitExceeded
|
|
3067
|
+
});
|
|
3068
|
+
if (preflightMedia && bodyText && bodyText !== preflightMedia.placeholder && isLikelyBareFilename(bodyText)) bodyText = preflightMedia.placeholder;
|
|
3069
|
+
if (preflightAudioTranscript) {
|
|
3070
|
+
const transcriptBody = formatMatrixAudioTranscript(preflightAudioTranscript);
|
|
3071
|
+
bodyText = !bodyText || bodyText === media?.placeholder ? transcriptBody : `${bodyText}\n${transcriptBody}`;
|
|
3072
|
+
}
|
|
3073
|
+
if (!bodyText) {
|
|
3074
|
+
await commitInboundEventIfClaimedAndDiscardReserved();
|
|
3075
|
+
return;
|
|
3076
|
+
}
|
|
3077
|
+
const commandBodyText = hasControlCommandInMessage ? commandCheckText : bodyText;
|
|
3078
|
+
const senderName = await getSenderName();
|
|
3079
|
+
if (_configuredBinding) {
|
|
3080
|
+
const { ensureConfiguredAcpBindingReady } = await loadAcpBindingRuntime();
|
|
3081
|
+
if (!(await ensureConfiguredAcpBindingReady({
|
|
3082
|
+
cfg,
|
|
3083
|
+
configuredBinding: _configuredBinding
|
|
3084
|
+
})).ok) {
|
|
3085
|
+
logInboundDrop({
|
|
3086
|
+
log: logVerboseMessage,
|
|
3087
|
+
channel: "matrix",
|
|
3088
|
+
reason: "configured ACP binding unavailable",
|
|
3089
|
+
target: _configuredBinding.spec.conversationId
|
|
3090
|
+
});
|
|
3091
|
+
discardReservedHistorySlot();
|
|
3092
|
+
return;
|
|
3093
|
+
}
|
|
3094
|
+
}
|
|
3095
|
+
if (_runtimeBindingId) {
|
|
3096
|
+
const { getSessionBindingService } = await loadSessionBindingRuntime();
|
|
3097
|
+
getSessionBindingService().touch(_runtimeBindingId, eventTs ?? void 0);
|
|
3098
|
+
}
|
|
3099
|
+
const preparedTrigger = isRoom && historyLimit > 0 ? reservedHistorySlot ? roomHistoryTracker.prepareReservedTrigger(_route.agentId, roomId, historyLimit, reservedHistorySlot, {
|
|
3100
|
+
sender: senderName,
|
|
3101
|
+
body: bodyText,
|
|
3102
|
+
timestamp: eventTs ?? void 0,
|
|
3103
|
+
messageId
|
|
3104
|
+
}, historyThreadId) : roomHistoryTracker.prepareTrigger(_route.agentId, roomId, historyLimit, {
|
|
3105
|
+
sender: senderName,
|
|
3106
|
+
body: bodyText,
|
|
3107
|
+
timestamp: eventTs ?? void 0,
|
|
3108
|
+
messageId
|
|
3109
|
+
}, historyThreadId) : void 0;
|
|
3110
|
+
if (reservedHistorySlot && preparedTrigger) markReservedHistorySlotConsumed();
|
|
3111
|
+
return {
|
|
3112
|
+
route: _route,
|
|
3113
|
+
hasExplicitSessionBinding,
|
|
3114
|
+
roomConfig,
|
|
3115
|
+
isDirectMessage,
|
|
3116
|
+
isRoom,
|
|
3117
|
+
shouldRequireMention,
|
|
3118
|
+
wasMentioned,
|
|
3119
|
+
effectiveWasMentioned,
|
|
3120
|
+
shouldBypassMention,
|
|
3121
|
+
canDetectMention,
|
|
3122
|
+
commandAuthorized,
|
|
3123
|
+
inboundHistory: preparedTrigger ? buildInboundHistoryFromEntries({
|
|
3124
|
+
entries: preparedTrigger.history,
|
|
3125
|
+
limit: historyLimit
|
|
3126
|
+
}) : void 0,
|
|
3127
|
+
senderName,
|
|
3128
|
+
bodyText,
|
|
3129
|
+
commandBodyText,
|
|
3130
|
+
media,
|
|
3131
|
+
preflightAudioTranscript,
|
|
3132
|
+
locationPayload,
|
|
3133
|
+
messageId,
|
|
3134
|
+
triggerSnapshot: preparedTrigger,
|
|
3135
|
+
threadRootId,
|
|
3136
|
+
thread,
|
|
3137
|
+
botLoopProtection,
|
|
3138
|
+
effectiveGroupAllowFrom,
|
|
3139
|
+
effectiveRoomUsers
|
|
3140
|
+
};
|
|
3141
|
+
}
|
|
3142
|
+
//#endregion
|
|
3143
|
+
//#region extensions/matrix/src/matrix/monitor/location.ts
|
|
3144
|
+
function decodeGeoUriParamValue(value) {
|
|
3145
|
+
try {
|
|
3146
|
+
return decodeURIComponent(value);
|
|
3147
|
+
} catch {
|
|
3148
|
+
return value;
|
|
2289
3149
|
}
|
|
2290
3150
|
}
|
|
2291
|
-
function
|
|
2292
|
-
|
|
2293
|
-
if (!
|
|
2294
|
-
|
|
2295
|
-
const
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
3151
|
+
function parseGeoUri(value) {
|
|
3152
|
+
const trimmed = value.trim();
|
|
3153
|
+
if (!trimmed) return null;
|
|
3154
|
+
if (!normalizeLowercaseStringOrEmpty(trimmed).startsWith("geo:")) return null;
|
|
3155
|
+
const [coordsPart, ...paramParts] = trimmed.slice(4).split(";");
|
|
3156
|
+
if (!coordsPart) return null;
|
|
3157
|
+
const coords = coordsPart.split(",");
|
|
3158
|
+
if (coords.length < 2) return null;
|
|
3159
|
+
const latitude = parseStrictFiniteNumber(coords[0] ?? "");
|
|
3160
|
+
const longitude = parseStrictFiniteNumber(coords[1] ?? "");
|
|
3161
|
+
if (latitude === void 0 || longitude === void 0) return null;
|
|
3162
|
+
const params = /* @__PURE__ */ new Map();
|
|
3163
|
+
for (const part of paramParts) {
|
|
3164
|
+
const segment = part.trim();
|
|
3165
|
+
if (!segment) continue;
|
|
3166
|
+
const eqIndex = segment.indexOf("=");
|
|
3167
|
+
const rawKey = eqIndex === -1 ? segment : segment.slice(0, eqIndex);
|
|
3168
|
+
const rawValue = eqIndex === -1 ? "" : segment.slice(eqIndex + 1);
|
|
3169
|
+
const key = normalizeLowercaseStringOrEmpty(rawKey);
|
|
3170
|
+
if (!key) continue;
|
|
3171
|
+
const valuePart = rawValue.trim();
|
|
3172
|
+
params.set(key, valuePart ? decodeGeoUriParamValue(valuePart) : "");
|
|
3173
|
+
}
|
|
3174
|
+
const accuracyRaw = params.get("u");
|
|
3175
|
+
return {
|
|
3176
|
+
latitude,
|
|
3177
|
+
longitude,
|
|
3178
|
+
accuracy: accuracyRaw ? parseStrictFiniteNumber(accuracyRaw) : void 0
|
|
3179
|
+
};
|
|
3180
|
+
}
|
|
3181
|
+
function resolveMatrixLocation(params) {
|
|
3182
|
+
const { eventType, content } = params;
|
|
3183
|
+
if (!(eventType === EventType.Location || eventType === EventType.RoomMessage && content.msgtype === EventType.Location)) return null;
|
|
3184
|
+
const geoUri = normalizeOptionalString(content.geo_uri) ?? "";
|
|
3185
|
+
if (!geoUri) return null;
|
|
3186
|
+
const parsed = parseGeoUri(geoUri);
|
|
3187
|
+
if (!parsed) return null;
|
|
3188
|
+
const caption = normalizeOptionalString(content.body) ?? "";
|
|
3189
|
+
const location = {
|
|
3190
|
+
latitude: parsed.latitude,
|
|
3191
|
+
longitude: parsed.longitude,
|
|
3192
|
+
accuracy: parsed.accuracy,
|
|
3193
|
+
caption: caption || void 0,
|
|
3194
|
+
source: "pin",
|
|
3195
|
+
isLive: false
|
|
3196
|
+
};
|
|
3197
|
+
return {
|
|
3198
|
+
text: formatLocationText(location),
|
|
3199
|
+
context: toLocationContext(location)
|
|
3200
|
+
};
|
|
3201
|
+
}
|
|
3202
|
+
//#endregion
|
|
3203
|
+
//#region extensions/matrix/src/matrix/monitor/handler-ingress-prefix.ts
|
|
3204
|
+
async function readMatrixIngressPrefix(config) {
|
|
3205
|
+
const { client, senderId, dropPreStartupMessages, eventTs, eventAge, startupMs, startupGraceMs, event, eventType, eventId, inboundDeduper, roomId, logVerboseMessage, directTracker, claimInboundReplay } = config;
|
|
3206
|
+
const selfUserId = await client.getUserId();
|
|
3207
|
+
if (senderId === selfUserId) return;
|
|
3208
|
+
if (dropPreStartupMessages) {
|
|
3209
|
+
if (typeof eventTs === "number" && eventTs < startupMs - startupGraceMs) return;
|
|
3210
|
+
if (typeof eventTs !== "number" && typeof eventAge === "number" && eventAge > startupGraceMs) return;
|
|
3211
|
+
}
|
|
3212
|
+
const content = event.content;
|
|
3213
|
+
if (eventType === EventType.RoomMessage && isMatrixVerificationRoomMessage({
|
|
3214
|
+
msgtype: content.msgtype,
|
|
3215
|
+
body: content.body
|
|
3216
|
+
})) {
|
|
3217
|
+
logVerboseMessage(`matrix: skip verification/system room message room=${roomId}`);
|
|
3218
|
+
return;
|
|
3219
|
+
}
|
|
3220
|
+
const locationPayload = resolveMatrixLocation({
|
|
3221
|
+
eventType,
|
|
3222
|
+
content
|
|
3223
|
+
});
|
|
3224
|
+
const relates = content["m.relates_to"];
|
|
3225
|
+
if (relates && "rel_type" in relates && relates.rel_type === RelationType.Replace) return;
|
|
3226
|
+
if (hasBundledMatrixReplacementRelation(event)) return;
|
|
3227
|
+
if (eventId && inboundDeduper) {
|
|
3228
|
+
const claim = await inboundDeduper.claim({
|
|
3229
|
+
roomId,
|
|
3230
|
+
eventId
|
|
3231
|
+
});
|
|
3232
|
+
if (claim.kind === "claimed") claimInboundReplay(claim.handle);
|
|
3233
|
+
else if (claim.kind !== "invalid") {
|
|
3234
|
+
logVerboseMessage(`matrix: skip duplicate inbound event room=${roomId} id=${eventId}`);
|
|
3235
|
+
return;
|
|
3236
|
+
}
|
|
3237
|
+
}
|
|
3238
|
+
return {
|
|
3239
|
+
content,
|
|
3240
|
+
isDirectMessage: await directTracker.isDirectMessage({
|
|
3241
|
+
roomId,
|
|
3242
|
+
senderId,
|
|
3243
|
+
selfUserId
|
|
2302
3244
|
}),
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
msgtype
|
|
2307
|
-
})
|
|
2308
|
-
}) ?? "";
|
|
3245
|
+
locationPayload,
|
|
3246
|
+
selfUserId
|
|
3247
|
+
};
|
|
2309
3248
|
}
|
|
2310
|
-
|
|
2311
|
-
|
|
3249
|
+
//#endregion
|
|
3250
|
+
//#region extensions/matrix/src/matrix/monitor/replies.ts
|
|
3251
|
+
function joinMatrixVisibleContent(contents) {
|
|
3252
|
+
return contents.filter((content) => Boolean(content)).join("\n");
|
|
2312
3253
|
}
|
|
2313
|
-
function
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
const
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
3254
|
+
function mergeMatrixReplyDeliveryResults(results) {
|
|
3255
|
+
const visibleResults = results.filter((result) => result.visibleReplySent);
|
|
3256
|
+
if (visibleResults.length === 0) return {
|
|
3257
|
+
visibleReplySent: false,
|
|
3258
|
+
suppression: { reason: "no_visible_result" }
|
|
3259
|
+
};
|
|
3260
|
+
const receiptInputs = [];
|
|
3261
|
+
for (const result of visibleResults) {
|
|
3262
|
+
if (result.receipt) {
|
|
3263
|
+
receiptInputs.push({ receipt: result.receipt });
|
|
3264
|
+
continue;
|
|
3265
|
+
}
|
|
3266
|
+
for (const messageId of result.messageIds ?? []) receiptInputs.push({ messageId });
|
|
3267
|
+
}
|
|
3268
|
+
const receipt = receiptInputs.length > 0 ? createMessageReceiptFromOutboundResults({ results: receiptInputs }) : void 0;
|
|
3269
|
+
return {
|
|
3270
|
+
...receipt ? {
|
|
3271
|
+
messageIds: listMessageReceiptPlatformIds(receipt),
|
|
3272
|
+
receipt
|
|
3273
|
+
} : {},
|
|
3274
|
+
visibleReplySent: true,
|
|
3275
|
+
content: joinMatrixVisibleContent(visibleResults.map((result) => result.content))
|
|
3276
|
+
};
|
|
2324
3277
|
}
|
|
2325
|
-
function
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
return
|
|
3278
|
+
function toMatrixPartialDeliveryError(error, settled) {
|
|
3279
|
+
const failedPartial = isChannelPartialDeliveryError(error) ? error.deliveryResult : void 0;
|
|
3280
|
+
const merged = mergeMatrixReplyDeliveryResults([...settled, ...failedPartial ? [failedPartial] : []]);
|
|
3281
|
+
return merged.visibleReplySent ? createChannelPartialDeliveryError(error, {
|
|
3282
|
+
...merged,
|
|
3283
|
+
visibleReplySent: true
|
|
3284
|
+
}) : error;
|
|
2329
3285
|
}
|
|
2330
|
-
function
|
|
2331
|
-
|
|
3286
|
+
function createMatrixReplyDeliveryResult(results) {
|
|
3287
|
+
if (results.length === 0) return mergeMatrixReplyDeliveryResults([]);
|
|
3288
|
+
const receipt = createMessageReceiptFromOutboundResults({ results: results.map((result) => ({ receipt: result.receipt })) });
|
|
3289
|
+
return {
|
|
3290
|
+
messageIds: listMessageReceiptPlatformIds(receipt),
|
|
3291
|
+
receipt,
|
|
3292
|
+
visibleReplySent: true,
|
|
3293
|
+
content: joinMatrixVisibleContent(results.map((result) => result.content))
|
|
3294
|
+
};
|
|
2332
3295
|
}
|
|
2333
|
-
function
|
|
2334
|
-
|
|
2335
|
-
const
|
|
2336
|
-
|
|
3296
|
+
function resolveVisibleMatrixReplyText(text) {
|
|
3297
|
+
if (typeof text !== "string") return;
|
|
3298
|
+
const trimmedStart = text.trimStart();
|
|
3299
|
+
if (!trimmedStart) return text;
|
|
3300
|
+
if (normalizeLowercaseStringOrEmpty(trimmedStart).startsWith("reasoning:")) return;
|
|
3301
|
+
const visibleText = stripReasoningTagsFromText(text, {
|
|
3302
|
+
mode: "strict",
|
|
3303
|
+
trim: "none"
|
|
3304
|
+
});
|
|
3305
|
+
return visibleText.trim() ? visibleText : void 0;
|
|
3306
|
+
}
|
|
3307
|
+
async function deliverMatrixReplies(params) {
|
|
3308
|
+
const core = getMatrixRuntime();
|
|
3309
|
+
const tableMode = params.tableMode ?? core.channel.text.resolveMarkdownTableMode({
|
|
3310
|
+
cfg: params.cfg,
|
|
2337
3311
|
channel: "matrix",
|
|
2338
|
-
accountId
|
|
3312
|
+
accountId: params.accountId
|
|
2339
3313
|
});
|
|
3314
|
+
const logVerbose = (message) => {
|
|
3315
|
+
if (core.logging.shouldLogVerbose()) params.runtime.log?.(message);
|
|
3316
|
+
};
|
|
3317
|
+
const hasRepliedRef = params.hasRepliedRef ?? { value: false };
|
|
3318
|
+
const acceptedResults = [];
|
|
3319
|
+
try {
|
|
3320
|
+
for (const reply of params.replies) {
|
|
3321
|
+
const visibleText = resolveVisibleMatrixReplyText(reply.text);
|
|
3322
|
+
const hasMedia = Boolean(reply?.mediaUrl) || (reply?.mediaUrls?.length ?? 0) > 0;
|
|
3323
|
+
if (reply.isReasoning === true || !hasMedia && reply.text && visibleText === void 0) {
|
|
3324
|
+
logVerbose("matrix reply suppressed as reasoning-only");
|
|
3325
|
+
continue;
|
|
3326
|
+
}
|
|
3327
|
+
if (!reply?.text && !hasMedia) {
|
|
3328
|
+
if (reply?.audioAsVoice) {
|
|
3329
|
+
logVerbose("matrix reply has audioAsVoice without media/text; skipping");
|
|
3330
|
+
continue;
|
|
3331
|
+
}
|
|
3332
|
+
params.runtime.error?.("matrix reply missing text/media");
|
|
3333
|
+
continue;
|
|
3334
|
+
}
|
|
3335
|
+
const replyToIdRaw = (reply.replyToId ?? params.replyToId)?.trim();
|
|
3336
|
+
const replyToId = params.threadId ? replyToIdRaw : params.replyToMode === "off" ? void 0 : replyToIdRaw;
|
|
3337
|
+
const rawText = visibleText ?? "";
|
|
3338
|
+
const mediaList = reply.mediaUrls?.length ? reply.mediaUrls : reply.mediaUrl ? [reply.mediaUrl] : [];
|
|
3339
|
+
const shouldIncludeReply = (id) => Boolean(id) && (params.threadId || params.replyToMode === "all" || !hasRepliedRef.value);
|
|
3340
|
+
const replyToIdForReply = shouldIncludeReply(replyToId) ? replyToId : void 0;
|
|
3341
|
+
const onDeliveryResult = (result) => {
|
|
3342
|
+
acceptedResults.push(result);
|
|
3343
|
+
if (replyToIdForReply) hasRepliedRef.value = true;
|
|
3344
|
+
};
|
|
3345
|
+
if (mediaList.length === 0) {
|
|
3346
|
+
const { chunks } = chunkMatrixText(rawText, {
|
|
3347
|
+
cfg: params.cfg,
|
|
3348
|
+
accountId: params.accountId,
|
|
3349
|
+
tableMode
|
|
3350
|
+
});
|
|
3351
|
+
for (const chunk of chunks) {
|
|
3352
|
+
const trimmed = chunk.trim();
|
|
3353
|
+
if (!trimmed) continue;
|
|
3354
|
+
await sendMessageMatrix(params.roomId, trimmed, {
|
|
3355
|
+
client: params.client,
|
|
3356
|
+
cfg: params.cfg,
|
|
3357
|
+
replyToId: replyToIdForReply,
|
|
3358
|
+
threadId: params.threadId,
|
|
3359
|
+
accountId: params.accountId,
|
|
3360
|
+
onDeliveryResult
|
|
3361
|
+
});
|
|
3362
|
+
}
|
|
3363
|
+
continue;
|
|
3364
|
+
}
|
|
3365
|
+
let first = true;
|
|
3366
|
+
for (const mediaUrl of mediaList) {
|
|
3367
|
+
const caption = first ? rawText : "";
|
|
3368
|
+
await sendMessageMatrix(params.roomId, caption, {
|
|
3369
|
+
client: params.client,
|
|
3370
|
+
cfg: params.cfg,
|
|
3371
|
+
mediaUrl,
|
|
3372
|
+
mediaLocalRoots: params.mediaLocalRoots,
|
|
3373
|
+
replyToId: replyToIdForReply,
|
|
3374
|
+
threadId: params.threadId,
|
|
3375
|
+
audioAsVoice: reply.audioAsVoice,
|
|
3376
|
+
accountId: params.accountId,
|
|
3377
|
+
onDeliveryResult
|
|
3378
|
+
});
|
|
3379
|
+
first = false;
|
|
3380
|
+
}
|
|
3381
|
+
}
|
|
3382
|
+
} catch (error) {
|
|
3383
|
+
throw toMatrixPartialDeliveryError(error, [createMatrixReplyDeliveryResult(acceptedResults)]);
|
|
3384
|
+
}
|
|
3385
|
+
return createMatrixReplyDeliveryResult(acceptedResults);
|
|
3386
|
+
}
|
|
3387
|
+
//#endregion
|
|
3388
|
+
//#region extensions/matrix/src/matrix/monitor/handler-reply-dispatcher.ts
|
|
3389
|
+
function createMatrixReplyDispatcher(config) {
|
|
3390
|
+
const { cfg, prefixOptions, humanDelay, typingCallbacks, streaming, draftStream, draftController, client, roomId, runtime, textLimit, replyToMode, threadTarget, replyToEventId, accountId, mediaLocalRoots, tableMode, logVerboseMessage } = config;
|
|
3391
|
+
const quietDraftStreaming = streaming === "quiet" || streaming === "progress";
|
|
3392
|
+
const hasRepliedRef = { value: false };
|
|
3393
|
+
let finalReplyDeliveryFailed = false;
|
|
3394
|
+
let nonFinalReplyDeliveryFailed = false;
|
|
3395
|
+
const { deliver: deliverReply, onError: onReplyError, ...turnDispatcherOptions } = {
|
|
3396
|
+
...prefixOptions,
|
|
3397
|
+
humanDelay,
|
|
3398
|
+
deliver: async (payload, info) => {
|
|
3399
|
+
const completeDelivery = async (result) => {
|
|
3400
|
+
if (info.kind === "block") {
|
|
3401
|
+
draftController.clearDraftConsumed();
|
|
3402
|
+
draftController.advanceDraftBlockBoundary({ fallbackToLatestEnd: true });
|
|
3403
|
+
draftStream?.reset();
|
|
3404
|
+
draftController.resetReplyToIdForNextBlock();
|
|
3405
|
+
draftController.updateDraftFromLatestFullText();
|
|
3406
|
+
const { sendTypingMatrix } = await loadMatrixSendModule();
|
|
3407
|
+
await sendTypingMatrix(roomId, true, void 0, client).catch(() => {});
|
|
3408
|
+
}
|
|
3409
|
+
return result;
|
|
3410
|
+
};
|
|
3411
|
+
const createDraftReceipt = (id) => createPreviewMessageReceipt({
|
|
3412
|
+
id,
|
|
3413
|
+
...threadTarget ? { threadId: threadTarget } : {},
|
|
3414
|
+
...draftController.currentReplyToId() ? { replyToId: draftController.currentReplyToId() } : {}
|
|
3415
|
+
});
|
|
3416
|
+
const createDraftDeliveryResult = (id, content) => {
|
|
3417
|
+
const receipt = createDraftReceipt(id);
|
|
3418
|
+
return {
|
|
3419
|
+
messageIds: receipt.platformMessageIds,
|
|
3420
|
+
receipt,
|
|
3421
|
+
visibleReplySent: true,
|
|
3422
|
+
content
|
|
3423
|
+
};
|
|
3424
|
+
};
|
|
3425
|
+
const createSurvivingDraftDelivery = (id, redacted) => {
|
|
3426
|
+
const content = redacted ? void 0 : draftStream?.content();
|
|
3427
|
+
return content ? createDraftDeliveryResult(id, content) : mergeMatrixReplyDeliveryResults([]);
|
|
3428
|
+
};
|
|
3429
|
+
if (draftStream && info.kind !== "tool" && !payload.isCompactionNotice) {
|
|
3430
|
+
const hasMedia = Boolean(payload.mediaUrl) || (payload.mediaUrls?.length ?? 0) > 0;
|
|
3431
|
+
const ttsSupplement = getReplyPayloadTtsSupplement(payload);
|
|
3432
|
+
const fallbackPayload = ttsSupplement && ttsSupplement.visibleTextAlreadyDelivered !== true && !payload.text?.trim() ? {
|
|
3433
|
+
...payload,
|
|
3434
|
+
text: ttsSupplement.spokenText
|
|
3435
|
+
} : payload;
|
|
3436
|
+
if (draftController.isDraftConsumed()) {
|
|
3437
|
+
await draftStream.discardPending();
|
|
3438
|
+
return await completeDelivery(await deliverMatrixReplies({
|
|
3439
|
+
cfg,
|
|
3440
|
+
replies: [fallbackPayload],
|
|
3441
|
+
roomId,
|
|
3442
|
+
client,
|
|
3443
|
+
runtime,
|
|
3444
|
+
textLimit,
|
|
3445
|
+
replyToMode,
|
|
3446
|
+
hasRepliedRef,
|
|
3447
|
+
threadId: threadTarget,
|
|
3448
|
+
replyToId: threadTarget ?? replyToEventId ?? void 0,
|
|
3449
|
+
accountId,
|
|
3450
|
+
mediaLocalRoots,
|
|
3451
|
+
tableMode
|
|
3452
|
+
}));
|
|
3453
|
+
}
|
|
3454
|
+
const payloadReplyToId = normalizeOptionalString(payload.replyToId);
|
|
3455
|
+
const payloadReplyMismatch = replyToMode !== "off" && !threadTarget && payloadReplyToId !== draftController.currentReplyToId();
|
|
3456
|
+
let mustDeliverFinalNormally = draftStream.mustDeliverFinalNormally();
|
|
3457
|
+
if (Boolean(payload.text?.trim()) && !payload.isError && !payloadReplyMismatch && !mustDeliverFinalNormally) {
|
|
3458
|
+
await draftStream.stop();
|
|
3459
|
+
mustDeliverFinalNormally = draftStream.mustDeliverFinalNormally();
|
|
3460
|
+
} else await draftStream.discardPending();
|
|
3461
|
+
const draftEventId = draftStream.eventId();
|
|
3462
|
+
const draftFinalTextNeedsNormalMentionDelivery = Boolean(draftEventId) && typeof payload.text === "string" && Boolean(payload.text.trim()) && !payload.isError && !payloadReplyMismatch && !mustDeliverFinalNormally && await matrixTextWouldActivateMentions(client, payload.text);
|
|
3463
|
+
if (draftEventId && payload.text && !payload.isError && !hasMedia && !payloadReplyMismatch && !mustDeliverFinalNormally && !draftFinalTextNeedsNormalMentionDelivery) {
|
|
3464
|
+
const finalPreviewText = payload.text;
|
|
3465
|
+
const { prepareMatrixSingleText } = await loadMatrixSendModule();
|
|
3466
|
+
const preparedFinalPreviewContent = prepareMatrixSingleText(finalPreviewText, {
|
|
3467
|
+
cfg,
|
|
3468
|
+
accountId,
|
|
3469
|
+
preserveWhitespace: true
|
|
3470
|
+
}).convertedText;
|
|
3471
|
+
let finalizedDraftContent = draftStream.content() ?? preparedFinalPreviewContent;
|
|
3472
|
+
let fallbackResult;
|
|
3473
|
+
const previewResult = await deliverWithFinalizableLivePreviewAdapter({
|
|
3474
|
+
kind: "final",
|
|
3475
|
+
payload,
|
|
3476
|
+
adapter: defineFinalizableLivePreviewAdapter({
|
|
3477
|
+
draft: {
|
|
3478
|
+
flush: async () => {},
|
|
3479
|
+
clear: async () => {},
|
|
3480
|
+
discardPending: async () => {},
|
|
3481
|
+
id: () => draftEventId
|
|
3482
|
+
},
|
|
3483
|
+
buildFinalEdit: () => ({
|
|
3484
|
+
text: finalPreviewText,
|
|
3485
|
+
finalizeLive: !(quietDraftStreaming || !draftStream.matchesPreparedText(finalPreviewText)),
|
|
3486
|
+
...quietDraftStreaming ? { extraContent: buildMatrixFinalizedPreviewContent() } : {}
|
|
3487
|
+
}),
|
|
3488
|
+
editFinal: async (_draftEventId, edit) => {
|
|
3489
|
+
if (edit.finalizeLive) {
|
|
3490
|
+
if (!await draftStream.finalizeLive()) throw new Error("Matrix draft live finalize failed");
|
|
3491
|
+
finalizedDraftContent = draftStream.content() ?? preparedFinalPreviewContent;
|
|
3492
|
+
return;
|
|
3493
|
+
}
|
|
3494
|
+
const { editMessageMatrix } = await loadMatrixSendModule();
|
|
3495
|
+
await editMessageMatrix(roomId, _draftEventId, edit.text, {
|
|
3496
|
+
client,
|
|
3497
|
+
cfg,
|
|
3498
|
+
threadId: threadTarget,
|
|
3499
|
+
accountId,
|
|
3500
|
+
extraContent: edit.extraContent
|
|
3501
|
+
});
|
|
3502
|
+
finalizedDraftContent = prepareMatrixSingleText(edit.text, {
|
|
3503
|
+
cfg,
|
|
3504
|
+
accountId,
|
|
3505
|
+
preserveWhitespace: true
|
|
3506
|
+
}).convertedText;
|
|
3507
|
+
},
|
|
3508
|
+
createPreviewReceipt: createDraftReceipt,
|
|
3509
|
+
logPreviewEditFailure: (err) => {
|
|
3510
|
+
logVerboseMessage(`matrix: preview final edit failed: ${String(err)}`);
|
|
3511
|
+
}
|
|
3512
|
+
}),
|
|
3513
|
+
deliverNormally: async () => {
|
|
3514
|
+
const draftRedacted = await redactMatrixDraftEvent(client, roomId, draftEventId);
|
|
3515
|
+
const survivingDraft = createSurvivingDraftDelivery(draftEventId, draftRedacted);
|
|
3516
|
+
let deliveredFallback;
|
|
3517
|
+
try {
|
|
3518
|
+
deliveredFallback = await deliverMatrixReplies({
|
|
3519
|
+
cfg,
|
|
3520
|
+
replies: [fallbackPayload],
|
|
3521
|
+
roomId,
|
|
3522
|
+
client,
|
|
3523
|
+
runtime,
|
|
3524
|
+
textLimit,
|
|
3525
|
+
replyToMode,
|
|
3526
|
+
hasRepliedRef,
|
|
3527
|
+
threadId: threadTarget,
|
|
3528
|
+
replyToId: threadTarget ?? replyToEventId ?? void 0,
|
|
3529
|
+
accountId,
|
|
3530
|
+
mediaLocalRoots,
|
|
3531
|
+
tableMode
|
|
3532
|
+
});
|
|
3533
|
+
} catch (error) {
|
|
3534
|
+
throw toMatrixPartialDeliveryError(error, [survivingDraft]);
|
|
3535
|
+
}
|
|
3536
|
+
fallbackResult = mergeMatrixReplyDeliveryResults([survivingDraft, deliveredFallback]);
|
|
3537
|
+
return fallbackResult.visibleReplySent;
|
|
3538
|
+
}
|
|
3539
|
+
});
|
|
3540
|
+
draftController.markDraftConsumed();
|
|
3541
|
+
return await completeDelivery(previewResult.kind === "preview-finalized" && previewResult.liveState?.receipt ? createDraftDeliveryResult(draftEventId, finalizedDraftContent ?? preparedFinalPreviewContent) : fallbackResult ?? mergeMatrixReplyDeliveryResults([]));
|
|
3542
|
+
} else if (draftEventId && hasMedia && !payloadReplyMismatch) {
|
|
3543
|
+
let textEditOk = !mustDeliverFinalNormally;
|
|
3544
|
+
const payloadText = payload.text ?? ttsSupplement?.spokenText;
|
|
3545
|
+
const preparedPayloadContent = typeof payloadText === "string" ? (await loadMatrixSendModule()).prepareMatrixSingleText(payloadText, {
|
|
3546
|
+
cfg,
|
|
3547
|
+
accountId,
|
|
3548
|
+
preserveWhitespace: true
|
|
3549
|
+
}).convertedText : void 0;
|
|
3550
|
+
let finalizedDraftContent = draftStream.content() ?? preparedPayloadContent;
|
|
3551
|
+
const payloadTextMatchesDraft = typeof payloadText === "string" && draftStream.matchesPreparedText(payloadText);
|
|
3552
|
+
const reusesDraftTextUnchanged = typeof payloadText === "string" && Boolean(payloadText.trim()) && payloadTextMatchesDraft;
|
|
3553
|
+
const mediaTextNeedsNormalMentionDelivery = typeof payloadText === "string" && Boolean(payloadText.trim()) && await matrixTextWouldActivateMentions(client, payloadText);
|
|
3554
|
+
const requiresFinalTextEdit = quietDraftStreaming || typeof payloadText === "string" && !payloadTextMatchesDraft;
|
|
3555
|
+
if (textEditOk && mediaTextNeedsNormalMentionDelivery) textEditOk = false;
|
|
3556
|
+
else if (textEditOk && payloadText && requiresFinalTextEdit) {
|
|
3557
|
+
const { editMessageMatrix, prepareMatrixSingleText } = await loadMatrixSendModule();
|
|
3558
|
+
textEditOk = await editMessageMatrix(roomId, draftEventId, payloadText, {
|
|
3559
|
+
client,
|
|
3560
|
+
cfg,
|
|
3561
|
+
threadId: threadTarget,
|
|
3562
|
+
accountId,
|
|
3563
|
+
extraContent: quietDraftStreaming ? buildMatrixFinalizedPreviewContent() : void 0
|
|
3564
|
+
}).then(() => {
|
|
3565
|
+
finalizedDraftContent = prepareMatrixSingleText(payloadText, {
|
|
3566
|
+
cfg,
|
|
3567
|
+
accountId,
|
|
3568
|
+
preserveWhitespace: true
|
|
3569
|
+
}).convertedText;
|
|
3570
|
+
return true;
|
|
3571
|
+
}, () => false);
|
|
3572
|
+
} else if (textEditOk && reusesDraftTextUnchanged) {
|
|
3573
|
+
textEditOk = await draftStream.finalizeLive();
|
|
3574
|
+
finalizedDraftContent = draftStream.content();
|
|
3575
|
+
}
|
|
3576
|
+
const reusesDraftAsFinalText = Boolean(payloadText?.trim()) && textEditOk;
|
|
3577
|
+
const draftContent = draftStream.content();
|
|
3578
|
+
const draftRedacted = reusesDraftAsFinalText ? false : await redactMatrixDraftEvent(client, roomId, draftEventId);
|
|
3579
|
+
const mediaPayload = ttsSupplement && reusesDraftAsFinalText ? buildTtsSupplementMediaPayload(payload) : {
|
|
3580
|
+
...payload,
|
|
3581
|
+
text: reusesDraftAsFinalText ? void 0 : payload.text ?? (ttsSupplement?.visibleTextAlreadyDelivered === true ? void 0 : ttsSupplement?.spokenText)
|
|
3582
|
+
};
|
|
3583
|
+
const providerDraftContent = finalizedDraftContent ?? preparedPayloadContent;
|
|
3584
|
+
const previewDelivery = reusesDraftAsFinalText && providerDraftContent ? createDraftDeliveryResult(draftEventId, providerDraftContent) : !draftRedacted && draftContent ? createDraftDeliveryResult(draftEventId, draftContent) : mergeMatrixReplyDeliveryResults([]);
|
|
3585
|
+
let mediaDelivery;
|
|
3586
|
+
try {
|
|
3587
|
+
mediaDelivery = await deliverMatrixReplies({
|
|
3588
|
+
cfg,
|
|
3589
|
+
replies: [mediaPayload],
|
|
3590
|
+
roomId,
|
|
3591
|
+
client,
|
|
3592
|
+
runtime,
|
|
3593
|
+
textLimit,
|
|
3594
|
+
replyToMode,
|
|
3595
|
+
hasRepliedRef,
|
|
3596
|
+
threadId: threadTarget,
|
|
3597
|
+
replyToId: threadTarget ?? replyToEventId ?? void 0,
|
|
3598
|
+
accountId,
|
|
3599
|
+
mediaLocalRoots,
|
|
3600
|
+
tableMode
|
|
3601
|
+
});
|
|
3602
|
+
} catch (error) {
|
|
3603
|
+
throw toMatrixPartialDeliveryError(error, [previewDelivery]);
|
|
3604
|
+
}
|
|
3605
|
+
draftController.markDraftConsumed();
|
|
3606
|
+
return await completeDelivery(mergeMatrixReplyDeliveryResults([previewDelivery, mediaDelivery]));
|
|
3607
|
+
}
|
|
3608
|
+
const shouldRedactDraft = Boolean(draftEventId) && (payload.isError || payloadReplyMismatch || mustDeliverFinalNormally || draftFinalTextNeedsNormalMentionDelivery);
|
|
3609
|
+
const draftRedacted = shouldRedactDraft && draftEventId ? await redactMatrixDraftEvent(client, roomId, draftEventId) : false;
|
|
3610
|
+
const survivingDraft = shouldRedactDraft && draftEventId ? createSurvivingDraftDelivery(draftEventId, draftRedacted) : mergeMatrixReplyDeliveryResults([]);
|
|
3611
|
+
let deliveredFallback;
|
|
3612
|
+
try {
|
|
3613
|
+
deliveredFallback = await deliverMatrixReplies({
|
|
3614
|
+
cfg,
|
|
3615
|
+
replies: [fallbackPayload],
|
|
3616
|
+
roomId,
|
|
3617
|
+
client,
|
|
3618
|
+
runtime,
|
|
3619
|
+
textLimit,
|
|
3620
|
+
replyToMode,
|
|
3621
|
+
hasRepliedRef,
|
|
3622
|
+
threadId: threadTarget,
|
|
3623
|
+
replyToId: threadTarget ?? replyToEventId ?? void 0,
|
|
3624
|
+
accountId,
|
|
3625
|
+
mediaLocalRoots,
|
|
3626
|
+
tableMode
|
|
3627
|
+
});
|
|
3628
|
+
} catch (error) {
|
|
3629
|
+
throw toMatrixPartialDeliveryError(error, [survivingDraft]);
|
|
3630
|
+
}
|
|
3631
|
+
if (shouldRedactDraft || deliveredFallback.visibleReplySent) draftController.markDraftConsumed();
|
|
3632
|
+
return await completeDelivery(mergeMatrixReplyDeliveryResults([survivingDraft, deliveredFallback]));
|
|
3633
|
+
}
|
|
3634
|
+
return await completeDelivery(await deliverMatrixReplies({
|
|
3635
|
+
cfg,
|
|
3636
|
+
replies: [payload],
|
|
3637
|
+
roomId,
|
|
3638
|
+
client,
|
|
3639
|
+
runtime,
|
|
3640
|
+
textLimit,
|
|
3641
|
+
replyToMode,
|
|
3642
|
+
hasRepliedRef,
|
|
3643
|
+
threadId: threadTarget,
|
|
3644
|
+
replyToId: threadTarget ?? replyToEventId ?? void 0,
|
|
3645
|
+
accountId,
|
|
3646
|
+
mediaLocalRoots,
|
|
3647
|
+
tableMode
|
|
3648
|
+
}));
|
|
3649
|
+
},
|
|
3650
|
+
onError: (err, info) => {
|
|
3651
|
+
if (info.kind === "final") finalReplyDeliveryFailed = true;
|
|
3652
|
+
else nonFinalReplyDeliveryFailed = true;
|
|
3653
|
+
if (info.kind === "block") draftController.advanceDraftBlockBoundary({ fallbackToLatestEnd: true });
|
|
3654
|
+
runtime.error?.(`matrix ${info.kind} reply failed: ${String(err)}`);
|
|
3655
|
+
},
|
|
3656
|
+
onReplyStart: typingCallbacks.onReplyStart,
|
|
3657
|
+
onIdle: typingCallbacks.onIdle
|
|
3658
|
+
};
|
|
3659
|
+
return {
|
|
3660
|
+
deliverReply,
|
|
3661
|
+
onReplyError,
|
|
3662
|
+
turnDispatcherOptions,
|
|
3663
|
+
finalReplyDeliveryFailed: () => finalReplyDeliveryFailed,
|
|
3664
|
+
nonFinalReplyDeliveryFailed: () => nonFinalReplyDeliveryFailed
|
|
3665
|
+
};
|
|
3666
|
+
}
|
|
3667
|
+
//#endregion
|
|
3668
|
+
//#region extensions/matrix/src/matrix/monitor/handler-state.ts
|
|
3669
|
+
const ALLOW_FROM_STORE_CACHE_TTL_MS = 3e4;
|
|
3670
|
+
const PAIRING_REPLY_COOLDOWN_MS = 5 * 6e4;
|
|
3671
|
+
const MAX_TRACKED_PAIRING_REPLY_SENDERS = 512;
|
|
3672
|
+
function createMatrixHandlerState(config) {
|
|
3673
|
+
const { core, accountId, runtime, allowFromResolvedEntries, groupAllowFromResolvedEntries, resolveLiveUserAllowlist } = config;
|
|
2340
3674
|
let cachedStoreAllowFrom = null;
|
|
2341
3675
|
let liveDmAllowlistCache = null;
|
|
2342
3676
|
let liveGroupAllowlistCache = null;
|
|
@@ -2367,19 +3701,35 @@ function createMatrixRoomMessageHandler(params) {
|
|
|
2367
3701
|
return entries;
|
|
2368
3702
|
};
|
|
2369
3703
|
const pairingReplySentAtMsBySender = /* @__PURE__ */ new Map();
|
|
2370
|
-
const
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
3704
|
+
const resolveLiveAccountAllowlists = async () => {
|
|
3705
|
+
const liveCfg = core.config.current();
|
|
3706
|
+
const liveAccountAllowlists = resolveMatrixAccountAllowlistConfig({
|
|
3707
|
+
cfg: liveCfg,
|
|
3708
|
+
accountId
|
|
3709
|
+
});
|
|
3710
|
+
return {
|
|
3711
|
+
liveCfg,
|
|
3712
|
+
liveDmAllowFrom: await resolveCachedLiveAllowlist({
|
|
3713
|
+
cfg: liveCfg,
|
|
3714
|
+
entries: liveAccountAllowlists.dmAllowFrom,
|
|
3715
|
+
startupResolvedEntries: allowFromResolvedEntries,
|
|
3716
|
+
cache: liveDmAllowlistCache,
|
|
3717
|
+
updateCache: (next) => {
|
|
3718
|
+
liveDmAllowlistCache = next;
|
|
3719
|
+
}
|
|
3720
|
+
}),
|
|
3721
|
+
liveGroupAllowFrom: await resolveCachedLiveAllowlist({
|
|
3722
|
+
cfg: liveCfg,
|
|
3723
|
+
entries: liveAccountAllowlists.groupAllowFrom,
|
|
3724
|
+
failClosedOnUnresolved: true,
|
|
3725
|
+
startupResolvedEntries: groupAllowFromResolvedEntries,
|
|
3726
|
+
cache: liveGroupAllowlistCache,
|
|
3727
|
+
updateCache: (next) => {
|
|
3728
|
+
liveGroupAllowlistCache = next;
|
|
3729
|
+
}
|
|
3730
|
+
})
|
|
3731
|
+
};
|
|
3732
|
+
};
|
|
2383
3733
|
const readStoreAllowFrom = async () => {
|
|
2384
3734
|
const now = Date.now();
|
|
2385
3735
|
if (cachedStoreAllowFrom && isFutureDateTimestampMs(cachedStoreAllowFrom.expiresAtMs, { nowMs: now })) return cachedStoreAllowFrom.value;
|
|
@@ -2411,14 +3761,59 @@ function createMatrixRoomMessageHandler(params) {
|
|
|
2411
3761
|
}
|
|
2412
3762
|
return true;
|
|
2413
3763
|
};
|
|
3764
|
+
return {
|
|
3765
|
+
resolveLiveAccountAllowlists,
|
|
3766
|
+
readStoreAllowFrom,
|
|
3767
|
+
shouldSendPairingReply
|
|
3768
|
+
};
|
|
3769
|
+
}
|
|
3770
|
+
//#endregion
|
|
3771
|
+
//#region extensions/matrix/src/matrix/monitor/handler.ts
|
|
3772
|
+
function createMatrixRoomMessageHandler(params) {
|
|
3773
|
+
const { client, core, cfg, accountId, runtime, logger, logVerboseMessage, allowFromResolvedEntries = [], groupAllowFromResolvedEntries = [], configuredBotUserIds = /* @__PURE__ */ new Set(), groupPolicy, replyToMode, dmSessionScope, streaming, previewToolProgressEnabled, blockStreamingEnabled, textLimit, historyLimit, startupMs, startupGraceMs, dropPreStartupMessages, inboundDeduper, directTracker, getRoomInfo, getMemberDisplayName, resolveLiveUserAllowlist = resolveMatrixMonitorLiveUserAllowlist, resolveStorePath: resolveStorePathImpl = resolveStorePath, createChannelInboundEnvelopeBuilder: createChannelInboundEnvelopeBuilderImpl = createChannelInboundEnvelopeBuilder, finalizeInboundContext, resolveHumanDelayConfig: resolveHumanDelayConfigImpl = resolveHumanDelayConfig } = params;
|
|
3774
|
+
const handlerConfig = {
|
|
3775
|
+
...params,
|
|
3776
|
+
allowFromResolvedEntries,
|
|
3777
|
+
groupAllowFromResolvedEntries,
|
|
3778
|
+
configuredBotUserIds,
|
|
3779
|
+
resolveLiveUserAllowlist,
|
|
3780
|
+
resolveStorePath: resolveStorePathImpl,
|
|
3781
|
+
createChannelInboundEnvelopeBuilder: createChannelInboundEnvelopeBuilderImpl,
|
|
3782
|
+
resolveHumanDelayConfig: resolveHumanDelayConfigImpl
|
|
3783
|
+
};
|
|
3784
|
+
const contextVisibilityMode = resolveChannelContextVisibilityMode({
|
|
3785
|
+
cfg,
|
|
3786
|
+
channel: "matrix",
|
|
3787
|
+
accountId
|
|
3788
|
+
});
|
|
3789
|
+
const handlerState = createMatrixHandlerState({
|
|
3790
|
+
core,
|
|
3791
|
+
accountId,
|
|
3792
|
+
runtime,
|
|
3793
|
+
allowFromResolvedEntries,
|
|
3794
|
+
groupAllowFromResolvedEntries,
|
|
3795
|
+
resolveLiveUserAllowlist
|
|
3796
|
+
});
|
|
3797
|
+
const resolveThreadContext = createMatrixThreadContextResolver({
|
|
3798
|
+
client,
|
|
3799
|
+
getMemberDisplayName,
|
|
3800
|
+
logVerboseMessage
|
|
3801
|
+
});
|
|
3802
|
+
const resolveReplyContext = createMatrixReplyContextResolver({
|
|
3803
|
+
client,
|
|
3804
|
+
getMemberDisplayName,
|
|
3805
|
+
logVerboseMessage
|
|
3806
|
+
});
|
|
3807
|
+
const roomHistoryTracker = createRoomHistoryTracker();
|
|
3808
|
+
const roomIngressQueue = new KeyedAsyncQueue();
|
|
3809
|
+
const sharedDmContextNoticeRooms = /* @__PURE__ */ new Set();
|
|
2414
3810
|
const runRoomIngress = async (roomId, task) => {
|
|
2415
3811
|
return await roomIngressQueue.enqueue(roomId, task);
|
|
2416
3812
|
};
|
|
2417
3813
|
return async (roomId, event) => {
|
|
2418
3814
|
const eventId = typeof event.event_id === "string" ? event.event_id.trim() : "";
|
|
2419
3815
|
let inboundReplayClaim;
|
|
2420
|
-
let
|
|
2421
|
-
let draftConsumed = false;
|
|
3816
|
+
let draftControllerRef;
|
|
2422
3817
|
try {
|
|
2423
3818
|
const eventType = event.type;
|
|
2424
3819
|
if (eventType === EventType.RoomMessageEncrypted) return;
|
|
@@ -2433,568 +3828,59 @@ function createMatrixRoomMessageHandler(params) {
|
|
|
2433
3828
|
if (!senderId) return;
|
|
2434
3829
|
const eventTs = event.origin_server_ts;
|
|
2435
3830
|
const eventAge = event.unsigned?.age;
|
|
2436
|
-
const commitInboundEventIfClaimed = async () => {
|
|
2437
|
-
if (!inboundReplayClaim) return;
|
|
2438
|
-
await inboundReplayClaim.commit();
|
|
2439
|
-
inboundReplayClaim = void 0;
|
|
2440
|
-
};
|
|
2441
|
-
const readIngressPrefix = async () => {
|
|
2442
|
-
const selfUserId = await client.getUserId();
|
|
2443
|
-
if (senderId === selfUserId) return;
|
|
2444
|
-
if (dropPreStartupMessages) {
|
|
2445
|
-
if (typeof eventTs === "number" && eventTs < startupMs - startupGraceMs) return;
|
|
2446
|
-
if (typeof eventTs !== "number" && typeof eventAge === "number" && eventAge > startupGraceMs) return;
|
|
2447
|
-
}
|
|
2448
|
-
const content = event.content;
|
|
2449
|
-
if (eventType === EventType.RoomMessage && isMatrixVerificationRoomMessage({
|
|
2450
|
-
msgtype: content.msgtype,
|
|
2451
|
-
body: content.body
|
|
2452
|
-
})) {
|
|
2453
|
-
logVerboseMessage(`matrix: skip verification/system room message room=${roomId}`);
|
|
2454
|
-
return;
|
|
2455
|
-
}
|
|
2456
|
-
const locationPayload = resolveMatrixLocation({
|
|
2457
|
-
eventType,
|
|
2458
|
-
content
|
|
2459
|
-
});
|
|
2460
|
-
const relates = content["m.relates_to"];
|
|
2461
|
-
if (relates && "rel_type" in relates && relates.rel_type === RelationType.Replace) return;
|
|
2462
|
-
if (hasBundledMatrixReplacementRelation(event)) return;
|
|
2463
|
-
if (eventId && inboundDeduper) {
|
|
2464
|
-
const claim = await inboundDeduper.claim({
|
|
2465
|
-
roomId,
|
|
2466
|
-
eventId
|
|
2467
|
-
});
|
|
2468
|
-
if (claim.kind === "claimed") inboundReplayClaim = claim.handle;
|
|
2469
|
-
else if (claim.kind !== "invalid") {
|
|
2470
|
-
logVerboseMessage(`matrix: skip duplicate inbound event room=${roomId} id=${eventId}`);
|
|
2471
|
-
return;
|
|
2472
|
-
}
|
|
2473
|
-
}
|
|
2474
|
-
return {
|
|
2475
|
-
content,
|
|
2476
|
-
isDirectMessage: await directTracker.isDirectMessage({
|
|
2477
|
-
roomId,
|
|
2478
|
-
senderId,
|
|
2479
|
-
selfUserId
|
|
2480
|
-
}),
|
|
2481
|
-
locationPayload,
|
|
2482
|
-
selfUserId
|
|
2483
|
-
};
|
|
3831
|
+
const commitInboundEventIfClaimed = async () => {
|
|
3832
|
+
if (!inboundReplayClaim) return;
|
|
3833
|
+
await inboundReplayClaim.commit();
|
|
3834
|
+
inboundReplayClaim = void 0;
|
|
2484
3835
|
};
|
|
2485
|
-
const
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
const historyThreadId = threadRootId ? thread.threadId : void 0;
|
|
2503
|
-
let reservedHistorySlotConsumed = false;
|
|
2504
|
-
const discardReservedHistorySlot = () => {
|
|
2505
|
-
if (reservedHistorySlot && !reservedHistorySlotConsumed) {
|
|
2506
|
-
roomHistoryTracker.discardPending(roomId, reservedHistorySlot, historyThreadId);
|
|
2507
|
-
reservedHistorySlotConsumed = true;
|
|
2508
|
-
}
|
|
2509
|
-
};
|
|
2510
|
-
const commitInboundEventIfClaimedAndDiscardReserved = async () => {
|
|
2511
|
-
discardReservedHistorySlot();
|
|
2512
|
-
await commitInboundEventIfClaimed();
|
|
2513
|
-
};
|
|
2514
|
-
if (isRoom && groupPolicy === "disabled") {
|
|
2515
|
-
await commitInboundEventIfClaimedAndDiscardReserved();
|
|
2516
|
-
return;
|
|
3836
|
+
const readIngressPrefix = () => readMatrixIngressPrefix({
|
|
3837
|
+
client,
|
|
3838
|
+
senderId,
|
|
3839
|
+
dropPreStartupMessages,
|
|
3840
|
+
eventTs: eventTs ?? void 0,
|
|
3841
|
+
eventAge: eventAge ?? void 0,
|
|
3842
|
+
startupMs,
|
|
3843
|
+
startupGraceMs,
|
|
3844
|
+
event,
|
|
3845
|
+
eventType,
|
|
3846
|
+
eventId,
|
|
3847
|
+
inboundDeduper,
|
|
3848
|
+
roomId,
|
|
3849
|
+
logVerboseMessage,
|
|
3850
|
+
directTracker,
|
|
3851
|
+
claimInboundReplay: (handle) => {
|
|
3852
|
+
inboundReplayClaim = handle;
|
|
2517
3853
|
}
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
const
|
|
2521
|
-
|
|
3854
|
+
});
|
|
3855
|
+
const continueIngress = async (paramsLocal) => {
|
|
3856
|
+
const access = await resolveMatrixIngressAccess({
|
|
3857
|
+
handler: handlerConfig,
|
|
3858
|
+
params: paramsLocal,
|
|
2522
3859
|
roomId,
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
const roomConfig = roomConfigInfo?.config;
|
|
2526
|
-
const allowBotsMode = resolveMatrixAllowBotsMode(roomConfig?.allowBots ?? accountAllowBots);
|
|
2527
|
-
const isConfiguredBotSender = configuredBotUserIds.has(senderId);
|
|
2528
|
-
const roomMatchMeta = roomConfigInfo ? `matchKey=${roomConfigInfo.matchKey ?? "none"} matchSource=${roomConfigInfo.matchSource ?? "none"}` : "matchKey=none matchSource=none";
|
|
2529
|
-
if (isConfiguredBotSender && allowBotsMode === "off") {
|
|
2530
|
-
logVerboseMessage(`matrix: drop configured bot sender=${senderId} (allowBots=false${isDirectMessage ? "" : `, ${roomMatchMeta}`})`);
|
|
2531
|
-
await commitInboundEventIfClaimedAndDiscardReserved();
|
|
2532
|
-
return;
|
|
2533
|
-
}
|
|
2534
|
-
const botLoopProtection = isConfiguredBotSender && senderId !== selfUserId ? {
|
|
2535
|
-
scopeId: accountId,
|
|
2536
|
-
conversationId: roomId,
|
|
2537
|
-
senderId,
|
|
2538
|
-
receiverId: selfUserId,
|
|
2539
|
-
config: mergePairLoopGuardConfig(accountConfig?.botLoopProtection, roomConfig?.botLoopProtection),
|
|
2540
|
-
defaultsConfig: cfg.channels?.defaults?.botLoopProtection,
|
|
2541
|
-
defaultEnabled: true,
|
|
2542
|
-
nowMs: eventTs ?? void 0
|
|
2543
|
-
} : void 0;
|
|
2544
|
-
if (isRoom && roomConfig && !roomConfigInfo?.allowed) {
|
|
2545
|
-
logVerboseMessage(`matrix: room disabled room=${roomId} (${roomMatchMeta})`);
|
|
2546
|
-
await commitInboundEventIfClaimedAndDiscardReserved();
|
|
2547
|
-
return;
|
|
2548
|
-
}
|
|
2549
|
-
if (isRoom && groupPolicy === "allowlist") {
|
|
2550
|
-
if (!roomConfigInfo?.allowlistConfigured) {
|
|
2551
|
-
logVerboseMessage(`matrix: drop room message (no allowlist, ${roomMatchMeta})`);
|
|
2552
|
-
await commitInboundEventIfClaimedAndDiscardReserved();
|
|
2553
|
-
return;
|
|
2554
|
-
}
|
|
2555
|
-
if (!roomConfig) {
|
|
2556
|
-
logVerboseMessage(`matrix: drop room message (not in allowlist, ${roomMatchMeta})`);
|
|
2557
|
-
await commitInboundEventIfClaimedAndDiscardReserved();
|
|
2558
|
-
return;
|
|
2559
|
-
}
|
|
2560
|
-
}
|
|
2561
|
-
let senderNamePromise = null;
|
|
2562
|
-
const getSenderName = async () => {
|
|
2563
|
-
senderNamePromise ??= getMemberDisplayName(roomId, senderId).catch(() => senderId);
|
|
2564
|
-
return await senderNamePromise;
|
|
2565
|
-
};
|
|
2566
|
-
const storeAllowFrom = isDirectMessage && dmPolicy !== "allowlist" && dmPolicy !== "open" ? await readStoreAllowFrom() : [];
|
|
2567
|
-
const roomUsers = roomConfig?.users ?? [];
|
|
2568
|
-
const liveCfg = core.config.current();
|
|
2569
|
-
const liveAccountAllowlists = resolveMatrixAccountAllowlistConfig({
|
|
2570
|
-
cfg: liveCfg,
|
|
2571
|
-
accountId
|
|
2572
|
-
});
|
|
2573
|
-
const liveDmAllowFrom = await resolveCachedLiveAllowlist({
|
|
2574
|
-
cfg: liveCfg,
|
|
2575
|
-
entries: liveAccountAllowlists.dmAllowFrom,
|
|
2576
|
-
startupResolvedEntries: allowFromResolvedEntries,
|
|
2577
|
-
cache: liveDmAllowlistCache,
|
|
2578
|
-
updateCache: (next) => {
|
|
2579
|
-
liveDmAllowlistCache = next;
|
|
2580
|
-
}
|
|
2581
|
-
});
|
|
2582
|
-
const liveGroupAllowFrom = await resolveCachedLiveAllowlist({
|
|
2583
|
-
cfg: liveCfg,
|
|
2584
|
-
entries: liveAccountAllowlists.groupAllowFrom,
|
|
2585
|
-
failClosedOnUnresolved: true,
|
|
2586
|
-
startupResolvedEntries: groupAllowFromResolvedEntries,
|
|
2587
|
-
cache: liveGroupAllowlistCache,
|
|
2588
|
-
updateCache: (next) => {
|
|
2589
|
-
liveGroupAllowlistCache = next;
|
|
2590
|
-
}
|
|
2591
|
-
});
|
|
2592
|
-
const accessState = await resolveMatrixMonitorAccessState({
|
|
2593
|
-
allowFrom: liveDmAllowFrom,
|
|
2594
|
-
storeAllowFrom,
|
|
2595
|
-
dmPolicy,
|
|
2596
|
-
groupPolicy,
|
|
2597
|
-
groupAllowFrom: liveGroupAllowFrom,
|
|
2598
|
-
roomUsers,
|
|
3860
|
+
event,
|
|
3861
|
+
eventTs: eventTs ?? void 0,
|
|
2599
3862
|
senderId,
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
if (isDirectMessage) {
|
|
2607
|
-
if (!dmEnabled || dmPolicy === "disabled") {
|
|
2608
|
-
await commitInboundEventIfClaimedAndDiscardReserved();
|
|
2609
|
-
return;
|
|
2610
|
-
}
|
|
2611
|
-
const senderReason = messageIngress.senderAccess.reasonCode;
|
|
2612
|
-
if (ingressDecision.decision !== "allow") {
|
|
2613
|
-
if (ingressDecision.admission === "pairing-required") {
|
|
2614
|
-
const senderName = await getSenderName();
|
|
2615
|
-
const { code, created } = await core.channel.pairing.upsertPairingRequest({
|
|
2616
|
-
channel: "matrix",
|
|
2617
|
-
id: senderId,
|
|
2618
|
-
accountId,
|
|
2619
|
-
meta: { name: senderName }
|
|
2620
|
-
});
|
|
2621
|
-
if (shouldSendPairingReply(senderId, created)) {
|
|
2622
|
-
const pairingReply = core.channel.pairing.buildPairingReply({
|
|
2623
|
-
channel: "matrix",
|
|
2624
|
-
idLine: `Your Matrix user id: ${senderId}`,
|
|
2625
|
-
code
|
|
2626
|
-
});
|
|
2627
|
-
logVerboseMessage(created ? `matrix pairing request sender=${senderId} name=${senderName ?? "unknown"} (reason=${senderReason})` : `matrix pairing reminder sender=${senderId} name=${senderName ?? "unknown"} (reason=${senderReason})`);
|
|
2628
|
-
try {
|
|
2629
|
-
const { sendMessageMatrix } = await loadMatrixSendModule();
|
|
2630
|
-
await sendMessageMatrix(`room:${roomId}`, created ? pairingReply : `${pairingReply}\n\nPairing request is still pending approval. Reusing existing code.`, {
|
|
2631
|
-
client,
|
|
2632
|
-
cfg,
|
|
2633
|
-
accountId
|
|
2634
|
-
});
|
|
2635
|
-
await commitInboundEventIfClaimed();
|
|
2636
|
-
} catch (err) {
|
|
2637
|
-
logVerboseMessage(`matrix pairing reply failed for ${senderId}: ${String(err)}`);
|
|
2638
|
-
discardReservedHistorySlot();
|
|
2639
|
-
return;
|
|
2640
|
-
}
|
|
2641
|
-
} else {
|
|
2642
|
-
logVerboseMessage(`matrix pairing reminder suppressed sender=${senderId} (cooldown)`);
|
|
2643
|
-
await commitInboundEventIfClaimedAndDiscardReserved();
|
|
2644
|
-
}
|
|
2645
|
-
}
|
|
2646
|
-
if (isReactionEvent || dmPolicy !== "pairing") {
|
|
2647
|
-
logVerboseMessage(`matrix: blocked ${isReactionEvent ? "reaction" : "dm"} sender ${senderId} (dmPolicy=${dmPolicy}, reason=${senderReason})`);
|
|
2648
|
-
await commitInboundEventIfClaimedAndDiscardReserved();
|
|
2649
|
-
}
|
|
2650
|
-
return;
|
|
2651
|
-
}
|
|
2652
|
-
}
|
|
2653
|
-
if (isRoom && ingressDecision.decision !== "allow") {
|
|
2654
|
-
logVerboseMessage(`matrix: blocked sender ${senderId} (ingress=${ingressDecision.reasonCode}, ${roomMatchMeta})`);
|
|
2655
|
-
await commitInboundEventIfClaimedAndDiscardReserved();
|
|
2656
|
-
return;
|
|
2657
|
-
}
|
|
2658
|
-
if (isRoom) logVerboseMessage(`matrix: allow room ${roomId} (${roomMatchMeta})`);
|
|
2659
|
-
if (isReactionEvent) {
|
|
2660
|
-
const senderName = await getSenderName();
|
|
2661
|
-
const { handleInboundMatrixReaction } = await loadMatrixReactionEvents();
|
|
2662
|
-
await handleInboundMatrixReaction({
|
|
2663
|
-
client,
|
|
2664
|
-
core,
|
|
2665
|
-
cfg,
|
|
2666
|
-
accountId,
|
|
2667
|
-
roomId,
|
|
2668
|
-
event,
|
|
2669
|
-
senderId,
|
|
2670
|
-
senderLabel: senderName,
|
|
2671
|
-
selfUserId,
|
|
2672
|
-
isDirectMessage,
|
|
2673
|
-
logVerboseMessage
|
|
2674
|
-
});
|
|
2675
|
-
await commitInboundEventIfClaimedAndDiscardReserved();
|
|
2676
|
-
return;
|
|
2677
|
-
}
|
|
2678
|
-
let pollSnapshotPromise = null;
|
|
2679
|
-
const getPollSnapshot = async () => {
|
|
2680
|
-
if (!isPollEvent) return null;
|
|
2681
|
-
pollSnapshotPromise ??= fetchMatrixPollSnapshot(client, roomId, event).catch((err) => {
|
|
2682
|
-
logVerboseMessage(`matrix: failed resolving poll snapshot room=${roomId} id=${event.event_id ?? "unknown"}: ${String(err)}`);
|
|
2683
|
-
return null;
|
|
2684
|
-
});
|
|
2685
|
-
return await pollSnapshotPromise;
|
|
2686
|
-
};
|
|
2687
|
-
const mentionPrecheckText = resolveMatrixMentionPrecheckText({
|
|
2688
|
-
eventType,
|
|
2689
|
-
content,
|
|
2690
|
-
locationText: locationPayload?.text
|
|
3863
|
+
isReactionEvent,
|
|
3864
|
+
readStoreAllowFrom: handlerState.readStoreAllowFrom,
|
|
3865
|
+
shouldSendPairingReply: handlerState.shouldSendPairingReply,
|
|
3866
|
+
resolveLiveAccountAllowlists: handlerState.resolveLiveAccountAllowlists,
|
|
3867
|
+
roomHistoryTracker,
|
|
3868
|
+
commitInboundEventIfClaimed
|
|
2691
3869
|
});
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
const earlyContentSize = typeof earlyContentInfo?.size === "number" ? earlyContentInfo.size : void 0;
|
|
2698
|
-
const earlyContentBody = typeof content.body === "string" ? content.body.trim() : "";
|
|
2699
|
-
const earlyOriginalFilename = (typeof content.filename === "string" ? content.filename.trim() : "") || earlyContentBody || void 0;
|
|
2700
|
-
const pendingHistoryText = resolveMatrixPendingHistoryText({
|
|
2701
|
-
mentionPrecheckText,
|
|
2702
|
-
content,
|
|
2703
|
-
mediaUrl
|
|
2704
|
-
});
|
|
2705
|
-
const pendingHistoryPollText = !pendingHistoryText && isPollEvent && historyLimit > 0 ? (await getPollSnapshot())?.text : "";
|
|
2706
|
-
if (!mentionPrecheckText && !mediaUrl && !isPollEvent) {
|
|
2707
|
-
await commitInboundEventIfClaimedAndDiscardReserved();
|
|
2708
|
-
return;
|
|
2709
|
-
}
|
|
2710
|
-
let preflightMedia = null;
|
|
2711
|
-
let preflightMediaDownloadFailed = false;
|
|
2712
|
-
let preflightMediaSizeLimitExceeded = false;
|
|
2713
|
-
let preflightAudioTranscript;
|
|
2714
|
-
const { route: _route, configuredBinding: _configuredBinding, runtimeBindingId: _runtimeBindingId } = resolveMatrixInboundRoute({
|
|
2715
|
-
cfg,
|
|
2716
|
-
accountId,
|
|
3870
|
+
if (!access) return;
|
|
3871
|
+
return await resolveMatrixIngressContent({
|
|
3872
|
+
handler: handlerConfig,
|
|
3873
|
+
params: paramsLocal,
|
|
3874
|
+
access,
|
|
2717
3875
|
roomId,
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
threadId: thread.threadId,
|
|
3876
|
+
event,
|
|
3877
|
+
eventType,
|
|
3878
|
+
isPollEvent,
|
|
2722
3879
|
eventTs: eventTs ?? void 0,
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
const preflightAudioMediaUrl = mediaUrl?.startsWith("mxc://") ? mediaUrl : void 0;
|
|
2727
|
-
const shouldRunMatrixAudioPreflight = isMatrixAudioContent({
|
|
2728
|
-
msgtype: typeof content.msgtype === "string" ? content.msgtype : void 0,
|
|
2729
|
-
mimetype: earlyContentType
|
|
2730
|
-
}) && isMatrixAudioMediaEnabled(cfg) && preflightAudioMediaUrl !== void 0;
|
|
2731
|
-
if (shouldRunMatrixAudioPreflight && audioPreflightMode === "defer" && isRoom && historyLimit > 0 && !reservedHistorySlot) {
|
|
2732
|
-
const reserved = roomHistoryTracker.reservePending(_route.agentId, roomId, {
|
|
2733
|
-
sender: senderId,
|
|
2734
|
-
body: pendingHistoryText,
|
|
2735
|
-
timestamp: eventTs ?? void 0,
|
|
2736
|
-
messageId
|
|
2737
|
-
}, historyThreadId);
|
|
2738
|
-
return { deferredPrefix: {
|
|
2739
|
-
...paramsLocal,
|
|
2740
|
-
audioPreflightMode: "run",
|
|
2741
|
-
reservedHistorySlot: reserved
|
|
2742
|
-
} };
|
|
2743
|
-
}
|
|
2744
|
-
if (shouldRunMatrixAudioPreflight) {
|
|
2745
|
-
try {
|
|
2746
|
-
preflightMedia = await downloadMatrixMedia({
|
|
2747
|
-
client,
|
|
2748
|
-
mxcUrl: preflightAudioMediaUrl,
|
|
2749
|
-
contentType: earlyContentType,
|
|
2750
|
-
sizeBytes: earlyContentSize,
|
|
2751
|
-
maxBytes: mediaMaxBytes,
|
|
2752
|
-
file: contentFile,
|
|
2753
|
-
originalFilename: earlyOriginalFilename
|
|
2754
|
-
});
|
|
2755
|
-
} catch (err) {
|
|
2756
|
-
preflightMediaDownloadFailed = true;
|
|
2757
|
-
if (isMatrixMediaSizeLimitError(err)) preflightMediaSizeLimitExceeded = true;
|
|
2758
|
-
const errorText = formatMatrixErrorMessage(err);
|
|
2759
|
-
logVerboseMessage(`matrix: media download failed room=${roomId} id=${event.event_id ?? "unknown"} type=${content.msgtype} error=${errorText}`);
|
|
2760
|
-
logger.warn("matrix media download failed", {
|
|
2761
|
-
roomId,
|
|
2762
|
-
eventId: event.event_id,
|
|
2763
|
-
msgtype: content.msgtype,
|
|
2764
|
-
encrypted: Boolean(contentFile),
|
|
2765
|
-
error: errorText
|
|
2766
|
-
});
|
|
2767
|
-
}
|
|
2768
|
-
if (preflightMedia) preflightAudioTranscript = await resolveMatrixPreflightAudioTranscript({
|
|
2769
|
-
mediaPath: preflightMedia.path,
|
|
2770
|
-
mediaContentType: preflightMedia.contentType,
|
|
2771
|
-
cfg,
|
|
2772
|
-
accountId,
|
|
2773
|
-
chatType: isDirectMessage ? "direct" : "channel",
|
|
2774
|
-
originatingTo: `room:${roomId}`,
|
|
2775
|
-
messageThreadId: thread.threadId,
|
|
2776
|
-
sessionKey: _route.sessionKey
|
|
2777
|
-
});
|
|
2778
|
-
}
|
|
2779
|
-
const agentMentionRegexes = core.channel.mentions.buildMentionRegexes(cfg, _route.agentId, {
|
|
2780
|
-
provider: "matrix",
|
|
2781
|
-
conversationId: roomId,
|
|
2782
|
-
providerPolicy: accountConfig?.mentionPatterns
|
|
2783
|
-
});
|
|
2784
|
-
const selfDisplayName = content.formatted_body ? await getMemberDisplayName(roomId, selfUserId).catch(() => void 0) : void 0;
|
|
2785
|
-
const mentionPrecheckTextWithTranscript = preflightAudioTranscript ? [mentionPrecheckText, preflightAudioTranscript].filter(Boolean).join("\n").trim() : mentionPrecheckText;
|
|
2786
|
-
const { wasMentioned, hasExplicitMention } = resolveMentions({
|
|
2787
|
-
content,
|
|
2788
|
-
userId: selfUserId,
|
|
2789
|
-
displayName: selfDisplayName,
|
|
2790
|
-
text: mentionPrecheckTextWithTranscript,
|
|
2791
|
-
mentionRegexes: agentMentionRegexes
|
|
2792
|
-
});
|
|
2793
|
-
if (isConfiguredBotSender && allowBotsMode === "mentions" && !isDirectMessage && !wasMentioned) {
|
|
2794
|
-
logVerboseMessage(`matrix: drop configured bot sender=${senderId} (allowBots=mentions, missing mention, ${roomMatchMeta})`);
|
|
2795
|
-
await commitInboundEventIfClaimedAndDiscardReserved();
|
|
2796
|
-
return;
|
|
2797
|
-
}
|
|
2798
|
-
const allowTextCommands = core.channel.commands.shouldHandleTextCommands({
|
|
2799
|
-
cfg,
|
|
2800
|
-
surface: "matrix"
|
|
2801
|
-
});
|
|
2802
|
-
const useAccessGroups = true;
|
|
2803
|
-
const commandCheckText = stripMatrixMentionPrefix({
|
|
2804
|
-
text: mentionPrecheckText,
|
|
2805
|
-
userId: selfUserId,
|
|
2806
|
-
displayName: selfDisplayName,
|
|
2807
|
-
mentionRegexes: agentMentionRegexes
|
|
2808
|
-
});
|
|
2809
|
-
const hasControlCommandInMessage = core.channel.text.hasControlCommand(commandCheckText, cfg);
|
|
2810
|
-
const commandAccess = await resolveMatrixMonitorCommandAccess(accessState, {
|
|
2811
|
-
useAccessGroups,
|
|
2812
|
-
allowTextCommands,
|
|
2813
|
-
hasControlCommand: hasControlCommandInMessage
|
|
2814
|
-
});
|
|
2815
|
-
const commandAuthorized = commandAccess.authorized;
|
|
2816
|
-
if (isRoom && commandAccess.shouldBlockControlCommand) {
|
|
2817
|
-
logInboundDrop({
|
|
2818
|
-
log: logVerboseMessage,
|
|
2819
|
-
channel: "matrix",
|
|
2820
|
-
reason: "control command (unauthorized)",
|
|
2821
|
-
target: senderId
|
|
2822
|
-
});
|
|
2823
|
-
await commitInboundEventIfClaimedAndDiscardReserved();
|
|
2824
|
-
return;
|
|
2825
|
-
}
|
|
2826
|
-
const shouldRequireMention = isRoom ? roomConfig?.autoReply === true ? false : roomConfig?.autoReply === false ? true : typeof roomConfig?.requireMention === "boolean" ? roomConfig?.requireMention : true : false;
|
|
2827
|
-
const mentionDecision = resolveInboundMentionDecision({
|
|
2828
|
-
facts: {
|
|
2829
|
-
canDetectMention: true,
|
|
2830
|
-
wasMentioned,
|
|
2831
|
-
hasAnyMention: hasExplicitMention
|
|
2832
|
-
},
|
|
2833
|
-
policy: {
|
|
2834
|
-
isGroup: isRoom,
|
|
2835
|
-
requireMention: shouldRequireMention,
|
|
2836
|
-
allowTextCommands,
|
|
2837
|
-
hasControlCommand: hasControlCommandInMessage,
|
|
2838
|
-
commandAuthorized
|
|
2839
|
-
}
|
|
2840
|
-
});
|
|
2841
|
-
const { effectiveWasMentioned, shouldBypassMention } = mentionDecision;
|
|
2842
|
-
const canDetectMention = agentMentionRegexes.length > 0 || hasExplicitMention;
|
|
2843
|
-
if (mentionDecision.shouldSkip) {
|
|
2844
|
-
const pendingHistoryBody = preflightAudioTranscript ? formatMatrixAudioTranscript(preflightAudioTranscript) : pendingHistoryText || pendingHistoryPollText;
|
|
2845
|
-
if (historyLimit > 0 && pendingHistoryBody) {
|
|
2846
|
-
const pendingEntry = {
|
|
2847
|
-
sender: senderId,
|
|
2848
|
-
body: pendingHistoryBody,
|
|
2849
|
-
timestamp: eventTs ?? void 0,
|
|
2850
|
-
messageId
|
|
2851
|
-
};
|
|
2852
|
-
if (reservedHistorySlot) {
|
|
2853
|
-
roomHistoryTracker.finalizePending(roomId, reservedHistorySlot, pendingEntry, historyThreadId);
|
|
2854
|
-
reservedHistorySlotConsumed = true;
|
|
2855
|
-
} else roomHistoryTracker.recordPending(roomId, pendingEntry, historyThreadId);
|
|
2856
|
-
}
|
|
2857
|
-
logger.info("skipping room message", {
|
|
2858
|
-
roomId,
|
|
2859
|
-
reason: "no-mention"
|
|
2860
|
-
});
|
|
2861
|
-
await commitInboundEventIfClaimed();
|
|
2862
|
-
return;
|
|
2863
|
-
}
|
|
2864
|
-
if (preflightAudioTranscript) await sendMatrixPreflightAudioTranscriptEcho({
|
|
2865
|
-
transcript: preflightAudioTranscript,
|
|
2866
|
-
cfg,
|
|
2867
|
-
accountId,
|
|
2868
|
-
originatingTo: `room:${roomId}`,
|
|
2869
|
-
messageThreadId: thread.threadId
|
|
2870
|
-
});
|
|
2871
|
-
if (isPollEvent) {
|
|
2872
|
-
const pollSnapshot = await getPollSnapshot();
|
|
2873
|
-
if (!pollSnapshot) {
|
|
2874
|
-
discardReservedHistorySlot();
|
|
2875
|
-
return;
|
|
2876
|
-
}
|
|
2877
|
-
content = {
|
|
2878
|
-
msgtype: "m.text",
|
|
2879
|
-
body: pollSnapshot.text
|
|
2880
|
-
};
|
|
2881
|
-
}
|
|
2882
|
-
let media = preflightMedia;
|
|
2883
|
-
let mediaDownloadFailed = preflightMediaDownloadFailed;
|
|
2884
|
-
let mediaSizeLimitExceeded = preflightMediaSizeLimitExceeded;
|
|
2885
|
-
const finalContentUrl = "url" in content && typeof content.url === "string" ? content.url : void 0;
|
|
2886
|
-
const finalContentFile = "file" in content && content.file && typeof content.file === "object" ? content.file : void 0;
|
|
2887
|
-
const finalMediaUrl = finalContentUrl ?? finalContentFile?.url;
|
|
2888
|
-
const contentBody = typeof content.body === "string" ? content.body.trim() : "";
|
|
2889
|
-
const originalFilename = (typeof content.filename === "string" ? content.filename.trim() : "") || contentBody || void 0;
|
|
2890
|
-
const contentInfo = "info" in content && content.info && typeof content.info === "object" ? content.info : void 0;
|
|
2891
|
-
const contentType = contentInfo?.mimetype;
|
|
2892
|
-
const contentSize = typeof contentInfo?.size === "number" ? contentInfo.size : void 0;
|
|
2893
|
-
if (!media && !mediaDownloadFailed && finalMediaUrl?.startsWith("mxc://")) try {
|
|
2894
|
-
media = await downloadMatrixMedia({
|
|
2895
|
-
client,
|
|
2896
|
-
mxcUrl: finalMediaUrl,
|
|
2897
|
-
contentType,
|
|
2898
|
-
sizeBytes: contentSize,
|
|
2899
|
-
maxBytes: mediaMaxBytes,
|
|
2900
|
-
file: finalContentFile,
|
|
2901
|
-
originalFilename
|
|
2902
|
-
});
|
|
2903
|
-
} catch (err) {
|
|
2904
|
-
mediaDownloadFailed = true;
|
|
2905
|
-
if (isMatrixMediaSizeLimitError(err)) mediaSizeLimitExceeded = true;
|
|
2906
|
-
const errorText = formatMatrixErrorMessage(err);
|
|
2907
|
-
logVerboseMessage(`matrix: media download failed room=${roomId} id=${event.event_id ?? "unknown"} type=${content.msgtype} error=${errorText}`);
|
|
2908
|
-
logger.warn("matrix media download failed", {
|
|
2909
|
-
roomId,
|
|
2910
|
-
eventId: event.event_id,
|
|
2911
|
-
msgtype: content.msgtype,
|
|
2912
|
-
encrypted: Boolean(finalContentFile),
|
|
2913
|
-
error: errorText
|
|
2914
|
-
});
|
|
2915
|
-
}
|
|
2916
|
-
let bodyText = resolveMatrixInboundBodyText({
|
|
2917
|
-
rawBody: locationPayload?.text ?? contentBody,
|
|
2918
|
-
filename: typeof content.filename === "string" ? content.filename : void 0,
|
|
2919
|
-
mediaPlaceholder: media?.placeholder,
|
|
2920
|
-
msgtype: content.msgtype,
|
|
2921
|
-
hadMediaUrl: Boolean(finalMediaUrl),
|
|
2922
|
-
mediaDownloadFailed,
|
|
2923
|
-
mediaSizeLimitExceeded
|
|
3880
|
+
senderId,
|
|
3881
|
+
roomHistoryTracker,
|
|
3882
|
+
commitInboundEventIfClaimed
|
|
2924
3883
|
});
|
|
2925
|
-
if (preflightMedia && bodyText && bodyText !== preflightMedia.placeholder && isLikelyBareFilename(bodyText)) bodyText = preflightMedia.placeholder;
|
|
2926
|
-
if (preflightAudioTranscript) {
|
|
2927
|
-
const transcriptBody = formatMatrixAudioTranscript(preflightAudioTranscript);
|
|
2928
|
-
bodyText = !bodyText || bodyText === media?.placeholder ? transcriptBody : `${bodyText}\n${transcriptBody}`;
|
|
2929
|
-
}
|
|
2930
|
-
if (!bodyText) {
|
|
2931
|
-
await commitInboundEventIfClaimedAndDiscardReserved();
|
|
2932
|
-
return;
|
|
2933
|
-
}
|
|
2934
|
-
const commandBodyText = hasControlCommandInMessage ? commandCheckText : bodyText;
|
|
2935
|
-
const senderName = await getSenderName();
|
|
2936
|
-
if (_configuredBinding) {
|
|
2937
|
-
const { ensureConfiguredAcpBindingReady } = await loadAcpBindingRuntime();
|
|
2938
|
-
if (!(await ensureConfiguredAcpBindingReady({
|
|
2939
|
-
cfg,
|
|
2940
|
-
configuredBinding: _configuredBinding
|
|
2941
|
-
})).ok) {
|
|
2942
|
-
logInboundDrop({
|
|
2943
|
-
log: logVerboseMessage,
|
|
2944
|
-
channel: "matrix",
|
|
2945
|
-
reason: "configured ACP binding unavailable",
|
|
2946
|
-
target: _configuredBinding.spec.conversationId
|
|
2947
|
-
});
|
|
2948
|
-
discardReservedHistorySlot();
|
|
2949
|
-
return;
|
|
2950
|
-
}
|
|
2951
|
-
}
|
|
2952
|
-
if (_runtimeBindingId) {
|
|
2953
|
-
const { getSessionBindingService } = await loadSessionBindingRuntime();
|
|
2954
|
-
getSessionBindingService().touch(_runtimeBindingId, eventTs ?? void 0);
|
|
2955
|
-
}
|
|
2956
|
-
const preparedTrigger = isRoom && historyLimit > 0 ? reservedHistorySlot ? roomHistoryTracker.prepareReservedTrigger(_route.agentId, roomId, historyLimit, reservedHistorySlot, {
|
|
2957
|
-
sender: senderName,
|
|
2958
|
-
body: bodyText,
|
|
2959
|
-
timestamp: eventTs ?? void 0,
|
|
2960
|
-
messageId
|
|
2961
|
-
}, historyThreadId) : roomHistoryTracker.prepareTrigger(_route.agentId, roomId, historyLimit, {
|
|
2962
|
-
sender: senderName,
|
|
2963
|
-
body: bodyText,
|
|
2964
|
-
timestamp: eventTs ?? void 0,
|
|
2965
|
-
messageId
|
|
2966
|
-
}, historyThreadId) : void 0;
|
|
2967
|
-
if (reservedHistorySlot && preparedTrigger) reservedHistorySlotConsumed = true;
|
|
2968
|
-
return {
|
|
2969
|
-
route: _route,
|
|
2970
|
-
hasExplicitSessionBinding,
|
|
2971
|
-
roomConfig,
|
|
2972
|
-
isDirectMessage,
|
|
2973
|
-
isRoom,
|
|
2974
|
-
shouldRequireMention,
|
|
2975
|
-
wasMentioned,
|
|
2976
|
-
effectiveWasMentioned,
|
|
2977
|
-
shouldBypassMention,
|
|
2978
|
-
canDetectMention,
|
|
2979
|
-
commandAuthorized,
|
|
2980
|
-
inboundHistory: preparedTrigger ? buildInboundHistoryFromEntries({
|
|
2981
|
-
entries: preparedTrigger.history,
|
|
2982
|
-
limit: historyLimit
|
|
2983
|
-
}) : void 0,
|
|
2984
|
-
senderName,
|
|
2985
|
-
bodyText,
|
|
2986
|
-
commandBodyText,
|
|
2987
|
-
media,
|
|
2988
|
-
preflightAudioTranscript,
|
|
2989
|
-
locationPayload,
|
|
2990
|
-
messageId,
|
|
2991
|
-
triggerSnapshot: preparedTrigger,
|
|
2992
|
-
threadRootId,
|
|
2993
|
-
thread,
|
|
2994
|
-
botLoopProtection,
|
|
2995
|
-
effectiveGroupAllowFrom,
|
|
2996
|
-
effectiveRoomUsers
|
|
2997
|
-
};
|
|
2998
3884
|
};
|
|
2999
3885
|
const ingressResult = historyLimit > 0 ? await runRoomIngress(roomId, async () => {
|
|
3000
3886
|
const prefix = await readIngressPrefix();
|
|
@@ -3017,192 +3903,60 @@ function createMatrixRoomMessageHandler(params) {
|
|
|
3017
3903
|
if (!resolvedIngressResult) return;
|
|
3018
3904
|
if ("deferredPrefix" in resolvedIngressResult) return;
|
|
3019
3905
|
const { route: _route, hasExplicitSessionBinding, roomConfig, isDirectMessage, isRoom, shouldRequireMention, wasMentioned, effectiveWasMentioned, shouldBypassMention, canDetectMention, commandAuthorized, inboundHistory, senderName, bodyText, commandBodyText, media, preflightAudioTranscript, locationPayload, messageId, triggerSnapshot, threadRootId, thread, botLoopProtection, effectiveGroupAllowFrom, effectiveRoomUsers } = resolvedIngressResult;
|
|
3020
|
-
const
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
if (!isRoom || !contextSenderId) return true;
|
|
3024
|
-
if (effectiveRoomUsers.length > 0) return resolveMatrixAllowListMatch({
|
|
3025
|
-
allowList: effectiveRoomUsers,
|
|
3026
|
-
userId: contextSenderId
|
|
3027
|
-
}).allowed;
|
|
3028
|
-
if (groupPolicy === "allowlist" && effectiveGroupAllowFrom.length > 0) return resolveMatrixAllowListMatch({
|
|
3029
|
-
allowList: effectiveGroupAllowFrom,
|
|
3030
|
-
userId: contextSenderId
|
|
3031
|
-
}).allowed;
|
|
3032
|
-
return true;
|
|
3033
|
-
};
|
|
3034
|
-
const shouldIncludeRoomContextSender = (kind, contextSenderId) => evaluateSupplementalContextVisibility({
|
|
3035
|
-
mode: contextVisibilityMode,
|
|
3036
|
-
kind,
|
|
3037
|
-
senderAllowed: isRoomContextSenderAllowed(contextSenderId)
|
|
3038
|
-
}).include;
|
|
3039
|
-
let threadContext = threadRootId ? await resolveThreadContext({
|
|
3040
|
-
roomId,
|
|
3041
|
-
threadRootId
|
|
3042
|
-
}) : void 0;
|
|
3043
|
-
let threadContextBlockedByPolicy = false;
|
|
3044
|
-
if (threadContext?.senderId && !shouldIncludeRoomContextSender("thread", threadContext.senderId)) {
|
|
3045
|
-
logVerboseMessage(`matrix: drop thread root context (mode=${contextVisibilityMode})`);
|
|
3046
|
-
threadContextBlockedByPolicy = true;
|
|
3047
|
-
threadContext = void 0;
|
|
3048
|
-
}
|
|
3049
|
-
let replyContext;
|
|
3050
|
-
if (replyToEventId && replyToEventId === threadRootId && threadContext?.summary) replyContext = {
|
|
3051
|
-
replyToBody: threadContext.summary,
|
|
3052
|
-
replyToSender: threadContext.senderLabel,
|
|
3053
|
-
replyToSenderId: threadContext.senderId
|
|
3054
|
-
};
|
|
3055
|
-
else if (replyToEventId && replyToEventId === threadRootId && threadContextBlockedByPolicy) replyContext = await resolveReplyContext({
|
|
3056
|
-
roomId,
|
|
3057
|
-
eventId: replyToEventId
|
|
3058
|
-
});
|
|
3059
|
-
else replyContext = replyToEventId ? await resolveReplyContext({
|
|
3060
|
-
roomId,
|
|
3061
|
-
eventId: replyToEventId
|
|
3062
|
-
}) : void 0;
|
|
3063
|
-
const replySenderAllowed = !replyContext?.replyToSenderId || isRoomContextSenderAllowed(replyContext.replyToSenderId);
|
|
3064
|
-
const roomName = (isRoom ? await getRoomInfo(roomId) : void 0)?.name;
|
|
3065
|
-
const envelopeFrom = isDirectMessage ? senderName : roomName ?? roomId;
|
|
3066
|
-
const textWithId = `${bodyText}\n[matrix event id: ${messageId} room: ${roomId}]`;
|
|
3067
|
-
const storePath = resolveStorePathImpl(cfg.session?.store, { agentId: _route.agentId });
|
|
3068
|
-
const buildEnvelope = createChannelInboundEnvelopeBuilderImpl({
|
|
3906
|
+
const inboundContext = await resolveMatrixInboundContext({
|
|
3907
|
+
client,
|
|
3908
|
+
core,
|
|
3069
3909
|
cfg,
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
const sharedDmContextNotice = isDirectMessage ? hasExplicitSessionBinding ? null : resolveMatrixSharedDmContextNotice({
|
|
3074
|
-
storePath,
|
|
3075
|
-
sessionKey: sharedDmNoticeSessionKey,
|
|
3910
|
+
accountId,
|
|
3911
|
+
runtime,
|
|
3912
|
+
logVerboseMessage,
|
|
3076
3913
|
roomId,
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
contextVisibility: contextVisibilityMode,
|
|
3097
|
-
finalize: finalizeInboundContext,
|
|
3098
|
-
supplemental: {
|
|
3099
|
-
quote: replyContext ? {
|
|
3100
|
-
id: threadTarget ? void 0 : replyToEventId ?? void 0,
|
|
3101
|
-
body: replyContext.replyToBody,
|
|
3102
|
-
sender: replyContext.replyToSender,
|
|
3103
|
-
senderAllowed: replySenderAllowed
|
|
3104
|
-
} : void 0,
|
|
3105
|
-
thread: {
|
|
3106
|
-
starterBody: threadContext?.threadStarterBody,
|
|
3107
|
-
senderAllowed: threadContext ? true : void 0
|
|
3108
|
-
},
|
|
3109
|
-
groupSystemPrompt: isRoom ? groupSystemPrompt : void 0
|
|
3110
|
-
},
|
|
3111
|
-
media: toInboundMediaFacts(media ? [{
|
|
3112
|
-
path: media.path,
|
|
3113
|
-
url: media.path,
|
|
3114
|
-
contentType: media.contentType,
|
|
3115
|
-
transcribed: preflightAudioTranscript !== void 0
|
|
3116
|
-
}] : void 0),
|
|
3914
|
+
event,
|
|
3915
|
+
eventTs: eventTs ?? void 0,
|
|
3916
|
+
route: _route,
|
|
3917
|
+
isDirectMessage,
|
|
3918
|
+
isRoom,
|
|
3919
|
+
effectiveRoomUsers,
|
|
3920
|
+
groupPolicy,
|
|
3921
|
+
effectiveGroupAllowFrom,
|
|
3922
|
+
contextVisibilityMode,
|
|
3923
|
+
resolveThreadContext,
|
|
3924
|
+
resolveReplyContext,
|
|
3925
|
+
threadRootId,
|
|
3926
|
+
thread,
|
|
3927
|
+
getRoomInfo,
|
|
3928
|
+
senderId,
|
|
3929
|
+
senderName,
|
|
3930
|
+
bodyText,
|
|
3931
|
+
commandBodyText,
|
|
3932
|
+
roomConfig,
|
|
3117
3933
|
messageId,
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
sender: {
|
|
3121
|
-
id: senderId,
|
|
3122
|
-
name: senderName,
|
|
3123
|
-
username: senderId.split(":")[0]?.replace(/^@/, "")
|
|
3124
|
-
},
|
|
3125
|
-
conversation: {
|
|
3126
|
-
kind: isDirectMessage ? "direct" : "channel",
|
|
3127
|
-
id: roomId,
|
|
3128
|
-
label: envelopeFrom,
|
|
3129
|
-
nativeChannelId: roomId,
|
|
3130
|
-
threadId: threadTarget
|
|
3131
|
-
},
|
|
3132
|
-
route: {
|
|
3133
|
-
agentId: _route.agentId,
|
|
3134
|
-
dmScope: _route.dmScope,
|
|
3135
|
-
accountId: _route.accountId,
|
|
3136
|
-
routeSessionKey: _route.sessionKey
|
|
3137
|
-
},
|
|
3138
|
-
reply: {
|
|
3139
|
-
to: `room:${roomId}`,
|
|
3140
|
-
replyToId: threadTarget ? void 0 : replyToEventId ?? void 0,
|
|
3141
|
-
messageThreadId: threadTarget,
|
|
3142
|
-
nativeChannelId: roomId
|
|
3143
|
-
},
|
|
3144
|
-
message: {
|
|
3145
|
-
body,
|
|
3146
|
-
rawBody: bodyText,
|
|
3147
|
-
commandBody: commandBodyText,
|
|
3148
|
-
bodyForAgent: bodyText,
|
|
3149
|
-
inboundHistory: inboundHistory && inboundHistory.length > 0 ? inboundHistory : void 0
|
|
3150
|
-
},
|
|
3151
|
-
sessionTranscript: { historyLimit: isRoom ? historyLimit : 0 },
|
|
3152
|
-
access: {
|
|
3153
|
-
...isRoom ? { mentions: {
|
|
3154
|
-
canDetectMention: true,
|
|
3155
|
-
wasMentioned,
|
|
3156
|
-
requireMention: shouldRequireMention
|
|
3157
|
-
} } : {},
|
|
3158
|
-
commands: { authorized: commandAuthorized }
|
|
3159
|
-
},
|
|
3160
|
-
extra: {
|
|
3161
|
-
GroupSubject: isRoom ? roomName ?? roomId : void 0,
|
|
3162
|
-
GroupId: isRoom ? roomId : void 0,
|
|
3163
|
-
GroupChannel: isRoom ? roomId : void 0,
|
|
3164
|
-
...locationPayload?.context,
|
|
3165
|
-
CommandSource: "text",
|
|
3166
|
-
NativeDirectUserId: isDirectMessage ? senderId : void 0
|
|
3167
|
-
}
|
|
3168
|
-
});
|
|
3169
|
-
if (quoteHidden) logVerboseMessage(`matrix: drop reply context (mode=${contextVisibilityMode})`);
|
|
3170
|
-
const preview = truncateUtf16Safe(bodyText, 200).replace(/\n/g, "\\n");
|
|
3171
|
-
logVerboseMessage(`matrix inbound: room=${roomId} from=${senderId} preview="${preview}"`);
|
|
3172
|
-
const replyTarget = ctxPayload.To;
|
|
3173
|
-
if (!replyTarget) {
|
|
3174
|
-
runtime.error?.("matrix: missing reply target");
|
|
3175
|
-
return;
|
|
3176
|
-
}
|
|
3177
|
-
const { ackReaction, ackReactionScope: ackScope } = resolveMatrixAckReactionConfig({
|
|
3178
|
-
cfg,
|
|
3179
|
-
agentId: _route.agentId,
|
|
3180
|
-
accountId
|
|
3181
|
-
});
|
|
3182
|
-
const shouldAckReaction = () => Boolean(ackReaction && core.channel.reactions.shouldAckReaction({
|
|
3183
|
-
scope: ackScope,
|
|
3184
|
-
isDirect: isDirectMessage,
|
|
3185
|
-
isGroup: isRoom,
|
|
3186
|
-
isMentionableGroup: isRoom,
|
|
3187
|
-
requireMention: shouldRequireMention,
|
|
3188
|
-
canDetectMention,
|
|
3934
|
+
inboundHistory,
|
|
3935
|
+
wasMentioned,
|
|
3189
3936
|
effectiveWasMentioned,
|
|
3190
|
-
shouldBypassMention
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3937
|
+
shouldBypassMention,
|
|
3938
|
+
canDetectMention,
|
|
3939
|
+
shouldRequireMention,
|
|
3940
|
+
commandAuthorized,
|
|
3941
|
+
locationPayload,
|
|
3942
|
+
media,
|
|
3943
|
+
preflightAudioTranscript,
|
|
3944
|
+
historyLimit,
|
|
3945
|
+
hasExplicitSessionBinding,
|
|
3946
|
+
dmSessionScope,
|
|
3947
|
+
sharedDmContextNoticeRooms,
|
|
3948
|
+
resolveStorePath: resolveStorePathImpl,
|
|
3949
|
+
createChannelInboundEnvelopeBuilder: createChannelInboundEnvelopeBuilderImpl,
|
|
3950
|
+
finalizeInboundContext
|
|
3197
3951
|
});
|
|
3952
|
+
if (!inboundContext) return;
|
|
3953
|
+
const { replyToEventId, threadTarget, storePath, ctxPayload, replyTarget, sharedDmContextNotice } = inboundContext;
|
|
3198
3954
|
const tableMode = core.channel.text.resolveMarkdownTableMode({
|
|
3199
3955
|
cfg,
|
|
3200
3956
|
channel: "matrix",
|
|
3201
3957
|
accountId: _route.accountId
|
|
3202
3958
|
});
|
|
3203
3959
|
const mediaLocalRoots = getAgentScopedMediaLocalRoots(cfg, _route.agentId);
|
|
3204
|
-
let finalReplyDeliveryFailed = false;
|
|
3205
|
-
let nonFinalReplyDeliveryFailed = false;
|
|
3206
3960
|
const { onModelSelected, ...prefixOptions } = createReplyPrefixOptions({
|
|
3207
3961
|
cfg,
|
|
3208
3962
|
agentId: _route.agentId,
|
|
@@ -3237,431 +3991,49 @@ function createMatrixRoomMessageHandler(params) {
|
|
|
3237
3991
|
});
|
|
3238
3992
|
}
|
|
3239
3993
|
});
|
|
3240
|
-
const
|
|
3241
|
-
const
|
|
3242
|
-
const
|
|
3243
|
-
|
|
3244
|
-
|
|
3994
|
+
const hookRunner = getGlobalHookRunner();
|
|
3995
|
+
const allowProviderPreview = !((hookRunner?.hasHooks("reply_payload_sending") ?? false) || (hookRunner?.hasHooks("message_sending") ?? false));
|
|
3996
|
+
const draftController = await createMatrixDraftController({
|
|
3997
|
+
streaming: allowProviderPreview ? streaming : "off",
|
|
3998
|
+
previewToolProgressEnabled: allowProviderPreview && previewToolProgressEnabled,
|
|
3999
|
+
replyToMode,
|
|
4000
|
+
messageId,
|
|
4001
|
+
threadTarget,
|
|
4002
|
+
accountConfig: params.accountConfig,
|
|
4003
|
+
cfg,
|
|
4004
|
+
accountId: _route.accountId,
|
|
3245
4005
|
roomId,
|
|
3246
4006
|
client,
|
|
4007
|
+
logVerboseMessage
|
|
4008
|
+
});
|
|
4009
|
+
const { draftStream } = draftController;
|
|
4010
|
+
draftControllerRef = draftController;
|
|
4011
|
+
const replyDispatcher = createMatrixReplyDispatcher({
|
|
3247
4012
|
cfg,
|
|
3248
|
-
|
|
3249
|
-
threadId: threadTarget,
|
|
3250
|
-
replyToId: draftReplyToId,
|
|
3251
|
-
preserveReplyId: replyToMode === "all",
|
|
3252
|
-
accountId: _route.accountId,
|
|
3253
|
-
log: logVerboseMessage
|
|
3254
|
-
})) : void 0;
|
|
3255
|
-
draftStreamRef = draftStream;
|
|
3256
|
-
const shouldStreamPreviewToolProgress = Boolean(draftStream) && previewToolProgressEnabled;
|
|
3257
|
-
const shouldSuppressDefaultToolProgressMessages = Boolean(draftStream) && (shouldStreamPreviewToolProgress || params.streaming === "progress");
|
|
3258
|
-
let currentDraftMessageGeneration = 0;
|
|
3259
|
-
let currentDraftBlockOffset = 0;
|
|
3260
|
-
let latestDraftFullText = "";
|
|
3261
|
-
const pendingDraftBoundaries = [];
|
|
3262
|
-
const latestQueuedDraftBoundaryOffsets = /* @__PURE__ */ new Map();
|
|
3263
|
-
let currentDraftReplyToId = draftReplyToId;
|
|
3264
|
-
let previewToolProgressSuppressed = false;
|
|
3265
|
-
let previewToolProgressLines = [];
|
|
3266
|
-
let latestPlan;
|
|
3267
|
-
let latestPlanExplanation;
|
|
3268
|
-
const progressConfigEntry = params.accountConfig ?? cfg.channels?.matrix;
|
|
3269
|
-
const progressSeed = `${_route.accountId}:${roomId}`;
|
|
3270
|
-
const renderProgressDraft = () => {
|
|
3271
|
-
if (!draftStream) return;
|
|
3272
|
-
const previewText = formatChannelProgressDraftText({
|
|
3273
|
-
entry: progressConfigEntry,
|
|
3274
|
-
lines: previewToolProgressLines,
|
|
3275
|
-
seed: progressSeed,
|
|
3276
|
-
formatLine: formatMatrixToolProgressMarkdownCode,
|
|
3277
|
-
bullet: "-",
|
|
3278
|
-
narration: latestPlanExplanation,
|
|
3279
|
-
plan: latestPlan
|
|
3280
|
-
});
|
|
3281
|
-
if (!previewText) return;
|
|
3282
|
-
draftStream.update(previewText);
|
|
3283
|
-
};
|
|
3284
|
-
const progressDraftGate = createChannelProgressDraftGate({ onStart: renderProgressDraft });
|
|
3285
|
-
const pushPreviewToolProgress = async (line, options) => {
|
|
3286
|
-
if (!draftStream) return;
|
|
3287
|
-
if (options?.toolName !== void 0 && !isChannelProgressDraftWorkToolName(options.toolName)) return;
|
|
3288
|
-
const normalized = normalizeChannelProgressDraftLineIdentity(line);
|
|
3289
|
-
const progressLine = typeof line === "object" && line !== void 0 ? line : normalized;
|
|
3290
|
-
if (!progressDraftStreaming) {
|
|
3291
|
-
if (!shouldStreamPreviewToolProgress || previewToolProgressSuppressed || !normalized) return;
|
|
3292
|
-
const nextLines = mergeChannelProgressDraftLine(previewToolProgressLines, progressLine, { maxLines: resolveChannelProgressDraftMaxLines(progressConfigEntry) });
|
|
3293
|
-
if (nextLines === previewToolProgressLines) return;
|
|
3294
|
-
previewToolProgressLines = nextLines;
|
|
3295
|
-
draftStream.update(formatChannelProgressDraftText({
|
|
3296
|
-
entry: progressConfigEntry,
|
|
3297
|
-
lines: previewToolProgressLines,
|
|
3298
|
-
seed: progressSeed,
|
|
3299
|
-
formatLine: formatMatrixToolProgressMarkdownCode,
|
|
3300
|
-
bullet: "-",
|
|
3301
|
-
narration: latestPlanExplanation,
|
|
3302
|
-
plan: latestPlan
|
|
3303
|
-
}));
|
|
3304
|
-
return;
|
|
3305
|
-
}
|
|
3306
|
-
if (shouldStreamPreviewToolProgress && !previewToolProgressSuppressed && normalized) previewToolProgressLines = mergeChannelProgressDraftLine(previewToolProgressLines, progressLine, { maxLines: resolveChannelProgressDraftMaxLines(progressConfigEntry) });
|
|
3307
|
-
const alreadyStarted = progressDraftGate.hasStarted;
|
|
3308
|
-
const progressActive = await progressDraftGate.noteWork();
|
|
3309
|
-
if ((alreadyStarted || progressActive) && progressDraftGate.hasStarted) renderProgressDraft();
|
|
3310
|
-
};
|
|
3311
|
-
const pushPlanProgress = async (steps, explanation) => {
|
|
3312
|
-
latestPlan = steps?.length ? steps.map((entry) => ({ ...entry })) : void 0;
|
|
3313
|
-
latestPlanExplanation = explanation?.replace(/\s+/g, " ").trim() || void 0;
|
|
3314
|
-
if (!draftStream || previewToolProgressSuppressed) return;
|
|
3315
|
-
if (!progressDraftStreaming) {
|
|
3316
|
-
renderProgressDraft();
|
|
3317
|
-
return;
|
|
3318
|
-
}
|
|
3319
|
-
const alreadyStarted = progressDraftGate.hasStarted;
|
|
3320
|
-
await progressDraftGate.startNow();
|
|
3321
|
-
if (alreadyStarted && progressDraftGate.hasStarted) renderProgressDraft();
|
|
3322
|
-
};
|
|
3323
|
-
const suppressPreviewToolProgressForAnswerText = (text) => {
|
|
3324
|
-
if (!text?.trim()) return;
|
|
3325
|
-
previewToolProgressSuppressed = true;
|
|
3326
|
-
previewToolProgressLines = [];
|
|
3327
|
-
latestPlan = void 0;
|
|
3328
|
-
latestPlanExplanation = void 0;
|
|
3329
|
-
};
|
|
3330
|
-
const resetPreviewToolProgress = () => {
|
|
3331
|
-
previewToolProgressSuppressed = false;
|
|
3332
|
-
previewToolProgressLines = [];
|
|
3333
|
-
latestPlan = void 0;
|
|
3334
|
-
latestPlanExplanation = void 0;
|
|
3335
|
-
};
|
|
3336
|
-
const buildPreviewToolProgressReplyOptions = () => {
|
|
3337
|
-
if (!shouldSuppressDefaultToolProgressMessages) return {};
|
|
3338
|
-
const options = { suppressDefaultToolProgressMessages: true };
|
|
3339
|
-
if (!shouldStreamPreviewToolProgress) return options;
|
|
3340
|
-
return {
|
|
3341
|
-
...options,
|
|
3342
|
-
onToolStart: async (payload) => {
|
|
3343
|
-
const toolName = payload.name?.trim();
|
|
3344
|
-
await pushPreviewToolProgress(buildChannelProgressDraftLineForEntry(progressConfigEntry, {
|
|
3345
|
-
event: "tool",
|
|
3346
|
-
itemId: payload.itemId,
|
|
3347
|
-
toolCallId: payload.toolCallId,
|
|
3348
|
-
name: toolName,
|
|
3349
|
-
phase: payload.phase,
|
|
3350
|
-
args: payload.args
|
|
3351
|
-
}, payload.detailMode ? { detailMode: payload.detailMode } : void 0), { toolName });
|
|
3352
|
-
},
|
|
3353
|
-
onItemEvent: async (payload) => {
|
|
3354
|
-
await pushPreviewToolProgress(buildChannelProgressDraftLineForEntry(progressConfigEntry, {
|
|
3355
|
-
event: "item",
|
|
3356
|
-
itemId: payload.itemId,
|
|
3357
|
-
toolCallId: payload.toolCallId,
|
|
3358
|
-
itemKind: payload.kind,
|
|
3359
|
-
title: payload.title,
|
|
3360
|
-
name: payload.name,
|
|
3361
|
-
phase: payload.phase,
|
|
3362
|
-
status: payload.status,
|
|
3363
|
-
summary: payload.summary,
|
|
3364
|
-
progressText: payload.progressText,
|
|
3365
|
-
meta: payload.meta
|
|
3366
|
-
}));
|
|
3367
|
-
},
|
|
3368
|
-
onPlanUpdate: async (payload) => {
|
|
3369
|
-
if (payload.phase !== "update") return;
|
|
3370
|
-
await pushPlanProgress(payload.steps, payload.explanation);
|
|
3371
|
-
},
|
|
3372
|
-
onApprovalEvent: async (payload) => {
|
|
3373
|
-
if (payload.phase !== "requested") return;
|
|
3374
|
-
await pushPreviewToolProgress(formatChannelProgressDraftLine({
|
|
3375
|
-
event: "approval",
|
|
3376
|
-
phase: payload.phase,
|
|
3377
|
-
title: payload.title,
|
|
3378
|
-
command: payload.command,
|
|
3379
|
-
reason: payload.reason,
|
|
3380
|
-
message: payload.message
|
|
3381
|
-
}));
|
|
3382
|
-
},
|
|
3383
|
-
onCommandOutput: async (payload) => {
|
|
3384
|
-
if (payload.phase !== "end") return;
|
|
3385
|
-
await pushPreviewToolProgress(buildChannelProgressDraftLineForEntry(progressConfigEntry, {
|
|
3386
|
-
event: "command-output",
|
|
3387
|
-
itemId: payload.itemId,
|
|
3388
|
-
toolCallId: payload.toolCallId,
|
|
3389
|
-
phase: payload.phase,
|
|
3390
|
-
title: payload.title,
|
|
3391
|
-
name: payload.name,
|
|
3392
|
-
status: payload.status,
|
|
3393
|
-
exitCode: payload.exitCode
|
|
3394
|
-
}));
|
|
3395
|
-
},
|
|
3396
|
-
onPatchSummary: async (payload) => {
|
|
3397
|
-
if (payload.phase !== "end") return;
|
|
3398
|
-
await pushPreviewToolProgress(buildChannelProgressDraftLineForEntry(progressConfigEntry, {
|
|
3399
|
-
event: "patch",
|
|
3400
|
-
itemId: payload.itemId,
|
|
3401
|
-
toolCallId: payload.toolCallId,
|
|
3402
|
-
phase: payload.phase,
|
|
3403
|
-
title: payload.title,
|
|
3404
|
-
name: payload.name,
|
|
3405
|
-
added: payload.added,
|
|
3406
|
-
modified: payload.modified,
|
|
3407
|
-
deleted: payload.deleted,
|
|
3408
|
-
summary: payload.summary
|
|
3409
|
-
}));
|
|
3410
|
-
}
|
|
3411
|
-
};
|
|
3412
|
-
};
|
|
3413
|
-
const getDisplayableDraftText = () => {
|
|
3414
|
-
const nextDraftBoundaryOffset = pendingDraftBoundaries.find((boundary) => boundary.messageGeneration === currentDraftMessageGeneration)?.endOffset;
|
|
3415
|
-
if (nextDraftBoundaryOffset === void 0) return latestDraftFullText.slice(currentDraftBlockOffset);
|
|
3416
|
-
return latestDraftFullText.slice(currentDraftBlockOffset, nextDraftBoundaryOffset);
|
|
3417
|
-
};
|
|
3418
|
-
const updateDraftFromLatestFullText = () => {
|
|
3419
|
-
const blockText = getDisplayableDraftText();
|
|
3420
|
-
if (blockText) draftStream?.update(blockText);
|
|
3421
|
-
};
|
|
3422
|
-
const queueDraftBlockBoundary = (payload, context) => {
|
|
3423
|
-
const payloadTextLength = payload.text?.length ?? 0;
|
|
3424
|
-
const messageGeneration = context?.assistantMessageIndex ?? currentDraftMessageGeneration;
|
|
3425
|
-
const nextDraftBoundaryOffset = (latestQueuedDraftBoundaryOffsets.get(messageGeneration) ?? 0) + payloadTextLength;
|
|
3426
|
-
latestQueuedDraftBoundaryOffsets.set(messageGeneration, nextDraftBoundaryOffset);
|
|
3427
|
-
pendingDraftBoundaries.push({
|
|
3428
|
-
messageGeneration,
|
|
3429
|
-
endOffset: nextDraftBoundaryOffset
|
|
3430
|
-
});
|
|
3431
|
-
};
|
|
3432
|
-
const advanceDraftBlockBoundary = (options) => {
|
|
3433
|
-
const completedBoundary = pendingDraftBoundaries.shift();
|
|
3434
|
-
if (completedBoundary) {
|
|
3435
|
-
if (!pendingDraftBoundaries.some((entry) => entry.messageGeneration === completedBoundary.messageGeneration)) latestQueuedDraftBoundaryOffsets.delete(completedBoundary.messageGeneration);
|
|
3436
|
-
if (completedBoundary.messageGeneration === currentDraftMessageGeneration) currentDraftBlockOffset = completedBoundary.endOffset;
|
|
3437
|
-
return;
|
|
3438
|
-
}
|
|
3439
|
-
if (options?.fallbackToLatestEnd) currentDraftBlockOffset = latestDraftFullText.length;
|
|
3440
|
-
};
|
|
3441
|
-
const resetDraftBlockOffsets = () => {
|
|
3442
|
-
currentDraftMessageGeneration += 1;
|
|
3443
|
-
currentDraftBlockOffset = 0;
|
|
3444
|
-
latestDraftFullText = "";
|
|
3445
|
-
};
|
|
3446
|
-
const resetDraftDeliveryState = async () => {
|
|
3447
|
-
await draftStream?.discardPending();
|
|
3448
|
-
draftStream?.reset();
|
|
3449
|
-
draftConsumed = false;
|
|
3450
|
-
currentDraftMessageGeneration = 0;
|
|
3451
|
-
currentDraftBlockOffset = 0;
|
|
3452
|
-
latestDraftFullText = "";
|
|
3453
|
-
pendingDraftBoundaries.length = 0;
|
|
3454
|
-
latestQueuedDraftBoundaryOffsets.clear();
|
|
3455
|
-
currentDraftReplyToId = draftReplyToId;
|
|
3456
|
-
progressDraftGate.reset();
|
|
3457
|
-
resetPreviewToolProgress();
|
|
3458
|
-
};
|
|
3459
|
-
const { deliver: deliverReply, onError: onReplyError, ...turnDispatcherOptions } = {
|
|
3460
|
-
...prefixOptions,
|
|
4013
|
+
prefixOptions,
|
|
3461
4014
|
humanDelay: resolveHumanDelayConfigImpl(cfg, _route.agentId),
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
|
|
3470
|
-
|
|
3471
|
-
|
|
3472
|
-
|
|
3473
|
-
|
|
3474
|
-
|
|
3475
|
-
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
|
|
3479
|
-
replyToMode,
|
|
3480
|
-
threadId: threadTarget,
|
|
3481
|
-
replyToId: threadTarget ?? replyToEventId ?? void 0,
|
|
3482
|
-
accountId: _route.accountId,
|
|
3483
|
-
mediaLocalRoots,
|
|
3484
|
-
tableMode
|
|
3485
|
-
});
|
|
3486
|
-
return;
|
|
3487
|
-
}
|
|
3488
|
-
const payloadReplyToId = normalizeOptionalString(payload.replyToId);
|
|
3489
|
-
const payloadReplyMismatch = replyToMode !== "off" && !threadTarget && payloadReplyToId !== currentDraftReplyToId;
|
|
3490
|
-
let mustDeliverFinalNormally = draftStream.mustDeliverFinalNormally();
|
|
3491
|
-
if (Boolean(payload.text?.trim()) && !payload.isError && !payloadReplyMismatch && !mustDeliverFinalNormally) {
|
|
3492
|
-
await draftStream.stop();
|
|
3493
|
-
mustDeliverFinalNormally = draftStream.mustDeliverFinalNormally();
|
|
3494
|
-
} else await draftStream.discardPending();
|
|
3495
|
-
const draftEventId = draftStream.eventId();
|
|
3496
|
-
const draftFinalTextNeedsNormalMentionDelivery = Boolean(draftEventId) && typeof payload.text === "string" && Boolean(payload.text.trim()) && !payload.isError && !payloadReplyMismatch && !mustDeliverFinalNormally && await matrixTextWouldActivateMentions(client, payload.text);
|
|
3497
|
-
if (draftEventId && payload.text && !payload.isError && !hasMedia && !payloadReplyMismatch && !mustDeliverFinalNormally && !draftFinalTextNeedsNormalMentionDelivery) {
|
|
3498
|
-
const finalPreviewText = payload.text;
|
|
3499
|
-
await deliverWithFinalizableLivePreviewAdapter({
|
|
3500
|
-
kind: "final",
|
|
3501
|
-
payload,
|
|
3502
|
-
adapter: defineFinalizableLivePreviewAdapter({
|
|
3503
|
-
draft: {
|
|
3504
|
-
flush: async () => {},
|
|
3505
|
-
clear: async () => {},
|
|
3506
|
-
discardPending: async () => {},
|
|
3507
|
-
id: () => draftEventId
|
|
3508
|
-
},
|
|
3509
|
-
buildFinalEdit: () => ({
|
|
3510
|
-
text: finalPreviewText,
|
|
3511
|
-
finalizeLive: !(quietDraftStreaming || !draftStream.matchesPreparedText(finalPreviewText)),
|
|
3512
|
-
...quietDraftStreaming ? { extraContent: buildMatrixFinalizedPreviewContent() } : {}
|
|
3513
|
-
}),
|
|
3514
|
-
editFinal: async (_draftEventId, edit) => {
|
|
3515
|
-
if (edit.finalizeLive) {
|
|
3516
|
-
if (!await draftStream.finalizeLive()) throw new Error("Matrix draft live finalize failed");
|
|
3517
|
-
return;
|
|
3518
|
-
}
|
|
3519
|
-
const { editMessageMatrix } = await loadMatrixSendModule();
|
|
3520
|
-
await editMessageMatrix(roomId, _draftEventId, edit.text, {
|
|
3521
|
-
client,
|
|
3522
|
-
cfg,
|
|
3523
|
-
threadId: threadTarget,
|
|
3524
|
-
accountId: _route.accountId,
|
|
3525
|
-
extraContent: edit.extraContent
|
|
3526
|
-
});
|
|
3527
|
-
},
|
|
3528
|
-
createPreviewReceipt: (id) => createPreviewMessageReceipt({
|
|
3529
|
-
id,
|
|
3530
|
-
...threadTarget ? { threadId: threadTarget } : {},
|
|
3531
|
-
...currentDraftReplyToId ? { replyToId: currentDraftReplyToId } : {}
|
|
3532
|
-
}),
|
|
3533
|
-
logPreviewEditFailure: (err) => {
|
|
3534
|
-
logVerboseMessage(`matrix: preview final edit failed: ${String(err)}`);
|
|
3535
|
-
}
|
|
3536
|
-
}),
|
|
3537
|
-
deliverNormally: async () => {
|
|
3538
|
-
await redactMatrixDraftEvent(client, roomId, draftEventId);
|
|
3539
|
-
await deliverMatrixReplies({
|
|
3540
|
-
cfg,
|
|
3541
|
-
replies: [fallbackPayload],
|
|
3542
|
-
roomId,
|
|
3543
|
-
client,
|
|
3544
|
-
runtime,
|
|
3545
|
-
textLimit,
|
|
3546
|
-
replyToMode,
|
|
3547
|
-
threadId: threadTarget,
|
|
3548
|
-
replyToId: threadTarget ?? replyToEventId ?? void 0,
|
|
3549
|
-
accountId: _route.accountId,
|
|
3550
|
-
mediaLocalRoots,
|
|
3551
|
-
tableMode
|
|
3552
|
-
});
|
|
3553
|
-
}
|
|
3554
|
-
});
|
|
3555
|
-
draftConsumed = true;
|
|
3556
|
-
} else if (draftEventId && hasMedia && !payloadReplyMismatch) {
|
|
3557
|
-
let textEditOk = !mustDeliverFinalNormally;
|
|
3558
|
-
const payloadText = payload.text ?? ttsSupplement?.spokenText;
|
|
3559
|
-
const payloadTextMatchesDraft = typeof payloadText === "string" && draftStream.matchesPreparedText(payloadText);
|
|
3560
|
-
const reusesDraftTextUnchanged = typeof payloadText === "string" && Boolean(payloadText.trim()) && payloadTextMatchesDraft;
|
|
3561
|
-
const mediaTextNeedsNormalMentionDelivery = typeof payloadText === "string" && Boolean(payloadText.trim()) && await matrixTextWouldActivateMentions(client, payloadText);
|
|
3562
|
-
const requiresFinalTextEdit = quietDraftStreaming || typeof payloadText === "string" && !payloadTextMatchesDraft;
|
|
3563
|
-
if (textEditOk && mediaTextNeedsNormalMentionDelivery) textEditOk = false;
|
|
3564
|
-
else if (textEditOk && payloadText && requiresFinalTextEdit) {
|
|
3565
|
-
const { editMessageMatrix } = await loadMatrixSendModule();
|
|
3566
|
-
textEditOk = await editMessageMatrix(roomId, draftEventId, payloadText, {
|
|
3567
|
-
client,
|
|
3568
|
-
cfg,
|
|
3569
|
-
threadId: threadTarget,
|
|
3570
|
-
accountId: _route.accountId,
|
|
3571
|
-
extraContent: quietDraftStreaming ? buildMatrixFinalizedPreviewContent() : void 0
|
|
3572
|
-
}).then(() => true, () => false);
|
|
3573
|
-
} else if (textEditOk && reusesDraftTextUnchanged) textEditOk = await draftStream.finalizeLive();
|
|
3574
|
-
const reusesDraftAsFinalText = Boolean(payloadText?.trim()) && textEditOk;
|
|
3575
|
-
if (!reusesDraftAsFinalText) await redactMatrixDraftEvent(client, roomId, draftEventId);
|
|
3576
|
-
const mediaPayload = ttsSupplement && reusesDraftAsFinalText ? buildTtsSupplementMediaPayload(payload) : {
|
|
3577
|
-
...payload,
|
|
3578
|
-
text: reusesDraftAsFinalText ? void 0 : payload.text ?? (ttsSupplement?.visibleTextAlreadyDelivered === true ? void 0 : ttsSupplement?.spokenText)
|
|
3579
|
-
};
|
|
3580
|
-
await deliverMatrixReplies({
|
|
3581
|
-
cfg,
|
|
3582
|
-
replies: [mediaPayload],
|
|
3583
|
-
roomId,
|
|
3584
|
-
client,
|
|
3585
|
-
runtime,
|
|
3586
|
-
textLimit,
|
|
3587
|
-
replyToMode,
|
|
3588
|
-
threadId: threadTarget,
|
|
3589
|
-
replyToId: threadTarget ?? replyToEventId ?? void 0,
|
|
3590
|
-
accountId: _route.accountId,
|
|
3591
|
-
mediaLocalRoots,
|
|
3592
|
-
tableMode
|
|
3593
|
-
});
|
|
3594
|
-
draftConsumed = true;
|
|
3595
|
-
} else {
|
|
3596
|
-
const draftRedacted = Boolean(draftEventId) && (payload.isError || payloadReplyMismatch || mustDeliverFinalNormally || draftFinalTextNeedsNormalMentionDelivery);
|
|
3597
|
-
if (draftRedacted && draftEventId) await redactMatrixDraftEvent(client, roomId, draftEventId);
|
|
3598
|
-
const deliveredFallback = await deliverMatrixReplies({
|
|
3599
|
-
cfg,
|
|
3600
|
-
replies: [fallbackPayload],
|
|
3601
|
-
roomId,
|
|
3602
|
-
client,
|
|
3603
|
-
runtime,
|
|
3604
|
-
textLimit,
|
|
3605
|
-
replyToMode,
|
|
3606
|
-
threadId: threadTarget,
|
|
3607
|
-
replyToId: threadTarget ?? replyToEventId ?? void 0,
|
|
3608
|
-
accountId: _route.accountId,
|
|
3609
|
-
mediaLocalRoots,
|
|
3610
|
-
tableMode
|
|
3611
|
-
});
|
|
3612
|
-
if (draftRedacted || deliveredFallback) draftConsumed = true;
|
|
3613
|
-
}
|
|
3614
|
-
if (info.kind === "block") {
|
|
3615
|
-
draftConsumed = false;
|
|
3616
|
-
advanceDraftBlockBoundary({ fallbackToLatestEnd: true });
|
|
3617
|
-
draftStream.reset();
|
|
3618
|
-
currentDraftReplyToId = replyToMode === "all" ? draftReplyToId : void 0;
|
|
3619
|
-
updateDraftFromLatestFullText();
|
|
3620
|
-
const { sendTypingMatrix } = await loadMatrixSendModule();
|
|
3621
|
-
await sendTypingMatrix(roomId, true, void 0, client).catch(() => {});
|
|
3622
|
-
}
|
|
3623
|
-
} else await deliverMatrixReplies({
|
|
3624
|
-
cfg,
|
|
3625
|
-
replies: [payload],
|
|
3626
|
-
roomId,
|
|
3627
|
-
client,
|
|
3628
|
-
runtime,
|
|
3629
|
-
textLimit,
|
|
3630
|
-
replyToMode,
|
|
3631
|
-
threadId: threadTarget,
|
|
3632
|
-
replyToId: threadTarget ?? replyToEventId ?? void 0,
|
|
3633
|
-
accountId: _route.accountId,
|
|
3634
|
-
mediaLocalRoots,
|
|
3635
|
-
tableMode
|
|
3636
|
-
});
|
|
3637
|
-
},
|
|
3638
|
-
onError: (err, info) => {
|
|
3639
|
-
if (info.kind === "final") finalReplyDeliveryFailed = true;
|
|
3640
|
-
else nonFinalReplyDeliveryFailed = true;
|
|
3641
|
-
if (info.kind === "block") advanceDraftBlockBoundary({ fallbackToLatestEnd: true });
|
|
3642
|
-
runtime.error?.(`matrix ${info.kind} reply failed: ${String(err)}`);
|
|
3643
|
-
},
|
|
3644
|
-
onReplyStart: typingCallbacks.onReplyStart,
|
|
3645
|
-
onIdle: typingCallbacks.onIdle
|
|
3646
|
-
};
|
|
4015
|
+
typingCallbacks,
|
|
4016
|
+
streaming,
|
|
4017
|
+
draftStream,
|
|
4018
|
+
draftController,
|
|
4019
|
+
client,
|
|
4020
|
+
roomId,
|
|
4021
|
+
runtime,
|
|
4022
|
+
textLimit,
|
|
4023
|
+
replyToMode,
|
|
4024
|
+
threadTarget,
|
|
4025
|
+
replyToEventId: replyToEventId ?? void 0,
|
|
4026
|
+
accountId: _route.accountId,
|
|
4027
|
+
mediaLocalRoots,
|
|
4028
|
+
tableMode,
|
|
4029
|
+
logVerboseMessage
|
|
4030
|
+
});
|
|
4031
|
+
const { deliverReply, onReplyError, turnDispatcherOptions } = replyDispatcher;
|
|
3647
4032
|
const pinnedMainDmOwner = isDirectMessage ? await (async () => {
|
|
3648
|
-
const
|
|
3649
|
-
const livePinnedAllowlists = resolveMatrixAccountAllowlistConfig({
|
|
3650
|
-
cfg: livePinnedCfg,
|
|
3651
|
-
accountId
|
|
3652
|
-
});
|
|
3653
|
-
const livePinnedDmAllowFrom = await resolveCachedLiveAllowlist({
|
|
3654
|
-
cfg: livePinnedCfg,
|
|
3655
|
-
entries: livePinnedAllowlists.dmAllowFrom,
|
|
3656
|
-
startupResolvedEntries: allowFromResolvedEntries,
|
|
3657
|
-
cache: liveDmAllowlistCache,
|
|
3658
|
-
updateCache: (next) => {
|
|
3659
|
-
liveDmAllowlistCache = next;
|
|
3660
|
-
}
|
|
3661
|
-
});
|
|
4033
|
+
const { liveCfg, liveDmAllowFrom } = await handlerState.resolveLiveAccountAllowlists();
|
|
3662
4034
|
return resolvePinnedMainDmOwnerFromAllowlist({
|
|
3663
|
-
dmScope:
|
|
3664
|
-
allowFrom:
|
|
4035
|
+
dmScope: liveCfg.session?.dmScope,
|
|
4036
|
+
allowFrom: liveDmAllowFrom,
|
|
3665
4037
|
normalizeEntry: normalizeMatrixUserId
|
|
3666
4038
|
});
|
|
3667
4039
|
})() : null;
|
|
@@ -3724,32 +4096,28 @@ function createMatrixRoomMessageHandler(params) {
|
|
|
3724
4096
|
}
|
|
3725
4097
|
},
|
|
3726
4098
|
delivery: {
|
|
4099
|
+
observeMessageSent: true,
|
|
3727
4100
|
deliver: deliverReply,
|
|
3728
4101
|
onError: (err, info) => onReplyError(err, info)
|
|
3729
4102
|
},
|
|
3730
4103
|
dispatcherOptions: {
|
|
3731
4104
|
...turnDispatcherOptions,
|
|
3732
|
-
onSettled: () => progressDraftGate.cancel()
|
|
4105
|
+
onSettled: () => draftController.progressDraftGate.cancel()
|
|
3733
4106
|
},
|
|
3734
4107
|
replyOptions: {
|
|
3735
4108
|
skillFilter: roomConfig?.skills,
|
|
3736
4109
|
disableBlockStreaming: !blockStreamingEnabled,
|
|
3737
|
-
onPartialReply: draftStream ? (payload) =>
|
|
3738
|
-
if (progressDraftStreaming) return;
|
|
3739
|
-
latestDraftFullText = payload.text ?? "";
|
|
3740
|
-
suppressPreviewToolProgressForAnswerText(latestDraftFullText);
|
|
3741
|
-
updateDraftFromLatestFullText();
|
|
3742
|
-
} : void 0,
|
|
4110
|
+
onPartialReply: draftStream ? (payload) => draftController.onPartialReply(payload.text ?? "") : void 0,
|
|
3743
4111
|
onBlockReplyQueued: draftStream ? (payload, context) => {
|
|
3744
4112
|
if (payload.isCompactionNotice === true) return;
|
|
3745
|
-
queueDraftBlockBoundary(payload, context);
|
|
4113
|
+
draftController.queueDraftBlockBoundary(payload, context);
|
|
3746
4114
|
} : void 0,
|
|
3747
4115
|
onAssistantMessageStart: draftStream ? () => {
|
|
3748
|
-
resetDraftBlockOffsets();
|
|
3749
|
-
resetPreviewToolProgress();
|
|
4116
|
+
draftController.resetDraftBlockOffsets();
|
|
4117
|
+
draftController.resetPreviewToolProgress();
|
|
3750
4118
|
} : void 0,
|
|
3751
|
-
onQueuedFollowupAdmitted: draftStream ? resetDraftDeliveryState : void 0,
|
|
3752
|
-
...buildPreviewToolProgressReplyOptions(),
|
|
4119
|
+
onQueuedFollowupAdmitted: draftStream ? draftController.resetDraftDeliveryState : void 0,
|
|
4120
|
+
...draftController.buildPreviewToolProgressReplyOptions(),
|
|
3753
4121
|
onModelSelected
|
|
3754
4122
|
}
|
|
3755
4123
|
})
|
|
@@ -3761,12 +4129,12 @@ function createMatrixRoomMessageHandler(params) {
|
|
|
3761
4129
|
}
|
|
3762
4130
|
const { dispatchResult } = turnResult;
|
|
3763
4131
|
const { queuedFinal, counts } = dispatchResult;
|
|
3764
|
-
if (finalReplyDeliveryFailed) {
|
|
4132
|
+
if (replyDispatcher.finalReplyDeliveryFailed()) {
|
|
3765
4133
|
logVerboseMessage(`matrix: final reply delivery failed room=${roomId} id=${messageId}; keeping replay committed`);
|
|
3766
4134
|
await commitInboundEventIfClaimed();
|
|
3767
4135
|
return;
|
|
3768
4136
|
}
|
|
3769
|
-
if (!queuedFinal && nonFinalReplyDeliveryFailed) {
|
|
4137
|
+
if (!queuedFinal && replyDispatcher.nonFinalReplyDeliveryFailed()) {
|
|
3770
4138
|
logVerboseMessage(`matrix: non-final reply delivery failed room=${roomId} id=${messageId}; keeping replay committed`);
|
|
3771
4139
|
await commitInboundEventIfClaimed();
|
|
3772
4140
|
return;
|
|
@@ -3785,9 +4153,10 @@ function createMatrixRoomMessageHandler(params) {
|
|
|
3785
4153
|
} catch (err) {
|
|
3786
4154
|
runtime.error?.(`matrix handler failed: ${String(err)}`);
|
|
3787
4155
|
} finally {
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
4156
|
+
const draftStream = draftControllerRef?.draftStream;
|
|
4157
|
+
if (draftStream) {
|
|
4158
|
+
const draftEventId = await draftStream.stop().catch(() => void 0);
|
|
4159
|
+
if (draftEventId && draftControllerRef?.isDraftConsumed() !== true) await redactMatrixDraftEvent(client, roomId, draftEventId);
|
|
3791
4160
|
}
|
|
3792
4161
|
inboundReplayClaim?.release();
|
|
3793
4162
|
}
|
|
@@ -3808,10 +4177,10 @@ function shouldPromoteRecentInviteRoom(params) {
|
|
|
3808
4177
|
//#endregion
|
|
3809
4178
|
//#region extensions/matrix/src/matrix/monitor/startup.ts
|
|
3810
4179
|
const loadMatrixStartupMaintenanceDeps = createLazyRuntimeModule(() => Promise.all([
|
|
3811
|
-
import("./setup-core-
|
|
3812
|
-
import("./device-health-
|
|
3813
|
-
import("./setup-core-
|
|
3814
|
-
import("./startup-verification-
|
|
4180
|
+
import("./setup-core-BVfBv2ai.js").then((n) => n.c),
|
|
4181
|
+
import("./device-health-B4-YXtJR.js").then((n) => n.t),
|
|
4182
|
+
import("./setup-core-BVfBv2ai.js").then((n) => n.o),
|
|
4183
|
+
import("./startup-verification-wm3_i88s.js")
|
|
3815
4184
|
]).then(([configUpdateModule, deviceHealthModule, profileModule, startupVerificationModule]) => ({
|
|
3816
4185
|
updateMatrixAccountConfig: configUpdateModule.updateMatrixAccountConfig,
|
|
3817
4186
|
summarizeMatrixDeviceHealth: deviceHealthModule.summarizeMatrixDeviceHealth,
|
|
@@ -4040,20 +4409,13 @@ function createMatrixMonitorTaskRunner(params) {
|
|
|
4040
4409
|
}
|
|
4041
4410
|
//#endregion
|
|
4042
4411
|
//#region extensions/matrix/src/matrix/monitor/index.ts
|
|
4043
|
-
function isMatrixStreamingConfig(streaming) {
|
|
4044
|
-
return Boolean(streaming && typeof streaming === "object" && !Array.isArray(streaming));
|
|
4045
|
-
}
|
|
4046
4412
|
function resolveMatrixStreamingMode(streaming) {
|
|
4047
|
-
|
|
4048
|
-
if (
|
|
4049
|
-
if (streaming === "progress") return "progress";
|
|
4050
|
-
if (isMatrixStreamingConfig(streaming)) {
|
|
4051
|
-
if (streaming.mode === "partial" || streaming.mode === "quiet" || streaming.mode === "progress") return streaming.mode;
|
|
4052
|
-
}
|
|
4413
|
+
const mode = streaming?.mode;
|
|
4414
|
+
if (mode === "partial" || mode === "quiet" || mode === "progress") return mode;
|
|
4053
4415
|
return "off";
|
|
4054
4416
|
}
|
|
4055
4417
|
function resolveMatrixPreviewToolProgress(streaming) {
|
|
4056
|
-
if (!
|
|
4418
|
+
if (!streaming) return true;
|
|
4057
4419
|
if (resolveMatrixStreamingMode(streaming) === "progress") return streaming.progress?.toolProgress ?? streaming.preview?.toolProgress ?? true;
|
|
4058
4420
|
return streaming.preview?.toolProgress ?? true;
|
|
4059
4421
|
}
|