@openclaw/mattermost 2026.9.5 → 2026.9.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/icon.png +0 -0
- package/dist/.setup/{channel-plugin-api-N-mnrhds.mjs → channel-plugin-api-Bc8Qc1-t.mjs} +2 -2
- package/dist/.setup/{channel-plugin-api-CKz3b0dp.mjs → channel-plugin-api-DXqHarCt.mjs} +2 -2
- package/dist/.setup/{channel-plugin-runtime-Ca4cZHq2.mjs → channel-plugin-runtime-B0CAMiHe.mjs} +146 -176
- package/dist/.setup/channel.runtime-E2B5dNrh.mjs +383 -0
- package/dist/.setup/{client-Cx71KZ1x.mjs → client-CVeeTqCO.mjs} +55 -46
- package/dist/.setup/doctor-contract-BI6SB2cd.mjs +175 -0
- package/dist/.setup/{interactions-BG-CQbVD.mjs → interactions-DMSZYnEx.mjs} +170 -80
- package/dist/.setup/{channel.runtime-C074p7wv.mjs → monitor-BZyzPkkb.mjs} +237 -726
- package/dist/.setup/{monitor-auth-DBoM2Bja.mjs → monitor-auth-aZ0b1gqx.mjs} +11 -16
- package/dist/.setup/{normalize-BQzx2u8S.mjs → normalize-BCjtmxtp.mjs} +8 -17
- package/dist/.setup/rolldown-runtime-BBjsoOtd.mjs +27 -0
- package/dist/.setup/send-ClgX-usq.mjs +438 -0
- package/dist/.setup/{slash-state-CmyIYDIc.mjs → slash-state-Dni1XNc1.mjs} +144 -764
- package/dist/api.js +2 -2
- package/dist/channel-plugin-api.js +2 -2
- package/dist/channel-plugin-runtime.js +1 -1
- package/dist/doctor-contract-api.js +1 -1
- package/dist/policy-api.js +1 -1
- package/dist/runtime-api.js +2 -23
- package/dist/setup-entry.js +1 -1
- package/dist/slash-route-api.js +1 -1
- package/node_modules/zod/README.md +2 -2
- package/node_modules/zod/compile.cjs +19 -0
- package/node_modules/zod/index.cjs +19 -0
- package/node_modules/zod/locales/index.cjs +19 -0
- package/node_modules/zod/mini/index.cjs +19 -0
- package/node_modules/zod/package.json +8 -7
- package/node_modules/zod/src/v3/helpers/errorUtil.ts +1 -1
- package/node_modules/zod/src/v4/classic/external.ts +2 -0
- package/node_modules/zod/src/v4/classic/from-json-schema.ts +248 -25
- package/node_modules/zod/src/v4/classic/schemas.ts +243 -168
- package/node_modules/zod/src/v4/classic/tests/assignability.test.ts +60 -9
- package/node_modules/zod/src/v4/classic/tests/bigint.test.ts +6 -0
- package/node_modules/zod/src/v4/classic/tests/continuability.test.ts +2 -2
- package/node_modules/zod/src/v4/classic/tests/cyclic-data.test.ts +265 -0
- package/node_modules/zod/src/v4/classic/tests/discriminated-unions.test.ts +112 -6
- package/node_modules/zod/src/v4/classic/tests/enum.test.ts +9 -0
- package/node_modules/zod/src/v4/classic/tests/error.test.ts +130 -1
- package/node_modules/zod/src/v4/classic/tests/from-json-schema.test.ts +157 -0
- package/node_modules/zod/src/v4/classic/tests/iban.test.ts +81 -0
- package/node_modules/zod/src/v4/classic/tests/instance-footprint.test.ts +40 -2
- package/node_modules/zod/src/v4/classic/tests/instanceof.test.ts +27 -7
- package/node_modules/zod/src/v4/classic/tests/issue-schema.test.ts +88 -56
- package/node_modules/zod/src/v4/classic/tests/number.test.ts +39 -0
- package/node_modules/zod/src/v4/classic/tests/object.test.ts +56 -0
- package/node_modules/zod/src/v4/classic/tests/optin-ladder.test.ts +3 -2
- package/node_modules/zod/src/v4/classic/tests/prefault.test.ts +70 -0
- package/node_modules/zod/src/v4/classic/tests/properties.test.ts +141 -0
- package/node_modules/zod/src/v4/classic/tests/recursive-types.test.ts +46 -1
- package/node_modules/zod/src/v4/classic/tests/standard-schema.test.ts +19 -0
- package/node_modules/zod/src/v4/classic/tests/string.test.ts +95 -1
- package/node_modules/zod/src/v4/classic/tests/template-literal.test.ts +33 -1
- package/node_modules/zod/src/v4/classic/tests/to-json-schema.test.ts +234 -38
- package/node_modules/zod/src/v4/classic/tests/validate.test.ts +569 -0
- package/node_modules/zod/src/v4/core/api.ts +44 -28
- package/node_modules/zod/src/v4/core/checks.ts +62 -102
- package/node_modules/zod/src/v4/core/compile.ts +218 -93
- package/node_modules/zod/src/v4/core/core.ts +1 -3
- package/node_modules/zod/src/v4/core/doc.ts +6 -2
- package/node_modules/zod/src/v4/core/errors.ts +3 -6
- package/node_modules/zod/src/v4/core/json-schema-generator.ts +2 -2
- package/node_modules/zod/src/v4/core/json-schema-processors.ts +185 -81
- package/node_modules/zod/src/v4/core/memoizer.ts +75 -28
- package/node_modules/zod/src/v4/core/parse.ts +37 -16
- package/node_modules/zod/src/v4/core/regexes.ts +14 -4
- package/node_modules/zod/src/v4/core/schemas.ts +296 -132
- package/node_modules/zod/src/v4/core/tests/cached.test.ts +54 -0
- package/node_modules/zod/src/v4/core/tests/compile-differential.test.ts +35 -0
- package/node_modules/zod/src/v4/core/tests/compile-generative.test.ts +445 -0
- package/node_modules/zod/src/v4/core/tests/compile.test.ts +399 -2
- package/node_modules/zod/src/v4/core/tests/email-regex.test.ts +140 -0
- package/node_modules/zod/src/v4/core/tests/locales/tg.test.ts +85 -0
- package/node_modules/zod/src/v4/core/tests/polyfill-collision.test.ts +46 -0
- package/node_modules/zod/src/v4/core/tests/url-no-canparse.test.ts +118 -16
- package/node_modules/zod/src/v4/core/to-json-schema.ts +9 -7
- package/node_modules/zod/src/v4/core/util.ts +218 -147
- package/node_modules/zod/src/v4/core/versions.ts +2 -2
- package/node_modules/zod/src/v4/locales/ar.ts +2 -0
- package/node_modules/zod/src/v4/locales/az.ts +2 -0
- package/node_modules/zod/src/v4/locales/be.ts +2 -0
- package/node_modules/zod/src/v4/locales/bg.ts +2 -0
- package/node_modules/zod/src/v4/locales/bn.ts +2 -0
- package/node_modules/zod/src/v4/locales/ca.ts +2 -0
- package/node_modules/zod/src/v4/locales/ckb.ts +2 -0
- package/node_modules/zod/src/v4/locales/cs.ts +2 -0
- package/node_modules/zod/src/v4/locales/da.ts +2 -0
- package/node_modules/zod/src/v4/locales/de.ts +2 -0
- package/node_modules/zod/src/v4/locales/el.ts +2 -0
- package/node_modules/zod/src/v4/locales/en.ts +2 -0
- package/node_modules/zod/src/v4/locales/eo.ts +2 -0
- package/node_modules/zod/src/v4/locales/es.ts +2 -0
- package/node_modules/zod/src/v4/locales/fa.ts +2 -0
- package/node_modules/zod/src/v4/locales/fi.ts +2 -0
- package/node_modules/zod/src/v4/locales/fr-CA.ts +2 -0
- package/node_modules/zod/src/v4/locales/fr.ts +2 -0
- package/node_modules/zod/src/v4/locales/gu.ts +2 -0
- package/node_modules/zod/src/v4/locales/he.ts +2 -0
- package/node_modules/zod/src/v4/locales/hi.ts +2 -0
- package/node_modules/zod/src/v4/locales/hr.ts +2 -0
- package/node_modules/zod/src/v4/locales/hu.ts +2 -0
- package/node_modules/zod/src/v4/locales/hy.ts +2 -0
- package/node_modules/zod/src/v4/locales/id.ts +2 -0
- package/node_modules/zod/src/v4/locales/index.ts +1 -0
- package/node_modules/zod/src/v4/locales/is.ts +2 -0
- package/node_modules/zod/src/v4/locales/it.ts +2 -0
- package/node_modules/zod/src/v4/locales/ja.ts +2 -0
- package/node_modules/zod/src/v4/locales/ka.ts +2 -0
- package/node_modules/zod/src/v4/locales/km.ts +2 -0
- package/node_modules/zod/src/v4/locales/kn.ts +2 -0
- package/node_modules/zod/src/v4/locales/ko.ts +2 -0
- package/node_modules/zod/src/v4/locales/lt.ts +2 -0
- package/node_modules/zod/src/v4/locales/mk.ts +2 -0
- package/node_modules/zod/src/v4/locales/ms.ts +2 -0
- package/node_modules/zod/src/v4/locales/ne.ts +2 -0
- package/node_modules/zod/src/v4/locales/nl.ts +2 -0
- package/node_modules/zod/src/v4/locales/nn.ts +2 -0
- package/node_modules/zod/src/v4/locales/no.ts +2 -0
- package/node_modules/zod/src/v4/locales/ota.ts +2 -0
- package/node_modules/zod/src/v4/locales/pl.ts +2 -0
- package/node_modules/zod/src/v4/locales/ps.ts +2 -0
- package/node_modules/zod/src/v4/locales/pt-BR.ts +2 -0
- package/node_modules/zod/src/v4/locales/pt.ts +2 -0
- package/node_modules/zod/src/v4/locales/ro.ts +2 -0
- package/node_modules/zod/src/v4/locales/ru.ts +2 -0
- package/node_modules/zod/src/v4/locales/sk.ts +2 -0
- package/node_modules/zod/src/v4/locales/sl.ts +2 -0
- package/node_modules/zod/src/v4/locales/sv.ts +2 -0
- package/node_modules/zod/src/v4/locales/ta.ts +2 -0
- package/node_modules/zod/src/v4/locales/tg.ts +135 -0
- package/node_modules/zod/src/v4/locales/th.ts +2 -0
- package/node_modules/zod/src/v4/locales/tk.ts +2 -0
- package/node_modules/zod/src/v4/locales/tr.ts +2 -0
- package/node_modules/zod/src/v4/locales/uk.ts +2 -0
- package/node_modules/zod/src/v4/locales/ur.ts +2 -0
- package/node_modules/zod/src/v4/locales/uz.ts +2 -0
- package/node_modules/zod/src/v4/locales/vi.ts +2 -0
- package/node_modules/zod/src/v4/locales/yo.ts +2 -0
- package/node_modules/zod/src/v4/locales/zh-CN.ts +2 -0
- package/node_modules/zod/src/v4/locales/zh-TW.ts +2 -0
- package/node_modules/zod/src/v4/mini/external.ts +2 -0
- package/node_modules/zod/src/v4/mini/schemas.ts +32 -7
- package/node_modules/zod/src/v4/mini/tests/checks.test.ts +1 -1
- package/node_modules/zod/src/v4/mini/tests/computed.test.ts +11 -17
- package/node_modules/zod/src/v4/mini/tests/index.test.ts +86 -0
- package/node_modules/zod/src/v4/mini/tests/recursive-types.test.ts +16 -0
- package/node_modules/zod/src/v4/mini/tests/string.test.ts +23 -0
- package/node_modules/zod/v3/ZodError.cjs +19 -0
- package/node_modules/zod/v3/errors.cjs +19 -0
- package/node_modules/zod/v3/external.cjs +19 -0
- package/node_modules/zod/v3/helpers/enumUtil.cjs +19 -0
- package/node_modules/zod/v3/helpers/errorUtil.cjs +20 -1
- package/node_modules/zod/v3/helpers/errorUtil.js +1 -1
- package/node_modules/zod/v3/helpers/parseUtil.cjs +19 -0
- package/node_modules/zod/v3/helpers/partialUtil.cjs +19 -0
- package/node_modules/zod/v3/helpers/typeAliases.cjs +19 -0
- package/node_modules/zod/v3/helpers/util.cjs +19 -0
- package/node_modules/zod/v3/index.cjs +19 -0
- package/node_modules/zod/v3/standard-schema.cjs +19 -0
- package/node_modules/zod/v3/types.cjs +19 -0
- package/node_modules/zod/v4/classic/checks.cjs +19 -0
- package/node_modules/zod/v4/classic/coerce.cjs +19 -0
- package/node_modules/zod/v4/classic/compat.cjs +19 -0
- package/node_modules/zod/v4/classic/deep-partial.cjs +19 -0
- package/node_modules/zod/v4/classic/errors.cjs +19 -0
- package/node_modules/zod/v4/classic/external.cjs +22 -1
- package/node_modules/zod/v4/classic/external.d.cts +1 -1
- package/node_modules/zod/v4/classic/external.d.ts +1 -1
- package/node_modules/zod/v4/classic/external.js +1 -1
- package/node_modules/zod/v4/classic/from-json-schema.cjs +264 -24
- package/node_modules/zod/v4/classic/from-json-schema.js +245 -24
- package/node_modules/zod/v4/classic/in-out.cjs +19 -0
- package/node_modules/zod/v4/classic/index.cjs +19 -0
- package/node_modules/zod/v4/classic/iso.cjs +19 -0
- package/node_modules/zod/v4/classic/parse.cjs +19 -0
- package/node_modules/zod/v4/classic/schemas.cjs +100 -35
- package/node_modules/zod/v4/classic/schemas.d.cts +15 -1
- package/node_modules/zod/v4/classic/schemas.d.ts +15 -1
- package/node_modules/zod/v4/classic/schemas.js +77 -33
- package/node_modules/zod/v4/core/api.cjs +45 -22
- package/node_modules/zod/v4/core/api.d.cts +12 -6
- package/node_modules/zod/v4/core/api.d.ts +12 -6
- package/node_modules/zod/v4/core/api.js +25 -22
- package/node_modules/zod/v4/core/checks.cjs +51 -97
- package/node_modules/zod/v4/core/checks.d.cts +17 -1
- package/node_modules/zod/v4/core/checks.d.ts +17 -1
- package/node_modules/zod/v4/core/checks.js +31 -96
- package/node_modules/zod/v4/core/compile.cjs +173 -78
- package/node_modules/zod/v4/core/compile.d.cts +18 -4
- package/node_modules/zod/v4/core/compile.d.ts +18 -4
- package/node_modules/zod/v4/core/compile.js +154 -79
- package/node_modules/zod/v4/core/core.cjs +20 -1
- package/node_modules/zod/v4/core/core.js +1 -1
- package/node_modules/zod/v4/core/doc.cjs +26 -2
- package/node_modules/zod/v4/core/doc.js +7 -2
- package/node_modules/zod/v4/core/errors.cjs +21 -5
- package/node_modules/zod/v4/core/errors.js +2 -5
- package/node_modules/zod/v4/core/index.cjs +19 -0
- package/node_modules/zod/v4/core/json-schema-generator.cjs +20 -1
- package/node_modules/zod/v4/core/json-schema-generator.js +2 -2
- package/node_modules/zod/v4/core/json-schema-processors.cjs +188 -72
- package/node_modules/zod/v4/core/json-schema-processors.d.cts +16 -0
- package/node_modules/zod/v4/core/json-schema-processors.d.ts +16 -0
- package/node_modules/zod/v4/core/json-schema-processors.js +170 -74
- package/node_modules/zod/v4/core/json-schema.cjs +19 -0
- package/node_modules/zod/v4/core/memoizer.cjs +111 -23
- package/node_modules/zod/v4/core/memoizer.js +69 -23
- package/node_modules/zod/v4/core/parse.cjs +56 -16
- package/node_modules/zod/v4/core/parse.js +37 -16
- package/node_modules/zod/v4/core/regexes.cjs +31 -6
- package/node_modules/zod/v4/core/regexes.d.cts +3 -0
- package/node_modules/zod/v4/core/regexes.d.ts +3 -0
- package/node_modules/zod/v4/core/regexes.js +10 -4
- package/node_modules/zod/v4/core/registries.cjs +19 -0
- package/node_modules/zod/v4/core/schemas.cjs +302 -114
- package/node_modules/zod/v4/core/schemas.d.cts +28 -8
- package/node_modules/zod/v4/core/schemas.d.ts +28 -8
- package/node_modules/zod/v4/core/schemas.js +279 -113
- package/node_modules/zod/v4/core/standard-schema.cjs +19 -0
- package/node_modules/zod/v4/core/to-json-schema.cjs +28 -7
- package/node_modules/zod/v4/core/to-json-schema.d.cts +4 -3
- package/node_modules/zod/v4/core/to-json-schema.d.ts +4 -3
- package/node_modules/zod/v4/core/to-json-schema.js +7 -6
- package/node_modules/zod/v4/core/util.cjs +177 -143
- package/node_modules/zod/v4/core/util.d.cts +25 -4
- package/node_modules/zod/v4/core/util.d.ts +25 -4
- package/node_modules/zod/v4/core/util.js +156 -143
- package/node_modules/zod/v4/core/versions.cjs +21 -2
- package/node_modules/zod/v4/core/versions.d.cts +1 -1
- package/node_modules/zod/v4/core/versions.d.ts +1 -1
- package/node_modules/zod/v4/core/versions.js +2 -2
- package/node_modules/zod/v4/core/visit.cjs +19 -0
- package/node_modules/zod/v4/index.cjs +19 -0
- package/node_modules/zod/v4/locales/ar.cjs +2 -0
- package/node_modules/zod/v4/locales/ar.js +2 -0
- package/node_modules/zod/v4/locales/az.cjs +2 -0
- package/node_modules/zod/v4/locales/az.js +2 -0
- package/node_modules/zod/v4/locales/be.cjs +2 -0
- package/node_modules/zod/v4/locales/be.js +2 -0
- package/node_modules/zod/v4/locales/bg.cjs +2 -0
- package/node_modules/zod/v4/locales/bg.js +2 -0
- package/node_modules/zod/v4/locales/bn.cjs +2 -0
- package/node_modules/zod/v4/locales/bn.js +2 -0
- package/node_modules/zod/v4/locales/ca.cjs +2 -0
- package/node_modules/zod/v4/locales/ca.js +2 -0
- package/node_modules/zod/v4/locales/ckb.cjs +2 -0
- package/node_modules/zod/v4/locales/ckb.js +2 -0
- package/node_modules/zod/v4/locales/cs.cjs +2 -0
- package/node_modules/zod/v4/locales/cs.js +2 -0
- package/node_modules/zod/v4/locales/da.cjs +2 -0
- package/node_modules/zod/v4/locales/da.js +2 -0
- package/node_modules/zod/v4/locales/de.cjs +2 -0
- package/node_modules/zod/v4/locales/de.js +2 -0
- package/node_modules/zod/v4/locales/el.cjs +2 -0
- package/node_modules/zod/v4/locales/el.js +2 -0
- package/node_modules/zod/v4/locales/en.cjs +2 -0
- package/node_modules/zod/v4/locales/en.js +2 -0
- package/node_modules/zod/v4/locales/eo.cjs +2 -0
- package/node_modules/zod/v4/locales/eo.js +2 -0
- package/node_modules/zod/v4/locales/es.cjs +2 -0
- package/node_modules/zod/v4/locales/es.js +2 -0
- package/node_modules/zod/v4/locales/fa.cjs +2 -0
- package/node_modules/zod/v4/locales/fa.js +2 -0
- package/node_modules/zod/v4/locales/fi.cjs +2 -0
- package/node_modules/zod/v4/locales/fi.js +2 -0
- package/node_modules/zod/v4/locales/fr-CA.cjs +2 -0
- package/node_modules/zod/v4/locales/fr-CA.js +2 -0
- package/node_modules/zod/v4/locales/fr.cjs +2 -0
- package/node_modules/zod/v4/locales/fr.js +2 -0
- package/node_modules/zod/v4/locales/gu.cjs +2 -0
- package/node_modules/zod/v4/locales/gu.js +2 -0
- package/node_modules/zod/v4/locales/he.cjs +2 -0
- package/node_modules/zod/v4/locales/he.js +2 -0
- package/node_modules/zod/v4/locales/hi.cjs +2 -0
- package/node_modules/zod/v4/locales/hi.js +2 -0
- package/node_modules/zod/v4/locales/hr.cjs +2 -0
- package/node_modules/zod/v4/locales/hr.js +2 -0
- package/node_modules/zod/v4/locales/hu.cjs +2 -0
- package/node_modules/zod/v4/locales/hu.js +2 -0
- package/node_modules/zod/v4/locales/hy.cjs +2 -0
- package/node_modules/zod/v4/locales/hy.js +2 -0
- package/node_modules/zod/v4/locales/id.cjs +2 -0
- package/node_modules/zod/v4/locales/id.js +2 -0
- package/node_modules/zod/v4/locales/index.cjs +22 -1
- package/node_modules/zod/v4/locales/index.d.cts +1 -0
- package/node_modules/zod/v4/locales/index.d.ts +1 -0
- package/node_modules/zod/v4/locales/index.js +1 -0
- package/node_modules/zod/v4/locales/is.cjs +2 -0
- package/node_modules/zod/v4/locales/is.js +2 -0
- package/node_modules/zod/v4/locales/it.cjs +2 -0
- package/node_modules/zod/v4/locales/it.js +2 -0
- package/node_modules/zod/v4/locales/ja.cjs +2 -0
- package/node_modules/zod/v4/locales/ja.js +2 -0
- package/node_modules/zod/v4/locales/ka.cjs +2 -0
- package/node_modules/zod/v4/locales/ka.js +2 -0
- package/node_modules/zod/v4/locales/km.cjs +2 -0
- package/node_modules/zod/v4/locales/km.js +2 -0
- package/node_modules/zod/v4/locales/kn.cjs +2 -0
- package/node_modules/zod/v4/locales/kn.js +2 -0
- package/node_modules/zod/v4/locales/ko.cjs +2 -0
- package/node_modules/zod/v4/locales/ko.js +2 -0
- package/node_modules/zod/v4/locales/lt.cjs +2 -0
- package/node_modules/zod/v4/locales/lt.js +2 -0
- package/node_modules/zod/v4/locales/mk.cjs +2 -0
- package/node_modules/zod/v4/locales/mk.js +2 -0
- package/node_modules/zod/v4/locales/ms.cjs +2 -0
- package/node_modules/zod/v4/locales/ms.js +2 -0
- package/node_modules/zod/v4/locales/ne.cjs +2 -0
- package/node_modules/zod/v4/locales/ne.js +2 -0
- package/node_modules/zod/v4/locales/nl.cjs +2 -0
- package/node_modules/zod/v4/locales/nl.js +2 -0
- package/node_modules/zod/v4/locales/nn.cjs +2 -0
- package/node_modules/zod/v4/locales/nn.js +2 -0
- package/node_modules/zod/v4/locales/no.cjs +2 -0
- package/node_modules/zod/v4/locales/no.js +2 -0
- package/node_modules/zod/v4/locales/ota.cjs +2 -0
- package/node_modules/zod/v4/locales/ota.js +2 -0
- package/node_modules/zod/v4/locales/pl.cjs +2 -0
- package/node_modules/zod/v4/locales/pl.js +2 -0
- package/node_modules/zod/v4/locales/ps.cjs +2 -0
- package/node_modules/zod/v4/locales/ps.js +2 -0
- package/node_modules/zod/v4/locales/pt-BR.cjs +2 -0
- package/node_modules/zod/v4/locales/pt-BR.js +2 -0
- package/node_modules/zod/v4/locales/pt.cjs +2 -0
- package/node_modules/zod/v4/locales/pt.js +2 -0
- package/node_modules/zod/v4/locales/ro.cjs +2 -0
- package/node_modules/zod/v4/locales/ro.js +2 -0
- package/node_modules/zod/v4/locales/ru.cjs +2 -0
- package/node_modules/zod/v4/locales/ru.js +2 -0
- package/node_modules/zod/v4/locales/sk.cjs +2 -0
- package/node_modules/zod/v4/locales/sk.js +2 -0
- package/node_modules/zod/v4/locales/sl.cjs +2 -0
- package/node_modules/zod/v4/locales/sl.js +2 -0
- package/node_modules/zod/v4/locales/sv.cjs +2 -0
- package/node_modules/zod/v4/locales/sv.js +2 -0
- package/node_modules/zod/v4/locales/ta.cjs +2 -0
- package/node_modules/zod/v4/locales/ta.js +2 -0
- package/node_modules/zod/v4/locales/tg.cjs +144 -0
- package/node_modules/zod/v4/locales/tg.d.cts +5 -0
- package/node_modules/zod/v4/locales/tg.d.ts +4 -0
- package/node_modules/zod/v4/locales/tg.js +117 -0
- package/node_modules/zod/v4/locales/th.cjs +2 -0
- package/node_modules/zod/v4/locales/th.js +2 -0
- package/node_modules/zod/v4/locales/tk.cjs +2 -0
- package/node_modules/zod/v4/locales/tk.js +2 -0
- package/node_modules/zod/v4/locales/tr.cjs +2 -0
- package/node_modules/zod/v4/locales/tr.js +2 -0
- package/node_modules/zod/v4/locales/uk.cjs +2 -0
- package/node_modules/zod/v4/locales/uk.js +2 -0
- package/node_modules/zod/v4/locales/ur.cjs +2 -0
- package/node_modules/zod/v4/locales/ur.js +2 -0
- package/node_modules/zod/v4/locales/uz.cjs +2 -0
- package/node_modules/zod/v4/locales/uz.js +2 -0
- package/node_modules/zod/v4/locales/vi.cjs +2 -0
- package/node_modules/zod/v4/locales/vi.js +2 -0
- package/node_modules/zod/v4/locales/yo.cjs +2 -0
- package/node_modules/zod/v4/locales/yo.js +2 -0
- package/node_modules/zod/v4/locales/zh-CN.cjs +2 -0
- package/node_modules/zod/v4/locales/zh-CN.js +2 -0
- package/node_modules/zod/v4/locales/zh-TW.cjs +2 -0
- package/node_modules/zod/v4/locales/zh-TW.js +2 -0
- package/node_modules/zod/v4/mini/checks.cjs +19 -0
- package/node_modules/zod/v4/mini/coerce.cjs +19 -0
- package/node_modules/zod/v4/mini/deep-partial.cjs +19 -0
- package/node_modules/zod/v4/mini/external.cjs +22 -1
- package/node_modules/zod/v4/mini/external.d.cts +1 -1
- package/node_modules/zod/v4/mini/external.d.ts +1 -1
- package/node_modules/zod/v4/mini/external.js +1 -1
- package/node_modules/zod/v4/mini/in-out.cjs +19 -0
- package/node_modules/zod/v4/mini/index.cjs +19 -0
- package/node_modules/zod/v4/mini/iso.cjs +19 -0
- package/node_modules/zod/v4/mini/parse.cjs +19 -0
- package/node_modules/zod/v4/mini/schemas.cjs +44 -8
- package/node_modules/zod/v4/mini/schemas.d.cts +6 -1
- package/node_modules/zod/v4/mini/schemas.d.ts +6 -1
- package/node_modules/zod/v4/mini/schemas.js +21 -6
- package/node_modules/zod/v4-mini/index.cjs +19 -0
- package/openclaw.plugin.json +20 -0
- package/package.json +5 -5
- package/dist/.setup/doctor-contract-mvORF4f6.mjs +0 -18
|
@@ -0,0 +1,383 @@
|
|
|
1
|
+
import { _ as readMattermostError, h as normalizeMattermostBaseUrl, l as fetchMattermostChannelPosts, r as createMattermostClient, s as fetchMattermostChannel, u as fetchMattermostMe } from "./client-CVeeTqCO.mjs";
|
|
2
|
+
import { o as resolveMattermostTrustedChatKind } from "./monitor-auth-aZ0b1gqx.mjs";
|
|
3
|
+
import { c as listMattermostAccountIds, n as normalizeMattermostMessagingTarget, o as inspectMattermostAccount, u as resolveMattermostAccount } from "./normalize-BCjtmxtp.mjs";
|
|
4
|
+
import { n as resolveMattermostOpaqueTarget, t as sendMessageMattermost } from "./send-ClgX-usq.mjs";
|
|
5
|
+
import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
6
|
+
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
7
|
+
import { asDateTimestampMs, resolveExpiresAtMsFromDurationMs, resolveTimerTimeoutMs } from "openclaw/plugin-sdk/number-runtime";
|
|
8
|
+
import { readProviderJsonResponse } from "openclaw/plugin-sdk/provider-http";
|
|
9
|
+
import { fetchWithSsrFGuard, isPrivateNetworkOptInEnabled, ssrfPolicyFromPrivateNetworkOptIn } from "openclaw/plugin-sdk/ssrf-runtime";
|
|
10
|
+
import { resolveAllowlistProviderRuntimeGroupPolicy } from "openclaw/plugin-sdk/runtime-group-policy";
|
|
11
|
+
import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
12
|
+
import { runChannelProbe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
13
|
+
//#region extensions/mattermost/src/mattermost/directory.ts
|
|
14
|
+
function buildClient(params) {
|
|
15
|
+
const account = inspectMattermostAccount({
|
|
16
|
+
cfg: params.cfg,
|
|
17
|
+
accountId: params.accountId
|
|
18
|
+
});
|
|
19
|
+
if (!account.enabled || !account.botToken || !account.baseUrl) return null;
|
|
20
|
+
return createMattermostClient({
|
|
21
|
+
baseUrl: account.baseUrl,
|
|
22
|
+
botToken: account.botToken,
|
|
23
|
+
allowPrivateNetwork: isPrivateNetworkOptInEnabled(account.config)
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
/** Build the requested account client, or aggregate accounts for an explicitly unscoped lookup. */
|
|
27
|
+
function buildClients(params) {
|
|
28
|
+
const requestedAccountId = params.accountId?.trim();
|
|
29
|
+
const accountIds = requestedAccountId ? [requestedAccountId] : listMattermostAccountIds(params.cfg);
|
|
30
|
+
const seen = /* @__PURE__ */ new Set();
|
|
31
|
+
const clients = [];
|
|
32
|
+
for (const id of accountIds) {
|
|
33
|
+
const client = buildClient({
|
|
34
|
+
cfg: params.cfg,
|
|
35
|
+
accountId: id
|
|
36
|
+
});
|
|
37
|
+
if (client && !seen.has(client.token)) {
|
|
38
|
+
seen.add(client.token);
|
|
39
|
+
clients.push(client);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return clients;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* List channels (public + private) visible to any configured bot account.
|
|
46
|
+
*
|
|
47
|
+
* NOTE: Uses per_page=200 which covers most instances. Mattermost does not
|
|
48
|
+
* return a "has more" indicator, so very large instances (200+ channels per bot)
|
|
49
|
+
* may see incomplete results. Pagination can be added if needed.
|
|
50
|
+
*/
|
|
51
|
+
async function listMattermostDirectoryGroups(params) {
|
|
52
|
+
const clients = buildClients(params);
|
|
53
|
+
if (!clients.length) return [];
|
|
54
|
+
const q = normalizeLowercaseStringOrEmpty(params.query);
|
|
55
|
+
const seenIds = /* @__PURE__ */ new Set();
|
|
56
|
+
const entries = [];
|
|
57
|
+
for (const client of clients) try {
|
|
58
|
+
const me = await fetchMattermostMe(client);
|
|
59
|
+
const channels = await client.request(`/users/${me.id}/channels?per_page=200`);
|
|
60
|
+
for (const ch of channels) {
|
|
61
|
+
if (ch.type !== "O" && ch.type !== "P") continue;
|
|
62
|
+
if (seenIds.has(ch.id)) continue;
|
|
63
|
+
if (q) {
|
|
64
|
+
const name = normalizeLowercaseStringOrEmpty(ch.name);
|
|
65
|
+
const display = normalizeLowercaseStringOrEmpty(ch.display_name);
|
|
66
|
+
if (!name.includes(q) && !display.includes(q)) continue;
|
|
67
|
+
}
|
|
68
|
+
seenIds.add(ch.id);
|
|
69
|
+
entries.push({
|
|
70
|
+
kind: resolveMattermostTrustedChatKind({ channelType: ch.type }) === "group" ? "group" : "channel",
|
|
71
|
+
id: `channel:${ch.id}`,
|
|
72
|
+
name: ch.name ?? void 0,
|
|
73
|
+
handle: ch.display_name ?? void 0
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
} catch (err) {
|
|
77
|
+
console.debug?.("[mattermost-directory] listGroups: skipping account:", err?.message);
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
return params.limit && params.limit > 0 ? entries.slice(0, params.limit) : entries;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* List team members as peer directory entries.
|
|
84
|
+
*
|
|
85
|
+
* Uses only the first available client since all bots in a team see the same
|
|
86
|
+
* user list (unlike channels where membership varies). Uses the first team
|
|
87
|
+
* returned — multi-team setups will only see members from that team.
|
|
88
|
+
*
|
|
89
|
+
* Uses paginated member listing with per_page=200, the Mattermost API maximum.
|
|
90
|
+
*/
|
|
91
|
+
async function listMattermostDirectoryPeers(params) {
|
|
92
|
+
const client = buildClients(params)[0];
|
|
93
|
+
if (!client) return [];
|
|
94
|
+
try {
|
|
95
|
+
const me = await fetchMattermostMe(client);
|
|
96
|
+
const team = (await client.request("/users/me/teams"))[0];
|
|
97
|
+
if (!team) return [];
|
|
98
|
+
const teamId = team.id;
|
|
99
|
+
const q = normalizeLowercaseStringOrEmpty(params.query);
|
|
100
|
+
let users;
|
|
101
|
+
if (q) users = await client.request("/users/search", {
|
|
102
|
+
method: "POST",
|
|
103
|
+
body: JSON.stringify({
|
|
104
|
+
term: q,
|
|
105
|
+
team_id: teamId
|
|
106
|
+
})
|
|
107
|
+
});
|
|
108
|
+
else {
|
|
109
|
+
const pageSize = 200;
|
|
110
|
+
const userIds = [];
|
|
111
|
+
for (let page = 0;; page += 1) {
|
|
112
|
+
const pageMembers = await client.request(`/teams/${teamId}/members?page=${page}&per_page=${pageSize}`);
|
|
113
|
+
for (const member of pageMembers) if (member.user_id !== me.id) userIds.push(member.user_id);
|
|
114
|
+
if (pageMembers.length < pageSize) break;
|
|
115
|
+
}
|
|
116
|
+
if (!userIds.length) return [];
|
|
117
|
+
users = [];
|
|
118
|
+
for (let index = 0; index < userIds.length; index += pageSize) {
|
|
119
|
+
const userIdBatch = userIds.slice(index, index + pageSize);
|
|
120
|
+
users.push(...await client.request("/users/ids", {
|
|
121
|
+
method: "POST",
|
|
122
|
+
body: JSON.stringify(userIdBatch)
|
|
123
|
+
}));
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
const entries = users.filter((u) => u.id !== me.id).map((u) => ({
|
|
127
|
+
kind: "user",
|
|
128
|
+
id: `user:${u.id}`,
|
|
129
|
+
name: u.username ?? void 0,
|
|
130
|
+
handle: [u.first_name, u.last_name].filter(Boolean).join(" ").trim() || u.nickname || void 0
|
|
131
|
+
}));
|
|
132
|
+
return params.limit && params.limit > 0 ? entries.slice(0, params.limit) : entries;
|
|
133
|
+
} catch (err) {
|
|
134
|
+
console.debug?.("[mattermost-directory] listPeers failed:", err?.message);
|
|
135
|
+
return [];
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
//#endregion
|
|
139
|
+
//#region extensions/mattermost/src/mattermost/probe.ts
|
|
140
|
+
async function probeMattermost(baseUrl, botToken, timeoutMs = 2500, allowPrivateNetwork = false, deps) {
|
|
141
|
+
const normalized = normalizeMattermostBaseUrl(baseUrl);
|
|
142
|
+
if (!normalized) return {
|
|
143
|
+
ok: false,
|
|
144
|
+
error: "baseUrl missing"
|
|
145
|
+
};
|
|
146
|
+
const url = `${normalized}/api/v4/users/me`;
|
|
147
|
+
const headers = { Authorization: `Bearer ${botToken}` };
|
|
148
|
+
return await runChannelProbe(void 0, async ({ elapsedMs }) => {
|
|
149
|
+
const resolvedTimeoutMs = timeoutMs > 0 ? resolveTimerTimeoutMs(timeoutMs, 2500) : void 0;
|
|
150
|
+
const { response: res, release } = await fetchWithSsrFGuard({
|
|
151
|
+
url,
|
|
152
|
+
init: { headers },
|
|
153
|
+
auditContext: "mattermost-probe",
|
|
154
|
+
policy: ssrfPolicyFromPrivateNetworkOptIn(allowPrivateNetwork),
|
|
155
|
+
...resolvedTimeoutMs !== void 0 ? { timeoutMs: resolvedTimeoutMs } : {},
|
|
156
|
+
...deps?.fetchImpl ? { fetchImpl: deps.fetchImpl } : {},
|
|
157
|
+
...deps?.lookupFn ? { lookupFn: deps.lookupFn } : {}
|
|
158
|
+
});
|
|
159
|
+
const requestElapsedMs = elapsedMs();
|
|
160
|
+
try {
|
|
161
|
+
if (!res.ok) {
|
|
162
|
+
const detail = await readMattermostError(res, headers);
|
|
163
|
+
return {
|
|
164
|
+
ok: false,
|
|
165
|
+
status: res.status,
|
|
166
|
+
error: detail || res.statusText,
|
|
167
|
+
elapsedMs: requestElapsedMs
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
const bot = await readProviderJsonResponse(res, "Mattermost probe /users/me");
|
|
171
|
+
return {
|
|
172
|
+
ok: true,
|
|
173
|
+
status: res.status,
|
|
174
|
+
elapsedMs: requestElapsedMs,
|
|
175
|
+
bot
|
|
176
|
+
};
|
|
177
|
+
} finally {
|
|
178
|
+
await release();
|
|
179
|
+
}
|
|
180
|
+
}, (error) => ({
|
|
181
|
+
ok: false,
|
|
182
|
+
status: null,
|
|
183
|
+
error: formatErrorMessage(error)
|
|
184
|
+
}));
|
|
185
|
+
}
|
|
186
|
+
//#endregion
|
|
187
|
+
//#region extensions/mattermost/src/mattermost/reactions.ts
|
|
188
|
+
const BOT_USER_CACHE_TTL_MS = 6e5;
|
|
189
|
+
const botUserIdCache = /* @__PURE__ */ new Map();
|
|
190
|
+
async function resolveBotUserId(client, cacheKey) {
|
|
191
|
+
const rawNow = Date.now();
|
|
192
|
+
const now = asDateTimestampMs(rawNow);
|
|
193
|
+
const cached = botUserIdCache.get(cacheKey);
|
|
194
|
+
if (cached) {
|
|
195
|
+
if (now !== void 0 && cached.expiresAt > now) return cached.userId;
|
|
196
|
+
botUserIdCache.delete(cacheKey);
|
|
197
|
+
}
|
|
198
|
+
const userId = (await fetchMattermostMe(client))?.id?.trim();
|
|
199
|
+
if (!userId) return null;
|
|
200
|
+
const expiresAt = resolveExpiresAtMsFromDurationMs(BOT_USER_CACHE_TTL_MS, { nowMs: rawNow });
|
|
201
|
+
if (expiresAt !== void 0) botUserIdCache.set(cacheKey, {
|
|
202
|
+
userId,
|
|
203
|
+
expiresAt
|
|
204
|
+
});
|
|
205
|
+
return userId;
|
|
206
|
+
}
|
|
207
|
+
async function addMattermostReaction(params) {
|
|
208
|
+
return runMattermostReaction(params, {
|
|
209
|
+
action: "add",
|
|
210
|
+
mutation: createReaction
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
async function removeMattermostReaction(params) {
|
|
214
|
+
return runMattermostReaction(params, {
|
|
215
|
+
action: "remove",
|
|
216
|
+
mutation: deleteReaction
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
function parseAuthorizedReactionTarget(rawTarget) {
|
|
220
|
+
const normalized = rawTarget ? normalizeMattermostMessagingTarget(rawTarget) : void 0;
|
|
221
|
+
if (!normalized) return null;
|
|
222
|
+
if (normalized.startsWith("channel:")) {
|
|
223
|
+
const id = normalized.slice(8).trim();
|
|
224
|
+
return id ? {
|
|
225
|
+
kind: "channel",
|
|
226
|
+
id
|
|
227
|
+
} : null;
|
|
228
|
+
}
|
|
229
|
+
if (normalized.startsWith("user:")) {
|
|
230
|
+
const id = normalized.slice(5).trim();
|
|
231
|
+
return id ? {
|
|
232
|
+
kind: "user",
|
|
233
|
+
id
|
|
234
|
+
} : null;
|
|
235
|
+
}
|
|
236
|
+
return null;
|
|
237
|
+
}
|
|
238
|
+
async function authorizeMattermostReactionResource(params) {
|
|
239
|
+
const target = parseAuthorizedReactionTarget(params.authorizedTarget);
|
|
240
|
+
if (!target) throw new Error("Mattermost delegated reactions require a canonical authorized conversation target.");
|
|
241
|
+
const postChannelId = (await params.client.request(`/posts/${encodeURIComponent(params.postId)}`)).channel_id?.trim();
|
|
242
|
+
if (!postChannelId) throw new Error("Mattermost reaction post is missing its conversation binding.");
|
|
243
|
+
if (target.kind === "channel") {
|
|
244
|
+
if (postChannelId !== target.id) throw new Error("Mattermost reaction post belongs to a different conversation.");
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
const botUserId = await resolveBotUserId(params.client, params.cacheKey);
|
|
248
|
+
if (!botUserId) throw new Error("Mattermost reactions failed: could not resolve bot user id.");
|
|
249
|
+
const channel = await fetchMattermostChannel(params.client, postChannelId);
|
|
250
|
+
const participants = channel.name?.split("__").map((entry) => entry.trim()).filter(Boolean).toSorted() ?? [];
|
|
251
|
+
const authorizedParticipants = [botUserId, target.id].toSorted();
|
|
252
|
+
if (channel.type !== "D" || participants.length !== 2 || participants[0] !== authorizedParticipants[0] || participants[1] !== authorizedParticipants[1]) throw new Error("Mattermost reaction post belongs to a different direct conversation.");
|
|
253
|
+
return botUserId;
|
|
254
|
+
}
|
|
255
|
+
async function runMattermostReaction(params, options) {
|
|
256
|
+
const resolved = resolveMattermostAccount({
|
|
257
|
+
cfg: params.cfg,
|
|
258
|
+
accountId: params.accountId
|
|
259
|
+
});
|
|
260
|
+
const baseUrl = resolved.baseUrl?.trim();
|
|
261
|
+
const botToken = resolved.botToken?.trim();
|
|
262
|
+
if (!baseUrl || !botToken) return {
|
|
263
|
+
ok: false,
|
|
264
|
+
error: "Mattermost botToken/baseUrl missing."
|
|
265
|
+
};
|
|
266
|
+
const client = createMattermostClient({
|
|
267
|
+
baseUrl,
|
|
268
|
+
botToken,
|
|
269
|
+
fetchImpl: params.fetchImpl,
|
|
270
|
+
allowPrivateNetwork: isPrivateNetworkOptInEnabled(resolved.config)
|
|
271
|
+
});
|
|
272
|
+
const cacheKey = `${baseUrl}:${botToken}`;
|
|
273
|
+
try {
|
|
274
|
+
const userId = (params.conversationReadOrigin === "direct-operator" ? void 0 : await authorizeMattermostReactionResource({
|
|
275
|
+
client,
|
|
276
|
+
cacheKey,
|
|
277
|
+
postId: params.postId,
|
|
278
|
+
authorizedTarget: params.authorizedTarget
|
|
279
|
+
})) ?? await resolveBotUserId(client, cacheKey);
|
|
280
|
+
if (!userId) return {
|
|
281
|
+
ok: false,
|
|
282
|
+
error: "Mattermost reactions failed: could not resolve bot user id."
|
|
283
|
+
};
|
|
284
|
+
await options.mutation(client, {
|
|
285
|
+
userId,
|
|
286
|
+
postId: params.postId,
|
|
287
|
+
emojiName: params.emojiName
|
|
288
|
+
});
|
|
289
|
+
} catch (err) {
|
|
290
|
+
return {
|
|
291
|
+
ok: false,
|
|
292
|
+
error: `Mattermost ${options.action} reaction failed: ${String(err)}`
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
return { ok: true };
|
|
296
|
+
}
|
|
297
|
+
async function createReaction(client, params) {
|
|
298
|
+
await client.request("/reactions", {
|
|
299
|
+
method: "POST",
|
|
300
|
+
body: JSON.stringify({
|
|
301
|
+
user_id: params.userId,
|
|
302
|
+
post_id: params.postId,
|
|
303
|
+
emoji_name: params.emojiName
|
|
304
|
+
}),
|
|
305
|
+
discardResponse: true
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
async function deleteReaction(client, params) {
|
|
309
|
+
const emoji = encodeURIComponent(params.emojiName);
|
|
310
|
+
await client.request(`/users/${params.userId}/posts/${params.postId}/reactions/${emoji}`, {
|
|
311
|
+
method: "DELETE",
|
|
312
|
+
discardResponse: true
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
//#endregion
|
|
316
|
+
//#region extensions/mattermost/src/mattermost/read.ts
|
|
317
|
+
function parseMattermostChannelTarget(rawTarget) {
|
|
318
|
+
const normalized = normalizeMattermostMessagingTarget(rawTarget);
|
|
319
|
+
if (normalized?.startsWith("channel:")) return normalized.slice(8).trim() || void 0;
|
|
320
|
+
const trimmed = rawTarget.trim();
|
|
321
|
+
return trimmed && !trimmed.includes(":") ? trimmed : void 0;
|
|
322
|
+
}
|
|
323
|
+
function isCurrentMattermostReadTarget(params) {
|
|
324
|
+
const toolContext = params.context.toolContext;
|
|
325
|
+
const requesterAccountId = params.context.requesterAccountId?.trim();
|
|
326
|
+
if (normalizeLowercaseStringOrEmpty(toolContext?.currentChannelProvider) !== "mattermost" || !requesterAccountId || normalizeAccountId(requesterAccountId) !== normalizeAccountId(params.accountId)) return false;
|
|
327
|
+
const nativeChannelId = toolContext?.currentChannelId;
|
|
328
|
+
if (typeof nativeChannelId === "string" && nativeChannelId.trim()) return parseMattermostChannelTarget(nativeChannelId) === params.channelId;
|
|
329
|
+
const messagingTarget = toolContext?.currentMessagingTarget;
|
|
330
|
+
return typeof messagingTarget === "string" && Boolean(messagingTarget.trim()) && parseMattermostChannelTarget(messagingTarget) === params.channelId;
|
|
331
|
+
}
|
|
332
|
+
function isConfiguredMattermostReadTarget(params) {
|
|
333
|
+
const { groupPolicy } = resolveAllowlistProviderRuntimeGroupPolicy({
|
|
334
|
+
providerConfigPresent: params.cfg.channels?.mattermost !== void 0,
|
|
335
|
+
groupPolicy: params.account.config.groupPolicy,
|
|
336
|
+
defaultGroupPolicy: params.cfg.channels?.defaults?.groupPolicy
|
|
337
|
+
});
|
|
338
|
+
if (groupPolicy === "disabled") return false;
|
|
339
|
+
if (groupPolicy === "open") return true;
|
|
340
|
+
const groups = params.account.config.groups;
|
|
341
|
+
return groups?.[params.channelId] !== void 0 || groups?.["*"] !== void 0;
|
|
342
|
+
}
|
|
343
|
+
async function readMattermostMessages(params) {
|
|
344
|
+
const account = resolveMattermostAccount({
|
|
345
|
+
cfg: params.cfg,
|
|
346
|
+
accountId: params.accountId
|
|
347
|
+
});
|
|
348
|
+
if (!account.enabled) throw new Error(`Mattermost account "${account.accountId}" is disabled`);
|
|
349
|
+
const baseUrl = account.baseUrl?.trim();
|
|
350
|
+
const botToken = account.botToken?.trim();
|
|
351
|
+
if (!baseUrl || !botToken) throw new Error("Mattermost botToken/baseUrl missing.");
|
|
352
|
+
const client = createMattermostClient({
|
|
353
|
+
baseUrl,
|
|
354
|
+
botToken,
|
|
355
|
+
fetchImpl: params.fetchImpl,
|
|
356
|
+
allowPrivateNetwork: isPrivateNetworkOptInEnabled(account.config)
|
|
357
|
+
});
|
|
358
|
+
const directOperator = params.context.conversationReadOrigin === "direct-operator";
|
|
359
|
+
const currentConversation = isCurrentMattermostReadTarget({
|
|
360
|
+
accountId: account.accountId,
|
|
361
|
+
channelId: params.channelId,
|
|
362
|
+
context: params.context
|
|
363
|
+
});
|
|
364
|
+
if (!directOperator && !currentConversation) {
|
|
365
|
+
const requesterAccountId = params.context.requesterAccountId?.trim();
|
|
366
|
+
const sameProvider = normalizeLowercaseStringOrEmpty(params.context.toolContext?.currentChannelProvider) === "mattermost";
|
|
367
|
+
const sameAccount = requesterAccountId && normalizeAccountId(requesterAccountId) === normalizeAccountId(account.accountId);
|
|
368
|
+
if (!sameProvider || !sameAccount) throw new Error("Mattermost delegated reads require the current Mattermost account.");
|
|
369
|
+
const channel = await fetchMattermostChannel(client, params.channelId);
|
|
370
|
+
if (channel.type !== "O" && channel.type !== "P" || !isConfiguredMattermostReadTarget({
|
|
371
|
+
cfg: params.cfg,
|
|
372
|
+
account,
|
|
373
|
+
channelId: params.channelId
|
|
374
|
+
})) throw new Error("Mattermost read target channel is not allowed.");
|
|
375
|
+
}
|
|
376
|
+
return await fetchMattermostChannelPosts(client, params.channelId, {
|
|
377
|
+
limit: params.limit,
|
|
378
|
+
before: params.before,
|
|
379
|
+
after: params.after
|
|
380
|
+
});
|
|
381
|
+
}
|
|
382
|
+
//#endregion
|
|
383
|
+
export { addMattermostReaction, listMattermostDirectoryGroups, listMattermostDirectoryPeers, probeMattermost, readMattermostMessages, removeMattermostReaction, resolveMattermostOpaqueTarget, sendMessageMattermost };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
1
|
+
import { asOptionalObjectRecord, normalizeLowercaseStringOrEmpty, normalizeOptionalString, readStringField } 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, readErrorName } from "openclaw/plugin-sdk/error-runtime";
|
|
5
5
|
import { buildTimeoutAbortSignal } from "openclaw/plugin-sdk/extension-shared";
|
|
6
6
|
import { captureChannelReadAuthority, responseWithRelease } from "openclaw/plugin-sdk/fetch-runtime";
|
|
7
7
|
import { resolveTimerTimeoutMs } from "openclaw/plugin-sdk/number-runtime";
|
|
@@ -23,6 +23,7 @@ const MattermostPostSchema = z.object({
|
|
|
23
23
|
type: z.string().nullable().optional(),
|
|
24
24
|
root_id: z.string().nullable().optional(),
|
|
25
25
|
create_at: z.number().nullable().optional(),
|
|
26
|
+
delete_at: z.number().nullable().optional(),
|
|
26
27
|
props: z.record(z.string(), z.unknown()).nullable().optional()
|
|
27
28
|
}).passthrough();
|
|
28
29
|
const MattermostPostListSchema = z.object({
|
|
@@ -82,17 +83,36 @@ function createMattermostClient(params) {
|
|
|
82
83
|
const apiBaseUrl = `${baseUrl}/api/v4`;
|
|
83
84
|
const token = params.botToken.trim();
|
|
84
85
|
const requestTimeoutMs = resolveTimerTimeoutMs(params.timeoutMs, MATTERMOST_REQUEST_TIMEOUT_MS);
|
|
86
|
+
const assertSenderCurrent = params.assertRequestCurrent;
|
|
87
|
+
let postDispatchStarted = false;
|
|
88
|
+
const assertRequestCurrent = assertSenderCurrent ? () => {
|
|
89
|
+
try {
|
|
90
|
+
assertSenderCurrent();
|
|
91
|
+
} catch (error) {
|
|
92
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
93
|
+
if (postDispatchStarted) throw new AggregateError([error, /* @__PURE__ */ new Error("A Mattermost post request was already dispatched")], message, { cause: error });
|
|
94
|
+
throw new PlatformMessageNotDispatchedError(message, {
|
|
95
|
+
cause: error,
|
|
96
|
+
retryable: false
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
} : void 0;
|
|
85
100
|
const externalFetchImpl = params.fetchImpl;
|
|
86
101
|
const guardedFetchImpl = async (input, init) => {
|
|
87
102
|
const assertReadAuthority = captureChannelReadAuthority();
|
|
88
103
|
assertReadAuthority?.();
|
|
104
|
+
assertRequestCurrent?.();
|
|
89
105
|
const url = typeof input === "string" ? input : input instanceof URL ? input.toString() : input.url;
|
|
90
|
-
const { timeoutMs: initTimeoutMs, ...requestInit } = init ?? {};
|
|
106
|
+
const { timeoutMs: initTimeoutMs, isMessagePost, ...requestInit } = init ?? {};
|
|
91
107
|
const timeoutMs = resolveTimerTimeoutMs(initTimeoutMs, requestTimeoutMs);
|
|
92
108
|
const { response, release } = await fetchWithSsrFGuard({
|
|
93
109
|
url,
|
|
94
110
|
init: requestInit,
|
|
95
|
-
beforeRequest:
|
|
111
|
+
beforeRequest: () => {
|
|
112
|
+
assertReadAuthority?.();
|
|
113
|
+
assertRequestCurrent?.();
|
|
114
|
+
if (isMessagePost) postDispatchStarted = true;
|
|
115
|
+
},
|
|
96
116
|
auditContext: "mattermost-api",
|
|
97
117
|
policy: ssrfPolicyFromPrivateNetworkOptIn(params.allowPrivateNetwork),
|
|
98
118
|
signal: requestInit.signal ?? void 0,
|
|
@@ -103,7 +123,7 @@ function createMattermostClient(params) {
|
|
|
103
123
|
const fetchImpl = (externalFetchImpl ? async (input, init) => {
|
|
104
124
|
captureChannelReadAuthority()?.();
|
|
105
125
|
const url = typeof input === "string" ? input : input instanceof URL ? input.toString() : input.url;
|
|
106
|
-
const { timeoutMs: initTimeoutMs, ...requestInit } = init ?? {};
|
|
126
|
+
const { timeoutMs: initTimeoutMs, isMessagePost, ...requestInit } = init ?? {};
|
|
107
127
|
const timeoutMs = resolveTimerTimeoutMs(initTimeoutMs, requestTimeoutMs);
|
|
108
128
|
const { signal: timeoutSignal, cleanup } = buildTimeoutAbortSignal({
|
|
109
129
|
timeoutMs,
|
|
@@ -113,6 +133,8 @@ function createMattermostClient(params) {
|
|
|
113
133
|
const callerSignal = requestInit.signal ?? void 0;
|
|
114
134
|
const signal = callerSignal && timeoutSignal ? AbortSignal.any([callerSignal, timeoutSignal]) : callerSignal ?? timeoutSignal;
|
|
115
135
|
try {
|
|
136
|
+
assertRequestCurrent?.();
|
|
137
|
+
if (isMessagePost) postDispatchStarted = true;
|
|
116
138
|
const response = await externalFetchImpl(input, {
|
|
117
139
|
...requestInit,
|
|
118
140
|
signal
|
|
@@ -125,19 +147,22 @@ function createMattermostClient(params) {
|
|
|
125
147
|
} : void 0) ?? guardedFetchImpl;
|
|
126
148
|
const request = async (path, init) => {
|
|
127
149
|
const url = buildMattermostApiUrl(baseUrl, path);
|
|
128
|
-
const
|
|
150
|
+
const { discardResponse, ...requestInit } = init ?? {};
|
|
151
|
+
const headers = new Headers(requestInit.headers);
|
|
129
152
|
headers.set("Authorization", `Bearer ${token}`);
|
|
130
|
-
if (typeof
|
|
153
|
+
if (typeof requestInit.body === "string" && !headers.has("Content-Type")) headers.set("Content-Type", "application/json");
|
|
154
|
+
const isMessagePost = path === "/posts" && init?.method?.toUpperCase() === "POST";
|
|
131
155
|
const res = await fetchImpl(url, {
|
|
132
|
-
...
|
|
133
|
-
headers
|
|
156
|
+
...requestInit,
|
|
157
|
+
headers,
|
|
158
|
+
isMessagePost
|
|
134
159
|
});
|
|
135
160
|
if (!res.ok) {
|
|
136
161
|
const detail = await readMattermostError(res, headers);
|
|
137
162
|
throw new Error(`Mattermost API ${res.status} ${res.statusText}: ${detail || "unknown error"}`);
|
|
138
163
|
}
|
|
139
164
|
if (res.status === 204) return;
|
|
140
|
-
if (
|
|
165
|
+
if (discardResponse) {
|
|
141
166
|
try {
|
|
142
167
|
await res.body?.cancel();
|
|
143
168
|
} catch {}
|
|
@@ -147,7 +172,7 @@ function createMattermostClient(params) {
|
|
|
147
172
|
if ((res.headers.get("content-type") ?? "").includes("application/json")) return await readProviderJsonResponse(res, `Mattermost API ${path}`);
|
|
148
173
|
return await readMattermostSuccessText(res, path);
|
|
149
174
|
} catch (error) {
|
|
150
|
-
if (
|
|
175
|
+
if (isMessagePost) throw createChannelPartialDeliveryError(error, {
|
|
151
176
|
messageIds: [],
|
|
152
177
|
visibleReplySent: true
|
|
153
178
|
});
|
|
@@ -159,7 +184,8 @@ function createMattermostClient(params) {
|
|
|
159
184
|
apiBaseUrl,
|
|
160
185
|
token,
|
|
161
186
|
request,
|
|
162
|
-
fetchImpl
|
|
187
|
+
fetchImpl,
|
|
188
|
+
...assertRequestCurrent ? { assertRequestCurrent } : {}
|
|
163
189
|
};
|
|
164
190
|
}
|
|
165
191
|
async function fetchMattermostMe(client) {
|
|
@@ -200,7 +226,8 @@ async function sendMattermostTyping(client, params) {
|
|
|
200
226
|
if (parentId) payload.parent_id = parentId;
|
|
201
227
|
await client.request("/users/me/typing", {
|
|
202
228
|
method: "POST",
|
|
203
|
-
body: JSON.stringify(payload)
|
|
229
|
+
body: JSON.stringify(payload),
|
|
230
|
+
discardResponse: true
|
|
204
231
|
});
|
|
205
232
|
}
|
|
206
233
|
async function createMattermostDirectChannel(client, userIds, signal, timeoutMs) {
|
|
@@ -277,47 +304,21 @@ async function createMattermostDirectChannelWithRetry(client, userIds, options =
|
|
|
277
304
|
});
|
|
278
305
|
}
|
|
279
306
|
function isRetryableError(error) {
|
|
307
|
+
if (error instanceof PlatformMessageNotDispatchedError && !error.retryable) return false;
|
|
280
308
|
const candidates = collectErrorGraphCandidates(error, (current) => [
|
|
281
309
|
current.cause,
|
|
282
310
|
current.reason,
|
|
283
311
|
...Array.isArray(current.errors) ? current.errors : []
|
|
284
312
|
]);
|
|
285
|
-
const messages = candidates.map((candidate) => normalizeLowercaseStringOrEmpty(
|
|
313
|
+
const messages = candidates.map((candidate) => normalizeLowercaseStringOrEmpty(readStringField(asOptionalObjectRecord(candidate), "message"))).filter((message) => Boolean(message));
|
|
286
314
|
if (messages.some((message) => /mattermost api 5\d{2}\b/.test(message))) return true;
|
|
287
315
|
if (messages.some((message) => /mattermost api 429\b/.test(message) || message.includes("too many requests"))) return true;
|
|
288
|
-
|
|
289
|
-
const clientErrorMatch = message.match(/mattermost api (4\d{2})\b/);
|
|
290
|
-
if (!clientErrorMatch) continue;
|
|
291
|
-
const statusCodeText = clientErrorMatch[1];
|
|
292
|
-
if (!statusCodeText) continue;
|
|
293
|
-
const statusCode = Number.parseInt(statusCodeText, 10);
|
|
294
|
-
if (statusCode >= 400 && statusCode < 500) return false;
|
|
295
|
-
}
|
|
316
|
+
if (messages.some((message) => /mattermost api 4\d{2}\b/.test(message))) return false;
|
|
296
317
|
if (messages.some((message) => /mattermost api \d{3}\b/.test(message))) return false;
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
const code = readErrorCode(candidate);
|
|
300
|
-
if (code) codes.push(code);
|
|
301
|
-
}
|
|
302
|
-
if (codes.some((code) => RETRYABLE_NETWORK_ERROR_CODES.has(code))) return true;
|
|
303
|
-
const names = [];
|
|
304
|
-
for (const candidate of candidates) {
|
|
305
|
-
const name = readErrorName(candidate);
|
|
306
|
-
if (name) names.push(name);
|
|
307
|
-
}
|
|
308
|
-
if (names.some((name) => RETRYABLE_NETWORK_ERROR_NAMES.has(name))) return true;
|
|
318
|
+
if (candidates.some((candidate) => RETRYABLE_NETWORK_ERROR_CODES.has(readErrorCode(candidate) ?? ""))) return true;
|
|
319
|
+
if (candidates.some((candidate) => RETRYABLE_NETWORK_ERROR_NAMES.has(readErrorName(candidate)))) return true;
|
|
309
320
|
return messages.some((message) => RETRYABLE_NETWORK_MESSAGE_SNIPPETS.some((pattern) => message.includes(pattern)));
|
|
310
321
|
}
|
|
311
|
-
function readErrorMessage(error) {
|
|
312
|
-
if (!error || typeof error !== "object") return;
|
|
313
|
-
const message = error.message;
|
|
314
|
-
return typeof message === "string" && message.trim() ? message : void 0;
|
|
315
|
-
}
|
|
316
|
-
function readErrorName(error) {
|
|
317
|
-
if (!error || typeof error !== "object") return;
|
|
318
|
-
const name = error.name;
|
|
319
|
-
return typeof name === "string" && name.trim() ? name : void 0;
|
|
320
|
-
}
|
|
321
322
|
function readErrorCode(error) {
|
|
322
323
|
if (!error || typeof error !== "object") return;
|
|
323
324
|
const { code, errno } = error;
|
|
@@ -354,13 +355,21 @@ async function updateMattermostPost(client, postId, params) {
|
|
|
354
355
|
const payload = { id: postId };
|
|
355
356
|
if (params.message !== void 0) payload.message = params.message;
|
|
356
357
|
if (params.props !== void 0) payload.props = params.props;
|
|
357
|
-
|
|
358
|
+
else if (params.message !== void 0 && /\B@(channel|all|here)\b/i.test(params.message)) {
|
|
359
|
+
const current = MattermostPostSchema.parse(await client.request(`/posts/${postId}`));
|
|
360
|
+
if (current.id !== postId) throw new Error("Mattermost post lookup returned a different post id");
|
|
361
|
+
payload.props = current.props ?? {};
|
|
362
|
+
}
|
|
363
|
+
return await client.request(`/posts/${postId}/patch`, {
|
|
358
364
|
method: "PUT",
|
|
359
365
|
body: JSON.stringify(payload)
|
|
360
366
|
});
|
|
361
367
|
}
|
|
362
368
|
async function deleteMattermostPost(client, postId) {
|
|
363
|
-
await client.request(`/posts/${postId}`, {
|
|
369
|
+
await client.request(`/posts/${postId}`, {
|
|
370
|
+
method: "DELETE",
|
|
371
|
+
discardResponse: true
|
|
372
|
+
});
|
|
364
373
|
}
|
|
365
374
|
async function uploadMattermostFile(client, params) {
|
|
366
375
|
const form = new FormData();
|