@openclaw/googlechat 2026.7.2-beta.5 → 2026.7.33
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/README.md +1 -1
- package/dist/.setup/actions-DeT_GgtP.mjs +167 -0
- package/dist/.setup/approval-auth-CQP5ZS_f.mjs +27 -0
- package/dist/{approval-handler.runtime-BJXVLK9y.js → .setup/approval-handler.runtime-DWNRBf9B.mjs} +5 -6
- package/dist/{channel-CehfTiWZ.js → .setup/channel-BPjomke4.mjs} +80 -58
- package/dist/{channel-base-CC85hRUC.js → .setup/channel-base-DJICAvKH.mjs} +80 -148
- package/dist/{channel.adapters-DLatFGZz.js → .setup/channel.adapters-T6wPzrpo.mjs} +164 -379
- package/dist/{channel.runtime-Bz0__ttC.js → .setup/channel.runtime-CpT-qT67.mjs} +241 -458
- package/dist/.setup/doctor-contract-BcEqUZ4j.mjs +151 -0
- package/dist/{runtime-api-Dh0CNVS4.js → .setup/runtime-api-BbVoWRxq.mjs} +7 -3
- package/dist/.setup/secret-contract-api-BGDBptmu.mjs +3 -0
- package/dist/.setup/secret-contract-lCMHqumt.mjs +99 -0
- package/dist/.setup/setup-plugin-api-BgwvQMls.mjs +5 -0
- package/dist/.setup/setup-plugin-api-Ce08GSFO.mjs +2 -0
- package/dist/api.js +2 -2
- package/dist/channel-config-api.js +2 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/directory-contract-api.js +1 -1
- package/dist/doctor-contract-api.js +1 -1
- package/dist/runtime-api.js +2 -3
- package/dist/secret-contract-api.js +1 -1
- package/dist/setup-entry.js +3 -2
- package/dist/setup-plugin-api.js +1 -4
- package/node_modules/gaxios/build/cjs/src/gaxios.js +1 -1
- package/node_modules/gaxios/build/cjs/src/gaxios.js.map +1 -1
- package/node_modules/gaxios/build/cjs/test/test.getch.js +0 -66
- package/node_modules/gaxios/build/cjs/test/test.getch.js.map +1 -1
- package/node_modules/gaxios/build/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/node_modules/gaxios/build/esm/src/gaxios.js +1 -1
- package/node_modules/gaxios/build/esm/src/gaxios.js.map +1 -1
- package/node_modules/gaxios/build/esm/test/test.getch.js +0 -66
- package/node_modules/gaxios/build/esm/test/test.getch.js.map +1 -1
- package/node_modules/gaxios/build/esm/tsconfig.tsbuildinfo +1 -1
- package/node_modules/gaxios/package.json +4 -4
- package/openclaw.plugin.json +488 -416
- package/package.json +24 -81
- package/dist/actions-wnreW-IQ.js +0 -76
- package/dist/approval-auth-G-OFufNc.js +0 -30
- package/dist/config-api-CsD0IFxF.js +0 -3
- package/dist/doctor-contract-BpuSvJro.js +0 -115
- package/dist/secret-contract-BFYyuE0F.js +0 -88
- /package/node_modules/{agent-base → gaxios/node_modules/agent-base}/LICENSE +0 -0
- /package/node_modules/{agent-base → gaxios/node_modules/agent-base}/README.md +0 -0
- /package/node_modules/{agent-base → gaxios/node_modules/agent-base}/dist/helpers.d.ts +0 -0
- /package/node_modules/{agent-base → gaxios/node_modules/agent-base}/dist/helpers.d.ts.map +0 -0
- /package/node_modules/{agent-base → gaxios/node_modules/agent-base}/dist/helpers.js +0 -0
- /package/node_modules/{agent-base → gaxios/node_modules/agent-base}/dist/helpers.js.map +0 -0
- /package/node_modules/{agent-base → gaxios/node_modules/agent-base}/dist/index.d.ts +0 -0
- /package/node_modules/{agent-base → gaxios/node_modules/agent-base}/dist/index.d.ts.map +0 -0
- /package/node_modules/{agent-base → gaxios/node_modules/agent-base}/dist/index.js +0 -0
- /package/node_modules/{agent-base → gaxios/node_modules/agent-base}/dist/index.js.map +0 -0
- /package/node_modules/{agent-base → gaxios/node_modules/agent-base}/package.json +0 -0
- /package/node_modules/{data-uri-to-buffer → gaxios/node_modules/data-uri-to-buffer}/README.md +0 -0
- /package/node_modules/{data-uri-to-buffer → gaxios/node_modules/data-uri-to-buffer}/dist/index.d.ts +0 -0
- /package/node_modules/{data-uri-to-buffer → gaxios/node_modules/data-uri-to-buffer}/dist/index.js +0 -0
- /package/node_modules/{data-uri-to-buffer → gaxios/node_modules/data-uri-to-buffer}/dist/index.js.map +0 -0
- /package/node_modules/{data-uri-to-buffer → gaxios/node_modules/data-uri-to-buffer}/package.json +0 -0
- /package/node_modules/{data-uri-to-buffer → gaxios/node_modules/data-uri-to-buffer}/src/index.ts +0 -0
- /package/node_modules/{debug → gaxios/node_modules/debug}/LICENSE +0 -0
- /package/node_modules/{debug → gaxios/node_modules/debug}/README.md +0 -0
- /package/node_modules/{debug → gaxios/node_modules/debug}/package.json +0 -0
- /package/node_modules/{debug → gaxios/node_modules/debug}/src/browser.js +0 -0
- /package/node_modules/{debug → gaxios/node_modules/debug}/src/common.js +0 -0
- /package/node_modules/{debug → gaxios/node_modules/debug}/src/index.js +0 -0
- /package/node_modules/{debug → gaxios/node_modules/debug}/src/node.js +0 -0
- /package/node_modules/{extend → gaxios/node_modules/extend}/.editorconfig +0 -0
- /package/node_modules/{extend → gaxios/node_modules/extend}/.eslintrc +0 -0
- /package/node_modules/{extend → gaxios/node_modules/extend}/.jscs.json +0 -0
- /package/node_modules/{extend → gaxios/node_modules/extend}/.travis.yml +0 -0
- /package/node_modules/{extend → gaxios/node_modules/extend}/CHANGELOG.md +0 -0
- /package/node_modules/{extend → gaxios/node_modules/extend}/LICENSE +0 -0
- /package/node_modules/{extend → gaxios/node_modules/extend}/README.md +0 -0
- /package/node_modules/{extend → gaxios/node_modules/extend}/component.json +0 -0
- /package/node_modules/{extend → gaxios/node_modules/extend}/index.js +0 -0
- /package/node_modules/{extend → gaxios/node_modules/extend}/package.json +0 -0
- /package/node_modules/{fetch-blob → gaxios/node_modules/fetch-blob}/LICENSE +0 -0
- /package/node_modules/{fetch-blob → gaxios/node_modules/fetch-blob}/README.md +0 -0
- /package/node_modules/{fetch-blob → gaxios/node_modules/fetch-blob}/file.d.ts +0 -0
- /package/node_modules/{fetch-blob → gaxios/node_modules/fetch-blob}/file.js +0 -0
- /package/node_modules/{fetch-blob → gaxios/node_modules/fetch-blob}/from.d.ts +0 -0
- /package/node_modules/{fetch-blob → gaxios/node_modules/fetch-blob}/from.js +0 -0
- /package/node_modules/{fetch-blob → gaxios/node_modules/fetch-blob}/index.d.ts +0 -0
- /package/node_modules/{fetch-blob → gaxios/node_modules/fetch-blob}/index.js +0 -0
- /package/node_modules/{fetch-blob → gaxios/node_modules/fetch-blob}/package.json +0 -0
- /package/node_modules/{fetch-blob → gaxios/node_modules/fetch-blob}/streams.cjs +0 -0
- /package/node_modules/{formdata-polyfill → gaxios/node_modules/formdata-polyfill}/FormData.js +0 -0
- /package/node_modules/{formdata-polyfill → gaxios/node_modules/formdata-polyfill}/LICENSE +0 -0
- /package/node_modules/{formdata-polyfill → gaxios/node_modules/formdata-polyfill}/README.md +0 -0
- /package/node_modules/{formdata-polyfill → gaxios/node_modules/formdata-polyfill}/esm.min.d.ts +0 -0
- /package/node_modules/{formdata-polyfill → gaxios/node_modules/formdata-polyfill}/esm.min.js +0 -0
- /package/node_modules/{formdata-polyfill → gaxios/node_modules/formdata-polyfill}/formdata-to-blob.js +0 -0
- /package/node_modules/{formdata-polyfill → gaxios/node_modules/formdata-polyfill}/formdata.min.js +0 -0
- /package/node_modules/{formdata-polyfill → gaxios/node_modules/formdata-polyfill}/package.json +0 -0
- /package/node_modules/{https-proxy-agent → gaxios/node_modules/https-proxy-agent}/LICENSE +0 -0
- /package/node_modules/{https-proxy-agent → gaxios/node_modules/https-proxy-agent}/README.md +0 -0
- /package/node_modules/{https-proxy-agent → gaxios/node_modules/https-proxy-agent}/dist/index.d.ts +0 -0
- /package/node_modules/{https-proxy-agent → gaxios/node_modules/https-proxy-agent}/dist/index.d.ts.map +0 -0
- /package/node_modules/{https-proxy-agent → gaxios/node_modules/https-proxy-agent}/dist/index.js +0 -0
- /package/node_modules/{https-proxy-agent → gaxios/node_modules/https-proxy-agent}/dist/index.js.map +0 -0
- /package/node_modules/{https-proxy-agent → gaxios/node_modules/https-proxy-agent}/dist/parse-proxy-response.d.ts +0 -0
- /package/node_modules/{https-proxy-agent → gaxios/node_modules/https-proxy-agent}/dist/parse-proxy-response.d.ts.map +0 -0
- /package/node_modules/{https-proxy-agent → gaxios/node_modules/https-proxy-agent}/dist/parse-proxy-response.js +0 -0
- /package/node_modules/{https-proxy-agent → gaxios/node_modules/https-proxy-agent}/dist/parse-proxy-response.js.map +0 -0
- /package/node_modules/{https-proxy-agent → gaxios/node_modules/https-proxy-agent}/package.json +0 -0
- /package/node_modules/{ms → gaxios/node_modules/ms}/index.js +0 -0
- /package/node_modules/{ms → gaxios/node_modules/ms}/license.md +0 -0
- /package/node_modules/{ms → gaxios/node_modules/ms}/package.json +0 -0
- /package/node_modules/{ms → gaxios/node_modules/ms}/readme.md +0 -0
- /package/node_modules/{node-domexception → gaxios/node_modules/node-domexception}/LICENSE +0 -0
- /package/node_modules/{node-domexception → gaxios/node_modules/node-domexception}/index.js +0 -0
- /package/node_modules/{node-domexception → gaxios/node_modules/node-domexception}/package.json +0 -0
- /package/node_modules/{node-fetch → gaxios/node_modules/node-fetch}/@types/index.d.ts +0 -0
- /package/node_modules/{node-fetch → gaxios/node_modules/node-fetch}/LICENSE.md +0 -0
- /package/node_modules/{node-fetch → gaxios/node_modules/node-fetch}/README.md +0 -0
- /package/node_modules/{node-fetch → gaxios/node_modules/node-fetch}/package.json +0 -0
- /package/node_modules/{node-fetch → gaxios/node_modules/node-fetch}/src/body.js +0 -0
- /package/node_modules/{node-fetch → gaxios/node_modules/node-fetch}/src/errors/abort-error.js +0 -0
- /package/node_modules/{node-fetch → gaxios/node_modules/node-fetch}/src/errors/base.js +0 -0
- /package/node_modules/{node-fetch → gaxios/node_modules/node-fetch}/src/errors/fetch-error.js +0 -0
- /package/node_modules/{node-fetch → gaxios/node_modules/node-fetch}/src/headers.js +0 -0
- /package/node_modules/{node-fetch → gaxios/node_modules/node-fetch}/src/index.js +0 -0
- /package/node_modules/{node-fetch → gaxios/node_modules/node-fetch}/src/request.js +0 -0
- /package/node_modules/{node-fetch → gaxios/node_modules/node-fetch}/src/response.js +0 -0
- /package/node_modules/{node-fetch → gaxios/node_modules/node-fetch}/src/utils/get-search.js +0 -0
- /package/node_modules/{node-fetch → gaxios/node_modules/node-fetch}/src/utils/is-redirect.js +0 -0
- /package/node_modules/{node-fetch → gaxios/node_modules/node-fetch}/src/utils/is.js +0 -0
- /package/node_modules/{node-fetch → gaxios/node_modules/node-fetch}/src/utils/multipart-parser.js +0 -0
- /package/node_modules/{node-fetch → gaxios/node_modules/node-fetch}/src/utils/referrer.js +0 -0
- /package/node_modules/{web-streams-polyfill → gaxios/node_modules/web-streams-polyfill}/LICENSE +0 -0
- /package/node_modules/{web-streams-polyfill → gaxios/node_modules/web-streams-polyfill}/README.md +0 -0
- /package/node_modules/{web-streams-polyfill → gaxios/node_modules/web-streams-polyfill}/dist/polyfill.es2018.js +0 -0
- /package/node_modules/{web-streams-polyfill → gaxios/node_modules/web-streams-polyfill}/dist/polyfill.es2018.js.map +0 -0
- /package/node_modules/{web-streams-polyfill → gaxios/node_modules/web-streams-polyfill}/dist/polyfill.es2018.min.js +0 -0
- /package/node_modules/{web-streams-polyfill → gaxios/node_modules/web-streams-polyfill}/dist/polyfill.es2018.min.js.map +0 -0
- /package/node_modules/{web-streams-polyfill → gaxios/node_modules/web-streams-polyfill}/dist/polyfill.es2018.mjs +0 -0
- /package/node_modules/{web-streams-polyfill → gaxios/node_modules/web-streams-polyfill}/dist/polyfill.es2018.mjs.map +0 -0
- /package/node_modules/{web-streams-polyfill → gaxios/node_modules/web-streams-polyfill}/dist/polyfill.es6.js +0 -0
- /package/node_modules/{web-streams-polyfill → gaxios/node_modules/web-streams-polyfill}/dist/polyfill.es6.js.map +0 -0
- /package/node_modules/{web-streams-polyfill → gaxios/node_modules/web-streams-polyfill}/dist/polyfill.es6.min.js +0 -0
- /package/node_modules/{web-streams-polyfill → gaxios/node_modules/web-streams-polyfill}/dist/polyfill.es6.min.js.map +0 -0
- /package/node_modules/{web-streams-polyfill → gaxios/node_modules/web-streams-polyfill}/dist/polyfill.es6.mjs +0 -0
- /package/node_modules/{web-streams-polyfill → gaxios/node_modules/web-streams-polyfill}/dist/polyfill.es6.mjs.map +0 -0
- /package/node_modules/{web-streams-polyfill → gaxios/node_modules/web-streams-polyfill}/dist/polyfill.js +0 -0
- /package/node_modules/{web-streams-polyfill → gaxios/node_modules/web-streams-polyfill}/dist/polyfill.js.map +0 -0
- /package/node_modules/{web-streams-polyfill → gaxios/node_modules/web-streams-polyfill}/dist/polyfill.min.js +0 -0
- /package/node_modules/{web-streams-polyfill → gaxios/node_modules/web-streams-polyfill}/dist/polyfill.min.js.map +0 -0
- /package/node_modules/{web-streams-polyfill → gaxios/node_modules/web-streams-polyfill}/dist/polyfill.mjs +0 -0
- /package/node_modules/{web-streams-polyfill → gaxios/node_modules/web-streams-polyfill}/dist/polyfill.mjs.map +0 -0
- /package/node_modules/{web-streams-polyfill → gaxios/node_modules/web-streams-polyfill}/dist/ponyfill.es2018.js +0 -0
- /package/node_modules/{web-streams-polyfill → gaxios/node_modules/web-streams-polyfill}/dist/ponyfill.es2018.js.map +0 -0
- /package/node_modules/{web-streams-polyfill → gaxios/node_modules/web-streams-polyfill}/dist/ponyfill.es2018.mjs +0 -0
- /package/node_modules/{web-streams-polyfill → gaxios/node_modules/web-streams-polyfill}/dist/ponyfill.es2018.mjs.map +0 -0
- /package/node_modules/{web-streams-polyfill → gaxios/node_modules/web-streams-polyfill}/dist/ponyfill.es6.js +0 -0
- /package/node_modules/{web-streams-polyfill → gaxios/node_modules/web-streams-polyfill}/dist/ponyfill.es6.js.map +0 -0
- /package/node_modules/{web-streams-polyfill → gaxios/node_modules/web-streams-polyfill}/dist/ponyfill.es6.mjs +0 -0
- /package/node_modules/{web-streams-polyfill → gaxios/node_modules/web-streams-polyfill}/dist/ponyfill.es6.mjs.map +0 -0
- /package/node_modules/{web-streams-polyfill → gaxios/node_modules/web-streams-polyfill}/dist/ponyfill.js +0 -0
- /package/node_modules/{web-streams-polyfill → gaxios/node_modules/web-streams-polyfill}/dist/ponyfill.js.map +0 -0
- /package/node_modules/{web-streams-polyfill → gaxios/node_modules/web-streams-polyfill}/dist/ponyfill.mjs +0 -0
- /package/node_modules/{web-streams-polyfill → gaxios/node_modules/web-streams-polyfill}/dist/ponyfill.mjs.map +0 -0
- /package/node_modules/{web-streams-polyfill → gaxios/node_modules/web-streams-polyfill}/dist/types/polyfill.d.ts +0 -0
- /package/node_modules/{web-streams-polyfill → gaxios/node_modules/web-streams-polyfill}/dist/types/ponyfill.d.ts +0 -0
- /package/node_modules/{web-streams-polyfill → gaxios/node_modules/web-streams-polyfill}/dist/types/ts3.6/polyfill.d.ts +0 -0
- /package/node_modules/{web-streams-polyfill → gaxios/node_modules/web-streams-polyfill}/dist/types/ts3.6/ponyfill.d.ts +0 -0
- /package/node_modules/{web-streams-polyfill → gaxios/node_modules/web-streams-polyfill}/dist/types/tsdoc-metadata.json +0 -0
- /package/node_modules/{web-streams-polyfill → gaxios/node_modules/web-streams-polyfill}/es2018/package.json +0 -0
- /package/node_modules/{web-streams-polyfill → gaxios/node_modules/web-streams-polyfill}/es6/package.json +0 -0
- /package/node_modules/{web-streams-polyfill → gaxios/node_modules/web-streams-polyfill}/package.json +0 -0
- /package/node_modules/{web-streams-polyfill → gaxios/node_modules/web-streams-polyfill}/ponyfill/es2018/package.json +0 -0
- /package/node_modules/{web-streams-polyfill → gaxios/node_modules/web-streams-polyfill}/ponyfill/es6/package.json +0 -0
- /package/node_modules/{web-streams-polyfill → gaxios/node_modules/web-streams-polyfill}/ponyfill/package.json +0 -0
- /package/node_modules/{base64-js → google-auth-library/node_modules/base64-js}/LICENSE +0 -0
- /package/node_modules/{base64-js → google-auth-library/node_modules/base64-js}/README.md +0 -0
- /package/node_modules/{base64-js → google-auth-library/node_modules/base64-js}/base64js.min.js +0 -0
- /package/node_modules/{base64-js → google-auth-library/node_modules/base64-js}/index.d.ts +0 -0
- /package/node_modules/{base64-js → google-auth-library/node_modules/base64-js}/index.js +0 -0
- /package/node_modules/{base64-js → google-auth-library/node_modules/base64-js}/package.json +0 -0
- /package/node_modules/{bignumber.js → google-auth-library/node_modules/bignumber.js}/CHANGELOG.md +0 -0
- /package/node_modules/{bignumber.js → google-auth-library/node_modules/bignumber.js}/LICENCE.md +0 -0
- /package/node_modules/{bignumber.js → google-auth-library/node_modules/bignumber.js}/README.md +0 -0
- /package/node_modules/{bignumber.js → google-auth-library/node_modules/bignumber.js}/bignumber.d.mts +0 -0
- /package/node_modules/{bignumber.js → google-auth-library/node_modules/bignumber.js}/bignumber.d.ts +0 -0
- /package/node_modules/{bignumber.js → google-auth-library/node_modules/bignumber.js}/bignumber.js +0 -0
- /package/node_modules/{bignumber.js → google-auth-library/node_modules/bignumber.js}/bignumber.mjs +0 -0
- /package/node_modules/{bignumber.js → google-auth-library/node_modules/bignumber.js}/doc/API.html +0 -0
- /package/node_modules/{bignumber.js → google-auth-library/node_modules/bignumber.js}/package.json +0 -0
- /package/node_modules/{bignumber.js → google-auth-library/node_modules/bignumber.js}/types.d.ts +0 -0
- /package/node_modules/{buffer-equal-constant-time → google-auth-library/node_modules/buffer-equal-constant-time}/.npmignore +0 -0
- /package/node_modules/{buffer-equal-constant-time → google-auth-library/node_modules/buffer-equal-constant-time}/.travis.yml +0 -0
- /package/node_modules/{buffer-equal-constant-time → google-auth-library/node_modules/buffer-equal-constant-time}/LICENSE.txt +0 -0
- /package/node_modules/{buffer-equal-constant-time → google-auth-library/node_modules/buffer-equal-constant-time}/README.md +0 -0
- /package/node_modules/{buffer-equal-constant-time → google-auth-library/node_modules/buffer-equal-constant-time}/index.js +0 -0
- /package/node_modules/{buffer-equal-constant-time → google-auth-library/node_modules/buffer-equal-constant-time}/package.json +0 -0
- /package/node_modules/{buffer-equal-constant-time → google-auth-library/node_modules/buffer-equal-constant-time}/test.js +0 -0
- /package/node_modules/{ecdsa-sig-formatter → google-auth-library/node_modules/ecdsa-sig-formatter}/CODEOWNERS +0 -0
- /package/node_modules/{ecdsa-sig-formatter → google-auth-library/node_modules/ecdsa-sig-formatter}/LICENSE +0 -0
- /package/node_modules/{ecdsa-sig-formatter → google-auth-library/node_modules/ecdsa-sig-formatter}/README.md +0 -0
- /package/node_modules/{ecdsa-sig-formatter → google-auth-library/node_modules/ecdsa-sig-formatter}/package.json +0 -0
- /package/node_modules/{ecdsa-sig-formatter → google-auth-library/node_modules/ecdsa-sig-formatter}/src/ecdsa-sig-formatter.d.ts +0 -0
- /package/node_modules/{ecdsa-sig-formatter → google-auth-library/node_modules/ecdsa-sig-formatter}/src/ecdsa-sig-formatter.js +0 -0
- /package/node_modules/{ecdsa-sig-formatter → google-auth-library/node_modules/ecdsa-sig-formatter}/src/param-bytes-for-alg.js +0 -0
- /package/node_modules/{gcp-metadata → google-auth-library/node_modules/gcp-metadata}/LICENSE +0 -0
- /package/node_modules/{gcp-metadata → google-auth-library/node_modules/gcp-metadata}/README.md +0 -0
- /package/node_modules/{gcp-metadata → google-auth-library/node_modules/gcp-metadata}/build/src/gcp-residency.d.ts +0 -0
- /package/node_modules/{gcp-metadata → google-auth-library/node_modules/gcp-metadata}/build/src/gcp-residency.js +0 -0
- /package/node_modules/{gcp-metadata → google-auth-library/node_modules/gcp-metadata}/build/src/gcp-residency.js.map +0 -0
- /package/node_modules/{gcp-metadata → google-auth-library/node_modules/gcp-metadata}/build/src/index.d.ts +0 -0
- /package/node_modules/{gcp-metadata → google-auth-library/node_modules/gcp-metadata}/build/src/index.js +0 -0
- /package/node_modules/{gcp-metadata → google-auth-library/node_modules/gcp-metadata}/build/src/index.js.map +0 -0
- /package/node_modules/{gcp-metadata → google-auth-library/node_modules/gcp-metadata}/package.json +0 -0
- /package/node_modules/{google-logging-utils → google-auth-library/node_modules/google-logging-utils}/LICENSE +0 -0
- /package/node_modules/{google-logging-utils → google-auth-library/node_modules/google-logging-utils}/README.md +0 -0
- /package/node_modules/{google-logging-utils → google-auth-library/node_modules/google-logging-utils}/build/src/colours.d.ts +0 -0
- /package/node_modules/{google-logging-utils → google-auth-library/node_modules/google-logging-utils}/build/src/colours.js +0 -0
- /package/node_modules/{google-logging-utils → google-auth-library/node_modules/google-logging-utils}/build/src/colours.js.map +0 -0
- /package/node_modules/{google-logging-utils → google-auth-library/node_modules/google-logging-utils}/build/src/index.d.ts +0 -0
- /package/node_modules/{google-logging-utils → google-auth-library/node_modules/google-logging-utils}/build/src/index.js +0 -0
- /package/node_modules/{google-logging-utils → google-auth-library/node_modules/google-logging-utils}/build/src/index.js.map +0 -0
- /package/node_modules/{google-logging-utils → google-auth-library/node_modules/google-logging-utils}/build/src/logging-utils.d.ts +0 -0
- /package/node_modules/{google-logging-utils → google-auth-library/node_modules/google-logging-utils}/build/src/logging-utils.js +0 -0
- /package/node_modules/{google-logging-utils → google-auth-library/node_modules/google-logging-utils}/build/src/logging-utils.js.map +0 -0
- /package/node_modules/{google-logging-utils → google-auth-library/node_modules/google-logging-utils}/build/src/temporal.d.ts +0 -0
- /package/node_modules/{google-logging-utils → google-auth-library/node_modules/google-logging-utils}/build/src/temporal.js +0 -0
- /package/node_modules/{google-logging-utils → google-auth-library/node_modules/google-logging-utils}/build/src/temporal.js.map +0 -0
- /package/node_modules/{google-logging-utils → google-auth-library/node_modules/google-logging-utils}/package.json +0 -0
- /package/node_modules/{json-bigint → google-auth-library/node_modules/json-bigint}/LICENSE +0 -0
- /package/node_modules/{json-bigint → google-auth-library/node_modules/json-bigint}/README.md +0 -0
- /package/node_modules/{json-bigint → google-auth-library/node_modules/json-bigint}/index.js +0 -0
- /package/node_modules/{json-bigint → google-auth-library/node_modules/json-bigint}/lib/parse.js +0 -0
- /package/node_modules/{json-bigint → google-auth-library/node_modules/json-bigint}/lib/stringify.js +0 -0
- /package/node_modules/{json-bigint → google-auth-library/node_modules/json-bigint}/package.json +0 -0
- /package/node_modules/{jwa → google-auth-library/node_modules/jwa}/LICENSE +0 -0
- /package/node_modules/{jwa → google-auth-library/node_modules/jwa}/README.md +0 -0
- /package/node_modules/{jwa → google-auth-library/node_modules/jwa}/index.js +0 -0
- /package/node_modules/{jwa → google-auth-library/node_modules/jwa}/opslevel.yml +0 -0
- /package/node_modules/{jwa → google-auth-library/node_modules/jwa}/package.json +0 -0
- /package/node_modules/{jws → google-auth-library/node_modules/jws}/CHANGELOG.md +0 -0
- /package/node_modules/{jws → google-auth-library/node_modules/jws}/LICENSE +0 -0
- /package/node_modules/{jws → google-auth-library/node_modules/jws}/index.js +0 -0
- /package/node_modules/{jws → google-auth-library/node_modules/jws}/lib/data-stream.js +0 -0
- /package/node_modules/{jws → google-auth-library/node_modules/jws}/lib/sign-stream.js +0 -0
- /package/node_modules/{jws → google-auth-library/node_modules/jws}/lib/tostring.js +0 -0
- /package/node_modules/{jws → google-auth-library/node_modules/jws}/lib/verify-stream.js +0 -0
- /package/node_modules/{jws → google-auth-library/node_modules/jws}/opslevel.yml +0 -0
- /package/node_modules/{jws → google-auth-library/node_modules/jws}/package.json +0 -0
- /package/node_modules/{jws → google-auth-library/node_modules/jws}/readme.md +0 -0
- /package/node_modules/{safe-buffer → google-auth-library/node_modules/safe-buffer}/LICENSE +0 -0
- /package/node_modules/{safe-buffer → google-auth-library/node_modules/safe-buffer}/README.md +0 -0
- /package/node_modules/{safe-buffer → google-auth-library/node_modules/safe-buffer}/index.d.ts +0 -0
- /package/node_modules/{safe-buffer → google-auth-library/node_modules/safe-buffer}/index.js +0 -0
- /package/node_modules/{safe-buffer → google-auth-library/node_modules/safe-buffer}/package.json +0 -0
|
@@ -1,75 +1,15 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
import {
|
|
3
|
-
import { n as googleChatApprovalAuth } from "./approval-auth-
|
|
1
|
+
import { A as readGoogleChatApprovalActionToken, C as verifyGoogleChatRequest, D as completeGoogleChatApprovalCardBinding, E as claimGoogleChatApprovalCardBinding, N as releaseGoogleChatApprovalCardBinding, S as uploadGoogleChatAttachment, _ as downloadGoogleChatMedia, b as sendGoogleChatMessage, c as isGoogleChatGroupSpace, h as deleteGoogleChatMessage, k as getGoogleChatApprovalCardBinding, x as updateGoogleChatMessage, y as probeGoogleChat } from "./channel.adapters-T6wPzrpo.mjs";
|
|
2
|
+
import { E as resolveDefaultGroupPolicy, M as warnMissingProviderGroupPolicyFallbackOnce, O as resolveInboundRouteEnvelopeBuilderWithRuntime, P as getGoogleChatRuntime, k as resolveWebhookPath, m as isDangerousNameMatchingEnabled, n as GROUP_POLICY_BLOCKED_LABEL, u as createChannelPairingController, w as resolveAllowlistProviderRuntimeGroupPolicy } from "./runtime-api-BbVoWRxq.mjs";
|
|
3
|
+
import { n as googleChatApprovalAuth } from "./approval-auth-CQP5ZS_f.mjs";
|
|
4
4
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalLowercaseString, normalizeOptionalString, normalizeStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
5
5
|
import { mergePairLoopGuardConfig } from "openclaw/plugin-sdk/pair-loop-guard-runtime";
|
|
6
|
-
import {
|
|
7
|
-
import { collectErrorGraphCandidates, formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
8
|
-
import { createChannelIngressMonitor } from "openclaw/plugin-sdk/channel-outbound";
|
|
9
|
-
import { recordChannelBotPairLoopAndCheckSuppression, resolveChannelInboundRouteEnvelope, toInboundMediaFacts } from "openclaw/plugin-sdk/channel-inbound";
|
|
6
|
+
import { recordChannelBotPairLoopAndCheckSuppression } from "openclaw/plugin-sdk/channel-inbound";
|
|
10
7
|
import { WEBHOOK_RATE_LIMIT_DEFAULTS, createFixedWindowRateLimiter, normalizeWebhookPath, resolveRequestClientIp } from "openclaw/plugin-sdk/webhook-ingress";
|
|
11
8
|
import { registerWebhookTargetWithPluginRoute, resolveWebhookTargetWithAuthOrReject, withResolvedWebhookRequestPipeline } from "openclaw/plugin-sdk/webhook-targets";
|
|
12
|
-
import { createWebhookInFlightLimiter, readJsonWebhookBodyOrReject
|
|
9
|
+
import { createWebhookInFlightLimiter, readJsonWebhookBodyOrReject } from "openclaw/plugin-sdk/webhook-request-guards";
|
|
13
10
|
import { resolveApprovalOverGateway } from "openclaw/plugin-sdk/approval-gateway-runtime";
|
|
14
11
|
import { channelIngressRoutes, createChannelIngressResolver, defineStableChannelIngressIdentity } from "openclaw/plugin-sdk/channel-ingress-runtime";
|
|
15
|
-
import { resolveSendableOutboundReplyParts } from "openclaw/plugin-sdk/reply-payload";
|
|
16
|
-
//#region extensions/googlechat/src/approval-terminal-card.ts
|
|
17
|
-
const GOOGLECHAT_APPROVAL_CARD_ID = "openclaw-approval";
|
|
18
|
-
const MAX_TEXT_PARAGRAPH_CHARS = 1800;
|
|
19
|
-
function escapeGoogleChatText(text) {
|
|
20
|
-
return text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
21
|
-
}
|
|
22
|
-
function truncateText(text) {
|
|
23
|
-
return text.length <= MAX_TEXT_PARAGRAPH_CHARS ? text : `${truncateUtf16Safe(text, MAX_TEXT_PARAGRAPH_CHARS - 3)}...`;
|
|
24
|
-
}
|
|
25
|
-
function formatApprovalId(value) {
|
|
26
|
-
return JSON.stringify(value).slice(1, -1);
|
|
27
|
-
}
|
|
28
|
-
function formatCanonicalOutcome(approval) {
|
|
29
|
-
switch (approval.status) {
|
|
30
|
-
case "allowed": return approval.decision === "allow-always" ? "Allowed always" : "Allowed once";
|
|
31
|
-
case "denied": return "Denied";
|
|
32
|
-
case "expired": return "Expired";
|
|
33
|
-
case "cancelled": return "Cancelled";
|
|
34
|
-
}
|
|
35
|
-
return "Unavailable";
|
|
36
|
-
}
|
|
37
|
-
function buildSubjectSection(presentation) {
|
|
38
|
-
if (presentation.kind === "exec") return {
|
|
39
|
-
header: "Command",
|
|
40
|
-
widgets: [{ textParagraph: { text: escapeGoogleChatText(truncateText(presentation.commandPreview ?? presentation.commandText)) } }]
|
|
41
|
-
};
|
|
42
|
-
const description = presentation.description.trim();
|
|
43
|
-
return {
|
|
44
|
-
header: "Request",
|
|
45
|
-
widgets: [{ textParagraph: { text: truncateText(`<b>${escapeGoogleChatText(presentation.title)}</b>${description ? `<br>${escapeGoogleChatText(description)}` : ""}`) } }]
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
/** Render the canonical first-answer result without retaining any actionable buttons. */
|
|
49
|
-
function buildGoogleChatCanonicalApprovalTerminalCards(result) {
|
|
50
|
-
const { approval } = result;
|
|
51
|
-
const kindLabel = approval.presentation.kind === "plugin" ? "Plugin" : "Exec";
|
|
52
|
-
const detailLines = [
|
|
53
|
-
`<b>Approval ID:</b> ${escapeGoogleChatText(formatApprovalId(approval.id))}`,
|
|
54
|
-
`<b>Status:</b> ${escapeGoogleChatText(approval.status)}`,
|
|
55
|
-
...approval.status === "allowed" || approval.status === "denied" ? [`<b>Decision:</b> ${escapeGoogleChatText(approval.decision)}`] : [],
|
|
56
|
-
`<b>Reason:</b> ${escapeGoogleChatText(approval.reason)}`
|
|
57
|
-
];
|
|
58
|
-
return [{
|
|
59
|
-
cardId: GOOGLECHAT_APPROVAL_CARD_ID,
|
|
60
|
-
card: {
|
|
61
|
-
header: {
|
|
62
|
-
title: `${kindLabel} Approval: ${formatCanonicalOutcome(approval)}`,
|
|
63
|
-
subtitle: result.applied ? "Resolved by this action" : "Already resolved"
|
|
64
|
-
},
|
|
65
|
-
sections: [buildSubjectSection(approval.presentation), {
|
|
66
|
-
header: "Details",
|
|
67
|
-
widgets: [{ textParagraph: { text: truncateText(detailLines.join("<br>")) } }]
|
|
68
|
-
}]
|
|
69
|
-
}
|
|
70
|
-
}];
|
|
71
|
-
}
|
|
72
|
-
//#endregion
|
|
12
|
+
import { deliverTextOrMediaReply, resolveSendableOutboundReplyParts } from "openclaw/plugin-sdk/reply-payload";
|
|
73
13
|
//#region extensions/googlechat/src/approval-card-click.ts
|
|
74
14
|
function logIgnored(target, message) {
|
|
75
15
|
target.runtime.log?.(`[${target.account.accountId}] googlechat approval ignored: ${message}`);
|
|
@@ -120,29 +60,21 @@ async function maybeHandleGoogleChatApprovalCardClick(params) {
|
|
|
120
60
|
return true;
|
|
121
61
|
}
|
|
122
62
|
const consumed = claim.binding;
|
|
123
|
-
let result;
|
|
124
63
|
try {
|
|
125
|
-
|
|
64
|
+
await resolveApprovalOverGateway({
|
|
126
65
|
cfg: params.target.config,
|
|
127
66
|
approvalId: consumed.approvalId,
|
|
128
|
-
approvalKind: consumed.approvalKind,
|
|
129
67
|
decision: consumed.decision,
|
|
130
68
|
senderId: actor,
|
|
69
|
+
allowPluginFallback: consumed.approvalKind === "exec",
|
|
131
70
|
clientDisplayName: `Google Chat approval (${actor?.trim() || "unknown"})`
|
|
132
71
|
});
|
|
133
|
-
await updateGoogleChatMessage({
|
|
134
|
-
account: params.target.account,
|
|
135
|
-
messageName: consumed.messageName,
|
|
136
|
-
cardsV2: buildGoogleChatCanonicalApprovalTerminalCards(result)
|
|
137
|
-
});
|
|
138
72
|
} catch (error) {
|
|
139
73
|
releaseGoogleChatApprovalCardBinding(token);
|
|
140
74
|
throw error;
|
|
141
75
|
}
|
|
142
76
|
completeGoogleChatApprovalCardBinding(token);
|
|
143
|
-
|
|
144
|
-
const decision = "decision" in result.approval ? result.approval.decision : "none";
|
|
145
|
-
params.target.runtime.log?.(`[${params.target.account.accountId}] googlechat approval ${outcome} id=${consumed.approvalId} status=${result.approval.status} decision=${decision} sender=${actor || "unknown"}`);
|
|
77
|
+
params.target.runtime.log?.(`[${params.target.account.accountId}] googlechat approval resolved id=${consumed.approvalId} decision=${consumed.decision} sender=${actor || "unknown"}`);
|
|
146
78
|
return true;
|
|
147
79
|
}
|
|
148
80
|
//#endregion
|
|
@@ -180,7 +112,7 @@ const googleChatIngressIdentity = defineStableChannelIngressIdentity({
|
|
|
180
112
|
isWildcardEntry: (entry) => normalizeEntryValue(entry) === "*",
|
|
181
113
|
resolveEntryId: ({ entryIndex, fieldKey }) => fieldKey === "stableId" ? `entry-${entryIndex + 1}:user` : `entry-${entryIndex + 1}:${fieldKey}`
|
|
182
114
|
});
|
|
183
|
-
function
|
|
115
|
+
function resolveGroupConfig(params) {
|
|
184
116
|
const { groupId, groupName, groups } = params;
|
|
185
117
|
const entries = groups ?? {};
|
|
186
118
|
const keys = Object.keys(entries);
|
|
@@ -189,21 +121,14 @@ function resolveGoogleChatGroupConfig(params) {
|
|
|
189
121
|
allowlistConfigured: false,
|
|
190
122
|
deprecatedNameMatch: false
|
|
191
123
|
};
|
|
192
|
-
const
|
|
193
|
-
const scope = buildGoogleChatGroupPolicyScope({
|
|
194
|
-
tree: {
|
|
195
|
-
defaults: fallback,
|
|
196
|
-
scopes
|
|
197
|
-
},
|
|
198
|
-
groupId
|
|
199
|
-
});
|
|
200
|
-
const entry = scope.matchKey ? entries[scope.matchKey] : void 0;
|
|
124
|
+
const entry = entries[groupId];
|
|
201
125
|
const normalizedGroupName = normalizeLowercaseStringOrEmpty(groupName ?? "");
|
|
202
126
|
const deprecatedNameMatch = !entry && Boolean(groupName && keys.some((key) => {
|
|
203
127
|
const trimmed = key.trim();
|
|
204
128
|
if (!trimmed || trimmed === "*" || /^spaces\//i.test(trimmed)) return false;
|
|
205
129
|
return trimmed === groupName || normalizeLowercaseStringOrEmpty(trimmed) === normalizedGroupName;
|
|
206
130
|
}));
|
|
131
|
+
const fallback = entries["*"];
|
|
207
132
|
return {
|
|
208
133
|
entry: deprecatedNameMatch ? void 0 : entry ?? fallback,
|
|
209
134
|
allowlistConfigured: true,
|
|
@@ -266,7 +191,7 @@ async function applyGoogleChatInboundAccessPolicy(params) {
|
|
|
266
191
|
log: logVerbose
|
|
267
192
|
});
|
|
268
193
|
warnMutableGroupKeysConfigured(logVerbose, account.config.groups ?? void 0);
|
|
269
|
-
const groupConfigResolved =
|
|
194
|
+
const groupConfigResolved = resolveGroupConfig({
|
|
270
195
|
groupId: spaceId,
|
|
271
196
|
groupName: space.displayName ?? null,
|
|
272
197
|
groups: account.config.groups ?? void 0
|
|
@@ -274,8 +199,8 @@ async function applyGoogleChatInboundAccessPolicy(params) {
|
|
|
274
199
|
const groupEntry = groupConfigResolved.entry;
|
|
275
200
|
const groupUsers = groupEntry?.users ?? account.config.groupAllowFrom ?? [];
|
|
276
201
|
let effectiveWasMentioned;
|
|
277
|
-
const dmPolicy = account.config.
|
|
278
|
-
const rawConfigAllowFrom = normalizeStringEntries(account.config.allowFrom);
|
|
202
|
+
const dmPolicy = account.config.dm?.policy ?? "pairing";
|
|
203
|
+
const rawConfigAllowFrom = normalizeStringEntries(account.config.dm?.allowFrom);
|
|
279
204
|
const shouldComputeAuth = core.channel.commands.shouldComputeCommandAuthorized(rawBody, config);
|
|
280
205
|
const groupActivation = (() => {
|
|
281
206
|
if (!isGroup) return;
|
|
@@ -432,29 +357,138 @@ async function applyGoogleChatInboundAccessPolicy(params) {
|
|
|
432
357
|
//#endregion
|
|
433
358
|
//#region extensions/googlechat/src/monitor-durable.ts
|
|
434
359
|
function resolveGoogleChatDurableReplyOptions(params) {
|
|
435
|
-
if (params.infoKind !== "final" || params.
|
|
360
|
+
if (params.infoKind !== "final" || params.typingMessageName) return false;
|
|
436
361
|
const threadId = params.payload.replyToId?.trim() || void 0;
|
|
437
|
-
if (!threadId) return {
|
|
438
|
-
to: params.spaceId,
|
|
439
|
-
replyToId: null
|
|
440
|
-
};
|
|
441
362
|
return {
|
|
442
363
|
to: params.spaceId,
|
|
443
|
-
|
|
444
|
-
|
|
364
|
+
...threadId ? {
|
|
365
|
+
replyToId: threadId,
|
|
366
|
+
threadId
|
|
367
|
+
} : {}
|
|
445
368
|
};
|
|
446
369
|
}
|
|
447
370
|
//#endregion
|
|
448
|
-
//#region extensions/googlechat/src/monitor-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
371
|
+
//#region extensions/googlechat/src/monitor-reply-delivery.ts
|
|
372
|
+
async function deliverGoogleChatReply(params) {
|
|
373
|
+
const { payload, account, spaceId, runtime, core, config, statusSink } = params;
|
|
374
|
+
let typingMessageName = params.typingMessageName;
|
|
375
|
+
const reply = resolveSendableOutboundReplyParts(payload);
|
|
376
|
+
const mediaCount = reply.mediaCount;
|
|
377
|
+
const hasMedia = reply.hasMedia;
|
|
378
|
+
const text = reply.text;
|
|
379
|
+
let firstTextChunk = true;
|
|
380
|
+
let suppressCaption = false;
|
|
381
|
+
if (hasMedia && typingMessageName) try {
|
|
382
|
+
await deleteGoogleChatMessage({
|
|
383
|
+
account,
|
|
384
|
+
messageName: typingMessageName
|
|
385
|
+
});
|
|
386
|
+
typingMessageName = void 0;
|
|
387
|
+
} catch (err) {
|
|
388
|
+
runtime.error?.(`Google Chat typing cleanup failed: ${String(err)}`);
|
|
389
|
+
if (typingMessageName) {
|
|
390
|
+
const fallbackText = reply.hasText ? text : mediaCount > 1 ? "Sent attachments." : "Sent attachment.";
|
|
391
|
+
try {
|
|
392
|
+
await updateGoogleChatMessage({
|
|
393
|
+
account,
|
|
394
|
+
messageName: typingMessageName,
|
|
395
|
+
text: fallbackText
|
|
396
|
+
});
|
|
397
|
+
suppressCaption = Boolean(text.trim());
|
|
398
|
+
} catch (updateErr) {
|
|
399
|
+
runtime.error?.(`Google Chat typing update failed: ${String(updateErr)}`);
|
|
400
|
+
typingMessageName = void 0;
|
|
401
|
+
}
|
|
402
|
+
}
|
|
453
403
|
}
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
404
|
+
const chunkLimit = account.config.textChunkLimit ?? 4e3;
|
|
405
|
+
const chunkMode = core.channel.text.resolveChunkMode(config, "googlechat", account.accountId);
|
|
406
|
+
const sendTextMessage = async (chunk) => {
|
|
407
|
+
await sendGoogleChatMessage({
|
|
408
|
+
account,
|
|
409
|
+
space: spaceId,
|
|
410
|
+
text: chunk,
|
|
411
|
+
thread: payload.replyToId
|
|
412
|
+
});
|
|
413
|
+
};
|
|
414
|
+
await deliverTextOrMediaReply({
|
|
415
|
+
payload,
|
|
416
|
+
text: suppressCaption ? "" : reply.text,
|
|
417
|
+
chunkText: (value) => core.channel.text.chunkMarkdownTextWithMode(value, chunkLimit, chunkMode),
|
|
418
|
+
sendText: async (chunk) => {
|
|
419
|
+
try {
|
|
420
|
+
if (firstTextChunk && typingMessageName) await updateGoogleChatMessage({
|
|
421
|
+
account,
|
|
422
|
+
messageName: typingMessageName,
|
|
423
|
+
text: chunk
|
|
424
|
+
});
|
|
425
|
+
else await sendTextMessage(chunk);
|
|
426
|
+
firstTextChunk = false;
|
|
427
|
+
statusSink?.({ lastOutboundAt: Date.now() });
|
|
428
|
+
} catch (err) {
|
|
429
|
+
runtime.error?.(`Google Chat message send failed: ${String(err)}`);
|
|
430
|
+
if (firstTextChunk && typingMessageName) {
|
|
431
|
+
typingMessageName = void 0;
|
|
432
|
+
try {
|
|
433
|
+
await sendTextMessage(chunk);
|
|
434
|
+
statusSink?.({ lastOutboundAt: Date.now() });
|
|
435
|
+
} catch (fallbackErr) {
|
|
436
|
+
runtime.error?.(`Google Chat message fallback send failed: ${String(fallbackErr)}`);
|
|
437
|
+
} finally {
|
|
438
|
+
firstTextChunk = false;
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
},
|
|
443
|
+
sendMedia: async ({ mediaUrl, caption }) => {
|
|
444
|
+
try {
|
|
445
|
+
const loaded = await core.channel.media.readRemoteMediaBuffer({
|
|
446
|
+
url: mediaUrl,
|
|
447
|
+
maxBytes: (account.config.mediaMaxMb ?? 20) * 1024 * 1024
|
|
448
|
+
});
|
|
449
|
+
const upload = await uploadAttachmentForReply({
|
|
450
|
+
account,
|
|
451
|
+
spaceId,
|
|
452
|
+
buffer: loaded.buffer,
|
|
453
|
+
contentType: loaded.contentType,
|
|
454
|
+
filename: loaded.fileName ?? "attachment"
|
|
455
|
+
});
|
|
456
|
+
if (!upload.attachmentUploadToken) throw new Error("missing attachment upload token");
|
|
457
|
+
await sendGoogleChatMessage({
|
|
458
|
+
account,
|
|
459
|
+
space: spaceId,
|
|
460
|
+
text: caption,
|
|
461
|
+
thread: payload.replyToId,
|
|
462
|
+
attachments: [{
|
|
463
|
+
attachmentUploadToken: upload.attachmentUploadToken,
|
|
464
|
+
contentName: loaded.fileName
|
|
465
|
+
}]
|
|
466
|
+
});
|
|
467
|
+
statusSink?.({ lastOutboundAt: Date.now() });
|
|
468
|
+
} catch (err) {
|
|
469
|
+
runtime.error?.(`Google Chat attachment send failed: ${String(err)}`);
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
});
|
|
473
|
+
}
|
|
474
|
+
async function uploadAttachmentForReply(params) {
|
|
475
|
+
const { account, spaceId, buffer, contentType, filename } = params;
|
|
476
|
+
return await uploadGoogleChatAttachment({
|
|
477
|
+
account,
|
|
478
|
+
space: spaceId,
|
|
479
|
+
filename,
|
|
480
|
+
buffer,
|
|
481
|
+
contentType
|
|
482
|
+
});
|
|
483
|
+
}
|
|
484
|
+
//#endregion
|
|
485
|
+
//#region extensions/googlechat/src/monitor-webhook.ts
|
|
486
|
+
function extractBearerToken(header) {
|
|
487
|
+
const authHeader = Array.isArray(header) ? typeof header[0] === "string" ? header[0] : "" : typeof header === "string" ? header : "";
|
|
488
|
+
return normalizeLowercaseStringOrEmpty(authHeader).startsWith("bearer ") ? authHeader.slice(7).trim() : "";
|
|
457
489
|
}
|
|
490
|
+
const ADD_ON_PREAUTH_MAX_BYTES = 16384;
|
|
491
|
+
const ADD_ON_PREAUTH_TIMEOUT_MS = 3e3;
|
|
458
492
|
function recordParamsToActionParameters(params) {
|
|
459
493
|
if (!params) return;
|
|
460
494
|
const entries = Object.entries(params).filter((entry) => typeof entry[1] === "string").map(([key, value]) => ({
|
|
@@ -463,25 +497,29 @@ function recordParamsToActionParameters(params) {
|
|
|
463
497
|
}));
|
|
464
498
|
return entries.length > 0 ? entries : void 0;
|
|
465
499
|
}
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
500
|
+
function parseGoogleChatInboundPayload(raw, res) {
|
|
501
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
|
|
502
|
+
res.statusCode = 400;
|
|
503
|
+
res.end("invalid payload");
|
|
504
|
+
return { ok: false };
|
|
505
|
+
}
|
|
469
506
|
let eventPayload = raw;
|
|
470
507
|
let addOnBearerToken = "";
|
|
471
508
|
const rawObj = raw;
|
|
472
509
|
if (rawObj.commonEventObject?.hostApp === "CHAT") addOnBearerToken = typeof rawObj.authorizationEventObject?.systemIdToken === "string" ? rawObj.authorizationEventObject.systemIdToken.trim() : "";
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
const
|
|
510
|
+
if (rawObj.commonEventObject?.hostApp === "CHAT" && rawObj.chat?.messagePayload) {
|
|
511
|
+
const chat = rawObj.chat;
|
|
512
|
+
const messagePayload = chat.messagePayload;
|
|
513
|
+
eventPayload = {
|
|
514
|
+
type: "MESSAGE",
|
|
515
|
+
space: messagePayload?.space,
|
|
516
|
+
message: messagePayload?.message,
|
|
517
|
+
user: chat.user,
|
|
518
|
+
eventTime: chat.eventTime
|
|
519
|
+
};
|
|
520
|
+
} else if (rawObj.commonEventObject?.hostApp === "CHAT") {
|
|
521
|
+
const chat = rawObj.chat;
|
|
522
|
+
const buttonClickedPayload = chat?.buttonClickedPayload;
|
|
485
523
|
if (buttonClickedPayload) {
|
|
486
524
|
const invokedFunction = rawObj.commonEventObject.invokedFunction;
|
|
487
525
|
const actionParameters = recordParamsToActionParameters(rawObj.commonEventObject.parameters);
|
|
@@ -489,8 +527,8 @@ function parseGoogleChatInboundPayload(raw) {
|
|
|
489
527
|
type: "CARD_CLICKED",
|
|
490
528
|
space: buttonClickedPayload.space,
|
|
491
529
|
message: buttonClickedPayload.message,
|
|
492
|
-
user: buttonClickedPayload.user ??
|
|
493
|
-
eventTime:
|
|
530
|
+
user: buttonClickedPayload.user ?? chat.user,
|
|
531
|
+
eventTime: chat.eventTime,
|
|
494
532
|
action: buttonClickedPayload.action ?? {
|
|
495
533
|
...typeof invokedFunction === "string" ? { actionMethodName: invokedFunction } : {},
|
|
496
534
|
...actionParameters ? { parameters: actionParameters } : {}
|
|
@@ -503,249 +541,33 @@ function parseGoogleChatInboundPayload(raw) {
|
|
|
503
541
|
}
|
|
504
542
|
}
|
|
505
543
|
const event = eventPayload;
|
|
506
|
-
const eventType = event.type ??
|
|
507
|
-
if (typeof eventType !== "string"
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
return {
|
|
512
|
-
event,
|
|
513
|
-
addOnBearerToken
|
|
514
|
-
};
|
|
515
|
-
}
|
|
516
|
-
//#endregion
|
|
517
|
-
//#region extensions/googlechat/src/monitor-ingress.ts
|
|
518
|
-
const GOOGLECHAT_INGRESS_PAYLOAD_VERSION = 1;
|
|
519
|
-
const GOOGLECHAT_INGRESS_POLL_INTERVAL_MS = 500;
|
|
520
|
-
const GOOGLECHAT_INGRESS_PRUNE_INTERVAL_MS = 3600 * 1e3;
|
|
521
|
-
const GOOGLECHAT_INGRESS_MAX_CONCURRENT_DELIVERIES = 8;
|
|
522
|
-
const GOOGLECHAT_INGRESS_COMPLETED_TTL_MS = 720 * 60 * 60 * 1e3;
|
|
523
|
-
const GOOGLECHAT_INGRESS_COMPLETED_MAX_ENTRIES = 2e4;
|
|
524
|
-
const GOOGLECHAT_INGRESS_FAILED_TTL_MS = 720 * 60 * 60 * 1e3;
|
|
525
|
-
const GOOGLECHAT_INGRESS_FAILED_MAX_ENTRIES = 2e4;
|
|
526
|
-
var GoogleChatIngressPermanentError = class extends Error {
|
|
527
|
-
constructor(reason, message, options) {
|
|
528
|
-
super(message, options);
|
|
529
|
-
this.reason = reason;
|
|
530
|
-
this.name = "GoogleChatIngressPermanentError";
|
|
531
|
-
}
|
|
532
|
-
};
|
|
533
|
-
function isRecord$1(value) {
|
|
534
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
535
|
-
}
|
|
536
|
-
function requiredString(value, field) {
|
|
537
|
-
if (typeof value === "string" && value.trim()) return value.trim();
|
|
538
|
-
throw new GoogleChatIngressPermanentError("invalid-event", `Google Chat MESSAGE event is missing ${field}.`);
|
|
539
|
-
}
|
|
540
|
-
function inspectGoogleChatIngressEvent(raw) {
|
|
541
|
-
if (!isRecord$1(raw)) throw new GoogleChatIngressPermanentError("invalid-event", "Google Chat webhook envelope must be an object.");
|
|
542
|
-
const commonEventObject = isRecord$1(raw.commonEventObject) ? raw.commonEventObject : null;
|
|
543
|
-
const chat = isRecord$1(raw.chat) ? raw.chat : null;
|
|
544
|
-
const isAddOn = commonEventObject?.hostApp === "CHAT";
|
|
545
|
-
let eventType = raw.type ?? raw.eventType;
|
|
546
|
-
let space = isRecord$1(raw.space) ? raw.space : null;
|
|
547
|
-
let message = isRecord$1(raw.message) ? raw.message : null;
|
|
548
|
-
if (isAddOn) {
|
|
549
|
-
const messagePayload = isRecord$1(chat?.messagePayload) ? chat.messagePayload : null;
|
|
550
|
-
if (!messagePayload) return null;
|
|
551
|
-
eventType = "MESSAGE";
|
|
552
|
-
space = isRecord$1(messagePayload.space) ? messagePayload.space : null;
|
|
553
|
-
message = isRecord$1(messagePayload.message) ? messagePayload.message : null;
|
|
554
|
-
}
|
|
555
|
-
if (eventType !== "MESSAGE") return null;
|
|
556
|
-
const spaceName = requiredString(space?.name, "space.name");
|
|
557
|
-
return {
|
|
558
|
-
eventId: requiredString(message?.name, "message.name"),
|
|
559
|
-
laneKey: `space:${spaceName}`
|
|
560
|
-
};
|
|
561
|
-
}
|
|
562
|
-
function deserializeGoogleChatIngressEvent(rawEvent, claimedId) {
|
|
563
|
-
let raw;
|
|
564
|
-
try {
|
|
565
|
-
raw = JSON.parse(rawEvent);
|
|
566
|
-
} catch (error) {
|
|
567
|
-
throw new GoogleChatIngressPermanentError("invalid-event", `Google Chat ingress row ${claimedId} contains invalid JSON.`, { cause: error });
|
|
568
|
-
}
|
|
569
|
-
return raw;
|
|
570
|
-
}
|
|
571
|
-
function normalizeClaimedGoogleChatEvent(raw, claimedId) {
|
|
572
|
-
try {
|
|
573
|
-
const parsed = parseGoogleChatInboundPayload(raw);
|
|
574
|
-
if ((parsed.event.type ?? parsed.event.eventType) !== "MESSAGE") throw new GoogleChatEventPayloadError();
|
|
575
|
-
return parsed.event;
|
|
576
|
-
} catch (error) {
|
|
577
|
-
throw new GoogleChatIngressPermanentError("invalid-event", `Google Chat ingress row ${claimedId} cannot be normalized.`, { cause: error });
|
|
578
|
-
}
|
|
579
|
-
}
|
|
580
|
-
function resolveGoogleChatIngressNonRetryableFailure(error) {
|
|
581
|
-
for (const candidate of collectErrorGraphCandidates(error, (current) => [current.cause])) {
|
|
582
|
-
if (candidate instanceof GoogleChatIngressPermanentError) return {
|
|
583
|
-
reason: candidate.reason,
|
|
584
|
-
message: candidate.message
|
|
585
|
-
};
|
|
586
|
-
const message = formatErrorMessage(candidate);
|
|
587
|
-
if (/Google Chat API 401\b/.test(message) || /^(?:Missing Google Chat access token|Google Chat (?:credentials|service account)\b|(?:Failed to load|Invalid) Google Chat service account\b)/.test(message)) return {
|
|
588
|
-
reason: "googlechat-auth",
|
|
589
|
-
message
|
|
590
|
-
};
|
|
544
|
+
const eventType = event.type ?? eventPayload.eventType;
|
|
545
|
+
if (typeof eventType !== "string") {
|
|
546
|
+
res.statusCode = 400;
|
|
547
|
+
res.end("invalid payload");
|
|
548
|
+
return { ok: false };
|
|
591
549
|
}
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
if (!isRecord$1(rawEvent)) throw new GoogleChatIngressPermanentError("invalid-event", "Google Chat webhook envelope must be an object.");
|
|
597
|
-
const durableEvent = { ...rawEvent };
|
|
598
|
-
delete durableEvent.authorizationEventObject;
|
|
599
|
-
const serialized = JSON.stringify(durableEvent);
|
|
600
|
-
if (typeof serialized !== "string") throw new GoogleChatIngressPermanentError("invalid-event", "Google Chat webhook envelope cannot be serialized.");
|
|
601
|
-
return serialized;
|
|
602
|
-
};
|
|
603
|
-
const monitor = createChannelIngressMonitor({
|
|
604
|
-
queue: options.queue ?? (() => getGoogleChatRuntime().state.openChannelIngressQueue({ accountId: options.accountId })),
|
|
605
|
-
inspect: (rawEvent) => inspectGoogleChatIngressEvent(rawEvent),
|
|
606
|
-
payload: {
|
|
607
|
-
storage: "raw-event",
|
|
608
|
-
version: GOOGLECHAT_INGRESS_PAYLOAD_VERSION,
|
|
609
|
-
serialize: serializeForIngress,
|
|
610
|
-
deserialize: (rawEvent, { claim }) => deserializeGoogleChatIngressEvent(rawEvent, claim.id),
|
|
611
|
-
createClaimError: (kind, claim) => new GoogleChatIngressPermanentError("invalid-event", kind === "invalid-version" ? `Google Chat ingress row ${claim.id} has an invalid payload.` : `Google Chat ingress row ${claim.id} has invalid message identity.`)
|
|
612
|
-
},
|
|
613
|
-
deliver: (rawEvent, lifecycle, claim) => options.dispatch(normalizeClaimedGoogleChatEvent(rawEvent, claim.id), lifecycle),
|
|
614
|
-
pollIntervalMs: options.pollIntervalMs ?? GOOGLECHAT_INGRESS_POLL_INTERVAL_MS,
|
|
615
|
-
retention: {
|
|
616
|
-
pruneIntervalMs: GOOGLECHAT_INGRESS_PRUNE_INTERVAL_MS,
|
|
617
|
-
completedTtlMs: GOOGLECHAT_INGRESS_COMPLETED_TTL_MS,
|
|
618
|
-
completedMaxEntries: GOOGLECHAT_INGRESS_COMPLETED_MAX_ENTRIES,
|
|
619
|
-
failedTtlMs: GOOGLECHAT_INGRESS_FAILED_TTL_MS,
|
|
620
|
-
failedMaxEntries: GOOGLECHAT_INGRESS_FAILED_MAX_ENTRIES
|
|
621
|
-
},
|
|
622
|
-
drain: {
|
|
623
|
-
resolveNonRetryableFailure: resolveGoogleChatIngressNonRetryableFailure,
|
|
624
|
-
startLimit: GOOGLECHAT_INGRESS_MAX_CONCURRENT_DELIVERIES,
|
|
625
|
-
...options.adoptionStallTimeoutMs === void 0 ? {} : { adoptionStallTimeoutMs: options.adoptionStallTimeoutMs },
|
|
626
|
-
onLog: (message) => options.runtime.error?.(`googlechat: ${message}`)
|
|
627
|
-
},
|
|
628
|
-
...options.abortSignal ? { abortSignal: options.abortSignal } : {},
|
|
629
|
-
admissionMode: "while-running",
|
|
630
|
-
createStoppedError: () => /* @__PURE__ */ new Error("Google Chat ingress is stopped."),
|
|
631
|
-
onError: (error) => options.runtime.error?.(`googlechat ingress drain failed: ${formatErrorMessage(error)}`)
|
|
632
|
-
});
|
|
633
|
-
return {
|
|
634
|
-
receive: async (rawEvent) => {
|
|
635
|
-
if (!monitor.isRunning()) throw new Error("Google Chat ingress is stopped.");
|
|
636
|
-
let facts;
|
|
637
|
-
try {
|
|
638
|
-
facts = inspectGoogleChatIngressEvent(rawEvent);
|
|
639
|
-
} catch (error) {
|
|
640
|
-
if (error instanceof GoogleChatIngressPermanentError) return {
|
|
641
|
-
kind: "invalid",
|
|
642
|
-
message: error.message
|
|
643
|
-
};
|
|
644
|
-
throw error;
|
|
645
|
-
}
|
|
646
|
-
if (!facts) return { kind: "ignored" };
|
|
647
|
-
await monitor.admit(rawEvent, { facts });
|
|
648
|
-
return { kind: "durable" };
|
|
649
|
-
},
|
|
650
|
-
start: monitor.start,
|
|
651
|
-
stop: monitor.stop,
|
|
652
|
-
waitForIdle: monitor.waitForIdle
|
|
653
|
-
};
|
|
654
|
-
}
|
|
655
|
-
//#endregion
|
|
656
|
-
//#region extensions/googlechat/src/monitor-reply-delivery.ts
|
|
657
|
-
async function deliverGoogleChatReply(params) {
|
|
658
|
-
const { payload, account, spaceId, runtime, core, config, statusSink } = params;
|
|
659
|
-
let typingMessage = params.typingMessage;
|
|
660
|
-
const replyThreadName = payload.replyToId?.trim() || void 0;
|
|
661
|
-
const typingMessageThreadName = typingMessage?.thread?.trim() || void 0;
|
|
662
|
-
const reply = resolveSendableOutboundReplyParts(payload);
|
|
663
|
-
const text = reply.text;
|
|
664
|
-
let firstTextChunk = true;
|
|
665
|
-
if (typingMessage && typingMessageThreadName !== replyThreadName) {
|
|
666
|
-
try {
|
|
667
|
-
await deleteGoogleChatMessage({
|
|
668
|
-
account,
|
|
669
|
-
messageName: typingMessage.name
|
|
670
|
-
});
|
|
671
|
-
} catch (err) {
|
|
672
|
-
runtime.error?.(`Google Chat typing cleanup failed: ${String(err)}`);
|
|
673
|
-
}
|
|
674
|
-
typingMessage = void 0;
|
|
550
|
+
if (!event.space || typeof event.space !== "object" || Array.isArray(event.space)) {
|
|
551
|
+
res.statusCode = 400;
|
|
552
|
+
res.end("invalid payload");
|
|
553
|
+
return { ok: false };
|
|
675
554
|
}
|
|
676
|
-
if (
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
messageName: typingMessage.name
|
|
682
|
-
});
|
|
683
|
-
} catch (err) {
|
|
684
|
-
runtime.error?.(`Google Chat typing cleanup failed: ${String(err)}`);
|
|
555
|
+
if (eventType === "MESSAGE") {
|
|
556
|
+
if (!event.message || typeof event.message !== "object" || Array.isArray(event.message)) {
|
|
557
|
+
res.statusCode = 400;
|
|
558
|
+
res.end("invalid payload");
|
|
559
|
+
return { ok: false };
|
|
685
560
|
}
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
await sendGoogleChatMessage({
|
|
692
|
-
account,
|
|
693
|
-
space: spaceId,
|
|
694
|
-
text: chunk,
|
|
695
|
-
thread: replyThreadName
|
|
696
|
-
});
|
|
697
|
-
};
|
|
698
|
-
const chunks = core.channel.text.chunkMarkdownTextWithMode(text, chunkLimit, chunkMode);
|
|
699
|
-
for (const chunk of chunks) {
|
|
700
|
-
if (!chunk) continue;
|
|
701
|
-
try {
|
|
702
|
-
if (firstTextChunk && typingMessage) await updateGoogleChatMessage({
|
|
703
|
-
account,
|
|
704
|
-
messageName: typingMessage.name,
|
|
705
|
-
text: chunk
|
|
706
|
-
});
|
|
707
|
-
else await sendTextMessage(chunk);
|
|
708
|
-
firstTextChunk = false;
|
|
709
|
-
statusSink?.({ lastOutboundAt: Date.now() });
|
|
710
|
-
} catch (err) {
|
|
711
|
-
runtime.error?.(`Google Chat message send failed: ${String(err)}`);
|
|
712
|
-
if (firstTextChunk && typingMessage) {
|
|
713
|
-
typingMessage = void 0;
|
|
714
|
-
try {
|
|
715
|
-
await sendTextMessage(chunk);
|
|
716
|
-
statusSink?.({ lastOutboundAt: Date.now() });
|
|
717
|
-
} catch (fallbackErr) {
|
|
718
|
-
runtime.error?.(`Google Chat message fallback send failed: ${String(fallbackErr)}`);
|
|
719
|
-
} finally {
|
|
720
|
-
firstTextChunk = false;
|
|
721
|
-
}
|
|
722
|
-
}
|
|
561
|
+
} else if (eventType === "CARD_CLICKED") {
|
|
562
|
+
if (!event.user || typeof event.user !== "object" || Array.isArray(event.user)) {
|
|
563
|
+
res.statusCode = 400;
|
|
564
|
+
res.end("invalid payload");
|
|
565
|
+
return { ok: false };
|
|
723
566
|
}
|
|
724
567
|
}
|
|
725
|
-
}
|
|
726
|
-
//#endregion
|
|
727
|
-
//#region extensions/googlechat/src/monitor-webhook.ts
|
|
728
|
-
function extractBearerToken(header) {
|
|
729
|
-
const authHeader = Array.isArray(header) ? typeof header[0] === "string" ? header[0] : "" : typeof header === "string" ? header : "";
|
|
730
|
-
return normalizeLowercaseStringOrEmpty(authHeader).startsWith("bearer ") ? authHeader.slice(7).trim() : "";
|
|
731
|
-
}
|
|
732
|
-
const ADD_ON_PREAUTH_MAX_BYTES = 16 * 1024;
|
|
733
|
-
const ADD_ON_PREAUTH_TIMEOUT_MS = 3e3;
|
|
734
|
-
function isRecord(value) {
|
|
735
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
736
|
-
}
|
|
737
|
-
function parseGoogleChatInboundPayloadOrReject(raw, res) {
|
|
738
|
-
if (!isRecord(raw)) {
|
|
739
|
-
res.statusCode = 400;
|
|
740
|
-
res.end("invalid payload");
|
|
741
|
-
return null;
|
|
742
|
-
}
|
|
743
|
-
const commonEventObject = isRecord(raw.commonEventObject) ? raw.commonEventObject : null;
|
|
744
|
-
const authorizationEventObject = isRecord(raw.authorizationEventObject) ? raw.authorizationEventObject : null;
|
|
745
|
-
let addOnBearerToken = "";
|
|
746
|
-
if (commonEventObject?.hostApp === "CHAT" && typeof authorizationEventObject?.systemIdToken === "string") addOnBearerToken = authorizationEventObject.systemIdToken.trim();
|
|
747
568
|
return {
|
|
748
|
-
|
|
569
|
+
ok: true,
|
|
570
|
+
event,
|
|
749
571
|
addOnBearerToken
|
|
750
572
|
};
|
|
751
573
|
}
|
|
@@ -815,7 +637,7 @@ function createGoogleChatWebhookRequestHandler(params) {
|
|
|
815
637
|
handle: async ({ targets }) => {
|
|
816
638
|
const headerBearer = extractBearerToken(req.headers.authorization);
|
|
817
639
|
let selectedTarget;
|
|
818
|
-
let
|
|
640
|
+
let parsedEvent;
|
|
819
641
|
const readAndParseEvent = async (profile) => {
|
|
820
642
|
const body = await readJsonWebhookBodyOrReject({
|
|
821
643
|
req,
|
|
@@ -829,7 +651,8 @@ function createGoogleChatWebhookRequestHandler(params) {
|
|
|
829
651
|
invalidJsonMessage: "invalid payload"
|
|
830
652
|
});
|
|
831
653
|
if (!body.ok) return null;
|
|
832
|
-
|
|
654
|
+
const parsed = parseGoogleChatInboundPayload(body.value, res);
|
|
655
|
+
return parsed.ok ? parsed : null;
|
|
833
656
|
};
|
|
834
657
|
if (headerBearer) {
|
|
835
658
|
selectedTarget = await resolveGoogleChatWebhookTargetWithAuthOrReject({
|
|
@@ -840,11 +663,11 @@ function createGoogleChatWebhookRequestHandler(params) {
|
|
|
840
663
|
if (!selectedTarget) return true;
|
|
841
664
|
const parsed = await readAndParseEvent("post-auth");
|
|
842
665
|
if (!parsed) return true;
|
|
843
|
-
|
|
666
|
+
parsedEvent = parsed.event;
|
|
844
667
|
} else {
|
|
845
668
|
const parsed = await readAndParseEvent("pre-auth");
|
|
846
669
|
if (!parsed) return true;
|
|
847
|
-
|
|
670
|
+
parsedEvent = parsed.event;
|
|
848
671
|
if (!parsed.addOnBearerToken) {
|
|
849
672
|
logGoogleChatWebhookAuthRejectedForTargets(targets, "missing token");
|
|
850
673
|
res.statusCode = 401;
|
|
@@ -858,39 +681,16 @@ function createGoogleChatWebhookRequestHandler(params) {
|
|
|
858
681
|
});
|
|
859
682
|
if (!selectedTarget) return true;
|
|
860
683
|
}
|
|
861
|
-
if (!selectedTarget || !
|
|
684
|
+
if (!selectedTarget || !parsedEvent) {
|
|
862
685
|
res.statusCode = 401;
|
|
863
686
|
res.end("unauthorized");
|
|
864
687
|
return true;
|
|
865
688
|
}
|
|
866
689
|
const dispatchTarget = selectedTarget;
|
|
867
690
|
dispatchTarget.statusSink?.({ lastInboundAt: Date.now() });
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
res.statusCode = 400;
|
|
872
|
-
res.end("invalid payload");
|
|
873
|
-
return true;
|
|
874
|
-
}
|
|
875
|
-
if (admission.kind === "ignored") {
|
|
876
|
-
let event;
|
|
877
|
-
try {
|
|
878
|
-
event = parseGoogleChatInboundPayload(parsedInbound.raw).event;
|
|
879
|
-
} catch {
|
|
880
|
-
res.statusCode = 400;
|
|
881
|
-
res.end("invalid payload");
|
|
882
|
-
return true;
|
|
883
|
-
}
|
|
884
|
-
runDetachedWebhookWork(() => params.processEvent(event, dispatchTarget)).catch((err) => {
|
|
885
|
-
dispatchTarget.runtime.error?.(`[${dispatchTarget.account.accountId}] Google Chat webhook failed: ${String(err)}`);
|
|
886
|
-
});
|
|
887
|
-
}
|
|
888
|
-
} catch (error) {
|
|
889
|
-
dispatchTarget.runtime.error?.(`[${dispatchTarget.account.accountId}] Google Chat durable admission failed: ${String(error)}`);
|
|
890
|
-
res.statusCode = 503;
|
|
891
|
-
res.end("failed to persist event");
|
|
892
|
-
return true;
|
|
893
|
-
}
|
|
691
|
+
params.processEvent(parsedEvent, dispatchTarget).catch((err) => {
|
|
692
|
+
dispatchTarget.runtime.error?.(`[${dispatchTarget.account.accountId}] Google Chat webhook failed: ${String(err)}`);
|
|
693
|
+
});
|
|
894
694
|
res.statusCode = 200;
|
|
895
695
|
res.setHeader("Content-Type", "application/json");
|
|
896
696
|
res.end("{}");
|
|
@@ -982,7 +782,7 @@ function shouldSuppressGoogleChatBotLoop(params) {
|
|
|
982
782
|
logVerbose(params.core, params.runtime, `skip bot-to-bot loop in ${params.botLoopProtection.conversationId}`);
|
|
983
783
|
return true;
|
|
984
784
|
}
|
|
985
|
-
async function processGoogleChatEvent(event, target
|
|
785
|
+
async function processGoogleChatEvent(event, target) {
|
|
986
786
|
const eventType = event.type ?? event.eventType;
|
|
987
787
|
if (eventType === "CARD_CLICKED") {
|
|
988
788
|
await maybeHandleGoogleChatApprovalCardClick({
|
|
@@ -1000,8 +800,7 @@ async function processGoogleChatEvent(event, target, turnAdoptionLifecycle) {
|
|
|
1000
800
|
runtime: target.runtime,
|
|
1001
801
|
core: target.core,
|
|
1002
802
|
statusSink: target.statusSink,
|
|
1003
|
-
mediaMaxMb: target.mediaMaxMb
|
|
1004
|
-
turnAdoptionLifecycle
|
|
803
|
+
mediaMaxMb: target.mediaMaxMb
|
|
1005
804
|
});
|
|
1006
805
|
}
|
|
1007
806
|
/**
|
|
@@ -1018,7 +817,7 @@ function resolveBotDisplayName(params) {
|
|
|
1018
817
|
return "OpenClaw";
|
|
1019
818
|
}
|
|
1020
819
|
async function processMessageWithPipeline(params) {
|
|
1021
|
-
const { event, account, config, runtime, core, statusSink, mediaMaxMb
|
|
820
|
+
const { event, account, config, runtime, core, statusSink, mediaMaxMb } = params;
|
|
1022
821
|
const space = event.space;
|
|
1023
822
|
const message = event.message;
|
|
1024
823
|
if (!space || !message) return;
|
|
@@ -1044,8 +843,9 @@ async function processMessageWithPipeline(params) {
|
|
|
1044
843
|
}
|
|
1045
844
|
const messageText = (message.argumentText ?? message.text ?? "").trim();
|
|
1046
845
|
const attachments = message.attachment ?? [];
|
|
1047
|
-
const
|
|
1048
|
-
|
|
846
|
+
const hasMedia = attachments.length > 0;
|
|
847
|
+
const rawBody = messageText || (hasMedia ? "<media:attachment>" : "");
|
|
848
|
+
if (!rawBody) return;
|
|
1049
849
|
const access = await applyGoogleChatInboundAccessPolicy({
|
|
1050
850
|
account,
|
|
1051
851
|
config,
|
|
@@ -1080,29 +880,30 @@ async function processMessageWithPipeline(params) {
|
|
|
1080
880
|
core,
|
|
1081
881
|
runtime
|
|
1082
882
|
})) return;
|
|
1083
|
-
const { route, buildEnvelope } =
|
|
883
|
+
const { route, buildEnvelope } = resolveInboundRouteEnvelopeBuilderWithRuntime({
|
|
1084
884
|
cfg: config,
|
|
1085
885
|
channel: "googlechat",
|
|
1086
886
|
accountId: account.accountId,
|
|
1087
887
|
peer: {
|
|
1088
888
|
kind: isGroup ? "group" : "direct",
|
|
1089
889
|
id: spaceId
|
|
1090
|
-
}
|
|
890
|
+
},
|
|
891
|
+
runtime: core.channel,
|
|
892
|
+
sessionStore: config.session?.store
|
|
1091
893
|
});
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
if (
|
|
894
|
+
let mediaPath;
|
|
895
|
+
let mediaType;
|
|
896
|
+
if (attachments.length > 0) {
|
|
897
|
+
const first = attachments[0];
|
|
1095
898
|
const attachmentData = await downloadAttachment(first, account, mediaMaxMb, core);
|
|
1096
|
-
if (attachmentData)
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
};
|
|
899
|
+
if (attachmentData) {
|
|
900
|
+
mediaPath = attachmentData.path;
|
|
901
|
+
mediaType = attachmentData.contentType;
|
|
902
|
+
}
|
|
1101
903
|
}
|
|
1102
|
-
const media = toInboundMediaFacts(mediaInputs);
|
|
1103
904
|
const fromLabel = isGroup ? space.displayName || `space:${spaceId}` : senderName || `user:${senderId}`;
|
|
1104
905
|
const timestampMs = resolveGoogleChatTimestampMs(event.eventTime);
|
|
1105
|
-
const body = buildEnvelope({
|
|
906
|
+
const { storePath, body } = buildEnvelope({
|
|
1106
907
|
channel: "Google Chat",
|
|
1107
908
|
from: fromLabel,
|
|
1108
909
|
timestamp: timestampMs,
|
|
@@ -1129,7 +930,6 @@ async function processMessageWithPipeline(params) {
|
|
|
1129
930
|
},
|
|
1130
931
|
route: {
|
|
1131
932
|
agentId: route.agentId,
|
|
1132
|
-
dmScope: route.dmScope,
|
|
1133
933
|
accountId: route.accountId,
|
|
1134
934
|
routeSessionKey: route.sessionKey
|
|
1135
935
|
},
|
|
@@ -1145,7 +945,11 @@ async function processMessageWithPipeline(params) {
|
|
|
1145
945
|
rawBody,
|
|
1146
946
|
commandBody: rawBody
|
|
1147
947
|
},
|
|
1148
|
-
media:
|
|
948
|
+
media: mediaPath || mediaType ? [{
|
|
949
|
+
path: mediaPath,
|
|
950
|
+
url: mediaPath,
|
|
951
|
+
contentType: mediaType
|
|
952
|
+
}] : void 0,
|
|
1149
953
|
supplemental: { groupSystemPrompt: isGroup ? groupSystemPrompt : void 0 },
|
|
1150
954
|
extra: {
|
|
1151
955
|
ChatType: isGroup ? "channel" : "direct",
|
|
@@ -1160,23 +964,19 @@ async function processMessageWithPipeline(params) {
|
|
|
1160
964
|
runtime.error?.(`[${account.accountId}] typingIndicator="reaction" requires user OAuth (not supported with service account). Falling back to "message" mode.`);
|
|
1161
965
|
typingIndicator = "message";
|
|
1162
966
|
}
|
|
1163
|
-
let
|
|
1164
|
-
const typingMessageThreadName = account.config.replyToMode && account.config.replyToMode !== "off" ? replyThreadName : void 0;
|
|
967
|
+
let typingMessageName;
|
|
1165
968
|
if (typingIndicator === "message") try {
|
|
1166
|
-
const
|
|
969
|
+
const botName = resolveBotDisplayName({
|
|
970
|
+
accountName: account.config.name,
|
|
971
|
+
agentId: route.agentId,
|
|
972
|
+
config
|
|
973
|
+
});
|
|
974
|
+
typingMessageName = (await sendGoogleChatMessage({
|
|
1167
975
|
account,
|
|
1168
976
|
space: spaceId,
|
|
1169
|
-
text: `_${
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
config
|
|
1173
|
-
})} is typing..._`,
|
|
1174
|
-
thread: typingMessageThreadName
|
|
1175
|
-
});
|
|
1176
|
-
if (result?.messageName) typingMessage = {
|
|
1177
|
-
name: result.messageName,
|
|
1178
|
-
thread: typingMessageThreadName
|
|
1179
|
-
};
|
|
977
|
+
text: `_${botName} is typing..._`,
|
|
978
|
+
thread: replyThreadName
|
|
979
|
+
}))?.messageName;
|
|
1180
980
|
} catch (err) {
|
|
1181
981
|
runtime.error?.(`Failed sending typing message: ${String(err)}`);
|
|
1182
982
|
}
|
|
@@ -1184,7 +984,6 @@ async function processMessageWithPipeline(params) {
|
|
|
1184
984
|
channel: "googlechat",
|
|
1185
985
|
accountId: route.accountId,
|
|
1186
986
|
raw: message,
|
|
1187
|
-
...turnAdoptionLifecycle ? { turnAdoptionLifecycle } : {},
|
|
1188
987
|
adapter: {
|
|
1189
988
|
ingest: () => ({
|
|
1190
989
|
id: message.name ?? spaceId,
|
|
@@ -1198,17 +997,18 @@ async function processMessageWithPipeline(params) {
|
|
|
1198
997
|
cfg: config,
|
|
1199
998
|
channel: "googlechat",
|
|
1200
999
|
accountId: route.accountId,
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
},
|
|
1000
|
+
agentId: route.agentId,
|
|
1001
|
+
routeSessionKey: route.sessionKey,
|
|
1002
|
+
storePath,
|
|
1205
1003
|
ctxPayload,
|
|
1004
|
+
recordInboundSession: core.channel.session.recordInboundSession,
|
|
1005
|
+
dispatchReplyWithBufferedBlockDispatcher: core.channel.reply.dispatchReplyWithBufferedBlockDispatcher,
|
|
1206
1006
|
delivery: {
|
|
1207
1007
|
durable: (payload, info) => resolveGoogleChatDurableReplyOptions({
|
|
1208
1008
|
payload,
|
|
1209
1009
|
infoKind: info.kind,
|
|
1210
1010
|
spaceId,
|
|
1211
|
-
|
|
1011
|
+
typingMessageName
|
|
1212
1012
|
}),
|
|
1213
1013
|
deliver: async (payload) => {
|
|
1214
1014
|
await deliverGoogleChatReply({
|
|
@@ -1219,9 +1019,9 @@ async function processMessageWithPipeline(params) {
|
|
|
1219
1019
|
core,
|
|
1220
1020
|
config,
|
|
1221
1021
|
statusSink,
|
|
1222
|
-
|
|
1022
|
+
typingMessageName
|
|
1223
1023
|
});
|
|
1224
|
-
|
|
1024
|
+
typingMessageName = void 0;
|
|
1225
1025
|
},
|
|
1226
1026
|
onDelivered: () => {
|
|
1227
1027
|
statusSink?.({ lastOutboundAt: Date.now() });
|
|
@@ -1253,7 +1053,7 @@ async function downloadAttachment(attachment, account, mediaMaxMb, core) {
|
|
|
1253
1053
|
contentType: saved.contentType
|
|
1254
1054
|
};
|
|
1255
1055
|
}
|
|
1256
|
-
|
|
1056
|
+
function monitorGoogleChatProvider(options) {
|
|
1257
1057
|
const core = getGoogleChatRuntime();
|
|
1258
1058
|
const webhookPath = resolveWebhookPath({
|
|
1259
1059
|
webhookPath: options.webhookPath,
|
|
@@ -1262,7 +1062,7 @@ async function monitorGoogleChatProvider(options) {
|
|
|
1262
1062
|
});
|
|
1263
1063
|
if (!webhookPath) {
|
|
1264
1064
|
options.runtime.error?.(`[${options.account.accountId}] invalid webhook path`);
|
|
1265
|
-
return
|
|
1065
|
+
return () => {};
|
|
1266
1066
|
}
|
|
1267
1067
|
const audienceType = normalizeAudienceType(options.account.config.audienceType);
|
|
1268
1068
|
const audience = options.account.config.audience?.trim();
|
|
@@ -1273,15 +1073,7 @@ async function monitorGoogleChatProvider(options) {
|
|
|
1273
1073
|
appPrincipal: options.account.config.appPrincipal,
|
|
1274
1074
|
log: options.runtime.log
|
|
1275
1075
|
});
|
|
1276
|
-
const
|
|
1277
|
-
accountId: options.account.accountId,
|
|
1278
|
-
runtime: options.runtime,
|
|
1279
|
-
abortSignal: options.abortSignal,
|
|
1280
|
-
dispatch: async (event, lifecycle) => {
|
|
1281
|
-
await processGoogleChatEvent(event, target, lifecycle);
|
|
1282
|
-
}
|
|
1283
|
-
});
|
|
1284
|
-
const target = {
|
|
1076
|
+
const unregisterTarget = registerGoogleChatWebhookTarget({
|
|
1285
1077
|
account: options.account,
|
|
1286
1078
|
config: options.config,
|
|
1287
1079
|
runtime: options.runtime,
|
|
@@ -1290,24 +1082,14 @@ async function monitorGoogleChatProvider(options) {
|
|
|
1290
1082
|
audienceType,
|
|
1291
1083
|
audience,
|
|
1292
1084
|
statusSink: options.statusSink,
|
|
1293
|
-
mediaMaxMb
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
let unregisterTarget;
|
|
1298
|
-
try {
|
|
1299
|
-
unregisterTarget = registerGoogleChatWebhookTarget(target);
|
|
1300
|
-
} catch (error) {
|
|
1301
|
-
await ingress.stop();
|
|
1302
|
-
throw error;
|
|
1303
|
-
}
|
|
1304
|
-
return async () => {
|
|
1305
|
-
unregisterTarget?.();
|
|
1306
|
-
await ingress.stop();
|
|
1085
|
+
mediaMaxMb
|
|
1086
|
+
});
|
|
1087
|
+
return () => {
|
|
1088
|
+
unregisterTarget();
|
|
1307
1089
|
};
|
|
1308
1090
|
}
|
|
1309
1091
|
async function startGoogleChatMonitor(params) {
|
|
1310
|
-
return
|
|
1092
|
+
return monitorGoogleChatProvider(params);
|
|
1311
1093
|
}
|
|
1312
1094
|
function resolveGoogleChatWebhookPath(params) {
|
|
1313
1095
|
return resolveWebhookPath({
|
|
@@ -1321,6 +1103,7 @@ function resolveGoogleChatWebhookPath(params) {
|
|
|
1321
1103
|
const googleChatChannelRuntime = {
|
|
1322
1104
|
probeGoogleChat,
|
|
1323
1105
|
sendGoogleChatMessage,
|
|
1106
|
+
uploadGoogleChatAttachment,
|
|
1324
1107
|
resolveGoogleChatWebhookPath,
|
|
1325
1108
|
startGoogleChatMonitor
|
|
1326
1109
|
};
|