Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
09e3de2
feat: add @trigger.dev/ai package with TriggerChatTransport
cursoragent Feb 15, 2026
c37558f
test: add comprehensive unit tests for TriggerChatTransport
cursoragent Feb 15, 2026
7c80384
refactor: polish TriggerChatTransport implementation
cursoragent Feb 15, 2026
1bd10ee
test: add abort signal, multiple sessions, and body merging tests
cursoragent Feb 15, 2026
4af2529
chore: add changeset for @trigger.dev/ai package
cursoragent Feb 15, 2026
789f57e
refactor: remove internal ChatSessionState from public exports
cursoragent Feb 15, 2026
9404a11
feat: support dynamic accessToken function for token refresh
cursoragent Feb 15, 2026
e60dc53
refactor: avoid double-resolving accessToken in sendMessages
cursoragent Feb 15, 2026
d8141dd
feat: add chat transport and AI chat helpers to @trigger.dev/sdk
cursoragent Feb 15, 2026
52881f7
test: move chat transport tests to @trigger.dev/sdk
cursoragent Feb 15, 2026
5d502ba
refactor: delete packages/ai/ — moved to @trigger.dev/sdk subpaths
cursoragent Feb 15, 2026
469f846
chore: update changeset to target @trigger.dev/sdk
cursoragent Feb 15, 2026
be21b82
fix: address CodeRabbit review feedback
cursoragent Feb 15, 2026
2f055ed
docs(ai): add AI Chat with useChat guide
cursoragent Feb 15, 2026
2c93c91
feat(reference): add ai-chat Next.js reference project
cursoragent Feb 15, 2026
2f3bbc5
fix(reference): use compatible @ai-sdk v3 packages, await convertToMo…
cursoragent Feb 15, 2026
d551b1d
Use a single run with iterative waitpoint token completions
ericallam Feb 21, 2026
7d0ff4d
Added tool example
ericallam Feb 21, 2026
fd66d1b
expose a useTriggerChatTransport hook
ericallam Feb 21, 2026
b2f2201
use input streams and rename chatTask and chatState to chat.task and …
ericallam Mar 3, 2026
4739cf5
add stopping support and fix issue with the OpenAI responses API and …
ericallam Mar 4, 2026
d429fe4
Add warmTimeoutInSeconds option
ericallam Mar 4, 2026
c9b9409
Add clientData support
ericallam Mar 4, 2026
4ab6cad
provide already converted UIMessages to the run function for better dx
ericallam Mar 4, 2026
8566f50
Added better telemetry support to view turns
ericallam Mar 4, 2026
4d260b6
Fix double looping when resuming from an input stream waitpoint
ericallam Mar 4, 2026
5f64ada
Add some pending message support in the example
ericallam Mar 4, 2026
adb9bdd
Accumulate messages in the task, allowing us to only have to send use…
ericallam Mar 5, 2026
c827d65
build full example with persisting messages, adding necessary hooks, …
ericallam Mar 5, 2026
eb4fbbd
Add ai chat to the sidebar for now
ericallam Mar 5, 2026
25149b5
remove postinstall hook
ericallam Mar 5, 2026
a214660
feat: add onTurnStart hook, lastEventId support, and stream resume de…
ericallam Mar 5, 2026
d6b9c4a
Minor fixes around reconnecting streams
ericallam Mar 6, 2026
169bee9
update pnpm link file
ericallam Mar 6, 2026
2dfae7d
fixed chat tests
ericallam Mar 6, 2026
f45ae2e
use locals for the chat pipe counter instead of a module global
ericallam Mar 6, 2026
4acf58a
Add triggerOptions to the transport, auto-tag with the chat ID
ericallam Mar 6, 2026
c071c72
Make clientData typesafe and pass to all chat.task hooks
ericallam Mar 6, 2026
b3163be
feat: add chat.local for per-run typed data with Proxy access and dir…
ericallam Mar 6, 2026
0392902
feat(chat): add stop handling, abort cleanup, continuation support, a…
ericallam Mar 7, 2026
94bf8c0
Some improvements to the example ai-chat
ericallam Mar 7, 2026
9cea2fe
feat(chat): expose typed chat.stream, add deepResearch subtask exampl…
ericallam Mar 8, 2026
a3cf343
feat(ai): pass chat context and toolCallId to subtasks, add typed ai.…
ericallam Mar 8, 2026
0d3ac27
feat(chat): add preload support, dynamic tools, and preload-specific …
ericallam Mar 9, 2026
dbf38ff
docs: add mermaid architecture diagrams for ai-chat system
ericallam Mar 9, 2026
a87567d
docs: add sequence diagrams to ai-chat guide
ericallam Mar 9, 2026
8d99578
feat(chat): auto-hydrate chat.local values in ai.tool subtasks
ericallam Mar 9, 2026
454c362
feat(chat): add chat.defer(), preload toggle, TTFB measurement, and f…
ericallam Mar 9, 2026
b69509e
fix(reference): replace hand-rolled HTML stripping with turndown
ericallam Mar 9, 2026
bfdee96
feat(streams): add inputStream.waitWithWarmup(), warm timeout config …
ericallam Mar 9, 2026
ba4049a
feat(chat): add composable primitives, raw task example, and task mod…
ericallam Mar 10, 2026
1c56bcf
Introduce the chat session API and better docs organization
ericallam Mar 10, 2026
e4f1547
Add support for toUIMessageStream() options
ericallam Mar 10, 2026
b61c052
Add metadata to the streamText call
ericallam Mar 12, 2026
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
42 changes: 42 additions & 0 deletions .changeset/ai-sdk-chat-transport.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
"@trigger.dev/sdk": minor
---

Add AI SDK chat transport integration via two new subpath exports:

**`@trigger.dev/sdk/chat`** (frontend, browser-safe):
- `TriggerChatTransport` — custom `ChatTransport` for the AI SDK's `useChat` hook that runs chat completions as durable Trigger.dev tasks
- `createChatTransport()` — factory function

```tsx
import { useChat } from "@ai-sdk/react";
import { TriggerChatTransport } from "@trigger.dev/sdk/chat";

const { messages, sendMessage } = useChat({
transport: new TriggerChatTransport({
task: "my-chat-task",
accessToken,
}),
});
```

**`@trigger.dev/sdk/ai`** (backend, extends existing `ai.tool`/`ai.currentToolOptions`):
- `chatTask()` — pre-typed task wrapper with auto-pipe support
- `pipeChat()` — pipe a `StreamTextResult` or stream to the frontend
- `CHAT_STREAM_KEY` — the default stream key constant
- `ChatTaskPayload` type

```ts
import { chatTask } from "@trigger.dev/sdk/ai";
import { streamText, convertToModelMessages } from "ai";

export const myChatTask = chatTask({
id: "my-chat-task",
run: async ({ messages }) => {
return streamText({
model: openai("gpt-4o"),
messages: convertToModelMessages(messages),
});
},
});
```
22 changes: 22 additions & 0 deletions .claude/rules/package-installation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
paths:
- "**/package.json"
---

# Installing Packages

When adding a new dependency to any package.json in the monorepo:

1. **Look up the latest version** on npm before adding:
```bash
pnpm view <package-name> version
```
If unsure which version to use (e.g. major version compatibility), confirm with the user.

2. **Edit the package.json directly** — do NOT use `pnpm add` as it can cause issues in the monorepo. Add the dependency with the correct version range (typically `^x.y.z`).

3. **Run `pnpm i` from the repo root** after editing to install and update the lockfile:
```bash
pnpm i
```
Always run from the repo root, not from the package directory.
2 changes: 2 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ This file provides guidance to Claude Code when working with this repository. Su

This is a pnpm 10.23.0 monorepo using Turborepo. Run commands from root with `pnpm run`.

**Adding dependencies:** Edit `package.json` directly instead of using `pnpm add`, then run `pnpm i` from the repo root. See `.claude/rules/package-installation.md` for the full process.

```bash
pnpm run docker # Start Docker services (PostgreSQL, Redis, Electric)
pnpm run db:migrate # Run database migrations
Expand Down
Loading
Loading