@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,175 @@
|
|
|
1
|
+
import { n as __reExport, t as __exportAll } from "./rolldown-runtime-BBjsoOtd.mjs";
|
|
2
|
+
//#region packages/normalization-core/src/record-coerce.ts
|
|
3
|
+
/** Type guard for non-array object records at browser-safe boundaries. */
|
|
4
|
+
function isRecord(value) {
|
|
5
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
6
|
+
}
|
|
7
|
+
/** Returns a non-array record or null. */
|
|
8
|
+
function asNullableRecord(value) {
|
|
9
|
+
return isRecord(value) ? value : null;
|
|
10
|
+
}
|
|
11
|
+
//#endregion
|
|
12
|
+
//#region src/config/channel-config-normalization.ts
|
|
13
|
+
/** Applies one channel-specific doctor migration to every object-shaped account. */
|
|
14
|
+
function normalizeChannelAccounts(params) {
|
|
15
|
+
const rawAccounts = asNullableRecord(params.entry.accounts);
|
|
16
|
+
if (!rawAccounts) return {
|
|
17
|
+
entry: params.entry,
|
|
18
|
+
changed: false
|
|
19
|
+
};
|
|
20
|
+
let changed = false;
|
|
21
|
+
const accounts = { ...rawAccounts };
|
|
22
|
+
for (const [accountId, value] of Object.entries(rawAccounts)) {
|
|
23
|
+
const account = asNullableRecord(value);
|
|
24
|
+
if (!account) continue;
|
|
25
|
+
const normalized = params.normalizeAccount({
|
|
26
|
+
account,
|
|
27
|
+
accountId,
|
|
28
|
+
pathPrefix: `${params.pathPrefix}.accounts.${accountId}`,
|
|
29
|
+
changes: params.changes
|
|
30
|
+
});
|
|
31
|
+
if (normalized.changed) {
|
|
32
|
+
accounts[accountId] = normalized.entry;
|
|
33
|
+
changed = true;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return changed ? {
|
|
37
|
+
entry: {
|
|
38
|
+
...params.entry,
|
|
39
|
+
accounts
|
|
40
|
+
},
|
|
41
|
+
changed: true
|
|
42
|
+
} : {
|
|
43
|
+
entry: params.entry,
|
|
44
|
+
changed: false
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
/** Applies the same channel-specific doctor migration at root and account scope. */
|
|
48
|
+
function normalizeChannelConfigEntries(params) {
|
|
49
|
+
const changes = params.changes ?? [];
|
|
50
|
+
const channels = params.cfg.channels;
|
|
51
|
+
const entry = asNullableRecord(channels?.[params.channelId]);
|
|
52
|
+
if (!entry) return {
|
|
53
|
+
config: params.cfg,
|
|
54
|
+
changes
|
|
55
|
+
};
|
|
56
|
+
const channelPath = `channels.${params.channelId}`;
|
|
57
|
+
const root = params.normalizeEntry({
|
|
58
|
+
entry,
|
|
59
|
+
pathPrefix: channelPath,
|
|
60
|
+
changes
|
|
61
|
+
});
|
|
62
|
+
const accounts = normalizeChannelAccounts({
|
|
63
|
+
entry: root.entry,
|
|
64
|
+
pathPrefix: channelPath,
|
|
65
|
+
changes,
|
|
66
|
+
normalizeAccount: (accountParams) => params.normalizeEntry({
|
|
67
|
+
entry: accountParams.account,
|
|
68
|
+
accountId: accountParams.accountId,
|
|
69
|
+
pathPrefix: accountParams.pathPrefix,
|
|
70
|
+
changes: accountParams.changes
|
|
71
|
+
})
|
|
72
|
+
});
|
|
73
|
+
if (!root.changed && !accounts.changed) return {
|
|
74
|
+
config: params.cfg,
|
|
75
|
+
changes
|
|
76
|
+
};
|
|
77
|
+
return {
|
|
78
|
+
config: {
|
|
79
|
+
...params.cfg,
|
|
80
|
+
channels: {
|
|
81
|
+
...channels,
|
|
82
|
+
[params.channelId]: accounts.entry
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
changes
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
//#endregion
|
|
89
|
+
//#region src/plugin-sdk/legacy-webhook-listener-migration.ts
|
|
90
|
+
/** Preserve explicitly configured webhook listeners while moving ingress onto Gateway routes. */
|
|
91
|
+
function createLegacyWebhookListenerDoctorContract(params) {
|
|
92
|
+
const portKey = params.portKey ?? "webhookPort";
|
|
93
|
+
const hostKey = params.hostKey === void 0 ? "webhookHost" : params.hostKey;
|
|
94
|
+
const source = (entry) => params.webhookKey ? asNullableRecord(entry[params.webhookKey]) : entry;
|
|
95
|
+
const hasLegacy = (value) => {
|
|
96
|
+
const entry = asNullableRecord(value);
|
|
97
|
+
const listener = entry && source(entry);
|
|
98
|
+
return Boolean(listener && (Object.hasOwn(listener, portKey) || hostKey && Object.hasOwn(listener, hostKey)));
|
|
99
|
+
};
|
|
100
|
+
const prefix = `channels.${params.channelKey}`;
|
|
101
|
+
return {
|
|
102
|
+
legacyConfigRules: [{
|
|
103
|
+
path: ["channels", params.channelKey],
|
|
104
|
+
message: `${prefix} webhook listeners moved to Gateway routes. Run "openclaw doctor --fix" to preserve explicitly configured listener settings as legacyWebhook.`,
|
|
105
|
+
match: (value) => {
|
|
106
|
+
const accounts = asNullableRecord(asNullableRecord(value)?.accounts);
|
|
107
|
+
return hasLegacy(value) || Object.values(accounts ?? {}).some(hasLegacy);
|
|
108
|
+
}
|
|
109
|
+
}],
|
|
110
|
+
normalizeCompatibilityConfig: ({ cfg }) => {
|
|
111
|
+
const root = asNullableRecord(asNullableRecord(cfg.channels)?.[params.channelKey]);
|
|
112
|
+
const inherited = root && source(root);
|
|
113
|
+
const canonicalRoot = asNullableRecord(root?.legacyWebhook);
|
|
114
|
+
return normalizeChannelConfigEntries({
|
|
115
|
+
cfg,
|
|
116
|
+
channelId: params.channelKey,
|
|
117
|
+
normalizeEntry: ({ entry, accountId, pathPrefix, changes }) => {
|
|
118
|
+
const listener = source(entry);
|
|
119
|
+
if (!listener || !hasLegacy(entry)) return {
|
|
120
|
+
entry,
|
|
121
|
+
changed: false
|
|
122
|
+
};
|
|
123
|
+
const next = { ...entry };
|
|
124
|
+
const port = Object.hasOwn(listener, portKey) ? listener[portKey] : (accountId ? canonicalRoot?.port ?? inherited?.[portKey] : void 0) ?? params.defaultPort;
|
|
125
|
+
const inheritedHost = accountId ? canonicalRoot ? canonicalRoot.host : (hostKey ? inherited?.[hostKey] : void 0) ?? params.defaultHost : params.defaultHost;
|
|
126
|
+
const host = hostKey ? listener[hostKey] ?? inheritedHost : inheritedHost;
|
|
127
|
+
const legacyPath = [pathPrefix, params.webhookKey].filter(Boolean).join(".");
|
|
128
|
+
if (Object.hasOwn(entry, "legacyWebhook")) changes.push(`Removed ${legacyPath} legacy listener keys; ${pathPrefix}.legacyWebhook is already configured.`);
|
|
129
|
+
else if (accountId && root?.legacyWebhook === false) changes.push(`Removed ${legacyPath} legacy listener keys; ${prefix}.legacyWebhook: false keeps this account's inherited listener disabled.`);
|
|
130
|
+
else {
|
|
131
|
+
next.legacyWebhook = {
|
|
132
|
+
port,
|
|
133
|
+
...host !== void 0 ? { host } : {}
|
|
134
|
+
};
|
|
135
|
+
changes.push(`Moved ${legacyPath} listener settings to ${pathPrefix}.legacyWebhook. Point the external callback or reverse proxy at the Gateway port and webhook path, verify delivery, then set legacyWebhook: false to disable legacy forwarding.`);
|
|
136
|
+
}
|
|
137
|
+
const updated = params.webhookKey ? { ...listener } : next;
|
|
138
|
+
delete updated[portKey];
|
|
139
|
+
if (hostKey) delete updated[hostKey];
|
|
140
|
+
if (params.webhookKey) {
|
|
141
|
+
if (Object.keys(updated).length) next[params.webhookKey] = updated;
|
|
142
|
+
else delete next[params.webhookKey];
|
|
143
|
+
}
|
|
144
|
+
return {
|
|
145
|
+
entry: next,
|
|
146
|
+
changed: true
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
//#endregion
|
|
154
|
+
//#region \0openclaw:bundled-sdk:openclaw/plugin-sdk/runtime-doctor-migrations
|
|
155
|
+
var runtime_doctor_migrations_exports = /* @__PURE__ */ __exportAll({ createLegacyWebhookListenerDoctorContract: () => createLegacyWebhookListenerDoctorContract });
|
|
156
|
+
import * as import_openclaw_plugin_sdk_runtime_doctor_migrations from "openclaw/plugin-sdk/runtime-doctor-migrations";
|
|
157
|
+
__reExport(runtime_doctor_migrations_exports, import_openclaw_plugin_sdk_runtime_doctor_migrations);
|
|
158
|
+
//#endregion
|
|
159
|
+
//#region extensions/mattermost/src/doctor-contract.ts
|
|
160
|
+
const networkContract = (0, runtime_doctor_migrations_exports.createLegacyPrivateNetworkDoctorContract)({ channelKey: "mattermost" });
|
|
161
|
+
const streamingAliasMigration = (0, runtime_doctor_migrations_exports.defineChannelAliasMigration)({
|
|
162
|
+
channelId: "mattermost",
|
|
163
|
+
streaming: { defaultMode: "partial" },
|
|
164
|
+
accountStreamingReplacesRoot: true
|
|
165
|
+
});
|
|
166
|
+
const legacyConfigRules = [...networkContract.legacyConfigRules, ...streamingAliasMigration.legacyConfigRules];
|
|
167
|
+
function normalizeCompatibilityConfig({ cfg }) {
|
|
168
|
+
const network = networkContract.normalizeCompatibilityConfig({ cfg });
|
|
169
|
+
return streamingAliasMigration.normalizeChannelConfig({
|
|
170
|
+
cfg: network.config,
|
|
171
|
+
changes: network.changes
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
//#endregion
|
|
175
|
+
export { normalizeCompatibilityConfig as n, legacyConfigRules as t };
|
|
@@ -1,10 +1,149 @@
|
|
|
1
|
+
import { n as __reExport, t as __exportAll } from "./rolldown-runtime-BBjsoOtd.mjs";
|
|
1
2
|
import { t as getMattermostRuntime } from "./runtime-CNB4YGqJ.mjs";
|
|
2
|
-
import { y as updateMattermostPost } from "./client-
|
|
3
|
-
import { D as sendHttpRequestRejection, T as resolveClientIp, g as isTrustedProxyAddress, h as isRequestBodyLimitError, x as readRequestBodyWithLimit } from "./monitor-auth-
|
|
3
|
+
import { y as updateMattermostPost } from "./client-CVeeTqCO.mjs";
|
|
4
|
+
import { D as sendHttpRequestRejection, T as resolveClientIp, g as isTrustedProxyAddress, h as isRequestBodyLimitError, x as readRequestBodyWithLimit } from "./monitor-auth-aZ0b1gqx.mjs";
|
|
4
5
|
import { createHmac } from "node:crypto";
|
|
5
|
-
import { resolveGatewayPort } from "openclaw/plugin-sdk/gateway-config-runtime";
|
|
6
6
|
import { safeEqualSecret } from "openclaw/plugin-sdk/security-runtime";
|
|
7
7
|
import { normalizeOptionalString, normalizeStringifiedOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
8
|
+
//#region src/gateway/gateway-http-route-contracts.ts
|
|
9
|
+
const GATEWAY_PROBE_ROUTES = /* @__PURE__ */ new Map([
|
|
10
|
+
["/health", "live"],
|
|
11
|
+
["/healthz", "live"],
|
|
12
|
+
["/ready", "ready"],
|
|
13
|
+
["/readyz", "ready"],
|
|
14
|
+
["/startup", "startup"],
|
|
15
|
+
["/startupz", "startup"]
|
|
16
|
+
]);
|
|
17
|
+
function classifyGatewayProbePath(pathname) {
|
|
18
|
+
for (const [root, status] of GATEWAY_PROBE_ROUTES) {
|
|
19
|
+
if (pathname === root) return status;
|
|
20
|
+
if (pathname.startsWith(`${root}/`)) return "namespace";
|
|
21
|
+
}
|
|
22
|
+
return "outside";
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
//#region packages/normalization-core/src/string-coerce.ts
|
|
26
|
+
/** Trims string input and returns null for non-strings or empty strings. */
|
|
27
|
+
function normalizeNullableString(value) {
|
|
28
|
+
if (typeof value !== "string") return null;
|
|
29
|
+
const trimmed = value.trim();
|
|
30
|
+
return trimmed ? trimmed : null;
|
|
31
|
+
}
|
|
32
|
+
/** Trims string input and returns undefined for non-strings or empty strings. */
|
|
33
|
+
function normalizeOptionalString$1(value) {
|
|
34
|
+
return normalizeNullableString(value) ?? void 0;
|
|
35
|
+
}
|
|
36
|
+
/** Lowercases a normalized optional string. */
|
|
37
|
+
function normalizeOptionalLowercaseString(value) {
|
|
38
|
+
return normalizeOptionalString$1(value)?.toLowerCase();
|
|
39
|
+
}
|
|
40
|
+
/** Lowercases a normalized string or returns an empty string when absent. */
|
|
41
|
+
function normalizeLowercaseStringOrEmpty$1(value) {
|
|
42
|
+
return normalizeOptionalLowercaseString(value) ?? "";
|
|
43
|
+
}
|
|
44
|
+
//#endregion
|
|
45
|
+
//#region src/plugins/http-path-prefix.ts
|
|
46
|
+
function prefixMatchPath(pathname, prefix) {
|
|
47
|
+
return pathname === prefix || pathname.startsWith(`${prefix}/`) || pathname.startsWith(`${prefix}%`);
|
|
48
|
+
}
|
|
49
|
+
//#endregion
|
|
50
|
+
//#region src/gateway/security-path.ts
|
|
51
|
+
const MAX_PATH_DECODE_PASSES = 32;
|
|
52
|
+
function normalizePathSeparators(pathname) {
|
|
53
|
+
const collapsed = pathname.replace(/\/{2,}/g, "/");
|
|
54
|
+
if (collapsed.length <= 1) return collapsed;
|
|
55
|
+
return collapsed.replace(/\/+$/, "");
|
|
56
|
+
}
|
|
57
|
+
function resolveDotSegments(pathname) {
|
|
58
|
+
try {
|
|
59
|
+
return new URL(pathname, "http://localhost").pathname;
|
|
60
|
+
} catch {
|
|
61
|
+
return pathname;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
function normalizePathForSecurity(pathname) {
|
|
65
|
+
return normalizePathSeparators(normalizeLowercaseStringOrEmpty$1(resolveDotSegments(pathname))) || "/";
|
|
66
|
+
}
|
|
67
|
+
function buildCanonicalPathCandidates(pathname, maxDecodePasses = MAX_PATH_DECODE_PASSES) {
|
|
68
|
+
const candidates = /* @__PURE__ */ new Set([normalizePathForSecurity(pathname)]);
|
|
69
|
+
let decoded = pathname;
|
|
70
|
+
let malformedEncoding = false;
|
|
71
|
+
let decodePasses = 0;
|
|
72
|
+
for (let pass = 0; pass < maxDecodePasses; pass++) {
|
|
73
|
+
let nextDecoded;
|
|
74
|
+
try {
|
|
75
|
+
nextDecoded = decodeURIComponent(decoded);
|
|
76
|
+
} catch {
|
|
77
|
+
malformedEncoding = true;
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
if (nextDecoded === decoded) break;
|
|
81
|
+
decodePasses += 1;
|
|
82
|
+
decoded = nextDecoded;
|
|
83
|
+
candidates.add(normalizePathForSecurity(decoded));
|
|
84
|
+
}
|
|
85
|
+
let decodePassLimitReached = false;
|
|
86
|
+
if (!malformedEncoding) try {
|
|
87
|
+
decodePassLimitReached = decodeURIComponent(decoded) !== decoded;
|
|
88
|
+
} catch {
|
|
89
|
+
malformedEncoding = true;
|
|
90
|
+
}
|
|
91
|
+
return {
|
|
92
|
+
candidates: [...candidates],
|
|
93
|
+
decodePasses,
|
|
94
|
+
decodePassLimitReached,
|
|
95
|
+
malformedEncoding
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
function canonicalizePathForSecurity(pathname) {
|
|
99
|
+
const { candidates, decodePasses, decodePassLimitReached, malformedEncoding } = buildCanonicalPathCandidates(pathname);
|
|
100
|
+
return {
|
|
101
|
+
canonicalPath: candidates[candidates.length - 1] ?? "/",
|
|
102
|
+
candidates,
|
|
103
|
+
decodePasses,
|
|
104
|
+
decodePassLimitReached,
|
|
105
|
+
malformedEncoding,
|
|
106
|
+
rawNormalizedPath: normalizePathSeparators(normalizeLowercaseStringOrEmpty$1(pathname)) || "/"
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
const PROTECTED_PLUGIN_ROUTE_PREFIXES = ["/api/channels"];
|
|
110
|
+
//#endregion
|
|
111
|
+
//#region src/gateway/server/plugins-http/path-context.ts
|
|
112
|
+
function normalizeProtectedPrefix(prefix) {
|
|
113
|
+
const collapsed = normalizeLowercaseStringOrEmpty$1(prefix).replace(/\/{2,}/g, "/");
|
|
114
|
+
if (collapsed.length <= 1) return collapsed || "/";
|
|
115
|
+
return collapsed.replace(/\/+$/, "");
|
|
116
|
+
}
|
|
117
|
+
const NORMALIZED_PROTECTED_PLUGIN_ROUTE_PREFIXES = PROTECTED_PLUGIN_ROUTE_PREFIXES.map(normalizeProtectedPrefix);
|
|
118
|
+
/** Returns true when any decoded path candidate targets a protected route. */
|
|
119
|
+
function isProtectedPluginRoutePathFromContext(context) {
|
|
120
|
+
if (context.candidates.some((candidate) => NORMALIZED_PROTECTED_PLUGIN_ROUTE_PREFIXES.some((prefix) => prefixMatchPath(candidate, prefix)))) return true;
|
|
121
|
+
if (context.decodePassLimitReached) return true;
|
|
122
|
+
if (!context.malformedEncoding) return false;
|
|
123
|
+
return NORMALIZED_PROTECTED_PLUGIN_ROUTE_PREFIXES.some((prefix) => prefixMatchPath(context.rawNormalizedPath, prefix));
|
|
124
|
+
}
|
|
125
|
+
/** Builds all security-relevant decoded path candidates for a request path. */
|
|
126
|
+
function resolvePluginRoutePathContext(pathname) {
|
|
127
|
+
const canonical = canonicalizePathForSecurity(pathname);
|
|
128
|
+
return {
|
|
129
|
+
pathname,
|
|
130
|
+
canonicalPath: canonical.canonicalPath,
|
|
131
|
+
candidates: canonical.candidates,
|
|
132
|
+
malformedEncoding: canonical.malformedEncoding,
|
|
133
|
+
decodePassLimitReached: canonical.decodePassLimitReached,
|
|
134
|
+
rawNormalizedPath: canonical.rawNormalizedPath
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
//#endregion
|
|
138
|
+
//#region \0openclaw:bundled-sdk:openclaw/plugin-sdk/gateway-config-runtime
|
|
139
|
+
var gateway_config_runtime_exports = /* @__PURE__ */ __exportAll({
|
|
140
|
+
classifyGatewayProbePath: () => classifyGatewayProbePath,
|
|
141
|
+
isProtectedPluginRoutePathFromContext: () => isProtectedPluginRoutePathFromContext,
|
|
142
|
+
resolvePluginRoutePathContext: () => resolvePluginRoutePathContext
|
|
143
|
+
});
|
|
144
|
+
import * as import_openclaw_plugin_sdk_gateway_config_runtime from "openclaw/plugin-sdk/gateway-config-runtime";
|
|
145
|
+
__reExport(gateway_config_runtime_exports, import_openclaw_plugin_sdk_gateway_config_runtime);
|
|
146
|
+
//#endregion
|
|
8
147
|
//#region extensions/mattermost/src/mattermost/callback-host.ts
|
|
9
148
|
function isWildcardBindHost(rawHost) {
|
|
10
149
|
const trimmed = rawHost.trim();
|
|
@@ -24,9 +163,6 @@ function setInteractionCallbackUrl(accountId, url) {
|
|
|
24
163
|
function resolveInteractionCallbackPath(accountId) {
|
|
25
164
|
return `/mattermost/interactions/${accountId}`;
|
|
26
165
|
}
|
|
27
|
-
function normalizeCallbackBaseUrl(baseUrl) {
|
|
28
|
-
return baseUrl.trim().replace(/\/+$/, "");
|
|
29
|
-
}
|
|
30
166
|
function headerValue(value) {
|
|
31
167
|
if (Array.isArray(value)) return normalizeOptionalString(value[0]);
|
|
32
168
|
return normalizeOptionalString(value);
|
|
@@ -50,8 +186,8 @@ function isAllowedInteractionSource(params) {
|
|
|
50
186
|
function computeInteractionCallbackUrl(accountId, cfg) {
|
|
51
187
|
const path = resolveInteractionCallbackPath(accountId);
|
|
52
188
|
const callbackBaseUrl = normalizeOptionalString(cfg?.interactions?.callbackBaseUrl) ?? normalizeOptionalString(cfg?.channels?.mattermost?.interactions?.callbackBaseUrl);
|
|
53
|
-
if (callbackBaseUrl) return `${
|
|
54
|
-
const port = resolveGatewayPort(cfg);
|
|
189
|
+
if (callbackBaseUrl) return `${callbackBaseUrl.replace(/\/+$/, "")}${path}`;
|
|
190
|
+
const port = (0, gateway_config_runtime_exports.resolveGatewayPort)(cfg);
|
|
55
191
|
let host = cfg?.gateway?.customBindHost && !isWildcardBindHost(cfg.gateway.customBindHost) ? cfg.gateway.customBindHost.trim() : "localhost";
|
|
56
192
|
if (host.includes(":") && !(host.startsWith("[") && host.endsWith("]"))) host = `[${host}]`;
|
|
57
193
|
return `http://${host}:${port}${path}`;
|
|
@@ -101,17 +237,6 @@ function generateInteractionToken(context, accountId) {
|
|
|
101
237
|
const payload = JSON.stringify(canonicalizeInteractionContext(context));
|
|
102
238
|
return createHmac("sha256", secret).update(payload).digest("hex");
|
|
103
239
|
}
|
|
104
|
-
function verifyInteractionToken(context, token, accountId) {
|
|
105
|
-
const expected = generateInteractionToken(context, accountId);
|
|
106
|
-
return safeEqualSecret(expected, token);
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Build Mattermost `props.attachments` with interactive buttons.
|
|
110
|
-
*
|
|
111
|
-
* Each button includes an HMAC token in its integration context so the
|
|
112
|
-
* callback handler can verify the request originated from a legitimate
|
|
113
|
-
* button click (Mattermost's recommended security pattern).
|
|
114
|
-
*/
|
|
115
240
|
/**
|
|
116
241
|
* Sanitize a button ID so Mattermost's action router can match it.
|
|
117
242
|
* Mattermost uses the action ID in the URL path `/api/v4/posts/{id}/actions/{actionId}`
|
|
@@ -166,12 +291,10 @@ function buildButtonProps(params) {
|
|
|
166
291
|
text: params.text
|
|
167
292
|
}) };
|
|
168
293
|
}
|
|
169
|
-
function
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
destroyOnLimit: false
|
|
174
|
-
});
|
|
294
|
+
function sendInteractionResponse(res, statusCode, body) {
|
|
295
|
+
res.statusCode = statusCode;
|
|
296
|
+
res.setHeader("Content-Type", "application/json");
|
|
297
|
+
res.end(JSON.stringify(body));
|
|
175
298
|
}
|
|
176
299
|
function createMattermostInteractionHandler(params) {
|
|
177
300
|
const { client, accountId, log } = params;
|
|
@@ -198,14 +321,16 @@ function createMattermostInteractionHandler(params) {
|
|
|
198
321
|
allowRealIpFallback: params.allowRealIpFallback
|
|
199
322
|
})) {
|
|
200
323
|
log?.(`mattermost interaction: rejected callback source remote=${req.socket?.remoteAddress ?? "?"}`);
|
|
201
|
-
res
|
|
202
|
-
res.setHeader("Content-Type", "application/json");
|
|
203
|
-
res.end(JSON.stringify({ error: "Forbidden origin" }));
|
|
324
|
+
sendInteractionResponse(res, 403, { error: "Forbidden origin" });
|
|
204
325
|
return;
|
|
205
326
|
}
|
|
206
327
|
let payload;
|
|
207
328
|
try {
|
|
208
|
-
payload = parseInteractionPayload(await
|
|
329
|
+
payload = parseInteractionPayload(await readRequestBodyWithLimit(req, {
|
|
330
|
+
maxBytes: INTERACTION_MAX_BODY_BYTES,
|
|
331
|
+
timeoutMs: INTERACTION_BODY_TIMEOUT_MS,
|
|
332
|
+
destroyOnLimit: false
|
|
333
|
+
}));
|
|
209
334
|
} catch (err) {
|
|
210
335
|
log?.(`mattermost interaction: failed to parse body: ${String(err)}`);
|
|
211
336
|
if (isRequestBodyLimitError(err, "PAYLOAD_TOO_LARGE")) {
|
|
@@ -216,47 +341,35 @@ function createMattermostInteractionHandler(params) {
|
|
|
216
341
|
await sendHttpRequestRejection(req, res, 408, JSON.stringify({ error: "Request body timeout" }), "application/json");
|
|
217
342
|
return;
|
|
218
343
|
}
|
|
219
|
-
res
|
|
220
|
-
res.setHeader("Content-Type", "application/json");
|
|
221
|
-
res.end(JSON.stringify({ error: "Invalid request body" }));
|
|
344
|
+
sendInteractionResponse(res, 400, { error: "Invalid request body" });
|
|
222
345
|
return;
|
|
223
346
|
}
|
|
224
347
|
const context = payload.context;
|
|
225
348
|
if (!context) {
|
|
226
|
-
res
|
|
227
|
-
res.setHeader("Content-Type", "application/json");
|
|
228
|
-
res.end(JSON.stringify({ error: "Missing context" }));
|
|
349
|
+
sendInteractionResponse(res, 400, { error: "Missing context" });
|
|
229
350
|
return;
|
|
230
351
|
}
|
|
231
352
|
const token = context["_token"];
|
|
232
353
|
if (typeof token !== "string") {
|
|
233
354
|
log?.("mattermost interaction: missing _token in context");
|
|
234
|
-
res
|
|
235
|
-
res.setHeader("Content-Type", "application/json");
|
|
236
|
-
res.end(JSON.stringify({ error: "Missing token" }));
|
|
355
|
+
sendInteractionResponse(res, 403, { error: "Missing token" });
|
|
237
356
|
return;
|
|
238
357
|
}
|
|
239
358
|
const { _token, ...contextWithoutToken } = context;
|
|
240
|
-
if (!
|
|
359
|
+
if (!safeEqualSecret(generateInteractionToken(contextWithoutToken, accountId), token)) {
|
|
241
360
|
log?.("mattermost interaction: invalid _token");
|
|
242
|
-
res
|
|
243
|
-
res.setHeader("Content-Type", "application/json");
|
|
244
|
-
res.end(JSON.stringify({ error: "Invalid token" }));
|
|
361
|
+
sendInteractionResponse(res, 403, { error: "Invalid token" });
|
|
245
362
|
return;
|
|
246
363
|
}
|
|
247
364
|
const actionId = context.action_id;
|
|
248
365
|
if (typeof actionId !== "string") {
|
|
249
|
-
res
|
|
250
|
-
res.setHeader("Content-Type", "application/json");
|
|
251
|
-
res.end(JSON.stringify({ error: "Missing action_id in context" }));
|
|
366
|
+
sendInteractionResponse(res, 400, { error: "Missing action_id in context" });
|
|
252
367
|
return;
|
|
253
368
|
}
|
|
254
369
|
const signedChannelId = typeof contextWithoutToken[SIGNED_CHANNEL_ID_CONTEXT_KEY] === "string" ? contextWithoutToken[SIGNED_CHANNEL_ID_CONTEXT_KEY].trim() : "";
|
|
255
370
|
if (signedChannelId && signedChannelId !== payload.channel_id) {
|
|
256
371
|
log?.(`mattermost interaction: signed channel mismatch payload=${payload.channel_id} signed=${signedChannelId}`);
|
|
257
|
-
res
|
|
258
|
-
res.setHeader("Content-Type", "application/json");
|
|
259
|
-
res.end(JSON.stringify({ error: "Channel mismatch" }));
|
|
372
|
+
sendInteractionResponse(res, 403, { error: "Channel mismatch" });
|
|
260
373
|
return;
|
|
261
374
|
}
|
|
262
375
|
const userName = payload.user_name ?? payload.user_id;
|
|
@@ -268,9 +381,7 @@ function createMattermostInteractionHandler(params) {
|
|
|
268
381
|
const postChannelId = originalPost.channel_id?.trim();
|
|
269
382
|
if (!postChannelId || postChannelId !== payload.channel_id) {
|
|
270
383
|
log?.(`mattermost interaction: post channel mismatch payload=${payload.channel_id} post=${postChannelId ?? "<missing>"}`);
|
|
271
|
-
res
|
|
272
|
-
res.setHeader("Content-Type", "application/json");
|
|
273
|
-
res.end(JSON.stringify({ error: "Post/channel mismatch" }));
|
|
384
|
+
sendInteractionResponse(res, 403, { error: "Post/channel mismatch" });
|
|
274
385
|
return;
|
|
275
386
|
}
|
|
276
387
|
originalMessage = originalPost.message ?? "";
|
|
@@ -284,23 +395,12 @@ function createMattermostInteractionHandler(params) {
|
|
|
284
395
|
}
|
|
285
396
|
if (clickedButtonName === null) {
|
|
286
397
|
log?.(`mattermost interaction: action ${actionId} not found in post ${payload.post_id}`);
|
|
287
|
-
res
|
|
288
|
-
res.setHeader("Content-Type", "application/json");
|
|
289
|
-
res.end(JSON.stringify({ error: "Unknown action" }));
|
|
398
|
+
sendInteractionResponse(res, 403, { error: "Unknown action" });
|
|
290
399
|
return;
|
|
291
400
|
}
|
|
292
401
|
} catch (err) {
|
|
293
402
|
log?.(`mattermost interaction: failed to validate post ${payload.post_id}: ${String(err)}`);
|
|
294
|
-
res
|
|
295
|
-
res.setHeader("Content-Type", "application/json");
|
|
296
|
-
res.end(JSON.stringify({ error: "Failed to validate interaction" }));
|
|
297
|
-
return;
|
|
298
|
-
}
|
|
299
|
-
if (!originalPost) {
|
|
300
|
-
log?.(`mattermost interaction: missing fetched post ${payload.post_id}`);
|
|
301
|
-
res.statusCode = 500;
|
|
302
|
-
res.setHeader("Content-Type", "application/json");
|
|
303
|
-
res.end(JSON.stringify({ error: "Failed to load interaction post" }));
|
|
403
|
+
sendInteractionResponse(res, 500, { error: "Failed to validate interaction" });
|
|
304
404
|
return;
|
|
305
405
|
}
|
|
306
406
|
log?.(`mattermost interaction: action=${actionId} user=${payload.user_name ?? payload.user_id} post=${payload.post_id} channel=${payload.channel_id}`);
|
|
@@ -310,16 +410,12 @@ function createMattermostInteractionHandler(params) {
|
|
|
310
410
|
post: originalPost
|
|
311
411
|
});
|
|
312
412
|
if (!authorization.ok) {
|
|
313
|
-
res.statusCode
|
|
314
|
-
res.setHeader("Content-Type", "application/json");
|
|
315
|
-
res.end(JSON.stringify(authorization.response ?? { ephemeral_text: "You are not allowed to use this action here." }));
|
|
413
|
+
sendInteractionResponse(res, authorization.statusCode ?? 200, authorization.response ?? { ephemeral_text: "You are not allowed to use this action here." });
|
|
316
414
|
return;
|
|
317
415
|
}
|
|
318
416
|
} catch (err) {
|
|
319
417
|
log?.(`mattermost interaction: authorization failed: ${String(err)}`);
|
|
320
|
-
res
|
|
321
|
-
res.setHeader("Content-Type", "application/json");
|
|
322
|
-
res.end(JSON.stringify({ error: "Interaction authorization failed" }));
|
|
418
|
+
sendInteractionResponse(res, 500, { error: "Interaction authorization failed" });
|
|
323
419
|
return;
|
|
324
420
|
}
|
|
325
421
|
if (params.handleInteraction) try {
|
|
@@ -333,16 +429,12 @@ function createMattermostInteractionHandler(params) {
|
|
|
333
429
|
post: originalPost
|
|
334
430
|
});
|
|
335
431
|
if (response !== null) {
|
|
336
|
-
res
|
|
337
|
-
res.setHeader("Content-Type", "application/json");
|
|
338
|
-
res.end(JSON.stringify(response));
|
|
432
|
+
sendInteractionResponse(res, 200, response);
|
|
339
433
|
return;
|
|
340
434
|
}
|
|
341
435
|
} catch (err) {
|
|
342
436
|
log?.(`mattermost interaction: custom handler failed: ${String(err)}`);
|
|
343
|
-
res
|
|
344
|
-
res.setHeader("Content-Type", "application/json");
|
|
345
|
-
res.end(JSON.stringify({ error: "Interaction handler failed" }));
|
|
437
|
+
sendInteractionResponse(res, 500, { error: "Interaction handler failed" });
|
|
346
438
|
return;
|
|
347
439
|
}
|
|
348
440
|
try {
|
|
@@ -367,9 +459,7 @@ function createMattermostInteractionHandler(params) {
|
|
|
367
459
|
} catch (err) {
|
|
368
460
|
log?.(`mattermost interaction: failed to update post ${payload.post_id}: ${String(err)}`);
|
|
369
461
|
}
|
|
370
|
-
res
|
|
371
|
-
res.setHeader("Content-Type", "application/json");
|
|
372
|
-
res.end("{}");
|
|
462
|
+
sendInteractionResponse(res, 200, {});
|
|
373
463
|
if (params.dispatchButtonClick) try {
|
|
374
464
|
await params.dispatchButtonClick({
|
|
375
465
|
channelId: payload.channel_id,
|
|
@@ -386,4 +476,4 @@ function createMattermostInteractionHandler(params) {
|
|
|
386
476
|
};
|
|
387
477
|
}
|
|
388
478
|
//#endregion
|
|
389
|
-
export { resolveInteractionCallbackPath as a, setInteractionSecret as c, createMattermostInteractionHandler as i, isWildcardBindHost as l, buildButtonProps as n, resolveInteractionCallbackUrl as o, computeInteractionCallbackUrl as r, setInteractionCallbackUrl as s, buildButtonAttachments as t };
|
|
479
|
+
export { resolveInteractionCallbackPath as a, setInteractionSecret as c, createMattermostInteractionHandler as i, isWildcardBindHost as l, buildButtonProps as n, resolveInteractionCallbackUrl as o, computeInteractionCallbackUrl as r, setInteractionCallbackUrl as s, buildButtonAttachments as t, gateway_config_runtime_exports as u };
|