Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
56dbf7f
feat: add @trigger.dev/ai package with TriggerChatTransport
cursoragent Feb 15, 2026
9e711c2
test: add comprehensive unit tests for TriggerChatTransport
cursoragent Feb 15, 2026
f7e88fd
refactor: polish TriggerChatTransport implementation
cursoragent Feb 15, 2026
a0e5b1c
test: add abort signal, multiple sessions, and body merging tests
cursoragent Feb 15, 2026
f0ffd7d
chore: add changeset for @trigger.dev/ai package
cursoragent Feb 15, 2026
581b684
refactor: remove internal ChatSessionState from public exports
cursoragent Feb 15, 2026
2034e52
feat: support dynamic accessToken function for token refresh
cursoragent Feb 15, 2026
2c6ade6
refactor: avoid double-resolving accessToken in sendMessages
cursoragent Feb 15, 2026
dd96b63
feat: add chat transport and AI chat helpers to @trigger.dev/sdk
cursoragent Feb 15, 2026
382c90b
test: move chat transport tests to @trigger.dev/sdk
cursoragent Feb 15, 2026
3a01433
refactor: delete packages/ai/ — moved to @trigger.dev/sdk subpaths
cursoragent Feb 15, 2026
3db0bb7
chore: update changeset to target @trigger.dev/sdk
cursoragent Feb 15, 2026
9cb11b0
fix: address CodeRabbit review feedback
cursoragent Feb 15, 2026
29b7af9
docs(ai): add AI Chat with useChat guide
cursoragent Feb 15, 2026
983d8be
feat(reference): add ai-chat Next.js reference project
cursoragent Feb 15, 2026
94976d4
fix(reference): use compatible @ai-sdk v3 packages, await convertToMo…
cursoragent Feb 15, 2026
08da6e8
Use a single run with iterative waitpoint token completions
ericallam Feb 21, 2026
cc2dc46
Added tool example
ericallam Feb 21, 2026
504a65e
expose a useTriggerChatTransport hook
ericallam Feb 21, 2026
5748146
use input streams and rename chatTask and chatState to chat.task and …
ericallam Mar 3, 2026
057f6a1
add stopping support and fix issue with the OpenAI responses API and …
ericallam Mar 4, 2026
9a932b4
Add warmTimeoutInSeconds option
ericallam Mar 4, 2026
430802d
Add clientData support
ericallam Mar 4, 2026
6835b05
provide already converted UIMessages to the run function for better dx
ericallam Mar 4, 2026
b4fd232
Added better telemetry support to view turns
ericallam Mar 4, 2026
befa633
Fix double looping when resuming from an input stream waitpoint
ericallam Mar 4, 2026
e75b94f
Add some pending message support in the example
ericallam Mar 4, 2026
481074a
Accumulate messages in the task, allowing us to only have to send use…
ericallam Mar 5, 2026
7ae1fab
build full example with persisting messages, adding necessary hooks, …
ericallam Mar 5, 2026
8be5605
Add ai chat to the sidebar for now
ericallam Mar 5, 2026
d7d7228
remove postinstall hook
ericallam Mar 5, 2026
cdfe837
feat: add onTurnStart hook, lastEventId support, and stream resume de…
ericallam Mar 5, 2026
579ba7f
Minor fixes around reconnecting streams
ericallam Mar 6, 2026
feb7133
update pnpm link file
ericallam Mar 6, 2026
36c3d13
fixed chat tests
ericallam Mar 6, 2026
b88544c
use locals for the chat pipe counter instead of a module global
ericallam Mar 6, 2026
b0201c6
Add triggerOptions to the transport, auto-tag with the chat ID
ericallam Mar 6, 2026
95a2ce8
Make clientData typesafe and pass to all chat.task hooks
ericallam Mar 6, 2026
3933784
feat: add chat.local for per-run typed data with Proxy access and dir…
ericallam Mar 6, 2026
c51fbb5
feat(chat): add stop handling, abort cleanup, continuation support, a…
ericallam Mar 7, 2026
464ad1b
Some improvements to the example ai-chat
ericallam Mar 7, 2026
1ee6873
feat(chat): expose typed chat.stream, add deepResearch subtask exampl…
ericallam Mar 8, 2026
d0058d4
feat(ai): pass chat context and toolCallId to subtasks, add typed ai.…
ericallam Mar 8, 2026
645b103
feat(chat): add preload support, dynamic tools, and preload-specific …
ericallam Mar 9, 2026
52e2f59
docs: add mermaid architecture diagrams for ai-chat system
ericallam Mar 9, 2026
5a65c61
docs: add sequence diagrams to ai-chat guide
ericallam Mar 9, 2026
ddbd125
feat(chat): auto-hydrate chat.local values in ai.tool subtasks
ericallam Mar 9, 2026
65b7ae5
feat(chat): add chat.defer(), preload toggle, TTFB measurement, and f…
ericallam Mar 9, 2026
bdda665
fix(reference): replace hand-rolled HTML stripping with turndown
ericallam Mar 9, 2026
f9c771b
feat(streams): add inputStream.waitWithWarmup(), warm timeout config …
ericallam Mar 9, 2026
ba93c57
feat(chat): add composable primitives, raw task example, and task mod…
ericallam Mar 10, 2026
6ec7a5a
Introduce the chat session API and better docs organization
ericallam Mar 10, 2026
1e00025
Add support for toUIMessageStream() options
ericallam Mar 10, 2026
d0d8b19
Add metadata to the streamText call
ericallam Mar 12, 2026
fa6feb4
feat(chat): add chat.prompt API with provider registry support
ericallam Mar 23, 2026
c699ec7
refactor: rename warmTimeout to idleTimeout across chat APIs
ericallam Mar 23, 2026
a8fa2bc
feat: support message compaction
ericallam Mar 24, 2026
45d8be7
better compaction support in our other chat variants
ericallam Mar 24, 2026
19f9744
feat(chat): add compaction option, pendingMessages steering, and useP…
ericallam Mar 25, 2026
112fda7
Add a writer to easily write chunks in callbacks
ericallam Mar 26, 2026
d8deb44
feat(ai): add triggerAndSubscribe method and use it in ai.tool
ericallam Mar 26, 2026
b80c3bd
feat(chat): add chat.inject() for background context injection and ch…
ericallam Mar 26, 2026
de53572
feat(sdk): ToolSet typing for toolFromTask, ai.toolExecute, deprecate…
ericallam Mar 27, 2026
3e7cf18
Add run-scoped PAT renewal for chat transport
ericallam Mar 27, 2026
b7ef634
feat(sdk): ctx on chat.task hooks; ai-chat E2B sandbox; docs patterns
ericallam Mar 27, 2026
fd28faf
feat(sdk): add onChatSuspend/onChatResume hooks, exitAfterPreloadIdle…
ericallam Mar 28, 2026
b290034
Add support for triggering from the backend
ericallam Mar 28, 2026
a59dd9e
chat.task -> chat.agent
ericallam Mar 30, 2026
14a2921
feat: upgrade streamdown to v2.5.0 with custom Trigger.dev Shiki theme
ericallam Apr 1, 2026
3174647
playground ui tweaks
ericallam Apr 1, 2026
65fe8ac
Some design tweaks, improvements to playground options, rename unname…
ericallam Apr 1, 2026
9885cef
Add the chat client and strip agent crumbs
ericallam Apr 1, 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
6 changes: 6 additions & 0 deletions .changeset/ai-chat-sandbox-and-ctx.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@trigger.dev/sdk": patch
---

Add `TaskRunContext` (`ctx`) to all `chat.task` lifecycle events, `CompactedEvent`, and `ChatTaskRunPayload`. Export `TaskRunContext` from `@trigger.dev/sdk`.

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),
});
},
});
```
5 changes: 5 additions & 0 deletions .changeset/ai-tool-execute-helper.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@trigger.dev/sdk": patch
---

Add `ai.toolExecute(task)` so you can pass Trigger's subtask/metadata wiring as the `execute` handler to AI SDK `tool()` while defining `description` and `inputSchema` yourself. Refactors `ai.tool()` to share the same internal handler.
6 changes: 6 additions & 0 deletions .changeset/ai-tool-toolset-typing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@trigger.dev/sdk": patch
---

Align `ai.tool()` (`toolFromTask`) with the AI SDK `ToolSet` shape: Zod-backed tasks use static `tool()`; returns are asserted as `Tool & ToolSet[string]`. Raise the SDK's minimum `ai` devDependency to `^6.0.116` so emitted types resolve the same `ToolSet` as apps on AI SDK 6.0.x (avoids cross-version `ToolSet` mismatches in monorepos).

6 changes: 6 additions & 0 deletions .changeset/chat-run-pat-renewal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@trigger.dev/core": patch
"@trigger.dev/sdk": patch
---

Add run-scoped PAT renewal for chat transport (`renewRunAccessToken`), fail fast on 401/403 for SSE without retry backoff, and export `isTriggerRealtimeAuthError` for auth-error detection.
5 changes: 5 additions & 0 deletions .changeset/dry-sloths-divide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@trigger.dev/sdk": patch
---

Add `chat.withUIMessage<TUIMessage>()` for typed AI SDK `UIMessage` in chat task hooks, optional factory `streamOptions` merged with `uiMessageStreamOptions`, and `InferChatUIMessage` helper. Generic `ChatUIMessageStreamOptions`, compaction, and pending-message event types. `usePendingMessages` accepts a UI message type parameter; re-export `InferChatUIMessage` from `@trigger.dev/sdk/chat/react`.
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.
6 changes: 6 additions & 0 deletions .server-changes/streamdown-v2-upgrade.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
area: webapp
type: improvement
---

Upgrade streamdown from v1.4.0 to v2.5.0. Custom Shiki syntax highlighting theme matching our CodeMirror dark theme colors. Consolidate duplicated lazy StreamdownRenderer into a shared component.
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
13 changes: 13 additions & 0 deletions apps/webapp/app/components/BulkActionFilterSummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,19 @@ export function BulkActionFilterSummary({
/>
);
}
case "sources": {
const values = Array.isArray(value) ? value : [`${value}`];
return (
<AppliedFilter
variant="minimal/medium"
key={key}
label={filterTitle(key)}
icon={filterIcon(key)}
value={appliedSummary(values)}
removable={false}
/>
);
}
default: {
assertNever(typedKey);
}
Expand Down
14 changes: 2 additions & 12 deletions apps/webapp/app/components/code/AIQueryInput.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,15 @@
import { CheckIcon, PencilSquareIcon, PlusIcon, XMarkIcon } from "@heroicons/react/20/solid";
import { AnimatePresence, motion } from "framer-motion";
import { Suspense, lazy, useCallback, useEffect, useRef, useState } from "react";
import { Suspense, useCallback, useEffect, useRef, useState } from "react";
import { Button } from "~/components/primitives/Buttons";
import { Spinner } from "~/components/primitives/Spinner";
import { StreamdownRenderer } from "~/components/code/StreamdownRenderer";
import { useEnvironment } from "~/hooks/useEnvironment";
import { useOrganization } from "~/hooks/useOrganizations";
import { useProject } from "~/hooks/useProject";
import type { AITimeFilter } from "~/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.query/types";
import { cn } from "~/utils/cn";

// Lazy load streamdown components to avoid SSR issues
const StreamdownRenderer = lazy(() =>
import("streamdown").then((mod) => ({
default: ({ children, isAnimating }: { children: string; isAnimating: boolean }) => (
<mod.ShikiThemeContext.Provider value={["one-dark-pro", "one-dark-pro"]}>
<mod.Streamdown isAnimating={isAnimating}>{children}</mod.Streamdown>
</mod.ShikiThemeContext.Provider>
),
}))
);

type StreamEventType =
| { type: "thinking"; content: string }
| { type: "tool_call"; tool: string; args: unknown }
Expand Down
29 changes: 29 additions & 0 deletions apps/webapp/app/components/code/StreamdownRenderer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { lazy } from "react";
import type { CodeHighlighterPlugin } from "streamdown";

export const StreamdownRenderer = lazy(() =>
Promise.all([import("streamdown"), import("@streamdown/code"), import("./shikiTheme")]).then(
([{ Streamdown }, { createCodePlugin }, { triggerDarkTheme }]) => {
// Type assertion needed: @streamdown/code and streamdown resolve different shiki
// versions under pnpm, causing structurally-identical CodeHighlighterPlugin types
// to be considered incompatible (different BundledLanguage string unions).
const codePlugin = createCodePlugin({
themes: [triggerDarkTheme, triggerDarkTheme],
}) as unknown as CodeHighlighterPlugin;

return {
default: ({
children,
isAnimating = false,
}: {
children: string;
isAnimating?: boolean;
}) => (
<Streamdown isAnimating={isAnimating} plugins={{ code: codePlugin }}>
{children}
</Streamdown>
),
};
}
)
);
Loading
Loading