Skip to content
← Public packages

@kody/mailroom

Offline-first PWA for your Kody mailbox: sent and received threads, copy-prompt for agents, no send.

AGENTS.md

128 lines · 3.5 KB · Markdown

@kody/mailroom — agents

Human overview: README.md. Read-only mailbox UI — do not add send/compose unless Kent explicitly wants this app to send. No secrets required for the stock fork.

Import paths

import describe from 'kody:@kody/mailroom'
import list from 'kody:@kody/mailroom/list'
import get from 'kody:@kody/mailroom/get'
import search from 'kody:@kody/mailroom/search'
import getThread from 'kody:@kody/mailroom/thread'
import buildPrompt from 'kody:@kody/mailroom/prompt'
import handleApp from 'kody:@kody/mailroom/app'
import recordVersion from 'kody:@kody/mailroom/record-version'

Prefer static kody:@kody/mailroom/... imports from execute. Same data is also available via builtins emailMessageList / emailMessageGet / emailMessageSearch in any package.

Smoke tests

Package overview:

import describe from 'kody:@kody/mailroom'

const info = await describe()

List received threads:

import list from 'kody:@kody/mailroom/list'

const { threads } = await list({ direction: 'inbound', limit: 50 })

Read one stored message:

import get from 'kody:@kody/mailroom/get'

const message = await get({ messageId: '…' })

Search then group:

import search from 'kody:@kody/mailroom/search'

const { threads } = await search({ query: 'invoice', direction: 'inbound' })

Full thread with bodies:

import getThread from 'kody:@kody/mailroom/thread'

const thread = await getThread({ threadId: '…' })

Copy-prompt without opening the app:

import buildPrompt from 'kody:@kody/mailroom/prompt'

const { prompt } = await buildPrompt({ threadId: '…' })
// or { messageId: '…' }

App fetch (post-publish):

import { kody } from 'kody:runtime'

await kody.packageAppFetch({ kody_id: 'mailroom', path: '/' })

For platform-scoped official listing use package_scope: 'kody' when minting git remotes / publishing.

Fork / setup for agents

  1. Fork the community/@kody listing into the user's scope (or edit an existing fork).
  2. Git lane: packageGetGitRemote → clone → edit → push → packagePublishExternalPush.
  3. After a successful publish, record the About card version:
import recordVersion from 'kody:@kody/mailroom/record-version'

await recordVersion({
	sha: 'abc123', // published_commit
	message: 'Ship mailroom',
})
  1. Open hosted_app_url from the publish result (or https://{username}.kody.run/packages/mailroom) and confirm threads load.

Adapt guidance for humans: ./adapt. Keep IndexedDB cache + copy-prompt; do not wire send unless explicitly requested.

Exports

  • . — package overview (describe)
  • ./list — group mailbox messages into threads
  • ./get — one stored message including bodies
  • ./search — substring search, then group into threads
  • ./thread — every message in a thread, oldest first
  • ./prompt — copy-paste agent prompt for a thread or message
  • ./app — hosted PWA fetch handler
  • ./record-version — store published commit for the About card

Edge cases

  • Official @kody/mailroom shows kody's mailbox, not the fork owner's — users must fork + publish for their own mail.
  • App must use packageContext.hostedUrl / appBasePath for in-app links (mount is /packages/mailroom, not site root).
  • No compose/reply/send in stock app; agents send via other packages.
  • Update toast: newer published version or waiting service worker — user reloads; record-version keeps About honest after publish.