@trigger.dev/sdk 4.7.3 → 4.7.5
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 +26 -0
- package/dist/commonjs/v3/ai.js +7 -5
- package/dist/commonjs/v3/ai.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 +1 -1
- package/dist/commonjs/v3/index.js.map +1 -1
- package/dist/commonjs/v3/query.d.ts +434 -1
- package/dist/commonjs/v3/query.js +115 -0
- package/dist/commonjs/v3/query.js.map +1 -1
- 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/version.js +1 -1
- package/dist/esm/v3/ai.d.ts +26 -0
- package/dist/esm/v3/ai.js +7 -5
- package/dist/esm/v3/ai.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 +1 -1
- package/dist/esm/v3/index.js.map +1 -1
- package/dist/esm/v3/query.d.ts +434 -1
- package/dist/esm/v3/query.js +115 -0
- package/dist/esm/v3/query.js.map +1 -1
- 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/version.js +1 -1
- package/docs/ai-chat/actions.mdx +6 -1
- package/docs/ai-chat/backend.mdx +47 -0
- package/docs/ai-chat/patterns/redacting-telemetry.mdx +117 -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 +53 -2
- package/docs/ai-chat/transcript-storage.mdx +1 -1
- package/docs/apikeys.mdx +9 -7
- 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-tasks-commands.mdx +95 -0
- 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/config-file.mdx +58 -0
- package/docs/config/extensions/audioWaveform.mdx +4 -1
- package/docs/config/extensions/overview.mdx +2 -0
- package/docs/config/extensions/prismaExtension.mdx +6 -7
- 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 +5 -1
- package/docs/deployment/atomic-deployment.mdx +5 -3
- package/docs/deployment/dev-branches.mdx +5 -5
- package/docs/deployment/overview.mdx +9 -8
- package/docs/deployment/preview-branches.mdx +7 -4
- package/docs/errors-retrying.mdx +4 -4
- package/docs/github-actions.mdx +3 -3
- package/docs/how-it-works.mdx +5 -5
- package/docs/introduction.mdx +6 -0
- package/docs/limits.mdx +32 -8
- package/docs/logging.mdx +1 -1
- package/docs/machines.mdx +1 -1
- package/docs/manual-setup.mdx +1 -1
- package/docs/mcp-introduction.mdx +8 -7
- package/docs/mcp-tools.mdx +113 -3
- package/docs/migrating-from-v3.mdx +1 -1
- package/docs/observability/dashboards.mdx +64 -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/max-duration.mdx +4 -0
- package/docs/runs/metadata.mdx +7 -10
- package/docs/runs.mdx +18 -8
- package/docs/self-hosting/env/supervisor.mdx +3 -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 +158 -0
- package/docs/webhooks/connect.mdx +84 -0
- package/docs/webhooks/deliveries.mdx +103 -0
- package/docs/webhooks/filters.mdx +144 -0
- package/docs/webhooks/human-in-the-loop.mdx +162 -0
- package/docs/webhooks/linear.mdx +190 -0
- package/docs/webhooks/overview.mdx +119 -0
- package/docs/webhooks/session-routing.mdx +145 -0
- package/docs/webhooks/slack.mdx +397 -0
- package/docs/webhooks/sources.mdx +221 -0
- package/docs/webhooks/waiters.mdx +194 -0
- package/package.json +3 -2
package/dist/esm/v3/runs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runs.js","sourceRoot":"","sources":["../../../src/v3/runs.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":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kC;IAElC,MAAM,SAAS,GAAG,gBAAgB,CAAC,aAAa,EAAE,CAAC;IAEnD,OAAO,SAAS,CAAC,sBAAsB,CAAwB,GAAG,EAAE,OAAO,EAAE;QAC3E,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC/C,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,SAAS,sBAAsB,CAC7B,OAAe;IAEf,MAAM,SAAS,GAAG,gBAAgB,CAAC,aAAa,EAAE,CAAC;IAEnD,OAAO,SAAS,CAAC,gBAAgB,CAAwB,OAAO,CAAC,CAAC;AACpE,CAAC;AAED;;GAEG;AACH,KAAK,UAAU,WAAW,CAAI,KAAa,EAAE,SAAiB;IAC5D,MAAM,SAAS,GAAG,gBAAgB,CAAC,aAAa,EAAE,CAAC;IAEnD,OAAO,MAAM,SAAS,CAAC,WAAW,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;AACvD,CAAC"}
|
package/dist/esm/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = "4.7.
|
|
1
|
+
export const VERSION = "4.7.5";
|
|
2
2
|
//# sourceMappingURL=version.js.map
|
package/docs/ai-chat/actions.mdx
CHANGED
|
@@ -73,11 +73,16 @@ onAction: async ({ action }) => {
|
|
|
73
73
|
chat.history.slice(0, -1);
|
|
74
74
|
chat.inject([{ role: "system", content: "Answer formally this time." }]);
|
|
75
75
|
return chat.turn(); // with a one-shot instruction
|
|
76
|
+
|
|
77
|
+
case "ask":
|
|
78
|
+
return chat.turn(action.question); // answer a new user message
|
|
76
79
|
}
|
|
77
80
|
}
|
|
78
81
|
```
|
|
79
82
|
|
|
80
|
-
`
|
|
83
|
+
`chat.turn(message)` appends `message` (a string, or a `UIMessage`) to the history as a user message after the edit, and the turn answers it. That is how a button click becomes a question, such as a follow-up suggestion in [Slack](/webhooks/slack#buttons-that-send-the-agent-an-action).
|
|
84
|
+
|
|
85
|
+
Without a message, `run()` receives the edited history with no incoming user message, the same shape as a `regenerate-message` turn, and its `trigger` is `"action-turn"`, so a `run()` that returns early on `"action"` (the pre-May behaviour, when actions invoked `run()` directly) still answers. Returning anything other than `chat.turn()` or nothing is an error; a response can no longer be returned from `onAction` directly.
|
|
81
86
|
|
|
82
87
|
### Actions and persistence
|
|
83
88
|
|
package/docs/ai-chat/backend.mdx
CHANGED
|
@@ -4,6 +4,8 @@ sidebarTitle: "Backend"
|
|
|
4
4
|
description: "Three approaches to building your chat backend — chat.agent(), session iterator, or raw task primitives."
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
+
import WebhooksBetaNote from "/snippets/webhooks-beta-note.mdx";
|
|
8
|
+
|
|
7
9
|
There are three abstraction levels for a chat backend. All three speak the same wire protocol, so the [frontend transport](/ai-chat/frontend) works unchanged whichever you pick.
|
|
8
10
|
|
|
9
11
|
| Capability | `chat.agent()` | `chat.createSession()` | Raw primitives |
|
|
@@ -497,6 +499,51 @@ Custom actions let the frontend send structured commands (undo, rollback, edit,
|
|
|
497
499
|
|
|
498
500
|
See [Actions](/ai-chat/actions).
|
|
499
501
|
|
|
502
|
+
### Webhook events and channels
|
|
503
|
+
|
|
504
|
+
<WebhooksBetaNote />
|
|
505
|
+
|
|
506
|
+
Two `chat.agent()` options wire an agent to verified inbound webhooks. `events` claims [`chat.event(...)`](/webhooks/session-routing) descriptors: each verified delivery is routed to this agent's session and arrives at `onAction` as an action (not a turn), so [session routing](/webhooks/session-routing) decides which conversation it lands on. `channels` claims channel connectors that turn an external chat surface into a frontend for the agent: an inbound message runs as a turn through `run()` and the reply is posted back. `slack()` ships in `@trigger.dev/slack`, and `chat.channels.custom(...)` builds a connector for any endpoint without a preset.
|
|
507
|
+
|
|
508
|
+
```ts
|
|
509
|
+
import { webhooks } from "@trigger.dev/sdk";
|
|
510
|
+
import { chat } from "@trigger.dev/sdk/ai";
|
|
511
|
+
import { appMentions, slack, webhookSource } from "@trigger.dev/slack";
|
|
512
|
+
|
|
513
|
+
const slackEvents = webhooks.endpoint.define({ id: "slack", source: webhookSource() });
|
|
514
|
+
const stripe = webhooks.endpoint.define({ id: "stripe", source: webhooks.stripe() });
|
|
515
|
+
|
|
516
|
+
export const orderEvents = chat.event({
|
|
517
|
+
id: "order-events",
|
|
518
|
+
endpoint: stripe,
|
|
519
|
+
key: "{event.data.object.customer}",
|
|
520
|
+
// invoices always carry a customer; events without one would have no session to go to
|
|
521
|
+
filter: "event.type startsWith 'invoice.'",
|
|
522
|
+
type: "order.event",
|
|
523
|
+
});
|
|
524
|
+
|
|
525
|
+
export const myChat = chat.agent({
|
|
526
|
+
id: "my-chat",
|
|
527
|
+
events: [orderEvents],
|
|
528
|
+
channels: [
|
|
529
|
+
slack({
|
|
530
|
+
id: "support-slack",
|
|
531
|
+
endpoint: slackEvents,
|
|
532
|
+
token: process.env.SLACK_BOT_TOKEN!,
|
|
533
|
+
startOn: appMentions(),
|
|
534
|
+
}),
|
|
535
|
+
],
|
|
536
|
+
onAction: async ({ action }) => {
|
|
537
|
+
// A verified order-events delivery arrives here as an action.
|
|
538
|
+
},
|
|
539
|
+
run: async (payload) => {
|
|
540
|
+
// Inbound Slack messages run here as normal turns.
|
|
541
|
+
},
|
|
542
|
+
});
|
|
543
|
+
```
|
|
544
|
+
|
|
545
|
+
See [session routing](/webhooks/session-routing) and [channels](/webhooks/channels). For the interactive approvals layer, where a turn pauses on a human decision (buttons in the thread) and resumes on the click, see [human-in-the-loop](/webhooks/human-in-the-loop).
|
|
546
|
+
|
|
500
547
|
### Chat history
|
|
501
548
|
|
|
502
549
|
Imperative API for reading and modifying the accumulated message history. Works from any hook (`onAction`, `onTurnStart`, `onBeforeTurnComplete`, `onTurnComplete`, `hydrateMessages`) or from `run()` and AI SDK tools.
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Redact chat content from traces"
|
|
3
|
+
sidebarTitle: "Redact chat content"
|
|
4
|
+
description: "Stop a chat agent recording user messages and clientData on its spans, turn off AI SDK prompt and response recording, or redact span content with a span processor before it leaves the worker."
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
A chat agent's run trace records conversation content by default: the user's message and the `clientData` your frontend sends. When AI SDK telemetry is on, it also records the prompts and responses of each model call. This page covers the three controls that change that, and what they don't cover.
|
|
8
|
+
|
|
9
|
+
## What the run trace records
|
|
10
|
+
|
|
11
|
+
| Span | Content | Control |
|
|
12
|
+
| --- | --- | --- |
|
|
13
|
+
| `chat turn N` | The last user message (`chat.user_message`) and its first 80 characters as the span preview | `telemetry.recordUserMessage` |
|
|
14
|
+
| `chat turn N` | The raw `clientData` (`chat.client_data`) | `telemetry.recordClientData` |
|
|
15
|
+
| `pending message injected` | Messages sent mid-turn (`pending.messages`) | `telemetry.recordUserMessage` |
|
|
16
|
+
| AI SDK model call spans, when AI SDK telemetry is on | Prompt messages, response text, tool calls | `experimental_telemetry` on the model call |
|
|
17
|
+
| Any span | Everything above, plus your own attributes and span events | A span processor |
|
|
18
|
+
|
|
19
|
+
## Stop recording chat content
|
|
20
|
+
|
|
21
|
+
Set `telemetry` on the agent to stop the chat runtime recording the user's message and `clientData` on its spans. Both default to `true`.
|
|
22
|
+
|
|
23
|
+
```ts /trigger/support-agent.ts
|
|
24
|
+
import { chat } from "@trigger.dev/sdk/ai";
|
|
25
|
+
import { anthropic } from "@ai-sdk/anthropic";
|
|
26
|
+
|
|
27
|
+
export const supportAgent = chat.agent({
|
|
28
|
+
id: "support-agent",
|
|
29
|
+
telemetry: { recordUserMessage: false, recordClientData: false },
|
|
30
|
+
run: async ({ messages, signal, streamText }) =>
|
|
31
|
+
streamText({ model: anthropic("claude-sonnet-4-5"), messages, abortSignal: signal }),
|
|
32
|
+
});
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
The spans still appear in the trace with their timings and token usage. The turn spans have no preview text.
|
|
36
|
+
|
|
37
|
+
## Stop the AI SDK recording prompts and responses
|
|
38
|
+
|
|
39
|
+
AI SDK model call spans appear when AI SDK telemetry is on: [`chat.prompt.set()`](/ai-chat/backend#using-prompts) turns it on for you, or you pass `experimental_telemetry` yourself. Those spans include prompts and responses unless you turn that off with `recordInputs` and `recordOutputs`:
|
|
40
|
+
|
|
41
|
+
```ts /trigger/support-agent.ts
|
|
42
|
+
import { chat } from "@trigger.dev/sdk/ai";
|
|
43
|
+
import { anthropic } from "@ai-sdk/anthropic";
|
|
44
|
+
|
|
45
|
+
export const supportAgent = chat.agent({
|
|
46
|
+
id: "support-agent",
|
|
47
|
+
telemetry: { recordUserMessage: false, recordClientData: false },
|
|
48
|
+
run: async ({ messages, signal, streamText }) =>
|
|
49
|
+
streamText({
|
|
50
|
+
model: anthropic("claude-sonnet-4-5"),
|
|
51
|
+
messages,
|
|
52
|
+
abortSignal: signal,
|
|
53
|
+
// Replaces any telemetry config from chat.prompt.set(), so keep isEnabled on
|
|
54
|
+
experimental_telemetry: { isEnabled: true, recordInputs: false, recordOutputs: false },
|
|
55
|
+
}),
|
|
56
|
+
});
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
If you use `chat.prompt.set()`, your `experimental_telemetry` replaces the one it adds, including the metadata that links each generation to its prompt version. To keep that link, redact with a span processor instead.
|
|
60
|
+
|
|
61
|
+
## Redact instead of dropping
|
|
62
|
+
|
|
63
|
+
To keep the content but strip sensitive values from it, add a span processor in `trigger.config.ts`. It runs on every span before export, so one processor covers the chat runtime's spans, the AI SDK spans and your own.
|
|
64
|
+
|
|
65
|
+
```ts trigger.config.ts
|
|
66
|
+
import { defineConfig } from "@trigger.dev/sdk";
|
|
67
|
+
import type { AttributeValue, Attributes } from "@opentelemetry/api";
|
|
68
|
+
import type { SpanProcessor } from "@opentelemetry/sdk-trace-base";
|
|
69
|
+
|
|
70
|
+
const EMAIL = /[\w.+-]+@[\w-]+\.[\w.]+/g;
|
|
71
|
+
|
|
72
|
+
function redact(value: AttributeValue | undefined): AttributeValue | undefined {
|
|
73
|
+
if (typeof value === "string") return value.replace(EMAIL, "[email]");
|
|
74
|
+
// Some attributes are string arrays, like the messages sent mid-turn
|
|
75
|
+
if (Array.isArray(value)) {
|
|
76
|
+
return value.map((item) =>
|
|
77
|
+
typeof item === "string" ? item.replace(EMAIL, "[email]") : item
|
|
78
|
+
) as AttributeValue;
|
|
79
|
+
}
|
|
80
|
+
return value;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function scrub(attributes: Attributes) {
|
|
84
|
+
for (const key of Object.keys(attributes)) attributes[key] = redact(attributes[key]);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const redactEmails: SpanProcessor = {
|
|
88
|
+
onStart: () => {},
|
|
89
|
+
onEnding: (span) => {
|
|
90
|
+
scrub(span.attributes);
|
|
91
|
+
for (const event of span.events) scrub(event.attributes ?? {});
|
|
92
|
+
},
|
|
93
|
+
onEnd: () => {},
|
|
94
|
+
forceFlush: async () => {},
|
|
95
|
+
shutdown: async () => {},
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
export default defineConfig({
|
|
99
|
+
project: "<project ref>",
|
|
100
|
+
telemetry: { spanProcessors: [redactEmails] },
|
|
101
|
+
});
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Scrubbing every string value, rather than matching attribute names, also catches the turn preview text. See [Span processors](/config/config-file#span-processors) for when each hook runs and which attributes are kept.
|
|
105
|
+
|
|
106
|
+
## What spans don't cover
|
|
107
|
+
|
|
108
|
+
These controls change the run trace only. Conversation content also reaches the platform in two other places:
|
|
109
|
+
|
|
110
|
+
- **Session streams.** Each message your frontend sends is written to the session's `session.in` stream, and the agent's output to `session.out`. They hold message content for their retention window, and the session view in the dashboard reads from them. See [transcript storage limits](/ai-chat/transcript-storage#guarantees-and-limits).
|
|
111
|
+
- **The run payload.** A chat agent run's payload includes `clientData` as `metadata`, and every `session.in` record carries it too. Send an id in `clientData` and look up the rest in `onPreload` or `run` instead of sending the values themselves.
|
|
112
|
+
|
|
113
|
+
To keep a value off the platform entirely, redact or tokenize it in your frontend or backend before it's sent. The model then sees the redacted value too, unless your tools resolve the tokens.
|
|
114
|
+
|
|
115
|
+
## Verify it
|
|
116
|
+
|
|
117
|
+
Send a message containing a marker value (an email address, for example), then open the run in the dashboard. Select the `chat turn 1` span and check its properties: the marker is gone, or shows as `[email]` with the span processor above. The span list shows the same redacted preview.
|
|
@@ -134,6 +134,39 @@ The parent LLM naturally calls this tool multiple times:
|
|
|
134
134
|
2. `researchAgent({ conversationId: "competitors", message: "Go deeper on pricing" })` — same run, sub-agent has full context
|
|
135
135
|
3. `researchAgent({ conversationId: "new-topic", message: "..." })` — different ID = different sub-agent
|
|
136
136
|
|
|
137
|
+
## Limiting parallel sub-agents per session
|
|
138
|
+
|
|
139
|
+
Give every sub-agent task a shared named limit with a `perKey`, pass the parent session's id as each sub-agent's `concurrencyKey`, and raise that key's cap when the user picks a parallelism:
|
|
140
|
+
|
|
141
|
+
```ts trigger/limits.ts
|
|
142
|
+
import { concurrencyLimit } from "@trigger.dev/sdk";
|
|
143
|
+
|
|
144
|
+
// one sub-agent at a time per session unless a session is given more
|
|
145
|
+
export const subagentsLimit = concurrencyLimit({ name: "subagents", perKey: 1 });
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
```ts trigger/research-agent.ts
|
|
149
|
+
export const researchAgent = chat.agent({
|
|
150
|
+
id: "research-agent",
|
|
151
|
+
concurrency: subagentsLimit,
|
|
152
|
+
// ...
|
|
153
|
+
});
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
```ts
|
|
157
|
+
// in the parent agent, once per session, when the user picks a parallelism of 3
|
|
158
|
+
await concurrencyLimits.override("subagents", { concurrencyKey: sessionId, perKey: 3 });
|
|
159
|
+
|
|
160
|
+
// every sub-agent for this session carries the session's key
|
|
161
|
+
const agent = new AgentChat({
|
|
162
|
+
agent: "research-agent",
|
|
163
|
+
id: conversationId,
|
|
164
|
+
triggerConfig: { concurrencyKey: sessionId },
|
|
165
|
+
});
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
Three sub-agent runs for this session execute at once; a fourth waits. Other sessions keep the declared cap of one, and any tenant-level limit the sub-agent task also holds keeps applying. The override expires after 7 days by default (`ttl` sets it, up to 30 days), so a session that outlives that should call `override` again. See [Overriding a limit for one key](/concurrency#overriding-a-limit-for-one-key).
|
|
169
|
+
|
|
137
170
|
### Cross-turn persistence
|
|
138
171
|
|
|
139
172
|
Sub-agent conversations persist across **parent turns** because the `Map` lives in the parent's process heap. When the parent suspends and restores via snapshot, the heap is preserved — the Map still has the conversations, the sessions still have the run IDs.
|
|
@@ -12,6 +12,8 @@ By default (without `pendingMessages`), a message sent while the agent is respon
|
|
|
12
12
|
|
|
13
13
|
The `pendingMessages` option enables steering instead, injecting user messages between tool-call steps via the AI SDK's `prepareStep`. Messages that arrive during streaming are queued and injected at the next step boundary. A message that is not injected becomes the next turn instead, whether that is because `shouldInject` returned `false` or because there were no more step boundaries (single-step response or final text generation). The backend handles that, so no client-side re-send is involved.
|
|
14
14
|
|
|
15
|
+
Messages from a [channel](/webhooks/channels) such as [Slack](/webhooks/slack) are offered the same way, with `metadata.source` set to `"channel"` so `shouldInject` can tell them apart. A channel's stop control and approval clicks are never offered. The connector acknowledges a channel message as soon as it arrives (Slack reacts with 👀, Linear posts a thought), before `shouldInject` decides, so the acknowledgement is the same whether the message is folded in or answered next. Channels are part of the [webhooks private beta](https://trigger.dev/webhooks-beta).
|
|
16
|
+
|
|
15
17
|
Use the `streamText` passed to your agent's `run` callback. It wires up pending-message injection automatically. If you import `streamText` directly from `ai`, spread `chat.toStreamTextOptions()` into its options to connect injection.
|
|
16
18
|
|
|
17
19
|
## How it works
|
|
@@ -47,7 +47,9 @@ Options for `chat.agent()`.
|
|
|
47
47
|
| `storage` | `TranscriptStorage` | `defaultStorage` | Where the conversation is persisted and read back. The platform snapshot by default; bring your own to write each change to your database. See [Transcript storage](/ai-chat/transcript-storage) |
|
|
48
48
|
| `hydrateMessages` | `(event: HydrateMessagesEvent) => UIMessage[] \| Promise<UIMessage[]>` | — | **Deprecated.** Load message history from backend, replacing the linear accumulator. Use `loadContext` on a `storage` instead; cannot be combined with `storage`. See [hydrateMessages](/ai-chat/lifecycle-hooks#hydratemessages) |
|
|
49
49
|
| `actionSchema` | `TaskSchema` | — | Schema for validating custom actions sent via `transport.sendAction()`. See [Actions](/ai-chat/actions) |
|
|
50
|
-
| `onAction` | `(event: ActionEvent) => Promise<void \| ActionTurn> \| void \| ActionTurn` | — | Handle custom actions. Actions are state edits: only `hydrateMessages` (or a storage's `loadContext`) + `onAction` fire. Return `chat.turn()` to run a turn on the edited history, or nothing for an edit only. See [Actions](/ai-chat/actions) |
|
|
50
|
+
| `onAction` | `(event: ActionEvent) => Promise<void \| ActionTurn> \| void \| ActionTurn` | — | Handle custom actions. Actions are state edits: only `hydrateMessages` (or a storage's `loadContext`) + `onAction` fire. Return `chat.turn()` to run a turn on the edited history (`chat.turn(message)` to answer a new user message), or nothing for an edit only. See [Actions](/ai-chat/actions) |
|
|
51
|
+
| `events` | `ChatEvent[]` | — | Webhook event descriptors (from `chat.event()`) whose verified deliveries are routed to this agent as actions and handled in `onAction`. See [session routing](/webhooks/session-routing). Part of the [webhooks private beta](https://trigger.dev/webhooks-beta). |
|
|
52
|
+
| `channels` | `ChannelConnector[]` | — | Channel connectors (for example `slack()`) that turn an external chat surface into a frontend for the agent: inbound messages run as turns and the reply posts back. See [channels](/webhooks/channels). Part of the [webhooks private beta](https://trigger.dev/webhooks-beta). |
|
|
51
53
|
| `onTurnStart` | `(event: TurnStartEvent) => Promise<void> \| void` | — | Fires every turn before `run()` |
|
|
52
54
|
| `onBeforeTurnComplete` | `(event: BeforeTurnCompleteEvent) => Promise<void> \| void` | — | Fires after response but before stream closes. Includes `writer`. |
|
|
53
55
|
| `onTurnComplete` | `(event: TurnCompleteEvent) => Promise<void> \| void` | — | Fires after each turn completes (stream closed) |
|
|
@@ -71,6 +73,7 @@ Options for `chat.agent()`.
|
|
|
71
73
|
| `onChatResume` | `(event: ChatResumeEvent) => Promise<void> \| void` | — | Fires right after the run resumes from suspension |
|
|
72
74
|
| `exitAfterPreloadIdle` | `boolean` | `false` | Exit run after preload idle timeout instead of suspending. See [exitAfterPreloadIdle](/ai-chat/lifecycle-hooks#exitafterpreloadidle) |
|
|
73
75
|
| `oomMachine` | `MachinePresetName` | — | Fallback machine when an attempt fails with OOM. Setting it enables a single OOM retry on the larger machine. See [OOM resilience](/ai-chat/patterns/oom-resilience) |
|
|
76
|
+
| `telemetry` | `{ recordUserMessage?: boolean; recordClientData?: boolean }` | both `true` | What the chat runtime records on its spans. `recordUserMessage: false` drops the user message and turn preview (`chat.user_message`, `pending.messages`); `recordClientData: false` drops `chat.client_data`. See [Redact chat content from traces](/ai-chat/patterns/redacting-telemetry) |
|
|
74
77
|
|
|
75
78
|
Plus most standard [TaskOptions](/tasks/overview) — `queue`, `machine`, `maxDuration`, **`onWait`**, **`onResume`**, **`onComplete`**, and other lifecycle hooks. Generic `retry` is **not** exposed on `chat.agent`; use `oomMachine` for OOM recovery, or drop down to a raw [`task()`](/ai-chat/custom-agents) if you need richer retry semantics. Standard hooks use the same parameter shapes as on a normal `task()` (including `ctx`).
|
|
76
79
|
|
|
@@ -232,7 +235,7 @@ The persistence adapter set through `chat.agent({ storage })`. See [Transcript s
|
|
|
232
235
|
| Type | Shape |
|
|
233
236
|
| --- | --- |
|
|
234
237
|
| `TranscriptScope<TClientData>` | `{ chatId: string; clientData: TClientData }` |
|
|
235
|
-
| `TranscriptStorageContext<TClientData>` | `TranscriptScope` plus `{ turn: number; trigger: "submit-message" \| "regenerate-message" \| "action"; runId: string; ctx: TaskRunContext }` |
|
|
238
|
+
| `TranscriptStorageContext<TClientData>` | `TranscriptScope` plus `{ turn: number; trigger: "submit-message" \| "regenerate-message" \| "action" \| "action-turn"; source?: "client" \| "channel" \| "webhook"; connectorId?: string; runId: string; ctx: TaskRunContext }`. `action-turn` is the turn `chat.turn()` requested; `source` names the surface that drove the write |
|
|
236
239
|
| `TranscriptChange` | `{ op: "put"; message: UIMessage; final?: boolean }` \| `{ op: "remove"; id: string }` \| `{ op: "truncateAfter"; afterId: string }` \| `{ op: "state"; value: unknown \| null }` |
|
|
237
240
|
| `TranscriptChangeset` | `{ reason: "turn-complete" \| "turn-error" \| "action" \| "compaction" \| "recovery"; changes: TranscriptChange[]; transcript: TranscriptState; cursors?: TranscriptCursors }` |
|
|
238
241
|
| `TranscriptState` | `{ entries: Array<{ id: string; final: boolean; message: UIMessage }>; state: unknown \| null }`: the whole conversation after the changeset's changes, for stores that write one document |
|
|
@@ -275,6 +278,7 @@ Passed to the `onAction` callback. See [Actions](/ai-chat/actions).
|
|
|
275
278
|
| `clientData` | Typed by `clientDataSchema` | Custom data from the frontend |
|
|
276
279
|
| `uiMessages` | `UIMessage[]` | Accumulated UI messages (after hydration, if set) |
|
|
277
280
|
| `messages` | `ModelMessage[]` | Accumulated model messages (after hydration, if set) |
|
|
281
|
+
| `channel` | `{ connectorId, provider, event, deliveryId }` | For a channel action (a button the agent posted, such as a Slack `slackButton()`): the verified click event. Absent otherwise |
|
|
278
282
|
|
|
279
283
|
## TurnStartEvent
|
|
280
284
|
|
|
@@ -538,6 +542,8 @@ All methods available on the `chat` object from `@trigger.dev/sdk/ai`.
|
|
|
538
542
|
| Method | Description |
|
|
539
543
|
| ------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
|
|
540
544
|
| `chat.agent(options)` | Create a chat agent |
|
|
545
|
+
| `chat.event(options)` | Declare an inbound webhook event descriptor an agent claims via `chat.agent({ events })`. See [session routing](/webhooks/session-routing). Part of the [webhooks private beta](https://trigger.dev/webhooks-beta). |
|
|
546
|
+
| `chat.channels.custom(options)` | Create a generic chat-frontend channel over any verified webhook source (you supply the egress). The `slack()` preset ships in `@trigger.dev/slack`. See [channels](/webhooks/channels). Part of the [webhooks private beta](https://trigger.dev/webhooks-beta). |
|
|
541
547
|
| `chat.createSession(payload, options)` | Create an async iterator for chat turns |
|
|
542
548
|
| `chat.pipe(source, options?)` | Pipe a stream to the frontend (from anywhere inside a task) |
|
|
543
549
|
| `chat.pipeAndCapture(source, options?)` | Pipe and capture the response; returns `{ message, status, error }` |
|
|
@@ -570,6 +576,51 @@ All methods available on the `chat` object from `@trigger.dev/sdk/ai`.
|
|
|
570
576
|
| `chat.withUIMessage(config?)` | Returns a [ChatBuilder](/ai-chat/types#chatbuilder) with a fixed `UIMessage` subtype. See [Types](/ai-chat/types) |
|
|
571
577
|
| `chat.withClientData({ schema })` | Returns a [ChatBuilder](/ai-chat/types#chatbuilder) with a fixed client data schema. See [Types](/ai-chat/types#typed-client-data-with-chatwithclientdata) |
|
|
572
578
|
|
|
579
|
+
## `chat.event`
|
|
580
|
+
|
|
581
|
+
Declare an inbound webhook event that an agent claims via [`events`](#chatagentoptions) on `chat.agent()`. It is a descriptor only, with no handler: it names the [endpoint](/webhooks/overview) it subscribes to, a `key` template that resolves each delivery to a durable [session](/ai-chat/sessions), and an optional `type` label (defaults to the descriptor `id`). Verified deliveries are routed to that session and arrive at `onAction` as a `{ type, event, source, headers, deliveryId, endpoint }` envelope, not as a chat turn. See [session routing](/webhooks/session-routing).
|
|
582
|
+
|
|
583
|
+
```ts
|
|
584
|
+
import { webhooks } from "@trigger.dev/sdk";
|
|
585
|
+
import { chat } from "@trigger.dev/sdk/ai";
|
|
586
|
+
|
|
587
|
+
export const stripe = webhooks.endpoint.define({ id: "stripe", source: webhooks.stripe() });
|
|
588
|
+
|
|
589
|
+
export const orderEvents = chat.event({
|
|
590
|
+
id: "order-events",
|
|
591
|
+
endpoint: stripe,
|
|
592
|
+
key: "{event.data.object.customer}",
|
|
593
|
+
// invoices always carry a customer; events without one would have no session to go to
|
|
594
|
+
filter: "event.type startsWith 'invoice.'",
|
|
595
|
+
type: "order.event",
|
|
596
|
+
});
|
|
597
|
+
```
|
|
598
|
+
|
|
599
|
+
## `chat.channels.custom`
|
|
600
|
+
|
|
601
|
+
Create a generic chat-frontend channel on any [endpoint](/webhooks/overview), claimed via [`channels`](#chatagentoptions) on `chat.agent()`. You supply the session `key`, the `inbound` map from event to turn message, and your own `send` egress that posts the reply back, so the whole round-trip is under your control. Inbound messages run as normal turns and the reply is posted back. The `slack()` preset ships in `@trigger.dev/slack` and wires the egress for you. See [channels](/webhooks/channels), and the interactive approvals layer at [human-in-the-loop](/webhooks/human-in-the-loop).
|
|
602
|
+
|
|
603
|
+
```ts
|
|
604
|
+
import { webhooks } from "@trigger.dev/sdk";
|
|
605
|
+
import { chat } from "@trigger.dev/sdk/ai";
|
|
606
|
+
|
|
607
|
+
const surface = webhooks.endpoint.define({
|
|
608
|
+
id: "my-surface",
|
|
609
|
+
source: webhooks.custom<MyEvent>({ /* verifier config */ }),
|
|
610
|
+
});
|
|
611
|
+
|
|
612
|
+
export const mySurface = chat.channels.custom({
|
|
613
|
+
id: "my-surface",
|
|
614
|
+
endpoint: surface,
|
|
615
|
+
key: "{event.conversationId}",
|
|
616
|
+
inbound: (event) => event.text,
|
|
617
|
+
send: async (message, ctx) => {
|
|
618
|
+
const ref = await postToMySurface(ctx.event, message.text, ctx.previousRef);
|
|
619
|
+
return { ref };
|
|
620
|
+
},
|
|
621
|
+
});
|
|
622
|
+
```
|
|
623
|
+
|
|
573
624
|
## `chat.withUIMessage`
|
|
574
625
|
|
|
575
626
|
Returns a [`ChatBuilder`](/ai-chat/types#chatbuilder) with a fixed `UIMessage` subtype. Chain `.withClientData()`, hook methods, and `.agent()`.
|
|
@@ -226,7 +226,7 @@ A few things to get right:
|
|
|
226
226
|
## Guarantees and limits
|
|
227
227
|
|
|
228
228
|
- Crash recovery of a half-written answer is runtime-owned in every configuration. It comes from the durable session stream, which no application database can reconstruct. A storage holds settled turns; the runtime overlays the recovered tail and hands it to `save` like any other change.
|
|
229
|
-
- Bringing your own database does not remove platform custody. Session streams still hold message content for their retention window.
|
|
229
|
+
- Bringing your own database does not remove platform custody. Session streams still hold message content for their retention window. To keep content out of the run trace, see [Redact chat content from traces](/ai-chat/patterns/redacting-telemetry).
|
|
230
230
|
- The default storage rewrites the whole conversation each turn. A row-per-message storage writes only what changed. That is the reason to plug in your own.
|
|
231
231
|
|
|
232
232
|
## Migrating from hydrateMessages
|
package/docs/apikeys.mdx
CHANGED
|
@@ -75,19 +75,21 @@ The default API URL is `https://api.trigger.dev`.
|
|
|
75
75
|
|
|
76
76
|
## Access presets
|
|
77
77
|
|
|
78
|
-
Access presets define what a key can do.
|
|
78
|
+
Access presets define what a key can do. On the Free and Hobby plans only the **No restrictions** preset is available. All other presets require the Pro or Enterprise plan.
|
|
79
79
|
|
|
80
80
|
| Preset | Access |
|
|
81
81
|
| --- | --- |
|
|
82
82
|
| **Trigger only** | Trigger runs and batches for all or selected tasks. Trigger responses include scoped public access tokens for the runs and batches they create |
|
|
83
83
|
| **Task operator** | Trigger all or selected tasks and inspect or operate on their runs |
|
|
84
|
-
| **Observer** | Read runs, tasks, batches, logs, traces, and
|
|
85
|
-
| **Operator** | Observe and operate on runs and
|
|
84
|
+
| **Observer** | Read runs, tasks, batches, logs, traces, queues, errors, and webhooks |
|
|
85
|
+
| **Operator** | Observe and operate on runs, queues, errors, and webhooks, and trigger tasks |
|
|
86
|
+
| **Webhooks only** | Read and write [webhooks](/webhooks/overview), which are in private beta. Replaying deliveries that trigger tasks and creating webhook waiters require task or waitpoint scopes |
|
|
87
|
+
| **Waitpoints only** | Create, list, and retrieve [waitpoint tokens](/wait-for-token). No task or run access |
|
|
86
88
|
| **Deploy only** | Deploy versions, sync environment variables, and manage Preview branches |
|
|
87
89
|
| **Variables only** | Read and write environment variables in this environment |
|
|
88
90
|
| **No restrictions** | Full access to the environment |
|
|
89
91
|
|
|
90
|
-
**Trigger only** and **Task operator** can be restricted to selected tasks. Task restrictions use task identifiers, such as `send-email`. A request involving multiple tasks — such as a batch trigger — succeeds only when the key can access every task in the request, so a task-restricted key can batch-trigger only its selected tasks.
|
|
92
|
+
**Trigger only** and **Task operator** can be restricted to selected tasks, up to 10 tasks per key. Task restrictions use task identifiers, such as `send-email`. A request involving multiple tasks — such as a batch trigger — succeeds only when the key can access every task in the request, so a task-restricted key can batch-trigger only its selected tasks.
|
|
91
93
|
|
|
92
94
|
## Deploy with an API key
|
|
93
95
|
|
|
@@ -96,11 +98,11 @@ Set a key in `TRIGGER_ACCESS_TOKEN` to authenticate `trigger deploy` without log
|
|
|
96
98
|
<CodeGroup>
|
|
97
99
|
|
|
98
100
|
```bash npm
|
|
99
|
-
TRIGGER_ACCESS_TOKEN="tr_prod_sk_…" npx trigger.dev@latest deploy
|
|
101
|
+
TRIGGER_ACCESS_TOKEN="tr_prod_sk_…" npx trigger.dev@latest deploy --env prod
|
|
100
102
|
```
|
|
101
103
|
</CodeGroup>
|
|
102
104
|
|
|
103
|
-
The key must belong to the target environment. Use a Production key
|
|
105
|
+
The key must belong to the target environment. Use a Production key with `--env prod`, a Staging key with `--env staging`, or a key from the Preview environment with `--env preview`. If you leave out `--env`, the CLI deploys to the key's environment, and a `--env` that doesn't match the key is an error. A Preview deployment key can create and archive Preview branches and sync their environment variables.
|
|
104
106
|
|
|
105
107
|
<Note>
|
|
106
108
|
The deploy CLI reads environment API keys from `TRIGGER_ACCESS_TOKEN`, not
|
|
@@ -124,7 +126,7 @@ Use `@trigger.dev/sdk` version 4.5.8 or later to create public tokens with envir
|
|
|
124
126
|
|
|
125
127
|
- The token must request at least one scope.
|
|
126
128
|
- Its scopes cannot exceed the key's access.
|
|
127
|
-
- Its expiration cannot exceed 30 days.
|
|
129
|
+
- Its expiration cannot exceed 30 days (the default is 15 minutes).
|
|
128
130
|
|
|
129
131
|
<Note>
|
|
130
132
|
Revoking or expiring an API key does not revoke tokens it already created. Those tokens remain valid until their own expiration.
|
package/docs/billing-limits.mdx
CHANGED
|
@@ -49,7 +49,7 @@ When your organization's spend reaches the billing limit, billable environments
|
|
|
49
49
|
2. New runs can still be triggered and are queued, but they won't start executing. Queued runs incur no compute cost until they start.
|
|
50
50
|
3. You have **24 hours** to review and decide what to do.
|
|
51
51
|
|
|
52
|
-
If you don't act before the grace period ends,
|
|
52
|
+
If you don't act before the grace period ends, new triggers are rejected until you increase or remove the limit (limits also reset at the start of each billing cycle). Queued runs stay queued until you resolve the limit and choose to resume or cancel them. If the limit is still in place when a new billing cycle starts, queued runs resume automatically. Runs that have a TTL still expire if they stay queued past it.
|
|
53
53
|
|
|
54
54
|
<Note>
|
|
55
55
|
Billing limits are **soft limits**, not instantaneous hard caps. Usage is evaluated on a short
|
|
@@ -7,7 +7,6 @@ description: "List, get, set, and pull environment variables for a Trigger.dev p
|
|
|
7
7
|
import CommonOptions from "/snippets/cli-options-common.mdx";
|
|
8
8
|
import ConfigFileOptions from "/snippets/cli-options-config-file.mdx";
|
|
9
9
|
import ProjectRefOptions from "/snippets/cli-options-project-ref.mdx";
|
|
10
|
-
import BranchOptions from "/snippets/cli-options-branch.mdx";
|
|
11
10
|
|
|
12
11
|
These commands manage environment variables on a project environment. They default to `prod`. Use `--env staging` or `--env preview` (with `--branch`) for the other environments. There is no `dev` target: local `trigger dev` reads your local `.env`.
|
|
13
12
|
|
|
@@ -82,7 +81,7 @@ npx trigger.dev@latest env set STRIPE_KEY sk_live_abc --secret
|
|
|
82
81
|
|
|
83
82
|
## env pull
|
|
84
83
|
|
|
85
|
-
Writes the project's environment variables to a local file. Defaults to `.env.local`.
|
|
84
|
+
Writes the project's environment variables to a local file. Defaults to `.env.local`. Asks you to confirm before overwriting an existing file unless you pass `--force`. `TRIGGER_` system variables are omitted.
|
|
86
85
|
|
|
87
86
|
```bash
|
|
88
87
|
npx trigger.dev@latest env pull
|
|
@@ -94,7 +93,7 @@ npx trigger.dev@latest env pull --output .env.trigger --force
|
|
|
94
93
|
</ParamField>
|
|
95
94
|
|
|
96
95
|
<ParamField body="Force" type="--force">
|
|
97
|
-
Overwrite the output file if it exists.
|
|
96
|
+
Overwrite the output file if it exists, without asking.
|
|
98
97
|
</ParamField>
|
|
99
98
|
|
|
100
99
|
## Options
|
|
@@ -105,7 +104,9 @@ npx trigger.dev@latest env pull --output .env.trigger --force
|
|
|
105
104
|
|
|
106
105
|
<ConfigFileOptions />
|
|
107
106
|
<ProjectRefOptions />
|
|
108
|
-
<
|
|
107
|
+
<ParamField body="Preview branch" type="--branch | -b">
|
|
108
|
+
Required when using `--env preview`. Specify the branch, e.g. `--branch my-branch` or `-b my-branch`.
|
|
109
|
+
</ParamField>
|
|
109
110
|
|
|
110
111
|
### Common options
|
|
111
112
|
|
|
@@ -24,6 +24,12 @@ yarn dlx trigger.dev@latest init
|
|
|
24
24
|
|
|
25
25
|
</CodeGroup>
|
|
26
26
|
|
|
27
|
+
## Arguments
|
|
28
|
+
|
|
29
|
+
<ParamField body="Project path" type="[path]">
|
|
30
|
+
The path to the project. Defaults to `.`.
|
|
31
|
+
</ParamField>
|
|
32
|
+
|
|
27
33
|
## Options
|
|
28
34
|
|
|
29
35
|
<ParamField body="Javascript" type="--javascript">
|
|
@@ -36,7 +42,7 @@ yarn dlx trigger.dev@latest init
|
|
|
36
42
|
</ParamField>
|
|
37
43
|
|
|
38
44
|
<ParamField body="Package tag" type="--tag | -t">
|
|
39
|
-
The version of the `@trigger.dev/sdk` package to install. Defaults to
|
|
45
|
+
The version of the `@trigger.dev/sdk` package to install. Defaults to the CLI version.
|
|
40
46
|
</ParamField>
|
|
41
47
|
|
|
42
48
|
<ParamField body="Skip package install" type="--skip-package-install">
|
|
@@ -47,6 +53,26 @@ yarn dlx trigger.dev@latest init
|
|
|
47
53
|
Override the existing config file if it exists.
|
|
48
54
|
</ParamField>
|
|
49
55
|
|
|
56
|
+
<ParamField body="Project name" type="--project-name <name>">
|
|
57
|
+
The name of the project to create when your account has no projects yet.
|
|
58
|
+
</ParamField>
|
|
59
|
+
|
|
60
|
+
<ParamField body="Organization name" type="--org-name <name>">
|
|
61
|
+
The organization to create the first project in. Matches an existing organization by name, or creates it if you have none.
|
|
62
|
+
</ParamField>
|
|
63
|
+
|
|
64
|
+
<ParamField body="Runtime" type="-r, --runtime <runtime>">
|
|
65
|
+
The runtime to use: `node`, `node-22`, `node-24`, `node-26` or `bun`. Defaults to `node-24`.
|
|
66
|
+
</ParamField>
|
|
67
|
+
|
|
68
|
+
<ParamField body="Yes" type="-y, --yes">
|
|
69
|
+
Skip all prompts. Requires `--project-ref`, or `--project-name` with `--org-name` for a new account.
|
|
70
|
+
</ParamField>
|
|
71
|
+
|
|
72
|
+
<ParamField body="No browser" type="--no-browser">
|
|
73
|
+
Do not open the browser during login. Print the URL only.
|
|
74
|
+
</ParamField>
|
|
75
|
+
|
|
50
76
|
<ParamField body="Package arguments" type="--pkg-args">
|
|
51
77
|
Additional arguments to pass to the package manager. Accepts CSV for multiple args.
|
|
52
78
|
</ParamField>
|
|
@@ -26,6 +26,26 @@ yarn dlx trigger.dev@latest login
|
|
|
26
26
|
|
|
27
27
|
## Options
|
|
28
28
|
|
|
29
|
+
<ParamField body="No browser" type="--no-browser">
|
|
30
|
+
Do not open the browser. Print the URL only.
|
|
31
|
+
</ParamField>
|
|
32
|
+
|
|
33
|
+
<ParamField body="Email" type="--email <email>">
|
|
34
|
+
Prefill the email on the login page.
|
|
35
|
+
</ParamField>
|
|
36
|
+
|
|
37
|
+
<ParamField body="Name" type="--name <name>">
|
|
38
|
+
Set your name after authorization. Only applies to a new account that has not set its details yet.
|
|
39
|
+
</ParamField>
|
|
40
|
+
|
|
41
|
+
<ParamField body="Cancel pending" type="--cancel-pending">
|
|
42
|
+
Cancel a pending login and keep the current account.
|
|
43
|
+
</ParamField>
|
|
44
|
+
|
|
45
|
+
<ParamField body="No wait" type="--no-wait">
|
|
46
|
+
Save the authorization and exit so login can be resumed later.
|
|
47
|
+
</ParamField>
|
|
48
|
+
|
|
29
49
|
### Common options
|
|
30
50
|
|
|
31
51
|
These options are available on most commands.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: "CLI projects commands"
|
|
3
3
|
sidebarTitle: "projects"
|
|
4
|
-
description: "
|
|
4
|
+
description: "List, create, inspect, and rename Trigger.dev projects from the terminal."
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
import CommonOptions from "/snippets/cli-options-common.mdx";
|
|
@@ -37,6 +37,18 @@ yarn dlx trigger.dev@latest projects create
|
|
|
37
37
|
The name of the new project.
|
|
38
38
|
</ParamField>
|
|
39
39
|
|
|
40
|
+
## projects list
|
|
41
|
+
|
|
42
|
+
Lists your projects with the runtime and version of their current Production deployment.
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
npx trigger.dev@latest projects list
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
<ParamField body="Needs update" type="--needs-update">
|
|
49
|
+
Only show projects using Node.js 21 in Production.
|
|
50
|
+
</ParamField>
|
|
51
|
+
|
|
40
52
|
## projects get
|
|
41
53
|
|
|
42
54
|
Prints the name, ref, slug, organization, default runtime and region of a project.
|