mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-16 04:22:36 +00:00
feat(google-workspace): Drive write ops + Docs/Sheets create/append (#21895)
Expand the google-workspace skill beyond read-only access to Drive and Docs. Sheets already had full scope — just adds the missing create verb. New subcommands: - drive get : metadata for a single file - drive upload : upload a local file (auto MIME detection) - drive download : download or export (Docs/Sheets/Slides export to pdf/csv/pdf by default) - drive create-folder - drive share : user/group/domain/anyone + reader/writer/etc. - drive delete : default trashes (reversible); --permanent skips the trash - sheets create : new spreadsheet with optional first-tab name - docs create : new doc, optional initial body - docs append : append text at end of an existing doc Scope changes: - drive.readonly -> drive - documents.readonly -> documents Existing users with old tokens will hit the existing partial-scope warning path (AUTHENTICATED (partial) ...) — the troubleshooting table now points them at $GSETUP --revoke + redo steps 3-5 to pick up the write scopes.
This commit is contained in:
parent
674fad1483
commit
e43d2fe520
3 changed files with 415 additions and 6 deletions
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
name: google-workspace
|
||||
description: "Gmail, Calendar, Drive, Docs, Sheets via gws CLI or Python."
|
||||
version: 1.0.1
|
||||
version: 1.1.0
|
||||
author: Nous Research
|
||||
license: MIT
|
||||
required_credential_files:
|
||||
|
|
@ -216,8 +216,36 @@ $GAPI calendar delete EVENT_ID
|
|||
### Drive
|
||||
|
||||
```bash
|
||||
# Search existing files
|
||||
$GAPI drive search "quarterly report" --max 10
|
||||
$GAPI drive search "mimeType='application/pdf'" --raw-query --max 5
|
||||
|
||||
# Get metadata for a single file
|
||||
$GAPI drive get FILE_ID
|
||||
|
||||
# Upload a local file (auto-detects MIME type)
|
||||
$GAPI drive upload /path/to/report.pdf
|
||||
$GAPI drive upload /path/to/image.png --name "Logo.png" --parent FOLDER_ID
|
||||
|
||||
# Download (binary files download as-is; Google-native files export to a
|
||||
# sensible default — Docs→pdf, Sheets→csv, Slides→pdf, Drawings→png)
|
||||
$GAPI drive download FILE_ID
|
||||
$GAPI drive download DOC_ID --output ~/doc.pdf
|
||||
$GAPI drive download DOC_ID --export-mime text/plain --output ~/doc.txt
|
||||
|
||||
# Create a folder
|
||||
$GAPI drive create-folder "Reports"
|
||||
$GAPI drive create-folder "Q4" --parent FOLDER_ID
|
||||
|
||||
# Share
|
||||
$GAPI drive share FILE_ID --email alice@example.com --role reader
|
||||
$GAPI drive share FILE_ID --email alice@example.com --role writer --notify
|
||||
$GAPI drive share FILE_ID --type anyone --role reader # anyone with link
|
||||
$GAPI drive share FILE_ID --type domain --domain example.com --role reader
|
||||
|
||||
# Delete — defaults to trash (reversible). Use --permanent to skip the trash.
|
||||
$GAPI drive delete FILE_ID
|
||||
$GAPI drive delete FILE_ID --permanent
|
||||
```
|
||||
|
||||
### Contacts
|
||||
|
|
@ -229,6 +257,10 @@ $GAPI contacts list --max 20
|
|||
### Sheets
|
||||
|
||||
```bash
|
||||
# Create a new spreadsheet
|
||||
$GAPI sheets create --title "Q4 Budget"
|
||||
$GAPI sheets create --title "Inventory" --sheet-name "Stock"
|
||||
|
||||
# Read
|
||||
$GAPI sheets get SHEET_ID "Sheet1!A1:D10"
|
||||
|
||||
|
|
@ -242,7 +274,15 @@ $GAPI sheets append SHEET_ID "Sheet1!A:C" --values '[["new","row","data"]]'
|
|||
### Docs
|
||||
|
||||
```bash
|
||||
# Read
|
||||
$GAPI docs get DOC_ID
|
||||
|
||||
# Create a new Doc (optionally seeded with body text)
|
||||
$GAPI docs create --title "Meeting Notes"
|
||||
$GAPI docs create --title "Draft" --body "First paragraph..."
|
||||
|
||||
# Append text to the end of an existing Doc
|
||||
$GAPI docs append DOC_ID --text "Additional content to append"
|
||||
```
|
||||
|
||||
## Output Format
|
||||
|
|
@ -255,12 +295,21 @@ All commands return JSON. Parse with `jq` or read directly. Key fields:
|
|||
- **Calendar list**: `[{id, summary, start, end, location, description, htmlLink}]`
|
||||
- **Calendar create**: `{status: "created", id, summary, htmlLink}`
|
||||
- **Drive search**: `[{id, name, mimeType, modifiedTime, webViewLink}]`
|
||||
- **Drive get**: `{id, name, mimeType, modifiedTime, size, webViewLink, parents, owners}`
|
||||
- **Drive upload**: `{status: "uploaded", id, name, mimeType, webViewLink}`
|
||||
- **Drive download**: `{status: "downloaded", id, name, path, mimeType}`
|
||||
- **Drive create-folder**: `{status: "created", id, name, webViewLink}`
|
||||
- **Drive share**: `{status: "shared", permissionId, fileId, role, type}`
|
||||
- **Drive delete**: `{status: "trashed" | "deleted", fileId, permanent}`
|
||||
- **Contacts list**: `[{name, emails: [...], phones: [...]}]`
|
||||
- **Sheets get**: `[[cell, cell, ...], ...]`
|
||||
- **Sheets create**: `{status: "created", spreadsheetId, title, spreadsheetUrl}`
|
||||
- **Docs create**: `{status: "created", documentId, title, url}`
|
||||
- **Docs append**: `{status: "appended", documentId, inserted_at, characters}`
|
||||
|
||||
## Rules
|
||||
|
||||
1. **Never send email or create/delete events without confirming with the user first.** Show the draft content and ask for approval.
|
||||
1. **Never send email, create/delete calendar events, delete Drive files, share files, or modify Docs/Sheets without confirming with the user first.** Show what will be done (recipients, file IDs, content, share role) and ask for approval. For `drive delete`, prefer the default trash (reversible) over `--permanent`.
|
||||
2. **Check auth before first use** — run `setup.py --check`. If it fails, guide the user through setup.
|
||||
3. **Use the Gmail search syntax reference** for complex queries — load it with `skill_view("google-workspace", file_path="references/gmail-search-syntax.md")`.
|
||||
4. **Calendar times must include timezone** — always use ISO 8601 with offset (e.g., `2026-03-01T10:00:00-06:00`) or UTC (`Z`).
|
||||
|
|
@ -273,6 +322,7 @@ All commands return JSON. Parse with `jq` or read directly. Key fields:
|
|||
| `NOT_AUTHENTICATED` | Run setup Steps 2-5 above |
|
||||
| `REFRESH_FAILED` | Token revoked or expired — redo Steps 3-5 |
|
||||
| `HttpError 403: Insufficient Permission` | Missing API scope — `$GSETUP --revoke` then redo Steps 3-5 |
|
||||
| `AUTHENTICATED (partial)` or "Token missing scopes" | New write capabilities (Drive write/delete, Docs create/edit) require re-authorization. `$GSETUP --revoke` then redo Steps 3-5 to grant the upgraded scopes. |
|
||||
| `HttpError 403: Access Not Configured` | API not enabled — user needs to enable it in Google Cloud Console |
|
||||
| `ModuleNotFoundError` | Run `$GSETUP --install-deps` |
|
||||
| Advanced Protection blocks auth | Workspace admin must allowlist the OAuth client ID |
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue