@trigger.dev/sdk 4.5.0-rc.7 → 4.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/dist/commonjs/v3/ai-shared.js +1 -4
  2. package/dist/commonjs/v3/ai-shared.js.map +1 -1
  3. package/dist/commonjs/v3/ai.d.ts +7 -1
  4. package/dist/commonjs/v3/ai.js +110 -44
  5. package/dist/commonjs/v3/ai.js.map +1 -1
  6. package/dist/commonjs/v3/chat-client.js +18 -14
  7. package/dist/commonjs/v3/chat-client.js.map +1 -1
  8. package/dist/commonjs/v3/chat-react.js +1 -3
  9. package/dist/commonjs/v3/chat-react.js.map +1 -1
  10. package/dist/commonjs/v3/chat-server.d.ts +69 -1
  11. package/dist/commonjs/v3/chat-server.js +162 -14
  12. package/dist/commonjs/v3/chat-server.js.map +1 -1
  13. package/dist/commonjs/v3/chat-server.test.js +156 -12
  14. package/dist/commonjs/v3/chat-server.test.js.map +1 -1
  15. package/dist/commonjs/v3/chat.js +4 -3
  16. package/dist/commonjs/v3/chat.js.map +1 -1
  17. package/dist/commonjs/v3/chat.test.js +6 -18
  18. package/dist/commonjs/v3/chat.test.js.map +1 -1
  19. package/dist/commonjs/v3/idempotencyKeys.js.map +1 -1
  20. package/dist/commonjs/v3/prompt.js +2 -6
  21. package/dist/commonjs/v3/prompt.js.map +1 -1
  22. package/dist/commonjs/v3/promptManagement.js.map +1 -1
  23. package/dist/commonjs/v3/retry.js.map +1 -1
  24. package/dist/commonjs/v3/runs.d.ts +1 -1
  25. package/dist/commonjs/v3/sessions.js +1 -0
  26. package/dist/commonjs/v3/sessions.js.map +1 -1
  27. package/dist/commonjs/v3/shared.js.map +1 -1
  28. package/dist/commonjs/v3/skill.js.map +1 -1
  29. package/dist/commonjs/v3/streams.js +2 -3
  30. package/dist/commonjs/v3/streams.js.map +1 -1
  31. package/dist/commonjs/v3/streams.test.js.map +1 -1
  32. package/dist/commonjs/v3/test/mock-chat-agent.js +1 -4
  33. package/dist/commonjs/v3/test/mock-chat-agent.js.map +1 -1
  34. package/dist/commonjs/v3/test/test-session-handle.js.map +1 -1
  35. package/dist/commonjs/v3/triggerClient.test.js +1 -1
  36. package/dist/commonjs/v3/triggerClient.test.js.map +1 -1
  37. package/dist/commonjs/v3/triggerClient.types.test.js +11 -11
  38. package/dist/commonjs/v3/triggerClient.types.test.js.map +1 -1
  39. package/dist/commonjs/version.js +1 -1
  40. package/dist/esm/v3/ai-shared.js +1 -4
  41. package/dist/esm/v3/ai-shared.js.map +1 -1
  42. package/dist/esm/v3/ai.d.ts +7 -1
  43. package/dist/esm/v3/ai.js +110 -44
  44. package/dist/esm/v3/ai.js.map +1 -1
  45. package/dist/esm/v3/chat-client.js +18 -14
  46. package/dist/esm/v3/chat-client.js.map +1 -1
  47. package/dist/esm/v3/chat-react.js +1 -3
  48. package/dist/esm/v3/chat-react.js.map +1 -1
  49. package/dist/esm/v3/chat-server.d.ts +69 -1
  50. package/dist/esm/v3/chat-server.js +162 -14
  51. package/dist/esm/v3/chat-server.js.map +1 -1
  52. package/dist/esm/v3/chat-server.test.js +156 -12
  53. package/dist/esm/v3/chat-server.test.js.map +1 -1
  54. package/dist/esm/v3/chat.js +4 -3
  55. package/dist/esm/v3/chat.js.map +1 -1
  56. package/dist/esm/v3/chat.test.js +6 -18
  57. package/dist/esm/v3/chat.test.js.map +1 -1
  58. package/dist/esm/v3/idempotencyKeys.js +1 -1
  59. package/dist/esm/v3/idempotencyKeys.js.map +1 -1
  60. package/dist/esm/v3/prompt.js +2 -6
  61. package/dist/esm/v3/prompt.js.map +1 -1
  62. package/dist/esm/v3/promptManagement.js.map +1 -1
  63. package/dist/esm/v3/retry.js.map +1 -1
  64. package/dist/esm/v3/sessions.js +1 -0
  65. package/dist/esm/v3/sessions.js.map +1 -1
  66. package/dist/esm/v3/shared.js.map +1 -1
  67. package/dist/esm/v3/skill.js.map +1 -1
  68. package/dist/esm/v3/streams.js +2 -3
  69. package/dist/esm/v3/streams.js.map +1 -1
  70. package/dist/esm/v3/streams.test.js.map +1 -1
  71. package/dist/esm/v3/test/mock-chat-agent.js +4 -7
  72. package/dist/esm/v3/test/mock-chat-agent.js.map +1 -1
  73. package/dist/esm/v3/test/test-session-handle.js.map +1 -1
  74. package/dist/esm/v3/triggerClient.test.js +1 -1
  75. package/dist/esm/v3/triggerClient.test.js.map +1 -1
  76. package/dist/esm/v3/triggerClient.types.test.js +11 -11
  77. package/dist/esm/v3/triggerClient.types.test.js.map +1 -1
  78. package/dist/esm/version.js +1 -1
  79. package/docs/ai/prompts.mdx +0 -4
  80. package/docs/ai-chat/actions.mdx +0 -4
  81. package/docs/ai-chat/anatomy.mdx +0 -4
  82. package/docs/ai-chat/backend.mdx +0 -4
  83. package/docs/ai-chat/background-injection.mdx +0 -4
  84. package/docs/ai-chat/changelog.mdx +109 -1
  85. package/docs/ai-chat/chat-local.mdx +0 -4
  86. package/docs/ai-chat/client-protocol.mdx +0 -4
  87. package/docs/ai-chat/compaction.mdx +0 -4
  88. package/docs/ai-chat/custom-agents.mdx +32 -4
  89. package/docs/ai-chat/error-handling.mdx +0 -4
  90. package/docs/ai-chat/fast-starts.mdx +86 -4
  91. package/docs/ai-chat/frontend.mdx +0 -4
  92. package/docs/ai-chat/how-it-works.mdx +0 -4
  93. package/docs/ai-chat/lifecycle-hooks.mdx +0 -4
  94. package/docs/ai-chat/mcp.mdx +0 -4
  95. package/docs/ai-chat/overview.mdx +0 -4
  96. package/docs/ai-chat/patterns/branching-conversations.mdx +0 -4
  97. package/docs/ai-chat/patterns/code-sandbox.mdx +0 -4
  98. package/docs/ai-chat/patterns/database-persistence.mdx +0 -4
  99. package/docs/ai-chat/patterns/human-in-the-loop.mdx +9 -5
  100. package/docs/ai-chat/patterns/large-payloads.mdx +0 -4
  101. package/docs/ai-chat/patterns/oom-resilience.mdx +0 -4
  102. package/docs/ai-chat/patterns/persistence-and-replay.mdx +0 -4
  103. package/docs/ai-chat/patterns/recovery-boot.mdx +0 -4
  104. package/docs/ai-chat/patterns/skills.mdx +0 -4
  105. package/docs/ai-chat/patterns/sub-agents.mdx +0 -4
  106. package/docs/ai-chat/patterns/tool-result-auditing.mdx +0 -4
  107. package/docs/ai-chat/patterns/trusted-edge-signals.mdx +0 -4
  108. package/docs/ai-chat/patterns/version-upgrades.mdx +0 -4
  109. package/docs/ai-chat/pending-messages.mdx +0 -4
  110. package/docs/ai-chat/prompt-caching.mdx +4 -4
  111. package/docs/ai-chat/quick-start.mdx +0 -4
  112. package/docs/ai-chat/reference.mdx +1 -5
  113. package/docs/ai-chat/server-chat.mdx +0 -4
  114. package/docs/ai-chat/sessions.mdx +0 -4
  115. package/docs/ai-chat/testing.mdx +0 -4
  116. package/docs/ai-chat/tools.mdx +0 -4
  117. package/docs/ai-chat/types.mdx +0 -4
  118. package/docs/ai-chat/upgrade-guide.mdx +0 -4
  119. package/docs/building-with-ai.mdx +1 -1
  120. package/docs/deploy-environment-variables.mdx +1 -1
  121. package/docs/deployment/dev-branches.mdx +92 -0
  122. package/docs/deployment/overview.mdx +1 -1
  123. package/docs/help-slack.mdx +1 -0
  124. package/docs/how-to-reduce-your-spend.mdx +14 -7
  125. package/docs/introduction.mdx +13 -13
  126. package/docs/mcp-agent-rules.mdx +1 -1
  127. package/docs/open-source-self-hosting.mdx +1 -1
  128. package/docs/self-hosting/overview.mdx +2 -1
  129. package/docs/tasks/scheduled.mdx +2 -2
  130. package/docs/troubleshooting-debugging-in-vscode.mdx +1 -0
  131. package/docs/troubleshooting-github-issues.mdx +1 -1
  132. package/docs/troubleshooting-uptime-status.mdx +1 -0
  133. package/docs/video-walkthrough.mdx +1 -1
  134. package/docs/wait-for.mdx +1 -1
  135. package/package.json +2 -2
  136. package/docs/cli-dev.mdx +0 -8
@@ -4,10 +4,6 @@ sidebarTitle: "OOM resilience"
4
4
  description: "Recover from out-of-memory errors mid-turn by automatically retrying the failed turn on a larger machine — without losing the in-flight user message or re-processing completed turns."
5
5
  ---
6
6
 
7
- import RcBanner from "/snippets/ai-chat-rc-banner.mdx";
8
-
9
- <RcBanner />
10
-
11
7
  When a `chat.agent` turn runs out of memory, the worker process dies and everything in it is gone: the in-flight LLM call, the accumulator, any tool execution mid-flight. By default, Trigger.dev surfaces the OOM as a run failure.
12
8
 
13
9
  Setting `oomMachine` opts the agent into automatic recovery: the failed turn re-runs on a larger machine, picks up the user message that triggered the OOM (without re-processing earlier completed turns), and produces a normal response.
@@ -4,10 +4,6 @@ sidebarTitle: "Persistence and replay"
4
4
  description: "How chat.agent rebuilds conversation history at run boot — durable JSON snapshot in object storage plus session.out replay, with a hydrateMessages short-circuit for backend-owned history."
5
5
  ---
6
6
 
7
- import RcBanner from "/snippets/ai-chat-rc-banner.mdx";
8
-
9
- <RcBanner />
10
-
11
7
  `chat.agent` runs are processes — they boot, stream a turn, and either suspend (waiting for the next message) or exit. When the next message arrives at a session whose previous run already exited, a **fresh** run boots with no in-memory state. Something has to rebuild the conversation history before that turn can produce a coherent response.
12
8
 
13
9
  This page walks through the **snapshot + replay** model the runtime uses by default, and the [`hydrateMessages`](/ai-chat/lifecycle-hooks#hydratemessages) short-circuit that turns the whole thing off when the customer owns history.
@@ -4,10 +4,6 @@ sidebarTitle: "Recovery boot"
4
4
  description: "Recover from cancel-mid-stream, crashes, and OOM kills with full conversational context. The smart default Just Works; the onRecoveryBoot hook is the override path for advanced policies."
5
5
  ---
6
6
 
7
- import RcBanner from "/snippets/ai-chat-rc-banner.mdx";
8
-
9
- <RcBanner />
10
-
11
7
  When a `chat.agent` run dies in the middle of streaming a response — the user cancels, the worker OOMs, or an unhandled exception kills the process — the durable streams hold what was in flight. The next run boots as a continuation, reads both stream tails, and reconstructs a chain that preserves the partial response so any follow-up (`keep going`, `actually do X instead`, a new question) has full context.
12
8
 
13
9
  The behavior is automatic. The `onRecoveryBoot` hook is opt-in for policies that need something different.
@@ -4,10 +4,6 @@ sidebarTitle: "Agent Skills"
4
4
  description: "Ship reusable capabilities (folders with SKILL.md + scripts) that a chat agent discovers and invokes on demand."
5
5
  ---
6
6
 
7
- import RcBanner from "/snippets/ai-chat-rc-banner.mdx";
8
-
9
- <RcBanner />
10
-
11
7
  Agent skills are reusable capabilities you ship as folders — a `SKILL.md` describing when and how to use them, plus optional scripts, references, and assets. The chat agent sees a short description of each skill in its system prompt, loads the full instructions on demand via a `loadSkill` tool, and invokes the bundled scripts via `bash` — all without you wiring anything up manually.
12
8
 
13
9
  Built on the [AI SDK cookbook pattern](https://ai-sdk.dev/cookbook/guides/agent-skills). Works with any provider (OpenAI, Anthropic, Gemini, etc.) — not tied to Anthropic's server-side skills.
@@ -4,10 +4,6 @@ sidebarTitle: "Sub-Agents"
4
4
  description: "Delegate work to durable sub-agents from within a parent agent's tool calls, with streaming preliminary results."
5
5
  ---
6
6
 
7
- import RcBanner from "/snippets/ai-chat-rc-banner.mdx";
8
-
9
- <RcBanner />
10
-
11
7
  Sub-agents let a parent agent delegate work to other agents running as durable Trigger.dev tasks. The sub-agent's response streams back through the parent as preliminary tool results, so the frontend sees the sub-agent working inside the parent's tool call card.
12
8
 
13
9
  This builds on the AI SDK's [async generator tool pattern](https://ai-sdk.dev/docs/agents/subagents) and Trigger.dev's [AgentChat](/ai-chat/server-chat) for server-side agent interaction.
@@ -4,10 +4,6 @@ sidebarTitle: "Tool result auditing"
4
4
  description: "Fire side effects exactly once per resolved tool call — audit logs, billing, notifications — using extractNewToolResults inside hydrateMessages or onTurnComplete."
5
5
  ---
6
6
 
7
- import RcBanner from "/snippets/ai-chat-rc-banner.mdx";
8
-
9
- <RcBanner />
10
-
11
7
  When a chat agent uses [tools](/ai-chat/tools) (especially [human-in-the-loop](/ai-chat/patterns/human-in-the-loop) tools that wait on `addToolOutput` from the frontend), you often need to fire side effects exactly once per resolved tool call:
12
8
 
13
9
  - **Audit logs** — record every tool result for compliance.
@@ -4,10 +4,6 @@ sidebarTitle: "Trusted edge signals"
4
4
  description: "How to safely deliver server-trusted signals (bot scores, JA4, ASN, ReCAPTCHA verdicts) to a chat.agent run via an edge proxy."
5
5
  ---
6
6
 
7
- import RcBanner from "/snippets/ai-chat-rc-banner.mdx";
8
-
9
- <RcBanner />
10
-
11
7
  A common need for chat-style endpoints is to drive agent behavior from **server-trusted signals** that the browser cannot be allowed to declare itself — bot management scores, JA4 fingerprints, ASN, ReCAPTCHA verdicts, or any other anti-abuse data only the edge can see. The agent's [`clientData`](/ai-chat/reference#withclientdata) channel is the right delivery mechanism, but `clientData` set in the browser is by definition spoofable. The fix is to move the value population out of the browser and into a trusted edge proxy.
12
8
 
13
9
  This page documents the pattern using Cloudflare Workers as the proxy. The same shape applies to any edge layer (custom reverse proxy, Vercel Edge Middleware, AWS Lambda@Edge) — the trust comes from the deployment topology, not from Trigger.dev validating the source.
@@ -4,10 +4,6 @@ sidebarTitle: "Version upgrades"
4
4
  description: "Gracefully migrate suspended chat agents to a new deployment using chat.requestUpgrade() and the continuation mechanism."
5
5
  ---
6
6
 
7
- import RcBanner from "/snippets/ai-chat-rc-banner.mdx";
8
-
9
- <RcBanner />
10
-
11
7
  Chat agent runs are pinned to the worker version they started on. When you deploy a new version, suspended runs resume on the **old** code. If your deploy includes breaking changes (new tools, changed schemas, updated API contracts), this can cause issues.
12
8
 
13
9
  `chat.requestUpgrade()` lets the agent opt out of the current run so the transport triggers a new one on the latest version.
@@ -4,10 +4,6 @@ sidebarTitle: "Pending Messages"
4
4
  description: "Inject user messages mid-execution to steer agents between tool-call steps."
5
5
  ---
6
6
 
7
- import RcBanner from "/snippets/ai-chat-rc-banner.mdx";
8
-
9
- <RcBanner />
10
-
11
7
  ## Overview
12
8
 
13
9
  When an AI agent is executing tool calls, users may want to send a message that **steers the agent mid-execution** — adding context, correcting course, or refining the request without waiting for the response to finish.
@@ -4,10 +4,6 @@ sidebarTitle: "Prompt caching"
4
4
  description: "Cache the stable prefix of your agent's prompt with Anthropic prompt caching to cut token cost and latency on every turn."
5
5
  ---
6
6
 
7
- import RcBanner from "/snippets/ai-chat-rc-banner.mdx";
8
-
9
- <RcBanner />
10
-
11
7
  **Prompt caching lets a provider reuse the unchanged prefix of your prompt across requests, billing it at a fraction of the input price and skipping re-processing.** With Anthropic, cache reads cost ~10% of base input tokens, so a long, stable system prompt or a growing conversation history pays full price once and reads cheaply on every turn after.
12
8
 
13
9
  Caching is a **byte-exact prefix match**: any change in the prefix invalidates everything after it. A multi-turn agent is the ideal case — the system prompt, tools, and earlier turns are identical turn over turn, so the cacheable prefix only grows. `chat.agent` is built to keep that prefix stable across turns, suspends, and resumes; this page shows how to place the cache breakpoints and verify they're hitting.
@@ -135,6 +131,10 @@ The system breakpoint and the conversation breakpoint compose: the system block
135
131
  Anthropic allows **at most 4** cache breakpoints per request, and a prefix must be at least ~1024 tokens (model-dependent) to cache at all — shorter prefixes silently don't cache. One system breakpoint plus one rolling message breakpoint is the typical setup and leaves headroom.
136
132
  </Note>
137
133
 
134
+ <Note>
135
+ This rolling-breakpoint pattern composes with [Head Start](/ai-chat/fast-starts#head-start). On a head-start handover, the first turn's pending tool call is handed to the agent as a tool-approval round whose trailing `tool` message must reach `streamText` untouched for that call to execute. `chat.agent` preserves that tail across `prepareMessages` automatically, so rewriting the last message here is safe: on a resume turn the breakpoint just lands on the next user or assistant message instead of the transient approval row.
136
+ </Note>
137
+
138
138
  ## Caching and compaction
139
139
 
140
140
  Compaction rewrites the conversation prefix — it replaces earlier turns with a summary — so it necessarily invalidates the cached message prefix at that point. That's a one-time reset, not a regression: because `prepareMessages` also runs on the compaction rebuild and result paths, the new (shorter) prefix gets a fresh breakpoint and re-warms on the next turn. Your system-prompt cache is unaffected — compaction never touches the system block. See [Compaction](/ai-chat/compaction) for how the summary is produced.
@@ -4,10 +4,6 @@ sidebarTitle: "Quick Start"
4
4
  description: "Get a working AI agent in 3 steps — define an agent, generate a token, and wire up the frontend."
5
5
  ---
6
6
 
7
- import RcBanner from "/snippets/ai-chat-rc-banner.mdx";
8
-
9
- <RcBanner />
10
-
11
7
  These steps assume you already have a Trigger.dev project with the SDK installed and the CLI authenticated — if you don't, follow [Manual setup](/manual-setup) (or `npx trigger.dev@latest init` in an existing project) first. You should be able to run `pnpm exec trigger dev` from your project root before continuing.
12
8
 
13
9
  The chat surface works with Vercel AI SDK **v5, v6, or v7**; install whichever major you want. On **v7**, also install `@ai-sdk/otel` so your model calls are traced (the SDK registers it for you). See [compatibility](/ai-chat/reference#compatibility) for the full matrix.
@@ -4,15 +4,11 @@ sidebarTitle: "API Reference"
4
4
  description: "Complete API reference for the AI Agents SDK — backend options, events, frontend transport, and hooks."
5
5
  ---
6
6
 
7
- import RcBanner from "/snippets/ai-chat-rc-banner.mdx";
8
-
9
- <RcBanner />
10
-
11
7
  ## Compatibility
12
8
 
13
9
  | Dependency | Supported | Notes |
14
10
  |---|---|---|
15
- | `@trigger.dev/sdk` | `>=4.5.0-rc.0` | The chat agent surface lives in this SDK release. Install with `@trigger.dev/sdk@rc`. |
11
+ | `@trigger.dev/sdk` | `>=4.5.0` | The chat agent surface lives in this SDK release. Install with `@trigger.dev/sdk@latest`. |
16
12
  | `ai` (Vercel AI SDK) | `^5.0.0 \|\| ^6.0.0 \|\| >=7.0.0-canary <8` | Declared as a peer. v6 is what we develop against day to day; v5 and v7 work too (v7 is in canary/beta upstream). Your installed `ai` major drives the chat surface's types. |
17
13
  | `@ai-sdk/otel` | `1.x` (v7 only) | Optional. AI SDK 7 moved model-call span emission out of `ai` core into this adapter. Install it alongside `ai@7` and the SDK auto-registers it, so your model calls show up as spans in the run trace. Not needed on v5/v6, where `ai` core emits spans. See [AI SDK 7 telemetry](#ai-sdk-7-telemetry) below. |
18
14
  | `@ai-sdk/react` | matches your `ai` major | Pulled in by `useChat`. The transport works with whichever React hook ships in the same major as your `ai` version. |
@@ -4,10 +4,6 @@ sidebarTitle: "Server-Side Chat"
4
4
  description: "Use AgentChat to interact with chat agents from server-side code — tasks, webhooks, scripts, or other agents."
5
5
  ---
6
6
 
7
- import RcBanner from "/snippets/ai-chat-rc-banner.mdx";
8
-
9
- <RcBanner />
10
-
11
7
  `AgentChat` lets you chat with agents from server-side code. It works inside tasks (agent-to-agent), request handlers, webhook processors, and scripts.
12
8
 
13
9
  ```ts
@@ -4,10 +4,6 @@ sidebarTitle: "Sessions"
4
4
  description: "A Session is a stateful execution of an agent, with two-way streaming and durable compute. A single Session can have multiple runs associated with it."
5
5
  ---
6
6
 
7
- import RcBanner from "/snippets/ai-chat-rc-banner.mdx";
8
-
9
- <RcBanner />
10
-
11
7
  **A Session is a stateful execution of an agent.** It includes two-way streaming and durable compute, and a single Session can have multiple runs associated with it.
12
8
 
13
9
  The **two-way streaming** is a pair of durable streams. The input stream (`.in`) carries incoming user messages to your task. The output stream (`.out`) carries everything the agent produces back to your clients: AI generation parts (text, reasoning, tool calls) and any custom data parts you write.
@@ -4,10 +4,6 @@ sidebarTitle: "Testing"
4
4
  description: "Drive a chat.agent through real turns in unit tests — no network, no task runtime, no mocking the SDK."
5
5
  ---
6
6
 
7
- import RcBanner from "/snippets/ai-chat-rc-banner.mdx";
8
-
9
- <RcBanner />
10
-
11
7
  ## Overview
12
8
 
13
9
  `@trigger.dev/sdk/ai/test` exports `mockChatAgent`, an offline harness that runs your `chat.agent` definition's `run()` function inside an in-memory task runtime. You send messages, actions, and stop signals through driver methods and assert against the chunks the agent emits.
@@ -4,10 +4,6 @@ sidebarTitle: "Tools"
4
4
  description: "Declare tools on chat.agent so toModelOutput survives across turns, get them back typed in run(), and type your messages from them."
5
5
  ---
6
6
 
7
- import RcBanner from "/snippets/ai-chat-rc-banner.mdx";
8
-
9
- <RcBanner />
10
-
11
7
  `chat.agent` doesn't call the model for you. Your tools still go to [`streamText`](https://sdk.vercel.ai/docs/ai-sdk-core/tools-and-tool-calling) inside `run()`. But you should **also declare them on the agent config**:
12
8
 
13
9
  ```ts
@@ -4,10 +4,6 @@ sidebarTitle: "Types"
4
4
  description: "TypeScript types for AI Agents, UI messages, and the frontend transport."
5
5
  ---
6
6
 
7
- import RcBanner from "/snippets/ai-chat-rc-banner.mdx";
8
-
9
- <RcBanner />
10
-
11
7
  TypeScript patterns for [AI Chat](/ai-chat/overview). This page covers how to pin a custom AI SDK [`UIMessage`](https://sdk.vercel.ai/docs/reference/ai-sdk-core/ui-message) subtype with `chat.withUIMessage`, fix a typed `clientData` schema with `chat.withClientData`, chain builder-level hooks, and align types on the client.
12
8
 
13
9
  ## Custom `UIMessage` with `chat.withUIMessage`
@@ -4,10 +4,6 @@ sidebarTitle: "Sessions Upgrade Guide"
4
4
  description: "Migrating chat.agent code from the prerelease API to the Sessions-as-run-manager release."
5
5
  ---
6
6
 
7
- import RcBanner from "/snippets/ai-chat-rc-banner.mdx";
8
-
9
- <RcBanner />
10
-
11
7
  This guide is for customers who tried `chat.agent` during the prerelease period.
12
8
  The public surface of `chat.agent({...})`, `useTriggerChatTransport`,
13
9
  `AgentChat`, `chat.defer`, and `chat.history` is largely
@@ -1,5 +1,5 @@
1
1
  ---
2
- title: "Overview"
2
+ title: "Building with AI: overview"
3
3
  sidebarTitle: "Overview"
4
4
  description: "Tools and resources for building Trigger.dev projects with AI coding assistants."
5
5
  ---
@@ -230,7 +230,7 @@ To sync environment variables from your Vercel projects to Trigger.dev, you can
230
230
 
231
231
  #### Deploy
232
232
 
233
- When you run the [CLI deploy command](/cli-deploy) directly or using [GitHub Actions](/github-actions) it will sync the environment variables from [Infisical](https://infisical.com) to Trigger.dev. This means they'll appear on the Environment Variables page so you can confirm that it's worked.
233
+ When you run the [CLI deploy command](/cli-deploy-commands) directly or using [GitHub Actions](/github-actions) it will sync the environment variables from [Infisical](https://infisical.com) to Trigger.dev. This means they'll appear on the Environment Variables page so you can confirm that it's worked.
234
234
 
235
235
  This means that you need to redeploy your Trigger.dev tasks if you change the environment variables in [Infisical](https://infisical.com).
236
236
 
@@ -0,0 +1,92 @@
1
+ ---
2
+ title: "Development branches"
3
+ sidebarTitle: "Dev branches"
4
+ description: "Run multiple local dev sessions in isolation by giving each one its own development branch. Use branches to keep parallel work (in separate worktrees, directories, or agents) from clashing."
5
+ ---
6
+
7
+ Every project starts with a single development environment called `default`. A **dev branch** is an isolated environment that lives under development, with its own runs, schedules, and concurrency.
8
+
9
+ Branches are useful when you run more than one local dev session at a time. Give each session its own branch so their runs don't collide:
10
+
11
+ - Run several [git worktrees](https://git-scm.com/docs/git-worktree) or copies of your project in parallel, one branch each.
12
+ - Let multiple coding agents each work in their own branch without stepping on one another.
13
+
14
+ When you're done with a branch, you can archive it to free up a slot or just re-use it.
15
+
16
+ ## Run a dev session on a branch
17
+
18
+ Log in with the CLI first:
19
+
20
+ <CodeGroup>
21
+
22
+ ```bash npm
23
+ npx trigger.dev@latest login
24
+ ```
25
+
26
+ ```bash pnpm
27
+ pnpm dlx trigger.dev@latest login
28
+ ```
29
+
30
+ ```bash bun
31
+ bunx trigger.dev@latest login
32
+ ```
33
+
34
+ </CodeGroup>
35
+
36
+ Then start a dev session on a branch with the `--branch` flag. If the branch doesn't exist yet, it's created:
37
+
38
+ <CodeGroup>
39
+
40
+ ```bash npm
41
+ npx trigger.dev@latest dev --branch my-feature
42
+ ```
43
+
44
+ ```bash pnpm
45
+ pnpm dlx trigger.dev@latest dev --branch my-feature
46
+ ```
47
+
48
+ ```bash bun
49
+ bunx trigger.dev@latest dev --branch my-feature
50
+ ```
51
+
52
+ </CodeGroup>
53
+
54
+ Without `--branch`, the session runs on the `default` branch.
55
+
56
+ <Tip>
57
+ You can also set the branch with the `TRIGGER_DEV_BRANCH` environment variable instead of the flag.
58
+ </Tip>
59
+
60
+ ## Archive a branch
61
+
62
+ Archive a branch from the CLI when you no longer need it. The CLI detects your local git branch, or you can name one with `--branch`:
63
+
64
+ <CodeGroup>
65
+
66
+ ```bash npm
67
+ npx trigger.dev@latest dev archive --branch my-feature
68
+ ```
69
+
70
+ ```bash pnpm
71
+ pnpm dlx trigger.dev@latest dev archive --branch my-feature
72
+ ```
73
+
74
+ ```bash bun
75
+ bunx trigger.dev@latest dev archive --branch my-feature
76
+ ```
77
+
78
+ </CodeGroup>
79
+
80
+ You can also create and archive branches from the **Dev branches** page in the dashboard.
81
+
82
+ ## Limits on active branches
83
+
84
+ Each branch has its own concurrency, so we limit how many can be active per project. Archive a branch at any time to unlock another slot.
85
+
86
+ | Plan | Active dev branches |
87
+ | ----- | ------------------- |
88
+ | Free | 25 |
89
+ | Hobby | 25 |
90
+ | Pro | 25 |
91
+
92
+ Need more? [Get in touch](https://trigger.dev/contact) and we'll raise the limit.
@@ -6,7 +6,7 @@ description: "Learn how to deploy your tasks to Trigger.dev."
6
6
 
7
7
  import CorepackError from "/snippets/corepack-error.mdx";
8
8
 
9
- Before you can run production workloads on Trigger.dev, you need to deploy your tasks. The only way to do this at the moment is through the [deploy CLI command](/cli-deploy):
9
+ Before you can run production workloads on Trigger.dev, you need to deploy your tasks. The only way to do this at the moment is through the [deploy CLI command](/cli-deploy-commands):
10
10
 
11
11
  <CodeGroup>
12
12
 
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  title: "Slack support"
3
+ description: "Trigger.dev Pro plan customers can request a private Slack Connect channel for support."
3
4
  ---
4
5
 
5
6
  If you're on the Trigger.dev Pro plan, you can request a private Slack Connect channel.
@@ -16,21 +16,28 @@ Monitor your usage dashboard to understand your spending patterns. You can see:
16
16
 
17
17
  You can view your usage page by clicking the "Organization" menu in the top left of the dashboard and then clicking "Usage".
18
18
 
19
- ## Create billing alerts
19
+ ## Set billing limits and alerts
20
20
 
21
- Configure billing alerts in your dashboard to get notified when you approach spending thresholds. This helps you:
21
+ Configure billing limits and alerts in your dashboard to protect against unexpected usage and get notified when you approach spending thresholds. This helps you:
22
22
 
23
+ - Set a monthly compute spend limit for your organization
23
24
  - Catch unexpected cost increases early
24
25
  - Identify runaway tasks before they become expensive
25
26
 
26
- The billing alerts page includes two types of alerts:
27
+ The **Billing limits** settings page has two sections:
27
28
 
28
- - **Standard alerts**: Get notified at 75%, 90%, 100%, 200%, and 500% of your monthly budget
29
- - **Spike alerts**: Catch runaway usage from bugs or errors with alerts at 10x (1000%), 20x (2000%), 50x (5000%), and 100x (10000%) of your monthly budget. We recommend keeping these enabled as a safety net.
29
+ - **Billing limit**: Choose your plan limit, a custom amount, or no limit. When a limit is reached, billable environments (`production`, `staging`, and `preview`) enter a **grace period** — queues pause and new runs queue without starting. After grace expires, new triggers are rejected until you increase or remove the limit.
30
+ - **Billing alerts**: Add email alerts at specific spend thresholds (% of your limit when a limit is set, or dollar amounts when no limit is configured). Alerts notify you only; they do **not** pause environments or reject triggers.
30
31
 
31
- ![Billing alerts](./images/billing-alerts-ui.png)
32
+ **Limits vs alerts:** A billing limit enforces spend (grace → reject). Billing alerts are optional notifications at thresholds you choose.
32
33
 
33
- You can view your billing alerts page by clicking the "Organization" menu in the top left of the dashboard and then clicking "Settings".
34
+ **Soft limits:** Billing limits are not instantaneous hard caps. Usage is evaluated on a short delay, so spend can briefly exceed your limit before enforcement applies. Queued runs during grace incur no compute cost until they start. See our [terms](https://trigger.dev/terms) for refund policy details.
35
+
36
+ On the **Usage** page, when you have a custom billing limit (or a plan limit that differs from included usage), a **Billing limit** marker appears on the usage bar alongside your current spend and plan included usage.
37
+
38
+ ![Billing limits and alerts settings](./images/billing-alerts-ui.png)
39
+
40
+ You can open the page from the **Organization** menu in the top left of the dashboard, then **Settings** → **Billing limits**.
34
41
 
35
42
  ## Reduce your machine sizes
36
43
 
@@ -91,19 +91,19 @@ We provide everything you need to build and manage background tasks: a CLI and S
91
91
 
92
92
  | Extension | What it does | Docs |
93
93
  | :-------------------- | :----------------------------------------------------------- | :----------------------------------------------------- |
94
- | prismaExtension | Use Prisma with Trigger.dev | [Learn more](/config/extensions/prismaExtension) |
95
- | pythonExtension | Execute Python scripts in Trigger.dev | [Learn more](/config/extensions/pythonExtension) |
96
- | playwright | Use Playwright with Trigger.dev | [Learn more](/config/extensions/playwright) |
97
- | puppeteer | Use Puppeteer with Trigger.dev | [Learn more](/config/extensions/puppeteer) |
98
- | lightpanda | Use Lightpanda with Trigger.dev | [Learn more](/config/extensions/lightpanda) |
99
- | ffmpeg | Use FFmpeg with Trigger.dev | [Learn more](/config/extensions/ffmpeg) |
100
- | aptGet | Install system packages with aptGet | [Learn more](/config/extensions/aptGet) |
101
- | additionalFiles | Copy additional files to the build directory | [Learn more](/config/extensions/additionalFiles) |
102
- | additionalPackages | Include additional packages in the build | [Learn more](/config/extensions/additionalPackages) |
103
- | syncEnvVars | Automatically sync environment variables to Trigger.dev | [Learn more](/config/extensions/syncEnvVars) |
104
- | esbuildPlugin | Add existing or custom esbuild plugins to your build process | [Learn more](/config/extensions/esbuildPlugin) |
105
- | emitDecoratorMetadata | Support for the emitDecoratorMetadata TypeScript compiler | [Learn more](/config/extensions/emitDecoratorMetadata) |
106
- | audioWaveform | Support for Audio Waveform in your project | [Learn more](/config/extensions/audioWaveform) |
94
+ | prismaExtension | Use Prisma with Trigger.dev | [prismaExtension docs](/config/extensions/prismaExtension) |
95
+ | pythonExtension | Execute Python scripts in Trigger.dev | [pythonExtension docs](/config/extensions/pythonExtension) |
96
+ | playwright | Use Playwright with Trigger.dev | [playwright extension docs](/config/extensions/playwright) |
97
+ | puppeteer | Use Puppeteer with Trigger.dev | [puppeteer extension docs](/config/extensions/puppeteer) |
98
+ | lightpanda | Use Lightpanda with Trigger.dev | [lightpanda extension docs](/config/extensions/lightpanda) |
99
+ | ffmpeg | Use FFmpeg with Trigger.dev | [ffmpeg extension docs](/config/extensions/ffmpeg) |
100
+ | aptGet | Install system packages with aptGet | [aptGet extension docs](/config/extensions/aptGet) |
101
+ | additionalFiles | Copy additional files to the build directory | [additionalFiles docs](/config/extensions/additionalFiles) |
102
+ | additionalPackages | Include additional packages in the build | [additionalPackages docs](/config/extensions/additionalPackages) |
103
+ | syncEnvVars | Automatically sync environment variables to Trigger.dev | [syncEnvVars docs](/config/extensions/syncEnvVars) |
104
+ | esbuildPlugin | Add existing or custom esbuild plugins to your build process | [esbuildPlugin docs](/config/extensions/esbuildPlugin) |
105
+ | emitDecoratorMetadata | Support for the emitDecoratorMetadata TypeScript compiler | [emitDecoratorMetadata docs](/config/extensions/emitDecoratorMetadata) |
106
+ | audioWaveform | Support for Audio Waveform in your project | [audioWaveform docs](/config/extensions/audioWaveform) |
107
107
 
108
108
  ## Explore by example
109
109
 
@@ -19,7 +19,7 @@ The install command is the same, and now installs skills:
19
19
  npx trigger.dev@latest skills
20
20
  ```
21
21
 
22
- `npx trigger.dev@latest install-rules` still works as an alias, and `trigger dev` offers to install the skills on first run.
22
+ `npx trigger.dev@latest install-rules` still works as an alias for `skills`, and `trigger dev` offers to install the skills on first run.
23
23
 
24
24
  The old task and realtime guidance now lives in the `trigger-authoring-tasks` and `trigger-realtime-and-frontend` skills, alongside two new skills for building `chat.agent` AI agents. See [Skills](/skills) for the full list and supported assistants.
25
25
 
@@ -156,7 +156,7 @@ TRIGGER_DOMAIN=1234-42-42-42-42.ngrok-free.app
156
156
 
157
157
  ### Registry setup
158
158
 
159
- If you want to deploy v3 projects, you will need access to a Docker registry. The [CLI deploy](/cli-deploy) command will push the images, and then the worker machine can pull them when needed. We will use Docker Hub as an example.
159
+ If you want to deploy v3 projects, you will need access to a Docker registry. The [CLI deploy](/cli-deploy-commands) command will push the images, and then the worker machine can pull them when needed. We will use Docker Hub as an example.
160
160
 
161
161
  1. Sign up for a free account at [Docker Hub](https://hub.docker.com/)
162
162
 
@@ -1,5 +1,6 @@
1
1
  ---
2
- title: "Overview"
2
+ title: "Self-hosting overview"
3
+ sidebarTitle: "Overview"
3
4
  description: "You can self-host Trigger.dev on your own infrastructure."
4
5
  ---
5
6
 
@@ -95,7 +95,7 @@ There are two ways of doing this:
95
95
 
96
96
  ### Declarative schedules
97
97
 
98
- These sync when you run the [dev](/cli-dev) or [deploy](/cli-deploy) commands.
98
+ These sync when you run the [dev](/cli-dev-commands) or [deploy](/cli-deploy-commands) commands.
99
99
 
100
100
  To create them you add the `cron` property to your `schedules.task()`. This property is optional and is only used if you want to add a declarative schedule to your task:
101
101
 
@@ -127,7 +127,7 @@ export const secondScheduledTask = schedules.task({
127
127
  });
128
128
  ```
129
129
 
130
- When you run the [dev](/cli-dev) or [deploy](/cli-deploy) commands, declarative schedules will be synced. If you add, delete or edit the `cron` property it will be updated when you run these commands. You can view your schedules on the Schedules page in the dashboard.
130
+ When you run the [dev](/cli-dev-commands) or [deploy](/cli-deploy-commands) commands, declarative schedules will be synced. If you add, delete or edit the `cron` property it will be updated when you run these commands. You can view your schedules on the Schedules page in the dashboard.
131
131
 
132
132
  ### Imperative schedules
133
133
 
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  title: "Debugging in VS Code"
3
3
  sidebarTitle: "Debugging in VS Code"
4
+ description: "Attach the VS Code debugger to your Trigger.dev tasks to set breakpoints and step through your code."
4
5
  ---
5
6
 
6
7
  import DebuggingInVSCode from '/snippets/debugging_in_vscode.mdx';
@@ -3,4 +3,4 @@ title: "GitHub Issues"
3
3
  url: "https://github.com/triggerdotdev/trigger.dev/issues"
4
4
  ---
5
5
 
6
- Please [join our community on Discord](https://github.com/triggerdotdev/trigger.dev/issues) to ask questions, share your projects, and get help from other developers.
6
+ Please [join our community on Discord](https://trigger.dev/discord) to report bugs, request features, or get help from the team and other developers.
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  title: "Uptime Status"
3
+ description: "Subscribe to email notifications for Trigger.dev platform incidents and status updates."
3
4
  ---
4
5
 
5
6
  Get email notifications when Trigger.dev creates, updates or resolves a platform incident.
@@ -20,4 +20,4 @@ description: "Go from zero to a working task in your Next.js app in 10 minutes."
20
20
  - [1:44](https://youtu.be/YH_4c0K7fGM?si=J8svVzotZtyTXDap&t=104) – [Run and test](/run-tests) the "Hello, world!" example project
21
21
  - [2:09](https://youtu.be/YH_4c0K7fGM?si=FMTP8ep_cDBCU0_x&t=128) – Create and run an AI image generation task that uses [Fal.ai](https://fal.ai) – ([View the code](/guides/examples/fal-ai-image-to-cartoon))
22
22
  - [6:25](https://youtu.be/YH_4c0K7fGM?si=pPc8iLI2Y9FGD3yo&t=385) – Create and run a [Realtime](/realtime/overview) example using [React hooks](/realtime/react-hooks) – ([View the code](/guides/examples/fal-ai-realtime))
23
- - [11:10](https://youtu.be/YH_4c0K7fGM?si=Mjd0EvvNsNlVouvY&t=670) – [Deploy your task](/cli-deploy) to the Trigger.dev Cloud
23
+ - [11:10](https://youtu.be/YH_4c0K7fGM?si=Mjd0EvvNsNlVouvY&t=670) – [Deploy your task](/cli-deploy-commands) to the Trigger.dev Cloud
package/docs/wait-for.mdx CHANGED
@@ -38,5 +38,5 @@ You can pass an idempotency key to any wait function, allowing you to skip waits
38
38
 
39
39
  ```ts
40
40
  // Specify the idempotency key and TTL when waiting for a duration:
41
- await wait.for({ seconds: 10 }, { idempotencyKey: "my-idempotency-key", idempotencyKeyTTL: "1h" });
41
+ await wait.for({ seconds: 10, idempotencyKey: "my-idempotency-key", idempotencyKeyTTL: "1h" });
42
42
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trigger.dev/sdk",
3
- "version": "4.5.0-rc.7",
3
+ "version": "4.5.0",
4
4
  "description": "trigger.dev Node.JS SDK",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -66,7 +66,7 @@
66
66
  "dependencies": {
67
67
  "@opentelemetry/api": "1.9.1",
68
68
  "@opentelemetry/semantic-conventions": "1.41.1",
69
- "@trigger.dev/core": "4.5.0-rc.7",
69
+ "@trigger.dev/core": "4.5.0",
70
70
  "chalk": "^5.2.0",
71
71
  "cronstrue": "^2.21.0",
72
72
  "debug": "^4.3.4",
package/docs/cli-dev.mdx DELETED
@@ -1,8 +0,0 @@
1
- ---
2
- title: "CLI dev command"
3
- description: "The `trigger.dev dev` command is used to run your tasks locally."
4
- ---
5
-
6
- import CliDevCommands from "/snippets/cli-commands-develop.mdx";
7
-
8
- <CliDevCommands />