Skip to content

Commit bdfb430

Browse files
authored
Merge branch 'main' into docs/ttl-task-config-levels
2 parents 05058c5 + 8244ac6 commit bdfb430

File tree

339 files changed

+47940
-1178
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

339 files changed

+47940
-1178
lines changed

.changeset/ai-prompt-management.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@trigger.dev/sdk": patch
3+
---
4+
5+
Define and manage AI prompts with `prompts.define()`. Create typesafe prompt templates with variables, resolve them at runtime, and manage versions and overrides from the dashboard without redeploying.

.changeset/chilly-tips-explode.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"trigger.dev": patch
3+
---
4+
5+
Add platform notifications support to the CLI. The `trigger dev` and `trigger login` commands now fetch and display platform notifications (info, warn, error, success) from the server. Includes discovery-based filtering to conditionally show notifications based on project file patterns, color markup rendering for styled terminal output, and a non-blocking display flow with a spinner fallback for slow fetches. Use `--skip-platform-notifications` flag with `trigger dev` to disable the notification check.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"trigger.dev": patch
3+
---
4+
5+
Fix dev CLI leaking build directories on rebuild, causing disk space accumulation. Deprecated workers are now pruned (capped at 2 retained) when no active runs reference them. The watchdog process also cleans up `.trigger/tmp/` when the dev CLI is killed ungracefully (e.g. SIGKILL from pnpm).
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@trigger.dev/core": patch
3+
---
4+
5+
Fix `list_deploys` MCP tool failing when deployments have null `runtime` or `runtimeVersion` fields.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@trigger.dev/core": patch
3+
---
4+
5+
Propagate run tags to span attributes so they can be extracted server-side for LLM cost attribution metadata.

.changeset/mcp-get-span-details.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
"@trigger.dev/core": patch
3+
"trigger.dev": patch
4+
---
5+
6+
Add `get_span_details` MCP tool for inspecting individual spans within a run trace.
7+
8+
- New `get_span_details` tool returns full span attributes, timing, events, and AI enrichment (model, tokens, cost, speed)
9+
- Span IDs now shown in `get_run_details` trace output for easy discovery
10+
- New API endpoint `GET /api/v1/runs/:runId/spans/:spanId`
11+
- New `retrieveSpan()` method on the API client

.changeset/mcp-query-tools.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
"@trigger.dev/core": patch
3+
"trigger.dev": patch
4+
---
5+
6+
MCP server improvements: new tools, bug fixes, and new flags.
7+
8+
**New tools:**
9+
- `get_query_schema` — discover available TRQL tables and columns
10+
- `query` — execute TRQL queries against your data
11+
- `list_dashboards` — list built-in dashboards and their widgets
12+
- `run_dashboard_query` — execute a single dashboard widget query
13+
- `whoami` — show current profile, user, and API URL
14+
- `list_profiles` — list all configured CLI profiles
15+
- `switch_profile` — switch active profile for the MCP session
16+
- `start_dev_server` — start `trigger dev` in the background and stream output
17+
- `stop_dev_server` — stop the running dev server
18+
- `dev_server_status` — check dev server status and view recent logs
19+
20+
**New API endpoints:**
21+
- `GET /api/v1/query/schema` — query table schema discovery
22+
- `GET /api/v1/query/dashboards` — list built-in dashboards
23+
24+
**New features:**
25+
- `--readonly` flag hides write tools (`deploy`, `trigger_task`, `cancel_run`) so the AI cannot make changes
26+
- `read:query` JWT scope for query endpoint authorization
27+
- `get_run_details` trace output is now paginated with cursor support
28+
- MCP tool annotations (`readOnlyHint`, `destructiveHint`) for all tools
29+
30+
**Bug fixes:**
31+
- Fixed `search_docs` tool failing due to renamed upstream Mintlify tool (`SearchTriggerDev``search_trigger_dev`)
32+
- Fixed `list_deploys` failing when deployments have null `runtime`/`runtimeVersion` fields (#3139)
33+
- Fixed `list_preview_branches` crashing due to incorrect response shape access
34+
- Fixed `metrics` table column documented as `value` instead of `metric_value` in query docs
35+
- Fixed dev CLI leaking build directories on rebuild — deprecated workers now clean up their build dirs when their last run completes
36+
37+
**Context optimizations:**
38+
- `get_query_schema` now requires a table name and returns only one table's schema (was returning all tables)
39+
- `get_current_worker` no longer inlines payload schemas; use new `get_task_schema` tool instead
40+
- Query results formatted as text tables instead of JSON (~50% fewer tokens)
41+
- `cancel_run`, `list_deploys`, `list_preview_branches` formatted as text instead of raw JSON
42+
- Schema and dashboard API responses cached to avoid redundant fetches

.changeset/tame-oranges-change.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
"@trigger.dev/redis-worker": patch
3+
"@trigger.dev/sdk": patch
4+
"trigger.dev": patch
5+
"@trigger.dev/core": patch
6+
---
7+
8+
Adapted the CLI API client to propagate the trigger source via http headers.

.cursor/rules/writing-tasks.mdc

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ alwaysApply: false
1414

1515
## Essential requirements when generating task code
1616

17-
1. You MUST use `@trigger.dev/sdk/v3`
17+
1. You MUST import from `@trigger.dev/sdk` (NEVER `@trigger.dev/sdk/v3`)
1818
2. You MUST NEVER use `client.defineJob`
1919
3. YOU MUST `export` every task, including subtasks
2020
4. If you are able to generate an example payload for a task, do so.
@@ -53,7 +53,7 @@ Instead, you MUST ALWAYS generate ONLY this pattern:
5353
```ts
5454
// ✅ ALWAYS GENERATE THIS EXACT PATTERN
5555

56-
import { task } from "@trigger.dev/sdk/v3";
56+
import { task } from "@trigger.dev/sdk";
5757

5858
//1. You need to export each task, even if it's a subtask
5959
export const helloWorld = task({
@@ -71,7 +71,7 @@ export const helloWorld = task({
7171
A task is a function that can run for a long time with resilience to failure:
7272

7373
```ts
74-
import { task } from "@trigger.dev/sdk/v3";
74+
import { task } from "@trigger.dev/sdk";
7575

7676
export const helloWorld = task({
7777
id: "hello-world",
@@ -271,7 +271,7 @@ Global lifecycle hooks can also be defined in `trigger.config.ts` to apply to al
271271
## Correct Schedules task (cron) implementations
272272

273273
```ts
274-
import { schedules } from "@trigger.dev/sdk/v3";
274+
import { schedules } from "@trigger.dev/sdk";
275275

276276
export const firstScheduledTask = schedules.task({
277277
id: "first-scheduled-task",
@@ -312,7 +312,7 @@ export const firstScheduledTask = schedules.task({
312312
### Attach a Declarative schedule
313313

314314
```ts
315-
import { schedules } from "@trigger.dev/sdk/v3";
315+
import { schedules } from "@trigger.dev/sdk";
316316

317317
// Sepcify a cron pattern (UTC)
318318
export const firstScheduledTask = schedules.task({
@@ -326,7 +326,7 @@ export const firstScheduledTask = schedules.task({
326326
```
327327

328328
```ts
329-
import { schedules } from "@trigger.dev/sdk/v3";
329+
import { schedules } from "@trigger.dev/sdk";
330330

331331
// Specify a specific timezone like this:
332332
export const secondScheduledTask = schedules.task({
@@ -375,7 +375,7 @@ const createdSchedule = await schedules.create({
375375
Schema tasks validate payloads against a schema before execution:
376376

377377
```ts
378-
import { schemaTask } from "@trigger.dev/sdk/v3";
378+
import { schemaTask } from "@trigger.dev/sdk";
379379
import { z } from "zod";
380380

381381
const myTask = schemaTask({
@@ -400,7 +400,7 @@ When you trigger a task from your backend code, you need to set the `TRIGGER_SEC
400400
Triggers a single run of a task with specified payload and options without importing the task. Use type-only imports for full type checking.
401401

402402
```ts
403-
import { tasks } from "@trigger.dev/sdk/v3";
403+
import { tasks } from "@trigger.dev/sdk";
404404
import type { emailSequence } from "~/trigger/emails";
405405

406406
export async function POST(request: Request) {
@@ -418,7 +418,7 @@ export async function POST(request: Request) {
418418
Triggers multiple runs of a single task with different payloads without importing the task.
419419

420420
```ts
421-
import { tasks } from "@trigger.dev/sdk/v3";
421+
import { tasks } from "@trigger.dev/sdk";
422422
import type { emailSequence } from "~/trigger/emails";
423423

424424
export async function POST(request: Request) {
@@ -436,7 +436,7 @@ export async function POST(request: Request) {
436436
Triggers multiple runs of different tasks at once, useful when you need to execute multiple tasks simultaneously.
437437

438438
```ts
439-
import { batch } from "@trigger.dev/sdk/v3";
439+
import { batch } from "@trigger.dev/sdk";
440440
import type { myTask1, myTask2 } from "~/trigger/myTasks";
441441

442442
export async function POST(request: Request) {
@@ -621,7 +621,7 @@ const handle = await myTask.trigger(
621621
Access metadata inside a run:
622622

623623
```ts
624-
import { task, metadata } from "@trigger.dev/sdk/v3";
624+
import { task, metadata } from "@trigger.dev/sdk";
625625

626626
export const myTask = task({
627627
id: "my-task",
@@ -713,7 +713,7 @@ Trigger.dev Realtime enables subscribing to runs for real-time updates on run st
713713
Subscribe to a run after triggering a task:
714714

715715
```ts
716-
import { runs, tasks } from "@trigger.dev/sdk/v3";
716+
import { runs, tasks } from "@trigger.dev/sdk";
717717

718718
async function myBackend() {
719719
const handle = await tasks.trigger("my-task", { some: "data" });
@@ -735,7 +735,7 @@ async function myBackend() {
735735
You can infer types of run's payload and output by passing the task type:
736736

737737
```ts
738-
import { runs } from "@trigger.dev/sdk/v3";
738+
import { runs } from "@trigger.dev/sdk";
739739
import type { myTask } from "./trigger/my-task";
740740

741741
for await (const run of runs.subscribeToRun<typeof myTask>(handle.id)) {
@@ -752,7 +752,7 @@ for await (const run of runs.subscribeToRun<typeof myTask>(handle.id)) {
752752
Stream data in realtime from inside your tasks using the metadata system:
753753

754754
```ts
755-
import { task, metadata } from "@trigger.dev/sdk/v3";
755+
import { task, metadata } from "@trigger.dev/sdk";
756756
import OpenAI from "openai";
757757

758758
export type STREAMS = {
@@ -947,7 +947,7 @@ For most use cases, Realtime hooks are preferred over SWR hooks with polling due
947947
For client-side usage, generate a public access token with appropriate scopes:
948948

949949
```ts
950-
import { auth } from "@trigger.dev/sdk/v3";
950+
import { auth } from "@trigger.dev/sdk";
951951

952952
const publicToken = await auth.createPublicToken({
953953
scopes: {
@@ -967,7 +967,7 @@ Idempotency ensures that an operation produces the same result when called multi
967967
Provide an `idempotencyKey` when triggering a task to ensure it runs only once with that key:
968968

969969
```ts
970-
import { idempotencyKeys, task } from "@trigger.dev/sdk/v3";
970+
import { idempotencyKeys, task } from "@trigger.dev/sdk";
971971

972972
export const myTask = task({
973973
id: "my-task",
@@ -1058,7 +1058,7 @@ function hash(payload: any): string {
10581058

10591059
```ts
10601060
// onFailure executes after all retries are exhausted; use for notifications, logging, or side effects on final failure:
1061-
import { task, logger } from "@trigger.dev/sdk/v3";
1061+
import { task, logger } from "@trigger.dev/sdk";
10621062

10631063
export const loggingExample = task({
10641064
id: "logging-example",
@@ -1078,7 +1078,7 @@ export const loggingExample = task({
10781078
The `trigger.config.ts` file configures your Trigger.dev project, specifying task locations, retry settings, telemetry, and build options.
10791079

10801080
```ts
1081-
import { defineConfig } from "@trigger.dev/sdk/v3";
1081+
import { defineConfig } from "@trigger.dev/sdk";
10821082

10831083
export default defineConfig({
10841084
project: "<project ref>",
@@ -1226,7 +1226,7 @@ await myTask.trigger({ name: "Alice", age: 30 });
12261226

12271227
Before generating any code, you MUST verify:
12281228

1229-
1. Are you importing from `@trigger.dev/sdk/v3`? If not, STOP and FIX.
1229+
1. Are you importing from `@trigger.dev/sdk` (NOT `@trigger.dev/sdk/v3`)? If not, STOP and FIX.
12301230
2. Have you exported every task? If not, STOP and FIX.
12311231
3. Have you generated any DEPRECATED code patterns? If yes, STOP and FIX.
12321232

.github/VOUCHED.td

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,8 @@ samejr
1313
isshaddad
1414
# Outside contributors
1515
gautamsi
16-
capaj
16+
capaj
17+
chengzp
18+
bharathkumar39293
19+
bhekanik
20+
jrossi

0 commit comments

Comments
 (0)