@openclaw/googlechat 2026.7.2-beta.7 → 2026.7.34
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-CBeHrXtL.js → .setup/approval-handler.runtime-DWNRBf9B.mjs} +5 -6
- package/dist/{channel-kouqKs2x.js → .setup/channel-BPjomke4.mjs} +87 -67
- package/dist/{channel-base-hw9ErEr5.js → .setup/channel-base-DJICAvKH.mjs} +91 -182
- package/dist/{channel.adapters-DaipaeYt.js → .setup/channel.adapters-T6wPzrpo.mjs} +170 -383
- package/dist/{channel.runtime-BbwE9vOC.js → .setup/channel.runtime-CpT-qT67.mjs} +241 -440
- 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/{google-auth-library/node_modules/gaxios → gaxios}/build/cjs/src/gaxios.js +1 -1
- package/node_modules/gaxios/build/cjs/src/gaxios.js.map +1 -0
- package/node_modules/{google-auth-library/node_modules/gaxios → gaxios}/build/cjs/test/test.getch.js +0 -66
- package/node_modules/gaxios/build/cjs/test/test.getch.js.map +1 -0
- package/node_modules/gaxios/build/cjs/tsconfig.cjs.tsbuildinfo +1 -0
- package/node_modules/{google-auth-library/node_modules/gaxios → gaxios}/build/esm/src/gaxios.js +1 -1
- package/node_modules/gaxios/build/esm/src/gaxios.js.map +1 -0
- package/node_modules/{google-auth-library/node_modules/gaxios → gaxios}/build/esm/test/test.getch.js +0 -66
- package/node_modules/gaxios/build/esm/test/test.getch.js.map +1 -0
- package/node_modules/gaxios/build/esm/tsconfig.tsbuildinfo +1 -0
- package/node_modules/{google-auth-library/node_modules/gaxios → gaxios}/package.json +4 -4
- package/node_modules/google-auth-library/build/src/auth/googleauth.js +19 -24
- package/node_modules/google-auth-library/package.json +1 -1
- package/openclaw.plugin.json +488 -416
- package/package.json +25 -82
- package/dist/actions-D81dCtkC.js +0 -68
- package/dist/approval-auth-ykO6i_ub.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/google-auth-library/node_modules/gaxios/build/cjs/src/gaxios.js.map +0 -1
- package/node_modules/google-auth-library/node_modules/gaxios/build/cjs/test/test.getch.js.map +0 -1
- package/node_modules/google-auth-library/node_modules/gaxios/build/cjs/tsconfig.cjs.tsbuildinfo +0 -1
- package/node_modules/google-auth-library/node_modules/gaxios/build/esm/src/gaxios.js.map +0 -1
- package/node_modules/google-auth-library/node_modules/gaxios/build/esm/test/test.getch.js.map +0 -1
- package/node_modules/google-auth-library/node_modules/gaxios/build/esm/tsconfig.tsbuildinfo +0 -1
- package/node_modules/google-auth-library/node_modules/gcp-metadata/node_modules/google-logging-utils/LICENSE +0 -202
- package/node_modules/google-auth-library/node_modules/gcp-metadata/node_modules/google-logging-utils/README.md +0 -73
- package/node_modules/google-auth-library/node_modules/gcp-metadata/node_modules/google-logging-utils/build/src/colours.d.ts +0 -1
- package/node_modules/google-auth-library/node_modules/gcp-metadata/node_modules/google-logging-utils/build/src/colours.js +0 -81
- package/node_modules/google-auth-library/node_modules/gcp-metadata/node_modules/google-logging-utils/build/src/colours.js.map +0 -1
- package/node_modules/google-auth-library/node_modules/gcp-metadata/node_modules/google-logging-utils/build/src/index.d.ts +0 -2
- package/node_modules/google-auth-library/node_modules/gcp-metadata/node_modules/google-logging-utils/build/src/index.js +0 -31
- package/node_modules/google-auth-library/node_modules/gcp-metadata/node_modules/google-logging-utils/build/src/index.js.map +0 -1
- package/node_modules/google-auth-library/node_modules/gcp-metadata/node_modules/google-logging-utils/build/src/logging-utils.d.ts +0 -89
- package/node_modules/google-auth-library/node_modules/gcp-metadata/node_modules/google-logging-utils/build/src/logging-utils.js +0 -414
- package/node_modules/google-auth-library/node_modules/gcp-metadata/node_modules/google-logging-utils/build/src/logging-utils.js.map +0 -1
- package/node_modules/google-auth-library/node_modules/gcp-metadata/node_modules/google-logging-utils/build/src/temporal.d.ts +0 -45
- package/node_modules/google-auth-library/node_modules/gcp-metadata/node_modules/google-logging-utils/build/src/temporal.js +0 -68
- package/node_modules/google-auth-library/node_modules/gcp-metadata/node_modules/google-logging-utils/build/src/temporal.js.map +0 -1
- package/node_modules/google-auth-library/node_modules/gcp-metadata/node_modules/google-logging-utils/build/src/types.d.ts +0 -78
- package/node_modules/google-auth-library/node_modules/gcp-metadata/node_modules/google-logging-utils/build/src/types.js +0 -16
- package/node_modules/google-auth-library/node_modules/gcp-metadata/node_modules/google-logging-utils/build/src/types.js.map +0 -1
- package/node_modules/google-auth-library/node_modules/gcp-metadata/node_modules/google-logging-utils/package.json +0 -47
- /package/node_modules/{google-auth-library/node_modules/gaxios → gaxios}/LICENSE +0 -0
- /package/node_modules/{google-auth-library/node_modules/gaxios → gaxios}/README.md +0 -0
- /package/node_modules/{google-auth-library/node_modules/gaxios → gaxios}/build/cjs/browser-test/browser-test-runner.d.ts +0 -0
- /package/node_modules/{google-auth-library/node_modules/gaxios → gaxios}/build/cjs/browser-test/browser-test-runner.js +0 -0
- /package/node_modules/{google-auth-library/node_modules/gaxios → gaxios}/build/cjs/browser-test/browser-test-runner.js.map +0 -0
- /package/node_modules/{google-auth-library/node_modules/gaxios → gaxios}/build/cjs/browser-test/test.browser.d.ts +0 -0
- /package/node_modules/{google-auth-library/node_modules/gaxios → gaxios}/build/cjs/browser-test/test.browser.js +0 -0
- /package/node_modules/{google-auth-library/node_modules/gaxios → gaxios}/build/cjs/browser-test/test.browser.js.map +0 -0
- /package/node_modules/{google-auth-library/node_modules/gaxios → gaxios}/build/cjs/src/common.d.ts +0 -0
- /package/node_modules/{google-auth-library/node_modules/gaxios → gaxios}/build/cjs/src/common.js +0 -0
- /package/node_modules/{google-auth-library/node_modules/gaxios → gaxios}/build/cjs/src/common.js.map +0 -0
- /package/node_modules/{google-auth-library/node_modules/gaxios → gaxios}/build/cjs/src/gaxios.d.ts +0 -0
- /package/node_modules/{google-auth-library/node_modules/gaxios → gaxios}/build/cjs/src/index.d.ts +0 -0
- /package/node_modules/{google-auth-library/node_modules/gaxios → gaxios}/build/cjs/src/index.js +0 -0
- /package/node_modules/{google-auth-library/node_modules/gaxios → gaxios}/build/cjs/src/index.js.map +0 -0
- /package/node_modules/{google-auth-library/node_modules/gaxios → gaxios}/build/cjs/src/interceptor.d.ts +0 -0
- /package/node_modules/{google-auth-library/node_modules/gaxios → gaxios}/build/cjs/src/interceptor.js +0 -0
- /package/node_modules/{google-auth-library/node_modules/gaxios → gaxios}/build/cjs/src/interceptor.js.map +0 -0
- /package/node_modules/{google-auth-library/node_modules/gaxios → gaxios}/build/cjs/src/retry.d.ts +0 -0
- /package/node_modules/{google-auth-library/node_modules/gaxios → gaxios}/build/cjs/src/retry.js +0 -0
- /package/node_modules/{google-auth-library/node_modules/gaxios → gaxios}/build/cjs/src/retry.js.map +0 -0
- /package/node_modules/{google-auth-library/node_modules/gaxios → gaxios}/build/cjs/src/util.cjs +0 -0
- /package/node_modules/{google-auth-library/node_modules/gaxios → gaxios}/build/cjs/src/util.cjs.map +0 -0
- /package/node_modules/{google-auth-library/node_modules/gaxios → gaxios}/build/cjs/src/util.d.cts +0 -0
- /package/node_modules/{google-auth-library/node_modules/gaxios → gaxios}/build/cjs/system-test/test.install.d.ts +0 -0
- /package/node_modules/{google-auth-library/node_modules/gaxios → gaxios}/build/cjs/system-test/test.install.js +0 -0
- /package/node_modules/{google-auth-library/node_modules/gaxios → gaxios}/build/cjs/system-test/test.install.js.map +0 -0
- /package/node_modules/{google-auth-library/node_modules/gaxios → gaxios}/build/cjs/test/test.getch.d.ts +0 -0
- /package/node_modules/{google-auth-library/node_modules/gaxios → gaxios}/build/cjs/test/test.index.d.ts +0 -0
- /package/node_modules/{google-auth-library/node_modules/gaxios → gaxios}/build/cjs/test/test.index.js +0 -0
- /package/node_modules/{google-auth-library/node_modules/gaxios → gaxios}/build/cjs/test/test.index.js.map +0 -0
- /package/node_modules/{google-auth-library/node_modules/gaxios → gaxios}/build/cjs/test/test.retry.d.ts +0 -0
- /package/node_modules/{google-auth-library/node_modules/gaxios → gaxios}/build/cjs/test/test.retry.js +0 -0
- /package/node_modules/{google-auth-library/node_modules/gaxios → gaxios}/build/cjs/test/test.retry.js.map +0 -0
- /package/node_modules/{google-auth-library/node_modules/gaxios → gaxios}/build/esm/browser-test/browser-test-runner.d.ts +0 -0
- /package/node_modules/{google-auth-library/node_modules/gaxios → gaxios}/build/esm/browser-test/browser-test-runner.js +0 -0
- /package/node_modules/{google-auth-library/node_modules/gaxios → gaxios}/build/esm/browser-test/browser-test-runner.js.map +0 -0
- /package/node_modules/{google-auth-library/node_modules/gaxios → gaxios}/build/esm/browser-test/test.browser.d.ts +0 -0
- /package/node_modules/{google-auth-library/node_modules/gaxios → gaxios}/build/esm/browser-test/test.browser.js +0 -0
- /package/node_modules/{google-auth-library/node_modules/gaxios → gaxios}/build/esm/browser-test/test.browser.js.map +0 -0
- /package/node_modules/{google-auth-library/node_modules/gaxios → gaxios}/build/esm/package.json +0 -0
- /package/node_modules/{google-auth-library/node_modules/gaxios → gaxios}/build/esm/src/common.d.ts +0 -0
- /package/node_modules/{google-auth-library/node_modules/gaxios → gaxios}/build/esm/src/common.js +0 -0
- /package/node_modules/{google-auth-library/node_modules/gaxios → gaxios}/build/esm/src/common.js.map +0 -0
- /package/node_modules/{google-auth-library/node_modules/gaxios → gaxios}/build/esm/src/gaxios.d.ts +0 -0
- /package/node_modules/{google-auth-library/node_modules/gaxios → gaxios}/build/esm/src/index.d.ts +0 -0
- /package/node_modules/{google-auth-library/node_modules/gaxios → gaxios}/build/esm/src/index.js +0 -0
- /package/node_modules/{google-auth-library/node_modules/gaxios → gaxios}/build/esm/src/index.js.map +0 -0
- /package/node_modules/{google-auth-library/node_modules/gaxios → gaxios}/build/esm/src/interceptor.d.ts +0 -0
- /package/node_modules/{google-auth-library/node_modules/gaxios → gaxios}/build/esm/src/interceptor.js +0 -0
- /package/node_modules/{google-auth-library/node_modules/gaxios → gaxios}/build/esm/src/interceptor.js.map +0 -0
- /package/node_modules/{google-auth-library/node_modules/gaxios → gaxios}/build/esm/src/retry.d.ts +0 -0
- /package/node_modules/{google-auth-library/node_modules/gaxios → gaxios}/build/esm/src/retry.js +0 -0
- /package/node_modules/{google-auth-library/node_modules/gaxios → gaxios}/build/esm/src/retry.js.map +0 -0
- /package/node_modules/{google-auth-library/node_modules/gaxios → gaxios}/build/esm/src/util.cjs +0 -0
- /package/node_modules/{google-auth-library/node_modules/gaxios → gaxios}/build/esm/src/util.cjs.map +0 -0
- /package/node_modules/{google-auth-library/node_modules/gaxios → gaxios}/build/esm/src/util.d.cts +0 -0
- /package/node_modules/{google-auth-library/node_modules/gaxios → gaxios}/build/esm/system-test/test.install.d.ts +0 -0
- /package/node_modules/{google-auth-library/node_modules/gaxios → gaxios}/build/esm/system-test/test.install.js +0 -0
- /package/node_modules/{google-auth-library/node_modules/gaxios → gaxios}/build/esm/system-test/test.install.js.map +0 -0
- /package/node_modules/{google-auth-library/node_modules/gaxios → gaxios}/build/esm/test/test.getch.d.ts +0 -0
- /package/node_modules/{google-auth-library/node_modules/gaxios → gaxios}/build/esm/test/test.index.d.ts +0 -0
- /package/node_modules/{google-auth-library/node_modules/gaxios → gaxios}/build/esm/test/test.index.js +0 -0
- /package/node_modules/{google-auth-library/node_modules/gaxios → gaxios}/build/esm/test/test.index.js.map +0 -0
- /package/node_modules/{google-auth-library/node_modules/gaxios → gaxios}/build/esm/test/test.retry.d.ts +0 -0
- /package/node_modules/{google-auth-library/node_modules/gaxios → gaxios}/build/esm/test/test.retry.js +0 -0
- /package/node_modules/{google-auth-library/node_modules/gaxios → gaxios}/build/esm/test/test.retry.js.map +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/agent-base/LICENSE +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/agent-base/README.md +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/agent-base/dist/helpers.d.ts +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/agent-base/dist/helpers.d.ts.map +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/agent-base/dist/helpers.js +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/agent-base/dist/helpers.js.map +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/agent-base/dist/index.d.ts +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/agent-base/dist/index.d.ts.map +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/agent-base/dist/index.js +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/agent-base/dist/index.js.map +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/agent-base/package.json +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/data-uri-to-buffer/README.md +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/data-uri-to-buffer/dist/index.d.ts +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/data-uri-to-buffer/dist/index.js +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/data-uri-to-buffer/dist/index.js.map +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/data-uri-to-buffer/package.json +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/data-uri-to-buffer/src/index.ts +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/debug/LICENSE +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/debug/README.md +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/debug/package.json +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/debug/src/browser.js +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/debug/src/common.js +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/debug/src/index.js +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/debug/src/node.js +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/extend/.editorconfig +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/extend/.eslintrc +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/extend/.jscs.json +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/extend/.travis.yml +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/extend/CHANGELOG.md +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/extend/LICENSE +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/extend/README.md +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/extend/component.json +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/extend/index.js +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/extend/package.json +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/fetch-blob/LICENSE +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/fetch-blob/README.md +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/fetch-blob/file.d.ts +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/fetch-blob/file.js +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/fetch-blob/from.d.ts +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/fetch-blob/from.js +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/fetch-blob/index.d.ts +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/fetch-blob/index.js +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/fetch-blob/package.json +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/fetch-blob/streams.cjs +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/formdata-polyfill/FormData.js +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/formdata-polyfill/LICENSE +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/formdata-polyfill/README.md +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/formdata-polyfill/esm.min.d.ts +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/formdata-polyfill/esm.min.js +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/formdata-polyfill/formdata-to-blob.js +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/formdata-polyfill/formdata.min.js +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/formdata-polyfill/package.json +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/https-proxy-agent/LICENSE +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/https-proxy-agent/README.md +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/https-proxy-agent/dist/index.d.ts +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/https-proxy-agent/dist/index.d.ts.map +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/https-proxy-agent/dist/index.js +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/https-proxy-agent/dist/index.js.map +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/https-proxy-agent/dist/parse-proxy-response.d.ts +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/https-proxy-agent/dist/parse-proxy-response.d.ts.map +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/https-proxy-agent/dist/parse-proxy-response.js +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/https-proxy-agent/dist/parse-proxy-response.js.map +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/https-proxy-agent/package.json +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/ms/index.js +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/ms/license.md +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/ms/package.json +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/ms/readme.md +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/node-domexception/LICENSE +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/node-domexception/index.js +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/node-domexception/package.json +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/node-fetch/@types/index.d.ts +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/node-fetch/LICENSE.md +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/node-fetch/README.md +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/node-fetch/package.json +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/node-fetch/src/body.js +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/node-fetch/src/errors/abort-error.js +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/node-fetch/src/errors/base.js +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/node-fetch/src/errors/fetch-error.js +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/node-fetch/src/headers.js +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/node-fetch/src/index.js +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/node-fetch/src/request.js +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/node-fetch/src/response.js +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/node-fetch/src/utils/get-search.js +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/node-fetch/src/utils/is-redirect.js +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/node-fetch/src/utils/is.js +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/node-fetch/src/utils/multipart-parser.js +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/node-fetch/src/utils/referrer.js +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/web-streams-polyfill/LICENSE +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/web-streams-polyfill/README.md +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/web-streams-polyfill/dist/polyfill.es2018.js +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/web-streams-polyfill/dist/polyfill.es2018.js.map +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/web-streams-polyfill/dist/polyfill.es2018.min.js +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/web-streams-polyfill/dist/polyfill.es2018.min.js.map +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/web-streams-polyfill/dist/polyfill.es2018.mjs +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/web-streams-polyfill/dist/polyfill.es2018.mjs.map +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/web-streams-polyfill/dist/polyfill.es6.js +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/web-streams-polyfill/dist/polyfill.es6.js.map +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/web-streams-polyfill/dist/polyfill.es6.min.js +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/web-streams-polyfill/dist/polyfill.es6.min.js.map +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/web-streams-polyfill/dist/polyfill.es6.mjs +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/web-streams-polyfill/dist/polyfill.es6.mjs.map +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/web-streams-polyfill/dist/polyfill.js +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/web-streams-polyfill/dist/polyfill.js.map +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/web-streams-polyfill/dist/polyfill.min.js +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/web-streams-polyfill/dist/polyfill.min.js.map +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/web-streams-polyfill/dist/polyfill.mjs +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/web-streams-polyfill/dist/polyfill.mjs.map +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/web-streams-polyfill/dist/ponyfill.es2018.js +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/web-streams-polyfill/dist/ponyfill.es2018.js.map +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/web-streams-polyfill/dist/ponyfill.es2018.mjs +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/web-streams-polyfill/dist/ponyfill.es2018.mjs.map +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/web-streams-polyfill/dist/ponyfill.es6.js +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/web-streams-polyfill/dist/ponyfill.es6.js.map +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/web-streams-polyfill/dist/ponyfill.es6.mjs +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/web-streams-polyfill/dist/ponyfill.es6.mjs.map +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/web-streams-polyfill/dist/ponyfill.js +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/web-streams-polyfill/dist/ponyfill.js.map +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/web-streams-polyfill/dist/ponyfill.mjs +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/web-streams-polyfill/dist/ponyfill.mjs.map +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/web-streams-polyfill/dist/types/polyfill.d.ts +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/web-streams-polyfill/dist/types/ponyfill.d.ts +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/web-streams-polyfill/dist/types/ts3.6/polyfill.d.ts +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/web-streams-polyfill/dist/types/ts3.6/ponyfill.d.ts +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/web-streams-polyfill/dist/types/tsdoc-metadata.json +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/web-streams-polyfill/es2018/package.json +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/web-streams-polyfill/es6/package.json +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/web-streams-polyfill/package.json +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/web-streams-polyfill/ponyfill/es2018/package.json +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/web-streams-polyfill/ponyfill/es6/package.json +0 -0
- /package/node_modules/{google-auth-library → gaxios}/node_modules/web-streams-polyfill/ponyfill/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,42 +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
|
-
const GOOGLE_CHAT_MEDIA_RESPONSE_MAX_BYTES = 20 * 1024 * 1024;
|
|
620
|
-
function resolveGoogleChatMediaTimeoutMs(maxBytes) {
|
|
621
|
-
if (!maxBytes) return GOOGLECHAT_MEDIA_MAX_TIMEOUT_MS;
|
|
622
|
-
const transferMs = Math.ceil(maxBytes / GOOGLECHAT_MEDIA_MIN_BYTES_PER_SECOND * 1e3);
|
|
623
|
-
return Math.min(GOOGLECHAT_MEDIA_TIMEOUT_GRACE_MS + transferMs, GOOGLECHAT_MEDIA_MAX_TIMEOUT_MS);
|
|
624
|
-
}
|
|
612
|
+
const CHAT_UPLOAD_BASE = "https://chat.googleapis.com/upload/v1";
|
|
625
613
|
async function readGoogleChatJsonResponse(response, label) {
|
|
626
|
-
|
|
627
|
-
chunkTimeoutMs: GOOGLECHAT_RESPONSE_READ_IDLE_TIMEOUT_MS,
|
|
628
|
-
onIdleTimeout: ({ chunkTimeoutMs }) => /* @__PURE__ */ new Error(`${label}: response body stalled after ${chunkTimeoutMs}ms`),
|
|
629
|
-
onOverflow: ({ maxBytes }) => /* @__PURE__ */ new Error(`${label}: JSON response exceeds ${maxBytes} bytes`)
|
|
630
|
-
});
|
|
631
|
-
try {
|
|
632
|
-
return JSON.parse(new TextDecoder().decode(bytes));
|
|
633
|
-
} catch (cause) {
|
|
634
|
-
throw new Error(`${label}: malformed JSON response`, { cause });
|
|
635
|
-
}
|
|
636
|
-
}
|
|
637
|
-
async function readGoogleChatErrorResponse(response, label) {
|
|
638
|
-
return await readResponseTextSnippet(response, {
|
|
639
|
-
maxBytes: GOOGLECHAT_ERROR_BODY_MAX_BYTES,
|
|
640
|
-
maxChars: GOOGLECHAT_ERROR_BODY_MAX_BYTES,
|
|
641
|
-
chunkTimeoutMs: GOOGLECHAT_RESPONSE_READ_IDLE_TIMEOUT_MS,
|
|
642
|
-
onIdleTimeout: ({ chunkTimeoutMs }) => /* @__PURE__ */ new Error(`${label} error response stalled after ${chunkTimeoutMs}ms`)
|
|
643
|
-
}) ?? "";
|
|
614
|
+
return readProviderJsonResponse(response, label);
|
|
644
615
|
}
|
|
645
616
|
const headersToObject = (headers) => headers instanceof Headers ? Object.fromEntries(headers.entries()) : Array.isArray(headers) ? Object.fromEntries(headers) : headers || {};
|
|
646
617
|
async function withGoogleChatResponse(params) {
|
|
647
|
-
const { account, url, init, auditContext, errorPrefix = "Google Chat API",
|
|
618
|
+
const { account, url, init, auditContext, errorPrefix = "Google Chat API", handleResponse } = params;
|
|
648
619
|
const token = await getGoogleChatAccessToken(account);
|
|
649
620
|
const { response, release } = await fetchWithSsrFGuard({
|
|
650
621
|
url,
|
|
@@ -655,17 +626,15 @@ async function withGoogleChatResponse(params) {
|
|
|
655
626
|
Authorization: `Bearer ${token}`
|
|
656
627
|
}
|
|
657
628
|
},
|
|
658
|
-
auditContext
|
|
659
|
-
timeoutMs
|
|
629
|
+
auditContext
|
|
660
630
|
});
|
|
661
631
|
try {
|
|
662
632
|
if (!response.ok) {
|
|
663
|
-
const text = await
|
|
633
|
+
const text = await readResponseTextLimited(response).catch(() => "");
|
|
664
634
|
throw new Error(`${errorPrefix} ${response.status}: ${text || response.statusText}`);
|
|
665
635
|
}
|
|
666
636
|
return await handleResponse(response);
|
|
667
637
|
} finally {
|
|
668
|
-
if (!response.bodyUsed) response.body?.cancel().catch(() => void 0);
|
|
669
638
|
await release();
|
|
670
639
|
}
|
|
671
640
|
}
|
|
@@ -699,31 +668,32 @@ async function fetchBuffer(account, url, init, options) {
|
|
|
699
668
|
url,
|
|
700
669
|
init,
|
|
701
670
|
auditContext: "googlechat.api.buffer",
|
|
702
|
-
timeoutMs: resolveGoogleChatMediaTimeoutMs(options?.maxBytes),
|
|
703
671
|
handleResponse: async (res) => {
|
|
704
|
-
const maxBytes = options?.maxBytes
|
|
672
|
+
const maxBytes = options?.maxBytes;
|
|
705
673
|
const lengthHeader = res.headers.get("content-length");
|
|
706
|
-
if (lengthHeader) {
|
|
674
|
+
if (maxBytes && lengthHeader) {
|
|
707
675
|
const length = parseMediaContentLength(lengthHeader);
|
|
708
676
|
if (length !== null && length > maxBytes) throw new Error(`Google Chat media exceeds max bytes (${maxBytes})`);
|
|
709
677
|
}
|
|
678
|
+
if (!maxBytes) return {
|
|
679
|
+
buffer: Buffer.from(await res.arrayBuffer()),
|
|
680
|
+
contentType: res.headers.get("content-type") ?? void 0
|
|
681
|
+
};
|
|
710
682
|
return {
|
|
711
|
-
buffer: await readResponseWithLimit(res, maxBytes, {
|
|
712
|
-
chunkTimeoutMs: GOOGLECHAT_RESPONSE_READ_IDLE_TIMEOUT_MS,
|
|
713
|
-
onOverflow: () => /* @__PURE__ */ new Error(`Google Chat media exceeds max bytes (${maxBytes})`)
|
|
714
|
-
}),
|
|
683
|
+
buffer: await readResponseWithLimit(res, maxBytes, { onOverflow: () => /* @__PURE__ */ new Error(`Google Chat media exceeds max bytes (${maxBytes})`) }),
|
|
715
684
|
contentType: res.headers.get("content-type") ?? void 0
|
|
716
685
|
};
|
|
717
686
|
}
|
|
718
687
|
});
|
|
719
688
|
}
|
|
720
689
|
async function sendGoogleChatMessage(params) {
|
|
721
|
-
const { account, space, text, thread, cardsV2 } = params;
|
|
722
|
-
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;
|
|
723
692
|
const body = {};
|
|
724
693
|
if (text) body.text = text;
|
|
725
694
|
if (cardsV2 && cardsV2.length > 0) body.cardsV2 = cardsV2;
|
|
726
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 } : {}));
|
|
727
697
|
const urlObj = new URL(`${CHAT_API_BASE}/${space}/messages`);
|
|
728
698
|
if (thread) urlObj.searchParams.set("messageReplyOption", "REPLY_MESSAGE_FALLBACK_TO_NEW_THREAD");
|
|
729
699
|
const result = await fetchJson(account, urlObj.toString(), {
|
|
@@ -752,10 +722,52 @@ async function deleteGoogleChatMessage(params) {
|
|
|
752
722
|
const { account, messageName } = params;
|
|
753
723
|
await fetchOk(account, `${CHAT_API_BASE}/${messageName}`, { method: "DELETE" });
|
|
754
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
|
+
}
|
|
755
750
|
async function downloadGoogleChatMedia(params) {
|
|
756
751
|
const { account, resourceName, maxBytes } = params;
|
|
757
752
|
return await fetchBuffer(account, `${CHAT_API_BASE}/media/${resourceName}?alt=media`, void 0, { maxBytes });
|
|
758
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
|
+
}
|
|
759
771
|
async function findGoogleChatDirectMessage(params) {
|
|
760
772
|
const { account, userName } = params;
|
|
761
773
|
const url = new URL(`${CHAT_API_BASE}/spaces:findDirectMessage`);
|
|
@@ -865,301 +877,18 @@ async function resolveGoogleChatOutboundSessionRoute(params) {
|
|
|
865
877
|
});
|
|
866
878
|
}
|
|
867
879
|
//#endregion
|
|
868
|
-
//#region extensions/googlechat/src/format.ts
|
|
869
|
-
const GOOGLE_CHAT_FORMAT_PROFILE = FormatCapabilityProfile.define({
|
|
870
|
-
mechanism: "markdown",
|
|
871
|
-
constructs: {
|
|
872
|
-
underline: "fallback",
|
|
873
|
-
spoiler: "fallback",
|
|
874
|
-
codeLanguage: "fallback",
|
|
875
|
-
heading: "fallback",
|
|
876
|
-
orderedList: "fallback",
|
|
877
|
-
taskList: "fallback",
|
|
878
|
-
table: "fallback",
|
|
879
|
-
image: "fallback",
|
|
880
|
-
mention: "strip"
|
|
881
|
-
},
|
|
882
|
-
chunk: {
|
|
883
|
-
limit: 32e3,
|
|
884
|
-
unit: "bytes"
|
|
885
|
-
}
|
|
886
|
-
});
|
|
887
|
-
const GOOGLE_CHAT_LITERAL_FALLBACKS = /* @__PURE__ */ new Map([
|
|
888
|
-
["*", "*"],
|
|
889
|
-
["_", "_"],
|
|
890
|
-
["~", "~"],
|
|
891
|
-
["`", "`"],
|
|
892
|
-
["<", "<"],
|
|
893
|
-
[">", ">"],
|
|
894
|
-
["\\", "\"],
|
|
895
|
-
["-", "-"],
|
|
896
|
-
["|", "|"]
|
|
897
|
-
]);
|
|
898
|
-
function createPrivateMarkerGenerator(text) {
|
|
899
|
-
const used = /* @__PURE__ */ new Set();
|
|
900
|
-
let candidate = 0;
|
|
901
|
-
const rangeSize = 6400;
|
|
902
|
-
return () => {
|
|
903
|
-
while (true) {
|
|
904
|
-
const marker = String.fromCharCode(57344 + Math.floor(candidate / rangeSize), 57344 + candidate % rangeSize);
|
|
905
|
-
candidate += 1;
|
|
906
|
-
if (!used.has(marker) && !text.includes(marker)) {
|
|
907
|
-
used.add(marker);
|
|
908
|
-
return marker;
|
|
909
|
-
}
|
|
910
|
-
}
|
|
911
|
-
};
|
|
912
|
-
}
|
|
913
|
-
function createGoogleChatMarkers(text) {
|
|
914
|
-
const nextMarker = createPrivateMarkerGenerator(text);
|
|
915
|
-
return {
|
|
916
|
-
list: nextMarker(),
|
|
917
|
-
blockquoteOpen: nextMarker(),
|
|
918
|
-
blockquoteClose: nextMarker()
|
|
919
|
-
};
|
|
920
|
-
}
|
|
921
|
-
/** Removes unsafe HTML and internal scaffolding while retaining source Markdown for chunking. */
|
|
922
|
-
function sanitizeGoogleChatText(text) {
|
|
923
|
-
return sanitizeForPlainText(sanitizeAssistantVisibleText(text), { style: "markdown" });
|
|
924
|
-
}
|
|
925
|
-
function projectDecodedGoogleChatResources(ir) {
|
|
926
|
-
const characters = ir.text.split("");
|
|
927
|
-
let changed = false;
|
|
928
|
-
for (const match of ir.text.matchAll(/<(?:users|customEmojis)\/[^<>\s]+>/giu)) {
|
|
929
|
-
const start = match.index ?? 0;
|
|
930
|
-
characters[start] = "<";
|
|
931
|
-
characters[start + match[0].length - 1] = ">";
|
|
932
|
-
changed = true;
|
|
933
|
-
}
|
|
934
|
-
return changed ? {
|
|
935
|
-
...ir,
|
|
936
|
-
text: characters.join("")
|
|
937
|
-
} : ir;
|
|
938
|
-
}
|
|
939
|
-
function projectGoogleChatLinkLabels(ir) {
|
|
940
|
-
const characters = ir.text.split("");
|
|
941
|
-
let changed = false;
|
|
942
|
-
for (const link of ir.links) {
|
|
943
|
-
const label = ir.text.slice(link.start, link.end);
|
|
944
|
-
const comparableHref = link.href.startsWith("mailto:") ? link.href.slice(7) : link.href;
|
|
945
|
-
if (label === link.href || label === comparableHref) continue;
|
|
946
|
-
for (let index = link.start; index < link.end; index += 1) {
|
|
947
|
-
const character = characters[index] ?? "";
|
|
948
|
-
const fallback = GOOGLE_CHAT_LITERAL_FALLBACKS.get(character);
|
|
949
|
-
if (fallback && /[<>|*_~`]/u.test(character)) {
|
|
950
|
-
characters[index] = fallback;
|
|
951
|
-
changed = true;
|
|
952
|
-
}
|
|
953
|
-
}
|
|
954
|
-
}
|
|
955
|
-
return changed ? {
|
|
956
|
-
...ir,
|
|
957
|
-
text: characters.join("")
|
|
958
|
-
} : ir;
|
|
959
|
-
}
|
|
960
|
-
function markGoogleChatBulletLists(ir, markerToken) {
|
|
961
|
-
let text = ir.text;
|
|
962
|
-
for (const item of ir.listItems ?? []) {
|
|
963
|
-
const marker = item.listMarker;
|
|
964
|
-
if (item.kind !== "bullet" || !marker || text.slice(marker.start, marker.end) !== "• ") continue;
|
|
965
|
-
text = `${text.slice(0, marker.start)}${markerToken}${text.slice(marker.end)}`;
|
|
966
|
-
}
|
|
967
|
-
return text === ir.text ? ir : {
|
|
968
|
-
...ir,
|
|
969
|
-
text
|
|
970
|
-
};
|
|
971
|
-
}
|
|
972
|
-
function projectUnsafeCodeFallbacks(ir) {
|
|
973
|
-
let text = ir.text;
|
|
974
|
-
const styles = ir.styles.filter((span) => {
|
|
975
|
-
const content = ir.text.slice(span.start, span.end);
|
|
976
|
-
const unsafe = span.style === "code" && content.includes("`") || span.style === "code_block" && content.includes("```");
|
|
977
|
-
if (unsafe) {
|
|
978
|
-
const replacement = content.split("").map((character) => GOOGLE_CHAT_LITERAL_FALLBACKS.get(character) ?? character).join("");
|
|
979
|
-
text = `${text.slice(0, span.start)}${replacement}${text.slice(span.end)}`;
|
|
980
|
-
}
|
|
981
|
-
return !unsafe;
|
|
982
|
-
});
|
|
983
|
-
return styles.length === ir.styles.length ? ir : {
|
|
984
|
-
...ir,
|
|
985
|
-
styles,
|
|
986
|
-
text
|
|
987
|
-
};
|
|
988
|
-
}
|
|
989
|
-
function projectGoogleChatPlainLiterals(ir) {
|
|
990
|
-
const codeRanges = ir.styles.filter((span) => span.style === "code" || span.style === "code_block");
|
|
991
|
-
const inCode = (index) => codeRanges.some((span) => index >= span.start && index < span.end);
|
|
992
|
-
const inLink = (index) => ir.links.some((span) => index >= span.start && index < span.end);
|
|
993
|
-
const styleDelimiter = /* @__PURE__ */ new Map([
|
|
994
|
-
["~", "strikethrough"],
|
|
995
|
-
["_", "italic"],
|
|
996
|
-
["*", "bold"],
|
|
997
|
-
["`", "code"]
|
|
998
|
-
]);
|
|
999
|
-
const characters = ir.text.split("");
|
|
1000
|
-
let lineStart = 0;
|
|
1001
|
-
while (lineStart < characters.length) {
|
|
1002
|
-
const nextNewline = characters.indexOf("\n", lineStart);
|
|
1003
|
-
const lineEnd = nextNewline < 0 ? characters.length : nextNewline;
|
|
1004
|
-
for (const delimiter of [
|
|
1005
|
-
"~",
|
|
1006
|
-
"_",
|
|
1007
|
-
"*",
|
|
1008
|
-
"`"
|
|
1009
|
-
]) {
|
|
1010
|
-
const indexes = [];
|
|
1011
|
-
for (let index = lineStart; index < lineEnd; index += 1) if (characters[index] === delimiter && !inCode(index) && !inLink(index)) indexes.push(index);
|
|
1012
|
-
if (indexes.length === 0) continue;
|
|
1013
|
-
const renderedStyle = styleDelimiter.get(delimiter);
|
|
1014
|
-
const lineAddsDelimiter = ir.styles.some((span) => span.style === renderedStyle && span.start < lineEnd && span.end > lineStart);
|
|
1015
|
-
if (indexes.length >= 2 || lineAddsDelimiter) for (const index of indexes) characters[index] = GOOGLE_CHAT_LITERAL_FALLBACKS.get(delimiter) ?? delimiter;
|
|
1016
|
-
}
|
|
1017
|
-
let firstTextIndex = lineStart;
|
|
1018
|
-
while (firstTextIndex < lineEnd && characters[firstTextIndex] === " ") firstTextIndex += 1;
|
|
1019
|
-
if (firstTextIndex >= lineStart && !inCode(firstTextIndex)) {
|
|
1020
|
-
const character = characters[firstTextIndex];
|
|
1021
|
-
if ((character === "*" || character === "-") && characters[firstTextIndex + 1] === " " || character === ">") characters[firstTextIndex] = GOOGLE_CHAT_LITERAL_FALLBACKS.get(character) ?? character;
|
|
1022
|
-
}
|
|
1023
|
-
const line = characters.slice(lineStart, lineEnd).join("");
|
|
1024
|
-
for (const match of line.matchAll(/<[^<>\n]*\|[^<>\n]*>/gu)) {
|
|
1025
|
-
const open = lineStart + (match.index ?? 0);
|
|
1026
|
-
const close = open + match[0].length - 1;
|
|
1027
|
-
if (!inCode(open) && !inCode(close) && !inLink(open) && !inLink(close)) {
|
|
1028
|
-
characters[open] = "<";
|
|
1029
|
-
characters[close] = ">";
|
|
1030
|
-
}
|
|
1031
|
-
}
|
|
1032
|
-
lineStart = lineEnd + 1;
|
|
1033
|
-
}
|
|
1034
|
-
const text = characters.join("");
|
|
1035
|
-
return text === ir.text ? ir : {
|
|
1036
|
-
...ir,
|
|
1037
|
-
text
|
|
1038
|
-
};
|
|
1039
|
-
}
|
|
1040
|
-
function emitGoogleChatLists(text, markerToken) {
|
|
1041
|
-
return text.split("\n").map((line) => {
|
|
1042
|
-
const markerIndex = line.indexOf(markerToken);
|
|
1043
|
-
if (markerIndex < 0) return line;
|
|
1044
|
-
const prefix = line.slice(0, markerIndex);
|
|
1045
|
-
const quote = /^(?:> )*/u.exec(prefix)?.[0] ?? "";
|
|
1046
|
-
const indent = prefix.slice(quote.length);
|
|
1047
|
-
return `${quote}${" ".repeat(indent.length * 2)}* ${line.slice(markerIndex + markerToken.length)}`;
|
|
1048
|
-
}).join("\n");
|
|
1049
|
-
}
|
|
1050
|
-
function emitGoogleChatBlockquotes(text, markers) {
|
|
1051
|
-
let depth = 0;
|
|
1052
|
-
let lineStart = true;
|
|
1053
|
-
let rendered = "";
|
|
1054
|
-
for (let index = 0; index < text.length; index += 1) {
|
|
1055
|
-
if (text.startsWith(markers.blockquoteOpen, index)) {
|
|
1056
|
-
depth += 1;
|
|
1057
|
-
index += markers.blockquoteOpen.length - 1;
|
|
1058
|
-
continue;
|
|
1059
|
-
}
|
|
1060
|
-
if (text.startsWith(markers.blockquoteClose, index)) {
|
|
1061
|
-
depth = Math.max(0, depth - 1);
|
|
1062
|
-
index += markers.blockquoteClose.length - 1;
|
|
1063
|
-
continue;
|
|
1064
|
-
}
|
|
1065
|
-
const character = text[index] ?? "";
|
|
1066
|
-
if (lineStart && depth > 0) rendered += "> ".repeat(depth);
|
|
1067
|
-
rendered += character;
|
|
1068
|
-
lineStart = character === "\n";
|
|
1069
|
-
}
|
|
1070
|
-
return rendered;
|
|
1071
|
-
}
|
|
1072
|
-
function prepareGoogleChatIR(text) {
|
|
1073
|
-
const ir = projectGoogleChatPlainLiterals(projectGoogleChatLinkLabels(projectDecodedGoogleChatResources(projectUnsafeCodeFallbacks(markdownToIR(sanitizeGoogleChatText(text), {
|
|
1074
|
-
enableSpoilers: true,
|
|
1075
|
-
enableTaskLists: true,
|
|
1076
|
-
headingStyle: "rich",
|
|
1077
|
-
tableMode: "bullets"
|
|
1078
|
-
})))));
|
|
1079
|
-
const markers = createGoogleChatMarkers(ir.text);
|
|
1080
|
-
return {
|
|
1081
|
-
ir: markGoogleChatBulletLists(ir, markers.list),
|
|
1082
|
-
markers
|
|
1083
|
-
};
|
|
1084
|
-
}
|
|
1085
|
-
function renderGoogleChatIR(ir, markers) {
|
|
1086
|
-
return emitGoogleChatLists(emitGoogleChatBlockquotes(renderMarkdownWithMarkers(ir, {
|
|
1087
|
-
styleMarkers: {
|
|
1088
|
-
bold: {
|
|
1089
|
-
open: "*",
|
|
1090
|
-
close: "*"
|
|
1091
|
-
},
|
|
1092
|
-
italic: {
|
|
1093
|
-
open: "_",
|
|
1094
|
-
close: "_"
|
|
1095
|
-
},
|
|
1096
|
-
strikethrough: {
|
|
1097
|
-
open: "~",
|
|
1098
|
-
close: "~"
|
|
1099
|
-
},
|
|
1100
|
-
code: {
|
|
1101
|
-
open: "`",
|
|
1102
|
-
close: "`"
|
|
1103
|
-
},
|
|
1104
|
-
code_block: {
|
|
1105
|
-
open: "```\n",
|
|
1106
|
-
close: "```"
|
|
1107
|
-
},
|
|
1108
|
-
blockquote: {
|
|
1109
|
-
open: markers.blockquoteOpen,
|
|
1110
|
-
close: markers.blockquoteClose
|
|
1111
|
-
}
|
|
1112
|
-
},
|
|
1113
|
-
escapeText: (value) => value,
|
|
1114
|
-
buildLink: (link, value, context) => {
|
|
1115
|
-
if (context.origin === "linkify") return null;
|
|
1116
|
-
const href = link.href.trim();
|
|
1117
|
-
const label = value.slice(link.start, link.end);
|
|
1118
|
-
if (!href || !label) return null;
|
|
1119
|
-
const labelHasStyles = ir.styles.some((span) => span.start < link.end && span.end > link.start);
|
|
1120
|
-
return /[<>|]/u.test(href) || /[<>|*_~`]/u.test(label) || labelHasStyles ? {
|
|
1121
|
-
start: link.start,
|
|
1122
|
-
end: link.end,
|
|
1123
|
-
open: "",
|
|
1124
|
-
close: ` (${href})`
|
|
1125
|
-
} : {
|
|
1126
|
-
start: link.start,
|
|
1127
|
-
end: link.end,
|
|
1128
|
-
open: `<${href}|`,
|
|
1129
|
-
close: ">"
|
|
1130
|
-
};
|
|
1131
|
-
}
|
|
1132
|
-
}, GOOGLE_CHAT_FORMAT_PROFILE), markers), markers.list);
|
|
1133
|
-
}
|
|
1134
|
-
/** Renders CommonMark into byte-bounded Google Chat app-message chunks. */
|
|
1135
|
-
function formatGoogleChatTextChunks(text, limit = GOOGLE_CHAT_FORMAT_PROFILE.chunk.limit) {
|
|
1136
|
-
const prepared = prepareGoogleChatIR(text);
|
|
1137
|
-
return renderMarkdownIRChunksWithinLimit({
|
|
1138
|
-
ir: prepared.ir,
|
|
1139
|
-
limit: Math.min(limit, GOOGLE_CHAT_FORMAT_PROFILE.chunk.limit),
|
|
1140
|
-
measureRendered: (rendered) => new TextEncoder().encode(rendered).byteLength,
|
|
1141
|
-
renderChunk: (chunk) => renderGoogleChatIR(chunk, prepared.markers)
|
|
1142
|
-
}).map((chunk) => chunk.rendered);
|
|
1143
|
-
}
|
|
1144
|
-
//#endregion
|
|
1145
880
|
//#region extensions/googlechat/src/group-policy.ts
|
|
1146
|
-
function buildGoogleChatGroupPolicyScope(params) {
|
|
1147
|
-
const matchKey = params.groupId && Object.hasOwn(params.tree.scopes, params.groupId) ? params.groupId : void 0;
|
|
1148
|
-
return {
|
|
1149
|
-
tree: params.tree,
|
|
1150
|
-
path: matchKey ? [matchKey] : [],
|
|
1151
|
-
matchKey
|
|
1152
|
-
};
|
|
1153
|
-
}
|
|
1154
881
|
function resolveGoogleChatGroupRequireMention(params) {
|
|
1155
|
-
return
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
882
|
+
return resolveChannelGroupRequireMention({
|
|
883
|
+
cfg: params.cfg,
|
|
884
|
+
channel: "googlechat",
|
|
885
|
+
groupId: params.groupId,
|
|
886
|
+
accountId: params.accountId
|
|
887
|
+
});
|
|
1159
888
|
}
|
|
1160
889
|
//#endregion
|
|
1161
890
|
//#region extensions/googlechat/src/channel.adapters.ts
|
|
1162
|
-
const loadGoogleChatChannelRuntime = createLazyRuntimeNamedExport(() => import("./channel.runtime-
|
|
891
|
+
const loadGoogleChatChannelRuntime = createLazyRuntimeNamedExport(() => import("./channel.runtime-CpT-qT67.mjs"), "googleChatChannelRuntime");
|
|
1163
892
|
function createGoogleChatSendReceipt(params) {
|
|
1164
893
|
const messageId = params.messageId?.trim();
|
|
1165
894
|
return createMessageReceiptFromOutboundResults({
|
|
@@ -1173,7 +902,7 @@ function createGoogleChatSendReceipt(params) {
|
|
|
1173
902
|
kind: params.kind
|
|
1174
903
|
});
|
|
1175
904
|
}
|
|
1176
|
-
const
|
|
905
|
+
const collectGoogleChatGroupPolicyWarnings = createAllowlistProviderOpenWarningCollector({
|
|
1177
906
|
providerConfigPresent: (cfg) => cfg.channels?.googlechat !== void 0,
|
|
1178
907
|
resolveGroupPolicy: (account) => account.config.groupPolicy,
|
|
1179
908
|
buildOpenWarning: {
|
|
@@ -1181,13 +910,14 @@ const collectGoogleChatSecurityWarnings = composeAccountWarningCollectors(create
|
|
|
1181
910
|
openBehavior: "allows any space to trigger (mention-gated)",
|
|
1182
911
|
remediation: "Set channels.googlechat.groupPolicy=\"allowlist\" and configure channels.googlechat.groups"
|
|
1183
912
|
}
|
|
1184
|
-
})
|
|
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\".");
|
|
1185
915
|
const googlechatGroupsAdapter = { resolveRequireMention: resolveGoogleChatGroupRequireMention };
|
|
1186
916
|
const googlechatDirectoryAdapter = createChannelDirectoryAdapter({
|
|
1187
917
|
listPeers: async (params) => listResolvedDirectoryUserEntriesFromAllowFrom({
|
|
1188
918
|
...params,
|
|
1189
919
|
resolveAccount: adaptScopedAccountAccessor(resolveGoogleChatAccount),
|
|
1190
|
-
resolveAllowFrom: (account) => account.config.allowFrom,
|
|
920
|
+
resolveAllowFrom: (account) => account.config.dm?.allowFrom,
|
|
1191
921
|
normalizeId: (entry) => normalizeGoogleChatTarget(entry) ?? entry
|
|
1192
922
|
}),
|
|
1193
923
|
listGroups: async (params) => listResolvedDirectoryGroupEntriesFromMapKeys({
|
|
@@ -1199,9 +929,9 @@ const googlechatDirectoryAdapter = createChannelDirectoryAdapter({
|
|
|
1199
929
|
const googlechatSecurityAdapter = {
|
|
1200
930
|
dm: {
|
|
1201
931
|
channelKey: "googlechat",
|
|
1202
|
-
resolvePolicy: (account) => account.config.
|
|
1203
|
-
resolveAllowFrom: (account) => account.config.allowFrom,
|
|
1204
|
-
allowFromPathSuffix: "",
|
|
932
|
+
resolvePolicy: (account) => account.config.dm?.policy,
|
|
933
|
+
resolveAllowFrom: (account) => account.config.dm?.allowFrom,
|
|
934
|
+
allowFromPathSuffix: "dm.",
|
|
1205
935
|
normalizeEntry: (raw) => formatGoogleChatAllowFromEntry(raw)
|
|
1206
936
|
},
|
|
1207
937
|
collectWarnings: collectGoogleChatSecurityWarnings
|
|
@@ -1239,7 +969,7 @@ const googlechatPairingTextAdapter = {
|
|
|
1239
969
|
cfg,
|
|
1240
970
|
accountId
|
|
1241
971
|
});
|
|
1242
|
-
if (account.credentialSource === "none"
|
|
972
|
+
if (account.credentialSource === "none") return;
|
|
1243
973
|
const user = normalizeGoogleChatTarget(id) ?? id;
|
|
1244
974
|
const space = await resolveGoogleChatOutboundSpace({
|
|
1245
975
|
account,
|
|
@@ -1256,10 +986,10 @@ const googlechatPairingTextAdapter = {
|
|
|
1256
986
|
const googlechatOutboundAdapter = {
|
|
1257
987
|
base: {
|
|
1258
988
|
deliveryMode: "direct",
|
|
1259
|
-
chunker:
|
|
989
|
+
chunker: chunkTextForOutbound,
|
|
1260
990
|
chunkerMode: "markdown",
|
|
1261
|
-
textChunkLimit:
|
|
1262
|
-
sanitizeText: ({ text }) =>
|
|
991
|
+
textChunkLimit: 4e3,
|
|
992
|
+
sanitizeText: ({ text }) => sanitizeForPlainText(sanitizeAssistantVisibleText(text)),
|
|
1263
993
|
normalizePayload: ({ payload }) => shouldSuppressGoogleChatManualExecApprovalFollowupPayload(payload) ? null : payload,
|
|
1264
994
|
resolveTarget: ({ to }) => {
|
|
1265
995
|
const trimmed = normalizeOptionalString(to) ?? "";
|
|
@@ -1308,6 +1038,59 @@ const googlechatOutboundAdapter = {
|
|
|
1308
1038
|
kind: "text"
|
|
1309
1039
|
})
|
|
1310
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
|
+
};
|
|
1311
1094
|
}
|
|
1312
1095
|
}
|
|
1313
1096
|
};
|
|
@@ -1315,10 +1098,14 @@ const googlechatMessageAdapter = defineChannelMessageAdapter({
|
|
|
1315
1098
|
id: "googlechat",
|
|
1316
1099
|
durableFinal: { capabilities: {
|
|
1317
1100
|
text: true,
|
|
1101
|
+
media: true,
|
|
1318
1102
|
thread: true,
|
|
1319
1103
|
messageSendingHooks: true
|
|
1320
1104
|
} },
|
|
1321
|
-
send: {
|
|
1105
|
+
send: {
|
|
1106
|
+
text: googlechatOutboundAdapter.attachedResults.sendText,
|
|
1107
|
+
media: googlechatOutboundAdapter.attachedResults.sendMedia
|
|
1108
|
+
}
|
|
1322
1109
|
});
|
|
1323
1110
|
//#endregion
|
|
1324
|
-
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 };
|