@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,21 +1,20 @@
|
|
|
1
|
-
import { l as resolveGoogleChatAccount, r as formatGoogleChatAllowFromEntry
|
|
2
|
-
import {
|
|
1
|
+
import { l as resolveGoogleChatAccount, r as formatGoogleChatAllowFromEntry } from "./channel-base-DJICAvKH.mjs";
|
|
2
|
+
import { T as resolveChannelMediaMaxBytes, _ as missingTargetError, g as loadOutboundMediaFromUrl, i as PAIRING_APPROVED_MESSAGE, o as chunkTextForOutbound, p as fetchWithSsrFGuard$1, x as readRemoteMediaBuffer } from "./runtime-api-BbVoWRxq.mjs";
|
|
3
3
|
import { buildChannelOutboundSessionRoute } from "openclaw/plugin-sdk/channel-core";
|
|
4
4
|
import { createLazyRuntimeNamedExport } from "openclaw/plugin-sdk/lazy-runtime";
|
|
5
5
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
6
|
-
import
|
|
6
|
+
import crypto from "node:crypto";
|
|
7
7
|
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
8
|
-
import { parseMediaContentLength
|
|
8
|
+
import { parseMediaContentLength } from "openclaw/plugin-sdk/media-runtime";
|
|
9
|
+
import { readProviderJsonResponse, readResponseTextLimited } from "openclaw/plugin-sdk/provider-http";
|
|
9
10
|
import { readResponseWithLimit } from "openclaw/plugin-sdk/response-limit-runtime";
|
|
10
11
|
import { buildHostnameAllowlistPolicyFromSuffixAllowlist, fetchWithSsrFGuard } from "openclaw/plugin-sdk/ssrf-runtime";
|
|
11
|
-
import crypto from "node:crypto";
|
|
12
|
-
import { pruneMapToMaxSize } from "openclaw/plugin-sdk/collection-runtime";
|
|
13
|
-
import { readProviderJsonResponse } from "openclaw/plugin-sdk/provider-http";
|
|
14
12
|
import { createMessageReceiptFromOutboundResults, defineChannelMessageAdapter, sanitizeForPlainText } from "openclaw/plugin-sdk/channel-outbound";
|
|
15
|
-
import {
|
|
13
|
+
import { sanitizeAssistantVisibleText } from "openclaw/plugin-sdk/text-chunking";
|
|
16
14
|
import fs from "node:fs/promises";
|
|
15
|
+
import { resolveUserPath } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
17
16
|
import { adaptScopedAccountAccessor } from "openclaw/plugin-sdk/channel-config-helpers";
|
|
18
|
-
import {
|
|
17
|
+
import { composeAccountWarningCollectors, createAllowlistProviderOpenWarningCollector, resolveChannelGroupRequireMention } from "openclaw/plugin-sdk/channel-policy";
|
|
19
18
|
import { createChannelDirectoryAdapter, listResolvedDirectoryGroupEntriesFromMapKeys, listResolvedDirectoryUserEntriesFromAllowFrom } from "openclaw/plugin-sdk/directory-runtime";
|
|
20
19
|
//#region extensions/googlechat/src/approval-card-actions.ts
|
|
21
20
|
const GOOGLECHAT_APPROVAL_ACTION = "openclaw.approval";
|
|
@@ -25,8 +24,6 @@ const GOOGLECHAT_APPROVAL_ACTION_VALUE = "approval";
|
|
|
25
24
|
const MANUAL_EXEC_APPROVAL_COMMAND_RE = /(?:^|[\s`])\/approve[ \t]+([^ \t\r\n`|]+)[ \t]+(allow-once|allow-always|deny)(?=$|[\s`|.,;:!?])/giu;
|
|
26
25
|
const approvalCardBindings = /* @__PURE__ */ new Map();
|
|
27
26
|
const approvalCardResolvingTokens = /* @__PURE__ */ new Set();
|
|
28
|
-
const GOOGLECHAT_APPROVAL_CARD_BINDING_MAX_ENTRIES = 1024;
|
|
29
|
-
const GOOGLECHAT_MANUAL_APPROVAL_SUPPRESSION_MAX_ENTRIES = 1024;
|
|
30
27
|
const manualApprovalFollowupSuppressions = /* @__PURE__ */ new Map();
|
|
31
28
|
function createGoogleChatApprovalToken() {
|
|
32
29
|
return crypto.randomBytes(18).toString("base64url");
|
|
@@ -56,9 +53,7 @@ function readGoogleChatApprovalActionToken(event) {
|
|
|
56
53
|
}
|
|
57
54
|
function registerGoogleChatApprovalCardBinding(binding) {
|
|
58
55
|
if (binding.expiresAtMs <= Date.now()) return false;
|
|
59
|
-
if (approvalCardBindings.has(binding.token)) approvalCardBindings.delete(binding.token);
|
|
60
56
|
approvalCardBindings.set(binding.token, binding);
|
|
61
|
-
pruneMapToMaxSize(approvalCardBindings, GOOGLECHAT_APPROVAL_CARD_BINDING_MAX_ENTRIES);
|
|
62
57
|
registerGoogleChatManualApprovalFollowupSuppression({
|
|
63
58
|
approvalId: binding.approvalId,
|
|
64
59
|
approvalKind: binding.approvalKind,
|
|
@@ -87,9 +82,7 @@ function registerGoogleChatManualApprovalFollowupSuppression(suppression) {
|
|
|
87
82
|
if (suppression.expiresAtMs <= Date.now()) return false;
|
|
88
83
|
const key = manualApprovalFollowupSuppressionKey(suppression.approvalId);
|
|
89
84
|
if (!key) return false;
|
|
90
|
-
if (manualApprovalFollowupSuppressions.has(key)) manualApprovalFollowupSuppressions.delete(key);
|
|
91
85
|
manualApprovalFollowupSuppressions.set(key, suppression);
|
|
92
|
-
pruneMapToMaxSize(manualApprovalFollowupSuppressions, GOOGLECHAT_MANUAL_APPROVAL_SUPPRESSION_MAX_ENTRIES);
|
|
93
86
|
return true;
|
|
94
87
|
}
|
|
95
88
|
function unregisterGoogleChatManualApprovalFollowupSuppression(approvalId) {
|
|
@@ -168,13 +161,14 @@ function unregisterGoogleChatApprovalCardBindings(tokens) {
|
|
|
168
161
|
//#endregion
|
|
169
162
|
//#region extensions/googlechat/src/google-auth.runtime.ts
|
|
170
163
|
const GOOGLE_AUTH_POLICY = buildHostnameAllowlistPolicyFromSuffixAllowlist(["accounts.google.com", "googleapis.com"]);
|
|
171
|
-
const
|
|
164
|
+
const GOOGLE_AUTH_AUDIT_CONTEXT = "googlechat.auth.google-auth";
|
|
172
165
|
const GOOGLE_AUTH_URI = "https://accounts.google.com/o/oauth2/auth";
|
|
173
166
|
const GOOGLE_AUTH_PROVIDER_CERTS_URL = "https://www.googleapis.com/oauth2/v1/certs";
|
|
174
167
|
const GOOGLE_AUTH_TOKEN_URI = "https://oauth2.googleapis.com/token";
|
|
175
168
|
const GOOGLE_AUTH_UNIVERSE_DOMAIN = "googleapis.com";
|
|
176
169
|
const GOOGLE_CLIENT_CERTS_URL_PREFIX = "https://www.googleapis.com/robot/v1/metadata/x509/";
|
|
177
|
-
const MAX_GOOGLE_AUTH_RESPONSE_BYTES =
|
|
170
|
+
const MAX_GOOGLE_AUTH_RESPONSE_BYTES = 1048576;
|
|
171
|
+
const MAX_GOOGLE_CHAT_SERVICE_ACCOUNT_FILE_BYTES = 65536;
|
|
178
172
|
let googleAuthRuntimePromise = null;
|
|
179
173
|
function normalizeGoogleAuthPreparedRequestHeaders(config) {
|
|
180
174
|
if (!(config.headers instanceof Headers)) config.headers = new Headers(config.headers);
|
|
@@ -317,14 +311,14 @@ async function readCredentialsFile(filePath) {
|
|
|
317
311
|
try {
|
|
318
312
|
const stat = await handle.stat();
|
|
319
313
|
if (!stat.isFile()) throw new Error("Google Chat service account file must be a regular file.");
|
|
320
|
-
if (stat.size >
|
|
314
|
+
if (stat.size > MAX_GOOGLE_CHAT_SERVICE_ACCOUNT_FILE_BYTES) throw new Error(`Google Chat service account file exceeds ${MAX_GOOGLE_CHAT_SERVICE_ACCOUNT_FILE_BYTES} bytes.`);
|
|
321
315
|
let raw;
|
|
322
316
|
try {
|
|
323
317
|
raw = await handle.readFile({ encoding: "utf8" });
|
|
324
318
|
} catch {
|
|
325
319
|
throw new Error("Failed to load Google Chat service account file.");
|
|
326
320
|
}
|
|
327
|
-
if (Buffer.byteLength(raw, "utf8") >
|
|
321
|
+
if (Buffer.byteLength(raw, "utf8") > MAX_GOOGLE_CHAT_SERVICE_ACCOUNT_FILE_BYTES) throw new Error(`Google Chat service account file exceeds ${MAX_GOOGLE_CHAT_SERVICE_ACCOUNT_FILE_BYTES} bytes.`);
|
|
328
322
|
let parsed;
|
|
329
323
|
try {
|
|
330
324
|
parsed = JSON.parse(raw);
|
|
@@ -382,18 +376,17 @@ function resolveGoogleAuthDispatcherPolicy(input, init) {
|
|
|
382
376
|
};
|
|
383
377
|
return { init: nextInit };
|
|
384
378
|
}
|
|
385
|
-
function createGoogleAuthFetch() {
|
|
379
|
+
function createGoogleAuthFetch(baseFetch) {
|
|
386
380
|
return async (input, init) => {
|
|
387
381
|
const url = input instanceof Request ? input.url : String(input);
|
|
388
382
|
const guardedOptions = resolveGoogleAuthDispatcherPolicy(input, init);
|
|
389
383
|
const { response, release } = await fetchWithSsrFGuard({
|
|
390
|
-
auditContext:
|
|
384
|
+
auditContext: GOOGLE_AUTH_AUDIT_CONTEXT,
|
|
391
385
|
dispatcherPolicy: guardedOptions.dispatcherPolicy,
|
|
392
386
|
init: guardedOptions.init,
|
|
393
387
|
policy: GOOGLE_AUTH_POLICY,
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
url
|
|
388
|
+
url,
|
|
389
|
+
...baseFetch ? { fetchImpl: baseFetch } : {}
|
|
397
390
|
});
|
|
398
391
|
try {
|
|
399
392
|
const body = await readGoogleAuthResponseBytes(response);
|
|
@@ -444,15 +437,24 @@ async function readGoogleAuthResponseBytes(response) {
|
|
|
444
437
|
return bytes;
|
|
445
438
|
}
|
|
446
439
|
async function loadGoogleAuthRuntime() {
|
|
447
|
-
googleAuthRuntimePromise
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
440
|
+
if (!googleAuthRuntimePromise) googleAuthRuntimePromise = (async () => {
|
|
441
|
+
try {
|
|
442
|
+
const [googleAuthModule, gaxiosModule] = await Promise.all([import("google-auth-library"), import("gaxios")]);
|
|
443
|
+
return {
|
|
444
|
+
Gaxios: gaxiosModule.Gaxios,
|
|
445
|
+
GoogleAuth: googleAuthModule.GoogleAuth,
|
|
446
|
+
OAuth2Client: googleAuthModule.OAuth2Client
|
|
447
|
+
};
|
|
448
|
+
} catch (error) {
|
|
449
|
+
googleAuthRuntimePromise = null;
|
|
450
|
+
throw error;
|
|
451
|
+
}
|
|
452
|
+
})();
|
|
451
453
|
return await googleAuthRuntimePromise;
|
|
452
454
|
}
|
|
453
455
|
async function getGoogleAuthTransport() {
|
|
454
|
-
const {
|
|
455
|
-
return installGoogleAuthHeaderCompatibilityInterceptor(new
|
|
456
|
+
const { Gaxios } = await loadGoogleAuthRuntime();
|
|
457
|
+
return installGoogleAuthHeaderCompatibilityInterceptor(new Gaxios({ fetchImplementation: createGoogleAuthFetch() }));
|
|
456
458
|
}
|
|
457
459
|
async function resolveValidatedGoogleChatCredentials(account) {
|
|
458
460
|
if (account.credentials) return validateGoogleChatServiceAccountCredentials(account.credentials);
|
|
@@ -494,11 +496,12 @@ async function getAuthInstance(account) {
|
|
|
494
496
|
const key = buildAuthKey(account);
|
|
495
497
|
const cached = authCache.get(account.accountId);
|
|
496
498
|
if (cached && cached.key === key) return cached.auth;
|
|
497
|
-
const [{ GoogleAuth },
|
|
499
|
+
const [{ GoogleAuth }, rawTransporter, credentials] = await Promise.all([
|
|
498
500
|
loadGoogleAuthRuntime(),
|
|
499
501
|
getGoogleAuthTransport(),
|
|
500
502
|
resolveValidatedGoogleChatCredentials(account)
|
|
501
503
|
]);
|
|
504
|
+
const transporter = rawTransporter;
|
|
502
505
|
const evictOldest = () => {
|
|
503
506
|
if (authCache.size > MAX_AUTH_CACHE_SIZE) {
|
|
504
507
|
const oldest = authCache.keys().next().value;
|
|
@@ -525,17 +528,14 @@ async function getGoogleChatAccessToken(account) {
|
|
|
525
528
|
}
|
|
526
529
|
async function fetchChatCerts() {
|
|
527
530
|
const now = Date.now();
|
|
528
|
-
if (cachedCerts && now - cachedCerts.fetchedAt <
|
|
531
|
+
if (cachedCerts && now - cachedCerts.fetchedAt < 6e5) return cachedCerts.certs;
|
|
529
532
|
const { response, release } = await fetchWithSsrFGuard$1({
|
|
530
533
|
url: CHAT_CERTS_URL,
|
|
531
534
|
auditContext: "googlechat.auth.certs",
|
|
532
535
|
timeoutMs: GOOGLECHAT_CERT_FETCH_TIMEOUT_MS
|
|
533
536
|
});
|
|
534
537
|
try {
|
|
535
|
-
if (!response.ok) {
|
|
536
|
-
await response.body?.cancel().catch(() => void 0);
|
|
537
|
-
throw new Error(`Failed to fetch Chat certs (${response.status})`);
|
|
538
|
-
}
|
|
538
|
+
if (!response.ok) throw new Error(`Failed to fetch Chat certs (${response.status})`);
|
|
539
539
|
const certs = await readGoogleChatCertsResponse(response);
|
|
540
540
|
cachedCerts = {
|
|
541
541
|
fetchedAt: now,
|
|
@@ -609,41 +609,13 @@ async function verifyGoogleChatRequest(params) {
|
|
|
609
609
|
//#endregion
|
|
610
610
|
//#region extensions/googlechat/src/api.ts
|
|
611
611
|
const CHAT_API_BASE = "https://chat.googleapis.com/v1";
|
|
612
|
-
const
|
|
613
|
-
const GOOGLECHAT_MEDIA_TIMEOUT_GRACE_MS = 3e4;
|
|
614
|
-
const GOOGLECHAT_MEDIA_MIN_BYTES_PER_SECOND = 256 * 1024;
|
|
615
|
-
const GOOGLECHAT_MEDIA_MAX_TIMEOUT_MS = 15 * 6e4;
|
|
616
|
-
const GOOGLECHAT_RESPONSE_READ_IDLE_TIMEOUT_MS = 3e4;
|
|
617
|
-
const GOOGLECHAT_JSON_RESPONSE_MAX_BYTES = 16 * 1024 * 1024;
|
|
618
|
-
const GOOGLECHAT_ERROR_BODY_MAX_BYTES = 16 * 1024;
|
|
619
|
-
function resolveGoogleChatMediaTimeoutMs(maxBytes) {
|
|
620
|
-
if (!maxBytes) return GOOGLECHAT_MEDIA_MAX_TIMEOUT_MS;
|
|
621
|
-
const transferMs = Math.ceil(maxBytes / GOOGLECHAT_MEDIA_MIN_BYTES_PER_SECOND * 1e3);
|
|
622
|
-
return Math.min(GOOGLECHAT_MEDIA_TIMEOUT_GRACE_MS + transferMs, GOOGLECHAT_MEDIA_MAX_TIMEOUT_MS);
|
|
623
|
-
}
|
|
612
|
+
const CHAT_UPLOAD_BASE = "https://chat.googleapis.com/upload/v1";
|
|
624
613
|
async function readGoogleChatJsonResponse(response, label) {
|
|
625
|
-
|
|
626
|
-
chunkTimeoutMs: GOOGLECHAT_RESPONSE_READ_IDLE_TIMEOUT_MS,
|
|
627
|
-
onIdleTimeout: ({ chunkTimeoutMs }) => /* @__PURE__ */ new Error(`${label}: response body stalled after ${chunkTimeoutMs}ms`),
|
|
628
|
-
onOverflow: ({ maxBytes }) => /* @__PURE__ */ new Error(`${label}: JSON response exceeds ${maxBytes} bytes`)
|
|
629
|
-
});
|
|
630
|
-
try {
|
|
631
|
-
return JSON.parse(new TextDecoder().decode(bytes));
|
|
632
|
-
} catch (cause) {
|
|
633
|
-
throw new Error(`${label}: malformed JSON response`, { cause });
|
|
634
|
-
}
|
|
635
|
-
}
|
|
636
|
-
async function readGoogleChatErrorResponse(response, label) {
|
|
637
|
-
return await readResponseTextSnippet(response, {
|
|
638
|
-
maxBytes: GOOGLECHAT_ERROR_BODY_MAX_BYTES,
|
|
639
|
-
maxChars: GOOGLECHAT_ERROR_BODY_MAX_BYTES,
|
|
640
|
-
chunkTimeoutMs: GOOGLECHAT_RESPONSE_READ_IDLE_TIMEOUT_MS,
|
|
641
|
-
onIdleTimeout: ({ chunkTimeoutMs }) => /* @__PURE__ */ new Error(`${label} error response stalled after ${chunkTimeoutMs}ms`)
|
|
642
|
-
}) ?? "";
|
|
614
|
+
return readProviderJsonResponse(response, label);
|
|
643
615
|
}
|
|
644
616
|
const headersToObject = (headers) => headers instanceof Headers ? Object.fromEntries(headers.entries()) : Array.isArray(headers) ? Object.fromEntries(headers) : headers || {};
|
|
645
617
|
async function withGoogleChatResponse(params) {
|
|
646
|
-
const { account, url, init, auditContext, errorPrefix = "Google Chat API",
|
|
618
|
+
const { account, url, init, auditContext, errorPrefix = "Google Chat API", handleResponse } = params;
|
|
647
619
|
const token = await getGoogleChatAccessToken(account);
|
|
648
620
|
const { response, release } = await fetchWithSsrFGuard({
|
|
649
621
|
url,
|
|
@@ -654,12 +626,11 @@ async function withGoogleChatResponse(params) {
|
|
|
654
626
|
Authorization: `Bearer ${token}`
|
|
655
627
|
}
|
|
656
628
|
},
|
|
657
|
-
auditContext
|
|
658
|
-
timeoutMs
|
|
629
|
+
auditContext
|
|
659
630
|
});
|
|
660
631
|
try {
|
|
661
632
|
if (!response.ok) {
|
|
662
|
-
const text = await
|
|
633
|
+
const text = await readResponseTextLimited(response).catch(() => "");
|
|
663
634
|
throw new Error(`${errorPrefix} ${response.status}: ${text || response.statusText}`);
|
|
664
635
|
}
|
|
665
636
|
return await handleResponse(response);
|
|
@@ -697,7 +668,6 @@ async function fetchBuffer(account, url, init, options) {
|
|
|
697
668
|
url,
|
|
698
669
|
init,
|
|
699
670
|
auditContext: "googlechat.api.buffer",
|
|
700
|
-
timeoutMs: resolveGoogleChatMediaTimeoutMs(options?.maxBytes),
|
|
701
671
|
handleResponse: async (res) => {
|
|
702
672
|
const maxBytes = options?.maxBytes;
|
|
703
673
|
const lengthHeader = res.headers.get("content-length");
|
|
@@ -710,22 +680,20 @@ async function fetchBuffer(account, url, init, options) {
|
|
|
710
680
|
contentType: res.headers.get("content-type") ?? void 0
|
|
711
681
|
};
|
|
712
682
|
return {
|
|
713
|
-
buffer: await readResponseWithLimit(res, maxBytes, {
|
|
714
|
-
chunkTimeoutMs: GOOGLECHAT_RESPONSE_READ_IDLE_TIMEOUT_MS,
|
|
715
|
-
onOverflow: () => /* @__PURE__ */ new Error(`Google Chat media exceeds max bytes (${maxBytes})`)
|
|
716
|
-
}),
|
|
683
|
+
buffer: await readResponseWithLimit(res, maxBytes, { onOverflow: () => /* @__PURE__ */ new Error(`Google Chat media exceeds max bytes (${maxBytes})`) }),
|
|
717
684
|
contentType: res.headers.get("content-type") ?? void 0
|
|
718
685
|
};
|
|
719
686
|
}
|
|
720
687
|
});
|
|
721
688
|
}
|
|
722
689
|
async function sendGoogleChatMessage(params) {
|
|
723
|
-
const { account, space, text, thread, cardsV2 } = params;
|
|
724
|
-
if (text && (!cardsV2 || cardsV2.length === 0) && shouldSuppressGoogleChatManualExecApprovalFollowupText(text)) return null;
|
|
690
|
+
const { account, space, text, thread, cardsV2, attachments } = params;
|
|
691
|
+
if (text && (!cardsV2 || cardsV2.length === 0) && (!attachments || attachments.length === 0) && shouldSuppressGoogleChatManualExecApprovalFollowupText(text)) return null;
|
|
725
692
|
const body = {};
|
|
726
693
|
if (text) body.text = text;
|
|
727
694
|
if (cardsV2 && cardsV2.length > 0) body.cardsV2 = cardsV2;
|
|
728
695
|
if (thread) body.thread = { name: thread };
|
|
696
|
+
if (attachments && attachments.length > 0) body.attachment = attachments.map((item) => Object.assign({ attachmentDataRef: { attachmentUploadToken: item.attachmentUploadToken } }, item.contentName ? { contentName: item.contentName } : {}));
|
|
729
697
|
const urlObj = new URL(`${CHAT_API_BASE}/${space}/messages`);
|
|
730
698
|
if (thread) urlObj.searchParams.set("messageReplyOption", "REPLY_MESSAGE_FALLBACK_TO_NEW_THREAD");
|
|
731
699
|
const result = await fetchJson(account, urlObj.toString(), {
|
|
@@ -754,10 +722,52 @@ async function deleteGoogleChatMessage(params) {
|
|
|
754
722
|
const { account, messageName } = params;
|
|
755
723
|
await fetchOk(account, `${CHAT_API_BASE}/${messageName}`, { method: "DELETE" });
|
|
756
724
|
}
|
|
725
|
+
async function uploadGoogleChatAttachment(params) {
|
|
726
|
+
const { account, space, filename, buffer, contentType } = params;
|
|
727
|
+
const boundary = `openclaw-${crypto.randomUUID()}`;
|
|
728
|
+
const header = `--${boundary}\r\nContent-Type: application/json; charset=UTF-8\r\n\r\n${JSON.stringify({ filename })}\r\n`;
|
|
729
|
+
const mediaHeader = `--${boundary}\r\nContent-Type: ${contentType ?? "application/octet-stream"}\r\n\r\n`;
|
|
730
|
+
const footer = `\r\n--${boundary}--\r\n`;
|
|
731
|
+
const body = Buffer.concat([
|
|
732
|
+
Buffer.from(header, "utf8"),
|
|
733
|
+
Buffer.from(mediaHeader, "utf8"),
|
|
734
|
+
buffer,
|
|
735
|
+
Buffer.from(footer, "utf8")
|
|
736
|
+
]);
|
|
737
|
+
return { attachmentUploadToken: (await withGoogleChatResponse({
|
|
738
|
+
account,
|
|
739
|
+
url: `${CHAT_UPLOAD_BASE}/${space}/attachments:upload?uploadType=multipart`,
|
|
740
|
+
init: {
|
|
741
|
+
method: "POST",
|
|
742
|
+
headers: { "Content-Type": `multipart/related; boundary=${boundary}` },
|
|
743
|
+
body
|
|
744
|
+
},
|
|
745
|
+
auditContext: "googlechat.upload",
|
|
746
|
+
errorPrefix: "Google Chat upload",
|
|
747
|
+
handleResponse: async (response) => await readGoogleChatJsonResponse(response, "Google Chat upload failed")
|
|
748
|
+
})).attachmentDataRef?.attachmentUploadToken };
|
|
749
|
+
}
|
|
757
750
|
async function downloadGoogleChatMedia(params) {
|
|
758
751
|
const { account, resourceName, maxBytes } = params;
|
|
759
752
|
return await fetchBuffer(account, `${CHAT_API_BASE}/media/${resourceName}?alt=media`, void 0, { maxBytes });
|
|
760
753
|
}
|
|
754
|
+
async function createGoogleChatReaction(params) {
|
|
755
|
+
const { account, messageName, emoji } = params;
|
|
756
|
+
return await fetchJson(account, `${CHAT_API_BASE}/${messageName}/reactions`, {
|
|
757
|
+
method: "POST",
|
|
758
|
+
body: JSON.stringify({ emoji: { unicode: emoji } })
|
|
759
|
+
});
|
|
760
|
+
}
|
|
761
|
+
async function listGoogleChatReactions(params) {
|
|
762
|
+
const { account, messageName, limit } = params;
|
|
763
|
+
const url = new URL(`${CHAT_API_BASE}/${messageName}/reactions`);
|
|
764
|
+
if (limit && limit > 0) url.searchParams.set("pageSize", String(limit));
|
|
765
|
+
return (await fetchJson(account, url.toString(), { method: "GET" })).reactions ?? [];
|
|
766
|
+
}
|
|
767
|
+
async function deleteGoogleChatReaction(params) {
|
|
768
|
+
const { account, reactionName } = params;
|
|
769
|
+
await fetchOk(account, `${CHAT_API_BASE}/${reactionName}`, { method: "DELETE" });
|
|
770
|
+
}
|
|
761
771
|
async function findGoogleChatDirectMessage(params) {
|
|
762
772
|
const { account, userName } = params;
|
|
763
773
|
const url = new URL(`${CHAT_API_BASE}/spaces:findDirectMessage`);
|
|
@@ -867,301 +877,18 @@ async function resolveGoogleChatOutboundSessionRoute(params) {
|
|
|
867
877
|
});
|
|
868
878
|
}
|
|
869
879
|
//#endregion
|
|
870
|
-
//#region extensions/googlechat/src/format.ts
|
|
871
|
-
const GOOGLE_CHAT_FORMAT_PROFILE = FormatCapabilityProfile.define({
|
|
872
|
-
mechanism: "markdown",
|
|
873
|
-
constructs: {
|
|
874
|
-
underline: "fallback",
|
|
875
|
-
spoiler: "fallback",
|
|
876
|
-
codeLanguage: "fallback",
|
|
877
|
-
heading: "fallback",
|
|
878
|
-
orderedList: "fallback",
|
|
879
|
-
taskList: "fallback",
|
|
880
|
-
table: "fallback",
|
|
881
|
-
image: "fallback",
|
|
882
|
-
mention: "strip"
|
|
883
|
-
},
|
|
884
|
-
chunk: {
|
|
885
|
-
limit: 32e3,
|
|
886
|
-
unit: "bytes"
|
|
887
|
-
}
|
|
888
|
-
});
|
|
889
|
-
const GOOGLE_CHAT_LITERAL_FALLBACKS = /* @__PURE__ */ new Map([
|
|
890
|
-
["*", "*"],
|
|
891
|
-
["_", "_"],
|
|
892
|
-
["~", "~"],
|
|
893
|
-
["`", "`"],
|
|
894
|
-
["<", "<"],
|
|
895
|
-
[">", ">"],
|
|
896
|
-
["\\", "\"],
|
|
897
|
-
["-", "-"],
|
|
898
|
-
["|", "|"]
|
|
899
|
-
]);
|
|
900
|
-
function createPrivateMarkerGenerator(text) {
|
|
901
|
-
const used = /* @__PURE__ */ new Set();
|
|
902
|
-
let candidate = 0;
|
|
903
|
-
const rangeSize = 6400;
|
|
904
|
-
return () => {
|
|
905
|
-
while (true) {
|
|
906
|
-
const marker = String.fromCharCode(57344 + Math.floor(candidate / rangeSize), 57344 + candidate % rangeSize);
|
|
907
|
-
candidate += 1;
|
|
908
|
-
if (!used.has(marker) && !text.includes(marker)) {
|
|
909
|
-
used.add(marker);
|
|
910
|
-
return marker;
|
|
911
|
-
}
|
|
912
|
-
}
|
|
913
|
-
};
|
|
914
|
-
}
|
|
915
|
-
function createGoogleChatMarkers(text) {
|
|
916
|
-
const nextMarker = createPrivateMarkerGenerator(text);
|
|
917
|
-
return {
|
|
918
|
-
list: nextMarker(),
|
|
919
|
-
blockquoteOpen: nextMarker(),
|
|
920
|
-
blockquoteClose: nextMarker()
|
|
921
|
-
};
|
|
922
|
-
}
|
|
923
|
-
/** Removes unsafe HTML and internal scaffolding while retaining source Markdown for chunking. */
|
|
924
|
-
function sanitizeGoogleChatText(text) {
|
|
925
|
-
return sanitizeForPlainText(sanitizeAssistantVisibleText(text), { style: "markdown" });
|
|
926
|
-
}
|
|
927
|
-
function projectDecodedGoogleChatResources(ir) {
|
|
928
|
-
const characters = ir.text.split("");
|
|
929
|
-
let changed = false;
|
|
930
|
-
for (const match of ir.text.matchAll(/<(?:users|customEmojis)\/[^<>\s]+>/giu)) {
|
|
931
|
-
const start = match.index ?? 0;
|
|
932
|
-
characters[start] = "<";
|
|
933
|
-
characters[start + match[0].length - 1] = ">";
|
|
934
|
-
changed = true;
|
|
935
|
-
}
|
|
936
|
-
return changed ? {
|
|
937
|
-
...ir,
|
|
938
|
-
text: characters.join("")
|
|
939
|
-
} : ir;
|
|
940
|
-
}
|
|
941
|
-
function projectGoogleChatLinkLabels(ir) {
|
|
942
|
-
const characters = ir.text.split("");
|
|
943
|
-
let changed = false;
|
|
944
|
-
for (const link of ir.links) {
|
|
945
|
-
const label = ir.text.slice(link.start, link.end);
|
|
946
|
-
const comparableHref = link.href.startsWith("mailto:") ? link.href.slice(7) : link.href;
|
|
947
|
-
if (label === link.href || label === comparableHref) continue;
|
|
948
|
-
for (let index = link.start; index < link.end; index += 1) {
|
|
949
|
-
const character = characters[index] ?? "";
|
|
950
|
-
const fallback = GOOGLE_CHAT_LITERAL_FALLBACKS.get(character);
|
|
951
|
-
if (fallback && /[<>|*_~`]/u.test(character)) {
|
|
952
|
-
characters[index] = fallback;
|
|
953
|
-
changed = true;
|
|
954
|
-
}
|
|
955
|
-
}
|
|
956
|
-
}
|
|
957
|
-
return changed ? {
|
|
958
|
-
...ir,
|
|
959
|
-
text: characters.join("")
|
|
960
|
-
} : ir;
|
|
961
|
-
}
|
|
962
|
-
function markGoogleChatBulletLists(ir, markerToken) {
|
|
963
|
-
let text = ir.text;
|
|
964
|
-
for (const item of ir.listItems ?? []) {
|
|
965
|
-
const marker = item.listMarker;
|
|
966
|
-
if (item.kind !== "bullet" || !marker || text.slice(marker.start, marker.end) !== "• ") continue;
|
|
967
|
-
text = `${text.slice(0, marker.start)}${markerToken}${text.slice(marker.end)}`;
|
|
968
|
-
}
|
|
969
|
-
return text === ir.text ? ir : {
|
|
970
|
-
...ir,
|
|
971
|
-
text
|
|
972
|
-
};
|
|
973
|
-
}
|
|
974
|
-
function projectUnsafeCodeFallbacks(ir) {
|
|
975
|
-
let text = ir.text;
|
|
976
|
-
const styles = ir.styles.filter((span) => {
|
|
977
|
-
const content = ir.text.slice(span.start, span.end);
|
|
978
|
-
const unsafe = span.style === "code" && content.includes("`") || span.style === "code_block" && content.includes("```");
|
|
979
|
-
if (unsafe) {
|
|
980
|
-
const replacement = content.split("").map((character) => GOOGLE_CHAT_LITERAL_FALLBACKS.get(character) ?? character).join("");
|
|
981
|
-
text = `${text.slice(0, span.start)}${replacement}${text.slice(span.end)}`;
|
|
982
|
-
}
|
|
983
|
-
return !unsafe;
|
|
984
|
-
});
|
|
985
|
-
return styles.length === ir.styles.length ? ir : {
|
|
986
|
-
...ir,
|
|
987
|
-
styles,
|
|
988
|
-
text
|
|
989
|
-
};
|
|
990
|
-
}
|
|
991
|
-
function projectGoogleChatPlainLiterals(ir) {
|
|
992
|
-
const codeRanges = ir.styles.filter((span) => span.style === "code" || span.style === "code_block");
|
|
993
|
-
const inCode = (index) => codeRanges.some((span) => index >= span.start && index < span.end);
|
|
994
|
-
const inLink = (index) => ir.links.some((span) => index >= span.start && index < span.end);
|
|
995
|
-
const styleDelimiter = /* @__PURE__ */ new Map([
|
|
996
|
-
["~", "strikethrough"],
|
|
997
|
-
["_", "italic"],
|
|
998
|
-
["*", "bold"],
|
|
999
|
-
["`", "code"]
|
|
1000
|
-
]);
|
|
1001
|
-
const characters = ir.text.split("");
|
|
1002
|
-
let lineStart = 0;
|
|
1003
|
-
while (lineStart < characters.length) {
|
|
1004
|
-
const nextNewline = characters.indexOf("\n", lineStart);
|
|
1005
|
-
const lineEnd = nextNewline < 0 ? characters.length : nextNewline;
|
|
1006
|
-
for (const delimiter of [
|
|
1007
|
-
"~",
|
|
1008
|
-
"_",
|
|
1009
|
-
"*",
|
|
1010
|
-
"`"
|
|
1011
|
-
]) {
|
|
1012
|
-
const indexes = [];
|
|
1013
|
-
for (let index = lineStart; index < lineEnd; index += 1) if (characters[index] === delimiter && !inCode(index) && !inLink(index)) indexes.push(index);
|
|
1014
|
-
if (indexes.length === 0) continue;
|
|
1015
|
-
const renderedStyle = styleDelimiter.get(delimiter);
|
|
1016
|
-
const lineAddsDelimiter = ir.styles.some((span) => span.style === renderedStyle && span.start < lineEnd && span.end > lineStart);
|
|
1017
|
-
if (indexes.length >= 2 || lineAddsDelimiter) for (const index of indexes) characters[index] = GOOGLE_CHAT_LITERAL_FALLBACKS.get(delimiter) ?? delimiter;
|
|
1018
|
-
}
|
|
1019
|
-
let firstTextIndex = lineStart;
|
|
1020
|
-
while (firstTextIndex < lineEnd && characters[firstTextIndex] === " ") firstTextIndex += 1;
|
|
1021
|
-
if (firstTextIndex >= lineStart && !inCode(firstTextIndex)) {
|
|
1022
|
-
const character = characters[firstTextIndex];
|
|
1023
|
-
if ((character === "*" || character === "-") && characters[firstTextIndex + 1] === " " || character === ">") characters[firstTextIndex] = GOOGLE_CHAT_LITERAL_FALLBACKS.get(character) ?? character;
|
|
1024
|
-
}
|
|
1025
|
-
const line = characters.slice(lineStart, lineEnd).join("");
|
|
1026
|
-
for (const match of line.matchAll(/<[^<>\n]*\|[^<>\n]*>/gu)) {
|
|
1027
|
-
const open = lineStart + (match.index ?? 0);
|
|
1028
|
-
const close = open + match[0].length - 1;
|
|
1029
|
-
if (!inCode(open) && !inCode(close) && !inLink(open) && !inLink(close)) {
|
|
1030
|
-
characters[open] = "<";
|
|
1031
|
-
characters[close] = ">";
|
|
1032
|
-
}
|
|
1033
|
-
}
|
|
1034
|
-
lineStart = lineEnd + 1;
|
|
1035
|
-
}
|
|
1036
|
-
const text = characters.join("");
|
|
1037
|
-
return text === ir.text ? ir : {
|
|
1038
|
-
...ir,
|
|
1039
|
-
text
|
|
1040
|
-
};
|
|
1041
|
-
}
|
|
1042
|
-
function emitGoogleChatLists(text, markerToken) {
|
|
1043
|
-
return text.split("\n").map((line) => {
|
|
1044
|
-
const markerIndex = line.indexOf(markerToken);
|
|
1045
|
-
if (markerIndex < 0) return line;
|
|
1046
|
-
const prefix = line.slice(0, markerIndex);
|
|
1047
|
-
const quote = /^(?:> )*/u.exec(prefix)?.[0] ?? "";
|
|
1048
|
-
const indent = prefix.slice(quote.length);
|
|
1049
|
-
return `${quote}${" ".repeat(indent.length * 2)}* ${line.slice(markerIndex + markerToken.length)}`;
|
|
1050
|
-
}).join("\n");
|
|
1051
|
-
}
|
|
1052
|
-
function emitGoogleChatBlockquotes(text, markers) {
|
|
1053
|
-
let depth = 0;
|
|
1054
|
-
let lineStart = true;
|
|
1055
|
-
let rendered = "";
|
|
1056
|
-
for (let index = 0; index < text.length; index += 1) {
|
|
1057
|
-
if (text.startsWith(markers.blockquoteOpen, index)) {
|
|
1058
|
-
depth += 1;
|
|
1059
|
-
index += markers.blockquoteOpen.length - 1;
|
|
1060
|
-
continue;
|
|
1061
|
-
}
|
|
1062
|
-
if (text.startsWith(markers.blockquoteClose, index)) {
|
|
1063
|
-
depth = Math.max(0, depth - 1);
|
|
1064
|
-
index += markers.blockquoteClose.length - 1;
|
|
1065
|
-
continue;
|
|
1066
|
-
}
|
|
1067
|
-
const character = text[index] ?? "";
|
|
1068
|
-
if (lineStart && depth > 0) rendered += "> ".repeat(depth);
|
|
1069
|
-
rendered += character;
|
|
1070
|
-
lineStart = character === "\n";
|
|
1071
|
-
}
|
|
1072
|
-
return rendered;
|
|
1073
|
-
}
|
|
1074
|
-
function prepareGoogleChatIR(text) {
|
|
1075
|
-
const ir = projectGoogleChatPlainLiterals(projectGoogleChatLinkLabels(projectDecodedGoogleChatResources(projectUnsafeCodeFallbacks(markdownToIR(sanitizeGoogleChatText(text), {
|
|
1076
|
-
enableSpoilers: true,
|
|
1077
|
-
enableTaskLists: true,
|
|
1078
|
-
headingStyle: "rich",
|
|
1079
|
-
tableMode: "bullets"
|
|
1080
|
-
})))));
|
|
1081
|
-
const markers = createGoogleChatMarkers(ir.text);
|
|
1082
|
-
return {
|
|
1083
|
-
ir: markGoogleChatBulletLists(ir, markers.list),
|
|
1084
|
-
markers
|
|
1085
|
-
};
|
|
1086
|
-
}
|
|
1087
|
-
function renderGoogleChatIR(ir, markers) {
|
|
1088
|
-
return emitGoogleChatLists(emitGoogleChatBlockquotes(renderMarkdownWithMarkers(ir, {
|
|
1089
|
-
styleMarkers: {
|
|
1090
|
-
bold: {
|
|
1091
|
-
open: "*",
|
|
1092
|
-
close: "*"
|
|
1093
|
-
},
|
|
1094
|
-
italic: {
|
|
1095
|
-
open: "_",
|
|
1096
|
-
close: "_"
|
|
1097
|
-
},
|
|
1098
|
-
strikethrough: {
|
|
1099
|
-
open: "~",
|
|
1100
|
-
close: "~"
|
|
1101
|
-
},
|
|
1102
|
-
code: {
|
|
1103
|
-
open: "`",
|
|
1104
|
-
close: "`"
|
|
1105
|
-
},
|
|
1106
|
-
code_block: {
|
|
1107
|
-
open: "```\n",
|
|
1108
|
-
close: "```"
|
|
1109
|
-
},
|
|
1110
|
-
blockquote: {
|
|
1111
|
-
open: markers.blockquoteOpen,
|
|
1112
|
-
close: markers.blockquoteClose
|
|
1113
|
-
}
|
|
1114
|
-
},
|
|
1115
|
-
escapeText: (value) => value,
|
|
1116
|
-
buildLink: (link, value, context) => {
|
|
1117
|
-
if (context.origin === "linkify") return null;
|
|
1118
|
-
const href = link.href.trim();
|
|
1119
|
-
const label = value.slice(link.start, link.end);
|
|
1120
|
-
if (!href || !label) return null;
|
|
1121
|
-
const labelHasStyles = ir.styles.some((span) => span.start < link.end && span.end > link.start);
|
|
1122
|
-
return /[<>|]/u.test(href) || /[<>|*_~`]/u.test(label) || labelHasStyles ? {
|
|
1123
|
-
start: link.start,
|
|
1124
|
-
end: link.end,
|
|
1125
|
-
open: "",
|
|
1126
|
-
close: ` (${href})`
|
|
1127
|
-
} : {
|
|
1128
|
-
start: link.start,
|
|
1129
|
-
end: link.end,
|
|
1130
|
-
open: `<${href}|`,
|
|
1131
|
-
close: ">"
|
|
1132
|
-
};
|
|
1133
|
-
}
|
|
1134
|
-
}, GOOGLE_CHAT_FORMAT_PROFILE), markers), markers.list);
|
|
1135
|
-
}
|
|
1136
|
-
/** Renders CommonMark into byte-bounded Google Chat app-message chunks. */
|
|
1137
|
-
function formatGoogleChatTextChunks(text, limit = GOOGLE_CHAT_FORMAT_PROFILE.chunk.limit) {
|
|
1138
|
-
const prepared = prepareGoogleChatIR(text);
|
|
1139
|
-
return renderMarkdownIRChunksWithinLimit({
|
|
1140
|
-
ir: prepared.ir,
|
|
1141
|
-
limit: Math.min(limit, GOOGLE_CHAT_FORMAT_PROFILE.chunk.limit),
|
|
1142
|
-
measureRendered: (rendered) => new TextEncoder().encode(rendered).byteLength,
|
|
1143
|
-
renderChunk: (chunk) => renderGoogleChatIR(chunk, prepared.markers)
|
|
1144
|
-
}).map((chunk) => chunk.rendered);
|
|
1145
|
-
}
|
|
1146
|
-
//#endregion
|
|
1147
880
|
//#region extensions/googlechat/src/group-policy.ts
|
|
1148
|
-
function buildGoogleChatGroupPolicyScope(params) {
|
|
1149
|
-
const matchKey = params.groupId && Object.hasOwn(params.tree.scopes, params.groupId) ? params.groupId : void 0;
|
|
1150
|
-
return {
|
|
1151
|
-
tree: params.tree,
|
|
1152
|
-
path: matchKey ? [matchKey] : [],
|
|
1153
|
-
matchKey
|
|
1154
|
-
};
|
|
1155
|
-
}
|
|
1156
881
|
function resolveGoogleChatGroupRequireMention(params) {
|
|
1157
|
-
return
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
882
|
+
return resolveChannelGroupRequireMention({
|
|
883
|
+
cfg: params.cfg,
|
|
884
|
+
channel: "googlechat",
|
|
885
|
+
groupId: params.groupId,
|
|
886
|
+
accountId: params.accountId
|
|
887
|
+
});
|
|
1161
888
|
}
|
|
1162
889
|
//#endregion
|
|
1163
890
|
//#region extensions/googlechat/src/channel.adapters.ts
|
|
1164
|
-
const loadGoogleChatChannelRuntime = createLazyRuntimeNamedExport(() => import("./channel.runtime-
|
|
891
|
+
const loadGoogleChatChannelRuntime = createLazyRuntimeNamedExport(() => import("./channel.runtime-CpT-qT67.mjs"), "googleChatChannelRuntime");
|
|
1165
892
|
function createGoogleChatSendReceipt(params) {
|
|
1166
893
|
const messageId = params.messageId?.trim();
|
|
1167
894
|
return createMessageReceiptFromOutboundResults({
|
|
@@ -1175,7 +902,7 @@ function createGoogleChatSendReceipt(params) {
|
|
|
1175
902
|
kind: params.kind
|
|
1176
903
|
});
|
|
1177
904
|
}
|
|
1178
|
-
const
|
|
905
|
+
const collectGoogleChatGroupPolicyWarnings = createAllowlistProviderOpenWarningCollector({
|
|
1179
906
|
providerConfigPresent: (cfg) => cfg.channels?.googlechat !== void 0,
|
|
1180
907
|
resolveGroupPolicy: (account) => account.config.groupPolicy,
|
|
1181
908
|
buildOpenWarning: {
|
|
@@ -1183,13 +910,14 @@ const collectGoogleChatSecurityWarnings = composeAccountWarningCollectors(create
|
|
|
1183
910
|
openBehavior: "allows any space to trigger (mention-gated)",
|
|
1184
911
|
remediation: "Set channels.googlechat.groupPolicy=\"allowlist\" and configure channels.googlechat.groups"
|
|
1185
912
|
}
|
|
1186
|
-
})
|
|
913
|
+
});
|
|
914
|
+
const collectGoogleChatSecurityWarnings = composeAccountWarningCollectors(collectGoogleChatGroupPolicyWarnings, (account) => account.config.dm?.policy === "open" && "- Google Chat DMs are open to anyone. Set channels.googlechat.dm.policy=\"pairing\" or \"allowlist\".");
|
|
1187
915
|
const googlechatGroupsAdapter = { resolveRequireMention: resolveGoogleChatGroupRequireMention };
|
|
1188
916
|
const googlechatDirectoryAdapter = createChannelDirectoryAdapter({
|
|
1189
917
|
listPeers: async (params) => listResolvedDirectoryUserEntriesFromAllowFrom({
|
|
1190
918
|
...params,
|
|
1191
919
|
resolveAccount: adaptScopedAccountAccessor(resolveGoogleChatAccount),
|
|
1192
|
-
resolveAllowFrom: (account) => account.config.allowFrom,
|
|
920
|
+
resolveAllowFrom: (account) => account.config.dm?.allowFrom,
|
|
1193
921
|
normalizeId: (entry) => normalizeGoogleChatTarget(entry) ?? entry
|
|
1194
922
|
}),
|
|
1195
923
|
listGroups: async (params) => listResolvedDirectoryGroupEntriesFromMapKeys({
|
|
@@ -1201,9 +929,9 @@ const googlechatDirectoryAdapter = createChannelDirectoryAdapter({
|
|
|
1201
929
|
const googlechatSecurityAdapter = {
|
|
1202
930
|
dm: {
|
|
1203
931
|
channelKey: "googlechat",
|
|
1204
|
-
resolvePolicy: (account) => account.config.
|
|
1205
|
-
resolveAllowFrom: (account) => account.config.allowFrom,
|
|
1206
|
-
allowFromPathSuffix: "",
|
|
932
|
+
resolvePolicy: (account) => account.config.dm?.policy,
|
|
933
|
+
resolveAllowFrom: (account) => account.config.dm?.allowFrom,
|
|
934
|
+
allowFromPathSuffix: "dm.",
|
|
1207
935
|
normalizeEntry: (raw) => formatGoogleChatAllowFromEntry(raw)
|
|
1208
936
|
},
|
|
1209
937
|
collectWarnings: collectGoogleChatSecurityWarnings
|
|
@@ -1241,7 +969,7 @@ const googlechatPairingTextAdapter = {
|
|
|
1241
969
|
cfg,
|
|
1242
970
|
accountId
|
|
1243
971
|
});
|
|
1244
|
-
if (account.credentialSource === "none"
|
|
972
|
+
if (account.credentialSource === "none") return;
|
|
1245
973
|
const user = normalizeGoogleChatTarget(id) ?? id;
|
|
1246
974
|
const space = await resolveGoogleChatOutboundSpace({
|
|
1247
975
|
account,
|
|
@@ -1258,10 +986,10 @@ const googlechatPairingTextAdapter = {
|
|
|
1258
986
|
const googlechatOutboundAdapter = {
|
|
1259
987
|
base: {
|
|
1260
988
|
deliveryMode: "direct",
|
|
1261
|
-
chunker:
|
|
989
|
+
chunker: chunkTextForOutbound,
|
|
1262
990
|
chunkerMode: "markdown",
|
|
1263
|
-
textChunkLimit:
|
|
1264
|
-
sanitizeText: ({ text }) =>
|
|
991
|
+
textChunkLimit: 4e3,
|
|
992
|
+
sanitizeText: ({ text }) => sanitizeForPlainText(sanitizeAssistantVisibleText(text)),
|
|
1265
993
|
normalizePayload: ({ payload }) => shouldSuppressGoogleChatManualExecApprovalFollowupPayload(payload) ? null : payload,
|
|
1266
994
|
resolveTarget: ({ to }) => {
|
|
1267
995
|
const trimmed = normalizeOptionalString(to) ?? "";
|
|
@@ -1310,6 +1038,59 @@ const googlechatOutboundAdapter = {
|
|
|
1310
1038
|
kind: "text"
|
|
1311
1039
|
})
|
|
1312
1040
|
};
|
|
1041
|
+
},
|
|
1042
|
+
sendMedia: async ({ cfg, to, text, mediaUrl, mediaAccess, mediaLocalRoots, mediaReadFile, accountId, replyToId, threadId }) => {
|
|
1043
|
+
if (!mediaUrl) throw new Error("Google Chat mediaUrl is required.");
|
|
1044
|
+
const account = resolveGoogleChatAccount({
|
|
1045
|
+
cfg,
|
|
1046
|
+
accountId
|
|
1047
|
+
});
|
|
1048
|
+
const space = await resolveGoogleChatOutboundSpace({
|
|
1049
|
+
account,
|
|
1050
|
+
target: to
|
|
1051
|
+
});
|
|
1052
|
+
const thread = typeof threadId === "number" ? String(threadId) : threadId ?? replyToId ?? void 0;
|
|
1053
|
+
const effectiveMaxBytes = resolveChannelMediaMaxBytes({
|
|
1054
|
+
cfg,
|
|
1055
|
+
resolveChannelLimitMb: ({ cfg: cfgLocal, accountId: accountIdLocal }) => (cfgLocal.channels?.googlechat)?.accounts?.[accountIdLocal]?.mediaMaxMb ?? (cfgLocal.channels?.googlechat)?.mediaMaxMb,
|
|
1056
|
+
accountId
|
|
1057
|
+
}) ?? (account.config.mediaMaxMb ?? 20) * 1024 * 1024;
|
|
1058
|
+
const loaded = /^https?:\/\//i.test(mediaUrl) ? await readRemoteMediaBuffer({
|
|
1059
|
+
url: mediaUrl,
|
|
1060
|
+
maxBytes: effectiveMaxBytes
|
|
1061
|
+
}) : await loadOutboundMediaFromUrl(mediaUrl, {
|
|
1062
|
+
maxBytes: effectiveMaxBytes,
|
|
1063
|
+
mediaAccess,
|
|
1064
|
+
mediaLocalRoots,
|
|
1065
|
+
mediaReadFile
|
|
1066
|
+
});
|
|
1067
|
+
const { sendGoogleChatMessage, uploadGoogleChatAttachment } = await loadGoogleChatChannelRuntime();
|
|
1068
|
+
const upload = await uploadGoogleChatAttachment({
|
|
1069
|
+
account,
|
|
1070
|
+
space,
|
|
1071
|
+
filename: loaded.fileName ?? "attachment",
|
|
1072
|
+
buffer: loaded.buffer,
|
|
1073
|
+
contentType: loaded.contentType
|
|
1074
|
+
});
|
|
1075
|
+
const messageId = (await sendGoogleChatMessage({
|
|
1076
|
+
account,
|
|
1077
|
+
space,
|
|
1078
|
+
text,
|
|
1079
|
+
thread,
|
|
1080
|
+
attachments: upload.attachmentUploadToken ? [{
|
|
1081
|
+
attachmentUploadToken: upload.attachmentUploadToken,
|
|
1082
|
+
contentName: loaded.fileName
|
|
1083
|
+
}] : void 0
|
|
1084
|
+
}))?.messageName ?? "";
|
|
1085
|
+
return {
|
|
1086
|
+
messageId,
|
|
1087
|
+
chatId: space,
|
|
1088
|
+
receipt: createGoogleChatSendReceipt({
|
|
1089
|
+
messageId,
|
|
1090
|
+
chatId: space,
|
|
1091
|
+
kind: "media"
|
|
1092
|
+
})
|
|
1093
|
+
};
|
|
1313
1094
|
}
|
|
1314
1095
|
}
|
|
1315
1096
|
};
|
|
@@ -1317,10 +1098,14 @@ const googlechatMessageAdapter = defineChannelMessageAdapter({
|
|
|
1317
1098
|
id: "googlechat",
|
|
1318
1099
|
durableFinal: { capabilities: {
|
|
1319
1100
|
text: true,
|
|
1101
|
+
media: true,
|
|
1320
1102
|
thread: true,
|
|
1321
1103
|
messageSendingHooks: true
|
|
1322
1104
|
} },
|
|
1323
|
-
send: {
|
|
1105
|
+
send: {
|
|
1106
|
+
text: googlechatOutboundAdapter.attachedResults.sendText,
|
|
1107
|
+
media: googlechatOutboundAdapter.attachedResults.sendMedia
|
|
1108
|
+
}
|
|
1324
1109
|
});
|
|
1325
1110
|
//#endregion
|
|
1326
|
-
export {
|
|
1111
|
+
export { readGoogleChatApprovalActionToken as A, verifyGoogleChatRequest as C, completeGoogleChatApprovalCardBinding as D, claimGoogleChatApprovalCardBinding as E, unregisterGoogleChatManualApprovalFollowupSuppression as F, registerGoogleChatManualApprovalFollowupSuppression as M, releaseGoogleChatApprovalCardBinding as N, createGoogleChatApprovalToken as O, unregisterGoogleChatApprovalCardBindings as P, uploadGoogleChatAttachment as S, buildGoogleChatApprovalActionParameters as T, downloadGoogleChatMedia as _, googlechatPairingTextAdapter as a, sendGoogleChatMessage as b, isGoogleChatGroupSpace as c, normalizeGoogleChatTarget as d, resolveGoogleChatOutboundSessionRoute as f, deleteGoogleChatReaction as g, deleteGoogleChatMessage as h, googlechatOutboundAdapter as i, registerGoogleChatApprovalCardBinding as j, getGoogleChatApprovalCardBinding as k, isGoogleChatSpaceTarget as l, createGoogleChatReaction as m, googlechatGroupsAdapter as n, googlechatSecurityAdapter as o, resolveGoogleChatOutboundSpace as p, googlechatMessageAdapter as r, googlechatThreadingAdapter as s, googlechatDirectoryAdapter as t, isGoogleChatUserTarget as u, listGoogleChatReactions as v, GOOGLECHAT_APPROVAL_ACTION as w, updateGoogleChatMessage as x, probeGoogleChat as y };
|