@trigger.dev/sdk 4.7.3 → 4.8.0-webhooks.20261015065339
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/v3/ai.d.ts +560 -8
- package/dist/commonjs/v3/ai.js +2263 -178
- package/dist/commonjs/v3/ai.js.map +1 -1
- package/dist/commonjs/v3/chat.d.ts +23 -0
- package/dist/commonjs/v3/chat.js.map +1 -1
- package/dist/commonjs/v3/concurrencyLimits.d.ts +37 -7
- package/dist/commonjs/v3/concurrencyLimits.js +38 -70
- package/dist/commonjs/v3/concurrencyLimits.js.map +1 -1
- package/dist/commonjs/v3/index.d.ts +3 -1
- package/dist/commonjs/v3/index.js +23 -17
- package/dist/commonjs/v3/index.js.map +1 -1
- package/dist/commonjs/v3/modelFileDownload.d.ts +10 -0
- package/dist/commonjs/v3/modelFileDownload.js +164 -0
- package/dist/commonjs/v3/modelFileDownload.js.map +1 -0
- package/dist/commonjs/v3/runs.d.ts +22 -1
- package/dist/commonjs/v3/runs.js +6 -3
- package/dist/commonjs/v3/runs.js.map +1 -1
- package/dist/commonjs/v3/test/index.d.ts +2 -1
- package/dist/commonjs/v3/test/index.js +4 -1
- package/dist/commonjs/v3/test/index.js.map +1 -1
- package/dist/commonjs/v3/test/mock-channel-connector.d.ts +172 -0
- package/dist/commonjs/v3/test/mock-channel-connector.js +173 -0
- package/dist/commonjs/v3/test/mock-channel-connector.js.map +1 -0
- package/dist/commonjs/v3/test/mock-chat-agent.d.ts +81 -1
- package/dist/commonjs/v3/test/mock-chat-agent.js +137 -10
- package/dist/commonjs/v3/test/mock-chat-agent.js.map +1 -1
- package/dist/commonjs/v3/transcriptStorage.d.ts +44 -1
- package/dist/commonjs/v3/transcriptStorage.js +24 -0
- package/dist/commonjs/v3/transcriptStorage.js.map +1 -1
- package/dist/commonjs/v3/webhookWaiters.d.ts +80 -0
- package/dist/commonjs/v3/webhookWaiters.js +156 -0
- package/dist/commonjs/v3/webhookWaiters.js.map +1 -0
- package/dist/commonjs/v3/webhooks.d.ts +178 -2
- package/dist/commonjs/v3/webhooks.js +322 -1
- package/dist/commonjs/v3/webhooks.js.map +1 -1
- package/dist/commonjs/version.js +1 -1
- package/dist/esm/v3/ai.d.ts +560 -8
- package/dist/esm/v3/ai.js +2257 -178
- package/dist/esm/v3/ai.js.map +1 -1
- package/dist/esm/v3/chat.d.ts +23 -0
- package/dist/esm/v3/chat.js.map +1 -1
- package/dist/esm/v3/concurrencyLimits.d.ts +37 -7
- package/dist/esm/v3/concurrencyLimits.js +38 -70
- package/dist/esm/v3/concurrencyLimits.js.map +1 -1
- package/dist/esm/v3/index.d.ts +3 -1
- package/dist/esm/v3/index.js +1 -0
- package/dist/esm/v3/index.js.map +1 -1
- package/dist/esm/v3/modelFileDownload.d.ts +10 -0
- package/dist/esm/v3/modelFileDownload.js +161 -0
- package/dist/esm/v3/modelFileDownload.js.map +1 -0
- package/dist/esm/v3/runs.d.ts +22 -1
- package/dist/esm/v3/runs.js +6 -3
- package/dist/esm/v3/runs.js.map +1 -1
- package/dist/esm/v3/test/index.d.ts +2 -1
- package/dist/esm/v3/test/index.js +2 -1
- package/dist/esm/v3/test/index.js.map +1 -1
- package/dist/esm/v3/test/mock-channel-connector.d.ts +172 -0
- package/dist/esm/v3/test/mock-channel-connector.js +170 -0
- package/dist/esm/v3/test/mock-channel-connector.js.map +1 -0
- package/dist/esm/v3/test/mock-chat-agent.d.ts +81 -1
- package/dist/esm/v3/test/mock-chat-agent.js +137 -11
- package/dist/esm/v3/test/mock-chat-agent.js.map +1 -1
- package/dist/esm/v3/transcriptStorage.d.ts +44 -1
- package/dist/esm/v3/transcriptStorage.js +24 -0
- package/dist/esm/v3/transcriptStorage.js.map +1 -1
- package/dist/esm/v3/webhookWaiters.d.ts +80 -0
- package/dist/esm/v3/webhookWaiters.js +149 -0
- package/dist/esm/v3/webhookWaiters.js.map +1 -0
- package/dist/esm/v3/webhooks.d.ts +178 -2
- package/dist/esm/v3/webhooks.js +318 -1
- package/dist/esm/v3/webhooks.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/docs/ai-chat/actions.mdx +6 -1
- package/docs/ai-chat/backend.mdx +34 -0
- package/docs/ai-chat/patterns/sub-agents.mdx +33 -0
- package/docs/ai-chat/pending-messages.mdx +2 -0
- package/docs/ai-chat/reference.mdx +50 -2
- package/docs/apikeys.mdx +3 -3
- package/docs/billing-limits.mdx +1 -1
- package/docs/cli-env-commands.mdx +5 -4
- package/docs/cli-init-commands.mdx +27 -1
- package/docs/cli-login-commands.mdx +20 -0
- package/docs/cli-projects-commands.mdx +13 -1
- package/docs/cli-runs-commands.mdx +3 -2
- package/docs/cli-update-commands.mdx +9 -3
- package/docs/cli-whoami-commands.mdx +12 -0
- package/docs/concurrency.mdx +32 -0
- package/docs/config/extensions/audioWaveform.mdx +4 -1
- package/docs/config/extensions/overview.mdx +2 -0
- package/docs/config/extensions/prismaExtension.mdx +2 -3
- package/docs/config/extensions/puppeteer.mdx +3 -5
- package/docs/config/extensions/pythonExtension.mdx +9 -1
- package/docs/config/extensions/syncEnvVars.mdx +6 -0
- package/docs/deploy-environment-variables.mdx +1 -1
- package/docs/deployment/atomic-deployment.mdx +2 -0
- package/docs/deployment/dev-branches.mdx +5 -5
- package/docs/deployment/overview.mdx +8 -7
- package/docs/deployment/preview-branches.mdx +6 -3
- package/docs/errors-retrying.mdx +4 -4
- package/docs/how-it-works.mdx +5 -5
- package/docs/introduction.mdx +6 -0
- package/docs/limits.mdx +26 -8
- package/docs/logging.mdx +1 -1
- package/docs/machines.mdx +1 -1
- package/docs/mcp-introduction.mdx +8 -7
- package/docs/mcp-tools.mdx +91 -1
- package/docs/migrating-from-v3.mdx +1 -1
- package/docs/observability/dashboards.mdx +2 -0
- package/docs/observability/query.mdx +6 -2
- package/docs/private-networking/aws-console-setup.mdx +1 -1
- package/docs/private-networking/overview.mdx +1 -1
- package/docs/quick-start.mdx +3 -40
- package/docs/realtime/auth.mdx +1 -1
- package/docs/realtime/backend/input-streams.mdx +159 -0
- package/docs/realtime/backend/streams.mdx +25 -10
- package/docs/realtime/how-it-works.mdx +1 -1
- package/docs/realtime/react-hooks/overview.mdx +1 -1
- package/docs/realtime/react-hooks/streams.mdx +2 -2
- package/docs/realtime/react-hooks/subscribe.mdx +19 -3
- package/docs/realtime/react-hooks/triggering.mdx +2 -2
- package/docs/realtime/react-hooks/use-wait-token.mdx +1 -1
- package/docs/realtime/run-object.mdx +47 -24
- package/docs/replaying.mdx +26 -1
- package/docs/reports.mdx +4 -2
- package/docs/run-tests.mdx +2 -2
- package/docs/run-usage.mdx +3 -3
- package/docs/runs/heartbeats.mdx +2 -2
- package/docs/runs/list-best-practices.mdx +234 -0
- package/docs/runs/metadata.mdx +7 -10
- package/docs/runs.mdx +18 -8
- package/docs/self-hosting/env/supervisor.mdx +2 -0
- package/docs/self-hosting/env/webapp.mdx +5 -0
- package/docs/self-hosting/overview.mdx +26 -0
- package/docs/tags.mdx +6 -0
- package/docs/tasks/scheduled.mdx +11 -5
- package/docs/triggering.mdx +8 -0
- package/docs/troubleshooting-alerts.mdx +102 -3
- package/docs/troubleshooting.mdx +1 -1
- package/docs/upgrading-packages.mdx +3 -3
- package/docs/vercel-integration.mdx +13 -3
- package/docs/versioning.mdx +1 -1
- package/docs/wait-for-token.mdx +3 -3
- package/docs/webhooks/channels.mdx +128 -0
- package/docs/webhooks/connect.mdx +80 -0
- package/docs/webhooks/deliveries.mdx +92 -0
- package/docs/webhooks/filters.mdx +109 -0
- package/docs/webhooks/human-in-the-loop.mdx +149 -0
- package/docs/webhooks/linear.mdx +185 -0
- package/docs/webhooks/overview.mdx +99 -0
- package/docs/webhooks/session-routing.mdx +132 -0
- package/docs/webhooks/slack.mdx +360 -0
- package/docs/webhooks/sources.mdx +217 -0
- package/docs/webhooks/waiters.mdx +170 -0
- package/package.json +3 -2
package/docs/limits.mdx
CHANGED
|
@@ -43,7 +43,7 @@ You can request a higher rate limit from us if you're on a paid plan.
|
|
|
43
43
|
The maximum number of runs that can be queued **per queue** (not across all queues in the environment). Each queue can hold up to its limit independently. When a queue hits its limit, new triggers to that queue are rejected.
|
|
44
44
|
|
|
45
45
|
<Note>
|
|
46
|
-
The limits below apply to [Trigger.dev Cloud](https://trigger.dev). If you self-host Trigger.dev, queue size limits are configurable via the `MAXIMUM_DEV_QUEUE_SIZE` and `MAXIMUM_DEPLOYED_QUEUE_SIZE` environment variables — see [Self-hosting environment variables](/self-hosting/env/webapp
|
|
46
|
+
The limits below apply to [Trigger.dev Cloud](https://trigger.dev). If you self-host Trigger.dev, queue size limits are configurable via the `MAXIMUM_DEV_QUEUE_SIZE` and `MAXIMUM_DEPLOYED_QUEUE_SIZE` environment variables — see [Self-hosting environment variables](/self-hosting/env/webapp).
|
|
47
47
|
</Note>
|
|
48
48
|
|
|
49
49
|
| Pricing tier | Development (per queue) | Staging / Production (per queue) |
|
|
@@ -60,7 +60,7 @@ On Trigger.dev Cloud, all runs have an enforced maximum TTL of 14 days. Runs wit
|
|
|
60
60
|
|
|
61
61
|
There is no maximum on `delay`.
|
|
62
62
|
|
|
63
|
-
If you self-host, you can configure a maximum TTL via the `RUN_ENGINE_DEFAULT_MAX_TTL` environment variable — see [Self-hosting environment variables](/self-hosting/env/webapp
|
|
63
|
+
If you self-host, you can configure a maximum TTL via the `RUN_ENGINE_DEFAULT_MAX_TTL` environment variable — see [Self-hosting environment variables](/self-hosting/env/webapp).
|
|
64
64
|
|
|
65
65
|
## Schedules
|
|
66
66
|
|
|
@@ -124,8 +124,6 @@ Payloads and outputs over 512KB are kept in object storage rather than inline. C
|
|
|
124
124
|
|
|
125
125
|
A single batch can have a maximum of 1,000 items with SDK 4.3.1+. Prior versions are limited to 500 items.
|
|
126
126
|
|
|
127
|
-
<SoftLimit />
|
|
128
|
-
|
|
129
127
|
## Batch trigger rate limits
|
|
130
128
|
|
|
131
129
|
Batch triggering uses a token bucket algorithm to rate limit the number of runs you can trigger per environment. Each run in a batch consumes one token.
|
|
@@ -154,6 +152,26 @@ When you send a batch trigger, we convert it into individual runs. This limit co
|
|
|
154
152
|
| Hobby | 10 concurrent batches |
|
|
155
153
|
| Pro | 50 concurrent batches |
|
|
156
154
|
|
|
155
|
+
## Webhook ingest rate limits
|
|
156
|
+
|
|
157
|
+
Each hosted webhook endpoint accepts a limited number of requests per 10 seconds. Requests over the limit get a `429` response with a `Retry-After` header, and providers that retry deliver them again after the window.
|
|
158
|
+
|
|
159
|
+
| Pricing tier | Requests per endpoint |
|
|
160
|
+
| :----------- | :-------------------- |
|
|
161
|
+
| Free | 100 every 10 sec |
|
|
162
|
+
| Hobby | 300 every 10 sec |
|
|
163
|
+
| Pro | 1,000 every 10 sec |
|
|
164
|
+
| Enterprise | Set per organization |
|
|
165
|
+
|
|
166
|
+
All of an environment's endpoints also share a per-environment limit, counted in tokens: a request costs one token for every 64 KiB of body, started, so a 10 KiB event costs one and a 1 MiB event costs 16. Requests over it get the same `429` with `Retry-After`.
|
|
167
|
+
|
|
168
|
+
| Pricing tier | Tokens per environment |
|
|
169
|
+
| :----------- | :--------------------- |
|
|
170
|
+
| Free | 300 every 10 sec |
|
|
171
|
+
| Hobby | 1,000 every 10 sec |
|
|
172
|
+
| Pro | 3,000 every 10 sec |
|
|
173
|
+
| Enterprise | Set per organization |
|
|
174
|
+
|
|
157
175
|
## Log retention
|
|
158
176
|
|
|
159
177
|
| Pricing tier | Limit |
|
|
@@ -170,8 +188,8 @@ We limit the size of logs to prevent oversized data potentially causing issues.
|
|
|
170
188
|
|
|
171
189
|
#### Attribute Limits
|
|
172
190
|
|
|
173
|
-
- Span Attribute Count Limit:
|
|
174
|
-
- Log Attribute Count Limit:
|
|
191
|
+
- Span Attribute Count Limit: 1024
|
|
192
|
+
- Log Attribute Count Limit: 1024
|
|
175
193
|
- Span Attribute Value Length Limit: 131072 characters
|
|
176
194
|
- Log Attribute Value Length Limit: 131072 characters
|
|
177
195
|
|
|
@@ -188,8 +206,8 @@ We limit the size of logs to prevent oversized data potentially causing issues.
|
|
|
188
206
|
|
|
189
207
|
#### Attribute Clipping Behavior
|
|
190
208
|
|
|
191
|
-
- Attributes exceeding the value length limit (
|
|
192
|
-
- If the total number of attributes exceeds
|
|
209
|
+
- Attributes exceeding the value length limit (131072 characters) are discarded.
|
|
210
|
+
- If the total number of attributes exceeds 1024, additional attributes are not included.
|
|
193
211
|
|
|
194
212
|
#### Attribute Value Size Calculation
|
|
195
213
|
|
package/docs/logging.mdx
CHANGED
|
@@ -159,7 +159,7 @@ Trigger.dev automatically collects the following metrics for deployed tasks. No
|
|
|
159
159
|
| `nodejs.heap.total` | gauge | bytes | V8 heap total |
|
|
160
160
|
|
|
161
161
|
<Note>
|
|
162
|
-
In dev mode (`trigger dev`),
|
|
162
|
+
In dev mode (`trigger dev`), the `process.*` and `nodejs.*` metrics above are collected, along with custom metrics.
|
|
163
163
|
</Note>
|
|
164
164
|
|
|
165
165
|
### Context attributes
|
package/docs/machines.mdx
CHANGED
|
@@ -299,7 +299,7 @@ After adding the config, restart your client. You should see a server named **tr
|
|
|
299
299
|
|
|
300
300
|
## Authentication
|
|
301
301
|
|
|
302
|
-
The `search_docs` tool works without authentication
|
|
302
|
+
The `search_docs` tool works without authentication, and so do the local-only tools `list_profiles`, `dev_server_status` and `stop_dev_server`. All other tools require you to be logged in via the [Trigger.dev CLI](/cli-login-commands). The first time you use an authenticated tool, your MCP client will prompt you to log in.
|
|
303
303
|
|
|
304
304
|
<Accordion title="CLI Options">
|
|
305
305
|
|
|
@@ -310,7 +310,6 @@ The `install-mcp` command supports these options:
|
|
|
310
310
|
- `-p, --project-ref <project ref>` — Scope the MCP server to a specific project
|
|
311
311
|
- `-t, --tag <package tag>` — CLI package version to use (default: latest)
|
|
312
312
|
- `--dev-only` — Restrict to the dev environment only
|
|
313
|
-
- `--readonly` — Read-only mode. Hides write tools (`deploy`, `trigger_task`, `cancel_run`) so the AI cannot make changes to your account
|
|
314
313
|
- `--yolo` — Install into all supported clients automatically
|
|
315
314
|
- `--scope <scope>` — `user`, `project`, or `local`
|
|
316
315
|
- `--client <clients...>` — Install into specific client(s)
|
|
@@ -341,17 +340,19 @@ Restrict to dev environment for a specific project:
|
|
|
341
340
|
npx trigger.dev@latest install-mcp --dev-only --project-ref proj_abc123
|
|
342
341
|
```
|
|
343
342
|
|
|
344
|
-
|
|
343
|
+
To add these options to a manual config, append them to the `args` array:
|
|
345
344
|
|
|
346
|
-
```
|
|
347
|
-
|
|
345
|
+
```json
|
|
346
|
+
{
|
|
347
|
+
"args": ["trigger.dev@latest", "mcp", "--dev-only", "--project-ref", "proj_abc123"]
|
|
348
|
+
}
|
|
348
349
|
```
|
|
349
350
|
|
|
350
|
-
|
|
351
|
+
The `mcp` command also accepts `--readonly`, which hides the tools that write to your account (for example `deploy`, `trigger_task` and `cancel_run`) so the AI cannot make changes to it. It is only available as a manual config arg:
|
|
351
352
|
|
|
352
353
|
```json
|
|
353
354
|
{
|
|
354
|
-
"args": ["trigger.dev@latest", "mcp", "--
|
|
355
|
+
"args": ["trigger.dev@latest", "mcp", "--readonly"]
|
|
355
356
|
}
|
|
356
357
|
```
|
|
357
358
|
|
package/docs/mcp-tools.mdx
CHANGED
|
@@ -102,6 +102,20 @@ Cancel a running or queued run.
|
|
|
102
102
|
- `"Cancel run run_abc123"`
|
|
103
103
|
- `"Stop that task"`
|
|
104
104
|
|
|
105
|
+
### replay_run
|
|
106
|
+
|
|
107
|
+
Replay a run as a new run of the same task, in the same environment. The new run reuses the original run's payload, metadata, tags, queue, concurrency key, and machine unless you override them. See [Replaying](/replaying) for how each option falls back.
|
|
108
|
+
|
|
109
|
+
**Parameters:**
|
|
110
|
+
- `runId` (required): The run to replay, starting with `run_`
|
|
111
|
+
- `payload`, `metadata`, `tags` (optional): Replace the original run's values
|
|
112
|
+
- `queue`, `concurrencyKey`, `machine`, `version`, `region`, `delay`, `ttl`, `idempotencyKey`, `maxAttempts`, `maxDuration`, `priority` (optional): Override the trigger options for the new run
|
|
113
|
+
|
|
114
|
+
**Example usage:**
|
|
115
|
+
- `"Replay run run_abc123"`
|
|
116
|
+
- `"Replay that failed run with userId set to user_456"`
|
|
117
|
+
- `"Replay run run_abc123 on a large-1x machine in 10 minutes"`
|
|
118
|
+
|
|
105
119
|
## Deployment Tools
|
|
106
120
|
|
|
107
121
|
### deploy
|
|
@@ -225,7 +239,7 @@ Check the status of the dev server and view recent output. Shows whether it is s
|
|
|
225
239
|
- `"Are there any build errors?"`
|
|
226
240
|
|
|
227
241
|
<Callout type="warning">
|
|
228
|
-
The deploy and list_preview_branches tools are not available when the MCP server is running with the `--dev-only` flag. The `--readonly` flag hides deploy, trigger_task, and
|
|
242
|
+
The deploy and list_preview_branches tools are not available when the MCP server is running with the `--dev-only` flag. The `--readonly` flag hides deploy, trigger_task, cancel_run, and replay_run.
|
|
229
243
|
</Callout>
|
|
230
244
|
|
|
231
245
|
## Agent Chat Tools
|
|
@@ -317,3 +331,79 @@ Append one record to a named side channel's `in` stream. Sends control input to
|
|
|
317
331
|
<Callout type="warning">
|
|
318
332
|
`write_session_channel` is a write operation and is not available in readonly mode.
|
|
319
333
|
</Callout>
|
|
334
|
+
|
|
335
|
+
## Webhook Tools
|
|
336
|
+
|
|
337
|
+
Set up and debug [hosted webhook endpoints](/webhooks/overview). Endpoint ids start with `wh_` and delivery ids with `whd_`; endpoint tools also accept an endpoint's declared id. The same operations are on the [Webhooks API](/management/webhooks/list-endpoints).
|
|
338
|
+
|
|
339
|
+
### list_webhook_endpoints
|
|
340
|
+
|
|
341
|
+
List the environment's webhook endpoints: each one's id, declared id, source, status, URL and whether its signing secret is set.
|
|
342
|
+
|
|
343
|
+
**Example usage:**
|
|
344
|
+
- `"Which webhook endpoints do I have in dev?"`
|
|
345
|
+
|
|
346
|
+
### get_webhook_endpoint_details
|
|
347
|
+
|
|
348
|
+
Get an endpoint's subscribers, with the filters that decide which events each accepts, and its setup prompt: the steps for registering the endpoint and its signing secret with the provider.
|
|
349
|
+
|
|
350
|
+
**Parameters:**
|
|
351
|
+
- `endpointId` (required): the endpoint's declared id (such as `payments`) or `wh_` id
|
|
352
|
+
|
|
353
|
+
**Example usage:**
|
|
354
|
+
- `"Connect my payments webhook to Stripe"`
|
|
355
|
+
|
|
356
|
+
### list_webhook_deliveries
|
|
357
|
+
|
|
358
|
+
List recent deliveries, newest first.
|
|
359
|
+
|
|
360
|
+
**Parameters:**
|
|
361
|
+
- `endpointId` (optional): only this endpoint's deliveries, by declared id or `wh_` id
|
|
362
|
+
- `status` (optional): only these statuses, such as `["failed", "filtered"]`
|
|
363
|
+
- `period` (optional, default: `7d`): how far back to look
|
|
364
|
+
- `limit` (optional, default: `20`): how many to return, up to 100
|
|
365
|
+
- `cursor` (optional): the cursor from a previous call, for the next page
|
|
366
|
+
|
|
367
|
+
**Example usage:**
|
|
368
|
+
- `"Did the Stripe checkout event arrive in the last hour?"`
|
|
369
|
+
- `"Show me failed deliveries on the github endpoint"`
|
|
370
|
+
|
|
371
|
+
### get_webhook_delivery
|
|
372
|
+
|
|
373
|
+
Get one delivery: its status and error, each subscriber's result (the run or session it started, or why its filter skipped the event), how many waiting runs it resumed, and its event and headers.
|
|
374
|
+
|
|
375
|
+
**Parameters:**
|
|
376
|
+
- `deliveryId` (required): the delivery's `whd_` id
|
|
377
|
+
|
|
378
|
+
**Example usage:**
|
|
379
|
+
- `"Why didn't this webhook trigger my order task?"`
|
|
380
|
+
|
|
381
|
+
### replay_webhook_delivery
|
|
382
|
+
|
|
383
|
+
Replay a delivery from its stored event. Without `targetId` it goes to every subscriber again, with their filters checked again. With `targetId` it goes to that subscriber even if its filter skipped the event.
|
|
384
|
+
|
|
385
|
+
**Parameters:**
|
|
386
|
+
- `deliveryId` (required): the delivery's `whd_` id
|
|
387
|
+
- `targetId` (optional): the subscriber id to replay to
|
|
388
|
+
|
|
389
|
+
**Example usage:**
|
|
390
|
+
- `"Replay that delivery to the refunds task"`
|
|
391
|
+
|
|
392
|
+
### generate_webhook_secret
|
|
393
|
+
|
|
394
|
+
Generate a new signing secret for an endpoint and return it once, for providers where you choose the secret (such as GitHub). It replaces any existing secret.
|
|
395
|
+
|
|
396
|
+
**Parameters:**
|
|
397
|
+
- `endpointId` (required): the endpoint's declared id (such as `payments`) or `wh_` id
|
|
398
|
+
|
|
399
|
+
### set_webhook_secret
|
|
400
|
+
|
|
401
|
+
Store a signing secret or public key the provider issued, such as Stripe's `whsec_` secret. It replaces any existing secret.
|
|
402
|
+
|
|
403
|
+
**Parameters:**
|
|
404
|
+
- `endpointId` (required): the endpoint's declared id (such as `payments`) or `wh_` id
|
|
405
|
+
- `secret` (required): the secret or public key
|
|
406
|
+
|
|
407
|
+
<Callout type="warning">
|
|
408
|
+
`replay_webhook_delivery`, `generate_webhook_secret` and `set_webhook_secret` are write operations and are not available in readonly mode.
|
|
409
|
+
</Callout>
|
|
@@ -98,5 +98,7 @@ There is a separate concurrency limits for metric widgets.
|
|
|
98
98
|
| Limit | Details |
|
|
99
99
|
| :------------------------ | :------------- |
|
|
100
100
|
| Concurrent widget queries | 30 per project |
|
|
101
|
+
| Custom dashboards | Free 0, Hobby 1, Pro 5 per organization |
|
|
102
|
+
| Widgets per dashboard | Free 0, Hobby 10, Pro 20 |
|
|
101
103
|
|
|
102
104
|
See [Limits](/limits) for details.
|
|
@@ -8,6 +8,7 @@ description: "Query allows you to write custom queries against your data using T
|
|
|
8
8
|
- `runs`: contains all task run data including status, timing, costs, and task output. Run metadata (key-value set in your task) is not available on the Query page.
|
|
9
9
|
- `metrics`: contains metrics data for your runs including CPU, memory, and your custom metrics
|
|
10
10
|
- `llm_metrics`: contains LLM/AI metrics including token usage, costs, latency, and model performance data from GenAI spans
|
|
11
|
+
- `llm_models`: anonymized cross-tenant model performance aggregates (calls, cost, latency, throughput per model per minute); it has no tenant-specific data
|
|
11
12
|
|
|
12
13
|
### `metrics` table columns
|
|
13
14
|
|
|
@@ -24,6 +25,9 @@ description: "Query allows you to write custom queries against your data using T
|
|
|
24
25
|
| `machine_name` | string | Machine preset (e.g., `small-1x`) |
|
|
25
26
|
| `worker_version` | string | Worker version |
|
|
26
27
|
| `environment_type` | string | `PRODUCTION`, `STAGING`, `DEVELOPMENT`, `PREVIEW` |
|
|
28
|
+
| `worker_id` | string | Worker ID that produced the metric |
|
|
29
|
+
| `environment` | string | Environment slug |
|
|
30
|
+
| `project` | string | Project ref, starting with `proj_` |
|
|
27
31
|
| `attributes` | json | Raw JSON attributes for custom data |
|
|
28
32
|
|
|
29
33
|
See [Logging, tracing & metrics](/logging#automatic-system-and-runtime-metrics) for the full list of automatically collected metrics and how to create custom metrics. You can visualize this data on [Dashboards](/observability/dashboards).
|
|
@@ -68,7 +72,7 @@ ORDER BY timeBucket
|
|
|
68
72
|
LIMIT 1000
|
|
69
73
|
```
|
|
70
74
|
|
|
71
|
-
Available format types: `bytes`, `percent`, `duration`, `durationSeconds`, `quantity`, `costInDollars`.
|
|
75
|
+
Available format types: `bytes`, `percent`, `duration`, `durationSeconds`, `quantity`, `costInDollars`, `decimalBytes`, `cost`.
|
|
72
76
|
|
|
73
77
|
## Using the Query dashboard
|
|
74
78
|
|
|
@@ -602,7 +606,7 @@ LIMIT 100
|
|
|
602
606
|
|
|
603
607
|
We have several limits to prevent abuse and ensure performance:
|
|
604
608
|
|
|
605
|
-
- **Concurrency limit**: We limit the number of concurrent queries per
|
|
609
|
+
- **Concurrency limit**: We limit the number of concurrent queries per project.
|
|
606
610
|
- **Row limit**: We limit the number of rows returned to 10k.
|
|
607
611
|
- **Time restrictions**: We limit the time period you can query.
|
|
608
612
|
- **Time/Memory limit**: We limit the memory a query can use and the time it can run for. As well as other limits like AST complexity.
|
|
@@ -250,7 +250,7 @@ By default, no one can connect to your endpoint service. You need to explicitly
|
|
|
250
250
|
|
|
251
251
|
- **Friendly name**: a short, human-readable label for this connection.
|
|
252
252
|
- **VPC Endpoint Service name**: paste the `com.amazonaws.vpce.<region>.vpce-svc-...` value from Step 4.
|
|
253
|
-
- **Target region**: the
|
|
253
|
+
- **Target region**: the Trigger.dev region where the VPC Endpoint is created (pick one from the list, such as `us-east-1` or `eu-central-1`), normally the region your tasks run in. If it differs from the region your endpoint service lives in, enable cross-region access in Step 3.
|
|
254
254
|
|
|
255
255
|
</Step>
|
|
256
256
|
<Step title="Submit">
|
|
@@ -119,7 +119,7 @@ All three conditions must be true. No organization can route traffic to another
|
|
|
119
119
|
|
|
120
120
|
## Limits
|
|
121
121
|
|
|
122
|
-
- **
|
|
122
|
+
- **Four connections per organization.** This is a soft limit — get in touch if you need more.
|
|
123
123
|
- **All ports accepted.** Our security group allows all TCP ports from peered CIDRs. You control which ports are reachable through your NLB and target groups.
|
|
124
124
|
- **Same-region or cross-region.** Connections work within the same region as your tasks or across regions (cross-region adds AWS-level cost and ~10-30ms latency).
|
|
125
125
|
|
package/docs/quick-start.mdx
CHANGED
|
@@ -8,48 +8,11 @@ import CliInitStep from "/snippets/step-cli-init.mdx";
|
|
|
8
8
|
import CliDevStep from "/snippets/step-cli-dev.mdx";
|
|
9
9
|
import CliRunTestStep from "/snippets/step-run-test.mdx";
|
|
10
10
|
import CliViewRunStep from "/snippets/step-view-run.mdx";
|
|
11
|
+
import AgentSetupPrompt from "/snippets/agent-setup-prompt.mdx";
|
|
11
12
|
|
|
12
|
-
##
|
|
13
|
+
## Copy the setup prompt
|
|
13
14
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
<Accordion title="Copy the setup prompt">
|
|
17
|
-
|
|
18
|
-
```text
|
|
19
|
-
Help me add Trigger.dev to this project.
|
|
20
|
-
|
|
21
|
-
## What to do
|
|
22
|
-
|
|
23
|
-
1. I need a Trigger.dev account. If I don't have one, point me to https://cloud.trigger.dev to sign up. Wait for me to confirm.
|
|
24
|
-
2. Run `npx trigger.dev@latest init` in the project root.
|
|
25
|
-
- When it asks about the MCP server, recommend I install it (best DX: gives you direct access to Trigger.dev docs, deploys, and run monitoring).
|
|
26
|
-
- Install the "Hello World" example task when prompted.
|
|
27
|
-
3. Run `npx trigger.dev@latest dev` to start the dev server.
|
|
28
|
-
4. Once the dev server is running, test the example task from the Trigger.dev dashboard.
|
|
29
|
-
5. Create a named API key in my Development environment with **Trigger only** access. Set it as TRIGGER_SECRET_KEY in my .env file (or .env.local for Next.js).
|
|
30
|
-
6. Ask me what framework I'm using and show me how to trigger the task from my backend code.
|
|
31
|
-
|
|
32
|
-
If I've already run init and want the MCP server, run: npx trigger.dev@latest install-mcp
|
|
33
|
-
|
|
34
|
-
## Critical rules
|
|
35
|
-
|
|
36
|
-
- ALWAYS import from `@trigger.dev/sdk`. NEVER import from `@trigger.dev/sdk/v3`.
|
|
37
|
-
- NEVER use `client.defineJob()` — that's the deprecated v2 API.
|
|
38
|
-
- Use type-only imports when triggering from backend code to avoid bundling task code:
|
|
39
|
-
|
|
40
|
-
import type { myTask } from "./trigger/example";
|
|
41
|
-
import { tasks } from "@trigger.dev/sdk";
|
|
42
|
-
|
|
43
|
-
const handle = await tasks.trigger<typeof myTask>("hello-world", { message: "Hello from my app!" });
|
|
44
|
-
|
|
45
|
-
## When done, point me to
|
|
46
|
-
|
|
47
|
-
- Writing tasks: https://trigger.dev/docs/tasks/overview
|
|
48
|
-
- Real-time updates: https://trigger.dev/docs/realtime/overview
|
|
49
|
-
- AI tooling: https://trigger.dev/docs/building-with-ai
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
</Accordion>
|
|
15
|
+
<AgentSetupPrompt />
|
|
53
16
|
|
|
54
17
|
## Manual setup
|
|
55
18
|
|
package/docs/realtime/auth.mdx
CHANGED
|
@@ -157,7 +157,7 @@ const { parts } = useRealtimeStream<{ url: string }>(runId, "frames", {
|
|
|
157
157
|
|
|
158
158
|
When you [trigger tasks](/triggering) from your backend, the `handle` received includes a `publicAccessToken` field. This token can be used to authenticate real-time requests in your frontend application.
|
|
159
159
|
|
|
160
|
-
|
|
160
|
+
Auto-generated tokens expire after 1 hour and have a read scope for the specific run(s) that were triggered. For a different expiration or scopes, create a token yourself with [`auth.createPublicToken`](#creating-public-access-tokens).
|
|
161
161
|
|
|
162
162
|
See our [triggering documentation](/triggering) for detailed examples of how to trigger tasks and get auto-generated tokens.
|
|
163
163
|
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Input Streams
|
|
3
|
+
sidebarTitle: Input Streams
|
|
4
|
+
description: Send data into running tasks from your backend code
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
The Input Streams API allows you to send data into running Trigger.dev tasks from your backend code. This enables bidirectional communication — while [output streams](/realtime/backend/streams) let you read data from tasks, input streams let you push data into them.
|
|
8
|
+
|
|
9
|
+
<Note>
|
|
10
|
+
To learn how to receive input stream data inside your tasks, see [Input
|
|
11
|
+
Streams](/tasks/streams#input-streams) in the Streams doc.
|
|
12
|
+
</Note>
|
|
13
|
+
|
|
14
|
+
<Tip>
|
|
15
|
+
Input streams are keyed by `runId` — they're correct for sending data to a specific live run. If you need a bidirectional channel that survives run boundaries (e.g. a chat that resumes tomorrow, an agent coordinated across many runs), look at [`chat.agent`](/ai-chat/overview): it's built on a durable Session row that owns its runs and exposes the same consumer-side API (`on` / `once` / `wait` / `waitWithIdleTimeout`) on its `.in` channel.
|
|
16
|
+
</Tip>
|
|
17
|
+
|
|
18
|
+
## Sending data to a running task
|
|
19
|
+
|
|
20
|
+
### Using defined input streams (Recommended)
|
|
21
|
+
|
|
22
|
+
The recommended approach is to use [defined input streams](/tasks/streams#defining-input-streams) for full type safety:
|
|
23
|
+
|
|
24
|
+
```ts
|
|
25
|
+
import { cancelSignal, approval } from "./trigger/streams";
|
|
26
|
+
|
|
27
|
+
// Cancel a running AI stream
|
|
28
|
+
await cancelSignal.send(runId, { reason: "User clicked stop" });
|
|
29
|
+
|
|
30
|
+
// Approve a draft
|
|
31
|
+
await approval.send(runId, { approved: true, reviewer: "alice@example.com" });
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
The `.send()` method is fully typed — the data parameter must match the generic type you defined on the input stream.
|
|
35
|
+
|
|
36
|
+
<Note>
|
|
37
|
+
`.send()` works the same regardless of how the task is listening — whether it uses `.wait()`
|
|
38
|
+
(suspending), `.once()` (non-suspending), or `.on()` (continuous). The sender doesn't need to know
|
|
39
|
+
how the task is consuming the data. See [Input Streams](/tasks/streams#input-streams) for details on each
|
|
40
|
+
receiving method.
|
|
41
|
+
</Note>
|
|
42
|
+
|
|
43
|
+
## Practical examples
|
|
44
|
+
|
|
45
|
+
### Cancel from a Next.js API route
|
|
46
|
+
|
|
47
|
+
```ts app/api/cancel/route.ts
|
|
48
|
+
import { cancelStream } from "@/trigger/streams";
|
|
49
|
+
|
|
50
|
+
export async function POST(req: Request) {
|
|
51
|
+
const { runId } = await req.json();
|
|
52
|
+
|
|
53
|
+
await cancelStream.send(runId, { reason: "User clicked stop" });
|
|
54
|
+
|
|
55
|
+
return Response.json({ cancelled: true });
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Approval workflow API
|
|
60
|
+
|
|
61
|
+
```ts app/api/approve/route.ts
|
|
62
|
+
import { approval } from "@/trigger/streams";
|
|
63
|
+
|
|
64
|
+
export async function POST(req: Request) {
|
|
65
|
+
const { runId, approved, reviewer } = await req.json();
|
|
66
|
+
|
|
67
|
+
await approval.send(runId, {
|
|
68
|
+
approved,
|
|
69
|
+
reviewer,
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
return Response.json({ success: true });
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Remix action handler
|
|
77
|
+
|
|
78
|
+
```ts app/routes/api.approve.ts
|
|
79
|
+
import { json, type ActionFunctionArgs } from "@remix-run/node";
|
|
80
|
+
import { approval } from "~/trigger/streams";
|
|
81
|
+
|
|
82
|
+
export async function action({ request }: ActionFunctionArgs) {
|
|
83
|
+
const formData = await request.formData();
|
|
84
|
+
const runId = formData.get("runId") as string;
|
|
85
|
+
const approved = formData.get("approved") === "true";
|
|
86
|
+
const reviewer = formData.get("reviewer") as string;
|
|
87
|
+
|
|
88
|
+
await approval.send(runId, { approved, reviewer });
|
|
89
|
+
|
|
90
|
+
return json({ success: true });
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Express handler
|
|
95
|
+
|
|
96
|
+
```ts
|
|
97
|
+
import express from "express";
|
|
98
|
+
import { cancelSignal } from "./trigger/streams";
|
|
99
|
+
|
|
100
|
+
const app = express();
|
|
101
|
+
app.use(express.json());
|
|
102
|
+
|
|
103
|
+
app.post("/api/cancel", async (req, res) => {
|
|
104
|
+
const { runId, reason } = req.body;
|
|
105
|
+
|
|
106
|
+
await cancelSignal.send(runId, { reason });
|
|
107
|
+
|
|
108
|
+
res.json({ cancelled: true });
|
|
109
|
+
});
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Sending from another task
|
|
113
|
+
|
|
114
|
+
You can send input stream data from one task to another running task:
|
|
115
|
+
|
|
116
|
+
```ts
|
|
117
|
+
import { task } from "@trigger.dev/sdk";
|
|
118
|
+
import { approval } from "./streams";
|
|
119
|
+
|
|
120
|
+
export const reviewerTask = task({
|
|
121
|
+
id: "auto-reviewer",
|
|
122
|
+
run: async (payload: { targetRunId: string }) => {
|
|
123
|
+
// Perform automated review logic...
|
|
124
|
+
const isApproved = await performReview();
|
|
125
|
+
|
|
126
|
+
// Send approval to the waiting task
|
|
127
|
+
await approval.send(payload.targetRunId, {
|
|
128
|
+
approved: isApproved,
|
|
129
|
+
reviewer: "auto-reviewer",
|
|
130
|
+
});
|
|
131
|
+
},
|
|
132
|
+
});
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## Error handling
|
|
136
|
+
|
|
137
|
+
The `.send()` method will throw if:
|
|
138
|
+
|
|
139
|
+
- The run has already completed, failed, or been canceled
|
|
140
|
+
- The payload exceeds the 1MB size limit
|
|
141
|
+
- The run ID is invalid
|
|
142
|
+
|
|
143
|
+
```ts
|
|
144
|
+
import { cancelSignal } from "./trigger/streams";
|
|
145
|
+
|
|
146
|
+
try {
|
|
147
|
+
await cancelSignal.send(runId, { reason: "User clicked stop" });
|
|
148
|
+
} catch (error) {
|
|
149
|
+
console.error("Failed to send:", error);
|
|
150
|
+
// Handle the error — the run may have already completed
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## Important notes
|
|
155
|
+
|
|
156
|
+
- Maximum payload size per `.send()` call is **1MB**
|
|
157
|
+
- You cannot send data to a completed, failed, or canceled run
|
|
158
|
+
- Data sent before a listener is registered inside the task is **buffered** and delivered when a listener attaches
|
|
159
|
+
- Input streams require the current streams implementation (v2 is the default in SDK 4.1.0+). See [Streams](/tasks/streams) for details.
|
|
@@ -90,18 +90,16 @@ async function consumeWithTimeout(runId: string) {
|
|
|
90
90
|
timeoutInSeconds: 120, // Wait up to 2 minutes for data
|
|
91
91
|
});
|
|
92
92
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
console.log("Received chunk:", chunk);
|
|
96
|
-
}
|
|
97
|
-
} catch (error) {
|
|
98
|
-
if (error.name === "TimeoutError") {
|
|
99
|
-
console.log("Stream timed out");
|
|
100
|
-
}
|
|
93
|
+
for await (const chunk of stream) {
|
|
94
|
+
console.log("Received chunk:", chunk);
|
|
101
95
|
}
|
|
96
|
+
|
|
97
|
+
// The loop ends normally if no data arrives within the timeout
|
|
102
98
|
}
|
|
103
99
|
```
|
|
104
100
|
|
|
101
|
+
If no data arrives within `timeoutInSeconds`, the stream closes and the `for await` loop ends without throwing an error. To detect a timeout, track whether you received the chunk you expected to be last.
|
|
102
|
+
|
|
105
103
|
### Start index
|
|
106
104
|
|
|
107
105
|
Resume reading from a specific chunk index (useful for reconnection scenarios):
|
|
@@ -122,6 +120,25 @@ async function resumeStream(runId: string, lastChunkIndex: number) {
|
|
|
122
120
|
}
|
|
123
121
|
```
|
|
124
122
|
|
|
123
|
+
### Start from latest
|
|
124
|
+
|
|
125
|
+
Pass `from: "latest"` to start reading at the end of the stream instead of replaying its history. You may still receive the most recent existing chunk before new chunks arrive. The default is `"beginning"`, which replays the full history first. `from` is ignored when `startIndex` is set:
|
|
126
|
+
|
|
127
|
+
```ts
|
|
128
|
+
import { streams } from "@trigger.dev/sdk";
|
|
129
|
+
import { aiStream } from "./trigger/streams";
|
|
130
|
+
|
|
131
|
+
async function watchLive(runId: string) {
|
|
132
|
+
const stream = await aiStream.read(runId, {
|
|
133
|
+
from: "latest", // Start at the end of the stream instead of replaying history
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
for await (const chunk of stream) {
|
|
137
|
+
console.log("Received chunk:", chunk);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
```
|
|
141
|
+
|
|
125
142
|
### Abort signal
|
|
126
143
|
|
|
127
144
|
Use an `AbortSignal` to cancel stream reading:
|
|
@@ -181,8 +198,6 @@ async function advancedStreamConsumption(runId: string) {
|
|
|
181
198
|
} catch (error) {
|
|
182
199
|
if (error.name === "AbortError") {
|
|
183
200
|
console.log("Stream was cancelled");
|
|
184
|
-
} else if (error.name === "TimeoutError") {
|
|
185
|
-
console.log("Stream timed out");
|
|
186
201
|
} else {
|
|
187
202
|
console.error("Stream error:", error);
|
|
188
203
|
}
|
|
@@ -80,7 +80,7 @@ See our [run metadata docs](/runs/metadata) for more on how to write tasks that
|
|
|
80
80
|
|
|
81
81
|
You can combine run metadata with the Realtime API to bridge the gap between your trigger.dev tasks and your applications in two ways:
|
|
82
82
|
|
|
83
|
-
1. Using our [React hooks](/realtime/react-hooks/subscribe#using-metadata) to subscribe to metadata updates and update your UI in real-time.
|
|
83
|
+
1. Using our [React hooks](/realtime/react-hooks/subscribe#using-metadata-to-show-progress-in-your-ui) to subscribe to metadata updates and update your UI in real-time.
|
|
84
84
|
2. Using our [backend functions](/realtime/backend) to subscribe to metadata updates in your backend.
|
|
85
85
|
|
|
86
86
|
## Limits
|
|
@@ -466,7 +466,7 @@ function MyComponent({ runId, publicAccessToken }: { runId: string; publicAccess
|
|
|
466
466
|
|
|
467
467
|
### Throttling updates
|
|
468
468
|
|
|
469
|
-
The `useRealtimeRunWithStreams` hook accepts
|
|
469
|
+
The `useRealtimeRunWithStreams` hook accepts a `throttleInMs` option to throttle the updates from the server. This can be useful if you are getting too many updates and want to reduce the number of updates.
|
|
470
470
|
|
|
471
471
|
```tsx
|
|
472
472
|
import { useRealtimeRunWithStreams } from "@trigger.dev/react-hooks";
|
|
@@ -480,7 +480,7 @@ export function MyComponent({
|
|
|
480
480
|
}) {
|
|
481
481
|
const { run, streams, error } = useRealtimeRunWithStreams(runId, {
|
|
482
482
|
accessToken: publicAccessToken,
|
|
483
|
-
|
|
483
|
+
throttleInMs: 1000, // Throttle updates to once per second
|
|
484
484
|
});
|
|
485
485
|
|
|
486
486
|
if (error) return <div>Error: {error.message}</div>;
|