@openclaw/mattermost 2026.9.4 → 2026.9.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/activity.svg +40 -0
- package/assets/icon.png +0 -0
- package/dist/.setup/channel-plugin-api-CKz3b0dp.mjs +40 -0
- package/dist/.setup/channel-plugin-api-N-mnrhds.mjs +3 -0
- package/dist/{channel-plugin-runtime-Dhr44A2Y.js → .setup/channel-plugin-runtime-Ca4cZHq2.mjs} +10 -8
- package/dist/{channel.runtime-CYxC0VaI.js → .setup/channel.runtime-C074p7wv.mjs} +359 -107
- package/dist/{client-Dt7Q-j5B.js → .setup/client-Cx71KZ1x.mjs} +27 -15
- package/dist/{interactions-DF1FH27_.js → .setup/interactions-BG-CQbVD.mjs} +3 -3
- package/dist/{monitor-auth-C6RGYyn-.js → .setup/monitor-auth-DBoM2Bja.mjs} +16 -3
- package/dist/{normalize-R-ATEEHC.js → .setup/normalize-BQzx2u8S.mjs} +47 -7
- package/dist/.setup/secret-contract-api-Drab0Nqx.mjs +3 -0
- package/dist/{slash-state-BjBTvP7u.js → .setup/slash-state-CmyIYDIc.mjs} +59 -15
- package/dist/api.js +2 -2
- package/dist/channel-plugin-api.js +2 -39
- package/dist/channel-plugin-runtime.js +1 -1
- package/dist/doctor-contract-api.js +1 -1
- package/dist/gateway-auth-api.js +1 -1
- package/dist/policy-api.js +1 -1
- package/dist/runtime-api.js +1 -1
- package/dist/secret-contract-api.js +1 -1
- package/dist/setup-entry.js +3 -2
- package/dist/slash-route-api.js +1 -1
- package/node_modules/zod/README.md +27 -0
- package/node_modules/zod/compile.cjs +77 -0
- package/node_modules/zod/compile.d.cts +1 -0
- package/node_modules/zod/compile.d.ts +1 -0
- package/node_modules/zod/compile.js +52 -0
- package/node_modules/zod/index.cjs +2 -2
- package/node_modules/zod/index.d.cts +1 -2
- package/node_modules/zod/index.d.ts +1 -2
- package/node_modules/zod/index.js +5 -2
- package/node_modules/zod/package.json +13 -2
- package/node_modules/zod/src/compile.ts +56 -0
- package/node_modules/zod/src/index.ts +5 -2
- package/node_modules/zod/src/v3/ZodError.ts +22 -12
- package/node_modules/zod/src/v3/tests/error.test.ts +35 -0
- package/node_modules/zod/src/v3/tests/intersection.test.ts +18 -0
- package/node_modules/zod/src/v3/tests/language-server.test.ts +1 -2
- package/node_modules/zod/src/v3/tests/object.test.ts +3 -6
- package/node_modules/zod/src/v3/tests/readonly.test.ts +0 -80
- package/node_modules/zod/src/v3/tests/string.test.ts +6 -0
- package/node_modules/zod/src/v3/types.ts +5 -5
- package/node_modules/zod/src/v4/classic/checks.ts +1 -0
- package/node_modules/zod/src/v4/classic/compat.ts +26 -18
- package/node_modules/zod/src/v4/classic/deep-partial.ts +76 -0
- package/node_modules/zod/src/v4/classic/errors.ts +59 -44
- package/node_modules/zod/src/v4/classic/external.ts +12 -9
- package/node_modules/zod/src/v4/classic/from-json-schema.ts +140 -78
- package/node_modules/zod/src/v4/classic/in-out.ts +45 -0
- package/node_modules/zod/src/v4/classic/index.ts +2 -2
- package/node_modules/zod/src/v4/classic/iso.ts +2 -72
- package/node_modules/zod/src/v4/classic/parse.ts +10 -4
- package/node_modules/zod/src/v4/classic/schemas.ts +452 -262
- package/node_modules/zod/src/v4/classic/tests/apply.test.ts +27 -0
- package/node_modules/zod/src/v4/classic/tests/array.test.ts +2 -2
- package/node_modules/zod/src/v4/classic/tests/assignability.test.ts +135 -0
- package/node_modules/zod/src/v4/classic/tests/bigint.test.ts +30 -1
- package/node_modules/zod/src/v4/classic/tests/catch.test.ts +278 -0
- package/node_modules/zod/src/v4/classic/tests/codec-examples.test.ts +1 -2
- package/node_modules/zod/src/v4/classic/tests/codec.test.ts +2 -1
- package/node_modules/zod/src/v4/classic/tests/continuability.test.ts +2 -2
- package/node_modules/zod/src/v4/classic/tests/credit-card.test.ts +76 -0
- package/node_modules/zod/src/v4/classic/tests/cyclic-data.test.ts +720 -0
- package/node_modules/zod/src/v4/classic/tests/date.test.ts +30 -0
- package/node_modules/zod/src/v4/classic/tests/datetime.test.ts +32 -18
- package/node_modules/zod/src/v4/classic/tests/deep-partial.test.ts +380 -0
- package/node_modules/zod/src/v4/classic/tests/default-locale.test.ts +32 -0
- package/node_modules/zod/src/v4/classic/tests/default.test.ts +46 -0
- package/node_modules/zod/src/v4/classic/tests/detached-methods.test.ts +31 -7
- package/node_modules/zod/src/v4/classic/tests/discriminated-unions.test.ts +155 -13
- package/node_modules/zod/src/v4/classic/tests/enum.test.ts +11 -0
- package/node_modules/zod/src/v4/classic/tests/error-utils.test.ts +112 -2
- package/node_modules/zod/src/v4/classic/tests/error.test.ts +274 -6
- package/node_modules/zod/src/v4/classic/tests/from-json-schema.test.ts +425 -10
- package/node_modules/zod/src/v4/classic/tests/function.test.ts +31 -0
- package/node_modules/zod/src/v4/classic/tests/global-config.test.ts +2 -9
- package/node_modules/zod/src/v4/classic/tests/hash.test.ts +1 -2
- package/node_modules/zod/src/v4/classic/tests/in-out.test.ts +159 -0
- package/node_modules/zod/src/v4/classic/tests/index.test.ts +21 -2
- package/node_modules/zod/src/v4/classic/tests/instance-footprint.test.ts +281 -0
- package/node_modules/zod/src/v4/classic/tests/instanceof.test.ts +47 -0
- package/node_modules/zod/src/v4/classic/tests/intersection.test.ts +136 -0
- package/node_modules/zod/src/v4/classic/tests/issue-schema.test.ts +183 -0
- package/node_modules/zod/src/v4/classic/tests/jitless-allows-eval.test.ts +3 -10
- package/node_modules/zod/src/v4/classic/tests/lazy.test.ts +36 -1
- package/node_modules/zod/src/v4/classic/tests/literal.test.ts +12 -1
- package/node_modules/zod/src/v4/classic/tests/map.test.ts +12 -0
- package/node_modules/zod/src/v4/classic/tests/number.test.ts +46 -9
- package/node_modules/zod/src/v4/classic/tests/object.test.ts +245 -12
- package/node_modules/zod/src/v4/classic/tests/optin-ladder.test.ts +234 -0
- package/node_modules/zod/src/v4/classic/tests/optional.test.ts +49 -16
- package/node_modules/zod/src/v4/classic/tests/partial.test.ts +51 -4
- package/node_modules/zod/src/v4/classic/tests/preprocess-types.test.ts +20 -2
- package/node_modules/zod/src/v4/classic/tests/readonly.test.ts +0 -68
- package/node_modules/zod/src/v4/classic/tests/record.test.ts +186 -18
- package/node_modules/zod/src/v4/classic/tests/recursive-types.test.ts +33 -2
- package/node_modules/zod/src/v4/classic/tests/redos.test.ts +68 -0
- package/node_modules/zod/src/v4/classic/tests/refine.test.ts +60 -0
- package/node_modules/zod/src/v4/classic/tests/set.test.ts +9 -0
- package/node_modules/zod/src/v4/classic/tests/string.test.ts +127 -5
- package/node_modules/zod/src/v4/classic/tests/stringbool.test.ts +18 -0
- package/node_modules/zod/src/v4/classic/tests/template-literal.test.ts +11 -2
- package/node_modules/zod/src/v4/classic/tests/to-json-schema.test.ts +1585 -173
- package/node_modules/zod/src/v4/classic/tests/tuple.test.ts +45 -30
- package/node_modules/zod/src/v4/classic/tests/union.test.ts +39 -2
- package/node_modules/zod/src/v4/classic/tests/validate.test.ts +76 -0
- package/node_modules/zod/src/v4/classic/tests/validations.test.ts +2 -2
- package/node_modules/zod/src/v4/core/api.ts +48 -12
- package/node_modules/zod/src/v4/core/checks.ts +57 -44
- package/node_modules/zod/src/v4/core/compile.ts +2188 -0
- package/node_modules/zod/src/v4/core/core.ts +98 -19
- package/node_modules/zod/src/v4/core/doc.ts +11 -7
- package/node_modules/zod/src/v4/core/errors.ts +115 -24
- package/node_modules/zod/src/v4/core/index.ts +3 -0
- package/node_modules/zod/src/v4/core/json-schema-generator.ts +6 -1
- package/node_modules/zod/src/v4/core/json-schema-processors.ts +257 -93
- package/node_modules/zod/src/v4/core/json-schema.ts +2 -1
- package/node_modules/zod/src/v4/core/memoizer.ts +284 -0
- package/node_modules/zod/src/v4/core/parse.ts +131 -38
- package/node_modules/zod/src/v4/core/regexes.ts +30 -13
- package/node_modules/zod/src/v4/core/registries.ts +2 -2
- package/node_modules/zod/src/v4/core/schemas.ts +759 -461
- package/node_modules/zod/src/v4/core/tests/compile-differential.test.ts +969 -0
- package/node_modules/zod/src/v4/core/tests/compile-global.test.ts +89 -0
- package/node_modules/zod/src/v4/core/tests/compile-off-by-default.test.ts +26 -0
- package/node_modules/zod/src/v4/core/tests/compile-stats.test.ts +34 -0
- package/node_modules/zod/src/v4/core/tests/compile.test.ts +1639 -0
- package/node_modules/zod/src/v4/core/tests/locales/el.test.ts +1 -2
- package/node_modules/zod/src/v4/core/tests/locales/es.test.ts +1 -2
- package/node_modules/zod/src/v4/core/tests/locales/fr.test.ts +3 -3
- package/node_modules/zod/src/v4/core/tests/locales/parity.test.ts +42 -0
- package/node_modules/zod/src/v4/core/tests/locales/tk.test.ts +69 -0
- package/node_modules/zod/src/v4/core/tests/treeshake.test.ts +51 -0
- package/node_modules/zod/src/v4/core/tests/url-no-canparse.test.ts +31 -0
- package/node_modules/zod/src/v4/core/to-json-schema.ts +275 -42
- package/node_modules/zod/src/v4/core/util.ts +268 -42
- package/node_modules/zod/src/v4/core/versions.ts +2 -2
- package/node_modules/zod/src/v4/core/visit.ts +193 -0
- package/node_modules/zod/src/v4/index.ts +3 -3
- package/node_modules/zod/src/v4/locales/ar.ts +3 -0
- package/node_modules/zod/src/v4/locales/az.ts +3 -0
- package/node_modules/zod/src/v4/locales/be.ts +10 -0
- package/node_modules/zod/src/v4/locales/bg.ts +3 -0
- package/node_modules/zod/src/v4/locales/bn.ts +121 -0
- package/node_modules/zod/src/v4/locales/ca.ts +3 -0
- package/node_modules/zod/src/v4/locales/ckb.ts +138 -0
- package/node_modules/zod/src/v4/locales/cs.ts +3 -0
- package/node_modules/zod/src/v4/locales/da.ts +5 -2
- package/node_modules/zod/src/v4/locales/de.ts +3 -0
- package/node_modules/zod/src/v4/locales/el.ts +1 -0
- package/node_modules/zod/src/v4/locales/en.ts +15 -4
- package/node_modules/zod/src/v4/locales/eo.ts +3 -0
- package/node_modules/zod/src/v4/locales/es.ts +2 -0
- package/node_modules/zod/src/v4/locales/fa.ts +3 -0
- package/node_modules/zod/src/v4/locales/fi.ts +3 -0
- package/node_modules/zod/src/v4/locales/fr-CA.ts +3 -0
- package/node_modules/zod/src/v4/locales/fr.ts +19 -14
- package/node_modules/zod/src/v4/locales/gu.ts +121 -0
- package/node_modules/zod/src/v4/locales/he.ts +6 -1
- package/node_modules/zod/src/v4/locales/hi.ts +124 -0
- package/node_modules/zod/src/v4/locales/hr.ts +2 -0
- package/node_modules/zod/src/v4/locales/hu.ts +3 -0
- package/node_modules/zod/src/v4/locales/hy.ts +9 -0
- package/node_modules/zod/src/v4/locales/id.ts +3 -0
- package/node_modules/zod/src/v4/locales/index.ts +10 -0
- package/node_modules/zod/src/v4/locales/is.ts +3 -0
- package/node_modules/zod/src/v4/locales/it.ts +3 -0
- package/node_modules/zod/src/v4/locales/ja.ts +3 -0
- package/node_modules/zod/src/v4/locales/ka.ts +3 -0
- package/node_modules/zod/src/v4/locales/km.ts +3 -0
- package/node_modules/zod/src/v4/locales/kn.ts +124 -0
- package/node_modules/zod/src/v4/locales/ko.ts +3 -0
- package/node_modules/zod/src/v4/locales/lt.ts +2 -0
- package/node_modules/zod/src/v4/locales/mk.ts +3 -0
- package/node_modules/zod/src/v4/locales/ms.ts +3 -0
- package/node_modules/zod/src/v4/locales/ne.ts +126 -0
- package/node_modules/zod/src/v4/locales/nl.ts +3 -0
- package/node_modules/zod/src/v4/locales/nn.ts +119 -0
- package/node_modules/zod/src/v4/locales/no.ts +5 -2
- package/node_modules/zod/src/v4/locales/ota.ts +3 -0
- package/node_modules/zod/src/v4/locales/pl.ts +3 -0
- package/node_modules/zod/src/v4/locales/ps.ts +3 -0
- package/node_modules/zod/src/v4/locales/pt-BR.ts +159 -0
- package/node_modules/zod/src/v4/locales/pt.ts +99 -58
- package/node_modules/zod/src/v4/locales/ro.ts +1 -0
- package/node_modules/zod/src/v4/locales/ru.ts +10 -0
- package/node_modules/zod/src/v4/locales/sk.ts +121 -0
- package/node_modules/zod/src/v4/locales/sl.ts +3 -0
- package/node_modules/zod/src/v4/locales/sv.ts +5 -2
- package/node_modules/zod/src/v4/locales/ta.ts +3 -0
- package/node_modules/zod/src/v4/locales/th.ts +3 -0
- package/node_modules/zod/src/v4/locales/tk.ts +111 -0
- package/node_modules/zod/src/v4/locales/tr.ts +3 -0
- package/node_modules/zod/src/v4/locales/uk.ts +3 -0
- package/node_modules/zod/src/v4/locales/ur.ts +3 -0
- package/node_modules/zod/src/v4/locales/uz.ts +1 -0
- package/node_modules/zod/src/v4/locales/vi.ts +3 -0
- package/node_modules/zod/src/v4/locales/yo.ts +3 -0
- package/node_modules/zod/src/v4/locales/zh-CN.ts +3 -0
- package/node_modules/zod/src/v4/locales/zh-TW.ts +3 -0
- package/node_modules/zod/src/v4/mini/checks.ts +1 -0
- package/node_modules/zod/src/v4/mini/deep-partial.ts +73 -0
- package/node_modules/zod/src/v4/mini/external.ts +10 -1
- package/node_modules/zod/src/v4/mini/in-out.ts +45 -0
- package/node_modules/zod/src/v4/mini/parse.ts +2 -0
- package/node_modules/zod/src/v4/mini/schemas.ts +135 -56
- package/node_modules/zod/src/v4/mini/tests/apply.test.ts +33 -0
- package/node_modules/zod/src/v4/mini/tests/assignability.test.ts +62 -1
- package/node_modules/zod/src/v4/mini/tests/checks.test.ts +14 -0
- package/node_modules/zod/src/v4/mini/tests/codec.test.ts +35 -1
- package/node_modules/zod/src/v4/mini/tests/cyclic-data.test.ts +84 -0
- package/node_modules/zod/src/v4/mini/tests/deep-partial.test.ts +54 -0
- package/node_modules/zod/src/v4/mini/tests/error.test.ts +23 -4
- package/node_modules/zod/src/v4/mini/tests/functions.test.ts +9 -0
- package/node_modules/zod/src/v4/mini/tests/index.test.ts +72 -5
- package/node_modules/zod/src/v4/mini/tests/number.test.ts +14 -0
- package/node_modules/zod/src/v4/mini/tests/object.test.ts +65 -0
- package/node_modules/zod/src/v4/mini/tests/string.test.ts +21 -0
- package/node_modules/zod/v3/ZodError.cjs +22 -12
- package/node_modules/zod/v3/ZodError.d.cts +1 -1
- package/node_modules/zod/v3/ZodError.d.ts +1 -1
- package/node_modules/zod/v3/ZodError.js +22 -12
- package/node_modules/zod/v3/types.cjs +7 -5
- package/node_modules/zod/v3/types.js +7 -5
- package/node_modules/zod/v4/classic/checks.cjs +2 -1
- package/node_modules/zod/v4/classic/checks.d.cts +1 -1
- package/node_modules/zod/v4/classic/checks.d.ts +1 -1
- package/node_modules/zod/v4/classic/checks.js +1 -1
- package/node_modules/zod/v4/classic/compat.d.cts +9 -11
- package/node_modules/zod/v4/classic/compat.d.ts +9 -11
- package/node_modules/zod/v4/classic/deep-partial.cjs +39 -0
- package/node_modules/zod/v4/classic/deep-partial.d.cts +14 -0
- package/node_modules/zod/v4/classic/deep-partial.d.ts +14 -0
- package/node_modules/zod/v4/classic/deep-partial.js +13 -0
- package/node_modules/zod/v4/classic/errors.cjs +43 -34
- package/node_modules/zod/v4/classic/errors.d.cts +3 -4
- package/node_modules/zod/v4/classic/errors.d.ts +3 -4
- package/node_modules/zod/v4/classic/errors.js +43 -34
- package/node_modules/zod/v4/classic/external.cjs +30 -27
- package/node_modules/zod/v4/classic/external.d.cts +5 -2
- package/node_modules/zod/v4/classic/external.d.ts +5 -2
- package/node_modules/zod/v4/classic/external.js +5 -8
- package/node_modules/zod/v4/classic/from-json-schema.cjs +136 -75
- package/node_modules/zod/v4/classic/from-json-schema.js +136 -75
- package/node_modules/zod/v4/classic/in-out.cjs +63 -0
- package/node_modules/zod/v4/classic/in-out.d.cts +8 -0
- package/node_modules/zod/v4/classic/in-out.d.ts +8 -0
- package/node_modules/zod/v4/classic/in-out.js +36 -0
- package/node_modules/zod/v4/classic/index.cjs +2 -2
- package/node_modules/zod/v4/classic/index.d.cts +1 -2
- package/node_modules/zod/v4/classic/index.d.ts +1 -2
- package/node_modules/zod/v4/classic/index.js +2 -2
- package/node_modules/zod/v4/classic/iso.cjs +11 -22
- package/node_modules/zod/v4/classic/iso.d.cts +2 -17
- package/node_modules/zod/v4/classic/iso.d.ts +2 -17
- package/node_modules/zod/v4/classic/iso.js +2 -17
- package/node_modules/zod/v4/classic/parse.cjs +4 -1
- package/node_modules/zod/v4/classic/parse.d.cts +17 -4
- package/node_modules/zod/v4/classic/parse.d.ts +17 -4
- package/node_modules/zod/v4/classic/parse.js +1 -0
- package/node_modules/zod/v4/classic/schemas.cjs +498 -398
- package/node_modules/zod/v4/classic/schemas.d.cts +53 -18
- package/node_modules/zod/v4/classic/schemas.d.ts +53 -18
- package/node_modules/zod/v4/classic/schemas.js +492 -396
- package/node_modules/zod/v4/core/api.cjs +23 -4
- package/node_modules/zod/v4/core/api.d.cts +13 -9
- package/node_modules/zod/v4/core/api.d.ts +13 -9
- package/node_modules/zod/v4/core/api.js +21 -4
- package/node_modules/zod/v4/core/checks.cjs +37 -31
- package/node_modules/zod/v4/core/checks.d.cts +13 -13
- package/node_modules/zod/v4/core/checks.d.ts +13 -13
- package/node_modules/zod/v4/core/checks.js +37 -31
- package/node_modules/zod/v4/core/compile.cjs +1813 -0
- package/node_modules/zod/v4/core/compile.d.cts +51 -0
- package/node_modules/zod/v4/core/compile.d.ts +51 -0
- package/node_modules/zod/v4/core/compile.js +1783 -0
- package/node_modules/zod/v4/core/core.cjs +81 -18
- package/node_modules/zod/v4/core/core.d.cts +16 -4
- package/node_modules/zod/v4/core/core.d.ts +16 -4
- package/node_modules/zod/v4/core/core.js +82 -19
- package/node_modules/zod/v4/core/doc.cjs +5 -7
- package/node_modules/zod/v4/core/doc.d.cts +3 -1
- package/node_modules/zod/v4/core/doc.d.ts +3 -1
- package/node_modules/zod/v4/core/doc.js +5 -7
- package/node_modules/zod/v4/core/errors.cjs +110 -25
- package/node_modules/zod/v4/core/errors.d.cts +4 -0
- package/node_modules/zod/v4/core/errors.d.ts +4 -0
- package/node_modules/zod/v4/core/errors.js +110 -25
- package/node_modules/zod/v4/core/index.cjs +5 -1
- package/node_modules/zod/v4/core/index.d.cts +3 -0
- package/node_modules/zod/v4/core/index.d.ts +3 -0
- package/node_modules/zod/v4/core/index.js +3 -0
- package/node_modules/zod/v4/core/json-schema-generator.cjs +4 -0
- package/node_modules/zod/v4/core/json-schema-generator.d.cts +2 -2
- package/node_modules/zod/v4/core/json-schema-generator.d.ts +2 -2
- package/node_modules/zod/v4/core/json-schema-generator.js +4 -0
- package/node_modules/zod/v4/core/json-schema-processors.cjs +264 -95
- package/node_modules/zod/v4/core/json-schema-processors.js +243 -97
- package/node_modules/zod/v4/core/json-schema.d.cts +2 -1
- package/node_modules/zod/v4/core/json-schema.d.ts +2 -1
- package/node_modules/zod/v4/core/memoizer.cjs +272 -0
- package/node_modules/zod/v4/core/memoizer.d.cts +15 -0
- package/node_modules/zod/v4/core/memoizer.d.ts +15 -0
- package/node_modules/zod/v4/core/memoizer.js +265 -0
- package/node_modules/zod/v4/core/parse.cjs +96 -34
- package/node_modules/zod/v4/core/parse.d.cts +14 -11
- package/node_modules/zod/v4/core/parse.d.ts +14 -11
- package/node_modules/zod/v4/core/parse.js +94 -33
- package/node_modules/zod/v4/core/regexes.cjs +27 -15
- package/node_modules/zod/v4/core/regexes.d.cts +2 -0
- package/node_modules/zod/v4/core/regexes.d.ts +2 -0
- package/node_modules/zod/v4/core/regexes.js +24 -13
- package/node_modules/zod/v4/core/registries.js +2 -2
- package/node_modules/zod/v4/core/schemas.cjs +537 -326
- package/node_modules/zod/v4/core/schemas.d.cts +100 -31
- package/node_modules/zod/v4/core/schemas.d.ts +100 -31
- package/node_modules/zod/v4/core/schemas.js +526 -325
- package/node_modules/zod/v4/core/to-json-schema.cjs +242 -39
- package/node_modules/zod/v4/core/to-json-schema.d.cts +42 -3
- package/node_modules/zod/v4/core/to-json-schema.d.ts +42 -3
- package/node_modules/zod/v4/core/to-json-schema.js +241 -39
- package/node_modules/zod/v4/core/util.cjs +212 -31
- package/node_modules/zod/v4/core/util.d.cts +58 -1
- package/node_modules/zod/v4/core/util.d.ts +58 -1
- package/node_modules/zod/v4/core/util.js +202 -30
- package/node_modules/zod/v4/core/versions.cjs +2 -2
- package/node_modules/zod/v4/core/versions.d.cts +1 -1
- package/node_modules/zod/v4/core/versions.d.ts +1 -1
- package/node_modules/zod/v4/core/versions.js +2 -2
- package/node_modules/zod/v4/core/visit.cjs +195 -0
- package/node_modules/zod/v4/core/visit.d.cts +30 -0
- package/node_modules/zod/v4/core/visit.d.ts +30 -0
- package/node_modules/zod/v4/core/visit.js +169 -0
- package/node_modules/zod/v4/index.cjs +15 -5
- package/node_modules/zod/v4/index.d.cts +2 -2
- package/node_modules/zod/v4/index.d.ts +2 -2
- package/node_modules/zod/v4/index.js +3 -2
- package/node_modules/zod/v4/locales/ar.cjs +3 -0
- package/node_modules/zod/v4/locales/ar.js +3 -0
- package/node_modules/zod/v4/locales/az.cjs +3 -0
- package/node_modules/zod/v4/locales/az.js +3 -0
- package/node_modules/zod/v4/locales/be.cjs +10 -0
- package/node_modules/zod/v4/locales/be.js +10 -0
- package/node_modules/zod/v4/locales/bg.cjs +3 -0
- package/node_modules/zod/v4/locales/bg.js +3 -0
- package/node_modules/zod/v4/locales/bn.cjs +138 -0
- package/node_modules/zod/v4/locales/bn.d.cts +5 -0
- package/node_modules/zod/v4/locales/bn.d.ts +4 -0
- package/node_modules/zod/v4/locales/bn.js +111 -0
- package/node_modules/zod/v4/locales/ca.cjs +3 -0
- package/node_modules/zod/v4/locales/ca.js +3 -0
- package/node_modules/zod/v4/locales/ckb.cjs +158 -0
- package/node_modules/zod/v4/locales/ckb.d.cts +5 -0
- package/node_modules/zod/v4/locales/ckb.d.ts +4 -0
- package/node_modules/zod/v4/locales/ckb.js +131 -0
- package/node_modules/zod/v4/locales/cs.cjs +3 -0
- package/node_modules/zod/v4/locales/cs.js +3 -0
- package/node_modules/zod/v4/locales/da.cjs +5 -2
- package/node_modules/zod/v4/locales/da.js +5 -2
- package/node_modules/zod/v4/locales/de.cjs +3 -0
- package/node_modules/zod/v4/locales/de.js +3 -0
- package/node_modules/zod/v4/locales/el.cjs +1 -0
- package/node_modules/zod/v4/locales/el.js +1 -0
- package/node_modules/zod/v4/locales/en.cjs +14 -4
- package/node_modules/zod/v4/locales/en.js +14 -4
- package/node_modules/zod/v4/locales/eo.cjs +3 -0
- package/node_modules/zod/v4/locales/eo.js +3 -0
- package/node_modules/zod/v4/locales/es.cjs +2 -0
- package/node_modules/zod/v4/locales/es.js +2 -0
- package/node_modules/zod/v4/locales/fa.cjs +3 -0
- package/node_modules/zod/v4/locales/fa.js +3 -0
- package/node_modules/zod/v4/locales/fi.cjs +3 -0
- package/node_modules/zod/v4/locales/fi.js +3 -0
- package/node_modules/zod/v4/locales/fr-CA.cjs +3 -0
- package/node_modules/zod/v4/locales/fr-CA.js +3 -0
- package/node_modules/zod/v4/locales/fr.cjs +16 -14
- package/node_modules/zod/v4/locales/fr.js +16 -14
- package/node_modules/zod/v4/locales/gu.cjs +138 -0
- package/node_modules/zod/v4/locales/gu.d.cts +5 -0
- package/node_modules/zod/v4/locales/gu.d.ts +4 -0
- package/node_modules/zod/v4/locales/gu.js +111 -0
- package/node_modules/zod/v4/locales/he.cjs +5 -0
- package/node_modules/zod/v4/locales/he.js +5 -0
- package/node_modules/zod/v4/locales/hi.cjs +136 -0
- package/node_modules/zod/v4/locales/hi.d.cts +5 -0
- package/node_modules/zod/v4/locales/hi.d.ts +4 -0
- package/node_modules/zod/v4/locales/hi.js +109 -0
- package/node_modules/zod/v4/locales/hr.cjs +2 -0
- package/node_modules/zod/v4/locales/hr.js +2 -0
- package/node_modules/zod/v4/locales/hu.cjs +3 -0
- package/node_modules/zod/v4/locales/hu.js +3 -0
- package/node_modules/zod/v4/locales/hy.cjs +9 -0
- package/node_modules/zod/v4/locales/hy.js +9 -0
- package/node_modules/zod/v4/locales/id.cjs +3 -0
- package/node_modules/zod/v4/locales/id.js +3 -0
- package/node_modules/zod/v4/locales/index.cjs +22 -2
- package/node_modules/zod/v4/locales/index.d.cts +10 -0
- package/node_modules/zod/v4/locales/index.d.ts +10 -0
- package/node_modules/zod/v4/locales/index.js +10 -0
- package/node_modules/zod/v4/locales/is.cjs +3 -0
- package/node_modules/zod/v4/locales/is.js +3 -0
- package/node_modules/zod/v4/locales/it.cjs +3 -0
- package/node_modules/zod/v4/locales/it.js +3 -0
- package/node_modules/zod/v4/locales/ja.cjs +3 -0
- package/node_modules/zod/v4/locales/ja.js +3 -0
- package/node_modules/zod/v4/locales/ka.cjs +3 -0
- package/node_modules/zod/v4/locales/ka.js +3 -0
- package/node_modules/zod/v4/locales/km.cjs +3 -0
- package/node_modules/zod/v4/locales/km.js +3 -0
- package/node_modules/zod/v4/locales/kn.cjs +141 -0
- package/node_modules/zod/v4/locales/kn.d.cts +5 -0
- package/node_modules/zod/v4/locales/kn.d.ts +4 -0
- package/node_modules/zod/v4/locales/kn.js +114 -0
- package/node_modules/zod/v4/locales/ko.cjs +3 -0
- package/node_modules/zod/v4/locales/ko.js +3 -0
- package/node_modules/zod/v4/locales/lt.cjs +2 -0
- package/node_modules/zod/v4/locales/lt.js +2 -0
- package/node_modules/zod/v4/locales/mk.cjs +3 -0
- package/node_modules/zod/v4/locales/mk.js +3 -0
- package/node_modules/zod/v4/locales/ms.cjs +3 -0
- package/node_modules/zod/v4/locales/ms.js +3 -0
- package/node_modules/zod/v4/locales/ne.cjs +136 -0
- package/node_modules/zod/v4/locales/ne.d.cts +5 -0
- package/node_modules/zod/v4/locales/ne.d.ts +4 -0
- package/node_modules/zod/v4/locales/ne.js +109 -0
- package/node_modules/zod/v4/locales/nl.cjs +3 -0
- package/node_modules/zod/v4/locales/nl.js +3 -0
- package/node_modules/zod/v4/locales/nn.cjs +138 -0
- package/node_modules/zod/v4/locales/nn.d.cts +5 -0
- package/node_modules/zod/v4/locales/nn.d.ts +4 -0
- package/node_modules/zod/v4/locales/nn.js +111 -0
- package/node_modules/zod/v4/locales/no.cjs +5 -2
- package/node_modules/zod/v4/locales/no.js +5 -2
- package/node_modules/zod/v4/locales/ota.cjs +3 -0
- package/node_modules/zod/v4/locales/ota.js +3 -0
- package/node_modules/zod/v4/locales/pl.cjs +3 -0
- package/node_modules/zod/v4/locales/pl.js +3 -0
- package/node_modules/zod/v4/locales/ps.cjs +3 -0
- package/node_modules/zod/v4/locales/ps.js +3 -0
- package/node_modules/zod/v4/locales/pt-BR.cjs +168 -0
- package/node_modules/zod/v4/locales/pt-BR.d.cts +5 -0
- package/node_modules/zod/v4/locales/pt-BR.d.ts +4 -0
- package/node_modules/zod/v4/locales/pt-BR.js +141 -0
- package/node_modules/zod/v4/locales/pt.cjs +87 -55
- package/node_modules/zod/v4/locales/pt.js +87 -55
- package/node_modules/zod/v4/locales/ro.cjs +1 -0
- package/node_modules/zod/v4/locales/ro.js +1 -0
- package/node_modules/zod/v4/locales/ru.cjs +10 -0
- package/node_modules/zod/v4/locales/ru.js +10 -0
- package/node_modules/zod/v4/locales/sk.cjs +141 -0
- package/node_modules/zod/v4/locales/sk.d.cts +5 -0
- package/node_modules/zod/v4/locales/sk.d.ts +4 -0
- package/node_modules/zod/v4/locales/sk.js +114 -0
- package/node_modules/zod/v4/locales/sl.cjs +3 -0
- package/node_modules/zod/v4/locales/sl.js +3 -0
- package/node_modules/zod/v4/locales/sv.cjs +5 -2
- package/node_modules/zod/v4/locales/sv.js +5 -2
- package/node_modules/zod/v4/locales/ta.cjs +3 -0
- package/node_modules/zod/v4/locales/ta.js +3 -0
- package/node_modules/zod/v4/locales/th.cjs +3 -0
- package/node_modules/zod/v4/locales/th.js +3 -0
- package/node_modules/zod/v4/locales/tk.cjs +132 -0
- package/node_modules/zod/v4/locales/tk.d.cts +5 -0
- package/node_modules/zod/v4/locales/tk.d.ts +4 -0
- package/node_modules/zod/v4/locales/tk.js +105 -0
- package/node_modules/zod/v4/locales/tr.cjs +3 -0
- package/node_modules/zod/v4/locales/tr.js +3 -0
- package/node_modules/zod/v4/locales/uk.cjs +3 -0
- package/node_modules/zod/v4/locales/uk.js +3 -0
- package/node_modules/zod/v4/locales/ur.cjs +3 -0
- package/node_modules/zod/v4/locales/ur.js +3 -0
- package/node_modules/zod/v4/locales/uz.cjs +1 -0
- package/node_modules/zod/v4/locales/uz.js +1 -0
- package/node_modules/zod/v4/locales/vi.cjs +3 -0
- package/node_modules/zod/v4/locales/vi.js +3 -0
- package/node_modules/zod/v4/locales/yo.cjs +3 -0
- package/node_modules/zod/v4/locales/yo.js +3 -0
- package/node_modules/zod/v4/locales/zh-CN.cjs +3 -0
- package/node_modules/zod/v4/locales/zh-CN.js +3 -0
- package/node_modules/zod/v4/locales/zh-TW.cjs +3 -0
- package/node_modules/zod/v4/locales/zh-TW.js +3 -0
- package/node_modules/zod/v4/mini/checks.cjs +2 -1
- package/node_modules/zod/v4/mini/checks.d.cts +1 -1
- package/node_modules/zod/v4/mini/checks.d.ts +1 -1
- package/node_modules/zod/v4/mini/checks.js +1 -1
- package/node_modules/zod/v4/mini/deep-partial.cjs +39 -0
- package/node_modules/zod/v4/mini/deep-partial.d.cts +14 -0
- package/node_modules/zod/v4/mini/deep-partial.d.ts +14 -0
- package/node_modules/zod/v4/mini/deep-partial.js +13 -0
- package/node_modules/zod/v4/mini/external.cjs +12 -1
- package/node_modules/zod/v4/mini/external.d.cts +5 -2
- package/node_modules/zod/v4/mini/external.d.ts +5 -2
- package/node_modules/zod/v4/mini/external.js +3 -1
- package/node_modules/zod/v4/mini/in-out.cjs +63 -0
- package/node_modules/zod/v4/mini/in-out.d.cts +8 -0
- package/node_modules/zod/v4/mini/in-out.d.ts +8 -0
- package/node_modules/zod/v4/mini/in-out.js +36 -0
- package/node_modules/zod/v4/mini/parse.cjs +3 -1
- package/node_modules/zod/v4/mini/parse.d.cts +1 -1
- package/node_modules/zod/v4/mini/parse.d.ts +1 -1
- package/node_modules/zod/v4/mini/parse.js +1 -1
- package/node_modules/zod/v4/mini/schemas.cjs +75 -47
- package/node_modules/zod/v4/mini/schemas.d.cts +43 -13
- package/node_modules/zod/v4/mini/schemas.d.ts +43 -13
- package/node_modules/zod/v4/mini/schemas.js +71 -45
- package/openclaw.plugin.json +13 -29
- package/package.json +8 -8
- package/node_modules/ws/LICENSE +0 -20
- package/node_modules/ws/README.md +0 -548
- package/node_modules/ws/browser.js +0 -8
- package/node_modules/ws/index.js +0 -22
- package/node_modules/ws/lib/buffer-util.js +0 -131
- package/node_modules/ws/lib/constants.js +0 -19
- package/node_modules/ws/lib/event-target.js +0 -292
- package/node_modules/ws/lib/extension.js +0 -203
- package/node_modules/ws/lib/limiter.js +0 -55
- package/node_modules/ws/lib/permessage-deflate.js +0 -530
- package/node_modules/ws/lib/receiver.js +0 -743
- package/node_modules/ws/lib/sender.js +0 -607
- package/node_modules/ws/lib/stream.js +0 -161
- package/node_modules/ws/lib/subprotocol.js +0 -62
- package/node_modules/ws/lib/validation.js +0 -152
- package/node_modules/ws/lib/websocket-server.js +0 -562
- package/node_modules/ws/lib/websocket.js +0 -1407
- package/node_modules/ws/package.json +0 -74
- package/node_modules/ws/wrapper.mjs +0 -21
- package/node_modules/zod/src/v4/core/config.ts +0 -15
- /package/dist/{doctor-contract-mvORF4f6.js → .setup/doctor-contract-mvORF4f6.mjs} +0 -0
- /package/dist/{gateway-auth-bypass-B93t91oq.js → .setup/gateway-auth-bypass-B93t91oq.mjs} +0 -0
- /package/dist/{ingress-identity-DNl4yQSc.js → .setup/ingress-identity-DNl4yQSc.mjs} +0 -0
- /package/dist/{runtime-CNB4YGqJ.js → .setup/runtime-CNB4YGqJ.mjs} +0 -0
- /package/dist/{secret-contract-qg3NXRlS.js → .setup/secret-contract-qg3NXRlS.mjs} +0 -0
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { n as getOptionalMattermostRuntime, t as getMattermostRuntime } from "./runtime-CNB4YGqJ.
|
|
2
|
-
import { a as resolveInteractionCallbackPath, c as setInteractionSecret, i as createMattermostInteractionHandler, n as buildButtonProps, r as computeInteractionCallbackUrl, s as setInteractionCallbackUrl } from "./interactions-
|
|
3
|
-
import { _ as
|
|
4
|
-
import { C as resolveDefaultGroupPolicy,
|
|
5
|
-
import { n as normalizeMattermostAllowEntry } from "./ingress-identity-DNl4yQSc.
|
|
6
|
-
import {
|
|
7
|
-
import { _ as registerSlashCommands, a as sendMessageMattermost, c as joinMattermostVisibleContent, d as renderMattermostModelsPickerView, f as renderMattermostProviderPickerView, g as isSlashCommandsEnabled, h as cleanupSlashCommands, l as buildMattermostAllowedModelRefs, m as DEFAULT_COMMAND_SPECS, n as deactivateSlashCommands, o as resolveMattermostOpaqueTarget, p as resolveMattermostModelPickerCurrentModel, r as getSlashCommandState, s as deliverMattermostReplyPayload, t as activateSlashCommands, u as parseMattermostModelPickerContext, v as resolveCallbackUrl, y as resolveSlashCommandConfig } from "./slash-state-
|
|
8
|
-
import { createRequire } from "node:module";
|
|
1
|
+
import { n as getOptionalMattermostRuntime, t as getMattermostRuntime } from "./runtime-CNB4YGqJ.mjs";
|
|
2
|
+
import { a as resolveInteractionCallbackPath, c as setInteractionSecret, i as createMattermostInteractionHandler, n as buildButtonProps, r as computeInteractionCallbackUrl, s as setInteractionCallbackUrl } from "./interactions-BG-CQbVD.mjs";
|
|
3
|
+
import { _ as readMattermostError, a as createMattermostPost, d as fetchMattermostUser, h as normalizeMattermostBaseUrl, l as fetchMattermostChannelPosts, m as isRetryableError, n as buildMattermostApiUrl, o as deleteMattermostPost, p as fetchMattermostUserTeams, r as createMattermostClient, s as fetchMattermostChannel, t as MattermostPostSchema, u as fetchMattermostMe, v as sendMattermostTyping, y as updateMattermostPost } from "./client-Cx71KZ1x.mjs";
|
|
4
|
+
import { C as resolveAllowlistProviderRuntimeGroupPolicy$1, E as resolveDefaultGroupPolicy, O as warnMissingProviderGroupPolicyFallbackOnce, S as registerPluginHttpRoute, _ as listSkillCommandsForAgents, a as resolveMattermostMonitorInboundAccess, b as logTypingFailure, c as DEFAULT_GROUP_HISTORY_LIMIT, d as createChannelMessageReplyPipeline, f as createChannelPairingController, l as buildPreparedModelsProviderData, m as isDangerousNameMatchingEnabled, n as formatMattermostDirectMessageDropLog, o as resolveMattermostTrustedChatKind, s as shouldRetainMattermostSenderHistory, t as authorizeMattermostCommandInvocation, u as createChannelHistoryWindow, w as resolveChannelMediaMaxBytes, y as logInboundDrop } from "./monitor-auth-DBoM2Bja.mjs";
|
|
5
|
+
import { n as normalizeMattermostAllowEntry } from "./ingress-identity-DNl4yQSc.mjs";
|
|
6
|
+
import { c as listMattermostAccountIds, d as resolveMattermostReplyToMode, n as normalizeMattermostMessagingTarget, o as inspectMattermostAccount, r as parseMattermostQuestionContext, u as resolveMattermostAccount } from "./normalize-BQzx2u8S.mjs";
|
|
7
|
+
import { _ as registerSlashCommands, a as sendMessageMattermost, c as joinMattermostVisibleContent, d as renderMattermostModelsPickerView, f as renderMattermostProviderPickerView, g as isSlashCommandsEnabled, h as cleanupSlashCommands, l as buildMattermostAllowedModelRefs, m as DEFAULT_COMMAND_SPECS, n as deactivateSlashCommands, o as resolveMattermostOpaqueTarget, p as resolveMattermostModelPickerCurrentModel, r as getSlashCommandState, s as deliverMattermostReplyPayload, t as activateSlashCommands, u as parseMattermostModelPickerContext, v as resolveCallbackUrl, y as resolveSlashCommandConfig } from "./slash-state-CmyIYDIc.mjs";
|
|
9
8
|
import { randomUUID } from "node:crypto";
|
|
10
9
|
import { resolveGatewayPort } from "openclaw/plugin-sdk/gateway-config-runtime";
|
|
11
10
|
import { resolvePinnedMainDmOwnerFromAllowlist, sanitizeUntrustedFileName } from "openclaw/plugin-sdk/security-runtime";
|
|
@@ -26,6 +25,7 @@ import { resolveChannelGroups, resolveChannelGroupsConfigPath } from "openclaw/p
|
|
|
26
25
|
import { buildTtsSupplementMediaPayload, countOutboundMedia, getReplyPayloadTtsSupplement, isReasoningReplyPayload, resolveSendableOutboundReplyParts } from "openclaw/plugin-sdk/reply-payload";
|
|
27
26
|
import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
28
27
|
import { isRecord } from "openclaw/plugin-sdk/channel-secret-basic-runtime";
|
|
28
|
+
import { getSessionEntry, resolveStorePath } from "openclaw/plugin-sdk/session-store-runtime";
|
|
29
29
|
import { resolveInboundLastRouteSessionKey, resolveThreadSessionKeys } from "openclaw/plugin-sdk/routing";
|
|
30
30
|
import { escapeRegExp, runChannelProbe, sliceUtf16Safe, truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
31
31
|
import { resolveHumanDelayConfig } from "openclaw/plugin-sdk/agent-runtime";
|
|
@@ -34,8 +34,8 @@ import { pruneMapToMaxSize } from "openclaw/plugin-sdk/collection-runtime";
|
|
|
34
34
|
import { channelReadyPatch, isLoopbackHost } from "openclaw/plugin-sdk/gateway-runtime";
|
|
35
35
|
import { createRuntimeConfigReader } from "openclaw/plugin-sdk/runtime-config-snapshot";
|
|
36
36
|
import { captureWsEvent, createDebugProxyWebSocketAgent, resolveDebugProxySettings } from "openclaw/plugin-sdk/proxy-capture";
|
|
37
|
-
import
|
|
38
|
-
import {
|
|
37
|
+
import { WebSocket } from "openclaw/plugin-sdk/websocket-runtime";
|
|
38
|
+
import { questionGatewayRuntime } from "openclaw/plugin-sdk/question-gateway-runtime";
|
|
39
39
|
import { getGlobalHookRunner } from "openclaw/plugin-sdk/plugin-runtime";
|
|
40
40
|
import { chunkMarkdownTextWithMode } from "openclaw/plugin-sdk/reply-chunking";
|
|
41
41
|
import { createPersistentDedupeCache } from "openclaw/plugin-sdk/dedupe-runtime";
|
|
@@ -217,10 +217,6 @@ function shouldDropEmptyMattermostBody(params) {
|
|
|
217
217
|
return !botUsername || normalizeLowercaseStringOrEmpty(bareMention ?? "") !== `@${botUsername}`;
|
|
218
218
|
}
|
|
219
219
|
//#endregion
|
|
220
|
-
//#region extensions/mattermost/src/mattermost/ws-runtime.ts
|
|
221
|
-
const require = createRequire(import.meta.url);
|
|
222
|
-
const WebSocket = require(path.join(path.dirname(require.resolve("ws/package.json")), "index.js"));
|
|
223
|
-
//#endregion
|
|
224
220
|
//#region extensions/mattermost/src/mattermost/monitor-websocket.ts
|
|
225
221
|
const MATTERMOST_WEBSOCKET_MAX_PAYLOAD_BYTES = 16777216;
|
|
226
222
|
const MATTERMOST_WEBSOCKET_HANDSHAKE_TIMEOUT_MS = 3e4;
|
|
@@ -769,7 +765,7 @@ function resolveMattermostThreadSessionContext(params) {
|
|
|
769
765
|
};
|
|
770
766
|
}
|
|
771
767
|
function resolveMattermostPendingHistoryKey(params) {
|
|
772
|
-
return params.kind === "direct" ? null : params.sessionKey;
|
|
768
|
+
return params.kind === "direct" && !params.threadRootId ? null : params.sessionKey;
|
|
773
769
|
}
|
|
774
770
|
function resolveMattermostReactionChannelId(payload) {
|
|
775
771
|
return normalizeOptionalString(payload.broadcast?.channel_id) ?? normalizeOptionalString(payload.data?.channel_id);
|
|
@@ -865,10 +861,65 @@ async function buildMattermostEventPlan(monitor, params) {
|
|
|
865
861
|
}
|
|
866
862
|
//#endregion
|
|
867
863
|
//#region extensions/mattermost/src/mattermost/monitor-interactions.ts
|
|
864
|
+
/**
|
|
865
|
+
* Answer an ask_user question from the button its own prompt offered.
|
|
866
|
+
*
|
|
867
|
+
* The Gateway owns the answer, so this consumes the click instead of letting it
|
|
868
|
+
* fall through to the synthetic `[Button click: ...]` message the generic path
|
|
869
|
+
* sends; that message would reach the agent as prose while the question stayed
|
|
870
|
+
* open.
|
|
871
|
+
*/
|
|
872
|
+
function createMattermostQuestionInteractionHandler(monitor) {
|
|
873
|
+
const { account, cfg, core, pairing, resources, runtime } = monitor;
|
|
874
|
+
return async (interaction) => {
|
|
875
|
+
const selection = parseMattermostQuestionContext(interaction.context);
|
|
876
|
+
if (!selection) return null;
|
|
877
|
+
const channelInfo = await resources.resolveChannelInfo(interaction.payload.channel_id);
|
|
878
|
+
const decide = async () => await authorizeMattermostCommandInvocation({
|
|
879
|
+
account,
|
|
880
|
+
cfg,
|
|
881
|
+
senderId: interaction.payload.user_id,
|
|
882
|
+
senderName: interaction.userName,
|
|
883
|
+
channelId: interaction.payload.channel_id,
|
|
884
|
+
channelInfo,
|
|
885
|
+
readStoreAllowFrom: pairing.readAllowFromStore,
|
|
886
|
+
allowTextCommands: core.channel.commands.shouldHandleTextCommands({
|
|
887
|
+
cfg,
|
|
888
|
+
surface: "mattermost"
|
|
889
|
+
}),
|
|
890
|
+
hasControlCommand: false
|
|
891
|
+
});
|
|
892
|
+
const auth = await decide();
|
|
893
|
+
if (!auth.ok) return { ephemeral_text: `OpenClaw ignored this action for ${auth.roomLabel}.` };
|
|
894
|
+
try {
|
|
895
|
+
const result = await questionGatewayRuntime.resolveOption({
|
|
896
|
+
cfg,
|
|
897
|
+
questionId: selection.questionId,
|
|
898
|
+
optionIndex: selection.optionIndex,
|
|
899
|
+
senderId: interaction.payload.user_id,
|
|
900
|
+
clientDisplayName: `Mattermost question (${account.accountId})`,
|
|
901
|
+
authorize: async () => (await decide()).ok
|
|
902
|
+
});
|
|
903
|
+
if (result.status === "denied") return { ephemeral_text: `OpenClaw ignored this action for ${auth.roomLabel}.` };
|
|
904
|
+
if (result.status !== "answered") return { ephemeral_text: "This question was already answered." };
|
|
905
|
+
} catch (err) {
|
|
906
|
+
runtime.error?.(`mattermost question interaction failed: ${String(err)}`);
|
|
907
|
+
return { ephemeral_text: "Could not submit this answer." };
|
|
908
|
+
}
|
|
909
|
+
return {
|
|
910
|
+
update: {
|
|
911
|
+
message: interaction.post.message ?? "",
|
|
912
|
+
props: { attachments: [{ text: `✓ **${interaction.actionName}** selected by @${interaction.userName}` }] }
|
|
913
|
+
},
|
|
914
|
+
ephemeral_text: "Answer submitted."
|
|
915
|
+
};
|
|
916
|
+
};
|
|
917
|
+
}
|
|
868
918
|
function registerMattermostInteractions(params) {
|
|
869
919
|
const { monitor } = params;
|
|
870
920
|
const { account, botUserId, cfg, client, core, pairing, resources, runtime } = monitor;
|
|
871
921
|
const { resolveChannelInfo } = resources;
|
|
922
|
+
const handleQuestionInteraction = createMattermostQuestionInteractionHandler(monitor);
|
|
872
923
|
return registerPluginHttpRoute({
|
|
873
924
|
path: params.interactionPath,
|
|
874
925
|
fallbackPath: "/mattermost/interactions/default",
|
|
@@ -880,8 +931,8 @@ function registerMattermostInteractions(params) {
|
|
|
880
931
|
allowedSourceIps: params.allowedSourceIps,
|
|
881
932
|
trustedProxies: cfg.gateway?.trustedProxies,
|
|
882
933
|
allowRealIpFallback: cfg.gateway?.allowRealIpFallback === true,
|
|
883
|
-
handleInteraction: params.handleModelPickerInteraction,
|
|
884
|
-
authorizeButtonClick: async ({ payload
|
|
934
|
+
handleInteraction: async (interaction) => await handleQuestionInteraction(interaction) ?? await params.handleModelPickerInteraction(interaction),
|
|
935
|
+
authorizeButtonClick: async ({ payload }) => {
|
|
885
936
|
const channelInfo = await resolveChannelInfo(payload.channel_id);
|
|
886
937
|
const allowTextCommands = core.channel.commands.shouldHandleTextCommands({
|
|
887
938
|
cfg,
|
|
@@ -901,13 +952,7 @@ function registerMattermostInteractions(params) {
|
|
|
901
952
|
if (decision.ok) return { ok: true };
|
|
902
953
|
return {
|
|
903
954
|
ok: false,
|
|
904
|
-
response: {
|
|
905
|
-
update: {
|
|
906
|
-
message: post.message ?? "",
|
|
907
|
-
props: post.props ?? void 0
|
|
908
|
-
},
|
|
909
|
-
ephemeral_text: `OpenClaw ignored this action for ${decision.roomLabel}.`
|
|
910
|
-
}
|
|
955
|
+
response: { ephemeral_text: `OpenClaw ignored this action for ${decision.roomLabel}.` }
|
|
911
956
|
};
|
|
912
957
|
},
|
|
913
958
|
resolveSessionKey: async ({ channelId, userId, post }) => {
|
|
@@ -1073,12 +1118,6 @@ function createMattermostModelPickerInteractionHandler(monitor) {
|
|
|
1073
1118
|
const pickerState = parseMattermostModelPickerContext(params.context);
|
|
1074
1119
|
if (!pickerState) return null;
|
|
1075
1120
|
if (pickerState.ownerUserId !== params.payload.user_id) return { ephemeral_text: "Only the person who opened this picker can use it." };
|
|
1076
|
-
const updatePickerPost = (message, buttons) => updateModelPickerPost({
|
|
1077
|
-
channelId: params.payload.channel_id,
|
|
1078
|
-
postId: params.payload.post_id,
|
|
1079
|
-
message,
|
|
1080
|
-
buttons
|
|
1081
|
-
});
|
|
1082
1121
|
const channelInfo = await resolveChannelInfo(params.payload.channel_id);
|
|
1083
1122
|
const pickerCommandText = pickerState.action === "select" ? `/model ${pickerState.provider}/${pickerState.model}` : pickerState.action === "list" ? `/models ${pickerState.provider}` : "/models";
|
|
1084
1123
|
const allowTextCommands = core.channel.commands.shouldHandleTextCommands({
|
|
@@ -1127,7 +1166,18 @@ function createMattermostModelPickerInteractionHandler(monitor) {
|
|
|
1127
1166
|
agentId: eventPlan.route.agentId,
|
|
1128
1167
|
sessionKey: eventPlan.thread.sessionKey
|
|
1129
1168
|
};
|
|
1130
|
-
const
|
|
1169
|
+
const sessionEntry = getSessionEntry({
|
|
1170
|
+
storePath: resolveStorePath(cfg.session?.store, { agentId: modelSessionRoute.agentId }),
|
|
1171
|
+
sessionKey: modelSessionRoute.sessionKey,
|
|
1172
|
+
readConsistency: "latest"
|
|
1173
|
+
});
|
|
1174
|
+
const data = await buildPreparedModelsProviderData(cfg, eventPlan.route.agentId, { sessionEntry });
|
|
1175
|
+
const updatePickerPost = (message, buttons) => updateModelPickerPost({
|
|
1176
|
+
channelId: params.payload.channel_id,
|
|
1177
|
+
postId: params.payload.post_id,
|
|
1178
|
+
message: [data.refreshWarning, message].filter(Boolean).join("\n\n"),
|
|
1179
|
+
buttons
|
|
1180
|
+
});
|
|
1131
1181
|
if (data.providers.length === 0) return await updatePickerPost("No models available.");
|
|
1132
1182
|
if (pickerState.action === "providers" || pickerState.action === "back") {
|
|
1133
1183
|
const currentModel = resolveMattermostModelPickerCurrentModel({
|
|
@@ -1250,11 +1300,16 @@ async function buildMattermostInboundMediaPayload(media) {
|
|
|
1250
1300
|
function formatMattermostPendingMediaText(params) {
|
|
1251
1301
|
return [params.body, formatMediaPlaceholderText(params.media)].filter(Boolean).join("\n").trim();
|
|
1252
1302
|
}
|
|
1303
|
+
function sanitizeOptionalAttachmentName(fileName) {
|
|
1304
|
+
const sanitized = sanitizeUntrustedFileName(fileName, "_");
|
|
1305
|
+
if (sanitized === "_" && sanitizeUntrustedFileName(fileName, "-") === "-") return "";
|
|
1306
|
+
return sanitized;
|
|
1307
|
+
}
|
|
1253
1308
|
function formatMattermostInboundMediaText(params) {
|
|
1254
1309
|
const materializedCount = params.materializedMedia.filter((media) => Boolean(media.path) || Boolean(media.url)).length;
|
|
1255
1310
|
const unavailableCount = Math.max(0, params.nativeMedia.length - materializedCount);
|
|
1256
1311
|
if (unavailableCount === 0) return params.body;
|
|
1257
|
-
const unavailableFileNames = params.materializedMedia.filter((media) => !media.path && !media.url && media.fileName).map((media) =>
|
|
1312
|
+
const unavailableFileNames = params.materializedMedia.filter((media) => !media.path && !media.url && media.fileName).map((media) => sanitizeOptionalAttachmentName(media.fileName ?? "")).filter(Boolean).join(", ");
|
|
1258
1313
|
const fileNameNotice = unavailableFileNames ? ` ${JSON.stringify(truncateUtf16Safe(unavailableFileNames, 512))}` : "";
|
|
1259
1314
|
return formatInboundMediaUnavailableText({
|
|
1260
1315
|
body: params.body,
|
|
@@ -1391,6 +1446,212 @@ function createMattermostMonitorResources(params) {
|
|
|
1391
1446
|
};
|
|
1392
1447
|
}
|
|
1393
1448
|
//#endregion
|
|
1449
|
+
//#region extensions/mattermost/src/mattermost/monitor-thread-backfill.ts
|
|
1450
|
+
const TIMEOUT_MS = 5e3;
|
|
1451
|
+
const COOLDOWN_MS = 6e4;
|
|
1452
|
+
const MAX_ATTEMPTS = 3;
|
|
1453
|
+
const MAX_RECOVERIES = 1e3;
|
|
1454
|
+
const MAX_IN_FLIGHT = 8;
|
|
1455
|
+
const MAX_THREAD_POSTS = 200;
|
|
1456
|
+
const ThreadSchema = z.object({
|
|
1457
|
+
order: z.array(z.string()),
|
|
1458
|
+
posts: z.record(z.string(), MattermostPostSchema)
|
|
1459
|
+
});
|
|
1460
|
+
/** Recovery and pending history share one monitor lifetime, never a durable shadow store. */
|
|
1461
|
+
function createMattermostThreadBackfill(params) {
|
|
1462
|
+
const { monitor, channelHistories, historyLimit } = params;
|
|
1463
|
+
const { account, cfg, client } = monitor;
|
|
1464
|
+
const histories = createChannelHistoryWindow({ historyMap: channelHistories });
|
|
1465
|
+
const recoveries = /* @__PURE__ */ new Map();
|
|
1466
|
+
const inFlight = /* @__PURE__ */ new Set();
|
|
1467
|
+
const readIdentity = (turn) => {
|
|
1468
|
+
const entry = getSessionEntry({
|
|
1469
|
+
agentId: turn.agentId,
|
|
1470
|
+
storePath: resolveStorePath(cfg.session?.store, { agentId: turn.agentId }),
|
|
1471
|
+
sessionKey: turn.historyKey,
|
|
1472
|
+
readConsistency: "latest"
|
|
1473
|
+
});
|
|
1474
|
+
return entry ? JSON.stringify([entry.sessionId ?? null, entry.lifecycleRevision ?? null]) : null;
|
|
1475
|
+
};
|
|
1476
|
+
const owns = (turn, recovery) => {
|
|
1477
|
+
if (recoveries.get(turn.historyKey) !== recovery) return false;
|
|
1478
|
+
try {
|
|
1479
|
+
return readIdentity(turn) === recovery.identity;
|
|
1480
|
+
} catch {
|
|
1481
|
+
return false;
|
|
1482
|
+
}
|
|
1483
|
+
};
|
|
1484
|
+
const touch = (key, recovery) => {
|
|
1485
|
+
recoveries.delete(key);
|
|
1486
|
+
recoveries.set(key, recovery);
|
|
1487
|
+
for (const [oldKey, old] of recoveries) {
|
|
1488
|
+
if (recoveries.size <= MAX_RECOVERIES) break;
|
|
1489
|
+
if (!old.completion) recoveries.delete(oldKey);
|
|
1490
|
+
}
|
|
1491
|
+
};
|
|
1492
|
+
const fetchEntries = async (turn, signal) => {
|
|
1493
|
+
const query = new URLSearchParams({
|
|
1494
|
+
perPage: String(Math.min(historyLimit + 1, MAX_THREAD_POSTS)),
|
|
1495
|
+
direction: "up",
|
|
1496
|
+
fromPost: turn.currentPostId,
|
|
1497
|
+
fromCreateAt: String(turn.currentPostTimestamp)
|
|
1498
|
+
});
|
|
1499
|
+
const raw = await client.request(`/posts/${encodeURIComponent(turn.threadRootId)}/thread?${query}`, {
|
|
1500
|
+
signal,
|
|
1501
|
+
timeoutMs: TIMEOUT_MS
|
|
1502
|
+
});
|
|
1503
|
+
signal.throwIfAborted();
|
|
1504
|
+
const thread = ThreadSchema.parse(raw);
|
|
1505
|
+
const candidates = thread.order.slice(0, MAX_THREAD_POSTS).flatMap((id) => {
|
|
1506
|
+
const post = thread.posts[id];
|
|
1507
|
+
if (!post || post.id !== id || post.id === turn.currentPostId || post.channel_id !== turn.channelId || post.id !== turn.threadRootId && post.root_id !== turn.threadRootId || post.type || !post.user_id || typeof post.create_at !== "number" || post.create_at > turn.currentPostTimestamp || !post.message?.trim() && !post.file_ids?.length) return [];
|
|
1508
|
+
return [post];
|
|
1509
|
+
});
|
|
1510
|
+
const senderIds = [...new Set(candidates.map((post) => post.user_id))];
|
|
1511
|
+
let users = [];
|
|
1512
|
+
if (senderIds.length && isDangerousNameMatchingEnabled(account.config)) {
|
|
1513
|
+
users = await client.request("/users/ids", {
|
|
1514
|
+
method: "POST",
|
|
1515
|
+
body: JSON.stringify(senderIds),
|
|
1516
|
+
signal,
|
|
1517
|
+
timeoutMs: TIMEOUT_MS
|
|
1518
|
+
});
|
|
1519
|
+
signal.throwIfAborted();
|
|
1520
|
+
}
|
|
1521
|
+
const names = new Map(users.map((user) => [user.id, user.username ?? user.id]));
|
|
1522
|
+
let storeFailed = false;
|
|
1523
|
+
let storeRead;
|
|
1524
|
+
const readStoreAllowFrom = () => storeRead ??= monitor.pairing.readAllowFromStore().catch((error) => {
|
|
1525
|
+
storeFailed = true;
|
|
1526
|
+
throw error;
|
|
1527
|
+
});
|
|
1528
|
+
const allowed = new Map(await Promise.all(senderIds.map(async (senderId) => {
|
|
1529
|
+
try {
|
|
1530
|
+
signal.throwIfAborted();
|
|
1531
|
+
const access = await resolveMattermostMonitorInboundAccess({
|
|
1532
|
+
account,
|
|
1533
|
+
cfg,
|
|
1534
|
+
senderId,
|
|
1535
|
+
senderName: names.get(senderId) ?? senderId,
|
|
1536
|
+
channelId: turn.channelId,
|
|
1537
|
+
kind: turn.kind,
|
|
1538
|
+
groupPolicy: monitor.groupPolicy,
|
|
1539
|
+
readStoreAllowFrom,
|
|
1540
|
+
allowTextCommands: false,
|
|
1541
|
+
hasControlCommand: false,
|
|
1542
|
+
mayPair: false
|
|
1543
|
+
});
|
|
1544
|
+
signal.throwIfAborted();
|
|
1545
|
+
return [senderId, !storeFailed && shouldRetainMattermostSenderHistory({
|
|
1546
|
+
cfg,
|
|
1547
|
+
accountId: account.accountId,
|
|
1548
|
+
kind: turn.kind,
|
|
1549
|
+
ingress: access.ingress
|
|
1550
|
+
})];
|
|
1551
|
+
} catch {
|
|
1552
|
+
return [senderId, false];
|
|
1553
|
+
}
|
|
1554
|
+
})));
|
|
1555
|
+
signal.throwIfAborted();
|
|
1556
|
+
return candidates.filter((post) => allowed.get(post.user_id)).toSorted((a, b) => a.create_at - b.create_at || a.id.localeCompare(b.id)).map((post) => ({
|
|
1557
|
+
sender: names.get(post.user_id) ?? post.user_id,
|
|
1558
|
+
body: post.message?.trim() || "[attachment]",
|
|
1559
|
+
timestamp: post.create_at,
|
|
1560
|
+
messageId: post.id
|
|
1561
|
+
}));
|
|
1562
|
+
};
|
|
1563
|
+
return async (turn) => {
|
|
1564
|
+
if (historyLimit <= 0 || !Number.isFinite(turn.currentPostTimestamp) || turn.currentPostTimestamp <= 0) return { current: true };
|
|
1565
|
+
let identity;
|
|
1566
|
+
try {
|
|
1567
|
+
identity = readIdentity(turn);
|
|
1568
|
+
} catch {
|
|
1569
|
+
monitor.logVerboseMessage("mattermost: thread recovery skipped (session store unavailable)");
|
|
1570
|
+
return { current: true };
|
|
1571
|
+
}
|
|
1572
|
+
const previous = recoveries.get(turn.historyKey);
|
|
1573
|
+
let recovery = previous;
|
|
1574
|
+
if (!recovery || recovery.identity !== identity) {
|
|
1575
|
+
const adopting = previous?.identity === null && identity !== null;
|
|
1576
|
+
recovery = {
|
|
1577
|
+
identity,
|
|
1578
|
+
attempts: adopting ? previous.attempts : 0,
|
|
1579
|
+
nextAttemptAt: adopting ? previous.nextAttemptAt : 0,
|
|
1580
|
+
status: adopting && !previous.completion && previous.attempts > 0 ? previous.status : "pending"
|
|
1581
|
+
};
|
|
1582
|
+
if (!previous && (channelHistories.get(turn.historyKey)?.length ?? 0) > 0) recovery.status = "seeded";
|
|
1583
|
+
}
|
|
1584
|
+
touch(turn.historyKey, recovery);
|
|
1585
|
+
if (recovery.completion) {
|
|
1586
|
+
const history = await recovery.completion;
|
|
1587
|
+
return {
|
|
1588
|
+
current: owns(turn, recovery),
|
|
1589
|
+
history
|
|
1590
|
+
};
|
|
1591
|
+
}
|
|
1592
|
+
if (recovery.status === "settled") return { current: true };
|
|
1593
|
+
if (recovery.status === "seeded" && channelHistories.has(turn.historyKey)) return { current: true };
|
|
1594
|
+
if (recovery.attempts >= MAX_ATTEMPTS || Date.now() < recovery.nextAttemptAt || inFlight.size >= MAX_IN_FLIGHT) return { current: true };
|
|
1595
|
+
recovery.attempts++;
|
|
1596
|
+
recovery.nextAttemptAt = Date.now() + COOLDOWN_MS;
|
|
1597
|
+
const owner = recovery;
|
|
1598
|
+
const controller = new AbortController();
|
|
1599
|
+
const deadlineAt = performance.now() + TIMEOUT_MS;
|
|
1600
|
+
let timer;
|
|
1601
|
+
const deadline = new Promise((_, reject) => {
|
|
1602
|
+
timer = setTimeout(() => {
|
|
1603
|
+
const error = new DOMException("Mattermost thread recovery deadline", "TimeoutError");
|
|
1604
|
+
controller.abort(error);
|
|
1605
|
+
reject(error);
|
|
1606
|
+
}, TIMEOUT_MS);
|
|
1607
|
+
});
|
|
1608
|
+
const operation = fetchEntries(turn, controller.signal);
|
|
1609
|
+
inFlight.add(operation);
|
|
1610
|
+
operation.then(() => inFlight.delete(operation), () => inFlight.delete(operation));
|
|
1611
|
+
owner.completion = (async () => {
|
|
1612
|
+
try {
|
|
1613
|
+
const entries = await Promise.race([operation, deadline]);
|
|
1614
|
+
if (performance.now() >= deadlineAt) throw new DOMException("Mattermost thread recovery deadline", "TimeoutError");
|
|
1615
|
+
if (!owns(turn, owner)) return;
|
|
1616
|
+
const live = channelHistories.get(turn.historyKey) ?? [];
|
|
1617
|
+
const merged = /* @__PURE__ */ new Map();
|
|
1618
|
+
for (const entry of [...entries, ...live]) merged.set(entry.messageId ?? entry, entry);
|
|
1619
|
+
const snapshot = [...merged.values()].toSorted((a, b) => (a.timestamp ?? Infinity) - (b.timestamp ?? Infinity));
|
|
1620
|
+
const window = snapshot.slice(-historyLimit);
|
|
1621
|
+
if (window.length) {
|
|
1622
|
+
histories.clear({
|
|
1623
|
+
historyKey: turn.historyKey,
|
|
1624
|
+
limit: historyLimit
|
|
1625
|
+
});
|
|
1626
|
+
for (const entry of window) histories.record({
|
|
1627
|
+
historyKey: turn.historyKey,
|
|
1628
|
+
limit: historyLimit,
|
|
1629
|
+
entry
|
|
1630
|
+
});
|
|
1631
|
+
}
|
|
1632
|
+
owner.attempts = 0;
|
|
1633
|
+
owner.nextAttemptAt = 0;
|
|
1634
|
+
owner.status = window.length ? "seeded" : "settled";
|
|
1635
|
+
monitor.logVerboseMessage(`mattermost: thread recovery retained ${entries.length} entries historyKey=${turn.historyKey}`);
|
|
1636
|
+
return snapshot;
|
|
1637
|
+
} catch (error) {
|
|
1638
|
+
if (!owns(turn, owner)) return;
|
|
1639
|
+
owner.status = error instanceof Error && isRetryableError(error) && owner.attempts < MAX_ATTEMPTS ? "pending" : "settled";
|
|
1640
|
+
monitor.logVerboseMessage(`mattermost: thread recovery ${owner.status === "pending" ? "retry scheduled" : "gave up"} attempt=${owner.attempts}/${MAX_ATTEMPTS}`);
|
|
1641
|
+
return;
|
|
1642
|
+
} finally {
|
|
1643
|
+
clearTimeout(timer);
|
|
1644
|
+
owner.completion = void 0;
|
|
1645
|
+
}
|
|
1646
|
+
})();
|
|
1647
|
+
const history = await owner.completion;
|
|
1648
|
+
return {
|
|
1649
|
+
current: owns(turn, owner),
|
|
1650
|
+
history
|
|
1651
|
+
};
|
|
1652
|
+
};
|
|
1653
|
+
}
|
|
1654
|
+
//#endregion
|
|
1394
1655
|
//#region extensions/mattermost/src/mattermost/draft-stream.ts
|
|
1395
1656
|
const MATTERMOST_STREAM_MAX_CHARS = 4e3;
|
|
1396
1657
|
const DEFAULT_THROTTLE_MS = 1e3;
|
|
@@ -1439,9 +1700,6 @@ function createMattermostDraftStream(params) {
|
|
|
1439
1700
|
};
|
|
1440
1701
|
const sealedAssistantTexts = [];
|
|
1441
1702
|
const publishedAssistantParts = /* @__PURE__ */ new Map();
|
|
1442
|
-
const trackPublishedAssistantPart = (part) => {
|
|
1443
|
-
publishedAssistantParts.set(part.messageId, part);
|
|
1444
|
-
};
|
|
1445
1703
|
const sendOrEditStreamMessage = async (text) => {
|
|
1446
1704
|
if (streamState.stopped && !streamState.final) return false;
|
|
1447
1705
|
const target = currentGeneration;
|
|
@@ -1498,6 +1756,18 @@ function createMattermostDraftStream(params) {
|
|
|
1498
1756
|
const sealed = currentGeneration;
|
|
1499
1757
|
const assistantText = sealed.latestAssistantText?.trim();
|
|
1500
1758
|
let publishedAssistantOffset = 0;
|
|
1759
|
+
const recordPublishedAssistantPart = (messageId, content, offset) => {
|
|
1760
|
+
if (!assistantText) return;
|
|
1761
|
+
publishedAssistantParts.set(messageId, {
|
|
1762
|
+
messageId,
|
|
1763
|
+
content
|
|
1764
|
+
});
|
|
1765
|
+
publishedAssistantOffset = consumeMattermostPublishedChunk({
|
|
1766
|
+
source: assistantText,
|
|
1767
|
+
offset,
|
|
1768
|
+
chunk: content
|
|
1769
|
+
}) ?? offset;
|
|
1770
|
+
};
|
|
1501
1771
|
const boundary = (async () => {
|
|
1502
1772
|
try {
|
|
1503
1773
|
await sealed.ready;
|
|
@@ -1516,47 +1786,18 @@ function createMattermostDraftStream(params) {
|
|
|
1516
1786
|
if (sealed.postId) {
|
|
1517
1787
|
if (assistantText && (sealed.lastProviderText || sealed.lastSentText)) {
|
|
1518
1788
|
const publishedContent = sealed.lastProviderText ?? sealed.lastSentText;
|
|
1519
|
-
|
|
1520
|
-
messageId: sealed.postId,
|
|
1521
|
-
content: publishedContent
|
|
1522
|
-
});
|
|
1523
|
-
publishedAssistantOffset = consumeMattermostPublishedChunk({
|
|
1524
|
-
source: assistantText,
|
|
1525
|
-
offset: 0,
|
|
1526
|
-
chunk: publishedContent
|
|
1527
|
-
}) ?? 0;
|
|
1789
|
+
recordPublishedAssistantPart(sealed.postId, publishedContent, 0);
|
|
1528
1790
|
}
|
|
1529
1791
|
let providerFirstChunk = sealed.lastProviderText ?? firstChunk;
|
|
1530
1792
|
if (firstChunk !== sealed.lastSentText) providerFirstChunk = (await updateMattermostPost(params.client, sealed.postId, { message: firstChunk })).message ?? firstChunk;
|
|
1531
|
-
|
|
1532
|
-
trackPublishedAssistantPart({
|
|
1533
|
-
messageId: sealed.postId,
|
|
1534
|
-
content: providerFirstChunk
|
|
1535
|
-
});
|
|
1536
|
-
publishedAssistantOffset = consumeMattermostPublishedChunk({
|
|
1537
|
-
source: assistantText,
|
|
1538
|
-
offset: 0,
|
|
1539
|
-
chunk: providerFirstChunk
|
|
1540
|
-
}) ?? 0;
|
|
1541
|
-
}
|
|
1793
|
+
recordPublishedAssistantPart(sealed.postId, providerFirstChunk, 0);
|
|
1542
1794
|
} else {
|
|
1543
1795
|
const firstPost = await createMattermostPost(params.client, {
|
|
1544
1796
|
channelId: params.channelId,
|
|
1545
1797
|
message: firstChunk,
|
|
1546
1798
|
rootId: params.rootId
|
|
1547
1799
|
});
|
|
1548
|
-
|
|
1549
|
-
const publishedContent = firstPost.message ?? firstChunk;
|
|
1550
|
-
trackPublishedAssistantPart({
|
|
1551
|
-
messageId: firstPost.id,
|
|
1552
|
-
content: publishedContent
|
|
1553
|
-
});
|
|
1554
|
-
publishedAssistantOffset = consumeMattermostPublishedChunk({
|
|
1555
|
-
source: assistantText,
|
|
1556
|
-
offset: 0,
|
|
1557
|
-
chunk: publishedContent
|
|
1558
|
-
}) ?? 0;
|
|
1559
|
-
}
|
|
1800
|
+
recordPublishedAssistantPart(firstPost.id, firstPost.message ?? firstChunk, 0);
|
|
1560
1801
|
}
|
|
1561
1802
|
for (const chunk of chunks.slice(1)) {
|
|
1562
1803
|
const post = await createMattermostPost(params.client, {
|
|
@@ -1564,18 +1805,7 @@ function createMattermostDraftStream(params) {
|
|
|
1564
1805
|
message: chunk,
|
|
1565
1806
|
rootId: params.rootId
|
|
1566
1807
|
});
|
|
1567
|
-
|
|
1568
|
-
const publishedContent = post.message ?? chunk;
|
|
1569
|
-
trackPublishedAssistantPart({
|
|
1570
|
-
messageId: post.id,
|
|
1571
|
-
content: publishedContent
|
|
1572
|
-
});
|
|
1573
|
-
publishedAssistantOffset = consumeMattermostPublishedChunk({
|
|
1574
|
-
source: assistantText,
|
|
1575
|
-
offset: publishedAssistantOffset,
|
|
1576
|
-
chunk: publishedContent
|
|
1577
|
-
}) ?? publishedAssistantOffset;
|
|
1578
|
-
}
|
|
1808
|
+
recordPublishedAssistantPart(post.id, post.message ?? chunk, publishedAssistantOffset);
|
|
1579
1809
|
}
|
|
1580
1810
|
if (assistantText) sealedAssistantTexts.push({
|
|
1581
1811
|
text: assistantText,
|
|
@@ -1789,7 +2019,7 @@ async function deliverMattermostReplyWithDraftPreview(params) {
|
|
|
1789
2019
|
finalizedPreviewPost = await updateMattermostPost(params.client, previewPostId, edit);
|
|
1790
2020
|
},
|
|
1791
2021
|
resolveFinalizedId: (previewPostId) => finalizedPreviewPost?.id ?? previewPostId,
|
|
1792
|
-
onPreviewFinalized: (_previewPostId, receipt) => {
|
|
2022
|
+
onPreviewFinalized: async (_previewPostId, receipt) => {
|
|
1793
2023
|
params.previewState.finalizedViaPreviewPost = true;
|
|
1794
2024
|
previewFinalTextAlreadyDelivered = true;
|
|
1795
2025
|
previewDeliveryResult = {
|
|
@@ -1799,7 +2029,7 @@ async function deliverMattermostReplyWithDraftPreview(params) {
|
|
|
1799
2029
|
visibleReplySent: true,
|
|
1800
2030
|
content: finalizedPreviewPost?.message ?? pendingPreviewFinalContent ?? ""
|
|
1801
2031
|
};
|
|
1802
|
-
params.recordThreadParticipation?.();
|
|
2032
|
+
await params.recordThreadParticipation?.();
|
|
1803
2033
|
},
|
|
1804
2034
|
buildSupplementalPayload: (payload) => getReplyPayloadTtsSupplement(payload) ? buildTtsSupplementMediaPayload(payload) : void 0,
|
|
1805
2035
|
deliverSupplemental: async (payload) => {
|
|
@@ -1874,9 +2104,9 @@ const threadParticipation = createPersistentDedupeCache({
|
|
|
1874
2104
|
function makeKey(accountId, channelId, threadRootId) {
|
|
1875
2105
|
return `${accountId}:${channelId}:${threadRootId}`;
|
|
1876
2106
|
}
|
|
1877
|
-
function recordMattermostThreadParticipation(accountId, channelId, threadRootId, opts) {
|
|
2107
|
+
async function recordMattermostThreadParticipation(accountId, channelId, threadRootId, opts) {
|
|
1878
2108
|
if (!accountId || !channelId || !threadRootId) return;
|
|
1879
|
-
threadParticipation.register(makeKey(accountId, channelId, threadRootId), {
|
|
2109
|
+
await threadParticipation.register(makeKey(accountId, channelId, threadRootId), {
|
|
1880
2110
|
...opts?.agentId ? { agentId: opts.agentId } : {},
|
|
1881
2111
|
repliedAt: Date.now()
|
|
1882
2112
|
});
|
|
@@ -2050,10 +2280,10 @@ async function dispatchMattermostInboundTurn(monitor, params) {
|
|
|
2050
2280
|
progressDraft.markFinalReplyStarted();
|
|
2051
2281
|
}
|
|
2052
2282
|
let threadParticipationRecorded = false;
|
|
2053
|
-
const markThreadParticipation = () => {
|
|
2283
|
+
const markThreadParticipation = async () => {
|
|
2054
2284
|
if (!threadParticipationRecorded && kind !== "direct" && effectiveReplyToId) {
|
|
2055
2285
|
threadParticipationRecorded = true;
|
|
2056
|
-
recordMattermostThreadParticipation(account.accountId, channelId, effectiveReplyToId, { agentId: route.agentId });
|
|
2286
|
+
await recordMattermostThreadParticipation(account.accountId, channelId, effectiveReplyToId, { agentId: route.agentId });
|
|
2057
2287
|
}
|
|
2058
2288
|
};
|
|
2059
2289
|
const result = await deliverMattermostReplyWithDraftPreview({
|
|
@@ -2088,12 +2318,12 @@ async function dispatchMattermostInboundTurn(monitor, params) {
|
|
|
2088
2318
|
textLimit,
|
|
2089
2319
|
tableMode,
|
|
2090
2320
|
sendMessage: sendMessageMattermost
|
|
2091
|
-
}).catch((error) => {
|
|
2092
|
-
if (isChannelPartialDeliveryError(error)) markThreadParticipation();
|
|
2321
|
+
}).catch(async (error) => {
|
|
2322
|
+
if (isChannelPartialDeliveryError(error)) await markThreadParticipation();
|
|
2093
2323
|
throw error;
|
|
2094
2324
|
});
|
|
2095
|
-
if (deliveryResult.outcome === "text" || deliveryResult.outcome === "media") markThreadParticipation();
|
|
2096
|
-
else if (deliveryResult.outcome === "empty" && finalTextResolution?.kind === "already-delivered") markThreadParticipation();
|
|
2325
|
+
if (deliveryResult.outcome === "text" || deliveryResult.outcome === "media") await markThreadParticipation();
|
|
2326
|
+
else if (deliveryResult.outcome === "empty" && finalTextResolution?.kind === "already-delivered") await markThreadParticipation();
|
|
2097
2327
|
const deliveryLog = formatMattermostFinalDeliveryOutcomeLog({
|
|
2098
2328
|
outcome: deliveryResult.outcome,
|
|
2099
2329
|
payload: resolvedPayload,
|
|
@@ -2104,14 +2334,14 @@ async function dispatchMattermostInboundTurn(monitor, params) {
|
|
|
2104
2334
|
if (deliveryLog) runtime.log?.(deliveryLog);
|
|
2105
2335
|
return deliveryResult;
|
|
2106
2336
|
}
|
|
2107
|
-
}).catch((error) => {
|
|
2337
|
+
}).catch(async (error) => {
|
|
2108
2338
|
if (isChannelPartialDeliveryError(error)) {
|
|
2109
|
-
markThreadParticipation();
|
|
2339
|
+
await markThreadParticipation();
|
|
2110
2340
|
if (info.kind === "final") progressDraft.markFinalReplyDelivered();
|
|
2111
2341
|
}
|
|
2112
2342
|
throw error;
|
|
2113
2343
|
});
|
|
2114
|
-
if (result.visibleReplySent) markThreadParticipation();
|
|
2344
|
+
if (result.visibleReplySent) await markThreadParticipation();
|
|
2115
2345
|
if (info.kind === "final") progressDraft.markFinalReplyDelivered();
|
|
2116
2346
|
return result;
|
|
2117
2347
|
},
|
|
@@ -2209,7 +2439,10 @@ async function dispatchMattermostInboundTurn(monitor, params) {
|
|
|
2209
2439
|
onPlanUpdate: async (payloadValue) => {
|
|
2210
2440
|
if (!draftProgressEnabled || payloadValue.phase !== "update") return false;
|
|
2211
2441
|
const boundarySettled = enterBlockPreviewActivity("tool");
|
|
2212
|
-
const progressSettled = progressDraft.pushPlanProgress(payloadValue.steps, {
|
|
2442
|
+
const progressSettled = progressDraft.pushPlanProgress(payloadValue.steps, {
|
|
2443
|
+
explanation: payloadValue.explanation,
|
|
2444
|
+
explanationFormat: payloadValue.explanationFormat
|
|
2445
|
+
});
|
|
2213
2446
|
previewBoundaryController.noteUpdate();
|
|
2214
2447
|
const [, visible] = await Promise.all([boundarySettled, progressSettled]);
|
|
2215
2448
|
return visible;
|
|
@@ -2262,6 +2495,11 @@ function createMattermostPostHandler(monitor) {
|
|
|
2262
2495
|
const { resolveMattermostMedia, resolveUserInfo } = resources;
|
|
2263
2496
|
const channelHistories = /* @__PURE__ */ new Map();
|
|
2264
2497
|
const historyLimit = Math.max(0, account.config.historyLimit ?? cfg.messages?.groupChat?.historyLimit ?? DEFAULT_GROUP_HISTORY_LIMIT);
|
|
2498
|
+
const recoverThread = createMattermostThreadBackfill({
|
|
2499
|
+
monitor,
|
|
2500
|
+
channelHistories,
|
|
2501
|
+
historyLimit
|
|
2502
|
+
});
|
|
2265
2503
|
return async (post, payload, turnAdoptionLifecycle, messageIds) => {
|
|
2266
2504
|
const channelId = post.channel_id ?? payload.data?.channel_id ?? payload.broadcast?.channel_id;
|
|
2267
2505
|
if (!channelId) {
|
|
@@ -2307,7 +2545,8 @@ function createMattermostPostHandler(monitor) {
|
|
|
2307
2545
|
});
|
|
2308
2546
|
const historyKey = resolveMattermostPendingHistoryKey({
|
|
2309
2547
|
kind,
|
|
2310
|
-
sessionKey
|
|
2548
|
+
sessionKey,
|
|
2549
|
+
threadRootId: effectiveReplyToId
|
|
2311
2550
|
});
|
|
2312
2551
|
const fileIds = uniqueStrings(normalizeTrimmedStringList(post.file_ids ?? []));
|
|
2313
2552
|
const nativeMedia = fileIds.map(() => ({}));
|
|
@@ -2391,14 +2630,11 @@ function createMattermostPostHandler(monitor) {
|
|
|
2391
2630
|
return;
|
|
2392
2631
|
}
|
|
2393
2632
|
if (accessDecision.ingress.reasonCode === "group_policy_not_allowlisted") {
|
|
2394
|
-
if (
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
}),
|
|
2400
|
-
kind: "history",
|
|
2401
|
-
senderAllowed: false
|
|
2633
|
+
if (shouldRetainMattermostSenderHistory({
|
|
2634
|
+
cfg,
|
|
2635
|
+
accountId: account.accountId,
|
|
2636
|
+
kind,
|
|
2637
|
+
ingress: accessDecision.ingress
|
|
2402
2638
|
})) recordPendingHistory();
|
|
2403
2639
|
monitor.logVerboseMessage(`mattermost: drop group sender=${senderId} (not in groupAllowFrom)`);
|
|
2404
2640
|
return;
|
|
@@ -2496,7 +2732,7 @@ function createMattermostPostHandler(monitor) {
|
|
|
2496
2732
|
directId: senderId
|
|
2497
2733
|
});
|
|
2498
2734
|
const textWithId = `${bodyText}\n[mattermost message id: ${post.id} channel: ${channelId}]`;
|
|
2499
|
-
|
|
2735
|
+
const body = formatInboundEnvelope({
|
|
2500
2736
|
channel: "Mattermost",
|
|
2501
2737
|
from: fromLabel,
|
|
2502
2738
|
timestamp: typeof post.create_at === "number" ? post.create_at : void 0,
|
|
@@ -2509,7 +2745,22 @@ function createMattermostPostHandler(monitor) {
|
|
|
2509
2745
|
previousTimestamp,
|
|
2510
2746
|
envelope: envelopeOptions
|
|
2511
2747
|
});
|
|
2512
|
-
|
|
2748
|
+
const backfill = historyKey && effectiveReplyToId ? await recoverThread({
|
|
2749
|
+
historyKey,
|
|
2750
|
+
threadRootId: effectiveReplyToId,
|
|
2751
|
+
currentPostId: post.id,
|
|
2752
|
+
currentPostTimestamp: post.create_at ?? 0,
|
|
2753
|
+
agentId: route.agentId,
|
|
2754
|
+
channelId,
|
|
2755
|
+
kind
|
|
2756
|
+
}) : void 0;
|
|
2757
|
+
if (backfill && !backfill.current) {
|
|
2758
|
+
monitor.logVerboseMessage("mattermost: drop stale thread turn after session rotation");
|
|
2759
|
+
return;
|
|
2760
|
+
}
|
|
2761
|
+
const turnHistories = new Map(historyKey ? [[historyKey, (backfill?.history ?? channelHistories.get(historyKey) ?? []).filter((entry) => !allMessageIds.includes(entry.messageId ?? "") && (entry.timestamp === void 0 || post.create_at == null || entry.timestamp <= post.create_at)).slice(-historyLimit)]] : []);
|
|
2762
|
+
let combinedBody = body;
|
|
2763
|
+
if (historyKey) combinedBody = createChannelHistoryWindow({ historyMap: turnHistories }).buildPendingContext({
|
|
2513
2764
|
historyKey,
|
|
2514
2765
|
limit: historyLimit,
|
|
2515
2766
|
currentMessage: combinedBody,
|
|
@@ -2523,7 +2774,7 @@ function createMattermostPostHandler(monitor) {
|
|
|
2523
2774
|
envelope: envelopeOptions
|
|
2524
2775
|
})
|
|
2525
2776
|
});
|
|
2526
|
-
const inboundHistory = historyKey && historyLimit > 0 ? createChannelHistoryWindow({ historyMap:
|
|
2777
|
+
const inboundHistory = historyKey && historyLimit > 0 ? createChannelHistoryWindow({ historyMap: turnHistories }).buildInboundHistory({
|
|
2527
2778
|
historyKey,
|
|
2528
2779
|
limit: historyLimit
|
|
2529
2780
|
}) : void 0;
|
|
@@ -3076,11 +3327,12 @@ async function probeMattermost(baseUrl, botToken, timeoutMs = 2500, allowPrivate
|
|
|
3076
3327
|
error: "baseUrl missing"
|
|
3077
3328
|
};
|
|
3078
3329
|
const url = `${normalized}/api/v4/users/me`;
|
|
3330
|
+
const headers = { Authorization: `Bearer ${botToken}` };
|
|
3079
3331
|
return await runChannelProbe(void 0, async ({ elapsedMs }) => {
|
|
3080
3332
|
const resolvedTimeoutMs = timeoutMs > 0 ? resolveTimerTimeoutMs(timeoutMs, 2500) : void 0;
|
|
3081
3333
|
const { response: res, release } = await fetchWithSsrFGuard({
|
|
3082
3334
|
url,
|
|
3083
|
-
init: { headers
|
|
3335
|
+
init: { headers },
|
|
3084
3336
|
auditContext: "mattermost-probe",
|
|
3085
3337
|
policy: ssrfPolicyFromPrivateNetworkOptIn(allowPrivateNetwork),
|
|
3086
3338
|
...resolvedTimeoutMs !== void 0 ? { timeoutMs: resolvedTimeoutMs } : {},
|
|
@@ -3090,7 +3342,7 @@ async function probeMattermost(baseUrl, botToken, timeoutMs = 2500, allowPrivate
|
|
|
3090
3342
|
const requestElapsedMs = elapsedMs();
|
|
3091
3343
|
try {
|
|
3092
3344
|
if (!res.ok) {
|
|
3093
|
-
const detail = await readMattermostError(res);
|
|
3345
|
+
const detail = await readMattermostError(res, headers);
|
|
3094
3346
|
return {
|
|
3095
3347
|
ok: false,
|
|
3096
3348
|
status: res.status,
|