Skip to content

Commit 8b53b58

Browse files
committed
fix(chat): include "action" in ChatTaskPayload.trigger type
run() is invoked with trigger: "action" after onAction processes a typed action, but the type previously omitted it. Adding it lets users cleanly short-circuit the LLM call for actions that don't need a response (e.g. user-initiated compaction): if (trigger === "action") return;
1 parent 752a5aa commit 8b53b58

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@trigger.dev/sdk": patch
3+
---
4+
5+
Include `"action"` in the `ChatTaskPayload.trigger` union. `run()` is invoked with `trigger: "action"` after `onAction` processes a typed action, but the type previously omitted it. Users can now cleanly short-circuit the LLM call for actions that don't need a response (e.g. user-initiated compaction): `if (trigger === "action") return;`.

packages/trigger-sdk/src/v3/ai.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -626,8 +626,12 @@ export type ChatTaskPayload<TClientData = unknown> = {
626626
* - `"submit-message"`: A new user message
627627
* - `"regenerate-message"`: Regenerate the last assistant response
628628
* - `"preload"`: Run was preloaded before the first message (only on turn 0)
629+
* - `"action"`: A typed action from the frontend (see `actionSchema` + `onAction`).
630+
* The action has already been applied before `run()` fires — check `trigger === "action"`
631+
* to short-circuit the LLM call when an action doesn't need a response.
632+
* - `"close"`: The chat session is being closed (internal; `run()` is not called).
629633
*/
630-
trigger: "submit-message" | "regenerate-message" | "preload" | "close";
634+
trigger: "submit-message" | "regenerate-message" | "preload" | "action" | "close";
631635

632636
/** The ID of the message to regenerate (only for `"regenerate-message"`) */
633637
messageId?: string;

0 commit comments

Comments
 (0)