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