Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/custom-chatkit-providers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@trytilde/sdk": minor
"@trytilde/sdk-vercel-ai-node": minor
"@trytilde/api-client": minor
---

Support customer-hosted ChatKit providers with signed Fetch handlers, scoped runtime clients, contextual session tools, rich delivery, and Linq/AgentMail examples. Deploy compatible API support before using the new methods.
40 changes: 40 additions & 0 deletions docs/adrs/0043-custom-chatkit-provider-sdk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# ADR-0043: Framework-neutral ChatKit provider authoring

Status: Accepted

## In brief

- Export authoring and runtime helpers from a dedicated ChatKit provider subpath.
- Separate administrative, connection-runtime, and end-user credentials.
- Keep platform behavior in TypeScript and canonical accounting in Tilde.

## Context

A custom provider must express setup, ingestion, rich sends, identities, contextual
session tools, and recovery without requiring a specific agent framework or a
separately provisioned toolkit for each action.

This extends [SDK ownership](0030-tilde-sdk-and-cli-ownership.md) and preserves
[org/runtime identity separation](0042-org-runtime-identities.md). Platform
extensions follow [ADR-0038](0038-metadata-is-extension-data.md).

## Decision

Use standard Fetch Request/Response handlers for signed discovery and versioned
operations. Validate declared schemas/capabilities and keep server-bound execution
context outside model arguments. Provide connection-scoped ingestion, attachment,
conversation, and participant methods. Expose administrative wrappers separately.

Use stable execution/delivery IDs and explicit applied/absent/uncertain
reconciliation. Private rendering and recipient options flow through canonical
send preparation; reference email adapters redact BCC from public outputs.
Streaming protocol adapters submit canonical turns and relay cursor-based events
using the requesting user's authenticated client. Vercel AI adaptation is optional.

## Consequences

The core provider entry point has no Vercel AI requirement. Linq and AgentMail
serve as executable reference adapters, while hosts own deployment, secret
storage, webhook verification, and platform recovery. Backend support must ship
before an SDK release exposes these methods to customers. The example Node host
uses durable encrypted SQLite locally; Tilde's canonical database remains Postgres.
62 changes: 62 additions & 0 deletions docs/updates/154.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Customer-hosted ChatKit SDK

PR: https://github.com/trytilde/dispatch/pull/154 (draft)

## Intent of the change

Bring the custom ChatKit provider implementation into Dispatch's supported SDK
packages so customers can host complete transports and contextual tools using
`@trytilde/sdk`, with no dependency on the archived Harness SDK repository.

## Architecture changes

See [ADR-0043](../adrs/0043-custom-chatkit-provider-sdk.md), extending ADR-0030,
ADR-0038, and ADR-0042. Tilde owns authorization and canonical durable execution;
customer backends own platform behavior. SDK, connection-runtime, and user-client
credentials remain separate.

```mermaid
flowchart LR
API[Tilde API] -->|signed operations| Provider[Customer TypeScript provider]
Provider --> Platform[Platform API]
Provider -->|scoped normalized events| API
Caller -->|user credentials| Stream[Canonical session operations and SSE]
```

## Summarized changes

- Port provider authoring/runtime, definition and connection management, rich
delivery, work diagnostics, and canonical session streams to `packages/sdk`.
- Integrate dynamically discovered custom tools into the existing Vercel AI
`context.session.tools` object and export `sessionProviderTools`.
- Preserve newer room, run, identity, and client APIs. Add the Linq/AgentMail
reference implementations and streaming example under the owning SDK package.
- Regenerate contracts from API PR https://github.com/trytilde/api/pull/276.
Companion public docs: https://github.com/trytilde/docs/pull/36.
- Metadata classification: provider-specific external thread/message details are
interpreted only by the Linq or AgentMail reference adapter. The SDK forwards
opaque extension objects; canonical routing, credentials, leases, and execution
IDs use the signed typed contract, not metadata.
- No OpenBot client surface or fork-owned configuration is changed. No new
external service or global tool install is required; the existing Node 24
toolchain is used and Ajv reuses the repository's current dependency version.
- Validation on Dispatch `fcee72c`: `openbot sdk refresh` regenerated the client,
validated 732 operations, built all SDK packages, and passed all 316 SDK tests against the final rebased API contract:
core SDK 150, Vercel Node 152, and other SDK packages 14. `openbot sdk validate`
passed package/export validation; the final changed SDK packages were rebuilt.
- Focused typechecking, example typechecking, formatting, and lint pass. Existing
no-base-to-string warnings remain in older portions of the webhook test file.
Full OpenBot application check/build and browser/Electron e2e were not run
because this changes server SDK packages rather than application surfaces.

## Critical to apply

yes

Deploy the additive API and upgrade workers before releasing the SDK or enabling
custom providers. Consumers use `@trytilde/sdk/chatkit-provider` and configure
backend signing keys, per-connection runtime tokens, and durable backend state.
The reference host's setup guide covers the manually provisioned AgentMail
webhook. No publication, deployment, or live-platform/browser e2e is included.

Record refreshed after final wallet-preserving contract refresh: 2026-09-07T19:51:48+00:00.
Loading