跳到正文Skip to content
Agent J Beta
菜单Menu
中文EN
登录Sign in

搜索文档和页面Search docs and pages

文档Docs

连接 Google:邮件、日历、云盘、YouTubeConnect Google: Gmail, Calendar, Drive, YouTube

Agent J 预装固定版本的 Google 工具;网页登录和接口授权分开检查;用你自己的 Google 项目授权的一键引导在 0.18.1 提供。Agent J pre-installs a pinned Google tool; website sign-in and API authorization are checked separately; guided authorization with your own Google project arrives in 0.18.1.

告诉 Agent J「帮我连接 Gmail、日历和 YouTube」。它先分别检查两件事:电脑浏览器里有没有登录 Google 网页,以及 Google 接口(API)有没有授权。这两件事互不代替:Gmail 网页登录了,不等于 Agent 可以用邮件接口;接口授权了,也不会替你登录 YouTube Studio 网页。

这一版已经有的

  • Google 工具预装:Agent J 会在后台装好一个固定版本的 Google 命令行工具(gog),只放在 Agent J 自己的目录里,下载后逐字节校验。装不上不影响绑定、配对和聊天。它不会碰你电脑上已有的 gog、gcloud 或 gws,也不读取它们保存的授权。
  • 只读状态:Agent 运行 agentj google status 查看工具是否就绪,以及电脑上原来有哪些 Google 工具(只看是否存在,不读内容)。
  • 按用途列权限:读邮件、代发邮件、看日历、写日历、云盘里它建或你选的文件、YouTube 上传与读回、Search Console 只读。每个用途只申请需要的最小权限,从不默认申请「全部」。
  • 不用就关掉:说「我不用 Google 工具」,Agent 运行 agentj google off,只删掉 Agent J 自己的那份工具;以后想用再说一声。

0.18.1 会加上的

接口授权的一键引导:在你自己的 Google 项目里开通所需接口、建好桌面客户端,把应用设为 In production(正式发布),避免测试模式下授权 7 天就过期。这不是 Google 的应用验证;你仍会看到「Google 尚未验证此应用」。授权保存在电脑的系统钥匙串里,每天自动复查一次。

在那之前,Agent 会如实告诉你接口授权要等 0.18.1,不会用临时拼凑的命令替你走授权流程。

你自己做的事

  • 在电脑的正式 Google 登录页登录、完成两步验证、阅读并接受 Google Cloud 条款。
  • 看到「Google 尚未验证此应用」时,先确认这是你自己刚建的应用、用途和权限都对,再按页面提示选「高级」→「继续」。Agent 不会替你点这个继续,也不会提交 Google 验证(Submit for verification)。
  • 不要把密码、授权码、回调网址或 client JSON 发到聊天里。Agent 也不会向你要。

授权以后

授权不等于可以发信或发布:每次发送邮件、上传视频,仍按具体事项在手机上请你批准。YouTube 发布使用标准 Data API,可以私享上传并预约公开;到点后 Agent 会读回状态,确认真的公开了才报告已发布。如果视频被 Google 锁成私享,通常要通过 YouTube 网页或合格客户端重新上传,不能保证在 Studio 里直接改成公开。配额以你项目的 Google Cloud 控制台为准。

授权可能因为你撤销访问、修改 Gmail 密码、长期不用或组织策略而失效;晨间检查会提示重新授权,影响只限于依赖 Google 的任务,其他工作照常。

复制给主 Agent:

请只为我需要的 Google 用途准备本机授权。用我自己的项目,先说明建置计划和实际权限;Google 登录和风险提示由我自己确认。凭据不进聊天。网页登录和接口授权分开检查;授权成功也不要直接发信或发布。

技术细节
  • 工具:gog 0.43.0(openclaw/gogcli,MIT),按平台固定 SHA-256,先从 agentj.app 下载、再回退 GitHub;只解出唯一一个可执行文件,独立的 GOG_HOME,不继承任何 Google 令牌环境变量。
  • 命令:agentj google status、check、install、on、off,agentj google plan --purpose gmail-read --purpose youtube-publish 只显示计划,不执行任何操作。
  • 存放:本机状态目录的 google/(只有你自己的用户能读写),不上传云端,不进入对话和日志。

Tell Agent J "Connect Gmail, Calendar and YouTube." It checks two things separately: whether you are signed in to Google's websites in the computer's browser, and whether Google's APIs are authorized. Neither replaces the other. Signing in to Gmail does not let the Agent use the Gmail API, and API authorization does not sign you in to YouTube Studio.

In this version

  • Google tool pre-installed: Agent J installs one pinned Google command-line tool (gog) in the background, inside Agent J's own folder, checked byte for byte after download. If it fails, binding, pairing and chat are unaffected. It never touches a gog, gcloud or gws you already have, and never reads their saved authorization.
  • Read-only status: your Agent runs agentj google status to see whether the tool is ready and which Google tools were already on the computer (presence only, contents never read).
  • Permissions per purpose: read mail, send mail, read calendar, write calendar events, Drive files it creates or you pick, YouTube upload and read-back, Search Console read-only. Each purpose asks for the smallest permission it needs, never "everything".
  • Off if you don't need it: say "I won't use Google tools" and your Agent runs agentj google off, which removes only Agent J's own copy. Turn it back on any time.

Coming in 0.18.1

Guided API authorization: enable the needed APIs in your own Google project, create a desktop client, and set the app to In production, which avoids the seven-day expiry of Testing mode. This is not Google verification; you will still see Google's unverified-app warning. Authorization is stored in the computer's system keychain and checked once a day.

Until then your Agent tells you plainly that API authorization arrives in 0.18.1. It does not improvise an authorization flow with ad-hoc commands.

What you do yourself

  • Sign in on Google's real sign-in page on the computer, complete two-step verification, and read and accept the Google Cloud terms.
  • On "Google hasn't verified this app", check that it is the app you just created and that the purposes and permissions are right, then follow Google's Advanced → Continue. Your Agent never clicks that for you and never submits the app for Google verification (Submit for verification).
  • Never paste passwords, authorization codes, callback URLs or client JSON into chat. Your Agent will not ask for them.

After authorization

Authorization does not permit sending or publishing: every email sent and every video uploaded still asks for its own approval on your phone. YouTube uses the standard Data API and can upload privately with a scheduled publish time; after that time your Agent reads the status back and only reports "published" when it is actually public. If Google locks a video as private, re-uploading through YouTube's website or an eligible client is usually needed; changing visibility in Studio is not a guaranteed fix. Your project's quotas in the Google Cloud console apply.

Authorization can end if you revoke access, change your Gmail password, leave it unused for a long time, or an organization policy intervenes. The morning check says when to reauthorize; only Google tasks wait, everything else continues.

Copy to your main Agent:

Prepare local authorization for only the Google purposes I need. Use my own project and explain the setup plan and the actual permissions first; I confirm Google sign-in and risk warnings myself. Keep credentials out of chat. Check website sign-in and API authorization separately, and do not send or publish just because authorization succeeded.

Technical details
  • Tool: gog 0.43.0 (openclaw/gogcli, MIT), SHA-256 pinned per platform, downloaded from agentj.app first and GitHub second; only the single executable is extracted, with its own GOG_HOME and no inherited Google token variables.
  • Commands: agentj google status, check, install, on, off; agentj google plan --purpose gmail-read --purpose youtube-publish shows a plan and executes nothing.
  • Storage: google/ in the local state folder (readable only by your user), never uploaded, never in chat or logs.

这一页的 Markdown 原文This page as Markdown: zh.md · en.md