@openclaw/mattermost 2026.9.4 → 2026.9.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/activity.svg +40 -0
- package/assets/icon.png +0 -0
- package/dist/.setup/channel-plugin-api-CCmaCFdK.mjs +3 -0
- package/dist/.setup/channel-plugin-api-CzBhdovL.mjs +40 -0
- package/dist/{channel-plugin-runtime-Dhr44A2Y.js → .setup/channel-plugin-runtime-yAOg5GcM.mjs} +40 -30
- package/dist/{channel.runtime-CYxC0VaI.js → .setup/channel.runtime-CihvzY84.mjs} +419 -200
- package/dist/{client-Dt7Q-j5B.js → .setup/client-BSSVve1x.mjs} +64 -22
- package/dist/{interactions-DF1FH27_.js → .setup/interactions-rBQWCbK8.mjs} +3 -3
- package/dist/{monitor-auth-C6RGYyn-.js → .setup/monitor-auth-CCpN0z_f.mjs} +18 -5
- package/dist/{normalize-R-ATEEHC.js → .setup/normalize-DM54w7ud.mjs} +47 -7
- package/dist/.setup/secret-contract-api-Drab0Nqx.mjs +3 -0
- package/dist/{slash-state-BjBTvP7u.js → .setup/slash-state-DfnmzXMr.mjs} +92 -31
- 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 +29 -2
- package/node_modules/zod/compile.cjs +96 -0
- package/node_modules/zod/compile.d.cts +1 -0
- package/node_modules/zod/compile.d.ts +1 -0
- package/node_modules/zod/compile.js +52 -0
- package/node_modules/zod/index.cjs +21 -2
- package/node_modules/zod/index.d.cts +1 -2
- package/node_modules/zod/index.d.ts +1 -2
- package/node_modules/zod/index.js +5 -2
- package/node_modules/zod/locales/index.cjs +19 -0
- package/node_modules/zod/mini/index.cjs +19 -0
- package/node_modules/zod/package.json +20 -8
- package/node_modules/zod/src/compile.ts +56 -0
- package/node_modules/zod/src/index.ts +5 -2
- package/node_modules/zod/src/v3/ZodError.ts +22 -12
- package/node_modules/zod/src/v3/helpers/errorUtil.ts +1 -1
- package/node_modules/zod/src/v3/tests/error.test.ts +35 -0
- package/node_modules/zod/src/v3/tests/intersection.test.ts +18 -0
- package/node_modules/zod/src/v3/tests/language-server.test.ts +1 -2
- package/node_modules/zod/src/v3/tests/object.test.ts +3 -6
- package/node_modules/zod/src/v3/tests/readonly.test.ts +0 -80
- package/node_modules/zod/src/v3/tests/string.test.ts +6 -0
- package/node_modules/zod/src/v3/types.ts +5 -5
- package/node_modules/zod/src/v4/classic/checks.ts +1 -0
- package/node_modules/zod/src/v4/classic/compat.ts +26 -18
- package/node_modules/zod/src/v4/classic/deep-partial.ts +76 -0
- package/node_modules/zod/src/v4/classic/errors.ts +59 -44
- package/node_modules/zod/src/v4/classic/external.ts +14 -9
- package/node_modules/zod/src/v4/classic/from-json-schema.ts +363 -78
- package/node_modules/zod/src/v4/classic/in-out.ts +45 -0
- package/node_modules/zod/src/v4/classic/index.ts +2 -2
- package/node_modules/zod/src/v4/classic/iso.ts +2 -72
- package/node_modules/zod/src/v4/classic/parse.ts +10 -4
- package/node_modules/zod/src/v4/classic/schemas.ts +640 -375
- package/node_modules/zod/src/v4/classic/tests/apply.test.ts +27 -0
- package/node_modules/zod/src/v4/classic/tests/array.test.ts +2 -2
- package/node_modules/zod/src/v4/classic/tests/assignability.test.ts +186 -0
- package/node_modules/zod/src/v4/classic/tests/bigint.test.ts +36 -1
- package/node_modules/zod/src/v4/classic/tests/catch.test.ts +278 -0
- package/node_modules/zod/src/v4/classic/tests/codec-examples.test.ts +1 -2
- package/node_modules/zod/src/v4/classic/tests/codec.test.ts +2 -1
- package/node_modules/zod/src/v4/classic/tests/continuability.test.ts +3 -3
- package/node_modules/zod/src/v4/classic/tests/credit-card.test.ts +76 -0
- package/node_modules/zod/src/v4/classic/tests/cyclic-data.test.ts +985 -0
- package/node_modules/zod/src/v4/classic/tests/date.test.ts +30 -0
- package/node_modules/zod/src/v4/classic/tests/datetime.test.ts +32 -18
- package/node_modules/zod/src/v4/classic/tests/deep-partial.test.ts +380 -0
- package/node_modules/zod/src/v4/classic/tests/default-locale.test.ts +32 -0
- package/node_modules/zod/src/v4/classic/tests/default.test.ts +46 -0
- package/node_modules/zod/src/v4/classic/tests/detached-methods.test.ts +31 -7
- package/node_modules/zod/src/v4/classic/tests/discriminated-unions.test.ts +261 -13
- package/node_modules/zod/src/v4/classic/tests/enum.test.ts +20 -0
- package/node_modules/zod/src/v4/classic/tests/error-utils.test.ts +112 -2
- package/node_modules/zod/src/v4/classic/tests/error.test.ts +403 -6
- package/node_modules/zod/src/v4/classic/tests/from-json-schema.test.ts +582 -10
- package/node_modules/zod/src/v4/classic/tests/function.test.ts +31 -0
- package/node_modules/zod/src/v4/classic/tests/global-config.test.ts +2 -9
- package/node_modules/zod/src/v4/classic/tests/hash.test.ts +1 -2
- package/node_modules/zod/src/v4/classic/tests/iban.test.ts +81 -0
- package/node_modules/zod/src/v4/classic/tests/in-out.test.ts +159 -0
- package/node_modules/zod/src/v4/classic/tests/index.test.ts +21 -2
- package/node_modules/zod/src/v4/classic/tests/instance-footprint.test.ts +319 -0
- package/node_modules/zod/src/v4/classic/tests/instanceof.test.ts +67 -0
- package/node_modules/zod/src/v4/classic/tests/intersection.test.ts +136 -0
- package/node_modules/zod/src/v4/classic/tests/issue-schema.test.ts +215 -0
- package/node_modules/zod/src/v4/classic/tests/jitless-allows-eval.test.ts +3 -10
- package/node_modules/zod/src/v4/classic/tests/lazy.test.ts +36 -1
- package/node_modules/zod/src/v4/classic/tests/literal.test.ts +12 -1
- package/node_modules/zod/src/v4/classic/tests/map.test.ts +12 -0
- package/node_modules/zod/src/v4/classic/tests/number.test.ts +85 -9
- package/node_modules/zod/src/v4/classic/tests/object.test.ts +301 -12
- package/node_modules/zod/src/v4/classic/tests/optin-ladder.test.ts +235 -0
- package/node_modules/zod/src/v4/classic/tests/optional.test.ts +49 -16
- package/node_modules/zod/src/v4/classic/tests/partial.test.ts +51 -4
- package/node_modules/zod/src/v4/classic/tests/prefault.test.ts +70 -0
- package/node_modules/zod/src/v4/classic/tests/preprocess-types.test.ts +20 -2
- package/node_modules/zod/src/v4/classic/tests/properties.test.ts +141 -0
- package/node_modules/zod/src/v4/classic/tests/readonly.test.ts +0 -68
- package/node_modules/zod/src/v4/classic/tests/record.test.ts +186 -18
- package/node_modules/zod/src/v4/classic/tests/recursive-types.test.ts +79 -3
- package/node_modules/zod/src/v4/classic/tests/redos.test.ts +68 -0
- package/node_modules/zod/src/v4/classic/tests/refine.test.ts +60 -0
- package/node_modules/zod/src/v4/classic/tests/set.test.ts +9 -0
- package/node_modules/zod/src/v4/classic/tests/standard-schema.test.ts +19 -0
- package/node_modules/zod/src/v4/classic/tests/string.test.ts +222 -6
- package/node_modules/zod/src/v4/classic/tests/stringbool.test.ts +18 -0
- package/node_modules/zod/src/v4/classic/tests/template-literal.test.ts +44 -3
- package/node_modules/zod/src/v4/classic/tests/to-json-schema.test.ts +1812 -204
- package/node_modules/zod/src/v4/classic/tests/tuple.test.ts +45 -30
- package/node_modules/zod/src/v4/classic/tests/union.test.ts +39 -2
- package/node_modules/zod/src/v4/classic/tests/validate.test.ts +645 -0
- package/node_modules/zod/src/v4/classic/tests/validations.test.ts +2 -2
- package/node_modules/zod/src/v4/core/api.ts +87 -35
- package/node_modules/zod/src/v4/core/checks.ts +119 -146
- package/node_modules/zod/src/v4/core/compile.ts +2313 -0
- package/node_modules/zod/src/v4/core/core.ts +99 -22
- package/node_modules/zod/src/v4/core/doc.ts +17 -9
- package/node_modules/zod/src/v4/core/errors.ts +113 -25
- package/node_modules/zod/src/v4/core/index.ts +3 -0
- package/node_modules/zod/src/v4/core/json-schema-generator.ts +8 -3
- package/node_modules/zod/src/v4/core/json-schema-processors.ts +424 -156
- package/node_modules/zod/src/v4/core/json-schema.ts +2 -1
- package/node_modules/zod/src/v4/core/memoizer.ts +331 -0
- package/node_modules/zod/src/v4/core/parse.ts +164 -50
- package/node_modules/zod/src/v4/core/regexes.ts +42 -15
- package/node_modules/zod/src/v4/core/registries.ts +2 -2
- package/node_modules/zod/src/v4/core/schemas.ts +1000 -538
- package/node_modules/zod/src/v4/core/tests/cached.test.ts +54 -0
- package/node_modules/zod/src/v4/core/tests/compile-differential.test.ts +1004 -0
- package/node_modules/zod/src/v4/core/tests/compile-generative.test.ts +445 -0
- package/node_modules/zod/src/v4/core/tests/compile-global.test.ts +89 -0
- package/node_modules/zod/src/v4/core/tests/compile-off-by-default.test.ts +26 -0
- package/node_modules/zod/src/v4/core/tests/compile-stats.test.ts +34 -0
- package/node_modules/zod/src/v4/core/tests/compile.test.ts +2036 -0
- package/node_modules/zod/src/v4/core/tests/email-regex.test.ts +140 -0
- package/node_modules/zod/src/v4/core/tests/locales/el.test.ts +1 -2
- package/node_modules/zod/src/v4/core/tests/locales/es.test.ts +1 -2
- package/node_modules/zod/src/v4/core/tests/locales/fr.test.ts +3 -3
- package/node_modules/zod/src/v4/core/tests/locales/parity.test.ts +42 -0
- package/node_modules/zod/src/v4/core/tests/locales/tg.test.ts +85 -0
- package/node_modules/zod/src/v4/core/tests/locales/tk.test.ts +69 -0
- package/node_modules/zod/src/v4/core/tests/polyfill-collision.test.ts +46 -0
- package/node_modules/zod/src/v4/core/tests/treeshake.test.ts +51 -0
- package/node_modules/zod/src/v4/core/tests/url-no-canparse.test.ts +133 -0
- package/node_modules/zod/src/v4/core/to-json-schema.ts +283 -48
- package/node_modules/zod/src/v4/core/util.ts +454 -157
- package/node_modules/zod/src/v4/core/versions.ts +2 -2
- package/node_modules/zod/src/v4/core/visit.ts +193 -0
- package/node_modules/zod/src/v4/index.ts +3 -3
- package/node_modules/zod/src/v4/locales/ar.ts +5 -0
- package/node_modules/zod/src/v4/locales/az.ts +5 -0
- package/node_modules/zod/src/v4/locales/be.ts +12 -0
- package/node_modules/zod/src/v4/locales/bg.ts +5 -0
- package/node_modules/zod/src/v4/locales/bn.ts +123 -0
- package/node_modules/zod/src/v4/locales/ca.ts +5 -0
- package/node_modules/zod/src/v4/locales/ckb.ts +140 -0
- package/node_modules/zod/src/v4/locales/cs.ts +5 -0
- package/node_modules/zod/src/v4/locales/da.ts +7 -2
- package/node_modules/zod/src/v4/locales/de.ts +5 -0
- package/node_modules/zod/src/v4/locales/el.ts +3 -0
- package/node_modules/zod/src/v4/locales/en.ts +17 -4
- package/node_modules/zod/src/v4/locales/eo.ts +5 -0
- package/node_modules/zod/src/v4/locales/es.ts +4 -0
- package/node_modules/zod/src/v4/locales/fa.ts +5 -0
- package/node_modules/zod/src/v4/locales/fi.ts +5 -0
- package/node_modules/zod/src/v4/locales/fr-CA.ts +5 -0
- package/node_modules/zod/src/v4/locales/fr.ts +21 -14
- package/node_modules/zod/src/v4/locales/gu.ts +123 -0
- package/node_modules/zod/src/v4/locales/he.ts +8 -1
- package/node_modules/zod/src/v4/locales/hi.ts +126 -0
- package/node_modules/zod/src/v4/locales/hr.ts +4 -0
- package/node_modules/zod/src/v4/locales/hu.ts +5 -0
- package/node_modules/zod/src/v4/locales/hy.ts +11 -0
- package/node_modules/zod/src/v4/locales/id.ts +5 -0
- package/node_modules/zod/src/v4/locales/index.ts +11 -0
- package/node_modules/zod/src/v4/locales/is.ts +5 -0
- package/node_modules/zod/src/v4/locales/it.ts +5 -0
- package/node_modules/zod/src/v4/locales/ja.ts +5 -0
- package/node_modules/zod/src/v4/locales/ka.ts +5 -0
- package/node_modules/zod/src/v4/locales/km.ts +5 -0
- package/node_modules/zod/src/v4/locales/kn.ts +126 -0
- package/node_modules/zod/src/v4/locales/ko.ts +5 -0
- package/node_modules/zod/src/v4/locales/lt.ts +4 -0
- package/node_modules/zod/src/v4/locales/mk.ts +5 -0
- package/node_modules/zod/src/v4/locales/ms.ts +5 -0
- package/node_modules/zod/src/v4/locales/ne.ts +128 -0
- package/node_modules/zod/src/v4/locales/nl.ts +5 -0
- package/node_modules/zod/src/v4/locales/nn.ts +121 -0
- package/node_modules/zod/src/v4/locales/no.ts +7 -2
- package/node_modules/zod/src/v4/locales/ota.ts +5 -0
- package/node_modules/zod/src/v4/locales/pl.ts +5 -0
- package/node_modules/zod/src/v4/locales/ps.ts +5 -0
- package/node_modules/zod/src/v4/locales/pt-BR.ts +161 -0
- package/node_modules/zod/src/v4/locales/pt.ts +101 -58
- package/node_modules/zod/src/v4/locales/ro.ts +3 -0
- package/node_modules/zod/src/v4/locales/ru.ts +12 -0
- package/node_modules/zod/src/v4/locales/sk.ts +123 -0
- package/node_modules/zod/src/v4/locales/sl.ts +5 -0
- package/node_modules/zod/src/v4/locales/sv.ts +7 -2
- package/node_modules/zod/src/v4/locales/ta.ts +5 -0
- package/node_modules/zod/src/v4/locales/tg.ts +135 -0
- package/node_modules/zod/src/v4/locales/th.ts +5 -0
- package/node_modules/zod/src/v4/locales/tk.ts +113 -0
- package/node_modules/zod/src/v4/locales/tr.ts +5 -0
- package/node_modules/zod/src/v4/locales/uk.ts +5 -0
- package/node_modules/zod/src/v4/locales/ur.ts +5 -0
- package/node_modules/zod/src/v4/locales/uz.ts +3 -0
- package/node_modules/zod/src/v4/locales/vi.ts +5 -0
- package/node_modules/zod/src/v4/locales/yo.ts +5 -0
- package/node_modules/zod/src/v4/locales/zh-CN.ts +5 -0
- package/node_modules/zod/src/v4/locales/zh-TW.ts +5 -0
- package/node_modules/zod/src/v4/mini/checks.ts +1 -0
- package/node_modules/zod/src/v4/mini/deep-partial.ts +73 -0
- package/node_modules/zod/src/v4/mini/external.ts +12 -1
- package/node_modules/zod/src/v4/mini/in-out.ts +45 -0
- package/node_modules/zod/src/v4/mini/parse.ts +2 -0
- package/node_modules/zod/src/v4/mini/schemas.ts +167 -63
- package/node_modules/zod/src/v4/mini/tests/apply.test.ts +33 -0
- package/node_modules/zod/src/v4/mini/tests/assignability.test.ts +62 -1
- package/node_modules/zod/src/v4/mini/tests/checks.test.ts +14 -0
- package/node_modules/zod/src/v4/mini/tests/codec.test.ts +35 -1
- package/node_modules/zod/src/v4/mini/tests/computed.test.ts +11 -17
- package/node_modules/zod/src/v4/mini/tests/cyclic-data.test.ts +84 -0
- package/node_modules/zod/src/v4/mini/tests/deep-partial.test.ts +54 -0
- package/node_modules/zod/src/v4/mini/tests/error.test.ts +23 -4
- package/node_modules/zod/src/v4/mini/tests/functions.test.ts +9 -0
- package/node_modules/zod/src/v4/mini/tests/index.test.ts +158 -5
- package/node_modules/zod/src/v4/mini/tests/number.test.ts +14 -0
- package/node_modules/zod/src/v4/mini/tests/object.test.ts +65 -0
- package/node_modules/zod/src/v4/mini/tests/recursive-types.test.ts +16 -0
- package/node_modules/zod/src/v4/mini/tests/string.test.ts +44 -0
- package/node_modules/zod/v3/ZodError.cjs +41 -12
- package/node_modules/zod/v3/ZodError.d.cts +1 -1
- package/node_modules/zod/v3/ZodError.d.ts +1 -1
- package/node_modules/zod/v3/ZodError.js +22 -12
- package/node_modules/zod/v3/errors.cjs +19 -0
- package/node_modules/zod/v3/external.cjs +19 -0
- package/node_modules/zod/v3/helpers/enumUtil.cjs +19 -0
- package/node_modules/zod/v3/helpers/errorUtil.cjs +20 -1
- package/node_modules/zod/v3/helpers/errorUtil.js +1 -1
- package/node_modules/zod/v3/helpers/parseUtil.cjs +19 -0
- package/node_modules/zod/v3/helpers/partialUtil.cjs +19 -0
- package/node_modules/zod/v3/helpers/typeAliases.cjs +19 -0
- package/node_modules/zod/v3/helpers/util.cjs +19 -0
- package/node_modules/zod/v3/index.cjs +19 -0
- package/node_modules/zod/v3/standard-schema.cjs +19 -0
- package/node_modules/zod/v3/types.cjs +26 -5
- package/node_modules/zod/v3/types.js +7 -5
- package/node_modules/zod/v4/classic/checks.cjs +21 -1
- package/node_modules/zod/v4/classic/checks.d.cts +1 -1
- package/node_modules/zod/v4/classic/checks.d.ts +1 -1
- package/node_modules/zod/v4/classic/checks.js +1 -1
- package/node_modules/zod/v4/classic/coerce.cjs +19 -0
- package/node_modules/zod/v4/classic/compat.cjs +19 -0
- package/node_modules/zod/v4/classic/compat.d.cts +9 -11
- package/node_modules/zod/v4/classic/compat.d.ts +9 -11
- package/node_modules/zod/v4/classic/deep-partial.cjs +58 -0
- package/node_modules/zod/v4/classic/deep-partial.d.cts +14 -0
- package/node_modules/zod/v4/classic/deep-partial.d.ts +14 -0
- package/node_modules/zod/v4/classic/deep-partial.js +13 -0
- package/node_modules/zod/v4/classic/errors.cjs +62 -34
- package/node_modules/zod/v4/classic/errors.d.cts +3 -4
- package/node_modules/zod/v4/classic/errors.d.ts +3 -4
- package/node_modules/zod/v4/classic/errors.js +43 -34
- package/node_modules/zod/v4/classic/external.cjs +51 -27
- package/node_modules/zod/v4/classic/external.d.cts +5 -2
- package/node_modules/zod/v4/classic/external.d.ts +5 -2
- package/node_modules/zod/v4/classic/external.js +5 -8
- package/node_modules/zod/v4/classic/from-json-schema.cjs +376 -75
- package/node_modules/zod/v4/classic/from-json-schema.js +357 -75
- package/node_modules/zod/v4/classic/in-out.cjs +82 -0
- package/node_modules/zod/v4/classic/in-out.d.cts +8 -0
- package/node_modules/zod/v4/classic/in-out.d.ts +8 -0
- package/node_modules/zod/v4/classic/in-out.js +36 -0
- package/node_modules/zod/v4/classic/index.cjs +21 -2
- package/node_modules/zod/v4/classic/index.d.cts +1 -2
- package/node_modules/zod/v4/classic/index.d.ts +1 -2
- package/node_modules/zod/v4/classic/index.js +2 -2
- package/node_modules/zod/v4/classic/iso.cjs +30 -22
- package/node_modules/zod/v4/classic/iso.d.cts +2 -17
- package/node_modules/zod/v4/classic/iso.d.ts +2 -17
- package/node_modules/zod/v4/classic/iso.js +2 -17
- package/node_modules/zod/v4/classic/parse.cjs +23 -1
- package/node_modules/zod/v4/classic/parse.d.cts +17 -4
- package/node_modules/zod/v4/classic/parse.d.ts +17 -4
- package/node_modules/zod/v4/classic/parse.js +1 -0
- package/node_modules/zod/v4/classic/schemas.cjs +591 -426
- package/node_modules/zod/v4/classic/schemas.d.cts +68 -19
- package/node_modules/zod/v4/classic/schemas.d.ts +68 -19
- package/node_modules/zod/v4/classic/schemas.js +564 -424
- package/node_modules/zod/v4/core/api.cjs +66 -24
- package/node_modules/zod/v4/core/api.d.cts +22 -12
- package/node_modules/zod/v4/core/api.d.ts +22 -12
- package/node_modules/zod/v4/core/api.js +44 -24
- package/node_modules/zod/v4/core/checks.cjs +88 -128
- package/node_modules/zod/v4/core/checks.d.cts +29 -13
- package/node_modules/zod/v4/core/checks.d.ts +29 -13
- package/node_modules/zod/v4/core/checks.js +68 -127
- package/node_modules/zod/v4/core/compile.cjs +1908 -0
- package/node_modules/zod/v4/core/compile.d.cts +65 -0
- package/node_modules/zod/v4/core/compile.d.ts +65 -0
- package/node_modules/zod/v4/core/compile.js +1858 -0
- package/node_modules/zod/v4/core/core.cjs +101 -19
- package/node_modules/zod/v4/core/core.d.cts +16 -4
- package/node_modules/zod/v4/core/core.d.ts +16 -4
- package/node_modules/zod/v4/core/core.js +83 -20
- package/node_modules/zod/v4/core/doc.cjs +31 -9
- package/node_modules/zod/v4/core/doc.d.cts +3 -1
- package/node_modules/zod/v4/core/doc.d.ts +3 -1
- package/node_modules/zod/v4/core/doc.js +12 -9
- package/node_modules/zod/v4/core/errors.cjs +126 -25
- package/node_modules/zod/v4/core/errors.d.cts +4 -0
- package/node_modules/zod/v4/core/errors.d.ts +4 -0
- package/node_modules/zod/v4/core/errors.js +107 -25
- package/node_modules/zod/v4/core/index.cjs +24 -1
- package/node_modules/zod/v4/core/index.d.cts +3 -0
- package/node_modules/zod/v4/core/index.d.ts +3 -0
- package/node_modules/zod/v4/core/index.js +3 -0
- package/node_modules/zod/v4/core/json-schema-generator.cjs +24 -1
- package/node_modules/zod/v4/core/json-schema-generator.d.cts +2 -2
- package/node_modules/zod/v4/core/json-schema-generator.d.ts +2 -2
- package/node_modules/zod/v4/core/json-schema-generator.js +6 -2
- package/node_modules/zod/v4/core/json-schema-processors.cjs +441 -156
- package/node_modules/zod/v4/core/json-schema-processors.d.cts +16 -0
- package/node_modules/zod/v4/core/json-schema-processors.d.ts +16 -0
- package/node_modules/zod/v4/core/json-schema-processors.js +400 -158
- package/node_modules/zod/v4/core/json-schema.cjs +19 -0
- package/node_modules/zod/v4/core/json-schema.d.cts +2 -1
- package/node_modules/zod/v4/core/json-schema.d.ts +2 -1
- package/node_modules/zod/v4/core/memoizer.cjs +360 -0
- package/node_modules/zod/v4/core/memoizer.d.cts +15 -0
- package/node_modules/zod/v4/core/memoizer.d.ts +15 -0
- package/node_modules/zod/v4/core/memoizer.js +311 -0
- package/node_modules/zod/v4/core/parse.cjs +148 -46
- package/node_modules/zod/v4/core/parse.d.cts +14 -11
- package/node_modules/zod/v4/core/parse.d.ts +14 -11
- package/node_modules/zod/v4/core/parse.js +127 -45
- package/node_modules/zod/v4/core/regexes.cjs +54 -17
- package/node_modules/zod/v4/core/regexes.d.cts +5 -0
- package/node_modules/zod/v4/core/regexes.d.ts +5 -0
- package/node_modules/zod/v4/core/regexes.js +32 -15
- package/node_modules/zod/v4/core/registries.cjs +19 -0
- package/node_modules/zod/v4/core/registries.js +2 -2
- package/node_modules/zod/v4/core/schemas.cjs +785 -386
- package/node_modules/zod/v4/core/schemas.d.cts +123 -34
- package/node_modules/zod/v4/core/schemas.d.ts +123 -34
- package/node_modules/zod/v4/core/schemas.js +753 -386
- package/node_modules/zod/v4/core/standard-schema.cjs +19 -0
- package/node_modules/zod/v4/core/to-json-schema.cjs +269 -45
- package/node_modules/zod/v4/core/to-json-schema.d.cts +45 -5
- package/node_modules/zod/v4/core/to-json-schema.d.ts +45 -5
- package/node_modules/zod/v4/core/to-json-schema.js +247 -44
- package/node_modules/zod/v4/core/util.cjs +372 -157
- package/node_modules/zod/v4/core/util.d.cts +79 -1
- package/node_modules/zod/v4/core/util.d.ts +79 -1
- package/node_modules/zod/v4/core/util.js +341 -156
- package/node_modules/zod/v4/core/versions.cjs +21 -2
- package/node_modules/zod/v4/core/versions.d.cts +1 -1
- package/node_modules/zod/v4/core/versions.d.ts +1 -1
- package/node_modules/zod/v4/core/versions.js +2 -2
- package/node_modules/zod/v4/core/visit.cjs +214 -0
- package/node_modules/zod/v4/core/visit.d.cts +30 -0
- package/node_modules/zod/v4/core/visit.d.ts +30 -0
- package/node_modules/zod/v4/core/visit.js +169 -0
- package/node_modules/zod/v4/index.cjs +34 -5
- package/node_modules/zod/v4/index.d.cts +2 -2
- package/node_modules/zod/v4/index.d.ts +2 -2
- package/node_modules/zod/v4/index.js +3 -2
- package/node_modules/zod/v4/locales/ar.cjs +5 -0
- package/node_modules/zod/v4/locales/ar.js +5 -0
- package/node_modules/zod/v4/locales/az.cjs +5 -0
- package/node_modules/zod/v4/locales/az.js +5 -0
- package/node_modules/zod/v4/locales/be.cjs +12 -0
- package/node_modules/zod/v4/locales/be.js +12 -0
- package/node_modules/zod/v4/locales/bg.cjs +5 -0
- package/node_modules/zod/v4/locales/bg.js +5 -0
- package/node_modules/zod/v4/locales/bn.cjs +140 -0
- package/node_modules/zod/v4/locales/bn.d.cts +5 -0
- package/node_modules/zod/v4/locales/bn.d.ts +4 -0
- package/node_modules/zod/v4/locales/bn.js +113 -0
- package/node_modules/zod/v4/locales/ca.cjs +5 -0
- package/node_modules/zod/v4/locales/ca.js +5 -0
- package/node_modules/zod/v4/locales/ckb.cjs +160 -0
- package/node_modules/zod/v4/locales/ckb.d.cts +5 -0
- package/node_modules/zod/v4/locales/ckb.d.ts +4 -0
- package/node_modules/zod/v4/locales/ckb.js +133 -0
- package/node_modules/zod/v4/locales/cs.cjs +5 -0
- package/node_modules/zod/v4/locales/cs.js +5 -0
- package/node_modules/zod/v4/locales/da.cjs +7 -2
- package/node_modules/zod/v4/locales/da.js +7 -2
- package/node_modules/zod/v4/locales/de.cjs +5 -0
- package/node_modules/zod/v4/locales/de.js +5 -0
- package/node_modules/zod/v4/locales/el.cjs +3 -0
- package/node_modules/zod/v4/locales/el.js +3 -0
- package/node_modules/zod/v4/locales/en.cjs +16 -4
- package/node_modules/zod/v4/locales/en.js +16 -4
- package/node_modules/zod/v4/locales/eo.cjs +5 -0
- package/node_modules/zod/v4/locales/eo.js +5 -0
- package/node_modules/zod/v4/locales/es.cjs +4 -0
- package/node_modules/zod/v4/locales/es.js +4 -0
- package/node_modules/zod/v4/locales/fa.cjs +5 -0
- package/node_modules/zod/v4/locales/fa.js +5 -0
- package/node_modules/zod/v4/locales/fi.cjs +5 -0
- package/node_modules/zod/v4/locales/fi.js +5 -0
- package/node_modules/zod/v4/locales/fr-CA.cjs +5 -0
- package/node_modules/zod/v4/locales/fr-CA.js +5 -0
- package/node_modules/zod/v4/locales/fr.cjs +18 -14
- package/node_modules/zod/v4/locales/fr.js +18 -14
- package/node_modules/zod/v4/locales/gu.cjs +140 -0
- package/node_modules/zod/v4/locales/gu.d.cts +5 -0
- package/node_modules/zod/v4/locales/gu.d.ts +4 -0
- package/node_modules/zod/v4/locales/gu.js +113 -0
- package/node_modules/zod/v4/locales/he.cjs +7 -0
- package/node_modules/zod/v4/locales/he.js +7 -0
- package/node_modules/zod/v4/locales/hi.cjs +138 -0
- package/node_modules/zod/v4/locales/hi.d.cts +5 -0
- package/node_modules/zod/v4/locales/hi.d.ts +4 -0
- package/node_modules/zod/v4/locales/hi.js +111 -0
- package/node_modules/zod/v4/locales/hr.cjs +4 -0
- package/node_modules/zod/v4/locales/hr.js +4 -0
- package/node_modules/zod/v4/locales/hu.cjs +5 -0
- package/node_modules/zod/v4/locales/hu.js +5 -0
- package/node_modules/zod/v4/locales/hy.cjs +11 -0
- package/node_modules/zod/v4/locales/hy.js +11 -0
- package/node_modules/zod/v4/locales/id.cjs +5 -0
- package/node_modules/zod/v4/locales/id.js +5 -0
- package/node_modules/zod/v4/locales/index.cjs +43 -2
- package/node_modules/zod/v4/locales/index.d.cts +11 -0
- package/node_modules/zod/v4/locales/index.d.ts +11 -0
- package/node_modules/zod/v4/locales/index.js +11 -0
- package/node_modules/zod/v4/locales/is.cjs +5 -0
- package/node_modules/zod/v4/locales/is.js +5 -0
- package/node_modules/zod/v4/locales/it.cjs +5 -0
- package/node_modules/zod/v4/locales/it.js +5 -0
- package/node_modules/zod/v4/locales/ja.cjs +5 -0
- package/node_modules/zod/v4/locales/ja.js +5 -0
- package/node_modules/zod/v4/locales/ka.cjs +5 -0
- package/node_modules/zod/v4/locales/ka.js +5 -0
- package/node_modules/zod/v4/locales/km.cjs +5 -0
- package/node_modules/zod/v4/locales/km.js +5 -0
- package/node_modules/zod/v4/locales/kn.cjs +143 -0
- package/node_modules/zod/v4/locales/kn.d.cts +5 -0
- package/node_modules/zod/v4/locales/kn.d.ts +4 -0
- package/node_modules/zod/v4/locales/kn.js +116 -0
- package/node_modules/zod/v4/locales/ko.cjs +5 -0
- package/node_modules/zod/v4/locales/ko.js +5 -0
- package/node_modules/zod/v4/locales/lt.cjs +4 -0
- package/node_modules/zod/v4/locales/lt.js +4 -0
- package/node_modules/zod/v4/locales/mk.cjs +5 -0
- package/node_modules/zod/v4/locales/mk.js +5 -0
- package/node_modules/zod/v4/locales/ms.cjs +5 -0
- package/node_modules/zod/v4/locales/ms.js +5 -0
- package/node_modules/zod/v4/locales/ne.cjs +138 -0
- package/node_modules/zod/v4/locales/ne.d.cts +5 -0
- package/node_modules/zod/v4/locales/ne.d.ts +4 -0
- package/node_modules/zod/v4/locales/ne.js +111 -0
- package/node_modules/zod/v4/locales/nl.cjs +5 -0
- package/node_modules/zod/v4/locales/nl.js +5 -0
- package/node_modules/zod/v4/locales/nn.cjs +140 -0
- package/node_modules/zod/v4/locales/nn.d.cts +5 -0
- package/node_modules/zod/v4/locales/nn.d.ts +4 -0
- package/node_modules/zod/v4/locales/nn.js +113 -0
- package/node_modules/zod/v4/locales/no.cjs +7 -2
- package/node_modules/zod/v4/locales/no.js +7 -2
- package/node_modules/zod/v4/locales/ota.cjs +5 -0
- package/node_modules/zod/v4/locales/ota.js +5 -0
- package/node_modules/zod/v4/locales/pl.cjs +5 -0
- package/node_modules/zod/v4/locales/pl.js +5 -0
- package/node_modules/zod/v4/locales/ps.cjs +5 -0
- package/node_modules/zod/v4/locales/ps.js +5 -0
- package/node_modules/zod/v4/locales/pt-BR.cjs +170 -0
- package/node_modules/zod/v4/locales/pt-BR.d.cts +5 -0
- package/node_modules/zod/v4/locales/pt-BR.d.ts +4 -0
- package/node_modules/zod/v4/locales/pt-BR.js +143 -0
- package/node_modules/zod/v4/locales/pt.cjs +89 -55
- package/node_modules/zod/v4/locales/pt.js +89 -55
- package/node_modules/zod/v4/locales/ro.cjs +3 -0
- package/node_modules/zod/v4/locales/ro.js +3 -0
- package/node_modules/zod/v4/locales/ru.cjs +12 -0
- package/node_modules/zod/v4/locales/ru.js +12 -0
- package/node_modules/zod/v4/locales/sk.cjs +143 -0
- package/node_modules/zod/v4/locales/sk.d.cts +5 -0
- package/node_modules/zod/v4/locales/sk.d.ts +4 -0
- package/node_modules/zod/v4/locales/sk.js +116 -0
- package/node_modules/zod/v4/locales/sl.cjs +5 -0
- package/node_modules/zod/v4/locales/sl.js +5 -0
- package/node_modules/zod/v4/locales/sv.cjs +7 -2
- package/node_modules/zod/v4/locales/sv.js +7 -2
- package/node_modules/zod/v4/locales/ta.cjs +5 -0
- package/node_modules/zod/v4/locales/ta.js +5 -0
- package/node_modules/zod/v4/locales/tg.cjs +144 -0
- package/node_modules/zod/v4/locales/tg.d.cts +5 -0
- package/node_modules/zod/v4/locales/tg.d.ts +4 -0
- package/node_modules/zod/v4/locales/tg.js +117 -0
- package/node_modules/zod/v4/locales/th.cjs +5 -0
- package/node_modules/zod/v4/locales/th.js +5 -0
- package/node_modules/zod/v4/locales/tk.cjs +134 -0
- package/node_modules/zod/v4/locales/tk.d.cts +5 -0
- package/node_modules/zod/v4/locales/tk.d.ts +4 -0
- package/node_modules/zod/v4/locales/tk.js +107 -0
- package/node_modules/zod/v4/locales/tr.cjs +5 -0
- package/node_modules/zod/v4/locales/tr.js +5 -0
- package/node_modules/zod/v4/locales/uk.cjs +5 -0
- package/node_modules/zod/v4/locales/uk.js +5 -0
- package/node_modules/zod/v4/locales/ur.cjs +5 -0
- package/node_modules/zod/v4/locales/ur.js +5 -0
- package/node_modules/zod/v4/locales/uz.cjs +3 -0
- package/node_modules/zod/v4/locales/uz.js +3 -0
- package/node_modules/zod/v4/locales/vi.cjs +5 -0
- package/node_modules/zod/v4/locales/vi.js +5 -0
- package/node_modules/zod/v4/locales/yo.cjs +5 -0
- package/node_modules/zod/v4/locales/yo.js +5 -0
- package/node_modules/zod/v4/locales/zh-CN.cjs +5 -0
- package/node_modules/zod/v4/locales/zh-CN.js +5 -0
- package/node_modules/zod/v4/locales/zh-TW.cjs +5 -0
- package/node_modules/zod/v4/locales/zh-TW.js +5 -0
- package/node_modules/zod/v4/mini/checks.cjs +21 -1
- package/node_modules/zod/v4/mini/checks.d.cts +1 -1
- package/node_modules/zod/v4/mini/checks.d.ts +1 -1
- package/node_modules/zod/v4/mini/checks.js +1 -1
- package/node_modules/zod/v4/mini/coerce.cjs +19 -0
- package/node_modules/zod/v4/mini/deep-partial.cjs +58 -0
- package/node_modules/zod/v4/mini/deep-partial.d.cts +14 -0
- package/node_modules/zod/v4/mini/deep-partial.d.ts +14 -0
- package/node_modules/zod/v4/mini/deep-partial.js +13 -0
- package/node_modules/zod/v4/mini/external.cjs +33 -1
- package/node_modules/zod/v4/mini/external.d.cts +5 -2
- package/node_modules/zod/v4/mini/external.d.ts +5 -2
- package/node_modules/zod/v4/mini/external.js +3 -1
- package/node_modules/zod/v4/mini/in-out.cjs +82 -0
- package/node_modules/zod/v4/mini/in-out.d.cts +8 -0
- package/node_modules/zod/v4/mini/in-out.d.ts +8 -0
- package/node_modules/zod/v4/mini/in-out.js +36 -0
- package/node_modules/zod/v4/mini/index.cjs +19 -0
- package/node_modules/zod/v4/mini/iso.cjs +19 -0
- package/node_modules/zod/v4/mini/parse.cjs +22 -1
- package/node_modules/zod/v4/mini/parse.d.cts +1 -1
- package/node_modules/zod/v4/mini/parse.d.ts +1 -1
- package/node_modules/zod/v4/mini/parse.js +1 -1
- package/node_modules/zod/v4/mini/schemas.cjs +117 -53
- package/node_modules/zod/v4/mini/schemas.d.cts +49 -14
- package/node_modules/zod/v4/mini/schemas.d.ts +49 -14
- package/node_modules/zod/v4/mini/schemas.js +92 -51
- package/node_modules/zod/v4-mini/index.cjs +19 -0
- package/openclaw.plugin.json +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,12 +1,12 @@
|
|
|
1
1
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
2
2
|
import { bufferToBlobPart } from "openclaw/plugin-sdk/blob-runtime";
|
|
3
3
|
import { createChannelPartialDeliveryError } from "openclaw/plugin-sdk/channel-inbound";
|
|
4
|
-
import { collectErrorGraphCandidates } from "openclaw/plugin-sdk/error-runtime";
|
|
4
|
+
import { PlatformMessageNotDispatchedError, collectErrorGraphCandidates } from "openclaw/plugin-sdk/error-runtime";
|
|
5
5
|
import { buildTimeoutAbortSignal } from "openclaw/plugin-sdk/extension-shared";
|
|
6
|
-
import { responseWithRelease } from "openclaw/plugin-sdk/fetch-runtime";
|
|
6
|
+
import { captureChannelReadAuthority, responseWithRelease } from "openclaw/plugin-sdk/fetch-runtime";
|
|
7
7
|
import { resolveTimerTimeoutMs } from "openclaw/plugin-sdk/number-runtime";
|
|
8
|
-
import { readProviderJsonResponse,
|
|
9
|
-
import { readResponseWithLimit } from "openclaw/plugin-sdk/response-limit-runtime";
|
|
8
|
+
import { readProviderJsonResponse, redactProviderResponseErrorText } from "openclaw/plugin-sdk/provider-http";
|
|
9
|
+
import { readResponseTextPrefix, readResponseWithLimit } from "openclaw/plugin-sdk/response-limit-runtime";
|
|
10
10
|
import { retryAsync } from "openclaw/plugin-sdk/retry-runtime";
|
|
11
11
|
import { fetchWithSsrFGuard, ssrfPolicyFromPrivateNetworkOptIn } from "openclaw/plugin-sdk/ssrf-runtime";
|
|
12
12
|
import { z } from "zod";
|
|
@@ -63,17 +63,18 @@ async function readMattermostSuccessText(res, path) {
|
|
|
63
63
|
const bytes = await readResponseWithLimit(res, MATTERMOST_TEXT_RESPONSE_LIMIT_BYTES, { onOverflow: ({ maxBytes }) => /* @__PURE__ */ new Error(`Mattermost API ${path}: text response exceeds ${maxBytes} bytes`) });
|
|
64
64
|
return new TextDecoder().decode(bytes);
|
|
65
65
|
}
|
|
66
|
-
async function readMattermostError(res) {
|
|
66
|
+
async function readMattermostError(res, requestHeaders) {
|
|
67
67
|
const contentType = res.headers.get("content-type") ?? "";
|
|
68
|
-
const text = await
|
|
68
|
+
const { text, truncated } = await readResponseTextPrefix(res, MATTERMOST_ERROR_BODY_LIMIT_BYTES, {
|
|
69
|
+
chunkTimeoutMs: 1e4,
|
|
70
|
+
onIdleTimeout: ({ chunkTimeoutMs }) => /* @__PURE__ */ new Error(`error body read stalled for ${chunkTimeoutMs}ms`)
|
|
71
|
+
});
|
|
72
|
+
let detail = text;
|
|
69
73
|
if (contentType.includes("application/json")) try {
|
|
70
74
|
const data = JSON.parse(text);
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
return text;
|
|
75
|
-
}
|
|
76
|
-
return text;
|
|
75
|
+
detail = data !== null && typeof data === "object" && "message" in data && typeof data.message === "string" && data.message ? data.message : JSON.stringify(data);
|
|
76
|
+
} catch {}
|
|
77
|
+
return redactProviderResponseErrorText(detail, requestHeaders, { sourceTruncated: truncated });
|
|
77
78
|
}
|
|
78
79
|
function createMattermostClient(params) {
|
|
79
80
|
const baseUrl = normalizeMattermostBaseUrl(params.baseUrl);
|
|
@@ -81,14 +82,36 @@ function createMattermostClient(params) {
|
|
|
81
82
|
const apiBaseUrl = `${baseUrl}/api/v4`;
|
|
82
83
|
const token = params.botToken.trim();
|
|
83
84
|
const requestTimeoutMs = resolveTimerTimeoutMs(params.timeoutMs, MATTERMOST_REQUEST_TIMEOUT_MS);
|
|
85
|
+
const assertSenderCurrent = params.assertRequestCurrent;
|
|
86
|
+
let postDispatchStarted = false;
|
|
87
|
+
const assertRequestCurrent = assertSenderCurrent ? () => {
|
|
88
|
+
try {
|
|
89
|
+
assertSenderCurrent();
|
|
90
|
+
} catch (error) {
|
|
91
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
92
|
+
if (postDispatchStarted) throw new AggregateError([error, /* @__PURE__ */ new Error("A Mattermost post request was already dispatched")], message, { cause: error });
|
|
93
|
+
throw new PlatformMessageNotDispatchedError(message, {
|
|
94
|
+
cause: error,
|
|
95
|
+
retryable: false
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
} : void 0;
|
|
84
99
|
const externalFetchImpl = params.fetchImpl;
|
|
85
100
|
const guardedFetchImpl = async (input, init) => {
|
|
101
|
+
const assertReadAuthority = captureChannelReadAuthority();
|
|
102
|
+
assertReadAuthority?.();
|
|
103
|
+
assertRequestCurrent?.();
|
|
86
104
|
const url = typeof input === "string" ? input : input instanceof URL ? input.toString() : input.url;
|
|
87
|
-
const { timeoutMs: initTimeoutMs, ...requestInit } = init ?? {};
|
|
105
|
+
const { timeoutMs: initTimeoutMs, isMessagePost, ...requestInit } = init ?? {};
|
|
88
106
|
const timeoutMs = resolveTimerTimeoutMs(initTimeoutMs, requestTimeoutMs);
|
|
89
107
|
const { response, release } = await fetchWithSsrFGuard({
|
|
90
108
|
url,
|
|
91
109
|
init: requestInit,
|
|
110
|
+
beforeRequest: () => {
|
|
111
|
+
assertReadAuthority?.();
|
|
112
|
+
assertRequestCurrent?.();
|
|
113
|
+
if (isMessagePost) postDispatchStarted = true;
|
|
114
|
+
},
|
|
92
115
|
auditContext: "mattermost-api",
|
|
93
116
|
policy: ssrfPolicyFromPrivateNetworkOptIn(params.allowPrivateNetwork),
|
|
94
117
|
signal: requestInit.signal ?? void 0,
|
|
@@ -97,8 +120,9 @@ function createMattermostClient(params) {
|
|
|
97
120
|
return responseWithRelease(response, release);
|
|
98
121
|
};
|
|
99
122
|
const fetchImpl = (externalFetchImpl ? async (input, init) => {
|
|
123
|
+
captureChannelReadAuthority()?.();
|
|
100
124
|
const url = typeof input === "string" ? input : input instanceof URL ? input.toString() : input.url;
|
|
101
|
-
const { timeoutMs: initTimeoutMs, ...requestInit } = init ?? {};
|
|
125
|
+
const { timeoutMs: initTimeoutMs, isMessagePost, ...requestInit } = init ?? {};
|
|
102
126
|
const timeoutMs = resolveTimerTimeoutMs(initTimeoutMs, requestTimeoutMs);
|
|
103
127
|
const { signal: timeoutSignal, cleanup } = buildTimeoutAbortSignal({
|
|
104
128
|
timeoutMs,
|
|
@@ -108,6 +132,8 @@ function createMattermostClient(params) {
|
|
|
108
132
|
const callerSignal = requestInit.signal ?? void 0;
|
|
109
133
|
const signal = callerSignal && timeoutSignal ? AbortSignal.any([callerSignal, timeoutSignal]) : callerSignal ?? timeoutSignal;
|
|
110
134
|
try {
|
|
135
|
+
assertRequestCurrent?.();
|
|
136
|
+
if (isMessagePost) postDispatchStarted = true;
|
|
111
137
|
const response = await externalFetchImpl(input, {
|
|
112
138
|
...requestInit,
|
|
113
139
|
signal
|
|
@@ -123,20 +149,28 @@ function createMattermostClient(params) {
|
|
|
123
149
|
const headers = new Headers(init?.headers);
|
|
124
150
|
headers.set("Authorization", `Bearer ${token}`);
|
|
125
151
|
if (typeof init?.body === "string" && !headers.has("Content-Type")) headers.set("Content-Type", "application/json");
|
|
152
|
+
const isMessagePost = path === "/posts" && init?.method?.toUpperCase() === "POST";
|
|
126
153
|
const res = await fetchImpl(url, {
|
|
127
154
|
...init,
|
|
128
|
-
headers
|
|
155
|
+
headers,
|
|
156
|
+
isMessagePost
|
|
129
157
|
});
|
|
130
158
|
if (!res.ok) {
|
|
131
|
-
const detail = await readMattermostError(res);
|
|
159
|
+
const detail = await readMattermostError(res, headers);
|
|
132
160
|
throw new Error(`Mattermost API ${res.status} ${res.statusText}: ${detail || "unknown error"}`);
|
|
133
161
|
}
|
|
134
162
|
if (res.status === 204) return;
|
|
163
|
+
if (path === "/reactions" && init?.method?.toUpperCase() === "POST") {
|
|
164
|
+
try {
|
|
165
|
+
await res.body?.cancel();
|
|
166
|
+
} catch {}
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
135
169
|
try {
|
|
136
170
|
if ((res.headers.get("content-type") ?? "").includes("application/json")) return await readProviderJsonResponse(res, `Mattermost API ${path}`);
|
|
137
171
|
return await readMattermostSuccessText(res, path);
|
|
138
172
|
} catch (error) {
|
|
139
|
-
if (
|
|
173
|
+
if (isMessagePost) throw createChannelPartialDeliveryError(error, {
|
|
140
174
|
messageIds: [],
|
|
141
175
|
visibleReplySent: true
|
|
142
176
|
});
|
|
@@ -148,7 +182,8 @@ function createMattermostClient(params) {
|
|
|
148
182
|
apiBaseUrl,
|
|
149
183
|
token,
|
|
150
184
|
request,
|
|
151
|
-
fetchImpl
|
|
185
|
+
fetchImpl,
|
|
186
|
+
...assertRequestCurrent ? { assertRequestCurrent } : {}
|
|
152
187
|
};
|
|
153
188
|
}
|
|
154
189
|
async function fetchMattermostMe(client) {
|
|
@@ -266,6 +301,7 @@ async function createMattermostDirectChannelWithRetry(client, userIds, options =
|
|
|
266
301
|
});
|
|
267
302
|
}
|
|
268
303
|
function isRetryableError(error) {
|
|
304
|
+
if (error instanceof PlatformMessageNotDispatchedError && !error.retryable) return false;
|
|
269
305
|
const candidates = collectErrorGraphCandidates(error, (current) => [
|
|
270
306
|
current.cause,
|
|
271
307
|
current.reason,
|
|
@@ -343,7 +379,12 @@ async function updateMattermostPost(client, postId, params) {
|
|
|
343
379
|
const payload = { id: postId };
|
|
344
380
|
if (params.message !== void 0) payload.message = params.message;
|
|
345
381
|
if (params.props !== void 0) payload.props = params.props;
|
|
346
|
-
|
|
382
|
+
else if (params.message !== void 0 && /\B@(channel|all|here)\b/i.test(params.message)) {
|
|
383
|
+
const current = MattermostPostSchema.parse(await client.request(`/posts/${postId}`));
|
|
384
|
+
if (current.id !== postId) throw new Error("Mattermost post lookup returned a different post id");
|
|
385
|
+
payload.props = current.props ?? {};
|
|
386
|
+
}
|
|
387
|
+
return await client.request(`/posts/${postId}/patch`, {
|
|
347
388
|
method: "PUT",
|
|
348
389
|
body: JSON.stringify(payload)
|
|
349
390
|
});
|
|
@@ -357,13 +398,14 @@ async function uploadMattermostFile(client, params) {
|
|
|
357
398
|
const blob = new Blob([bufferToBlobPart(params.buffer)], { type: params.contentType });
|
|
358
399
|
form.append("files", blob, fileName);
|
|
359
400
|
form.append("channel_id", params.channelId);
|
|
401
|
+
const headers = { Authorization: `Bearer ${client.token}` };
|
|
360
402
|
const res = await client.fetchImpl(`${client.apiBaseUrl}/files`, {
|
|
361
403
|
method: "POST",
|
|
362
|
-
headers
|
|
404
|
+
headers,
|
|
363
405
|
body: form
|
|
364
406
|
});
|
|
365
407
|
if (!res.ok) {
|
|
366
|
-
const detail = await readMattermostError(res);
|
|
408
|
+
const detail = await readMattermostError(res, headers);
|
|
367
409
|
throw new Error(`Mattermost API ${res.status} ${res.statusText}: ${detail || "unknown error"}`);
|
|
368
410
|
}
|
|
369
411
|
const info = (await readProviderJsonResponse(res, "Mattermost API /files")).file_infos?.[0];
|
|
@@ -371,4 +413,4 @@ async function uploadMattermostFile(client, params) {
|
|
|
371
413
|
return info;
|
|
372
414
|
}
|
|
373
415
|
//#endregion
|
|
374
|
-
export {
|
|
416
|
+
export { readMattermostError as _, createMattermostPost as a, uploadMattermostFile as b, fetchMattermostChannelByName as c, fetchMattermostUser as d, fetchMattermostUserByUsername as f, parseMattermostApiStatus as g, normalizeMattermostBaseUrl as h, createMattermostDirectChannelWithRetry as i, fetchMattermostChannelPosts as l, isRetryableError as m, buildMattermostApiUrl as n, deleteMattermostPost as o, fetchMattermostUserTeams as p, createMattermostClient as r, fetchMattermostChannel as s, MattermostPostSchema as t, fetchMattermostMe as u, sendMattermostTyping as v, updateMattermostPost as y };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as getMattermostRuntime } from "./runtime-CNB4YGqJ.
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { t as getMattermostRuntime } from "./runtime-CNB4YGqJ.mjs";
|
|
2
|
+
import { y as updateMattermostPost } from "./client-BSSVve1x.mjs";
|
|
3
|
+
import { D as sendHttpRequestRejection, T as resolveClientIp, g as isTrustedProxyAddress, h as isRequestBodyLimitError, x as readRequestBodyWithLimit } from "./monitor-auth-CCpN0z_f.mjs";
|
|
4
4
|
import { createHmac } from "node:crypto";
|
|
5
5
|
import { resolveGatewayPort } from "openclaw/plugin-sdk/gateway-config-runtime";
|
|
6
6
|
import { safeEqualSecret } from "openclaw/plugin-sdk/security-runtime";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as getMattermostRuntime } from "./runtime-CNB4YGqJ.mjs";
|
|
2
|
+
import { n as normalizeMattermostAllowEntry, t as mattermostIngressIdentity } from "./ingress-identity-DNl4yQSc.mjs";
|
|
2
3
|
import { uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
4
|
import { logInboundDrop } from "openclaw/plugin-sdk/channel-inbound";
|
|
4
5
|
import { resolveAllowlistMatchSimple } from "openclaw/plugin-sdk/allow-from";
|
|
@@ -14,9 +15,9 @@ import { loadOutboundMediaFromUrl } from "openclaw/plugin-sdk/outbound-media";
|
|
|
14
15
|
import { DEFAULT_GROUP_HISTORY_LIMIT, createChannelHistoryWindow } from "openclaw/plugin-sdk/reply-history";
|
|
15
16
|
import { registerPluginHttpRoute } from "openclaw/plugin-sdk/webhook-targets";
|
|
16
17
|
import { isRequestBodyLimitError } from "openclaw/plugin-sdk/webhook-ingress";
|
|
17
|
-
import { readRequestBodyWithLimit, sendHttpRequestRejection } from "openclaw/plugin-sdk/webhook-request-guards";
|
|
18
|
+
import { createWebhookInFlightLimiter, readRequestBodyWithLimit, sendHttpRequestRejection } from "openclaw/plugin-sdk/webhook-request-guards";
|
|
18
19
|
import { isTrustedProxyAddress, resolveClientIp } from "openclaw/plugin-sdk/core";
|
|
19
|
-
import {
|
|
20
|
+
import { resolveChannelContextVisibilityMode, shouldIncludeSupplementalContext } from "openclaw/plugin-sdk/context-visibility-runtime";
|
|
20
21
|
//#region extensions/mattermost/src/mattermost/monitor-auth.ts
|
|
21
22
|
function normalizeMattermostAllowList(entries) {
|
|
22
23
|
const normalized = entries.map((entry) => normalizeMattermostAllowEntry(String(entry))).filter(Boolean);
|
|
@@ -54,7 +55,7 @@ async function resolveMattermostMonitorInboundAccess(params) {
|
|
|
54
55
|
const configAllowFrom = account.config.allowFrom ?? [];
|
|
55
56
|
const configGroupAllowFrom = account.config.groupAllowFrom ?? [];
|
|
56
57
|
const readStoreAllowFrom = params.readStoreAllowFrom ?? (storeAllowFrom != null ? async () => [...storeAllowFrom] : void 0);
|
|
57
|
-
return await
|
|
58
|
+
return await getMattermostRuntime().channel.inbound.ingress.resolveStable({
|
|
58
59
|
channelId: "mattermost",
|
|
59
60
|
accountId: account.accountId,
|
|
60
61
|
identity: mattermostIngressIdentity,
|
|
@@ -89,6 +90,18 @@ async function resolveMattermostMonitorInboundAccess(params) {
|
|
|
89
90
|
}
|
|
90
91
|
});
|
|
91
92
|
}
|
|
93
|
+
/** Live and recovered history share the same trigger-versus-visibility policy. */
|
|
94
|
+
function shouldRetainMattermostSenderHistory(params) {
|
|
95
|
+
return params.ingress.decision === "allow" || params.kind !== "direct" && params.ingress.reasonCode === "group_policy_not_allowlisted" && shouldIncludeSupplementalContext({
|
|
96
|
+
mode: resolveChannelContextVisibilityMode({
|
|
97
|
+
cfg: params.cfg,
|
|
98
|
+
channel: "mattermost",
|
|
99
|
+
accountId: params.accountId
|
|
100
|
+
}),
|
|
101
|
+
kind: "history",
|
|
102
|
+
senderAllowed: false
|
|
103
|
+
});
|
|
104
|
+
}
|
|
92
105
|
function resolveMattermostCommandDenyReason(params) {
|
|
93
106
|
if (params.decision.decision === "allow") return null;
|
|
94
107
|
if (params.kind === "direct") {
|
|
@@ -162,4 +175,4 @@ async function authorizeMattermostCommandInvocation(params) {
|
|
|
162
175
|
};
|
|
163
176
|
}
|
|
164
177
|
//#endregion
|
|
165
|
-
export {
|
|
178
|
+
export { resolveAllowlistProviderRuntimeGroupPolicy$1 as C, sendHttpRequestRejection as D, resolveDefaultGroupPolicy as E, warnMissingProviderGroupPolicyFallbackOnce as O, registerPluginHttpRoute as S, resolveClientIp as T, listSkillCommandsForAgents as _, resolveMattermostMonitorInboundAccess as a, logTypingFailure as b, DEFAULT_GROUP_HISTORY_LIMIT as c, createChannelMessageReplyPipeline as d, createChannelPairingController as f, isTrustedProxyAddress as g, isRequestBodyLimitError as h, normalizeMattermostAllowList as i, buildPreparedModelsProviderData as l, isDangerousNameMatchingEnabled as m, formatMattermostDirectMessageDropLog as n, resolveMattermostTrustedChatKind as o, createWebhookInFlightLimiter as p, isMattermostSenderAllowed as r, shouldRetainMattermostSenderHistory as s, authorizeMattermostCommandInvocation as t, createChannelHistoryWindow as u, loadOutboundMediaFromUrl as v, resolveChannelMediaMaxBytes$1 as w, readRequestBodyWithLimit as x, logInboundDrop as y };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { h as normalizeMattermostBaseUrl } from "./client-BSSVve1x.mjs";
|
|
2
2
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
3
|
import { resolveChannelPreviewStreamMode, resolveChannelStreamingBlockCoalesce, resolveChannelStreamingBlockEnabled, resolveChannelStreamingChunkMode } from "openclaw/plugin-sdk/channel-outbound";
|
|
4
4
|
import { createAccountListHelpers, hasConfiguredAccountValue } from "openclaw/plugin-sdk/account-helpers";
|
|
5
5
|
import { normalizeMessagePresentation, renderMessagePresentationFallbackText, resolveMessagePresentationControlValue } from "openclaw/plugin-sdk/interactive-runtime";
|
|
6
|
+
import { resolveAskUserQuestionOptionIndex, resolveAskUserQuestionOptionIndices } from "openclaw/plugin-sdk/reply-payload";
|
|
6
7
|
import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
7
8
|
import { buildSecretInputSchema, hasConfiguredSecretInput, resolveSecretInputString } from "openclaw/plugin-sdk/secret-input";
|
|
8
9
|
//#region extensions/mattermost/src/mattermost/accounts.ts
|
|
@@ -93,15 +94,54 @@ function resolveMattermostReplyToMode(account, kind) {
|
|
|
93
94
|
}
|
|
94
95
|
//#endregion
|
|
95
96
|
//#region extensions/mattermost/src/normalize.ts
|
|
97
|
+
/** Marks a button context as one this plugin answers through the question Gateway. */
|
|
98
|
+
const MATTERMOST_QUESTION_CONTEXT_KEY = "oc_question";
|
|
99
|
+
/**
|
|
100
|
+
* Read a question selection back out of a verified interaction context.
|
|
101
|
+
*
|
|
102
|
+
* The context is HMAC-signed on the way out and verified before this runs, so
|
|
103
|
+
* the ids here are the ones this Gateway wrote, not the clicker's input.
|
|
104
|
+
*/
|
|
105
|
+
function parseMattermostQuestionContext(context) {
|
|
106
|
+
if (context[MATTERMOST_QUESTION_CONTEXT_KEY] !== true) return null;
|
|
107
|
+
const questionId = context.question_id;
|
|
108
|
+
const optionIndex = context.option_index;
|
|
109
|
+
if (typeof questionId !== "string" || !questionId || typeof optionIndex !== "number") return null;
|
|
110
|
+
return Number.isInteger(optionIndex) && optionIndex >= 0 ? {
|
|
111
|
+
questionId,
|
|
112
|
+
optionIndex
|
|
113
|
+
} : null;
|
|
114
|
+
}
|
|
96
115
|
function resolveMattermostPresentation(params) {
|
|
97
116
|
const presentation = normalizeMessagePresentation(params.presentation);
|
|
117
|
+
const text = !presentation || params.presentationTextMode === "fallback" && params.text !== void 0 ? params.text ?? "" : renderMessagePresentationFallbackText({
|
|
118
|
+
text: params.text,
|
|
119
|
+
presentation
|
|
120
|
+
});
|
|
121
|
+
const questionOptionIndices = resolveAskUserQuestionOptionIndices({ channelData: params.channelData });
|
|
98
122
|
return {
|
|
99
|
-
text
|
|
100
|
-
text: params.text,
|
|
101
|
-
presentation
|
|
102
|
-
}),
|
|
123
|
+
text,
|
|
103
124
|
buttons: presentation ? presentation.blocks.filter((block) => block.type === "buttons").map((block) => block.buttons.flatMap((button) => {
|
|
104
|
-
|
|
125
|
+
const action = button.action;
|
|
126
|
+
if (action?.type === "question") {
|
|
127
|
+
if ("intent" in action) return [];
|
|
128
|
+
const optionIndex = resolveAskUserQuestionOptionIndex({
|
|
129
|
+
questionOptionIndices,
|
|
130
|
+
questionId: action.questionId,
|
|
131
|
+
optionValue: action.optionValue
|
|
132
|
+
});
|
|
133
|
+
return optionIndex === void 0 ? [] : [{
|
|
134
|
+
id: `question-${optionIndex}`,
|
|
135
|
+
text: button.label,
|
|
136
|
+
context: {
|
|
137
|
+
[MATTERMOST_QUESTION_CONTEXT_KEY]: true,
|
|
138
|
+
question_id: action.questionId,
|
|
139
|
+
option_index: optionIndex
|
|
140
|
+
},
|
|
141
|
+
style: button.style
|
|
142
|
+
}];
|
|
143
|
+
}
|
|
144
|
+
if (action) return [];
|
|
105
145
|
const value = resolveMessagePresentationControlValue(button);
|
|
106
146
|
return value ? [{
|
|
107
147
|
id: value,
|
|
@@ -156,4 +196,4 @@ function looksLikeMattermostTargetId(raw, _normalized) {
|
|
|
156
196
|
return /^[a-z0-9]{26}$/i.test(trimmed) || /^[a-z0-9]{26}__[a-z0-9]{26}$/i.test(trimmed);
|
|
157
197
|
}
|
|
158
198
|
//#endregion
|
|
159
|
-
export {
|
|
199
|
+
export { resolveMattermostPresentation as a, listMattermostAccountIds as c, resolveMattermostReplyToMode as d, buildSecretInputSchema as f, requiresMattermostMediaUpload as i, resolveDefaultMattermostAccountId as l, normalizeMattermostMessagingTarget as n, inspectMattermostAccount as o, hasConfiguredSecretInput as p, parseMattermostQuestionContext as r, isMattermostConfigured as s, looksLikeMattermostTargetId as t, resolveMattermostAccount as u };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { t as getMattermostRuntime } from "./runtime-CNB4YGqJ.
|
|
2
|
-
import { c as setInteractionSecret, l as isWildcardBindHost, n as buildButtonProps, o as resolveInteractionCallbackUrl } from "./interactions-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { t as getMattermostRuntime } from "./runtime-CNB4YGqJ.mjs";
|
|
2
|
+
import { c as setInteractionSecret, l as isWildcardBindHost, n as buildButtonProps, o as resolveInteractionCallbackUrl } from "./interactions-rBQWCbK8.mjs";
|
|
3
|
+
import { a as createMattermostPost, b as uploadMattermostFile, c as fetchMattermostChannelByName, d as fetchMattermostUser, f as fetchMattermostUserByUsername, g as parseMattermostApiStatus, h as normalizeMattermostBaseUrl, i as createMattermostDirectChannelWithRetry, p as fetchMattermostUserTeams, r as createMattermostClient, s as fetchMattermostChannel, u as fetchMattermostMe, v as sendMattermostTyping } from "./client-BSSVve1x.mjs";
|
|
4
|
+
import { D as sendHttpRequestRejection, b as logTypingFailure, h as isRequestBodyLimitError, i as normalizeMattermostAllowList, l as buildPreparedModelsProviderData, o as resolveMattermostTrustedChatKind, p as createWebhookInFlightLimiter, t as authorizeMattermostCommandInvocation, v as loadOutboundMediaFromUrl, x as readRequestBodyWithLimit } from "./monitor-auth-CCpN0z_f.mjs";
|
|
5
|
+
import { a as resolveMattermostPresentation, i as requiresMattermostMediaUpload, u as resolveMattermostAccount } from "./normalize-DM54w7ud.mjs";
|
|
6
6
|
import { createHash } from "node:crypto";
|
|
7
7
|
import { safeEqualSecret } from "openclaw/plugin-sdk/security-runtime";
|
|
8
8
|
import { asFiniteNumber, normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeStringifiedOptionalString, readStringField } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
@@ -976,23 +976,31 @@ async function resolveMattermostSendContext(to, opts) {
|
|
|
976
976
|
const client = createMattermostClient({
|
|
977
977
|
baseUrl,
|
|
978
978
|
botToken: token,
|
|
979
|
-
allowPrivateNetwork: isPrivateNetworkOptInEnabled(account.config)
|
|
980
|
-
|
|
981
|
-
const trimmedTo = normalizeOptionalString(to) ?? "";
|
|
982
|
-
const channelId = await resolveTargetChannelId({
|
|
983
|
-
target: parseMattermostTarget((await resolveMattermostOpaqueTarget({
|
|
984
|
-
input: trimmedTo,
|
|
985
|
-
client
|
|
986
|
-
}))?.to ?? trimmedTo),
|
|
987
|
-
client,
|
|
988
|
-
dmRetryOptions: mergeDmRetryOptions(account.config.dmChannelRetry ? {
|
|
989
|
-
maxRetries: account.config.dmChannelRetry.maxRetries,
|
|
990
|
-
initialDelayMs: account.config.dmChannelRetry.initialDelayMs,
|
|
991
|
-
maxDelayMs: account.config.dmChannelRetry.maxDelayMs,
|
|
992
|
-
timeoutMs: account.config.dmChannelRetry.timeoutMs
|
|
993
|
-
} : void 0, opts.dmRetryOptions),
|
|
994
|
-
logger: core.logging.shouldLogVerbose() ? logger : void 0
|
|
979
|
+
allowPrivateNetwork: isPrivateNetworkOptInEnabled(account.config),
|
|
980
|
+
assertRequestCurrent: opts.assertDirectAdapterHandoff
|
|
995
981
|
});
|
|
982
|
+
const dmRetryOptions = mergeDmRetryOptions(account.config.dmChannelRetry ? {
|
|
983
|
+
maxRetries: account.config.dmChannelRetry.maxRetries,
|
|
984
|
+
initialDelayMs: account.config.dmChannelRetry.initialDelayMs,
|
|
985
|
+
maxDelayMs: account.config.dmChannelRetry.maxDelayMs,
|
|
986
|
+
timeoutMs: account.config.dmChannelRetry.timeoutMs
|
|
987
|
+
} : void 0, opts.dmRetryOptions);
|
|
988
|
+
let channelId;
|
|
989
|
+
try {
|
|
990
|
+
const trimmedTo = normalizeOptionalString(to) ?? "";
|
|
991
|
+
channelId = await resolveTargetChannelId({
|
|
992
|
+
target: parseMattermostTarget((await resolveMattermostOpaqueTarget({
|
|
993
|
+
input: trimmedTo,
|
|
994
|
+
client
|
|
995
|
+
}))?.to ?? trimmedTo),
|
|
996
|
+
client,
|
|
997
|
+
dmRetryOptions,
|
|
998
|
+
logger: core.logging.shouldLogVerbose() ? logger : void 0
|
|
999
|
+
});
|
|
1000
|
+
} catch (error) {
|
|
1001
|
+
client.assertRequestCurrent?.();
|
|
1002
|
+
throw error;
|
|
1003
|
+
}
|
|
996
1004
|
return {
|
|
997
1005
|
cfg,
|
|
998
1006
|
accountId: account.accountId,
|
|
@@ -1009,6 +1017,7 @@ async function sendMessageMattermost(to, text, opts) {
|
|
|
1009
1017
|
const core = getCore();
|
|
1010
1018
|
const logger = core.logging.getChildLogger({ module: "mattermost" });
|
|
1011
1019
|
const { cfg, accountId, client, channelId, mediaMaxBytes } = await resolveMattermostSendContext(to, opts);
|
|
1020
|
+
client.assertRequestCurrent?.();
|
|
1012
1021
|
let props = opts.props;
|
|
1013
1022
|
if (!props && Array.isArray(opts.buttons) && opts.buttons.length > 0) {
|
|
1014
1023
|
setInteractionSecret(accountId, client.token);
|
|
@@ -1044,6 +1053,7 @@ async function sendMessageMattermost(to, text, opts) {
|
|
|
1044
1053
|
contentType: media.contentType ?? void 0
|
|
1045
1054
|
})).id];
|
|
1046
1055
|
} catch (err) {
|
|
1056
|
+
client.assertRequestCurrent?.();
|
|
1047
1057
|
uploadError = err instanceof Error ? err : new Error(String(err));
|
|
1048
1058
|
if (opts.requireMediaUpload || mediaMaxBytes !== void 0) throw new Error(`Mattermost media upload failed: ${uploadError.message}`, { cause: err });
|
|
1049
1059
|
if (core.logging.shouldLogVerbose()) logger.debug?.(`mattermost send: media upload failed, falling back to URL text: ${String(err)}`);
|
|
@@ -1061,6 +1071,13 @@ async function sendMessageMattermost(to, text, opts) {
|
|
|
1061
1071
|
if (uploadError) throw new Error(`Mattermost media upload failed: ${uploadError.message}`, { cause: uploadError });
|
|
1062
1072
|
throw new Error("Mattermost message is empty");
|
|
1063
1073
|
}
|
|
1074
|
+
client.assertRequestCurrent?.();
|
|
1075
|
+
try {
|
|
1076
|
+
await opts.onPlatformSendDispatch?.();
|
|
1077
|
+
} catch (error) {
|
|
1078
|
+
client.assertRequestCurrent?.();
|
|
1079
|
+
throw error;
|
|
1080
|
+
}
|
|
1064
1081
|
const post = await createMattermostPost(client, {
|
|
1065
1082
|
channelId,
|
|
1066
1083
|
message,
|
|
@@ -1423,7 +1440,7 @@ async function authorizeSlashInvocation(params) {
|
|
|
1423
1440
|
*/
|
|
1424
1441
|
function createSlashCommandHttpHandler(params) {
|
|
1425
1442
|
const { account, cfg, runtime, registeredCommands, triggerMap, log, bodyTimeoutMs } = params;
|
|
1426
|
-
return async (req, res, bufferedBody) => {
|
|
1443
|
+
return async (req, res, bufferedBody, onRequestAuthenticated) => {
|
|
1427
1444
|
if (req.method !== "POST") {
|
|
1428
1445
|
res.statusCode = 405;
|
|
1429
1446
|
res.setHeader("Allow", "POST");
|
|
@@ -1454,7 +1471,7 @@ function createSlashCommandHttpHandler(params) {
|
|
|
1454
1471
|
registeredCommands,
|
|
1455
1472
|
payload
|
|
1456
1473
|
});
|
|
1457
|
-
if (
|
|
1474
|
+
if (!registeredCommand || !safeEqualSecret(payload.token, registeredCommand.token)) {
|
|
1458
1475
|
sendJsonResponse(res, 401, {
|
|
1459
1476
|
response_type: "ephemeral",
|
|
1460
1477
|
text: "Unauthorized: invalid command token."
|
|
@@ -1479,6 +1496,7 @@ function createSlashCommandHttpHandler(params) {
|
|
|
1479
1496
|
});
|
|
1480
1497
|
return;
|
|
1481
1498
|
}
|
|
1499
|
+
onRequestAuthenticated?.();
|
|
1482
1500
|
const trigger = normalizeSlashCommandTrigger(payload.command);
|
|
1483
1501
|
const commandText = resolveCommandText(trigger, payload.text, triggerMap);
|
|
1484
1502
|
const channelId = payload.channel_id;
|
|
@@ -1554,9 +1572,14 @@ async function handleSlashCommandAsync(params) {
|
|
|
1554
1572
|
const to = kind === "direct" ? `user:${senderId}` : `channel:${channelId}`;
|
|
1555
1573
|
const pickerEntry = resolveMattermostModelPickerEntry(commandText);
|
|
1556
1574
|
if (pickerEntry) {
|
|
1557
|
-
const
|
|
1575
|
+
const sessionEntry = getSessionEntry({
|
|
1576
|
+
storePath: resolveStorePath(cfg.session?.store, { agentId: route.agentId }),
|
|
1577
|
+
sessionKey: route.sessionKey,
|
|
1578
|
+
readConsistency: "latest"
|
|
1579
|
+
});
|
|
1580
|
+
const data = await buildPreparedModelsProviderData(cfg, route.agentId, { sessionEntry });
|
|
1558
1581
|
if (data.providers.length === 0) {
|
|
1559
|
-
await sendMessageMattermost(`channel:${channelId}`, "No models available.", {
|
|
1582
|
+
await sendMessageMattermost(`channel:${channelId}`, [data.refreshWarning, "No models available."].filter(Boolean).join("\n\n"), {
|
|
1560
1583
|
cfg,
|
|
1561
1584
|
accountId: account.accountId
|
|
1562
1585
|
});
|
|
@@ -1581,7 +1604,7 @@ async function handleSlashCommandAsync(params) {
|
|
|
1581
1604
|
page: 1,
|
|
1582
1605
|
currentModel
|
|
1583
1606
|
});
|
|
1584
|
-
await sendMessageMattermost(`channel:${channelId}`, view.text, {
|
|
1607
|
+
await sendMessageMattermost(`channel:${channelId}`, [data.refreshWarning, view.text].filter(Boolean).join("\n\n"), {
|
|
1585
1608
|
cfg,
|
|
1586
1609
|
accountId: account.accountId,
|
|
1587
1610
|
buttons: view.buttons
|
|
@@ -1623,7 +1646,6 @@ async function handleSlashCommandAsync(params) {
|
|
|
1623
1646
|
channel: "mattermost",
|
|
1624
1647
|
accountId: account.accountId
|
|
1625
1648
|
});
|
|
1626
|
-
const humanDelay = resolveHumanDelayConfig(cfg, route.agentId);
|
|
1627
1649
|
await core.channel.inbound.dispatch({
|
|
1628
1650
|
cfg,
|
|
1629
1651
|
channel: "mattermost",
|
|
@@ -1666,14 +1688,28 @@ async function handleSlashCommandAsync(params) {
|
|
|
1666
1688
|
});
|
|
1667
1689
|
}
|
|
1668
1690
|
} },
|
|
1669
|
-
dispatcherOptions: { humanDelay },
|
|
1691
|
+
dispatcherOptions: { humanDelay: resolveHumanDelayConfig(cfg, route.agentId) },
|
|
1670
1692
|
replyOptions: { disableBlockStreaming: typeof account.blockStreaming === "boolean" ? !account.blockStreaming : void 0 }
|
|
1671
1693
|
});
|
|
1672
1694
|
}
|
|
1673
1695
|
//#endregion
|
|
1674
1696
|
//#region extensions/mattermost/src/mattermost/slash-state.ts
|
|
1697
|
+
/**
|
|
1698
|
+
* Shared state for Mattermost slash commands.
|
|
1699
|
+
*
|
|
1700
|
+
* Bridges the plugin registration phase (HTTP route) with the monitor phase
|
|
1701
|
+
* (command registration with MM API). The HTTP handler needs to know which
|
|
1702
|
+
* tokens are known for fast-path routing, and the monitor needs to store
|
|
1703
|
+
* registered command IDs.
|
|
1704
|
+
*
|
|
1705
|
+
* State is kept per-account so that multi-account deployments don't
|
|
1706
|
+
* overwrite each other's tokens, registered commands, or handlers.
|
|
1707
|
+
*/
|
|
1675
1708
|
const MULTI_ACCOUNT_BODY_MAX_BYTES = 65536;
|
|
1676
1709
|
const MULTI_ACCOUNT_BODY_TIMEOUT_MS = 5e3;
|
|
1710
|
+
const slashRouteInFlightLimiter = createWebhookInFlightLimiter();
|
|
1711
|
+
const SLASH_ROUTE_IN_FLIGHT_KEY = "mattermost:slash";
|
|
1712
|
+
const SLASH_AUTHENTICATED_IN_FLIGHT_KEY = `${SLASH_ROUTE_IN_FLIGHT_KEY}:authenticated`;
|
|
1677
1713
|
/**
|
|
1678
1714
|
* Map from accountId → per-account slash command state.
|
|
1679
1715
|
*
|
|
@@ -1693,6 +1729,13 @@ function getSlashAccountStates() {
|
|
|
1693
1729
|
return accountStates;
|
|
1694
1730
|
}
|
|
1695
1731
|
const accountStates = getSlashAccountStates();
|
|
1732
|
+
function resolveSlashRouteInFlightKey(authorization) {
|
|
1733
|
+
const token = authorization?.match(/^Token ([^,\s]+)$/iu)?.[1];
|
|
1734
|
+
if (!token) return SLASH_ROUTE_IN_FLIGHT_KEY;
|
|
1735
|
+
let matched = false;
|
|
1736
|
+
for (const state of accountStates.values()) for (const commandToken of state.commandTokens) matched = safeEqualSecret(token, commandToken) || matched;
|
|
1737
|
+
return matched ? `${SLASH_AUTHENTICATED_IN_FLIGHT_KEY}:${createHash("sha256").update(`${SLASH_AUTHENTICATED_IN_FLIGHT_KEY}:${token}`).digest("hex")}` : SLASH_ROUTE_IN_FLIGHT_KEY;
|
|
1738
|
+
}
|
|
1696
1739
|
function resolveSlashHandlerForToken(token) {
|
|
1697
1740
|
const matches = [];
|
|
1698
1741
|
for (const [accountId, state] of accountStates) if (state.commandTokens.has(token) && state.handler) matches.push({
|
|
@@ -1822,7 +1865,7 @@ function registerSlashCommandRoute(api) {
|
|
|
1822
1865
|
const accountCommandsRaw = accountsRaw[accountId]?.commands;
|
|
1823
1866
|
addCallbackPaths(accountCommandsRaw);
|
|
1824
1867
|
}
|
|
1825
|
-
const
|
|
1868
|
+
const dispatchRoute = async (req, res, onRequestAuthenticated) => {
|
|
1826
1869
|
if (accountStates.size === 0) {
|
|
1827
1870
|
res.statusCode = 503;
|
|
1828
1871
|
res.setHeader("Content-Type", "application/json; charset=utf-8");
|
|
@@ -1843,7 +1886,7 @@ function registerSlashCommandRoute(api) {
|
|
|
1843
1886
|
}));
|
|
1844
1887
|
return;
|
|
1845
1888
|
}
|
|
1846
|
-
await state.handler(req, res);
|
|
1889
|
+
await state.handler(req, res, void 0, onRequestAuthenticated);
|
|
1847
1890
|
return;
|
|
1848
1891
|
}
|
|
1849
1892
|
let bodyStr;
|
|
@@ -1895,7 +1938,25 @@ function registerSlashCommandRoute(api) {
|
|
|
1895
1938
|
}));
|
|
1896
1939
|
return;
|
|
1897
1940
|
}
|
|
1898
|
-
await match.handler(req, res, bodyStr);
|
|
1941
|
+
await match.handler(req, res, bodyStr, onRequestAuthenticated);
|
|
1942
|
+
};
|
|
1943
|
+
const routeHandler = async (req, res) => {
|
|
1944
|
+
const inFlightKey = resolveSlashRouteInFlightKey(req.headers.authorization);
|
|
1945
|
+
if (!slashRouteInFlightLimiter.tryAcquire(inFlightKey)) {
|
|
1946
|
+
await sendHttpRequestRejection(req, res, 429, "Too Many Requests");
|
|
1947
|
+
return;
|
|
1948
|
+
}
|
|
1949
|
+
let released = false;
|
|
1950
|
+
const release = () => {
|
|
1951
|
+
if (released) return;
|
|
1952
|
+
released = true;
|
|
1953
|
+
slashRouteInFlightLimiter.release(inFlightKey);
|
|
1954
|
+
};
|
|
1955
|
+
try {
|
|
1956
|
+
await dispatchRoute(req, res, release);
|
|
1957
|
+
} finally {
|
|
1958
|
+
release();
|
|
1959
|
+
}
|
|
1899
1960
|
};
|
|
1900
1961
|
for (const callbackPath of callbackPaths) api.registerHttpRoute({
|
|
1901
1962
|
path: callbackPath,
|
package/dist/api.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { t as buildButtonAttachments } from "
|
|
2
|
-
import { r as isMattermostSenderAllowed } from "
|
|
1
|
+
import { t as buildButtonAttachments } from "./.setup/interactions-rBQWCbK8.mjs";
|
|
2
|
+
import { r as isMattermostSenderAllowed } from "./.setup/monitor-auth-CCpN0z_f.mjs";
|
|
3
3
|
export { buildButtonAttachments, isMattermostSenderAllowed };
|
|
@@ -1,40 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { t as resolveMattermostGatewayAuthBypassPaths } from "./gateway-auth-bypass-B93t91oq.js";
|
|
4
|
-
//#region extensions/mattermost/src/channel.setup.ts
|
|
5
|
-
const mattermostSetupPlugin = {
|
|
6
|
-
id: "mattermost",
|
|
7
|
-
meta: { ...mattermostMeta },
|
|
8
|
-
capabilities: {
|
|
9
|
-
chatTypes: [
|
|
10
|
-
"direct",
|
|
11
|
-
"channel",
|
|
12
|
-
"group",
|
|
13
|
-
"thread"
|
|
14
|
-
],
|
|
15
|
-
reactions: true,
|
|
16
|
-
threads: true,
|
|
17
|
-
media: true,
|
|
18
|
-
nativeCommands: true
|
|
19
|
-
},
|
|
20
|
-
reload: {
|
|
21
|
-
configPrefixes: ["channels.mattermost"],
|
|
22
|
-
noopPrefixes: ["messages.inbound"],
|
|
23
|
-
/**
|
|
24
|
-
* accounts.default is promoted; named resolution merges only channel-wide fields
|
|
25
|
-
* plus the selected account. Runtime monitor, debounce, and ingress use accountId.
|
|
26
|
-
*/
|
|
27
|
-
accountScopedRestart: true
|
|
28
|
-
},
|
|
29
|
-
configSchema: MattermostChannelConfigSchema,
|
|
30
|
-
config: {
|
|
31
|
-
...mattermostConfigAdapter,
|
|
32
|
-
isConfigured: isMattermostConfigured,
|
|
33
|
-
describeAccount: describeMattermostAccount
|
|
34
|
-
},
|
|
35
|
-
gateway: { resolveGatewayAuthBypassPaths: resolveMattermostGatewayAuthBypassPaths },
|
|
36
|
-
setupContract: mattermostSetupContract,
|
|
37
|
-
setupWizard: mattermostSetupWizard
|
|
38
|
-
};
|
|
39
|
-
//#endregion
|
|
1
|
+
import { t as mattermostPlugin } from "./.setup/channel-plugin-runtime-yAOg5GcM.mjs";
|
|
2
|
+
import { t as mattermostSetupPlugin } from "./.setup/channel-plugin-api-CzBhdovL.mjs";
|
|
40
3
|
export { mattermostPlugin, mattermostSetupPlugin };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as mattermostPlugin } from "
|
|
1
|
+
import { t as mattermostPlugin } from "./.setup/channel-plugin-runtime-yAOg5GcM.mjs";
|
|
2
2
|
export { mattermostPlugin };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as normalizeCompatibilityConfig, t as legacyConfigRules } from "
|
|
1
|
+
import { n as normalizeCompatibilityConfig, t as legacyConfigRules } from "./.setup/doctor-contract-mvORF4f6.mjs";
|
|
2
2
|
export { legacyConfigRules, normalizeCompatibilityConfig };
|
package/dist/gateway-auth-api.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as resolveMattermostGatewayAuthBypassPaths } from "
|
|
1
|
+
import { t as resolveMattermostGatewayAuthBypassPaths } from "./.setup/gateway-auth-bypass-B93t91oq.mjs";
|
|
2
2
|
export { resolveMattermostGatewayAuthBypassPaths as resolveGatewayAuthBypassPaths };
|
package/dist/policy-api.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { r as isMattermostSenderAllowed } from "
|
|
1
|
+
import { r as isMattermostSenderAllowed } from "./.setup/monitor-auth-CCpN0z_f.mjs";
|
|
2
2
|
export { isMattermostSenderAllowed };
|