Skip to content
← Public packages

@kody/google

Call Gmail, Calendar, Tasks, Drive, Docs, Sheets, People, YouTube, and Analytics through saved Google OAuth.

AGENTS.md

100 lines · 3.4 KB · Markdown

@kody/google — agent notes

Human setup and intent live in README.md. This file is for agents: imports, smoke/dryRun execute snippets, and edge cases. Auth is OAuth integrations named google / google-* — never paste tokens. Do not disable live webhooks or jobs.

Auth / integrations

CallResolves to
omit bothgoogle (default)
account: 'work'google-work
integration: 'google-work'that exact name
account already google-…used as-is

Reconnect: /connect/oauth?provider=google or ...?provider=google-<purpose>. No user secrets for this package.

Import paths

ExportImport
overview + smokeTestkody:@kody/google
smoke-testkody:@kody/google/smoke-test
accountskody:@kody/google/accounts
core (requestGoogle, getUserInfo)kody:@kody/google/core
gmailkody:@kody/google/gmail
calendarkody:@kody/google/calendar
taskskody:@kody/google/tasks
drivekody:@kody/google/drive
docskody:@kody/google/docs
sheetskody:@kody/google/sheets
peoplekody:@kody/google/people
youtubekody:@kody/google/youtube
youtube-analyticskody:@kody/google/youtube-analytics
analyticskody:@kody/google/analytics
typeskody:@kody/google/types

Prefer static kody:@kody/google/... imports from execute. Do not lead with packages.invoke.

Smoke test (read-only)

import { smokeTest } from 'kody:@kody/google'
// or: import smokeTest from 'kody:@kody/google/smoke-test'

export default async function main() {
	return await smokeTest()
	// or: smokeTest({ integration: 'google-work' })
	// => { integration: 'google', profile: { email, name, emailVerified } }
}

Calendar / inbox smokes (need matching scopes):

import { listCalendars } from 'kody:@kody/google/calendar'
import { listInbox } from 'kody:@kody/google/gmail'

export default async function main() {
	const calendars = await listCalendars({ maxResults: 3 })
	const inbox = await listInbox({ maxResults: 5 })
	return { calendars, inbox }
}

dryRun snippets

import { createReplyDraft } from 'kody:@kody/google/gmail'

export default async function main() {
	return await createReplyDraft({
		replyToMessageId: '19fdd464c417fd87',
		body: ['Thanks — I will follow up tomorrow.'],
		dryRun: true,
	})
}

Edge cases / fork notes

  • A 403 / insufficient-scope error names the missing scope and the next connect URL. Inbox and Drive-wide helpers are not hidden.
  • createDraft stores raw MIME verbatim. createReplyDraft derives recipient, subject, In-Reply-To, References, threadId, and quoted original — only body is authored. Drafts need gmail.compose or gmail.modify; send-only clients with gmail.send can still use sendMessage.
  • Drive-wide search needs drive.readonly; drive.file is only files this app created.
  • Fork/adapt: keep OAuth + integration naming; do not invent a secret-backed Google path. Extra accounts stay google-<purpose>.
  • listEventsAcrossCalendars is not an unbounded scan. It defaults to a 20s wall-clock budget (explicit budgetMs is capped at 60s) and returns the events collected so far with truncated: true and truncatedReason: 'budget'. Hidden calendars stay included unless showHiddenCalendars: false. Pass a tighter timeMin / timeMax when you only need a window. There is no flag to scan forever.