@trigger.dev/sdk 4.5.8 → 4.5.10

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 (100) hide show
  1. package/dist/commonjs/package.json +2 -1
  2. package/dist/commonjs/v3/agentSkillsRuntime.js.map +1 -1
  3. package/dist/commonjs/v3/ai-shared.js.map +1 -1
  4. package/dist/commonjs/v3/ai.js +15 -1
  5. package/dist/commonjs/v3/ai.js.map +1 -1
  6. package/dist/commonjs/v3/aiAutoTelemetry.js.map +1 -1
  7. package/dist/commonjs/v3/auth.js.map +1 -1
  8. package/dist/commonjs/v3/batchDebounce.test.d.ts +1 -0
  9. package/dist/commonjs/v3/batchDebounce.test.js +189 -0
  10. package/dist/commonjs/v3/batchDebounce.test.js.map +1 -0
  11. package/dist/commonjs/v3/cache.js.map +1 -1
  12. package/dist/commonjs/v3/chat-client.d.ts +14 -1
  13. package/dist/commonjs/v3/chat-client.js +19 -2
  14. package/dist/commonjs/v3/chat-client.js.map +1 -1
  15. package/dist/commonjs/v3/chat-react.js +1 -1
  16. package/dist/commonjs/v3/chat-react.js.map +1 -1
  17. package/dist/commonjs/v3/chat-tab-coordinator.js.map +1 -1
  18. package/dist/commonjs/v3/chat-tab-coordinator.test.js.map +1 -1
  19. package/dist/commonjs/v3/chat.js +2 -2
  20. package/dist/commonjs/v3/chat.js.map +1 -1
  21. package/dist/commonjs/v3/chat.test.js.map +1 -1
  22. package/dist/commonjs/v3/config.js.map +1 -1
  23. package/dist/commonjs/v3/envvars.js.map +1 -1
  24. package/dist/commonjs/v3/hooks.js.map +1 -1
  25. package/dist/commonjs/v3/index.js.map +1 -1
  26. package/dist/commonjs/v3/locals.js.map +1 -1
  27. package/dist/commonjs/v3/metadata.js.map +1 -1
  28. package/dist/commonjs/v3/prompt.js.map +1 -1
  29. package/dist/commonjs/v3/promptManagement.js.map +1 -1
  30. package/dist/commonjs/v3/queues.js.map +1 -1
  31. package/dist/commonjs/v3/retry.js.map +1 -1
  32. package/dist/commonjs/v3/runs.d.ts +81 -81
  33. package/dist/commonjs/v3/runs.js.map +1 -1
  34. package/dist/commonjs/v3/schedules/index.js.map +1 -1
  35. package/dist/commonjs/v3/sessions.js.map +1 -1
  36. package/dist/commonjs/v3/shared.d.ts +2 -1
  37. package/dist/commonjs/v3/shared.js +7 -0
  38. package/dist/commonjs/v3/shared.js.map +1 -1
  39. package/dist/commonjs/v3/shared.test.js +9 -0
  40. package/dist/commonjs/v3/shared.test.js.map +1 -1
  41. package/dist/commonjs/v3/skill.js.map +1 -1
  42. package/dist/commonjs/v3/streams.js.map +1 -1
  43. package/dist/commonjs/v3/tasks.js.map +1 -1
  44. package/dist/commonjs/v3/test/mock-chat-agent.js.map +1 -1
  45. package/dist/commonjs/v3/test/test-session-handle.js.map +1 -1
  46. package/dist/commonjs/v3/triggerClient.js.map +1 -1
  47. package/dist/commonjs/v3/triggerClient.types.test.js.map +1 -1
  48. package/dist/commonjs/v3/wait.d.ts +6 -1
  49. package/dist/commonjs/v3/waitUntil.js.map +1 -1
  50. package/dist/commonjs/v3/webhooks.js.map +1 -1
  51. package/dist/commonjs/version.js +1 -1
  52. package/dist/esm/package.json +2 -1
  53. package/dist/esm/v3/ai.js +15 -1
  54. package/dist/esm/v3/ai.js.map +1 -1
  55. package/dist/esm/v3/auth.js.map +1 -1
  56. package/dist/esm/v3/batchDebounce.test.d.ts +1 -0
  57. package/dist/esm/v3/batchDebounce.test.js +187 -0
  58. package/dist/esm/v3/batchDebounce.test.js.map +1 -0
  59. package/dist/esm/v3/chat-client.d.ts +14 -1
  60. package/dist/esm/v3/chat-client.js +19 -2
  61. package/dist/esm/v3/chat-client.js.map +1 -1
  62. package/dist/esm/v3/chat-tab-coordinator.js.map +1 -1
  63. package/dist/esm/v3/chat-tab-coordinator.test.js.map +1 -1
  64. package/dist/esm/v3/chat.js +2 -2
  65. package/dist/esm/v3/chat.js.map +1 -1
  66. package/dist/esm/v3/chat.test.js.map +1 -1
  67. package/dist/esm/v3/metadata.js.map +1 -1
  68. package/dist/esm/v3/retry.js.map +1 -1
  69. package/dist/esm/v3/runs.d.ts +80 -80
  70. package/dist/esm/v3/sessions.js.map +1 -1
  71. package/dist/esm/v3/shared.d.ts +2 -1
  72. package/dist/esm/v3/shared.js +6 -0
  73. package/dist/esm/v3/shared.js.map +1 -1
  74. package/dist/esm/v3/shared.test.js +10 -1
  75. package/dist/esm/v3/shared.test.js.map +1 -1
  76. package/dist/esm/v3/test/mock-chat-agent.js.map +1 -1
  77. package/dist/esm/v3/test/test-session-handle.js.map +1 -1
  78. package/dist/esm/v3/triggerClient.js.map +1 -1
  79. package/dist/esm/v3/wait.d.ts +6 -1
  80. package/dist/esm/version.js +1 -1
  81. package/docs/ai-chat/changelog.mdx +1 -1
  82. package/docs/ai-chat/client-protocol.mdx +4 -2
  83. package/docs/ai-chat/fast-starts.mdx +4 -1
  84. package/docs/ai-chat/how-it-works.mdx +1 -1
  85. package/docs/ai-chat/migrating-from-a-route-handler.mdx +592 -0
  86. package/docs/bulk-actions.mdx +2 -1
  87. package/docs/config/extensions/emitDecoratorMetadata.mdx +27 -4
  88. package/docs/config/extensions/lightpanda.mdx +1 -1
  89. package/docs/config/extensions/puppeteer.mdx +1 -1
  90. package/docs/how-it-works.mdx +4 -4
  91. package/docs/how-to-reduce-your-spend.mdx +4 -4
  92. package/docs/mcp-tools.mdx +1 -1
  93. package/docs/queue-concurrency.mdx +4 -0
  94. package/docs/runs/bulk-actions.mdx +2 -1
  95. package/docs/self-hosting/docker.mdx +9 -0
  96. package/docs/self-hosting/env/supervisor.mdx +2 -1
  97. package/docs/self-hosting/env/webapp.mdx +5 -1
  98. package/docs/self-hosting/kubernetes.mdx +281 -221
  99. package/docs/triggering.mdx +16 -4
  100. package/package.json +4 -3
@@ -1,5 +1,5 @@
1
1
  ---
2
- title: "How it works"
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({ seconds: 30 })`), 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.
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({ seconds: 30 });
181
+ await wait.for({ minutes: 5 });
182
182
 
183
- console.log("Resumed after 30 seconds");
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
- Waits longer than 5 seconds automatically checkpoint your task, meaning you don't pay for compute while waiting. Use `wait.for()`, `wait.until()`, or `triggerAndWait()` instead of polling loops.
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
- // This wait is free - your task is checkpointed
181
+ // You aren't charged for compute during this wait
182
182
  await wait.for({ minutes: 5 });
183
183
 
184
- // Parent is also checkpointed while waiting for child tasks
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
- [Read more about waitpoints](/wait-for).
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
 
@@ -61,7 +61,7 @@ Get the current worker for a project, including the worker version, SDK version,
61
61
 
62
62
  ### trigger_task
63
63
 
64
- Trigger a task to run with a specific payload. You can add a delay, set tags, configure retries, choose a machine size, set a TTL, or use an idempotency key.
64
+ Trigger a task to run with a specific payload. You can add a delay, set tags, configure retries, choose a machine size, pick a region, set a TTL, or use an idempotency key.
65
65
 
66
66
  **Example usage:**
67
67
  - `"Run the email-notification task"`
@@ -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.
@@ -1,5 +1,6 @@
1
1
  ---
2
- title: "Bulk actions"
2
+ title: "Bulk actions with the SDK"
3
+ sidebarTitle: "Bulk actions"
3
4
  description: "Cancel or replay many runs from the SDK using run IDs or SDK run-list filters."
4
5
  ---
5
6
 
@@ -362,6 +362,15 @@ TRIGGER_IMAGE_TAG=v4.5.0
362
362
 
363
363
  We patch the latest released version line only, so keep an eye on new releases to receive security fixes. See [Security & vulnerability reporting](/self-hosting/security).
364
364
 
365
+ You can also lock the versions of the bundled services, for example with `CLICKHOUSE_IMAGE_TAG`. If you do, or if you bring your own ClickHouse via `CLICKHOUSE_URL`, note that Trigger.dev requires ClickHouse 25.8 or newer.
366
+
367
+ <Note>
368
+ The bundled ClickHouse uses the official `clickhouse/clickhouse-server` image, and your existing
369
+ data volume carries over automatically on upgrade. If you pinned `CLICKHOUSE_IMAGE_TAG` to a
370
+ Bitnami tag, switch it to an official tag (for example `26.2`) — Bitnami tags don't exist in the
371
+ official repository.
372
+ </Note>
373
+
365
374
  <Note>
366
375
  Trigger.dev 4.5.0 is the last version we officially support for running v3 (SDK v3) tasks. If
367
376
  you still have v3 tasks, pin `TRIGGER_IMAGE_TAG` to exactly `v4.5.0` or [migrate to
@@ -46,7 +46,8 @@ mode: "wide"
46
46
  | **Kubernetes settings** | | | |
47
47
  | `KUBERNETES_FORCE_ENABLED` | No | false | Force Kubernetes mode. |
48
48
  | `KUBERNETES_NAMESPACE` | No | default | The namespace that runs should be in. |
49
- | `KUBERNETES_WORKER_NODETYPE_LABEL` | No | v4-worker | Nodes for runs need this label, e.g. `nodetype=v4-worker`. |
49
+ | `KUBERNETES_WORKER_NODETYPE_LABEL` | No | v4-worker | Nodes for runs need `nodetype=<this>`. Empty: any node. |
50
+ | `KUBERNETES_RUNNER_TOLERATIONS` | No | — | Run pod tolerations. CSV: `key=value:effect`/`key:effect`. |
50
51
  | `KUBERNETES_IMAGE_PULL_SECRETS` | No | — | Image pull secrets (CSV). |
51
52
  | `KUBERNETES_EPHEMERAL_STORAGE_SIZE_LIMIT` | No | 10Gi | Ephemeral storage size limit. Applies to all runs. |
52
53
  | `KUBERNETES_EPHEMERAL_STORAGE_SIZE_REQUEST` | No | 2Gi | Ephemeral storage size request. Applies to all runs. |
@@ -12,7 +12,7 @@ mode: "wide"
12
12
  | `MAGIC_LINK_SECRET` | Yes | — | Magic link encryption secret. Run: `openssl rand -hex 16` |
13
13
  | `ENCRYPTION_KEY` | Yes | — | Secret store encryption key. Run: `openssl rand -hex 16` |
14
14
  | `MANAGED_WORKER_SECRET` | Yes | — | Managed worker secret. Must be set and match supervisor. Run: `openssl rand -hex 32` |
15
- | `ALLOW_INSECURE_DEFAULT_SECRETS` | No | false | Boot even if a secret is still a known-insecure published default. Temporary escape hatch for values you can't safely rotate yet (see [Secret generation and rotation](/self-hosting/kubernetes#secret-generation-and-rotation)). |
15
+ | `ALLOW_INSECURE_DEFAULT_SECRETS` | No | false | Boot even if a secret is still a known-insecure published default. Temporary escape hatch for values you can't safely rotate yet (see [Secrets](/self-hosting/kubernetes#secrets)). |
16
16
  | **Domains & ports** | | | |
17
17
  | `REMIX_APP_PORT` | No | 3030 | Remix app port. |
18
18
  | `APP_ORIGIN` | Yes | http://localhost:3030 | App origin URL. |
@@ -26,7 +26,11 @@ mode: "wide"
26
26
  | `DATABASE_CONNECTION_LIMIT` | No | 10 | Max DB connections. |
27
27
  | `DATABASE_POOL_TIMEOUT` | No | 60 | DB pool timeout (s). |
28
28
  | `DATABASE_CONNECTION_TIMEOUT` | No | 20 | DB connect timeout (s). |
29
+ | `DATABASE_WRITER_POOL_TIMEOUT` | No | `DATABASE_POOL_TIMEOUT` | Writer pool timeout (s); overrides the shared default for the writer only. |
30
+ | `DATABASE_WRITER_CONNECTION_TIMEOUT` | No | `DATABASE_CONNECTION_TIMEOUT` | Writer connect timeout (s); overrides the shared default for the writer only. |
29
31
  | `DATABASE_READ_REPLICA_URL` | No | `DATABASE_URL` | Read-replica DB string. |
32
+ | `DATABASE_READ_REPLICA_POOL_TIMEOUT` | No | `DATABASE_POOL_TIMEOUT` | Read-replica pool timeout (s); overrides the shared default for the replica only. |
33
+ | `DATABASE_READ_REPLICA_CONNECTION_TIMEOUT` | No | `DATABASE_CONNECTION_TIMEOUT` | Read-replica connect timeout (s); overrides the shared default for the replica only. |
30
34
  | **Redis** | | | |
31
35
  | `REDIS_HOST` | Yes | — | Redis host. |
32
36
  | `REDIS_PORT` | Yes | — | Redis port. |