Skip to content

Gmail rich compose + Docs previews + email→PDF + GAS link - #19

Merged
jmbish04 merged 4 commits into
mainfrom
claude/html-entity-encoding-fix-1aee9f
Aug 27, 2026
Merged

Gmail rich compose + Docs previews + email→PDF + GAS link#19
jmbish04 merged 4 commits into
mainfrom
claude/html-entity-encoding-fix-1aee9f

Conversation

@jmbish04

Copy link
Copy Markdown
Owner

Culmination of this session's work on the Gmail/Docs MCP surface. tsc clean, 362 tests pass, lint exit 0.

Bug fix

  • HTML-entity leak in Docs injectionhtml-to-braille.ts read text nodes via .rawText (entities intact) so "/' landed literally in docs. Now .text (decoded). Root fix covers every doc-write path (markdown import, append, tab updates). Plain-text tools already decode via sanitizeArgs; Gmail HTML→text already decodes.

Gmail compose

  • cc/bcc on all compose tools (drafts included), preserved when a draft is sent.
  • Multiple recipientsto/cc/bcc accept an array or comma-separated string.
  • Inline imagesattachments[{ as:"inline", contentId }]multipart/related + Content-ID; reference in HTML as <img src="cid:…"> (never link-falls-back). Plus href links (html/markdown) and blob attachments (already supported).
  • Reply-all draft against an existing thread via gmail_create_reply_draft (defaults reply-all, keeps thread).

Gmail read

  • gmail_get_message — body as text (default) / html / rfc, ALWAYS with urls:[{label,href}]; gmail_get_thread carries per-message body+urls.

Email → PDF

  • gmail_to_pdf — thread / message / message-subset. via:"render" (Browser Rendering REST /pdf → R2 pdf_url, supports highlights) or via:"appscript" (native Apps Script → Drive URL).

Docs/Sheet/PDF preview

  • preview_file (+ default on docs_create_from_markdown) — export → per-page PNG (R2 previews bucket, 48h TTL via lifecycle + hourly purge, served /api/preview/:id) + optional Ollama vision critique routed through core-guardian (lib/guardian-ai.ts, auth WORKER_API_KEY). Returns { pdf_url, pages:{pg_N:{image_url, vision_ai_notes}} }.
  • New R2 bucket google-workspace-mcp-previews (lifecycle: expire 2 days), bound as R2_PREVIEWS_BUCKET.

Apps Script (email-to-pdf)

  • gas-projects.ts registry — per-account scriptId (live IDs for both accounts) + runtime override via set_gas_script / global_config. Run via scripts.run (gmail_to_pdf via:"appscript").
  • gas/ git submodule → core-template-gas — GAS source lives there (PR Gmail send-as, Drive attachments/audit, Code Mode, Apps Script deploy pipeline, per-account OAuth #8), that repo's CI deploys. Worker only runs the deployed scripts.
  • Verified live against the deployed script: auth + execution work end-to-end. (Found a V8-runtime bug in pixelcog's isa_ type-guard — fix handed to the core-template-gas agent.)

Docs

New migration: none. New binding: R2_PREVIEWS_BUCKET (bucket already created). Requires deploy to take effect.

🤖 Generated with Claude Code

claude added 4 commits August 27, 2026 04:15
…link

Gmail:
- Fix HTML-entity leak in Docs injection (html-to-braille used .rawText; now .text)
- cc/bcc on all compose tools (drafts included); multi-recipient to/cc/bcc (array or CSV)
- Inline images (as:"inline"+contentId → multipart/related Content-ID), href links, blob attach
- gmail_get_message: text/html/rfc body + always urls[{label,href}]; thread carries body+urls
- gmail_to_pdf: thread/message → PDF (Browser Rendering render OR native Apps Script via:appscript),
  optional term highlighting

Docs/preview:
- preview_file + docs_create_from_markdown: per-page PNG previews (R2 previews bucket, 48h TTL,
  /api/preview/:id) + optional Ollama vision critique via core-guardian (lib/guardian-ai.ts)

Apps Script (email-to-pdf):
- gas-projects.ts registry (scriptId per account) + set_gas_script; run via scripts.run
- gas/ git submodule → core-template-gas (source lives there; CI deploys)

Docs: AGENTS.md directive #20 (submodule + follow gas/AGENTS.md) + feature-map bullets.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
email-to-pdf PR #8 merged; verified live end-to-end (thread → Drive PDF).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- doc-preview: render pages concurrently (Promise.all) instead of sequentially
  — avoids stacking Browser-Rendering latencies on default-on create previews
- thread-pdf sanitizeBody: strip javascript:/vbscript: URLs before headless
  render; document the remote-image fetch tradeoff
- fix stale docstrings (preview route R2 key, wrangler previews-bucket TTL)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Includes base64 Gmail-logo header fix + account routing + V8/render hardening.
email-to-pdf verified live end-to-end (thread → Drive PDF, logo renders).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@jmbish04
jmbish04 merged commit 97b66ef into main Aug 27, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants