@trigger.dev/sdk 4.5.8 → 4.5.9
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.
- package/dist/commonjs/version.js +1 -1
- package/dist/esm/version.js +1 -1
- package/docs/ai-chat/changelog.mdx +1 -1
- package/docs/ai-chat/how-it-works.mdx +1 -1
- package/docs/bulk-actions.mdx +2 -1
- package/docs/config/extensions/lightpanda.mdx +1 -1
- package/docs/config/extensions/puppeteer.mdx +1 -1
- package/docs/how-it-works.mdx +4 -4
- package/docs/how-to-reduce-your-spend.mdx +4 -4
- package/docs/queue-concurrency.mdx +4 -0
- package/docs/runs/bulk-actions.mdx +2 -1
- package/package.json +2 -2
package/dist/commonjs/version.js
CHANGED
package/dist/esm/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = "4.5.
|
|
1
|
+
export const VERSION = "4.5.9";
|
|
2
2
|
//# sourceMappingURL=version.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "How
|
|
2
|
+
title: "How the AI Agents SDK works"
|
|
3
3
|
sidebarTitle: "How it works"
|
|
4
4
|
description: "End-to-end mechanics of a chat.agent turn: the two durable channels per session, the long-lived task that reads and writes them, and how a chat survives refreshes, deploys, and idle gaps."
|
|
5
5
|
---
|
package/docs/bulk-actions.mdx
CHANGED
package/docs/how-it-works.mdx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "How
|
|
2
|
+
title: "How Trigger.dev works"
|
|
3
3
|
sidebarTitle: "How it works"
|
|
4
4
|
description: "Understand how Trigger.dev works and how it can help you."
|
|
5
5
|
---
|
|
@@ -148,7 +148,7 @@ Here's how the Checkpoint-Resume System works:
|
|
|
148
148
|
|
|
149
149
|
2. **Subtask Handling**: If a task needs to trigger a subtask, it can do so and wait for its completion using `triggerAndWait`
|
|
150
150
|
|
|
151
|
-
3. **State Checkpointing**: While waiting for a subtask or during a programmed pause (e.g., `wait.for({
|
|
151
|
+
3. **State Checkpointing**: While waiting for a subtask or during a long programmed pause (e.g., `wait.for({ minutes: 5 })`), the system uses CRIU (Checkpoint/Restore In Userspace) to create a checkpoint of the task's entire state, including memory, CPU registers, and open file descriptors. A `wait.for()` or `wait.until()` shorter than 60 seconds doesn't checkpoint — see [Wait](/wait).
|
|
152
152
|
|
|
153
153
|
4. **Resource Release**: After checkpointing, the parent task's resources are released, freeing up the execution environment.
|
|
154
154
|
|
|
@@ -178,9 +178,9 @@ export const parentTask = task({
|
|
|
178
178
|
console.log("Child task result:", result);
|
|
179
179
|
|
|
180
180
|
// This will also cause the task to be checkpointed and suspended
|
|
181
|
-
await wait.for({
|
|
181
|
+
await wait.for({ minutes: 5 });
|
|
182
182
|
|
|
183
|
-
console.log("Resumed after
|
|
183
|
+
console.log("Resumed after 5 minutes");
|
|
184
184
|
|
|
185
185
|
return "Parent task completed";
|
|
186
186
|
},
|
|
@@ -170,7 +170,7 @@ export const boundedTask = task({
|
|
|
170
170
|
|
|
171
171
|
## Use waitpoints instead of polling
|
|
172
172
|
|
|
173
|
-
|
|
173
|
+
You don't pay for compute during any wait longer than 5 seconds. Use `wait.for()`, `wait.until()`, or `triggerAndWait()` instead of polling loops.
|
|
174
174
|
|
|
175
175
|
```ts
|
|
176
176
|
import { task, wait } from "@trigger.dev/sdk";
|
|
@@ -178,17 +178,17 @@ import { task, wait } from "@trigger.dev/sdk";
|
|
|
178
178
|
export const waitpointTask = task({
|
|
179
179
|
id: "waitpoint-task",
|
|
180
180
|
run: async (payload) => {
|
|
181
|
-
//
|
|
181
|
+
// You aren't charged for compute during this wait
|
|
182
182
|
await wait.for({ minutes: 5 });
|
|
183
183
|
|
|
184
|
-
//
|
|
184
|
+
// The parent isn't charged either while it waits for a child task
|
|
185
185
|
const result = await childTask.triggerAndWait({ data: payload });
|
|
186
186
|
return result;
|
|
187
187
|
},
|
|
188
188
|
});
|
|
189
189
|
```
|
|
190
190
|
|
|
191
|
-
|
|
191
|
+
Waiting saves you compute, but it doesn't always free up concurrency — see [Wait](/wait).
|
|
192
192
|
|
|
193
193
|
## Use debounce to consolidate multiple triggers
|
|
194
194
|
|
|
@@ -199,6 +199,10 @@ For example, if you have a queue with a `concurrencyLimit` of 1:
|
|
|
199
199
|
- When the executing run reaches a waitpoint and checkpoints, it releases its slot
|
|
200
200
|
- The next queued run can then begin execution
|
|
201
201
|
|
|
202
|
+
### Short time-based waits keep their slot
|
|
203
|
+
|
|
204
|
+
Checkpointing takes time, so a run doesn't checkpoint the moment it reaches a waitpoint. For [`wait.for()`](/wait-for) and [`wait.until()`](/wait-until) it happens 60 seconds into the wait, so anything shorter stays `EXECUTING` and holds its slot for the whole wait. If you're polling in a loop, use an interval comfortably above 60 seconds so the slot is actually released between polls.
|
|
205
|
+
|
|
202
206
|
### Waiting for a subtask on a different queue
|
|
203
207
|
|
|
204
208
|
When a parent task triggers and waits for a subtask on a different queue, the parent task will checkpoint and release its concurrency slot once it reaches the wait point. This prevents environment deadlocks where all concurrency slots would be occupied by waiting tasks.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trigger.dev/sdk",
|
|
3
|
-
"version": "4.5.
|
|
3
|
+
"version": "4.5.9",
|
|
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.
|
|
69
|
+
"@trigger.dev/core": "4.5.9",
|
|
70
70
|
"chalk": "^5.2.0",
|
|
71
71
|
"cronstrue": "^2.21.0",
|
|
72
72
|
"debug": "^4.3.4",
|