Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
139 commits
Select commit Hold shift + click to select a range
2e83a66
feat: add @trigger.dev/ai package with TriggerChatTransport
cursoragent Feb 15, 2026
d26e0e1
test: add comprehensive unit tests for TriggerChatTransport
cursoragent Feb 15, 2026
90b8c86
refactor: polish TriggerChatTransport implementation
cursoragent Feb 15, 2026
ca80b0b
test: add abort signal, multiple sessions, and body merging tests
cursoragent Feb 15, 2026
f69cc27
chore: add changeset for @trigger.dev/ai package
cursoragent Feb 15, 2026
96f4a42
refactor: remove internal ChatSessionState from public exports
cursoragent Feb 15, 2026
acecb54
feat: support dynamic accessToken function for token refresh
cursoragent Feb 15, 2026
8d6a1b5
refactor: avoid double-resolving accessToken in sendMessages
cursoragent Feb 15, 2026
2db4ac0
feat: add chat transport and AI chat helpers to @trigger.dev/sdk
cursoragent Feb 15, 2026
cfca648
test: move chat transport tests to @trigger.dev/sdk
cursoragent Feb 15, 2026
99c9a6e
refactor: delete packages/ai/ — moved to @trigger.dev/sdk subpaths
cursoragent Feb 15, 2026
4b1767d
chore: update changeset to target @trigger.dev/sdk
cursoragent Feb 15, 2026
c7ef720
fix: address CodeRabbit review feedback
cursoragent Feb 15, 2026
93c8c99
docs(ai): add AI Chat with useChat guide
cursoragent Feb 15, 2026
3247450
feat(reference): add ai-chat Next.js reference project
cursoragent Feb 15, 2026
4de6b48
fix(reference): use compatible @ai-sdk v3 packages, await convertToMo…
cursoragent Feb 15, 2026
9a80383
Use a single run with iterative waitpoint token completions
ericallam Feb 21, 2026
a4d2c40
Added tool example
ericallam Feb 21, 2026
1f41d3a
expose a useTriggerChatTransport hook
ericallam Feb 21, 2026
1ebf4e1
use input streams and rename chatTask and chatState to chat.task and …
ericallam Mar 3, 2026
a5db573
add stopping support and fix issue with the OpenAI responses API and …
ericallam Mar 4, 2026
b096ed8
Add warmTimeoutInSeconds option
ericallam Mar 4, 2026
04218f6
Add clientData support
ericallam Mar 4, 2026
a2c3d95
provide already converted UIMessages to the run function for better dx
ericallam Mar 4, 2026
0d1bbe3
Added better telemetry support to view turns
ericallam Mar 4, 2026
f5fe68f
Fix double looping when resuming from an input stream waitpoint
ericallam Mar 4, 2026
be27cf2
Add some pending message support in the example
ericallam Mar 4, 2026
e62958f
Accumulate messages in the task, allowing us to only have to send use…
ericallam Mar 5, 2026
7b99c11
build full example with persisting messages, adding necessary hooks, …
ericallam Mar 5, 2026
80e06cc
Add ai chat to the sidebar for now
ericallam Mar 5, 2026
7c760ce
remove postinstall hook
ericallam Mar 5, 2026
33fec86
feat: add onTurnStart hook, lastEventId support, and stream resume de…
ericallam Mar 5, 2026
3761bff
Minor fixes around reconnecting streams
ericallam Mar 6, 2026
756395e
update pnpm link file
ericallam Mar 6, 2026
acf05a6
fixed chat tests
ericallam Mar 6, 2026
8cb8857
use locals for the chat pipe counter instead of a module global
ericallam Mar 6, 2026
72158bc
Add triggerOptions to the transport, auto-tag with the chat ID
ericallam Mar 6, 2026
d47cf9f
Make clientData typesafe and pass to all chat.task hooks
ericallam Mar 6, 2026
4bb65eb
feat: add chat.local for per-run typed data with Proxy access and dir…
ericallam Mar 6, 2026
c9c0e5b
feat(chat): add stop handling, abort cleanup, continuation support, a…
ericallam Mar 7, 2026
ba6ff19
Some improvements to the example ai-chat
ericallam Mar 7, 2026
3d03611
feat(chat): expose typed chat.stream, add deepResearch subtask exampl…
ericallam Mar 8, 2026
1d4a5ba
feat(ai): pass chat context and toolCallId to subtasks, add typed ai.…
ericallam Mar 8, 2026
50cd338
feat(chat): add preload support, dynamic tools, and preload-specific …
ericallam Mar 9, 2026
8bea894
docs: add mermaid architecture diagrams for ai-chat system
ericallam Mar 9, 2026
1b2c06e
docs: add sequence diagrams to ai-chat guide
ericallam Mar 9, 2026
77f2469
feat(chat): auto-hydrate chat.local values in ai.tool subtasks
ericallam Mar 9, 2026
38a10b3
feat(chat): add chat.defer(), preload toggle, TTFB measurement, and f…
ericallam Mar 9, 2026
057dbb1
fix(reference): replace hand-rolled HTML stripping with turndown
ericallam Mar 9, 2026
8f54593
feat(streams): add inputStream.waitWithWarmup(), warm timeout config …
ericallam Mar 9, 2026
553c6cf
feat(chat): add composable primitives, raw task example, and task mod…
ericallam Mar 10, 2026
d3b7ebe
Introduce the chat session API and better docs organization
ericallam Mar 10, 2026
f59c823
Add support for toUIMessageStream() options
ericallam Mar 10, 2026
ea262ff
Add metadata to the streamText call
ericallam Mar 12, 2026
346a017
feat(chat): add chat.prompt API with provider registry support
ericallam Mar 23, 2026
0a1b449
refactor: rename warmTimeout to idleTimeout across chat APIs
ericallam Mar 23, 2026
e64bb39
feat: support message compaction
ericallam Mar 24, 2026
aefb8be
better compaction support in our other chat variants
ericallam Mar 24, 2026
2f69ecc
feat(chat): add compaction option, pendingMessages steering, and useP…
ericallam Mar 25, 2026
c47c7fc
Add a writer to easily write chunks in callbacks
ericallam Mar 26, 2026
07264fd
feat(ai): add triggerAndSubscribe method and use it in ai.tool
ericallam Mar 26, 2026
07719e0
feat(chat): add chat.inject() for background context injection and ch…
ericallam Mar 26, 2026
46073b7
feat(sdk): ToolSet typing for toolFromTask, ai.toolExecute, deprecate…
ericallam Mar 27, 2026
7b22122
Add run-scoped PAT renewal for chat transport
ericallam Mar 27, 2026
6f982e6
feat(sdk): ctx on chat.task hooks; ai-chat E2B sandbox; docs patterns
ericallam Mar 27, 2026
be91304
feat(sdk): add onChatSuspend/onChatResume hooks, exitAfterPreloadIdle…
ericallam Mar 28, 2026
02517fe
Add support for triggering from the backend
ericallam Mar 28, 2026
8bff905
chat.task -> chat.agent
ericallam Mar 30, 2026
6856d71
feat: upgrade streamdown to v2.5.0 with custom Trigger.dev Shiki theme
ericallam Apr 1, 2026
49b8760
playground ui tweaks
ericallam Apr 1, 2026
c653fd9
Some design tweaks, improvements to playground options, rename unname…
ericallam Apr 1, 2026
c6ab08f
Add the chat client and strip agent crumbs
ericallam Apr 1, 2026
2409028
Add server-to-server chat support and subagent support to the playgro…
ericallam Apr 2, 2026
fd0482f
add agent mcp tools
ericallam Apr 2, 2026
c29b7ac
Add support for optionally validating UI messages
ericallam Apr 2, 2026
4efc03f
Support for upgrading an agent to a new version
ericallam Apr 3, 2026
4fc7947
Add run agent view
ericallam Apr 10, 2026
07fd38f
feat(chat): add stopGeneration, fix onTurnComplete/onFinishPromise, a…
ericallam Apr 11, 2026
bb6e492
fix(sdk): inject prepareStep in toStreamTextOptions even without chat…
ericallam Apr 13, 2026
54e87ad
feat(chat): allow generateMessageId in uiMessageStreamOptions, auto-p…
ericallam Apr 14, 2026
bdf006e
feat(chat): tool approvals support — ID-matched message replacement, …
ericallam Apr 14, 2026
efb1e02
fix: restore applyPrepareMessages call after agentcrumbs strip
ericallam Apr 14, 2026
52104e5
prevent preloads from firing twice when in React strictMode
ericallam Apr 14, 2026
4fc2f49
feat(chat): add chat.response API for persistent data parts, transien…
ericallam Apr 14, 2026
a0ca0c1
feat(chat): add hydrateMessages, chat.history, and custom actions
ericallam Apr 15, 2026
6ee6ce3
fix(chat): prevent useChat resume from hanging on completed turns
ericallam Apr 15, 2026
b0c550d
fix pnpm lock file
ericallam Apr 16, 2026
d867df6
feat(ai-chat): add askUser tool for HITL testing, verify TRI-8556 fix
ericallam Apr 17, 2026
766bde7
chore(ai-chat): remove test-big-error trigger from onValidateMessages
ericallam Apr 17, 2026
5b2797e
feat(chat): multi-tab coordination via BroadcastChannel
ericallam Apr 17, 2026
3da465f
fix(ai-chat): defer multi-tab broadcasts, disable streamdown word ani…
ericallam Apr 17, 2026
af4891f
feat(core): add runInMockTaskContext test infrastructure
ericallam Apr 18, 2026
75fbae3
feat(sdk): add mockChatAgent test harness with locals DI
ericallam Apr 18, 2026
8a05e27
feat(chat): expose finishReason on turn-complete events
ericallam Apr 18, 2026
739a03e
feat(chat): add chat.endRun()
ericallam Apr 18, 2026
9fe361d
fix(chat): include "action" in ChatTaskPayload.trigger type
ericallam Apr 18, 2026
a1d1334
feat(core): add skill resource catalog + SkillManifest schemas
ericallam Apr 18, 2026
75b4d94
feat(sdk): add skills.define + chat.skills runtime wiring
ericallam Apr 18, 2026
a25d16f
feat(cli): built-in skill bundler for trigger dev + deploy
ericallam Apr 18, 2026
8da87db
feat(sdk,cli,core,build): phase 1 of agent skills
ericallam Apr 18, 2026
7f419f0
fix(cli): skills bundler resolves caller-relative paths + correct dev…
ericallam Apr 18, 2026
a8ece5a
WIP chat.store primitive
ericallam Apr 19, 2026
18d0934
feat(sdk,core): Session client SDK + hello-world smoke test
ericallam Apr 20, 2026
c6a5b40
feat(sdk,core): Session channel SDK toolkits + waitpoints — client side
ericallam Apr 23, 2026
a9851e4
feat(sdk): chat.agent → Sessions migration (phases B + C + min E)
ericallam Apr 23, 2026
daa5412
feat(sdk): server-side ChatStream / AgentChat -> Sessions (phase D)
ericallam Apr 23, 2026
1929d5d
fix(sdk,chat): route pipeChat through session.out + chat-agent smoke …
ericallam Apr 23, 2026
0e0059e
test(sdk,core): session-aware mockChatAgent harness + chat.test.ts mocks
ericallam Apr 23, 2026
d68e2d9
docs(architecture): chat.agent over Sessions reference
ericallam Apr 23, 2026
b6c0220
feat(cli): MCP agentChat tool → Sessions migration
ericallam Apr 23, 2026
6660fa4
feat(webapp,sdk): dashboard AgentView → session streams
ericallam Apr 23, 2026
0307fac
feat(sdk,ai-chat): skills runtime subpath + ai-chat browser test bridge
ericallam Apr 23, 2026
9cd71f8
feat(sdk,webapp,ai-chat): end-to-end browser UI smoke on sessions
ericallam Apr 23, 2026
a791ef1
feat(sdk,core): drop legacy chat stream-ID constants
ericallam Apr 23, 2026
e3cf9c5
fix(sdk,chat): make isStreaming optional in reconnectToStream short-c…
ericallam Apr 24, 2026
517d7b0
fix(webapp): use getRequestAbortSignal() for dashboard stream routes
ericallam Apr 24, 2026
9662b98
refactor(sdk): extract browser-safe chat types into ai-shared
ericallam Apr 25, 2026
bfa820a
feat(sdk,webapp): X-Peek-Settled opt-in fast-close on session.out
ericallam Apr 25, 2026
17788ab
feat(sdk,webapp): X-Peek-Settled fast-close (webapp + docs)
ericallam Apr 25, 2026
aa07f82
feat(sdk,playground,ai-chat): chat.agent on Sessions-as-run-manager
ericallam Apr 27, 2026
a76f8b6
ignore claude subdirs
ericallam Apr 28, 2026
952c071
fix sdk build for new context field
ericallam Apr 28, 2026
c040398
fix(core): buffer session-stream chunks even when handlers exist
ericallam Apr 28, 2026
4e6cacc
ignroe claude scheduled tasks lock file
ericallam Apr 28, 2026
5511672
fix(sdk,ai-chat): auto chat:{chatId} tag on server-mediated start; at…
ericallam Apr 28, 2026
53b46f2
fix(ai-chat reference): await Chat.messages persist in onTurnStart
ericallam Apr 29, 2026
37a57e4
feat(ai-chat reference): db:reset:chats helper for clean smoke-test s…
ericallam Apr 29, 2026
d775dba
feat(ai-chat reference): explicit Preload button + Runs link in debug…
ericallam Apr 29, 2026
c9b5236
fix(cli): MCP agentChat — task-bound session creation
ericallam Apr 29, 2026
fc3ff2f
test(clickhouse): add missing task_kind to taskRuns test fixtures
ericallam Apr 29, 2026
4b37fa1
fix(sdk,cli): server-to-agent chat preload — `trigger: "preload"` + `…
ericallam Apr 29, 2026
cf8f45e
feat(sdk,core): ChatChunkTooLargeError for oversized chat-stream chunks
ericallam Apr 30, 2026
6c967ce
fix(sdk,core): unblock CI on PR #3173
ericallam Apr 30, 2026
4385121
fix(core): typesVersions entry for v3/chat-client + inline CodeQL guards
ericallam Apr 30, 2026
7a2e3b0
fix(core,webapp): plumb maxDuration / lockToVersion / region through …
ericallam May 1, 2026
bd9754d
chore: consolidate chat.agent / Sessions / Skills changesets (26 → 8)
ericallam May 1, 2026
1e5a647
chore: rewrite consolidated changesets in user-facing changelog voice
ericallam May 1, 2026
75cf364
fix: address PR 3173 review feedback
ericallam May 1, 2026
6ecf1d7
feat(sdk): resilient SSE reconnection in chat transport
ericallam May 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
16 changes: 16 additions & 0 deletions .changeset/agent-skills.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
"@trigger.dev/sdk": patch
"@trigger.dev/core": patch
"@trigger.dev/build": patch
"trigger.dev": patch
---

Add Agent Skills for `chat.agent`. Drop a folder with a `SKILL.md` and any helper scripts/references next to your task code, register it with `skills.define({ id, path })`, and the CLI bundles it into the deploy image automatically — no `trigger.config.ts` changes. The agent gets a one-line summary in its system prompt and discovers full instructions on demand via `loadSkill`, with `bash` and `readFile` tools scoped per-skill (path-traversal guards, output caps, abort-signal propagation).

```ts
const pdfSkill = skills.define({ id: "pdf-extract", path: "./skills/pdf-extract" });

chat.skills.set([await pdfSkill.local()]);
```

Built on the [AI SDK cookbook pattern](https://ai-sdk.dev/cookbook/guides/agent-skills) — portable across providers. SDK + CLI only for now; dashboard-editable `SKILL.md` text is on the roadmap.
15 changes: 15 additions & 0 deletions .changeset/ai-tool-helpers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
"@trigger.dev/sdk": patch
---

Add `ai.toolExecute(task)` so you can wire a Trigger subtask in as the `execute` handler of an AI SDK `tool()` while defining `description` and `inputSchema` yourself — useful when you want full control over the tool surface and just need Trigger's subtask machinery for the body.

```ts
const myTool = tool({
description: "...",
inputSchema: z.object({ ... }),
execute: ai.toolExecute(mySubtask),
});
```

`ai.tool(task)` (`toolFromTask`) keeps doing the all-in-one wrap and now aligns its return type with AI SDK's `ToolSet`. Minimum `ai` peer raised to `^6.0.116` to avoid cross-version `ToolSet` mismatches in monorepos.
30 changes: 30 additions & 0 deletions .changeset/chat-agent.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
"@trigger.dev/sdk": minor
"@trigger.dev/core": patch
---

Run AI chats as durable Trigger.dev tasks. Define the agent in one function, wire `useChat` to it from React, and the conversation survives page refreshes, network blips, and process restarts — with built-in support for tools, HITL approvals, multi-turn state, and stop-mid-stream cancellation.

```ts
import { chat } from "@trigger.dev/sdk/ai";
import { streamText } from "ai";
import { openai } from "@ai-sdk/openai";

export const myChat = chat.agent({
id: "my-chat",
run: async ({ messages, signal }) =>
streamText({ model: openai("gpt-4o"), messages, abortSignal: signal }),
});
```

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

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

Lifecycle hooks (`onPreload`, `onTurnStart`, `onTurnComplete`, etc.) cover the common needs around persistence, validation, and post-turn work. `chat.store` gives you a typed shared-data slot the agent and client both read and write. `chat.endRun()` exits cleanly when the agent decides it's done. The transport's `watch` mode lets a dashboard tab observe a run without driving it.

Drops the pre-Sessions chat stream constants (`CHAT_STREAM_KEY`, `CHAT_MESSAGES_STREAM_ID`, `CHAT_STOP_STREAM_ID`) — migrate to `sessions.open(id).out` / `.in`.
5 changes: 5 additions & 0 deletions .changeset/mcp-agent-chat-sessions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"trigger.dev": patch
---

The CLI MCP server's agent-chat tools (`start_agent_chat`, `send_agent_message`, `close_agent_chat`) now run on the new Sessions primitive, so AI assistants driving a `chat.agent` get the same idempotent-by-`chatId`, durable-across-runs behavior the browser transport gets. Required PAT scopes go from `write:inputStreams` to `read:sessions` + `write:sessions`.
8 changes: 8 additions & 0 deletions .changeset/mock-chat-agent-test-harness.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@trigger.dev/sdk": patch
"@trigger.dev/core": patch
---

Unit-test `chat.agent` definitions offline with `mockChatAgent` from `@trigger.dev/sdk/ai/test`. Drives a real agent's turn loop in-process — no network, no task runtime — so you can send messages, actions, and stop signals via driver methods, inspect captured output chunks, and verify hooks fire. Pairs with `MockLanguageModelV3` from `ai/test` for model mocking. `setupLocals` lets you pre-seed `locals` (DB clients, service stubs) before `run()` starts.

The broader `runInMockTaskContext` harness it's built on lives at `@trigger.dev/core/v3/test` — useful for unit-testing any task code, not just chat.
14 changes: 14 additions & 0 deletions .changeset/sessions-primitive.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
"@trigger.dev/core": patch
"@trigger.dev/sdk": patch
---

Add Sessions — a durable, task-bound, bidirectional channel pair that outlives any single run. One identifier (your `externalId`), many runs over time, with a stable `.in` channel clients can write to and a stable `.out` channel they can subscribe to. Powers `chat.agent` (separate changeset), and unblocks anything that needs "resume tomorrow" or "approval loop" workflows.

```ts
const session = await sessions.create({ externalId: chatId, taskIdentifier: "my-task" });
await session.in.send({ kind: "message", payload: "..." });
for await (const chunk of session.out.read()) { /* ... */ }
```

Inside the task, `.in.wait()` / `.waitWithIdleTimeout()` suspends the run on a session-stream waitpoint until the next record arrives. `.out.append` / `.pipe` / `.writer` produce records via direct-to-S2 writes.
Loading
Loading