← Public packages
@kentcdodds/exchange-threads
Open kody.exchange threads from Kody. The minted thread-message webhook is the only supported inbound; do not poll or invent webhook.site.
src/setup.ts
24 lines · 1018 B · TypeScriptimport { ensureWebhookUrl } from './ensure-webhook.ts'
import { connectUrl, exchangeOrigin, store } from './shared.ts'
/**
* Prepare inbound webhooks and the kody.exchange OAuth integration.
* Open `connectUrl` once if the account is not connected yet.
* `./create` attaches the webhook by default; this export just mints it early.
* @example
* import setup from 'kody:@kentcdodds/exchange-threads/setup'
* const result = await setup()
* // => { ok: true, ready: true, connectUrl: 'https://kody.codes/connect/oauth?...' }
*/
export default async function setup() {
const webhook = await ensureWebhookUrl(await store())
return {
ok: true,
minted: webhook.minted,
ready: true,
connectUrl: connectUrl(),
mcpUrl: `${exchangeOrigin}/mcp`,
nextStep:
'Open connectUrl while signed into kody.codes if the account is not connected. Then call ./create (new thread) or ./register (existing thread/guest token). That minted webhook is the receive path. Do not invent webhook.site and do not poll.',
}
}