@openclaw/clickclack 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-yIQ_PUDD.mjs → channel-Bcwtohk7.mjs} +326 -224
- package/dist/.setup/resolve-BHGLohni.mjs +336 -0
- package/dist/.setup/rolldown-runtime-B4FMCO8f.mjs +28 -0
- package/dist/.setup/{runtime-api-D9Bwyc44.mjs → runtime-api-BvP8DrPQ.mjs} +231 -164
- package/dist/.setup/{setup-claim-t5SbtvZy.mjs → setup-claim-Cx8knvXs.mjs} +1 -1
- package/dist/.setup/setup-plugin-api-BH_nw-AP.mjs +2 -0
- package/dist/.setup/{setup-plugin-api-BUwBPYpy.mjs → setup-plugin-api-C9QcBJuW.mjs} +1 -1
- package/dist/.setup/{setup-surface-BBl3rvVx.mjs → setup-surface-BW1Q06w5.mjs} +50 -503
- package/dist/.setup/setup-verify-Msgd70_M.mjs +111 -0
- package/dist/api.js +3 -2
- package/dist/channel-plugin-api.js +1 -1
- package/dist/doctor-contract-api.js +160 -3
- package/dist/index.js +1 -1
- package/dist/runtime-api.js +4 -3
- package/dist/setup-entry.js +1 -1
- package/dist/setup-plugin-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 +31 -1
- package/package.json +5 -5
- package/dist/.setup/setup-plugin-api-B19mjQvl.mjs +0 -2
|
@@ -1,106 +1,177 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as __reExport, t as __exportAll } from "./rolldown-runtime-B4FMCO8f.mjs";
|
|
2
|
+
import { c as CLICKCLACK_CHANNEL_ID, d as DEFAULT_ACCOUNT_ID, f as isClickClackAccountCurrent, g as resolveClickClackAccountConfig, h as resolveClickClackAccount, l as clickClackConfigAdapter, m as listEnabledClickClackAccounts, n as clickClackSetupContract, s as clickClackConfigSchema, t as clickClackSetupWizard, u as clickClackMeta } from "./setup-surface-BW1Q06w5.mjs";
|
|
3
|
+
import { i as createClickClackClient, n as resolveWorkspaceId, o as normalizeClickClackCorrelationId, r as ClickClackHttpError, t as resolveChannelId } from "./resolve-BHGLohni.mjs";
|
|
2
4
|
import { n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries } from "./secret-contract-BKkzzjBA.mjs";
|
|
3
5
|
import { resolveChannelMediaMaxBytes } from "openclaw/plugin-sdk/account-helpers";
|
|
4
6
|
import { parseDateStringTimestampMs } from "openclaw/plugin-sdk/number-runtime";
|
|
5
7
|
import { mergePairLoopGuardConfig } from "openclaw/plugin-sdk/pair-loop-guard-runtime";
|
|
6
8
|
import { readStringField } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
7
9
|
import { buildChannelOutboundSessionRoute, buildThreadAwareOutboundSessionRoute, createChatChannelPlugin } from "openclaw/plugin-sdk/channel-core";
|
|
8
|
-
import { buildChannelProgressDraftLine, createChannelMessageReplyPipeline, createMessageReceiptFromOutboundResults, defineChannelMessageAdapter, deriveDurableFinalDeliveryRequirements } from "openclaw/plugin-sdk/channel-outbound";
|
|
10
|
+
import { buildChannelProgressDraftLine, createChannelMessageReplyPipeline, createMessageReceiptFromOutboundResults, defineChannelMessageAdapter, deriveDurableFinalDeliveryRequirements, formatChannelProgressDraftLineForEntry, isCompleteAgentPreamble } from "openclaw/plugin-sdk/channel-outbound";
|
|
9
11
|
import { createComputedAccountStatusAdapter, createDefaultChannelRuntimeState } from "openclaw/plugin-sdk/status-helpers";
|
|
10
12
|
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
11
13
|
import { channelReadyPatch, channelStoppedPatch } from "openclaw/plugin-sdk/gateway-runtime";
|
|
12
14
|
import { sleepWithAbort } from "openclaw/plugin-sdk/runtime-env";
|
|
13
15
|
import { rawDataToString } from "openclaw/plugin-sdk/webhook-ingress";
|
|
14
|
-
import {
|
|
16
|
+
import { isDeepStrictEqual } from "node:util";
|
|
17
|
+
import { parseAccessGroupAllowFromEntry } from "openclaw/plugin-sdk/access-groups";
|
|
18
|
+
import { formatNormalizedAllowFromEntries, resolveAllowlistMatchByCandidates } from "openclaw/plugin-sdk/allow-from";
|
|
15
19
|
import { normalizeAgentId } from "openclaw/plugin-sdk/routing";
|
|
16
20
|
import { createHash, randomUUID } from "node:crypto";
|
|
17
21
|
import { truncateCodePoints } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
18
|
-
import { buildMentionRegexes, normalizeMentionText } from "openclaw/plugin-sdk/channel-mention-gating";
|
|
19
22
|
import { createPluginRuntimeStore } from "openclaw/plugin-sdk/runtime-store";
|
|
20
23
|
import { listNativeCommandSpecsForConfig } from "openclaw/plugin-sdk/native-command-registry";
|
|
21
24
|
import { buildChannelInboundEventContext, createChannelInboundEnvelopeBuilder, createChannelPartialDeliveryError, recordChannelBotPairLoopAndCheckSuppression } from "openclaw/plugin-sdk/channel-inbound";
|
|
22
25
|
import { extensionForMime } from "openclaw/plugin-sdk/media-mime";
|
|
23
26
|
import { loadOutboundMediaFromUrl } from "openclaw/plugin-sdk/outbound-media";
|
|
24
27
|
import { FormatCapabilityProfile, renderMarkdownWithMarkers, sanitizeAssistantVisibleText } from "openclaw/plugin-sdk/text-chunking";
|
|
28
|
+
//#region src/channels/mention-gating.ts
|
|
29
|
+
function resolveBotThreadMentionPolicy(params) {
|
|
30
|
+
if (!params.isBotOwnedThread || params.requireMentionInBotThreads === void 0) return {
|
|
31
|
+
requireMention: params.requireMention,
|
|
32
|
+
implicitMentionKinds: params.implicitMentionKinds
|
|
33
|
+
};
|
|
34
|
+
return {
|
|
35
|
+
requireMention: params.requireMentionInBotThreads,
|
|
36
|
+
implicitMentionKinds: params.requireMentionInBotThreads ? params.implicitMentionKinds?.filter((kind) => kind === "native") : params.implicitMentionKinds
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
//#endregion
|
|
40
|
+
//#region \0openclaw:bundled-sdk:openclaw/plugin-sdk/channel-mention-gating
|
|
41
|
+
var channel_mention_gating_exports = /* @__PURE__ */ __exportAll({ resolveBotThreadMentionPolicy: () => resolveBotThreadMentionPolicy });
|
|
42
|
+
import * as import_openclaw_plugin_sdk_channel_mention_gating from "openclaw/plugin-sdk/channel-mention-gating";
|
|
43
|
+
__reExport(channel_mention_gating_exports, import_openclaw_plugin_sdk_channel_mention_gating);
|
|
44
|
+
//#endregion
|
|
25
45
|
//#region extensions/clickclack/src/discussions/binding-generation.ts
|
|
26
|
-
const
|
|
27
|
-
|
|
46
|
+
const GENERATION_STORE_OPTIONS = {
|
|
47
|
+
namespace: "discussion-binding-generations",
|
|
48
|
+
maxEntries: 1e4,
|
|
49
|
+
overflowPolicy: "reject-new"
|
|
50
|
+
};
|
|
28
51
|
const storesByRuntime$2 = /* @__PURE__ */ new WeakMap();
|
|
29
|
-
function
|
|
30
|
-
|
|
31
|
-
if (
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
52
|
+
function withGenerationStore(runtime, run) {
|
|
53
|
+
let owner = storesByRuntime$2.get(runtime);
|
|
54
|
+
if (!owner) {
|
|
55
|
+
const store = runtime.state.openKeyedStore(GENERATION_STORE_OPTIONS);
|
|
56
|
+
owner = {
|
|
57
|
+
store,
|
|
58
|
+
...!store.observe || !store.compareAndApply ? { native: runtime.state.openSyncKeyedStore(GENERATION_STORE_OPTIONS) } : {},
|
|
59
|
+
tail: Promise.resolve()
|
|
60
|
+
};
|
|
61
|
+
storesByRuntime$2.set(runtime, owner);
|
|
62
|
+
}
|
|
63
|
+
const currentOwner = owner;
|
|
64
|
+
const current = owner.tail.then(() => run(currentOwner));
|
|
65
|
+
owner.tail = current.then(() => void 0, () => void 0);
|
|
66
|
+
return current;
|
|
67
|
+
}
|
|
68
|
+
function mutateGeneration(runtime, sessionKey, decide) {
|
|
69
|
+
return withGenerationStore(runtime, async ({ store, native }) => {
|
|
70
|
+
if (native) {
|
|
71
|
+
const current = native.lookup(sessionKey);
|
|
72
|
+
const next = decide(current);
|
|
73
|
+
if (next.value !== current) {
|
|
74
|
+
if (next.value) native.register(sessionKey, next.value);
|
|
75
|
+
else native.delete(sessionKey);
|
|
76
|
+
}
|
|
77
|
+
return next.result;
|
|
78
|
+
}
|
|
79
|
+
const { observe, compareAndApply } = store;
|
|
80
|
+
if (!observe || !compareAndApply) throw new Error("ClickClack generation comparison capabilities changed");
|
|
81
|
+
let observed = await observe(sessionKey);
|
|
82
|
+
for (;;) {
|
|
83
|
+
const next = decide(observed.value);
|
|
84
|
+
const outcome = await compareAndApply(sessionKey, observed.comparison, next.value === observed.value ? {
|
|
85
|
+
operation: "update",
|
|
86
|
+
action: "keep"
|
|
87
|
+
} : next.value ? {
|
|
88
|
+
operation: "update",
|
|
89
|
+
action: "set",
|
|
90
|
+
value: next.value
|
|
91
|
+
} : {
|
|
92
|
+
operation: "delete",
|
|
93
|
+
action: "delete"
|
|
94
|
+
});
|
|
95
|
+
if (outcome.status !== "conflict") return next.result;
|
|
96
|
+
observed = outcome.current;
|
|
97
|
+
}
|
|
36
98
|
});
|
|
37
|
-
storesByRuntime$2.set(runtime, created);
|
|
38
|
-
return created;
|
|
39
99
|
}
|
|
40
100
|
/** Reserves a generation so an interrupted channel create can be adopted on retry. */
|
|
41
101
|
function reserveDiscussionBindingGeneration(params) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
102
|
+
let generation;
|
|
103
|
+
return mutateGeneration(params.runtime, params.sessionKey, (existing) => {
|
|
104
|
+
const existingAccountId = existing?.accountId ?? existing?.pending?.accountId;
|
|
105
|
+
const existingCredentialFingerprint = existing?.credentialFingerprint ?? existing?.pending?.credentialFingerprint;
|
|
106
|
+
if (existing?.destinationIdentity === params.destinationIdentity && existingAccountId === params.accountId && existingCredentialFingerprint === params.credentialFingerprint) return {
|
|
107
|
+
value: existing.accountId && existing.credentialFingerprint ? existing : {
|
|
108
|
+
...existing,
|
|
109
|
+
accountId: params.accountId,
|
|
110
|
+
credentialFingerprint: params.credentialFingerprint
|
|
111
|
+
},
|
|
112
|
+
result: existing.generation
|
|
113
|
+
};
|
|
114
|
+
generation ??= (params.createGeneration ?? randomUUID)();
|
|
115
|
+
return {
|
|
116
|
+
value: {
|
|
117
|
+
accountId: params.accountId,
|
|
118
|
+
credentialFingerprint: params.credentialFingerprint,
|
|
119
|
+
destinationIdentity: params.destinationIdentity,
|
|
120
|
+
generation
|
|
121
|
+
},
|
|
122
|
+
result: generation
|
|
123
|
+
};
|
|
60
124
|
});
|
|
61
|
-
return generation;
|
|
62
125
|
}
|
|
63
126
|
/** Clears only the completed reservation; future opens must mint a new ownership ref. */
|
|
64
127
|
function clearDiscussionBindingGeneration(params) {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
store.delete(params.sessionKey);
|
|
128
|
+
return mutateGeneration(params.runtime, params.sessionKey, (existing) => ({
|
|
129
|
+
value: existing && params.expectedGeneration && existing.generation !== params.expectedGeneration ? existing : void 0,
|
|
130
|
+
result: void 0
|
|
131
|
+
}));
|
|
70
132
|
}
|
|
71
133
|
/** Quarantines a destination before the first fallible channel create. */
|
|
72
134
|
function recordPendingDiscussionOpen(params) {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
135
|
+
return mutateGeneration(params.runtime, params.sessionKey, (existing) => {
|
|
136
|
+
if (!existing || existing.generation !== params.generation) throw new Error("ClickClack discussion generation changed before channel creation");
|
|
137
|
+
if (existing.accountId !== params.pending.accountId || existing.credentialFingerprint !== params.pending.credentialFingerprint) throw new Error("ClickClack discussion ownership changed before channel creation");
|
|
138
|
+
return {
|
|
139
|
+
value: {
|
|
140
|
+
...existing,
|
|
141
|
+
pending: params.pending
|
|
142
|
+
},
|
|
143
|
+
result: void 0
|
|
144
|
+
};
|
|
80
145
|
});
|
|
81
146
|
}
|
|
82
147
|
function listPendingDiscussionOpens(runtime) {
|
|
83
|
-
return
|
|
148
|
+
return withGenerationStore(runtime, async ({ store }) => (await store.entries()).flatMap((entry) => entry.value.pending ? [{
|
|
84
149
|
sessionKey: entry.key,
|
|
85
150
|
generation: entry.value.generation,
|
|
86
151
|
...entry.value.pending
|
|
87
|
-
}] : []);
|
|
152
|
+
}] : []));
|
|
88
153
|
}
|
|
89
154
|
/** Stops destination-wide quarantine after the exact remote channel is known. */
|
|
90
155
|
function clearPendingDiscussionOpen(params) {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
156
|
+
return mutateGeneration(params.runtime, params.sessionKey, (existing) => {
|
|
157
|
+
if (!existing || existing.generation !== params.expectedGeneration || !existing.pending) return {
|
|
158
|
+
value: existing,
|
|
159
|
+
result: void 0
|
|
160
|
+
};
|
|
161
|
+
return {
|
|
162
|
+
value: {
|
|
163
|
+
accountId: existing.accountId ?? existing.pending.accountId,
|
|
164
|
+
credentialFingerprint: existing.credentialFingerprint ?? existing.pending.credentialFingerprint,
|
|
165
|
+
destinationIdentity: existing.destinationIdentity,
|
|
166
|
+
generation: existing.generation
|
|
167
|
+
},
|
|
168
|
+
result: void 0
|
|
169
|
+
};
|
|
99
170
|
});
|
|
100
171
|
}
|
|
101
|
-
function hasPendingDiscussionOpenForDestination(params) {
|
|
172
|
+
async function hasPendingDiscussionOpenForDestination(params) {
|
|
102
173
|
const serverBaseUrl = params.serverBaseUrl.replace(/\/+$/u, "");
|
|
103
|
-
return listPendingDiscussionOpens(params.runtime).some((pending) => pending.serverBaseUrl === serverBaseUrl && pending.workspaceId === params.workspaceId);
|
|
174
|
+
return (await listPendingDiscussionOpens(params.runtime)).some((pending) => pending.serverBaseUrl === serverBaseUrl && pending.workspaceId === params.workspaceId);
|
|
104
175
|
}
|
|
105
176
|
//#endregion
|
|
106
177
|
//#region extensions/clickclack/src/discussions/naming.ts
|
|
@@ -402,14 +473,19 @@ function isClickClackDiscussionChannelRevoked(params) {
|
|
|
402
473
|
}
|
|
403
474
|
//#endregion
|
|
404
475
|
//#region extensions/clickclack/src/discussions/routing.ts
|
|
405
|
-
function resolveClickClackDiscussionRoute(params) {
|
|
406
|
-
if (isClickClackDiscussionChannelRevoked(params)) return { state: "revoked" };
|
|
476
|
+
async function resolveClickClackDiscussionRoute(params) {
|
|
407
477
|
const store = getClickClackDiscussionBindingStore(params.runtime);
|
|
408
|
-
|
|
409
|
-
|
|
478
|
+
let matched = store.getByChannel(params.serverBaseUrl, params.channelId);
|
|
479
|
+
let pending = false;
|
|
480
|
+
if (!matched) {
|
|
481
|
+
pending = await hasPendingDiscussionOpenForDestination(params);
|
|
482
|
+
matched = store.getByChannel(params.serverBaseUrl, params.channelId);
|
|
483
|
+
}
|
|
484
|
+
if (isClickClackDiscussionChannelRevoked(params)) return { state: "revoked" };
|
|
485
|
+
if (!matched) return { state: pending ? "revoked" : "unbound" };
|
|
410
486
|
if (matched.binding.accountId !== params.accountId) return { state: "revoked" };
|
|
411
487
|
if (matched.binding.serverBaseUrl !== params.serverBaseUrl.replace(/\/+$/u, "")) return { state: "revoked" };
|
|
412
|
-
if (resolveDiscussionBindingAccount(params.config, matched.binding).state !== "active") return { state: "revoked" };
|
|
488
|
+
if (resolveDiscussionBindingAccount(params.runtime.config.current(), matched.binding).state !== "active") return { state: "revoked" };
|
|
413
489
|
let binding;
|
|
414
490
|
try {
|
|
415
491
|
binding = attachBindingToCurrentActiveSession({
|
|
@@ -454,45 +530,20 @@ function resolveClickClackDiscussionRoute(params) {
|
|
|
454
530
|
}
|
|
455
531
|
//#endregion
|
|
456
532
|
//#region extensions/clickclack/src/group-policy.ts
|
|
457
|
-
|
|
458
|
-
* Resolves bot-authored message policy using the same exact, wildcard, and
|
|
459
|
-
* account-level precedence as mention gating.
|
|
460
|
-
*/
|
|
461
|
-
function resolveClickClackBotPolicy(params) {
|
|
533
|
+
function resolveClickClackGroupPolicy(params) {
|
|
462
534
|
const { account, channelId } = params;
|
|
463
535
|
const channelKey = channelId?.trim();
|
|
464
536
|
const groups = channelKey ? account.groups : void 0;
|
|
465
537
|
const wildcard = groups?.["*"];
|
|
466
538
|
const exact = channelKey ? groups?.[channelKey] : void 0;
|
|
467
539
|
return {
|
|
540
|
+
requireMention: exact?.requireMention ?? wildcard?.requireMention ?? account.requireMention === true,
|
|
541
|
+
requireMentionInBotThreads: exact?.requireMentionInBotThreads ?? wildcard?.requireMentionInBotThreads ?? account.requireMentionInBotThreads,
|
|
542
|
+
mentionPatterns: exact?.mentionPatterns ?? wildcard?.mentionPatterns ?? account.mentionPatterns ?? [],
|
|
468
543
|
allowBots: exact?.allowBots ?? wildcard?.allowBots ?? account.allowBots ?? false,
|
|
469
544
|
botLoopProtection: mergePairLoopGuardConfig(account.botLoopProtection, wildcard?.botLoopProtection, exact?.botLoopProtection)
|
|
470
545
|
};
|
|
471
546
|
}
|
|
472
|
-
/**
|
|
473
|
-
* Resolves the effective group policy for a ClickClack channel.
|
|
474
|
-
*
|
|
475
|
-
* Lookup order:
|
|
476
|
-
* 1. Exact channel ID in `groups`
|
|
477
|
-
* 2. Wildcard `'*'` entry in `groups`
|
|
478
|
-
* 3. Account-level `requireMention` / `mentionPatterns`
|
|
479
|
-
* 4. Backward-compatible default: { requireMention: false, mentionPatterns: [] }
|
|
480
|
-
*/
|
|
481
|
-
function resolveClickClackGroupPolicy(params) {
|
|
482
|
-
const { account, channelId } = params;
|
|
483
|
-
const accountPolicy = {
|
|
484
|
-
requireMention: account.requireMention === true,
|
|
485
|
-
mentionPatterns: account.mentionPatterns ?? []
|
|
486
|
-
};
|
|
487
|
-
const channelKey = channelId?.trim();
|
|
488
|
-
const groups = channelKey ? account.groups : void 0;
|
|
489
|
-
const wildcard = groups?.["*"];
|
|
490
|
-
const exact = channelKey ? groups?.[channelKey] : void 0;
|
|
491
|
-
return {
|
|
492
|
-
requireMention: exact?.requireMention ?? wildcard?.requireMention ?? accountPolicy.requireMention,
|
|
493
|
-
mentionPatterns: exact?.mentionPatterns ?? wildcard?.mentionPatterns ?? accountPolicy.mentionPatterns
|
|
494
|
-
};
|
|
495
|
-
}
|
|
496
547
|
//#endregion
|
|
497
548
|
//#region extensions/clickclack/src/mention-facts.ts
|
|
498
549
|
/**
|
|
@@ -515,7 +566,7 @@ function buildLocalMentionRegexes(params) {
|
|
|
515
566
|
}
|
|
516
567
|
}
|
|
517
568
|
};
|
|
518
|
-
return buildMentionRegexes(syntheticCfg, void 0, {
|
|
569
|
+
return (0, channel_mention_gating_exports.buildMentionRegexes)(syntheticCfg, void 0, {
|
|
519
570
|
provider: "clickclack",
|
|
520
571
|
conversationId: params.channelId
|
|
521
572
|
});
|
|
@@ -546,7 +597,7 @@ function resolveClickClackMentionFacts(params) {
|
|
|
546
597
|
wasMentioned: false,
|
|
547
598
|
hasAnyMention: false
|
|
548
599
|
};
|
|
549
|
-
const sharedMentionRegexes = buildMentionRegexes(cfg, agentId, {
|
|
600
|
+
const sharedMentionRegexes = (0, channel_mention_gating_exports.buildMentionRegexes)(cfg, agentId, {
|
|
550
601
|
provider: "clickclack",
|
|
551
602
|
conversationId: channelId
|
|
552
603
|
});
|
|
@@ -556,7 +607,7 @@ function resolveClickClackMentionFacts(params) {
|
|
|
556
607
|
channelId
|
|
557
608
|
});
|
|
558
609
|
const mentionRegexes = [...sharedMentionRegexes, ...localMentionRegexes];
|
|
559
|
-
const bodyForRegex = normalizeMentionText(body);
|
|
610
|
+
const bodyForRegex = (0, channel_mention_gating_exports.normalizeMentionText)(body);
|
|
560
611
|
const hasConfiguredMention = mentionRegexes.some((regex) => regex.test(bodyForRegex));
|
|
561
612
|
const mentionHandles = resolveMentionHandles(body);
|
|
562
613
|
const normalizedBotHandle = botHandle?.replace(/^@/u, "").trim().toLowerCase();
|
|
@@ -622,10 +673,6 @@ function looksLikeClickClackTarget(raw) {
|
|
|
622
673
|
}
|
|
623
674
|
//#endregion
|
|
624
675
|
//#region extensions/clickclack/src/access.ts
|
|
625
|
-
/**
|
|
626
|
-
* Maps ClickClack senders and conversations onto the shared channel ingress
|
|
627
|
-
* allowlist/command authorization contract.
|
|
628
|
-
*/
|
|
629
676
|
const CHANNEL_ID$2 = "clickclack";
|
|
630
677
|
function normalizeClickClackUserId(value) {
|
|
631
678
|
const trimmed = value.trim();
|
|
@@ -640,6 +687,19 @@ const clickClackIngressIdentity = {
|
|
|
640
687
|
isWildcardEntry: (entry) => normalizeClickClackUserId(entry) === "*",
|
|
641
688
|
entryIdPrefix: "clickclack-user"
|
|
642
689
|
};
|
|
690
|
+
async function isClickClackBotOwnedThread(params) {
|
|
691
|
+
const { account, message } = params;
|
|
692
|
+
if (!account.botUserId || !message.parent_message_id || !message.thread_root_id || message.thread_root_id === message.id || !message.channel_id || message.direct_conversation_id || message.workspace_id !== account.workspace) return false;
|
|
693
|
+
try {
|
|
694
|
+
const root = await createClickClackClient({
|
|
695
|
+
baseUrl: account.apiEndpoint,
|
|
696
|
+
token: account.token
|
|
697
|
+
}).message(message.thread_root_id);
|
|
698
|
+
return root.id === message.thread_root_id && root.thread_root_id === root.id && !root.parent_message_id && !root.direct_conversation_id && root.workspace_id === message.workspace_id && root.channel_id === message.channel_id && root.author_id === account.botUserId;
|
|
699
|
+
} catch {
|
|
700
|
+
return false;
|
|
701
|
+
}
|
|
702
|
+
}
|
|
643
703
|
function resolveClickClackBotLoopConversationId(params) {
|
|
644
704
|
if (params.message.parent_message_id && params.message.thread_root_id) return params.message.thread_root_id;
|
|
645
705
|
return params.isDirect ? params.message.direct_conversation_id ?? params.message.author_id : params.message.channel_id ?? params.message.thread_root_id ?? params.message.author_id;
|
|
@@ -684,7 +744,7 @@ function resolveAccountAgentRoute(params) {
|
|
|
684
744
|
lastRoutePolicy: sessionKey === mainSessionKey ? "main" : "session"
|
|
685
745
|
};
|
|
686
746
|
}
|
|
687
|
-
function resolvePreparedInboundRoute(params) {
|
|
747
|
+
async function resolvePreparedInboundRoute(params) {
|
|
688
748
|
const runtime = getClickClackRuntime();
|
|
689
749
|
const isDirect = Boolean(params.message.direct_conversation_id);
|
|
690
750
|
const target = buildClickClackTarget(isDirect ? {
|
|
@@ -702,9 +762,8 @@ function resolvePreparedInboundRoute(params) {
|
|
|
702
762
|
target,
|
|
703
763
|
isDirect
|
|
704
764
|
});
|
|
705
|
-
const discussionResolution = !isDirect && params.message.channel_id ? resolveClickClackDiscussionRoute({
|
|
765
|
+
const discussionResolution = !isDirect && params.message.channel_id ? await resolveClickClackDiscussionRoute({
|
|
706
766
|
runtime,
|
|
707
|
-
config: params.config,
|
|
708
767
|
accountId: params.account.accountId,
|
|
709
768
|
serverBaseUrl: params.account.baseUrl,
|
|
710
769
|
workspaceId: params.message.workspace_id,
|
|
@@ -730,13 +789,37 @@ function resolvePreparedInboundRoute(params) {
|
|
|
730
789
|
*/
|
|
731
790
|
async function resolveClickClackInboundAccess(params) {
|
|
732
791
|
const runtime = getClickClackRuntime();
|
|
733
|
-
const
|
|
734
|
-
const preparedRoute = resolvePreparedInboundRoute(params);
|
|
735
|
-
const shouldCheckCommand = runtime.channel.commands.shouldComputeCommandAuthorized(params.message.body, cfg);
|
|
736
|
-
const effectiveGroupPolicy = resolveClickClackGroupPolicy({
|
|
792
|
+
const rootPolicyConfigured = resolveClickClackGroupPolicy({
|
|
737
793
|
account: params.account,
|
|
738
794
|
channelId: params.message.channel_id
|
|
795
|
+
}).requireMentionInBotThreads !== void 0;
|
|
796
|
+
const isCurrent = () => isClickClackAccountCurrent({
|
|
797
|
+
cfg: runtime.config.current(),
|
|
798
|
+
account: params.account
|
|
799
|
+
});
|
|
800
|
+
const isBotOwnedThread = rootPolicyConfigured && await isClickClackBotOwnedThread(params);
|
|
801
|
+
const routeConfig = rootPolicyConfigured ? runtime.config.current() : params.config;
|
|
802
|
+
const routeAccountConfig = rootPolicyConfigured ? resolveClickClackAccountConfig(routeConfig, params.account.accountId) : params.account;
|
|
803
|
+
const preparedRoute = await resolvePreparedInboundRoute({
|
|
804
|
+
...params,
|
|
805
|
+
config: routeConfig,
|
|
806
|
+
account: {
|
|
807
|
+
...params.account,
|
|
808
|
+
agentId: routeAccountConfig.agentId
|
|
809
|
+
}
|
|
739
810
|
});
|
|
811
|
+
const cfg = rootPolicyConfigured ? runtime.config.current() : params.config;
|
|
812
|
+
const accountPolicy = rootPolicyConfigured ? resolveClickClackAccountConfig(cfg, params.account.accountId) : params.account;
|
|
813
|
+
const effectiveGroupPolicy = resolveClickClackGroupPolicy({
|
|
814
|
+
account: accountPolicy,
|
|
815
|
+
channelId: params.message.channel_id
|
|
816
|
+
});
|
|
817
|
+
const threadMentionPolicy = resolveBotThreadMentionPolicy({
|
|
818
|
+
isBotOwnedThread,
|
|
819
|
+
requireMentionInBotThreads: effectiveGroupPolicy.requireMentionInBotThreads,
|
|
820
|
+
requireMention: effectiveGroupPolicy.requireMention
|
|
821
|
+
});
|
|
822
|
+
const shouldCheckCommand = runtime.channel.commands.shouldComputeCommandAuthorized(params.message.body, cfg);
|
|
740
823
|
const mentionFacts = resolveClickClackMentionFacts({
|
|
741
824
|
isDirect: preparedRoute.isDirect,
|
|
742
825
|
body: params.message.body,
|
|
@@ -746,23 +829,22 @@ async function resolveClickClackInboundAccess(params) {
|
|
|
746
829
|
agentId: preparedRoute.route.agentId,
|
|
747
830
|
channelId: params.message.channel_id
|
|
748
831
|
});
|
|
749
|
-
if (params.message.kind !== void 0 && params.message.kind !== "message") return {
|
|
832
|
+
if (!isCurrent() || params.message.kind !== void 0 && params.message.kind !== "message") return {
|
|
750
833
|
shouldDispatch: false,
|
|
834
|
+
isCurrent,
|
|
751
835
|
commandAuthorized: false,
|
|
752
|
-
requireMention:
|
|
836
|
+
requireMention: threadMentionPolicy.requireMention,
|
|
753
837
|
mentionFacts,
|
|
754
838
|
preparedRoute
|
|
755
839
|
};
|
|
756
|
-
const effectiveBotPolicy = resolveClickClackBotPolicy({
|
|
757
|
-
account: params.account,
|
|
758
|
-
channelId: params.message.channel_id
|
|
759
|
-
});
|
|
760
840
|
const isBotAuthor = params.message.author?.kind === "bot";
|
|
761
|
-
const
|
|
762
|
-
|
|
841
|
+
const allowFrom = accountPolicy.allowFrom ?? ["*"];
|
|
842
|
+
const ingressAllowFrom = isBotAuthor ? allowFrom.filter((entry) => normalizeClickClackUserId(entry) !== "*") : allowFrom;
|
|
843
|
+
if (!(!isBotAuthor || effectiveGroupPolicy.allowBots === true || effectiveGroupPolicy.allowBots === "mentions" && (preparedRoute.isDirect || mentionFacts.wasMentioned))) return {
|
|
763
844
|
shouldDispatch: false,
|
|
845
|
+
isCurrent,
|
|
764
846
|
commandAuthorized: false,
|
|
765
|
-
requireMention:
|
|
847
|
+
requireMention: threadMentionPolicy.requireMention,
|
|
766
848
|
mentionFacts,
|
|
767
849
|
preparedRoute
|
|
768
850
|
};
|
|
@@ -777,16 +859,16 @@ async function resolveClickClackInboundAccess(params) {
|
|
|
777
859
|
receiverId: params.account.botUserId,
|
|
778
860
|
eventId: params.message.id,
|
|
779
861
|
...botLoopNowMs !== void 0 ? { nowMs: botLoopNowMs } : {},
|
|
780
|
-
config:
|
|
862
|
+
config: effectiveGroupPolicy.botLoopProtection,
|
|
781
863
|
defaultsConfig: cfg.channels?.defaults?.botLoopProtection,
|
|
782
864
|
defaultEnabled: true
|
|
783
865
|
} : void 0;
|
|
784
|
-
const allowTextCommands =
|
|
866
|
+
const allowTextCommands = accountPolicy.replyMode !== "model" && runtime.channel.commands.shouldHandleTextCommands({
|
|
785
867
|
cfg,
|
|
786
868
|
surface: CHANNEL_ID$2,
|
|
787
869
|
commandSource: "text"
|
|
788
870
|
});
|
|
789
|
-
const resolved = await
|
|
871
|
+
const resolved = await runtime.channel.inbound.ingress.resolveStable({
|
|
790
872
|
channelId: CHANNEL_ID$2,
|
|
791
873
|
accountId: params.account.accountId,
|
|
792
874
|
identity: clickClackIngressIdentity,
|
|
@@ -799,6 +881,7 @@ async function resolveClickClackInboundAccess(params) {
|
|
|
799
881
|
contextBinding: {
|
|
800
882
|
agentId: preparedRoute.route.agentId,
|
|
801
883
|
sessionKey: preparedRoute.route.sessionKey,
|
|
884
|
+
nativeChannelId: params.message.channel_id || params.message.direct_conversation_id,
|
|
802
885
|
messageId: params.message.id,
|
|
803
886
|
inboundEventKind: "user_request"
|
|
804
887
|
},
|
|
@@ -807,7 +890,7 @@ async function resolveClickClackInboundAccess(params) {
|
|
|
807
890
|
groupPolicy: "allowlist",
|
|
808
891
|
mentionFacts,
|
|
809
892
|
policy: { activation: {
|
|
810
|
-
requireMention:
|
|
893
|
+
requireMention: threadMentionPolicy.requireMention,
|
|
811
894
|
allowTextCommands
|
|
812
895
|
} },
|
|
813
896
|
command: shouldCheckCommand ? {
|
|
@@ -815,10 +898,68 @@ async function resolveClickClackInboundAccess(params) {
|
|
|
815
898
|
modeWhenAccessGroupsOff: "configured"
|
|
816
899
|
} : false
|
|
817
900
|
});
|
|
901
|
+
const isAdmissionCurrent = () => {
|
|
902
|
+
if (!isCurrent()) return false;
|
|
903
|
+
const currentCfg = runtime.config.current();
|
|
904
|
+
const currentAccountPolicy = resolveClickClackAccountConfig(currentCfg, params.account.accountId);
|
|
905
|
+
const currentGroupPolicy = resolveClickClackGroupPolicy({
|
|
906
|
+
account: currentAccountPolicy,
|
|
907
|
+
channelId: params.message.channel_id
|
|
908
|
+
});
|
|
909
|
+
const currentAllowFrom = currentAccountPolicy.allowFrom ?? ["*"];
|
|
910
|
+
const currentIngressAllowFrom = isBotAuthor ? currentAllowFrom.filter((entry) => normalizeClickClackUserId(entry) !== "*") : currentAllowFrom;
|
|
911
|
+
const directSenderAllowed = resolveAllowlistMatchByCandidates({
|
|
912
|
+
allowList: formatNormalizedAllowFromEntries({
|
|
913
|
+
allowFrom: currentIngressAllowFrom.filter((entry) => parseAccessGroupAllowFromEntry(entry) === null),
|
|
914
|
+
normalizeEntry: normalizeClickClackUserId
|
|
915
|
+
}),
|
|
916
|
+
candidates: [{
|
|
917
|
+
value: normalizeClickClackUserId(params.message.author_id) ?? void 0,
|
|
918
|
+
source: "id"
|
|
919
|
+
}]
|
|
920
|
+
}).allowed;
|
|
921
|
+
const staticGroupAllowed = currentIngressAllowFrom.some((entry) => {
|
|
922
|
+
const name = parseAccessGroupAllowFromEntry(entry);
|
|
923
|
+
if (!name) return false;
|
|
924
|
+
const group = currentCfg.accessGroups?.[name];
|
|
925
|
+
return group?.type === "message.senders" && resolved.state.allowlists[preparedRoute.isDirect ? "dm" : "group"].accessGroups.matched.includes(name) && isDeepStrictEqual(group, cfg.accessGroups?.[name]);
|
|
926
|
+
});
|
|
927
|
+
if (!directSenderAllowed && !staticGroupAllowed) return false;
|
|
928
|
+
const currentMentionFacts = resolveClickClackMentionFacts({
|
|
929
|
+
isDirect: preparedRoute.isDirect,
|
|
930
|
+
body: params.message.body,
|
|
931
|
+
mentionPatterns: currentGroupPolicy.mentionPatterns,
|
|
932
|
+
botHandle: params.account.botHandle,
|
|
933
|
+
cfg: currentCfg,
|
|
934
|
+
agentId: preparedRoute.route.agentId,
|
|
935
|
+
channelId: params.message.channel_id
|
|
936
|
+
});
|
|
937
|
+
if (isBotAuthor && currentGroupPolicy.allowBots !== true && !(currentGroupPolicy.allowBots === "mentions" && (preparedRoute.isDirect || currentMentionFacts.wasMentioned))) return false;
|
|
938
|
+
const currentThreadPolicy = resolveBotThreadMentionPolicy({
|
|
939
|
+
isBotOwnedThread,
|
|
940
|
+
requireMentionInBotThreads: currentGroupPolicy.requireMentionInBotThreads,
|
|
941
|
+
requireMention: currentGroupPolicy.requireMention
|
|
942
|
+
});
|
|
943
|
+
return !(0, channel_mention_gating_exports.resolveInboundMentionDecision)({
|
|
944
|
+
facts: currentMentionFacts,
|
|
945
|
+
policy: {
|
|
946
|
+
isGroup: !preparedRoute.isDirect,
|
|
947
|
+
requireMention: currentThreadPolicy.requireMention,
|
|
948
|
+
allowTextCommands: allowTextCommands && currentAccountPolicy.replyMode !== "model" && runtime.channel.commands.shouldHandleTextCommands({
|
|
949
|
+
cfg: currentCfg,
|
|
950
|
+
surface: CHANNEL_ID$2,
|
|
951
|
+
commandSource: "text"
|
|
952
|
+
}),
|
|
953
|
+
hasControlCommand: shouldCheckCommand && runtime.channel.commands.shouldComputeCommandAuthorized(params.message.body, currentCfg),
|
|
954
|
+
commandAuthorized: resolved.commandAccess.authorized
|
|
955
|
+
}
|
|
956
|
+
}).shouldSkip;
|
|
957
|
+
};
|
|
818
958
|
return {
|
|
819
|
-
shouldDispatch: !preparedRoute.revoked && resolved.ingress.admission === "dispatch",
|
|
959
|
+
shouldDispatch: isAdmissionCurrent() && !preparedRoute.revoked && resolved.ingress.admission === "dispatch",
|
|
960
|
+
isCurrent: isAdmissionCurrent,
|
|
820
961
|
commandAuthorized: resolved.commandAccess.requested ? resolved.commandAccess.authorized : resolved.senderAccess.allowed,
|
|
821
|
-
requireMention:
|
|
962
|
+
requireMention: threadMentionPolicy.requireMention,
|
|
822
963
|
mentionFacts,
|
|
823
964
|
botLoopProtection,
|
|
824
965
|
preparedRoute,
|
|
@@ -887,20 +1028,7 @@ async function syncClickClackCommandMenu(params) {
|
|
|
887
1028
|
* Publishes agent activity (streamed commentary + tool progress) into
|
|
888
1029
|
* ClickClack as durable `agent_commentary` / `agent_tool` message rows,
|
|
889
1030
|
* coalesced so one logical step becomes one row instead of a row per frame.
|
|
890
|
-
*
|
|
891
|
-
* Ported from the clickglass agent-bridge sidecar, adapted from gateway
|
|
892
|
-
* websocket frames to the in-process `replyOptions.onItemEvent` seam:
|
|
893
|
-
*
|
|
894
|
-
* - Commentary/reasoning arrives as cumulative text snapshots per item id.
|
|
895
|
-
* Each segment becomes one durable row: POSTed when the segment starts
|
|
896
|
-
* streaming and PATCHed (debounced) as the snapshot grows, so prose
|
|
897
|
-
* interleaves chronologically with tool rows.
|
|
898
|
-
* - Tool/step items can emit several frames (start/update/complete) for the
|
|
899
|
-
* same call, sometimes with lane-prefixed ids (`tool:X`, `command:X`).
|
|
900
|
-
* Normalize the prefix away to one key per call, POST one row on the first
|
|
901
|
-
* frame, and PATCH it when a later frame carries a strictly longer body.
|
|
902
1031
|
*/
|
|
903
|
-
/** Debounce window for PATCHing streaming commentary snapshots. */
|
|
904
1032
|
const CLICKCLACK_COMMENTARY_FLUSH_MS = 700;
|
|
905
1033
|
/** Item kinds rendered as agent_tool rows; everything else is commentary. */
|
|
906
1034
|
const TOOL_ITEM_KINDS = /* @__PURE__ */ new Set([
|
|
@@ -938,7 +1066,7 @@ function commentaryBody(payload) {
|
|
|
938
1066
|
return text;
|
|
939
1067
|
}
|
|
940
1068
|
function activityBody(payload) {
|
|
941
|
-
const line =
|
|
1069
|
+
const line = formatChannelProgressDraftLineForEntry(void 0, {
|
|
942
1070
|
event: "item",
|
|
943
1071
|
itemId: payload.itemId,
|
|
944
1072
|
toolCallId: payload.toolCallId,
|
|
@@ -951,7 +1079,7 @@ function activityBody(payload) {
|
|
|
951
1079
|
progressText: payload.progressText,
|
|
952
1080
|
meta: payload.meta,
|
|
953
1081
|
commandBearing: payload.commandBearing
|
|
954
|
-
})?.
|
|
1082
|
+
})?.trim();
|
|
955
1083
|
if (line) return line;
|
|
956
1084
|
const head = payload.name?.trim() || payload.title?.trim();
|
|
957
1085
|
const text = payload.progressText?.trim() || payload.summary?.trim();
|
|
@@ -1009,9 +1137,19 @@ function createClickClackActivityPublisher(params) {
|
|
|
1009
1137
|
};
|
|
1010
1138
|
const handleCommentary = (payload) => {
|
|
1011
1139
|
const body = commentaryBody(payload);
|
|
1012
|
-
if (!body.trim()) return;
|
|
1013
1140
|
const key = payload.itemId?.trim() || "turn";
|
|
1014
1141
|
let segment = commentaryByItem.get(key);
|
|
1142
|
+
if (!body.trim()) {
|
|
1143
|
+
if (segment) {
|
|
1144
|
+
clearTimeout(segment.timer);
|
|
1145
|
+
commentaryByItem.delete(key);
|
|
1146
|
+
const retracted = segment;
|
|
1147
|
+
enqueue(async () => {
|
|
1148
|
+
if (retracted.messageId) await params.client.updateMessageBody(retracted.messageId, "");
|
|
1149
|
+
});
|
|
1150
|
+
}
|
|
1151
|
+
return;
|
|
1152
|
+
}
|
|
1015
1153
|
if (!segment) {
|
|
1016
1154
|
segment = {
|
|
1017
1155
|
body: "",
|
|
@@ -1019,7 +1157,7 @@ function createClickClackActivityPublisher(params) {
|
|
|
1019
1157
|
};
|
|
1020
1158
|
commentaryByItem.set(key, segment);
|
|
1021
1159
|
}
|
|
1022
|
-
if (body
|
|
1160
|
+
if (body === segment.body) return;
|
|
1023
1161
|
segment.body = body;
|
|
1024
1162
|
segment.dirty = true;
|
|
1025
1163
|
if (!segment.timer) segment.timer = setTimeout(() => {
|
|
@@ -1028,20 +1166,19 @@ function createClickClackActivityPublisher(params) {
|
|
|
1028
1166
|
}, flushMs);
|
|
1029
1167
|
};
|
|
1030
1168
|
const toolRowKey = (payload) => {
|
|
1031
|
-
|
|
1032
|
-
if (toolCallId) return toolCallId;
|
|
1033
|
-
return (payload.itemId?.trim() ?? "").replace(/^(tool|command):/, "");
|
|
1169
|
+
return payload.itemId?.trim() || payload.toolCallId?.trim() || "";
|
|
1034
1170
|
};
|
|
1035
1171
|
const handleDiscreteItem = (payload) => {
|
|
1036
1172
|
const body = activityBody(payload);
|
|
1037
1173
|
if (!body) return;
|
|
1038
|
-
const kind = TOOL_ITEM_KINDS.has(payload
|
|
1174
|
+
const kind = TOOL_ITEM_KINDS.has(normalizedItemKind(payload)) ? "agent_tool" : "agent_commentary";
|
|
1039
1175
|
flushAllCommentary();
|
|
1040
|
-
const
|
|
1176
|
+
const itemKey = toolRowKey(payload);
|
|
1177
|
+
const key = `${kind}:${itemKey}`;
|
|
1041
1178
|
const existing = toolRows.get(key);
|
|
1042
|
-
if (!existing || !
|
|
1179
|
+
if (!existing || !itemKey) {
|
|
1043
1180
|
const row = { body };
|
|
1044
|
-
if (
|
|
1181
|
+
if (itemKey) toolRows.set(key, row);
|
|
1045
1182
|
enqueue(async () => {
|
|
1046
1183
|
const posted = await postRow(kind, row.body);
|
|
1047
1184
|
row.messageId = posted.id;
|
|
@@ -1049,7 +1186,7 @@ function createClickClackActivityPublisher(params) {
|
|
|
1049
1186
|
});
|
|
1050
1187
|
return;
|
|
1051
1188
|
}
|
|
1052
|
-
if (body
|
|
1189
|
+
if (body === existing.body) return;
|
|
1053
1190
|
existing.body = body;
|
|
1054
1191
|
enqueue(async () => {
|
|
1055
1192
|
if (existing.messageId && existing.body !== existing.sentBody) {
|
|
@@ -1060,6 +1197,18 @@ function createClickClackActivityPublisher(params) {
|
|
|
1060
1197
|
};
|
|
1061
1198
|
return {
|
|
1062
1199
|
onItemEvent: (payload) => {
|
|
1200
|
+
if (payload.hideFromChannelProgress || payload.suppressChannelProgress || payload.suppressDurableProgress) {
|
|
1201
|
+
const key = toolRowKey(payload);
|
|
1202
|
+
const row = key ? toolRows.get(`agent_tool:${key}`) : void 0;
|
|
1203
|
+
if (row) {
|
|
1204
|
+
toolRows.delete(`agent_tool:${key}`);
|
|
1205
|
+
enqueue(async () => {
|
|
1206
|
+
if (row.messageId) await params.client.updateMessageBody(row.messageId, "");
|
|
1207
|
+
});
|
|
1208
|
+
}
|
|
1209
|
+
return false;
|
|
1210
|
+
}
|
|
1211
|
+
if (payload.kind === "preamble" && !isCompleteAgentPreamble(payload)) return false;
|
|
1063
1212
|
const kind = normalizedItemKind(payload);
|
|
1064
1213
|
if (STREAMING_COMMENTARY_ITEM_KINDS.has(kind)) {
|
|
1065
1214
|
handleCommentary(payload);
|
|
@@ -1410,6 +1559,7 @@ function normalizedKind(payload) {
|
|
|
1410
1559
|
return kind;
|
|
1411
1560
|
}
|
|
1412
1561
|
function progressText(payload) {
|
|
1562
|
+
if (payload.kind !== "preamble" && payload.title) return payload.title;
|
|
1413
1563
|
const line = buildChannelProgressDraftLine({
|
|
1414
1564
|
event: "item",
|
|
1415
1565
|
itemId: payload.itemId,
|
|
@@ -1433,21 +1583,11 @@ function isFinal(payload) {
|
|
|
1433
1583
|
return phase === "end" || status === "completed" || status === "failed" || status === "blocked";
|
|
1434
1584
|
}
|
|
1435
1585
|
function createLineIdResolver() {
|
|
1436
|
-
const lineIdsByIdentity = /* @__PURE__ */ new Map();
|
|
1437
1586
|
const anonymousLinesByKind = /* @__PURE__ */ new Map();
|
|
1438
1587
|
let anonymousSequence = 0;
|
|
1439
1588
|
return (payload) => {
|
|
1440
|
-
const
|
|
1441
|
-
|
|
1442
|
-
if (existingId) {
|
|
1443
|
-
for (const identity of identities) lineIdsByIdentity.set(identity, existingId);
|
|
1444
|
-
return existingId;
|
|
1445
|
-
}
|
|
1446
|
-
if (identities.length > 0) {
|
|
1447
|
-
const id = `item:${identities[0]}`;
|
|
1448
|
-
for (const identity of identities) lineIdsByIdentity.set(identity, id);
|
|
1449
|
-
return id;
|
|
1450
|
-
}
|
|
1589
|
+
const identity = payload.itemId?.trim() || payload.toolCallId?.trim();
|
|
1590
|
+
if (identity) return `item:${identity}`;
|
|
1451
1591
|
const kind = normalizedKind(payload);
|
|
1452
1592
|
const anonymousLines = anonymousLinesByKind.get(kind) ?? [];
|
|
1453
1593
|
const line = (payload.phase?.trim().toLowerCase() === "start" ? void 0 : anonymousLines.toReversed().find((line) => line.active)) ?? (() => {
|
|
@@ -1574,7 +1714,19 @@ function createClickClackAgentProgressPublisher(params) {
|
|
|
1574
1714
|
},
|
|
1575
1715
|
onItemEvent(payload) {
|
|
1576
1716
|
if (!started || cleared) return false;
|
|
1717
|
+
if (payload.suppressChannelProgress || payload.kind === "preamble" && !isCompleteAgentPreamble(payload)) return false;
|
|
1577
1718
|
const id = resolveLineId(payload);
|
|
1719
|
+
if (payload.hideFromChannelProgress) {
|
|
1720
|
+
if (seenLines.delete(id)) enqueueLine(id, {
|
|
1721
|
+
op: "update",
|
|
1722
|
+
line: {
|
|
1723
|
+
id,
|
|
1724
|
+
kind: normalizedKind(payload),
|
|
1725
|
+
text: ""
|
|
1726
|
+
}
|
|
1727
|
+
});
|
|
1728
|
+
return false;
|
|
1729
|
+
}
|
|
1578
1730
|
const final = isFinal(payload);
|
|
1579
1731
|
const kind = normalizedKind(payload);
|
|
1580
1732
|
const retractsExistingCommentary = kind === "commentary" && seenLines.has(id) && payload.progressText !== void 0 && payload.progressText.trim() === "";
|
|
@@ -1587,7 +1739,7 @@ function createClickClackAgentProgressPublisher(params) {
|
|
|
1587
1739
|
id,
|
|
1588
1740
|
kind,
|
|
1589
1741
|
text: retractsExistingCommentary ? "" : progressText(payload),
|
|
1590
|
-
status: payload.status?.trim() || (final ? "
|
|
1742
|
+
status: payload.status?.trim() || (final ? "blocked" : "running")
|
|
1591
1743
|
};
|
|
1592
1744
|
if (payload.name?.trim()) line.tool_name = payload.name.trim();
|
|
1593
1745
|
enqueueLine(id, {
|
|
@@ -1615,7 +1767,7 @@ function createClickClackAgentProgressPublisher(params) {
|
|
|
1615
1767
|
const CHANNEL_ID$1 = "clickclack";
|
|
1616
1768
|
const CLICKCLACK_MESSAGE_ID_PATTERN = /^msg_[0-9a-hjkmnp-tv-z]{26}$/u;
|
|
1617
1769
|
function hasClickClackReplyMedia(payload) {
|
|
1618
|
-
return Boolean(payload.mediaUrl?.trim() || payload.mediaUrls?.some((mediaUrl) =>
|
|
1770
|
+
return Boolean(payload.mediaUrl?.trim() || payload.mediaUrls?.some((mediaUrl) => mediaUrl.trim()));
|
|
1619
1771
|
}
|
|
1620
1772
|
function resolveClickClackAgentRunId(messageId) {
|
|
1621
1773
|
return CLICKCLACK_MESSAGE_ID_PATTERN.test(messageId) ? `${CHANNEL_ID$1}:${messageId}` : void 0;
|
|
@@ -1663,10 +1815,6 @@ async function dispatchModelReply(params) {
|
|
|
1663
1815
|
correlationId: params.correlationId
|
|
1664
1816
|
});
|
|
1665
1817
|
}
|
|
1666
|
-
/**
|
|
1667
|
-
* Dispatches one already-fetched ClickClack message through the configured
|
|
1668
|
-
* reply mode for its account.
|
|
1669
|
-
*/
|
|
1670
1818
|
async function handleClickClackInbound(params) {
|
|
1671
1819
|
const runtime = getClickClackRuntime();
|
|
1672
1820
|
const message = params.message;
|
|
@@ -1675,7 +1823,7 @@ async function handleClickClackInbound(params) {
|
|
|
1675
1823
|
config: params.config,
|
|
1676
1824
|
message
|
|
1677
1825
|
});
|
|
1678
|
-
if (!access.shouldDispatch || !access.channelIngress) return;
|
|
1826
|
+
if (!access.shouldDispatch || !access.channelIngress || !access.isCurrent()) return;
|
|
1679
1827
|
const conversationId = message.channel_id || message.direct_conversation_id;
|
|
1680
1828
|
if (!conversationId) return;
|
|
1681
1829
|
const { discussionRoute, isDirect, route, target } = access.preparedRoute;
|
|
@@ -1729,7 +1877,7 @@ async function handleClickClackInbound(params) {
|
|
|
1729
1877
|
}
|
|
1730
1878
|
let turnProvenance;
|
|
1731
1879
|
let activity;
|
|
1732
|
-
if (params.account.agentActivity
|
|
1880
|
+
if (params.account.agentActivity) activity = createClickClackActivityPublisher({
|
|
1733
1881
|
client: createClickClackClient({
|
|
1734
1882
|
baseUrl: params.account.apiEndpoint,
|
|
1735
1883
|
token: params.account.token,
|
|
@@ -1841,7 +1989,7 @@ async function handleClickClackInbound(params) {
|
|
|
1841
1989
|
delivery: {
|
|
1842
1990
|
deliver: async (payload) => {
|
|
1843
1991
|
if (hasClickClackReplyMedia(payload)) throw new Error("ClickClack media reply requires durable delivery");
|
|
1844
|
-
const text = payload
|
|
1992
|
+
const text = payload.text ?? "";
|
|
1845
1993
|
if (!text.trim()) return;
|
|
1846
1994
|
await sendClickClackText({
|
|
1847
1995
|
cfg: params.config,
|
|
@@ -2112,10 +2260,6 @@ async function startClickClackGatewayAccount(ctx) {
|
|
|
2112
2260
|
}
|
|
2113
2261
|
//#endregion
|
|
2114
2262
|
//#region extensions/clickclack/src/channel.ts
|
|
2115
|
-
/**
|
|
2116
|
-
* ClickClack channel plugin definition: target parsing, account config, status,
|
|
2117
|
-
* gateway startup, and outbound delivery wiring.
|
|
2118
|
-
*/
|
|
2119
2263
|
const CHANNEL_ID = CLICKCLACK_CHANNEL_ID;
|
|
2120
2264
|
const clickClackMessageAdapter = defineChannelMessageAdapter({
|
|
2121
2265
|
id: CHANNEL_ID,
|
|
@@ -2137,16 +2281,8 @@ const clickClackMessageAdapter = defineChannelMessageAdapter({
|
|
|
2137
2281
|
send: {
|
|
2138
2282
|
text: async (ctx) => {
|
|
2139
2283
|
const messageId = await sendClickClackText({
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
to: ctx.to,
|
|
2143
|
-
text: ctx.text,
|
|
2144
|
-
threadId: ctx.threadId,
|
|
2145
|
-
replyToId: ctx.replyToId,
|
|
2146
|
-
deliveryQueueId: ctx.deliveryQueueId,
|
|
2147
|
-
deliveryPartIndex: ctx.deliveryPartIndex,
|
|
2148
|
-
onPlatformSendDispatch: ctx.onPlatformSendDispatch,
|
|
2149
|
-
assertDirectAdapterHandoff: ctx.assertDirectAdapterHandoff
|
|
2284
|
+
...ctx,
|
|
2285
|
+
cfg: ctx.cfg
|
|
2150
2286
|
});
|
|
2151
2287
|
const threadId = ctx.threadId == null ? void 0 : String(ctx.threadId);
|
|
2152
2288
|
const replyToId = ctx.replyToId ?? void 0;
|
|
@@ -2165,21 +2301,8 @@ const clickClackMessageAdapter = defineChannelMessageAdapter({
|
|
|
2165
2301
|
},
|
|
2166
2302
|
media: async (ctx) => {
|
|
2167
2303
|
const messageId = await sendClickClackMedia({
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
to: ctx.to,
|
|
2171
|
-
text: ctx.text,
|
|
2172
|
-
mediaUrl: ctx.mediaUrl,
|
|
2173
|
-
mediaAccess: ctx.mediaAccess,
|
|
2174
|
-
mediaLocalRoots: ctx.mediaLocalRoots,
|
|
2175
|
-
mediaReadFile: ctx.mediaReadFile,
|
|
2176
|
-
threadId: ctx.threadId,
|
|
2177
|
-
replyToId: ctx.replyToId,
|
|
2178
|
-
deliveryQueueId: ctx.deliveryQueueId,
|
|
2179
|
-
deliveryPartIndex: ctx.deliveryPartIndex,
|
|
2180
|
-
onPlatformSendDispatch: ctx.onPlatformSendDispatch,
|
|
2181
|
-
assertDirectAdapterHandoff: ctx.assertDirectAdapterHandoff,
|
|
2182
|
-
onDeliveryResult: ctx.onDeliveryResult
|
|
2304
|
+
...ctx,
|
|
2305
|
+
cfg: ctx.cfg
|
|
2183
2306
|
});
|
|
2184
2307
|
const threadId = ctx.threadId == null ? void 0 : String(ctx.threadId);
|
|
2185
2308
|
const replyToId = ctx.replyToId ?? void 0;
|
|
@@ -2198,9 +2321,6 @@ const clickClackMessageAdapter = defineChannelMessageAdapter({
|
|
|
2198
2321
|
}
|
|
2199
2322
|
}
|
|
2200
2323
|
});
|
|
2201
|
-
/**
|
|
2202
|
-
* Channel plugin instance registered by the bundled ClickClack entry.
|
|
2203
|
-
*/
|
|
2204
2324
|
const clickClackPlugin = createChatChannelPlugin({
|
|
2205
2325
|
base: {
|
|
2206
2326
|
id: CHANNEL_ID,
|
|
@@ -2290,37 +2410,19 @@ const clickClackPlugin = createChatChannelPlugin({
|
|
|
2290
2410
|
base: { deliveryMode: "direct" },
|
|
2291
2411
|
attachedResults: {
|
|
2292
2412
|
channel: CHANNEL_ID,
|
|
2293
|
-
sendText: async (
|
|
2413
|
+
sendText: async (ctx) => {
|
|
2294
2414
|
return { messageId: await sendClickClackText({
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
to,
|
|
2298
|
-
text,
|
|
2299
|
-
threadId,
|
|
2300
|
-
replyToId,
|
|
2301
|
-
deliveryQueueId,
|
|
2302
|
-
deliveryPartIndex,
|
|
2303
|
-
onPlatformSendDispatch,
|
|
2304
|
-
assertDirectAdapterHandoff
|
|
2415
|
+
...ctx,
|
|
2416
|
+
cfg: ctx.cfg
|
|
2305
2417
|
}) ?? "" };
|
|
2306
2418
|
},
|
|
2307
|
-
sendMedia: async (
|
|
2419
|
+
sendMedia: async (ctx) => {
|
|
2420
|
+
const { mediaUrl, onDeliveryResult } = ctx;
|
|
2308
2421
|
if (!mediaUrl) throw new Error("ClickClack media send requires mediaUrl");
|
|
2309
2422
|
return { messageId: await sendClickClackMedia({
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
to,
|
|
2313
|
-
text,
|
|
2423
|
+
...ctx,
|
|
2424
|
+
cfg: ctx.cfg,
|
|
2314
2425
|
mediaUrl,
|
|
2315
|
-
mediaAccess,
|
|
2316
|
-
mediaLocalRoots,
|
|
2317
|
-
mediaReadFile,
|
|
2318
|
-
threadId,
|
|
2319
|
-
replyToId,
|
|
2320
|
-
deliveryQueueId,
|
|
2321
|
-
deliveryPartIndex,
|
|
2322
|
-
onPlatformSendDispatch,
|
|
2323
|
-
assertDirectAdapterHandoff,
|
|
2324
2426
|
onDeliveryResult: onDeliveryResult ? ({ messageId: acceptedMessageId, receipt }) => onDeliveryResult({
|
|
2325
2427
|
channel: CHANNEL_ID,
|
|
2326
2428
|
messageId: acceptedMessageId,
|