chore: release v4.5.0#3563
Open
github-actions[bot] wants to merge 1 commit into
Open
Conversation
28fd35c to
9a0e7f8
Compare
9a0e7f8 to
e477aeb
Compare
e477aeb to
2dd9063
Compare
2dd9063 to
7390aa8
Compare
7390aa8 to
48d6326
Compare
48d6326 to
830f8c9
Compare
830f8c9 to
be2f622
Compare
be2f622 to
f428661
Compare
f428661 to
b5d0261
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
6 improvements.
Improvements
chat.agentactions are no longer treated as turns. They firehydrateMessagesandonActiononly — noonTurnStart/prepareMessages/onBeforeTurnComplete/onTurnComplete, norun(), no turn-counter increment. The trace span is namedchat actioninstead ofchat turn N. (#3543)ai.toolExecute(task)so you can wire a Trigger subtask in as theexecutehandler of an AI SDKtool()while definingdescriptionandinputSchemayourself — useful when you want full control over the tool surface and just need Trigger's subtask machinery for the body. (#3546)idempotencyKeyvalues at the API boundary so they no longer trip an internal size limit on the underlying unique index and surface as a generic 500. Inputs are capped at 2048 characters — well above whatidempotencyKeys.create()produces (a 64-character hash) and above any realistic raw key. Applies totasks.trigger,tasks.batchTrigger,batch.create(Phase 1 streaming batches),wait.createToken,wait.forDuration, and the input/session stream waitpoint endpoints. Over-limit requests now return a structured 400 instead. (#3560)TASK_PROCESS_SIGSEGVtask crashes under the user's retry policy instead of failing the run on the first segfault. SIGSEGV in Node tasks is frequently non-deterministic (native addon races, JIT/GC interaction, near-OOM in native code, host issues), so retrying on a fresh process often succeeds. The retry is gated by the task's existingretryconfig +maxAttempts— same pathTASK_PROCESS_SIGTERMand uncaught exceptions already use — so tasks without a retry policy still fail fast. (#3552)Raw changeset output
Releases
@trigger.dev/sdk@4.5.0
Minor Changes
chat.agentactions are no longer treated as turns. They firehydrateMessagesandonActiononly — noonTurnStart/prepareMessages/onBeforeTurnComplete/onTurnComplete, norun(), no turn-counter increment. The trace span is namedchat actioninstead ofchat turn N. (#3543)onActioncan now return aStreamTextResult,string, orUIMessageto produce a model response from the action; returningvoid(the previous and now default) is side-effect-only.Migration: if you previously had
run()branching onpayload.trigger === "action", return yourstreamText(...)fromonActioninstead. If you persisted inonTurnComplete, do that work insideonAction. For any other state-only action, just remove your skip-the-model workaround — the default is now correct.Adds
onBoottochat.agent— a lifecycle hook that fires once per worker process picking up the chat. Runs for the initial run, preloaded runs, AND reactive continuation runs (post-cancel, crash,endRun,requestUpgrade, OOM retry), before any other hook. Use it to initializechat.local, open per-process resources, or re-hydrate state from your DB on continuation — anywhere the SAME run picking up after suspend/resume isn't enough. (#3543)If you previously initialized
chat.localinonChatStart, move it toonBoot—onChatStartis once-per-chat and won't fire on a continuation, leavingchat.localuninitialized whenrun()tries to use it. See the upgrade guide for the migration pattern.Run AI chats as durable Trigger.dev tasks. Define the agent in one function, wire
useChatto 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. (#3543)Lifecycle hooks (
onPreload,onTurnStart,onTurnComplete, etc.) cover the common needs around persistence, validation, and post-turn work.chat.storegives 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'swatchmode 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 tosessions.open(id).out/.in.Add
chat.headStart— an opt-in fast-path that runs the first turn'sstreamTextstep in your warm Next.js / Hono / Workers / Express handler while the trigger agent run boots in parallel. Cold-start TTFC drops by ~50% on the first message; the agent owns step 2+ (tool execution, persistence, hooks) so heavy deps stay where they belong. (#3543)For Node-only frameworks (Express, Fastify, Koa, raw
node:http) usechat.toNodeListener(handler)to bridge the Web Fetch handler to(req, res). Adds a new@trigger.dev/sdk/chat-serversubpath; bundle stays Web Fetch–only with nonode:*imports.Add read primitives to
chat.historyfor HITL flows:getPendingToolCalls(),getResolvedToolCalls(),extractNewToolResults(message),getChain(), andfindMessage(messageId). These lift the accumulator-walking logic that customers building human-in-the-loop tools were re-implementing into the SDK. (#3543)Use
getPendingToolCalls()to gate fresh user turns while a tool call is awaiting an answer. UseextractNewToolResults(message)to dedup tool results when persisting to your own store — the helper returns only the parts whosetoolCallIdis not already resolved on the chain.Adds the Sessions primitive — a durable, run-aware stream channel keyed (#3542)
on a stable
externalId. Public SDK additions:tasks.triggerAndSubscribe()and the
chat.agentruntime built on top of Sessions. Seehttps://trigger.dev/docs/ai-chat/overview for the full feature surface.
Patch Changes
Add Agent Skills for
chat.agent. Drop a folder with aSKILL.mdand any helper scripts/references next to your task code, register it withskills.define({ id, path }), and the CLI bundles it into the deploy image automatically — notrigger.config.tschanges. The agent gets a one-line summary in its system prompt and discovers full instructions on demand vialoadSkill, withbashandreadFiletools scoped per-skill (path-traversal guards, output caps, abort-signal propagation). (#3543)Built on the AI SDK cookbook pattern — portable across providers. SDK + CLI only for now; dashboard-editable
SKILL.mdtext is on the roadmap.Add
ai.toolExecute(task)so you can wire a Trigger subtask in as theexecutehandler of an AI SDKtool()while definingdescriptionandinputSchemayourself — useful when you want full control over the tool surface and just need Trigger's subtask machinery for the body. (#3546)ai.tool(task)(toolFromTask) keeps doing the all-in-one wrap and now aligns its return type with AI SDK'sToolSet. Minimumaipeer raised to^6.0.116to avoid cross-versionToolSetmismatches in monorepos.chat.agentwire is now delta-only — clients ship at most one new message per.in/appendinstead of the fullUIMessage[]history. The agent rebuilds prior history at run boot from a JSON snapshot in object storage plus await=0replay of thesession.outtail. Long chats stop hitting the 512 KiB body cap on/realtime/v1/sessions/{id}/in/append. Snapshot writes happen after everyonTurnComplete, awaited so they survive idle suspend; reads happen only at run boot. Registering ahydrateMessageshook short-circuits both the snapshot read/write and the replay — the customer is the source of truth for history. (#3543)Custom transports that constructed
ChatTaskWirePayloaddirectly need to drop themessages: UIMessage[]field and usemessage?: UIMessage(singular). Built-in transports (TriggerChatTransport,AgentChat) handle the change below the customer-facing surface — most apps need no changes. Configure object-store env vars (OBJECT_STORE_*) on your webapp deployment if you haven't already; without an object store and withouthydrateMessages, conversations don't survive run boundaries.Stamp
gen_ai.conversation.id(the chat id) on every span and metric emitted from inside achat.taskorchat.agentrun. Lets you filter dashboard spans, runs, and metrics by the chat conversation that produced them — independent of the run boundary, so multi-run chats correlate cleanly. No code changes required on the user side. (#3543)Unit-test
chat.agentdefinitions offline withmockChatAgentfrom@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 withMockLanguageModelV3fromai/testfor model mocking.setupLocalslets you pre-seedlocals(DB clients, service stubs) beforerun()starts. (#3543)The broader
runInMockTaskContextharness it's built on lives at@trigger.dev/core/v3/test— useful for unit-testing any task code, not just chat.Updated dependencies:
@trigger.dev/core@4.5.0@trigger.dev/build@4.5.0
Patch Changes
Add Agent Skills for
chat.agent. Drop a folder with aSKILL.mdand any helper scripts/references next to your task code, register it withskills.define({ id, path }), and the CLI bundles it into the deploy image automatically — notrigger.config.tschanges. The agent gets a one-line summary in its system prompt and discovers full instructions on demand vialoadSkill, withbashandreadFiletools scoped per-skill (path-traversal guards, output caps, abort-signal propagation). (#3543)Built on the AI SDK cookbook pattern — portable across providers. SDK + CLI only for now; dashboard-editable
SKILL.mdtext is on the roadmap.Updated dependencies:
@trigger.dev/core@4.5.0trigger.dev@4.5.0
Patch Changes
Add Agent Skills for
chat.agent. Drop a folder with aSKILL.mdand any helper scripts/references next to your task code, register it withskills.define({ id, path }), and the CLI bundles it into the deploy image automatically — notrigger.config.tschanges. The agent gets a one-line summary in its system prompt and discovers full instructions on demand vialoadSkill, withbashandreadFiletools scoped per-skill (path-traversal guards, output caps, abort-signal propagation). (#3543)Built on the AI SDK cookbook pattern — portable across providers. SDK + CLI only for now; dashboard-editable
SKILL.mdtext is on the roadmap.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 achat.agentget the same idempotent-by-chatId, durable-across-runs behavior the browser transport gets. Required PAT scopes go fromwrite:inputStreamstoread:sessions+write:sessions. (#3546)Updated dependencies:
@trigger.dev/core@4.5.0@trigger.dev/build@4.5.0@trigger.dev/schema-to-json@4.5.0@trigger.dev/core@4.5.0
Patch Changes
Add Agent Skills for
chat.agent. Drop a folder with aSKILL.mdand any helper scripts/references next to your task code, register it withskills.define({ id, path }), and the CLI bundles it into the deploy image automatically — notrigger.config.tschanges. The agent gets a one-line summary in its system prompt and discovers full instructions on demand vialoadSkill, withbashandreadFiletools scoped per-skill (path-traversal guards, output caps, abort-signal propagation). (#3543)Built on the AI SDK cookbook pattern — portable across providers. SDK + CLI only for now; dashboard-editable
SKILL.mdtext is on the roadmap.Reject overlong
idempotencyKeyvalues at the API boundary so they no longer trip an internal size limit on the underlying unique index and surface as a generic 500. Inputs are capped at 2048 characters — well above whatidempotencyKeys.create()produces (a 64-character hash) and above any realistic raw key. Applies totasks.trigger,tasks.batchTrigger,batch.create(Phase 1 streaming batches),wait.createToken,wait.forDuration, and the input/session stream waitpoint endpoints. Over-limit requests now return a structured 400 instead. (#3560)chat.agentwire is now delta-only — clients ship at most one new message per.in/appendinstead of the fullUIMessage[]history. The agent rebuilds prior history at run boot from a JSON snapshot in object storage plus await=0replay of thesession.outtail. Long chats stop hitting the 512 KiB body cap on/realtime/v1/sessions/{id}/in/append. Snapshot writes happen after everyonTurnComplete, awaited so they survive idle suspend; reads happen only at run boot. Registering ahydrateMessageshook short-circuits both the snapshot read/write and the replay — the customer is the source of truth for history. (#3543)Custom transports that constructed
ChatTaskWirePayloaddirectly need to drop themessages: UIMessage[]field and usemessage?: UIMessage(singular). Built-in transports (TriggerChatTransport,AgentChat) handle the change below the customer-facing surface — most apps need no changes. Configure object-store env vars (OBJECT_STORE_*) on your webapp deployment if you haven't already; without an object store and withouthydrateMessages, conversations don't survive run boundaries.Run AI chats as durable Trigger.dev tasks. Define the agent in one function, wire
useChatto 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. (#3543)Lifecycle hooks (
onPreload,onTurnStart,onTurnComplete, etc.) cover the common needs around persistence, validation, and post-turn work.chat.storegives 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'swatchmode 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 tosessions.open(id).out/.in.Add
ChatChunkTooLargeErrorand ApiClient methods for subscribing to session streams. Lays the groundwork for the upcomingchat.agent. (#3542)Stamp
gen_ai.conversation.id(the chat id) on every span and metric emitted from inside achat.taskorchat.agentrun. Lets you filter dashboard spans, runs, and metrics by the chat conversation that produced them — independent of the run boundary, so multi-run chats correlate cleanly. No code changes required on the user side. (#3543)Unit-test
chat.agentdefinitions offline withmockChatAgentfrom@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 withMockLanguageModelV3fromai/testfor model mocking.setupLocalslets you pre-seedlocals(DB clients, service stubs) beforerun()starts. (#3543)The broader
runInMockTaskContextharness it's built on lives at@trigger.dev/core/v3/test— useful for unit-testing any task code, not just chat.Retry
TASK_PROCESS_SIGSEGVtask crashes under the user's retry policy instead of failing the run on the first segfault. SIGSEGV in Node tasks is frequently non-deterministic (native addon races, JIT/GC interaction, near-OOM in native code, host issues), so retrying on a fresh process often succeeds. The retry is gated by the task's existingretryconfig +maxAttempts— same pathTASK_PROCESS_SIGTERMand uncaught exceptions already use — so tasks without a retry policy still fail fast. (#3552)Adds the Sessions primitive — a durable, run-aware stream channel keyed (#3542)
on a stable
externalId. Public SDK additions:tasks.triggerAndSubscribe()and the
chat.agentruntime built on top of Sessions. Seehttps://trigger.dev/docs/ai-chat/overview for the full feature surface.
@trigger.dev/plugins@4.5.0
Patch Changes
@trigger.dev/core@4.5.0@trigger.dev/python@4.5.0
Patch Changes
@trigger.dev/sdk@4.5.0@trigger.dev/core@4.5.0@trigger.dev/build@4.5.0@trigger.dev/react-hooks@4.5.0
Patch Changes
@trigger.dev/core@4.5.0@trigger.dev/redis-worker@4.5.0
Patch Changes
@trigger.dev/core@4.5.0@trigger.dev/rsc@4.5.0
Patch Changes
@trigger.dev/core@4.5.0@trigger.dev/schema-to-json@4.5.0
Patch Changes
@trigger.dev/core@4.5.0