Pass immutable run-state snapshot to onTriggeredRun

Co-authored-by: Eric Allam <eric@trigger.dev>
This commit is contained in:
Cursor Agent
2026-02-15 00:32:29 +00:00
parent 5d492d6c9a
commit 227290b3da
2 changed files with 4 additions and 2 deletions
+1 -1
View File
@@ -809,7 +809,7 @@ describe("TriggerChatTransport", function () {
onTriggeredRun: async function onTriggeredRun(state) {
await sleep(1);
observedRunId = state.runId;
observedState = { ...state };
observedState = state;
callbackCompleted = true;
},
});
+3 -1
View File
@@ -177,7 +177,9 @@ export class TriggerChatTransport<
if (this.onTriggeredRun) {
try {
await this.onTriggeredRun(runState);
await this.onTriggeredRun({
...runState,
});
} catch {
// Ignore callback errors so chat streaming can continue.
}