@trigger.dev/sdk 4.8.0-webhooks.20261020092920 → 4.8.0
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 +2 -1
- package/dist/commonjs/v3/ai.js +18 -1
- package/dist/commonjs/v3/ai.js.map +1 -1
- package/dist/commonjs/v3/webhooks.d.ts +11 -3
- package/dist/commonjs/v3/webhooks.js +17 -1
- package/dist/commonjs/v3/webhooks.js.map +1 -1
- package/dist/commonjs/version.js +1 -1
- package/dist/esm/v3/ai.d.ts +2 -1
- package/dist/esm/v3/ai.js +18 -1
- package/dist/esm/v3/ai.js.map +1 -1
- package/dist/esm/v3/webhooks.d.ts +11 -3
- package/dist/esm/v3/webhooks.js +17 -1
- package/dist/esm/v3/webhooks.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/docs/ai-chat/backend.mdx +10 -7
- package/docs/ai-chat/client-protocol.mdx +6 -3
- package/docs/ai-chat/patterns/redacting-telemetry.mdx +5 -5
- package/docs/ai-chat/pending-messages.mdx +1 -1
- package/docs/ai-chat/reference.mdx +4 -4
- package/docs/apikeys.mdx +1 -1
- package/docs/deploy-environment-variables.mdx +19 -0
- package/docs/mcp-tools.mdx +0 -4
- package/docs/webhooks/channels.mdx +29 -7
- package/docs/webhooks/connect.mdx +14 -7
- package/docs/webhooks/deliveries.mdx +8 -5
- package/docs/webhooks/filters.mdx +8 -4
- package/docs/webhooks/human-in-the-loop.mdx +9 -6
- package/docs/webhooks/linear.mdx +2 -5
- package/docs/webhooks/overview.mdx +16 -4
- package/docs/webhooks/session-routing.mdx +8 -5
- package/docs/webhooks/slack.mdx +44 -19
- package/docs/webhooks/sources.mdx +36 -7
- package/docs/webhooks/waiters.mdx +0 -4
- package/package.json +2 -2
|
@@ -2,7 +2,7 @@ import { Webhook } from "@trigger.dev/core/v3";
|
|
|
2
2
|
import type { WebhookSource, InferWebhookEvent, AnyWebhookSource, ValidateWebhookFilter, NarrowWebhookEvent, ChatEvent, ValidatedWebhookKey, WebhookResponseConfig, WebhookUrlSecretConfig, WebhookVerifierConfig, StripeWebhookEvent, GitHubWebhookEvent, TaskRunContext, AnyWebhookEndpoint, InferWebhookEndpointEvent, WebhookEndpoint, WebhookEndpointContext, TaskOptions } from "@trigger.dev/core/v3";
|
|
3
3
|
import { cancelWebhookWaiter, createWebhookWaiter, waitForWebhookWaiter } from "./webhookWaiters.js";
|
|
4
4
|
import { type Task } from "./shared.js";
|
|
5
|
-
import { type WebhookProviderId } from "@trigger.dev/core/webhooks";
|
|
5
|
+
import { type HookdeckSourceOptions, type WebhookProviderId } from "@trigger.dev/core/webhooks";
|
|
6
6
|
/**
|
|
7
7
|
* The type of error thrown when a webhook fails to parse or verify
|
|
8
8
|
*/
|
|
@@ -74,6 +74,13 @@ export declare const webhookSources: {
|
|
|
74
74
|
* the endpoint's Connect panel, which you paste into Meta's Verify Token field.
|
|
75
75
|
*/
|
|
76
76
|
readonly whatsapp: <T = unknown>() => WebhookSource<T>;
|
|
77
|
+
/**
|
|
78
|
+
* Hookdeck relays deliveries from another provider, so `T` is the original provider's event. It
|
|
79
|
+
* verifies `x-hookdeck-signature` (and `x-hookdeck-signature-2` while a secret is being rolled)
|
|
80
|
+
* with the Hookdeck project's signing secret, and dedupes retries on `x-hookdeck-eventid`. Pass
|
|
81
|
+
* `headerPrefix` when the project's header prefix was changed from `x-hookdeck`.
|
|
82
|
+
*/
|
|
83
|
+
readonly hookdeck: <T = unknown>(options?: HookdeckSourceOptions) => WebhookSource<T>;
|
|
77
84
|
};
|
|
78
85
|
type CamelCase<S extends string> = S extends `${infer Head}-${infer Tail}` ? `${Head}${Capitalize<CamelCase<Tail>>}` : S;
|
|
79
86
|
/**
|
|
@@ -85,7 +92,7 @@ type CamelCase<S extends string> = S extends `${infer Head}-${infer Tail}` ? `${
|
|
|
85
92
|
export type ProviderProducers = {
|
|
86
93
|
[K in Exclude<WebhookProviderId, "zoom"> as CamelCase<K>]: <TEvent = unknown>() => WebhookSource<TEvent>;
|
|
87
94
|
};
|
|
88
|
-
export declare const providerProducers: Omit<ProviderProducers, "slack">;
|
|
95
|
+
export declare const providerProducers: Omit<ProviderProducers, "slack" | "hookdeck">;
|
|
89
96
|
export type WebhookEndpointOptions<TIdentifier extends string, TSource extends AnyWebhookSource> = {
|
|
90
97
|
/** The endpoint id. Subscribers reference the endpoint, and it names the endpoint's URL. */
|
|
91
98
|
id: TIdentifier;
|
|
@@ -212,6 +219,7 @@ interface Webhooks {
|
|
|
212
219
|
composio: typeof webhookSources.composio;
|
|
213
220
|
gitlab: typeof webhookSources.gitlab;
|
|
214
221
|
whatsapp: typeof webhookSources.whatsapp;
|
|
222
|
+
hookdeck: typeof webhookSources.hookdeck;
|
|
215
223
|
/** Declare the URLs providers deliver to. */
|
|
216
224
|
endpoint: {
|
|
217
225
|
define: typeof defineWebhookEndpoint;
|
|
@@ -226,4 +234,4 @@ interface Webhooks {
|
|
|
226
234
|
/**
|
|
227
235
|
* Webhook utilities for handling incoming webhook requests
|
|
228
236
|
*/
|
|
229
|
-
export declare const webhooks: Webhooks & Omit<ProviderProducers, "slack">;
|
|
237
|
+
export declare const webhooks: Webhooks & Omit<ProviderProducers, "slack" | "hookdeck">;
|
package/dist/esm/v3/webhooks.js
CHANGED
|
@@ -205,13 +205,28 @@ export const webhookSources = {
|
|
|
205
205
|
secretProvisioning: "provider",
|
|
206
206
|
};
|
|
207
207
|
},
|
|
208
|
+
/**
|
|
209
|
+
* Hookdeck relays deliveries from another provider, so `T` is the original provider's event. It
|
|
210
|
+
* verifies `x-hookdeck-signature` (and `x-hookdeck-signature-2` while a secret is being rolled)
|
|
211
|
+
* with the Hookdeck project's signing secret, and dedupes retries on `x-hookdeck-eventid`. Pass
|
|
212
|
+
* `headerPrefix` when the project's header prefix was changed from `x-hookdeck`.
|
|
213
|
+
*/
|
|
214
|
+
hookdeck(options) {
|
|
215
|
+
const setupPrompt = webhookSetupPrompts.hookdeck;
|
|
216
|
+
return {
|
|
217
|
+
provider: "hookdeck",
|
|
218
|
+
verifier: { kind: "config", config: webhookProviderConfigs.hookdeck.config(options) },
|
|
219
|
+
secretProvisioning: webhookProviderConfigs.hookdeck.secretProvisioning,
|
|
220
|
+
...(setupPrompt ? { setupPrompt } : {}),
|
|
221
|
+
};
|
|
222
|
+
},
|
|
208
223
|
};
|
|
209
224
|
function producerName(provider) {
|
|
210
225
|
return provider.replace(/-([a-z0-9])/g, (_, c) => c.toUpperCase());
|
|
211
226
|
}
|
|
212
227
|
export const providerProducers = Object.fromEntries(Object.entries(webhookProviderConfigs)
|
|
213
228
|
// Zoom needs a computed URL-validation response that the hosted ingress does not support yet.
|
|
214
|
-
.filter(([provider]) => provider !== "slack" && provider !== "zoom")
|
|
229
|
+
.filter(([provider]) => provider !== "slack" && provider !== "zoom" && provider !== "hookdeck")
|
|
215
230
|
.map(([provider, entry]) => [
|
|
216
231
|
producerName(provider),
|
|
217
232
|
() => {
|
|
@@ -333,6 +348,7 @@ export const webhooks = {
|
|
|
333
348
|
composio: webhookSources.composio,
|
|
334
349
|
gitlab: webhookSources.gitlab,
|
|
335
350
|
whatsapp: webhookSources.whatsapp,
|
|
351
|
+
hookdeck: webhookSources.hookdeck,
|
|
336
352
|
endpoint: { define: defineWebhookEndpoint },
|
|
337
353
|
waiter: { create: createWebhookWaiter, wait: waitForWebhookWaiter, cancel: cancelWebhookWaiter },
|
|
338
354
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhooks.js","sourceRoot":"","sources":["../../../src/v3/webhooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAqBhE,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAa,MAAM,aAA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B,CAAC;QAEF,mCAAmC;QACnC,MAAM,eAAe,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,WAAW,CAAC,CAAC;QACpE,MAAM,kBAAkB,GAAG,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAExE,kDAAkD;QAClD,OAAO,eAAe,CAAC,SAAS,EAAE,kBAAkB,CAAC,CAAC;IACxD,CAAC;IAAC,OAAO,MAAM,EAAE,CAAC;QAChB,MAAM,IAAI,YAAY,CAAC,+BAA+B,CAAC,CAAC;IAC1D,CAAC;AACH,CAAC;AAED,mDAAmD;AACnD,SAAS,eAAe,CAAC,CAAS,EAAE,CAAS;IAC3C,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM,EAAE,CAAC;QAC1B,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAClC,MAAM,IAAI,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IAC9C,CAAC;IACD,OAAO,MAAM,KAAK,CAAC,CAAC;AACtB,CAAC"}
|
package/dist/esm/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = "4.8.0
|
|
1
|
+
export const VERSION = "4.8.0";
|
|
2
2
|
//# sourceMappingURL=version.js.map
|
package/docs/ai-chat/backend.mdx
CHANGED
|
@@ -4,8 +4,6 @@ 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
|
-
|
|
9
7
|
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.
|
|
10
8
|
|
|
11
9
|
| Capability | `chat.agent()` | `chat.createSession()` | Raw primitives |
|
|
@@ -274,7 +272,7 @@ export const myChat = chat.agent({
|
|
|
274
272
|
});
|
|
275
273
|
```
|
|
276
274
|
|
|
277
|
-
The managed `streamText` carries the stored prompt's `system`, `model` (resolved through the agent's `registry`), sampling config, and `experimental_telemetry`. Options you pass at the call site win, apart from `system`, which throws when the prompt already set one.
|
|
275
|
+
The managed `streamText` carries the stored prompt's `system`, `model` (resolved through the agent's `registry`), sampling config, and `experimental_telemetry`. AI SDK telemetry is on even without a stored prompt, so model steps and tool calls show in the run trace. Options you pass at the call site win, apart from `system`, which throws when the prompt already set one.
|
|
278
276
|
|
|
279
277
|
`chat.toStreamTextOptions()` remains available for the same job, and is the only option in a [custom agent](#custom-agents), which has no `run` argument to take a bound `streamText` from. A `chat.headStart` route does get one, and there it also owns `messages`, `stopWhen` and `abortSignal`, since the handover depends on them. Pass `{ registry }` when a prompt names a provider-prefixed model, and `{ tools }` when you want HITL tool approvals, so the SDK knows which calls pause on `needsApproval`.
|
|
280
278
|
|
|
@@ -501,14 +499,12 @@ See [Actions](/ai-chat/actions).
|
|
|
501
499
|
|
|
502
500
|
### Webhook events and channels
|
|
503
501
|
|
|
504
|
-
<WebhooksBetaNote />
|
|
505
|
-
|
|
506
502
|
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
503
|
|
|
508
504
|
```ts
|
|
509
505
|
import { webhooks } from "@trigger.dev/sdk";
|
|
510
506
|
import { chat } from "@trigger.dev/sdk/ai";
|
|
511
|
-
import { slack, webhookSource } from "@trigger.dev/slack";
|
|
507
|
+
import { appMentions, slack, webhookSource } from "@trigger.dev/slack";
|
|
512
508
|
|
|
513
509
|
const slackEvents = webhooks.endpoint.define({ id: "slack", source: webhookSource() });
|
|
514
510
|
const stripe = webhooks.endpoint.define({ id: "stripe", source: webhooks.stripe() });
|
|
@@ -525,7 +521,14 @@ export const orderEvents = chat.event({
|
|
|
525
521
|
export const myChat = chat.agent({
|
|
526
522
|
id: "my-chat",
|
|
527
523
|
events: [orderEvents],
|
|
528
|
-
channels: [
|
|
524
|
+
channels: [
|
|
525
|
+
slack({
|
|
526
|
+
id: "support-slack",
|
|
527
|
+
endpoint: slackEvents,
|
|
528
|
+
token: process.env.SLACK_BOT_TOKEN!,
|
|
529
|
+
startOn: appMentions(),
|
|
530
|
+
}),
|
|
531
|
+
],
|
|
529
532
|
onAction: async ({ action }) => {
|
|
530
533
|
// A verified order-events delivery arrives here as an action.
|
|
531
534
|
},
|
|
@@ -318,12 +318,13 @@ If nothing arrives by the deadline, the server sends `data: [DONE]` and closes.
|
|
|
318
318
|
|
|
319
319
|
### Stream format (S2)
|
|
320
320
|
|
|
321
|
-
The output stream uses [S2](https://s2.dev) under the hood and follows the standard SSE wire format ([WHATWG spec](https://html.spec.whatwg.org/multipage/server-sent-events.html#parsing-an-event-stream)).
|
|
321
|
+
The output stream uses [S2](https://s2.dev) under the hood and follows the standard SSE wire format ([WHATWG spec](https://html.spec.whatwg.org/multipage/server-sent-events.html#parsing-an-event-stream)). Four event types arrive on the wire:
|
|
322
322
|
|
|
323
323
|
| Event | Meaning |
|
|
324
324
|
| --- | --- |
|
|
325
325
|
| `batch` | One or more records. The records you actually care about. |
|
|
326
326
|
| `ping` | Keepalive (~every 5s on idle). Body is `{"timestamp": <ms>}`, and on backends that report it a `tail` (same `{seq_num, timestamp}` shape as a batch tail). The tail is what lets you tell you have caught up to the live edge; if you don't need caught-up detection, ignore the ping. |
|
|
327
|
+
| `error` | The read failed after the stream started, for example while the stream backend restarts. Body is a plain-text reason. The connection then closes **without** `[DONE]`. Treat it like a dropped connection and [resume](#resuming-a-stream) from the last `seq_num` you processed. |
|
|
327
328
|
| _(no `event:`, just `data: [DONE]`)_ | Stream is closing — server sends this once before EOF. |
|
|
328
329
|
|
|
329
330
|
A `batch` event in raw SSE format looks like this — note the `data` is a single line of JSON, no embedded newlines (per the SSE spec):
|
|
@@ -446,7 +447,7 @@ while (true) {
|
|
|
446
447
|
|
|
447
448
|
### Self-contained parser (for custom transports)
|
|
448
449
|
|
|
449
|
-
If you're building a transport in another language or don't want the dependency, here's a complete reader. It handles the SSE framing, the comma-separated `id:` line, batch unwrapping, the inner `body` string, and `ping` / `[DONE]` events:
|
|
450
|
+
If you're building a transport in another language or don't want the dependency, here's a complete reader. It handles the SSE framing, the comma-separated `id:` line, batch unwrapping, the inner `body` string, and `ping` / `error` / `[DONE]` events:
|
|
450
451
|
|
|
451
452
|
```ts
|
|
452
453
|
async function* readSessionOut(
|
|
@@ -489,6 +490,8 @@ async function* readSessionOut(
|
|
|
489
490
|
if (!data) continue;
|
|
490
491
|
|
|
491
492
|
if (eventType === "ping") continue;
|
|
493
|
+
// The read failed mid-stream. Reconnect from your last seq_num.
|
|
494
|
+
if (eventType === "error") throw new Error(`Stream read failed: ${data}`);
|
|
492
495
|
if (data === "[DONE]") return;
|
|
493
496
|
|
|
494
497
|
if (eventType === "batch") {
|
|
@@ -625,7 +628,7 @@ The built-in clients handle this transparently.
|
|
|
625
628
|
|
|
626
629
|
### Resuming a stream
|
|
627
630
|
|
|
628
|
-
If the SSE connection drops, reconnect with the `Last-Event-ID` header set to the **last `record.seq_num` you successfully processed** (decoded from the batch body
|
|
631
|
+
If the SSE connection drops, or the server sends an `error` event, reconnect with the `Last-Event-ID` header set to the **last `record.seq_num` you successfully processed** (decoded from the batch body, not the SSE `id:` line, which is a comma-list internal to S2):
|
|
629
632
|
|
|
630
633
|
```
|
|
631
634
|
GET /realtime/v1/sessions/{sessionId}/out
|
|
@@ -4,7 +4,7 @@ sidebarTitle: "Redact chat content"
|
|
|
4
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
5
|
---
|
|
6
6
|
|
|
7
|
-
A chat agent's run trace records conversation content by default: the user's message
|
|
7
|
+
A chat agent's run trace records conversation content by default: the user's message, the `clientData` your frontend sends, and, through AI SDK telemetry, the prompts and responses of each model call. This page covers the three controls that change that, and what they don't cover.
|
|
8
8
|
|
|
9
9
|
## What the run trace records
|
|
10
10
|
|
|
@@ -13,7 +13,7 @@ A chat agent's run trace records conversation content by default: the user's mes
|
|
|
13
13
|
| `chat turn N` | The last user message (`chat.user_message`) and its first 80 characters as the span preview | `telemetry.recordUserMessage` |
|
|
14
14
|
| `chat turn N` | The raw `clientData` (`chat.client_data`) | `telemetry.recordClientData` |
|
|
15
15
|
| `pending message injected` | Messages sent mid-turn (`pending.messages`) | `telemetry.recordUserMessage` |
|
|
16
|
-
| AI SDK model call spans
|
|
16
|
+
| AI SDK model call spans (on by default with the `streamText` from `run`) | Prompt messages, response text, tool calls | `telemetry.recordUserMessage` for the default config, or `experimental_telemetry` on the model call |
|
|
17
17
|
| Any span | Everything above, plus your own attributes and span events | A span processor |
|
|
18
18
|
|
|
19
19
|
## Stop recording chat content
|
|
@@ -32,11 +32,11 @@ export const supportAgent = chat.agent({
|
|
|
32
32
|
});
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
The spans still appear in the trace with their timings and token usage. The turn spans have no preview text.
|
|
35
|
+
The spans still appear in the trace with their timings and token usage. The turn spans have no preview text. `recordUserMessage: false` also keeps prompts and responses out of the AI SDK spans that the `streamText` passed to `run()` turns on, with or without a prompt stored by `chat.prompt.set()`, and leaves a stored prompt's variables out of the span metadata, unless the call passes its own `experimental_telemetry`.
|
|
36
36
|
|
|
37
37
|
## Stop the AI SDK recording prompts and responses
|
|
38
38
|
|
|
39
|
-
AI SDK model call
|
|
39
|
+
The `streamText` passed to `run()` turns AI SDK telemetry on, so each model call and tool call is a span in the run trace (pass `experimental_telemetry: { isEnabled: false }` to turn the spans off). If you call `streamText` from `ai` yourself, pass `experimental_telemetry` to get them. Those spans include prompts and responses unless you turn that off with `recordInputs` and `recordOutputs`:
|
|
40
40
|
|
|
41
41
|
```ts /trigger/support-agent.ts
|
|
42
42
|
import { chat } from "@trigger.dev/sdk/ai";
|
|
@@ -50,7 +50,7 @@ export const supportAgent = chat.agent({
|
|
|
50
50
|
model: anthropic("claude-sonnet-4-5"),
|
|
51
51
|
messages,
|
|
52
52
|
abortSignal: signal,
|
|
53
|
-
// Replaces
|
|
53
|
+
// Replaces the default telemetry config (and chat.prompt.set()'s), so keep isEnabled on
|
|
54
54
|
experimental_telemetry: { isEnabled: true, recordInputs: false, recordOutputs: false },
|
|
55
55
|
}),
|
|
56
56
|
});
|
|
@@ -12,7 +12,7 @@ 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.
|
|
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.
|
|
16
16
|
|
|
17
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.
|
|
18
18
|
|
|
@@ -48,8 +48,8 @@ Options for `chat.agent()`.
|
|
|
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
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).
|
|
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).
|
|
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). |
|
|
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). |
|
|
53
53
|
| `onTurnStart` | `(event: TurnStartEvent) => Promise<void> \| void` | — | Fires every turn before `run()` |
|
|
54
54
|
| `onBeforeTurnComplete` | `(event: BeforeTurnCompleteEvent) => Promise<void> \| void` | — | Fires after response but before stream closes. Includes `writer`. |
|
|
55
55
|
| `onTurnComplete` | `(event: TurnCompleteEvent) => Promise<void> \| void` | — | Fires after each turn completes (stream closed) |
|
|
@@ -542,8 +542,8 @@ All methods available on the `chat` object from `@trigger.dev/sdk/ai`.
|
|
|
542
542
|
| Method | Description |
|
|
543
543
|
| ------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
|
|
544
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).
|
|
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).
|
|
545
|
+
| `chat.event(options)` | Declare an inbound webhook event descriptor an agent claims via `chat.agent({ events })`. See [session routing](/webhooks/session-routing). |
|
|
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). |
|
|
547
547
|
| `chat.createSession(payload, options)` | Create an async iterator for chat turns |
|
|
548
548
|
| `chat.pipe(source, options?)` | Pipe a stream to the frontend (from anywhere inside a task) |
|
|
549
549
|
| `chat.pipeAndCapture(source, options?)` | Pipe and capture the response; returns `{ message, status, error }` |
|
package/docs/apikeys.mdx
CHANGED
|
@@ -83,7 +83,7 @@ Access presets define what a key can do. On the Free and Hobby plans only the **
|
|
|
83
83
|
| **Task operator** | Trigger all or selected tasks and inspect or operate on their runs |
|
|
84
84
|
| **Observer** | Read runs, tasks, batches, logs, traces, queues, errors, and webhooks |
|
|
85
85
|
| **Operator** | Observe and operate on runs, queues, errors, and webhooks, and trigger tasks |
|
|
86
|
-
| **Webhooks only** | Read and write [webhooks](/webhooks/overview)
|
|
86
|
+
| **Webhooks only** | Read and write [webhooks](/webhooks/overview). Replaying deliveries that trigger tasks and creating webhook waiters require task or waitpoint scopes |
|
|
87
87
|
| **Waitpoints only** | Create, list, and retrieve [waitpoint tokens](/wait-for-token). No task or run access |
|
|
88
88
|
| **Deploy only** | Deploy versions, sync environment variables, and manage Preview branches |
|
|
89
89
|
| **Variables only** | Read and write environment variables in this environment |
|
|
@@ -192,6 +192,25 @@ The context object provides:
|
|
|
192
192
|
|
|
193
193
|
For more information about the context object, see the [Context documentation](/context).
|
|
194
194
|
|
|
195
|
+
#### Linking to a run in the dashboard
|
|
196
|
+
|
|
197
|
+
Trigger.dev sets `TRIGGER_DASHBOARD_URL` on every run, in development and deployed environments. Its value is the dashboard's address without a trailing slash, so it also points at your own instance when you self-host. Append `/runs/<runId>` to link to a run:
|
|
198
|
+
|
|
199
|
+
```ts
|
|
200
|
+
import { task } from "@trigger.dev/sdk";
|
|
201
|
+
|
|
202
|
+
export const reportTask = task({
|
|
203
|
+
id: "report-task",
|
|
204
|
+
run: async (payload, { ctx }) => {
|
|
205
|
+
const runUrl = `${process.env.TRIGGER_DASHBOARD_URL}/runs/${ctx.run.id}`;
|
|
206
|
+
|
|
207
|
+
console.log(`View this run: ${runUrl}`);
|
|
208
|
+
},
|
|
209
|
+
});
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
The `/runs/<runId>` link checks that the viewer is a member of the run's organization, then redirects to the full run page. If you set your own `TRIGGER_DASHBOARD_URL` environment variable on the project, your value is used instead.
|
|
213
|
+
|
|
195
214
|
### Sync env vars from another service
|
|
196
215
|
|
|
197
216
|
There are two ways to pull secrets from another service into Trigger.dev: a native **Secret Sync** (currently [Infisical](https://infisical.com)), or the `syncEnvVars` build extension for any other service.
|
package/docs/mcp-tools.mdx
CHANGED
|
@@ -4,8 +4,6 @@ sidebarTitle: "Tools"
|
|
|
4
4
|
description: "Learn about how to use the tools available in the Trigger.dev MCP Server"
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
import WebhooksBetaNote from "/snippets/webhooks-beta-note.mdx";
|
|
8
|
-
|
|
9
7
|
## Documentation and Search Tools
|
|
10
8
|
|
|
11
9
|
### search_docs
|
|
@@ -352,8 +350,6 @@ Append one record to a named side channel's `in` stream. Sends control input to
|
|
|
352
350
|
|
|
353
351
|
## Webhook Tools
|
|
354
352
|
|
|
355
|
-
<WebhooksBetaNote />
|
|
356
|
-
|
|
357
353
|
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).
|
|
358
354
|
|
|
359
355
|
### list_webhook_endpoints
|
|
@@ -4,10 +4,6 @@ description: "Point Slack (or any chat surface) at an agent: messages become tur
|
|
|
4
4
|
sidebarTitle: "Channels"
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
import WebhooksBetaBanner from "/snippets/webhooks-beta-banner.mdx";
|
|
8
|
-
|
|
9
|
-
<WebhooksBetaBanner />
|
|
10
|
-
|
|
11
7
|
A [session route](/webhooks/session-routing) delivers a verified event to an agent as an [action](/ai-chat/actions): the agent reacts, and the response is a side effect. A **channel** is the other half: the webhook IS the chat surface. Inbound messages become **turns** (the normal `run()` loop), and the agent's reply is posted **back** to the surface. A Slack thread becomes a real conversation with the agent, exactly like the browser chat, just a different frontend.
|
|
12
8
|
|
|
13
9
|
List channels on a [`chat.agent`](/ai-chat/overview) alongside (or instead of) `events`:
|
|
@@ -15,14 +11,21 @@ List channels on a [`chat.agent`](/ai-chat/overview) alongside (or instead of) `
|
|
|
15
11
|
```ts
|
|
16
12
|
import { webhooks } from "@trigger.dev/sdk";
|
|
17
13
|
import { chat } from "@trigger.dev/sdk/ai";
|
|
18
|
-
import { slack, webhookSource } from "@trigger.dev/slack";
|
|
14
|
+
import { appMentions, slack, webhookSource } from "@trigger.dev/slack";
|
|
19
15
|
import { anthropic } from "@ai-sdk/anthropic";
|
|
20
16
|
|
|
21
17
|
const slackEvents = webhooks.endpoint.define({ id: "slack", source: webhookSource() });
|
|
22
18
|
|
|
23
19
|
export const supportAgent = chat.agent({
|
|
24
20
|
id: "support-agent",
|
|
25
|
-
channels: [
|
|
21
|
+
channels: [
|
|
22
|
+
slack({
|
|
23
|
+
id: "support-slack",
|
|
24
|
+
endpoint: slackEvents,
|
|
25
|
+
token: process.env.SLACK_BOT_TOKEN!,
|
|
26
|
+
startOn: appMentions(),
|
|
27
|
+
}),
|
|
28
|
+
],
|
|
26
29
|
run: async ({ messages, streamText }) =>
|
|
27
30
|
streamText({ model: anthropic("claude-sonnet-4-5"), messages }),
|
|
28
31
|
});
|
|
@@ -74,6 +77,25 @@ An event that `inbound` maps to an empty message (no text, and no file or data p
|
|
|
74
77
|
|
|
75
78
|
List the connector in `chat.agent({ channels: [mySurface] })`, which subscribes the agent to the endpoint with the id `agentId:connectorId`. Other subscribers on the endpoint keep receiving its deliveries.
|
|
76
79
|
|
|
80
|
+
## When a turn fails
|
|
81
|
+
|
|
82
|
+
When a turn fails (the model or provider returns an error, or the turn throws), the channel shows a short line instead of the error: "Something went wrong answering this. Try again." by default, or the connector's `errorMessage`. If the reply had partly streamed, the line goes after that text. The error is logged on the run, and `outbound` receives it as `reply.error`, so you can render a failure differently.
|
|
83
|
+
|
|
84
|
+
`errorMessage` is a fixed string, or a function that builds the line from the failure. It receives the `error`, the `partialText` streamed before it failed, the triggering `event` (undefined on a turn the channel didn't start), the `runId`, the `chatId`, and the `defaultMessage`. Return nothing, or throw, to fall back to the default line.
|
|
85
|
+
|
|
86
|
+
```ts
|
|
87
|
+
slack({
|
|
88
|
+
id: "slack",
|
|
89
|
+
endpoint: slackEvents,
|
|
90
|
+
token: process.env.SLACK_BOT_TOKEN!,
|
|
91
|
+
startOn: appMentions(),
|
|
92
|
+
errorMessage: ({ error, runId }) =>
|
|
93
|
+
error.message.includes("rate limit")
|
|
94
|
+
? "I'm getting a lot of requests right now. Try again in a minute."
|
|
95
|
+
: `Something went wrong answering this. Try again, or share ref ${runId} with support.`,
|
|
96
|
+
});
|
|
97
|
+
```
|
|
98
|
+
|
|
77
99
|
## Stopping a turn from the channel
|
|
78
100
|
|
|
79
101
|
A connector can map an event to a control with `onControl`. Returning `{ kind: "stop" }` while a turn is running aborts it through the run's `stopSignal`, exactly like the browser's stop button: the partial reply posts with `stopped: true` and the event is consumed instead of running as a turn. `linear()` and `slack()` map their stop buttons this way; a custom connector might map a `/stop` command:
|
|
@@ -92,7 +114,7 @@ When nothing is running, the event is handled by `inbound` as an ordinary messag
|
|
|
92
114
|
Two more hooks let a connector mirror the session into a surface that has its own notion of an agent, the way `slack()` does:
|
|
93
115
|
|
|
94
116
|
- `lifecycle(state, ctx)` reports `working` when a turn starts (and every 50 minutes while it runs), `waiting` when it pauses on a human decision, `idle` when it ends for any reason, and `closed` on `chat.close()`. `ctx.firstTurn` and `ctx.prompt` are there to title a new conversation. Calls are serialized, so an older report never lands after a newer one.
|
|
95
|
-
- `stream(ctx)`, with `delivery: "stream"`, returns a per-turn transport `{ text(delta), progress?(event), end(outcome) }`. The runtime feeds it the reply's markdown deltas and tool progress, then calls `end({ stopped, pending, errorText? })` once. Resolve `{ delivered: true }` when the reply reached the surface, and the runtime does not post it again. Call `ctx.opened(ref)` once the surface has created the stream message: the ref is saved with the session while the turn runs, and if the worker dies mid-stream the next one calls the connector's `endInterruptedStream(ref, ctx)` before it answers, so the old stream does not look like it is still being written.
|
|
117
|
+
- `stream(ctx)`, with `delivery: "stream"`, returns a per-turn transport `{ text(delta), progress?(event), end(outcome) }`. The runtime feeds it the reply's markdown deltas and tool progress, then calls `end({ stopped, pending, errorText? })` once, with the connector's error line as `errorText` when the turn failed. Resolve `{ delivered: true }` when the reply reached the surface, and the runtime does not post it again. Call `ctx.opened(ref)` once the surface has created the stream message: the ref is saved with the session while the turn runs, and if the worker dies mid-stream the next one calls the connector's `endInterruptedStream(ref, ctx)` before it answers, so the old stream does not look like it is still being written.
|
|
96
118
|
|
|
97
119
|
## Bound sessions
|
|
98
120
|
|
|
@@ -4,10 +4,6 @@ description: "Register an endpoint's URL and signing secret with the provider, b
|
|
|
4
4
|
sidebarTitle: "Connect a provider"
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
import WebhooksBetaBanner from "/snippets/webhooks-beta-banner.mdx";
|
|
8
|
-
|
|
9
|
-
<WebhooksBetaBanner />
|
|
10
|
-
|
|
11
7
|
Connect a provider to an [endpoint](/webhooks/overview) by registering the endpoint's URL with the provider and giving Trigger.dev the credential that verifies its requests.
|
|
12
8
|
|
|
13
9
|
Deploy the project or start `trigger dev` first. Once the CLI finds the endpoint, it appears on the environment's **Webhooks** page. The **Signing secret** column shows **Ready** when the endpoint can verify deliveries and **Needs secret** until then. Every delivery is rejected while an endpoint needs its secret.
|
|
@@ -22,8 +18,8 @@ The prompt tells the agent to use the Trigger.dev MCP server (`npx trigger.dev@l
|
|
|
22
18
|
| --- | --- |
|
|
23
19
|
| `list_webhook_endpoints` | Lists the environment's endpoints, with their URL and whether a secret is set. |
|
|
24
20
|
| `get_webhook_endpoint_details` | Reads one endpoint: URL, subscribers and their filters, secret state, and the setup prompt. |
|
|
25
|
-
| `generate_webhook_secret` | Generates a signing secret and returns it once, for providers where you choose the secret. |
|
|
26
|
-
| `set_webhook_secret` | Stores a secret the provider issued. |
|
|
21
|
+
| `generate_webhook_secret` | Generates a signing secret and returns it once, for providers where you choose the secret. Optionally keeps accepting the old secret (`previousSecretTtlSeconds`). |
|
|
22
|
+
| `set_webhook_secret` | Stores a secret the provider issued. Optionally keeps accepting the old secret (`previousSecretTtlSeconds`). |
|
|
27
23
|
|
|
28
24
|
Without the MCP server, the same operations are available on the REST API with the environment's secret key:
|
|
29
25
|
|
|
@@ -78,7 +74,18 @@ The verify token answers the URL check. The signing secret verifies event delive
|
|
|
78
74
|
|
|
79
75
|
Choose **Rotate signing secret** to replace a provider-supplied secret. For a secret you generate, choose **Regenerate secret**, copy the new value, and update the provider's configuration. Use **Rotate public key** when replacing an asymmetric provider's key.
|
|
80
76
|
|
|
77
|
+
Both dialogs ask how long to keep accepting the old secret: **Stop immediately**, 1 hour, 24 hours (the default) or 7 days. Until then, deliveries signed with either secret verify, so you can update the provider without failing any. Choose **Stop immediately** if the old secret leaked.
|
|
78
|
+
|
|
79
|
+
Through the MCP tools or the REST API, pass `previousSecretTtlSeconds` (at most 604800, 7 days). The response's `previousSecretExpiresAt` says when the old secret stops working. Without it, the old secret stops working straight away:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
curl -X POST "https://api.trigger.dev/api/v1/webhooks/endpoints/github/rotate-secret" \
|
|
83
|
+
-H "Authorization: Bearer $TRIGGER_SECRET_KEY" \
|
|
84
|
+
-H "Content-Type: application/json" \
|
|
85
|
+
-d '{"previousSecretTtlSeconds": 3600}'
|
|
86
|
+
```
|
|
87
|
+
|
|
81
88
|
<Warning>
|
|
82
89
|
Trigger.dev stores credentials encrypted and doesn't display saved values. Copy a generated secret
|
|
83
|
-
before closing the dialog.
|
|
90
|
+
before closing the dialog.
|
|
84
91
|
</Warning>
|
|
@@ -4,10 +4,6 @@ description: "Inspect webhook payloads, where each delivery went, and the runs i
|
|
|
4
4
|
sidebarTitle: "Deliveries and endpoints"
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
import WebhooksBetaBanner from "/snippets/webhooks-beta-banner.mdx";
|
|
8
|
-
|
|
9
|
-
<WebhooksBetaBanner />
|
|
10
|
-
|
|
11
7
|
**A delivery records a verified webhook event and what happened to it at each subscriber.** Find deliveries on an endpoint's **Deliveries** tab. A run that a delivery triggered links back to it, and to its endpoint, from the run's **Detail** tab.
|
|
12
8
|
|
|
13
9
|
## Endpoints
|
|
@@ -85,7 +81,14 @@ Trigger.dev uses the endpoint and idempotency key to deduplicate incoming events
|
|
|
85
81
|
|
|
86
82
|
A retry after the delivery window expires can create another delivery record. If the task-run idempotency window is still active, routing returns the existing run instead of starting another one.
|
|
87
83
|
|
|
88
|
-
When the source maps a provider event ID, that ID becomes the key
|
|
84
|
+
When the source maps a provider event ID, that ID becomes the key, so the provider's own retries of an event are recognised as duplicates:
|
|
85
|
+
|
|
86
|
+
| Key | Sources |
|
|
87
|
+
| --- | --- |
|
|
88
|
+
| A header | GitHub (`X-GitHub-Delivery`), Svix and Autumn (`svix-id`), Standard Webhooks, Loops and Granola (`webhook-id`), Linear (`Linear-Delivery`), PagerDuty (`X-Webhook-Id`), Jira (`X-Atlassian-Webhook-Identifier`), Zendesk (`X-Zendesk-Webhook-Invocation-Id`), Attio (`Idempotency-Key`), Shopify (`X-Shopify-Webhook-Id`), Hookdeck (`X-Hookdeck-Eventid`, or `<prefix>-eventid` with a custom header prefix) |
|
|
89
|
+
| A body field | Stripe, Notion, Vercel, Intercom, WorkOS, Metronome, Mux, Langfuse and Plain (`id`), Square, Slack and Typeform (`event_id`), Firecrawl (`webhookId`) |
|
|
90
|
+
|
|
91
|
+
The other named sources (Zoom, Calendly, Sentry, DocuSign, ElevenLabs, Vapi, Retell, Tailscale, Infisical, PlanetScale, Supabase, Discord) use the fallback below.
|
|
89
92
|
|
|
90
93
|
If the source doesn't map an event ID, the key is derived from the raw body, timestamp, and signature. A retry with a different timestamp or signature can therefore produce a different key. For a [custom source](/webhooks/sources#custom-providers), set `idempotencyField` to a stable event identifier when the provider supplies one.
|
|
91
94
|
|
|
@@ -4,10 +4,6 @@ description: "Choose which verified webhook events reach each subscriber, by pay
|
|
|
4
4
|
sidebarTitle: "Filters"
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
import WebhooksBetaBanner from "/snippets/webhooks-beta-banner.mdx";
|
|
8
|
-
|
|
9
|
-
<WebhooksBetaBanner />
|
|
10
|
-
|
|
11
7
|
**A filter selects which verified deliveries reach a subscriber.** Each subscriber on an [endpoint](/webhooks/overview) has its own filter, so one delivery can start one task and skip another. A delivery no subscriber takes is recorded with status `FILTERED`, so you can inspect it in the dashboard.
|
|
12
8
|
|
|
13
9
|
## Add a filter
|
|
@@ -98,6 +94,8 @@ Paths must have non-empty segments. `event.data.amount` is valid; `event.`, `eve
|
|
|
98
94
|
|
|
99
95
|
Values are strings in single quotes (`'created'`), numbers (`10000`), booleans (`true`), or `null`. Use a list of these values with `in` and `not in`.
|
|
100
96
|
|
|
97
|
+
A `null` value checks presence. `event.issue.pull_request != null` matches events that have the field, and `== null` matches events where it is missing or `null`. It works on any field, including fields your event type marks as required, because a missing field compares equal to `null`.
|
|
98
|
+
|
|
101
99
|
### Comparing two fields
|
|
102
100
|
|
|
103
101
|
Equality and comparison operators also accept a field path on the right-hand side:
|
|
@@ -114,6 +112,12 @@ event.billing.country == event.shipping.country
|
|
|
114
112
|
event.items any ( quantity > 0 )
|
|
115
113
|
```
|
|
116
114
|
|
|
115
|
+
When the payload itself is an array, as with providers that batch several events into one request (Tailscale, for example), quantify over `event`:
|
|
116
|
+
|
|
117
|
+
```text Filter expression
|
|
118
|
+
event any ( type == 'nodeCreated' )
|
|
119
|
+
```
|
|
120
|
+
|
|
117
121
|
### Spacing
|
|
118
122
|
|
|
119
123
|
Separate paths, operators, and values with one space. Parentheses may touch what they enclose, as in `(event.amount > 0)` and `any (quantity > 0)`. Lists and quoted strings may contain spaces (`['opened', 'closed']`, `'Fix the build'`). These forms work with both the TypeScript validator and the deployment parser.
|
|
@@ -4,10 +4,6 @@ sidebarTitle: "Human-in-the-loop"
|
|
|
4
4
|
description: "Pause an agent mid-turn to get a human decision from the channel (Slack approve/deny), then resume with the answer."
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
import WebhooksBetaBanner from "/snippets/webhooks-beta-banner.mdx";
|
|
8
|
-
|
|
9
|
-
<WebhooksBetaBanner />
|
|
10
|
-
|
|
11
7
|
**An agent on a [channel](/webhooks/channels) can pause a turn to get a human decision, then resume once someone answers in the thread.** It posts controls into the conversation and picks up where it left off once someone clicks, with the decision merged into the turn. This is the channel counterpart of browser [human-in-the-loop](/ai-chat/patterns/human-in-the-loop): the same no-`execute` tool, but the controls live in Slack (or your own surface) instead of a React component. The [`slack()`](/webhooks/slack) connector ships Approve and Deny buttons out of the box.
|
|
12
8
|
|
|
13
9
|
## How it works
|
|
@@ -41,7 +37,7 @@ Out of the box, `slack()` posts Approve and Deny buttons for any pending no-`exe
|
|
|
41
37
|
```ts trigger/support-agent.ts
|
|
42
38
|
import { webhooks } from "@trigger.dev/sdk";
|
|
43
39
|
import { chat } from "@trigger.dev/sdk/ai";
|
|
44
|
-
import { slack, webhookSource } from "@trigger.dev/slack";
|
|
40
|
+
import { appMentions, slack, webhookSource } from "@trigger.dev/slack";
|
|
45
41
|
import { tool } from "ai";
|
|
46
42
|
import { anthropic } from "@ai-sdk/anthropic";
|
|
47
43
|
import { z } from "zod";
|
|
@@ -60,7 +56,14 @@ const requestApproval = tool({
|
|
|
60
56
|
|
|
61
57
|
export const supportAgent = chat.agent({
|
|
62
58
|
id: "support-agent",
|
|
63
|
-
channels: [
|
|
59
|
+
channels: [
|
|
60
|
+
slack({
|
|
61
|
+
id: "support-slack",
|
|
62
|
+
endpoint: slackEvents,
|
|
63
|
+
token: process.env.SLACK_BOT_TOKEN!,
|
|
64
|
+
startOn: appMentions(),
|
|
65
|
+
}),
|
|
66
|
+
],
|
|
64
67
|
tools: { requestApproval },
|
|
65
68
|
run: async ({ messages, tools, streamText }) =>
|
|
66
69
|
streamText({
|
package/docs/webhooks/linear.mdx
CHANGED
|
@@ -4,10 +4,6 @@ description: "Turn a chat.agent into a Linear agent: assign it an issue or @ment
|
|
|
4
4
|
sidebarTitle: "Linear agents"
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
import WebhooksBetaBanner from "/snippets/webhooks-beta-banner.mdx";
|
|
8
|
-
|
|
9
|
-
<WebhooksBetaBanner />
|
|
10
|
-
|
|
11
7
|
Linear opens an **agent session** when someone @mentions your app in an issue or delegates (assigns) an issue to it. `linear()` from `@trigger.dev/linear` is a [channel](/webhooks/channels) connector for those sessions: each one becomes a durable Trigger.dev [session](/ai-chat/sessions), the user's prompt runs as a turn, and the agent's work shows up in Linear as thoughts, actions, a plan, an approval card when it needs a decision, and a response when it is done.
|
|
12
8
|
|
|
13
9
|
```ts
|
|
@@ -67,7 +63,7 @@ linear({ id: "linear", endpoint: linearEvents, token, context: { guidance: false
|
|
|
67
63
|
| Turn starts | An ephemeral `thought` ("Looking into this...") |
|
|
68
64
|
| A tool is called | An ephemeral `action` with the tool name and input, then the same action with its `result` |
|
|
69
65
|
| The reply is ready | A `response` with the reply as markdown |
|
|
70
|
-
| The turn fails | An `error` |
|
|
66
|
+
| The turn fails | An `error` saying "Something went wrong answering this. Try again." (`errorMessage` changes it) |
|
|
71
67
|
| A tool needs a human decision | An `elicitation` with Approve and Deny options, or the tool's own options from `interactions` (see [Approvals and choices](#approvals-and-choices)) |
|
|
72
68
|
| The user picks an option | A `thought` recording the decision ("Approved by Jane.", "Jane chose "High".") |
|
|
73
69
|
| A prompt arrives while the agent works | A `thought` ("Got it, I'll take that into account.") as soon as it arrives (see [Prompts sent while the agent is working](#prompts-sent-while-the-agent-is-working)) |
|
|
@@ -176,6 +172,7 @@ The first Linear turn binds the session to the agent session ([bound sessions](/
|
|
|
176
172
|
| `approvals` | `{ [toolName]: (input, call) => { title?, body } }` | Custom approval card body per tool. Default lays the tool input out as markdown. |
|
|
177
173
|
| `interactions` | `{ [toolName]: (call) => { title?, body, options } }` | A tool's own select card; the chosen option resolves the tool to `{ selected }`. |
|
|
178
174
|
| `receivedThought` | `string`, function or `null` | Thought posted as soon as a prompt arrives while the agent is working. Default "Got it, I'll take that into account.", null for none. |
|
|
175
|
+
| `errorMessage` | `string \| (ctx) => string` | The error activity's text when a turn fails, fixed or built from the failure ([details](/webhooks/channels#when-a-turn-fails)). Default "Something went wrong answering this. Try again." |
|
|
179
176
|
| `ack` | message, `null`, or function | The first thought. Pass `null` to post nothing before the response. |
|
|
180
177
|
| `inbound` / `outbound` | functions | Map the event to the turn, and the reply to an activity. |
|
|
181
178
|
| `delivery` | `"final"` or `"stream"` | `"final"` (default) posts the response when the turn ends. `"stream"` also posts ephemeral thoughts as the reply streams. |
|