词元之母TOK.MOM - 平台充值汇率 1:1 即 1 人民币充值到账 1 美元,支持一个 Key 调用近 600+ 海内外模型,限时特价模型低至 1 折,欢迎上岸!
| 来源 | 内置(默认安装) |
| 路径 | skills/productivity/google-workspace |
| 版本 | 1.1.0 |
| 作者 | Nous Research |
| 许可证 | MIT |
| 平台 | linux, macos, windows |
| 标签 | Google, Gmail, Calendar, Drive, Sheets, Docs, Contacts, Email, OAuth |
| 相关 skill | himalaya |
gws,该 skill 将以其作为执行后端以获得更广泛的 Google Workspace 覆盖;否则回退到内置的 Python 客户端实现。references/gmail-search-syntax.md —— Gmail 搜索运算符(is:unread、from:、newer_than: 等)scripts/setup.py —— OAuth2 设置(运行一次以完成授权)scripts/google_api.py —— 兼容性封装 CLI。在可用时优先使用 gws 执行操作,同时保留 Hermes 现有的 JSON 输出契约。AUTHENTICATED,跳至「使用方法」—— 设置已完成。himalaya skill —— 它通过 Gmail 应用专用密码(设置 → 安全 → 应用专用密码)工作,2 分钟即可完成设置,无需 Google Cloud 项目。加载 himalaya skill 并按其设置说明操作。--services email,calendar,使同意界面仅请求实际需要的权限范围(scope)。--services 集合,如 calendar,drive,sheets,docs。all 服务集合。你需要一个 Google Cloud OAuth 客户端。这是一次性设置: 2.在 API 库中启用所需 API:
https://console.cloud.google.com/apis/library
启用:Gmail API、Google Calendar API、Google Drive API、
Google Sheets API、Google Docs API、People API3.在此处创建 OAuth 客户端:
https://console.cloud.google.com/apis/credentials
凭据 → 创建凭据 → OAuth 2.0 客户端 ID4.应用类型选择「桌面应用」→ 创建 5.若应用仍处于测试状态,在此处将用户的 Google 账号添加为测试用户:
https://console.cloud.google.com/auth/audience
受众群体 → 测试用户 → 添加用户6.下载 JSON 文件并告诉我文件路径 Hermes CLI 重要提示:若文件路径以 /开头,请勿在 CLI 中单独发送该裸路径,因为它可能被误识别为斜杠命令。请将其放在句子中发送,例如:The JSON file path is: /home/user/Downloads/client_secret_....json
~/Downloads/hermes-google-client-secret.json),然后对该文件运行 --client-secret。auth_url 字段的 JSON,并将该 URL 保存至 ~/.hermes/google_oauth_last_url.txt。auth_url 字段,将该确切 URL 以单行形式发送给用户。http://localhost:1 上失败,这是预期行为。Error 403: access_denied,直接将其引导至 https://console.cloud.google.com/auth/audience 以添加自己为测试用户。http://localhost:1/?code=4/0A...&scope=... 的 URL 或仅粘贴授权码字符串,两者均可。--auth-url 步骤会在本地存储一个临时待处理的 OAuth 会话,以便 --auth-code 稍后完成 PKCE 交换,即使在无头系统上也可正常工作:--auth-code 因授权码过期、已被使用或来自旧浏览器标签页而失败,它现在会返回一个新的 fresh_auth_url。在这种情况下,立即将新 URL 发送给用户, 并让其仅使用最新的浏览器重定向重试。AUTHENTICATED。设置完成 —— 此后 token(令牌)将自动刷新。~/.hermes/google_token.json,自动刷新。~/.hermes/google_oauth_pending.json,直至交换完成。gws,google_api.py 会将其指向同一个 ~/.hermes/google_token.json 凭据文件。用户无需单独运行 gws auth login 流程。$GSETUP --revokeGAPI 设为简写:jq 解析或直接读取。关键字段:[{id, threadId, from, to, subject, date, snippet, labels}]{id, threadId, from, to, subject, date, labels, body}{status: "sent", id, threadId}[{id, summary, start, end, location, description, htmlLink}]{status: "created", id, summary, htmlLink}[{id, name, mimeType, modifiedTime, webViewLink}]{id, name, mimeType, modifiedTime, size, webViewLink, parents, owners}{status: "uploaded", id, name, mimeType, webViewLink}{status: "downloaded", id, name, path, mimeType}{status: "created", id, name, webViewLink}{status: "shared", permissionId, fileId, role, type}{status: "trashed" | "deleted", fileId, permanent}[{name, emails: [...], phones: [...]}][[cell, cell, ...], ...]{status: "created", spreadsheetId, title, spreadsheetUrl}{status: "created", documentId, title, url}{status: "appended", documentId, inserted_at, characters}drive delete,优先使用默认的回收站(可恢复)而非 --permanent。setup.py --check。若失败,引导用户完成设置。skill_view("google-workspace", file_path="references/gmail-search-syntax.md") 加载。2026-03-01T10:00:00-06:00)或 UTC(Z)。| 问题 | 解决方法 |
|---|---|
NOT_AUTHENTICATED | 执行上述设置步骤 2-5 |
REFRESH_FAILED | Token 已被撤销或过期 —— 重新执行步骤 3-5 |
HttpError 403: Insufficient Permission | 缺少 API scope —— $GSETUP --revoke 后重新执行步骤 3-5 |
AUTHENTICATED (partial) 或「Token missing scopes」 | 新的写入功能(Drive 写入/删除、Docs 创建/编辑)需要重新授权。$GSETUP --revoke 后重新执行步骤 3-5 以授予升级后的 scope。 |
HttpError 403: Access Not Configured | API 未启用 —— 用户需在 Google Cloud Console 中启用 |
ModuleNotFoundError | 运行 $GSETUP --install-deps |
| 高级保护阻止授权 | Workspace 管理员必须将 OAuth 客户端 ID 加入白名单 |