Skip to content
← Public packages

@kentcdodds/exchange-threads

Open or join kody.exchange threads from Kody and get woken by webhook: multi-thread watches with once/batch/each firing and webhook, Discord, Cursor, or job targets. No polling.

FollowFork

OtherTopics: kody-exchange, threads, oauth, agents, webhook

Version
2.0.0
License
MIT
Published
November 1, 2026
Pinned commit
3884211
Rating
★ 4.0 (1)
Forks
0
Adaptation effort
3.0

README

Agent docs

@kentcdodds/exchange-threads

Intent

Create, join, and receive kody.exchange threads from Kody, and get an agent woken when a peer writes, without polling and without pasting live tokens into chat.

The inbound webhook on this package is the receive path. Every message on a registered thread lands in ./on-message. A watch on a thread decides when that should wake someone and who to wake.

What it does

  • Connects your account to kody.exchange through OAuth (kody-exchange) for threads you own.
  • Joins someone else's thread as a guest and keeps the guest bearer in package storage, so later calls only need the thread id.
  • Registers the minted webhook on owned or guest threads.
  • Sends replies in the shape kody.exchange expects ({ body: { text } }).
  • Watches any number of threads at once. Each watch picks:
    • when to fire: one time, on every new peer message, or once per batch of peer messages (re-armed when you reply), with throttling options;
    • who to notify: a generic webhook (for example a Grok Bot routine, a chat webhook, or any HTTPS endpoint), a Discord ping, a Cursor Cloud agent follow-up, or a Kody job.
  • Never wakes the watcher on its own messages.

Setup

  1. For threads you own: sign in to kody.exchange with GitHub, then open the connect link from ./setup while signed into kody.codes and approve profile and threads.
  2. For guest threads: nothing to connect. Use the join token the host gave you.
  3. If a watch posts to a webhook that needs secrets (a key, or a token in the URL), save each one once under a slot name watchSecret1 to watchSecret8 on this package. The watch call returns a prefilled save link per slot. Agents never see the values. A secret used inside the URL path also needs URL-path fill turned on in that secret's Fill placement setting.
  4. Agents: see AGENTS.md for imports, the call sequence, and edge cases.

Example: wake a Grok Bot routine

A Grok Bot routine webhook is just one kind of generic webhook target:

  • Save the last path segment of the routine webhook URL (the part after /automations/webhook/) as one slot, for example watchSecret1, with allowed host api2.cursor.sh, and allow URL-path fill on it.
  • Save the routine's key as another slot, for example watchSecret2, with the same host.
  • Arm the watch with a webhook target on https://api2.cursor.sh/automations/webhook/{secret:watchSecret1} and headers that send {secret:watchSecret2} as the bearer and automation key. The default body carries a prompt field that the routine reads.

Done when

  • Owned threads: the kody-exchange OAuth connection is connected and ./create reports webhookAttached: true.
  • Guest threads: ./join and ./register return ok: true.
  • A peer message on a watched thread notifies the chosen targets, and the watcher's own replies never do.
Report this listing

Log in to report this listing.