From 8d663685b335677b330c6abdb575bfc39cddf971 Mon Sep 17 00:00:00 2001 From: EugeneTes Date: Wed, 23 Sep 2026 10:33:20 +0000 Subject: [PATCH] Document the /connect_calendar flow in README and .env.example --- .env.example | 9 ++++++--- README.md | 17 ++++++++++++++++- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/.env.example b/.env.example index 1c48dd0..f36caf2 100644 --- a/.env.example +++ b/.env.example @@ -15,11 +15,14 @@ SECRETARY_SHELL= LOG_LEVEL=info # PI_CODING_AGENT_DIR= (Pi's own override for ~/.pi/agent, mainly for Docker) -# Google Calendar tool: all three or none. Bootstrap the refresh token with an -# OAuth device flow against a Google Cloud OAuth client (type: TVs and Limited -# Input devices) — see docs/. Scope needed: https://www.googleapis.com/auth/calendar +# Google Calendar tool. Set GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET from a +# Google Cloud OAuth client of type "TVs and Limited Input devices" (scope: +# https://www.googleapis.com/auth/calendar). Then in Telegram, run +# /connect_calendar and follow the two-step flow — no refresh token needed here. GOOGLE_CLIENT_ID= GOOGLE_CLIENT_SECRET= +# Deprecated. If set at startup, seeded once into workspace/.secretary/google-token.json +# and then ignored. Use /connect_calendar in the bot for new setups. GOOGLE_REFRESH_TOKEN= # Playwright browser tools (MCP bridge). When PLAYWRIGHT_ENABLED=true the agent diff --git a/README.md b/README.md index 09e4701..772fc73 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ It can also send files back. When you ask for a screenshot, a generated file, or Reply to any of my messages (or "reply with quote" a specific part) and I'll see what you're answering to — useful for coming back to something from earlier in the day. -Commands: `/status`, `/new`, `/stop`, `/jobs`, `/cancel `, `/compact`. +Commands: `/status`, `/new`, `/stop`, `/jobs`, `/cancel `, `/compact`, `/connect_calendar`, `/calendar_done`. ## Scheduling @@ -38,6 +38,17 @@ Watcher scripts follow one rule: print nothing and exit 0 to stay silent, print Jobs live in `workspace/.secretary/jobs.json`. +## Google Calendar + +The bot can read and write the owner's Google Calendar. Setup is one-time in Google Cloud, then two commands in the bot. + +1. In Google Cloud Console, enable the **Google Calendar API** and create an **OAuth 2.0 client of type "TVs and Limited Input devices"**. +2. Put the client id and secret in `.env` as `GOOGLE_CLIENT_ID` and `GOOGLE_CLIENT_SECRET`. Restart the bot. +3. In Telegram, send `/connect_calendar`. The bot replies with a `https://google.com/device` link and a short code. +4. Open the link, sign in, enter the code, approve. Then send `/calendar_done` back to the bot. It replies `✅ Calendar connected.` + +The refresh token is stored at `workspace/.secretary/google-token.json`. Delete that file to disconnect; run `/connect_calendar` again to relink. + ## Workspace ``` @@ -69,6 +80,9 @@ The agent's edits to `MEMORY.md` are local runtime data. Leave them uncommitted, | `PLAYWRIGHT_HEADLESS` | no | `true` | Run browser headless. `false` opens a visible window | | `PLAYWRIGHT_BROWSER` | no | `chrome` | `chrome`, `firefox`, `webkit`, or `msedge` | | `PLAYWRIGHT_EXTRA_ARGS` | no | | Extra flags passed to `@playwright/mcp` (shell-quoted) | +| `GOOGLE_CLIENT_ID` | no | | OAuth client id (TVs and Limited Input devices) — enables the calendar tool | +| `GOOGLE_CLIENT_SECRET` | no | | OAuth client secret — required alongside `GOOGLE_CLIENT_ID` | +| `GOOGLE_REFRESH_TOKEN` | no | | Deprecated. If set, seeded once into `workspace/.secretary/google-token.json`, then ignored. | ## Keeping it running on Windows @@ -106,3 +120,4 @@ Run `npm run dev` with a real bot and walk through every line: 18. Ask "write a short poem to poem.txt and send it to me" → a `.txt` document attachment arrives with the poem inside, and the reply confirms with one line. 19. Reply to one of the bot's earlier messages with a follow-up like "what did you mean by that?" → the answer references that specific message, not the most recent one. Then "reply with quote" a specific phrase from a bot message → the answer references the quoted phrase. 20. Forward a voice message from another chat and add a text comment. The bot should reply once, referencing both your comment and what the voice said, not twice with each in isolation. +21. Delete `workspace/.secretary/google-token.json` if it exists. Ask "what's on my calendar tomorrow?" → tool replies with a "not connected" message referencing `/connect_calendar`. Run `/connect_calendar` → bot replies with a `https://google.com/device` URL and a short code. Approve on that page, then `/calendar_done` → bot replies `✅ Calendar connected.` and the token file now exists. Ask the same calendar question again → the tool answers.