diff --git a/.changeset/pre.json b/.changeset/pre.json index 7c0d538dc0c..7d404f5e8d7 100644 --- a/.changeset/pre.json +++ b/.changeset/pre.json @@ -29,9 +29,12 @@ "cap-idempotency-key-length", "chat-agent-hardening", "chat-agent-on-boot-hook", + "chat-agent-preview-branch", "chat-agent-tools", "chat-agent", "chat-boot-cursor", + "chat-head-start-prepare-messages", + "chat-headstart-api-client", "chat-headstart-custom-backends", "chat-headstart-hydrate", "chat-headstart-reasoning", @@ -40,6 +43,7 @@ "chat-session-attributes", "chat-slim-wire-merge", "chat-start-session-action-typed-client-data", + "chat-start-session-api-client", "chat-system-prompt-caching", "chat-transport-recreate-missing-session", "cli-deploy-skip-rewrite-timestamp", @@ -49,14 +53,18 @@ "create-session-stop-continuation", "custom-agent-loop-fixes", "dequeue-latency-histogram", + "dev-branches", "duplicate-task-ids", "env-vars-tracing-forceflush-typecheck", "envvars-import-is-secret", + "errors-api-schemas", + "httpserver-skip-body-parsing", "large-trigger-payload-offload", "locals-key-dual-package-fix", "mcp-agent-chat-sessions", "mcp-list-runs-region", "mcp-trigger-task-no-default-wait", + "mint-token-command", "mock-chat-agent-test-harness", "mollifier-buffer-pipeline-list-entries", "mollifier-configurable-constants", @@ -69,6 +77,7 @@ "resource-catalog-runtime-registration", "retry-middleware-errors", "retry-sigsegv", + "runner-send-debug-logs-gate", "runs-list-region-filter", "s2-batch-transform-linger-fix", "sessions-primitive", diff --git a/.server-changes/billing-limits.md b/.server-changes/billing-limits.md deleted file mode 100644 index ba40d03928b..00000000000 --- a/.server-changes/billing-limits.md +++ /dev/null @@ -1,24 +0,0 @@ ---- -area: webapp -type: feature ---- - -Add billing limits. Customers set a spend cap; when usage crosses it, billable -environments pause for a grace period, new triggers are rejected once it ends, -and a recovery flow resumes or cancels the queued backlog. Reconciliation keeps -the webapp converged to billing's state. - -## Manual pause during billing enforcement - -While `pauseSource=BILLING_LIMIT`, manual resume is rejected and manual pause is -a silent no-op (`PauseEnvironmentService` returns success with state `paused`). -We do not stack a manual pause on top of billing enforcement because resolve -converge unpauses all `BILLING_LIMIT`-paused environments for the org. - -API callers that pause during enforcement should expect the environment to -resume when the billing limit is resolved. The queues UI hides pause/resume in -this state; see `manualPauseEnvironmentGuard.server.ts`. - -The admin `runs.enable` endpoint skips billing-paused environments when -re-enabling or disabling org runs (returns them in `skipped`, not `failures` or -the update count). They resume only after the billing limit is resolved. diff --git a/.server-changes/cached-task-icon-svg.md b/.server-changes/cached-task-icon-svg.md deleted file mode 100644 index 7a675e01e13..00000000000 --- a/.server-changes/cached-task-icon-svg.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -area: webapp -type: improvement ---- - -Refresh the task and cached-task span icons shown in the run trace view with new SVG artwork. diff --git a/.server-changes/dequeue-region-gate.md b/.server-changes/dequeue-region-gate.md deleted file mode 100644 index d4f9d6979c4..00000000000 --- a/.server-changes/dequeue-region-gate.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -area: webapp -type: feature ---- - -Add a `RUN_ENGINE_DEQUEUE_DISABLED_WORKER_QUEUES` setting that refuses worker dequeue requests for the listed worker queues (or base regions), so their runs stay queued instead of being handed to workers that can't run them. diff --git a/.server-changes/dev-branches.md b/.server-changes/dev-branches.md deleted file mode 100644 index 634d4af1f15..00000000000 --- a/.server-changes/dev-branches.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -area: webapp -type: feature ---- - -Adds support for dev branches similar to the preview branches already supported. diff --git a/.server-changes/llm-spend-currency-label.md b/.server-changes/llm-spend-currency-label.md deleted file mode 100644 index 7084821f740..00000000000 --- a/.server-changes/llm-spend-currency-label.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -area: webapp -type: improvement ---- - -Add a currency unit to the agent dashboard "LLM spend" chart label, so it now reads "LLM spend ($)". diff --git a/.server-changes/logs-search-memory-and-pagination.md b/.server-changes/logs-search-memory-and-pagination.md deleted file mode 100644 index 70d32b32bd1..00000000000 --- a/.server-changes/logs-search-memory-and-pagination.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -area: webapp -type: fix ---- - -Keep logs search within bounded ClickHouse memory when browsing long time ranges, and fix pagination that could skip or duplicate entries sharing a timestamp. diff --git a/.server-changes/prisma-infrastructure-error-capture.md b/.server-changes/prisma-infrastructure-error-capture.md deleted file mode 100644 index 400cc9ddb66..00000000000 --- a/.server-changes/prisma-infrastructure-error-capture.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -area: webapp -type: fix ---- - -Log Prisma infrastructure errors (P1xxx) centrally and obfuscate their messages (which carry the DB hostname) on API responses that previously returned the raw message, without changing status codes or headers. diff --git a/.server-changes/rbac-permission-enforcement.md b/.server-changes/rbac-permission-enforcement.md deleted file mode 100644 index 1d72b0d7b3f..00000000000 --- a/.server-changes/rbac-permission-enforcement.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -area: webapp -type: feature ---- - -Enforce role-based permissions across the dashboard and API. New permission boundaries cover: runs (cancel, replay, bulk actions), deployments (rollback, promote, cancel), prompt versions, organization members (invite, resend, revoke), billing and seat purchases, integrations (GitHub and Vercel), and environment variables and API keys (restricted by environment tier). Roles without access can no longer read or change these, gated controls are disabled with a tooltip, and gated pages show a permission-denied panel instead of redirecting away. Behaviour is unchanged in the default configuration, where permissions stay permissive. diff --git a/.server-changes/remove-worker-create-endpoint.md b/.server-changes/remove-worker-create-endpoint.md deleted file mode 100644 index dd7c2041876..00000000000 --- a/.server-changes/remove-worker-create-endpoint.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -area: webapp -type: breaking ---- - -Remove the unused worker group management API endpoints (GET and POST /api/v1/workers). diff --git a/.server-changes/route-taskrun-reads-through-run-store.md b/.server-changes/route-taskrun-reads-through-run-store.md deleted file mode 100644 index dad804e40ba..00000000000 --- a/.server-changes/route-taskrun-reads-through-run-store.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -area: webapp -type: improvement ---- - -Route Postgres task run reads through the run store so they can be retargeted to a different backing store without changing call sites. diff --git a/.server-changes/sessions-test-column.md b/.server-changes/sessions-test-column.md deleted file mode 100644 index 4e28034b2bc..00000000000 --- a/.server-changes/sessions-test-column.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -area: webapp -type: feature ---- - -Agent sessions started from the Test playground are now flagged with a real `Session.isTest` boolean instead of a `"playground"` tag, surfaced as a dedicated "Test" column (check icon) in the Sessions table on both the Sessions and Agent pages, plus a matching property on the session detail page. The legacy `"playground"` tag is hidden from the Tags display on pre-existing sessions. diff --git a/.server-changes/sso.md b/.server-changes/sso.md deleted file mode 100644 index 67880748cca..00000000000 --- a/.server-changes/sso.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -area: webapp -type: feature ---- - -SAML/OIDC single sign-on: SSO login with optional per-domain enforcement, JIT provisioning, and periodic re-validation against the IdP. diff --git a/.server-changes/supervisor-pod-count-backpressure.md b/.server-changes/supervisor-pod-count-backpressure.md deleted file mode 100644 index f45411b04a5..00000000000 --- a/.server-changes/supervisor-pod-count-backpressure.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -area: supervisor -type: feature ---- - -The supervisor can pause dequeuing when the Kubernetes cluster is saturated, based on the cluster's total pod count. Opt-in and off by default. diff --git a/.server-changes/swap-task-icons.md b/.server-changes/swap-task-icons.md deleted file mode 100644 index 13605675e3d..00000000000 --- a/.server-changes/swap-task-icons.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -area: webapp -type: improvement ---- - -Update the dashboard task icons with a new glyph design. diff --git a/.server-changes/task-run-plan-type-clickhouse.md b/.server-changes/task-run-plan-type-clickhouse.md deleted file mode 100644 index c795e4f7b39..00000000000 --- a/.server-changes/task-run-plan-type-clickhouse.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -area: webapp -type: improvement ---- - -Store the run's plan type on the runs analytics table so reporting can group runs by plan. diff --git a/.server-changes/task-type-filter-segmented-control.md b/.server-changes/task-type-filter-segmented-control.md deleted file mode 100644 index a9f5d68c55a..00000000000 --- a/.server-changes/task-type-filter-segmented-control.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -area: webapp -type: improvement ---- - -Replace the Task type filter on the Tasks page with a segmented control: "All" plus icon-only Agent, Standard, and Scheduled segments (each with a tooltip showing its label and number-key shortcut). Filtering is now single-select (one task type at a time) instead of multi-select. Shortcut keys 0–3 select each segment. diff --git a/.server-changes/tasks-page-hydration-errors.md b/.server-changes/tasks-page-hydration-errors.md deleted file mode 100644 index ede865fa9e5..00000000000 --- a/.server-changes/tasks-page-hydration-errors.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -area: webapp -type: fix ---- - -Stop the Tasks page from logging React hydration errors for the per-row running and activity stats. diff --git a/.server-changes/verify-deployment-image-before-finalize.md b/.server-changes/verify-deployment-image-before-finalize.md deleted file mode 100644 index f821da49443..00000000000 --- a/.server-changes/verify-deployment-image-before-finalize.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -area: webapp -type: fix ---- - -Verify a deployment's image exists in the registry before marking it deployed, so a deploy whose image wasn't pushed fails instead of silently breaking runs (can be turned off via `DEPLOY_IMAGE_VERIFICATION_ENABLED=0` for setups that push images out of band) diff --git a/.server-changes/worker-queue-length-always-reported.md b/.server-changes/worker-queue-length-always-reported.md deleted file mode 100644 index ccce193d9f5..00000000000 --- a/.server-changes/worker-queue-length-always-reported.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -area: webapp -type: improvement ---- - -Optionally report worker queue length metrics continuously (enabled per-service via the RUN_ENGINE_WORKER_QUEUE_OBSERVER_ENABLED env var) so a queue's depth keeps being emitted even when nothing is dequeuing from it. diff --git a/hosting/k8s/helm/Chart.yaml b/hosting/k8s/helm/Chart.yaml index 42383d2c65c..481dbaff611 100644 --- a/hosting/k8s/helm/Chart.yaml +++ b/hosting/k8s/helm/Chart.yaml @@ -2,8 +2,8 @@ apiVersion: v2 name: trigger description: The official Trigger.dev Helm chart type: application -version: 4.5.0-rc.7 -appVersion: v4.5.0-rc.7 +version: 4.5.0-rc.8 +appVersion: v4.5.0-rc.8 home: https://trigger.dev sources: - https://github.com/triggerdotdev/trigger.dev diff --git a/packages/build/CHANGELOG.md b/packages/build/CHANGELOG.md index 2e4aa60f036..1d4fd8678f6 100644 --- a/packages/build/CHANGELOG.md +++ b/packages/build/CHANGELOG.md @@ -1,5 +1,12 @@ # @trigger.dev/build +## 4.5.0-rc.8 + +### Patch Changes + +- Updated dependencies: + - `@trigger.dev/core@4.5.0-rc.8` + ## 4.5.0-rc.7 ### Patch Changes @@ -56,7 +63,10 @@ - Add Agent Skills for `chat.agent`. Drop a folder with a `SKILL.md` and any helper scripts/references next to your task code, register it with `skills.define({ id, path })`, and the CLI bundles it into the deploy image automatically — no `trigger.config.ts` changes. The agent gets a one-line summary in its system prompt and discovers full instructions on demand via `loadSkill`, with `bash` and `readFile` tools scoped per-skill (path-traversal guards, output caps, abort-signal propagation). ([#3543](https://github.com/triggerdotdev/trigger.dev/pull/3543)) ```ts - const pdfSkill = skills.define({ id: "pdf-extract", path: "./skills/pdf-extract" }); + const pdfSkill = skills.define({ + id: "pdf-extract", + path: "./skills/pdf-extract", + }); chat.skills.set([await pdfSkill.local()]); ``` @@ -166,7 +176,6 @@ - The `prismaExtension` has been completely redesigned to support multiple Prisma versions and deployment strategies. This update introduces **three distinct modes** to handle the evolving Prisma ecosystem, from legacy setups to the upcoming Prisma 7. ([#2689](https://github.com/triggerdotdev/trigger.dev/pull/2689)) **Highlights:** - - 🎯 Three modes: Legacy, Engine-Only, and Modern - 🎉 **NEW:** Support for `prisma.config.ts` files (Legacy Mode) - 🔍 **NEW:** Enhanced version detection with filesystem fallback @@ -215,7 +224,6 @@ **Use when:** You're using Prisma 6.x or earlier with the `prisma-client-js` provider. **Features:** - - Automatic `prisma generate` during deployment - Supports single-file schemas (`prisma/schema.prisma`) - Supports multi-file schemas (Prisma 6.7+, directory-based schemas) @@ -264,7 +272,6 @@ ``` **Tested Versions:** - - Prisma 6.14.0 ✅ - Prisma 6.7.0+ (multi-file schema support) ✅ - Prisma 5.x ✅ @@ -276,7 +283,6 @@ **Use when:** You have a custom Prisma client output path and want to manage `prisma generate` yourself. **Features:** - - Only installs Prisma engine binaries (no client generation) - Automatic version detection from `@prisma/client` - Manual override of version and binary target @@ -316,7 +322,6 @@ ``` **Important Notes:** - - You **must** run `prisma generate` yourself (typically in a prebuild script) - Your schema **must** include the correct `binaryTargets` for deployment to the trigger.dev cloud. The binary target is `debian-openssl-3.0.x`. - The extension sets `PRISMA_QUERY_ENGINE_LIBRARY` and `PRISMA_QUERY_ENGINE_SCHEMA_ENGINE` environment variables to the correct paths for the binary targets. @@ -334,7 +339,6 @@ ``` **Tested Versions:** - - Prisma 6.19.0 ✅ - Prisma 6.16.0+ ✅ @@ -345,7 +349,6 @@ **Use when:** You're using Prisma 6.16+ with the new `prisma-client` provider (with `engineType = "client"`) or preparing for Prisma 7. **Features:** - - Designed for the new Prisma architecture - Zero configuration required - Automatically marks `@prisma/client` as external @@ -409,14 +412,12 @@ ``` **Important Notes:** - - You **must** run `prisma generate` yourself - Requires Prisma 6.16.0+ or Prisma 7 beta - The new `prisma-client` provider generates plain TypeScript (no Rust binaries) - Requires database adapters (e.g., `@prisma/adapter-pg` for PostgreSQL) **Tested Versions:** - - Prisma 6.16.0 with `engineType = "client"` ✅ - Prisma 6.20.0-integration-next.8 (Prisma 7 beta) ✅ @@ -457,7 +458,6 @@ ### Preparing for Prisma 7 If you want to adopt the new Prisma architecture, use **Modern Mode**: - 1. Update your schema to use `prisma-client` provider 2. Add database adapters to your dependencies 3. Configure the extension: @@ -489,7 +489,6 @@ **Use when:** You want to use Prisma's new config file format (Prisma 6+) to centralize your Prisma configuration. **Benefits:** - - Single source of truth for Prisma configuration - Automatic extraction of schema location and migrations path - Type-safe configuration with TypeScript @@ -527,7 +526,6 @@ ``` **What gets extracted:** - - `schema` - The schema file or directory path - `migrations.path` - The migrations directory path (if specified) diff --git a/packages/build/package.json b/packages/build/package.json index 5c21745d4b6..41c423e85a1 100644 --- a/packages/build/package.json +++ b/packages/build/package.json @@ -1,6 +1,6 @@ { "name": "@trigger.dev/build", - "version": "4.5.0-rc.7", + "version": "4.5.0-rc.8", "description": "trigger.dev build extensions", "license": "MIT", "publishConfig": { @@ -78,7 +78,7 @@ }, "dependencies": { "@prisma/config": "^6.10.0", - "@trigger.dev/core": "workspace:4.5.0-rc.7", + "@trigger.dev/core": "workspace:4.5.0-rc.8", "mlly": "^1.7.1", "pkg-types": "^1.1.3", "resolve": "^1.22.8", diff --git a/packages/cli-v3/CHANGELOG.md b/packages/cli-v3/CHANGELOG.md index 6cd084509d6..6ab3b69635f 100644 --- a/packages/cli-v3/CHANGELOG.md +++ b/packages/cli-v3/CHANGELOG.md @@ -1,5 +1,22 @@ # trigger.dev +## 4.5.0-rc.8 + +### Patch Changes + +- Add support for dev branches to the webapp and CLI. This allows humans (and agents) to run multiple local dev servers simultaneously, with a separate dashboard for each one. ([#4023](https://github.com/triggerdotdev/trigger.dev/pull/4023)) +- Adds `trigger.dev mint-token`, which mints a short-lived delegated token from your stored personal access token. The token authenticates against the API as you, can be narrowed with `--cap` and given a lifetime with `--ttl`, and prints to stdout so it can be captured. ([#3997](https://github.com/triggerdotdev/trigger.dev/pull/3997)) + + ```bash + UAT=$(trigger.dev mint-token --ttl 3600 --cap read:runs) + ``` + +- Runner debug logs are now disabled by default. Set `SEND_RUN_DEBUG_LOGS=true` on the supervisor to re-enable them. ([#3992](https://github.com/triggerdotdev/trigger.dev/pull/3992)) +- Updated dependencies: + - `@trigger.dev/core@4.5.0-rc.8` + - `@trigger.dev/build@4.5.0-rc.8` + - `@trigger.dev/schema-to-json@4.5.0-rc.8` + ## 4.5.0-rc.7 ### Patch Changes @@ -88,7 +105,10 @@ - Add Agent Skills for `chat.agent`. Drop a folder with a `SKILL.md` and any helper scripts/references next to your task code, register it with `skills.define({ id, path })`, and the CLI bundles it into the deploy image automatically — no `trigger.config.ts` changes. The agent gets a one-line summary in its system prompt and discovers full instructions on demand via `loadSkill`, with `bash` and `readFile` tools scoped per-skill (path-traversal guards, output caps, abort-signal propagation). ([#3543](https://github.com/triggerdotdev/trigger.dev/pull/3543)) ```ts - const pdfSkill = skills.define({ id: "pdf-extract", path: "./skills/pdf-extract" }); + const pdfSkill = skills.define({ + id: "pdf-extract", + path: "./skills/pdf-extract", + }); chat.skills.set([await pdfSkill.local()]); ``` @@ -132,7 +152,6 @@ - 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). ([#3224](https://github.com/triggerdotdev/trigger.dev/pull/3224)) - Fix `--load` flag being silently ignored on local/self-hosted builds. ([#3114](https://github.com/triggerdotdev/trigger.dev/pull/3114)) - Add `get_span_details` MCP tool for inspecting individual spans within a run trace. ([#3255](https://github.com/triggerdotdev/trigger.dev/pull/3255)) - - New `get_span_details` tool returns full span attributes, timing, events, and AI enrichment (model, tokens, cost, speed) - Span IDs now shown in `get_run_details` trace output for easy discovery - New API endpoint `GET /api/v1/runs/:runId/spans/:spanId` @@ -141,7 +160,6 @@ - MCP server improvements: new tools, bug fixes, and new flags. ([#3224](https://github.com/triggerdotdev/trigger.dev/pull/3224)) **New tools:** - - `get_query_schema` — discover available TRQL tables and columns - `query` — execute TRQL queries against your data - `list_dashboards` — list built-in dashboards and their widgets @@ -154,19 +172,16 @@ - `dev_server_status` — check dev server status and view recent logs **New API endpoints:** - - `GET /api/v1/query/schema` — query table schema discovery - `GET /api/v1/query/dashboards` — list built-in dashboards **New features:** - - `--readonly` flag hides write tools (`deploy`, `trigger_task`, `cancel_run`) so the AI cannot make changes - `read:query` JWT scope for query endpoint authorization - `get_run_details` trace output is now paginated with cursor support - MCP tool annotations (`readOnlyHint`, `destructiveHint`) for all tools **Bug fixes:** - - Fixed `search_docs` tool failing due to renamed upstream Mintlify tool (`SearchTriggerDev` → `search_trigger_dev`) - Fixed `list_deploys` failing when deployments have null `runtime`/`runtimeVersion` fields (#3139) - Fixed `list_preview_branches` crashing due to incorrect response shape access @@ -174,7 +189,6 @@ - Fixed dev CLI leaking build directories on rebuild — deprecated workers now clean up their build dirs when their last run completes **Context optimizations:** - - `get_query_schema` now requires a table name and returns only one table's schema (was returning all tables) - `get_current_worker` no longer inlines payload schemas; use new `get_task_schema` tool instead - Query results formatted as text tables instead of JSON (~50% fewer tokens) @@ -1298,7 +1312,6 @@ All important socket.io RPCs will now be retried with backoff. Actions relying on checkpoints will be replayed if we haven't been checkpointed and restored as expected, e.g. after reconnect. Other changes: - - Fix retry check in shared queue - Fix env var sync spinner - Heartbeat between retries @@ -1426,7 +1439,6 @@ - e9a63a486: Lock SDK and CLI deps on exact core version - 8757fdcee: v3: [prod] force flush timeout should be 1s - 26093896d: When using idempotency keys, triggerAndWait and batchTriggerAndWait will still work even if the existing runs have already been completed (or even partially completed, in the case of batchTriggerAndWait) - - TaskRunExecutionResult.id is now the run friendlyId, not the attempt friendlyId - A single TaskRun can now have many batchItems, in the case of batchTriggerAndWait while using idempotency keys - A run’s idempotencyKey is now added to the ctx as well as the TaskEvent and displayed in the span view @@ -1683,7 +1695,6 @@ All important socket.io RPCs will now be retried with backoff. Actions relying on checkpoints will be replayed if we haven't been checkpointed and restored as expected, e.g. after reconnect. Other changes: - - Fix retry check in shared queue - Fix env var sync spinner - Heartbeat between retries @@ -2088,7 +2099,6 @@ ### Patch Changes - 26093896d: When using idempotency keys, triggerAndWait and batchTriggerAndWait will still work even if the existing runs have already been completed (or even partially completed, in the case of batchTriggerAndWait) - - TaskRunExecutionResult.id is now the run friendlyId, not the attempt friendlyId - A single TaskRun can now have many batchItems, in the case of batchTriggerAndWait while using idempotency keys - A run’s idempotencyKey is now added to the ctx as well as the TaskEvent and displayed in the span view diff --git a/packages/cli-v3/package.json b/packages/cli-v3/package.json index a8dc8908f60..5b412b45fe0 100644 --- a/packages/cli-v3/package.json +++ b/packages/cli-v3/package.json @@ -1,6 +1,6 @@ { "name": "trigger.dev", - "version": "4.5.0-rc.7", + "version": "4.5.0-rc.8", "description": "A Command-Line Interface for Trigger.dev projects", "type": "module", "license": "MIT", @@ -97,9 +97,9 @@ "@opentelemetry/sdk-trace-node": "2.7.1", "@opentelemetry/semantic-conventions": "1.41.1", "@s2-dev/streamstore": "^0.22.10", - "@trigger.dev/build": "workspace:4.5.0-rc.7", - "@trigger.dev/core": "workspace:4.5.0-rc.7", - "@trigger.dev/schema-to-json": "workspace:4.5.0-rc.7", + "@trigger.dev/build": "workspace:4.5.0-rc.8", + "@trigger.dev/core": "workspace:4.5.0-rc.8", + "@trigger.dev/schema-to-json": "workspace:4.5.0-rc.8", "ansi-escapes": "^7.0.0", "braces": "^3.0.3", "c12": "^1.11.1", diff --git a/packages/core/CHANGELOG.md b/packages/core/CHANGELOG.md index ab55cbb8736..59c99c5d076 100644 --- a/packages/core/CHANGELOG.md +++ b/packages/core/CHANGELOG.md @@ -1,5 +1,13 @@ # internal-platform +## 4.5.0-rc.8 + +### Patch Changes + +- Add support for dev branches to the webapp and CLI. This allows humans (and agents) to run multiple local dev servers simultaneously, with a separate dashboard for each one. ([#4023](https://github.com/triggerdotdev/trigger.dev/pull/4023)) +- Add request and response schemas for the new Errors API (error groups). These back the env-scoped HTTP endpoints for listing error groups, retrieving a single group, and changing its state (resolve, ignore, unresolve), plus a `filter[error]` option on the runs list to fetch the runs behind a group. Exported from `@trigger.dev/core/v3` so the SDK can reuse them. ([#4005](https://github.com/triggerdotdev/trigger.dev/pull/4005)) +- Add an optional `skipBodyParsing` flag to the internal HTTP server route definition, letting a route respond without reading or parsing the request body. ([#4009](https://github.com/triggerdotdev/trigger.dev/pull/4009)) + ## 4.5.0-rc.7 ### Patch Changes @@ -67,7 +75,10 @@ - Add Agent Skills for `chat.agent`. Drop a folder with a `SKILL.md` and any helper scripts/references next to your task code, register it with `skills.define({ id, path })`, and the CLI bundles it into the deploy image automatically — no `trigger.config.ts` changes. The agent gets a one-line summary in its system prompt and discovers full instructions on demand via `loadSkill`, with `bash` and `readFile` tools scoped per-skill (path-traversal guards, output caps, abort-signal propagation). ([#3543](https://github.com/triggerdotdev/trigger.dev/pull/3543)) ```ts - const pdfSkill = skills.define({ id: "pdf-extract", path: "./skills/pdf-extract" }); + const pdfSkill = skills.define({ + id: "pdf-extract", + path: "./skills/pdf-extract", + }); chat.skills.set([await pdfSkill.local()]); ``` @@ -93,12 +104,15 @@ import { useChat } from "@ai-sdk/react"; import { useTriggerChatTransport } from "@trigger.dev/sdk/chat/react"; - const transport = useTriggerChatTransport({ task: "my-chat", accessToken, startSession }); + const transport = useTriggerChatTransport({ + task: "my-chat", + accessToken, + startSession, + }); const { messages, sendMessage } = useChat({ transport }); ``` **What you get:** - - **AI SDK `useChat` integration** — a custom [`ChatTransport`](https://sdk.vercel.ai/docs/ai-sdk-ui/transport) (`useTriggerChatTransport`) plugs straight into Vercel AI SDK's `useChat` hook. Text streaming, tool calls, reasoning, and `data-*` parts all work natively over Trigger.dev's realtime streams. No custom API routes needed. - **First-turn fast path (`chat.headStart`)** — opt-in handler that runs the first turn's `streamText` step in your warm server process while the agent run boots in parallel, cutting cold-start TTFC by roughly half (measured 2801ms → 1218ms on `claude-sonnet-4-6`). The agent owns step 2+ (tool execution, persistence, hooks) so heavy deps stay where they belong. Web Fetch handler works natively in Next.js, Hono, SvelteKit, Remix, Workers, etc.; bridge to Express/Fastify/Koa via `chat.toNodeListener`. New `@trigger.dev/sdk/chat-server` subpath. - **Multi-turn durability via Sessions** — every chat is backed by a durable Session that outlives any individual run. Conversations resume across page refreshes, idle timeout, crashes, and deploys; `resume: true` reconnects via `lastEventId` so clients only see new chunks. `sessions.list` enumerates chats for inbox-style UIs. @@ -129,16 +143,23 @@ import { sessions, tasks } from "@trigger.dev/sdk"; // Trigger a task and subscribe to its session output in one call - const { runId, stream } = await tasks.triggerAndSubscribe("my-task", payload, { - externalId: "user-456", - }); + const { runId, stream } = await tasks.triggerAndSubscribe( + "my-task", + payload, + { + externalId: "user-456", + }, + ); for await (const chunk of stream) { // ... } // Enumerate existing sessions (powers inbox-style UIs without a separate index) - for await (const s of sessions.list({ type: "chat.agent", tag: "user:user-456" })) { + for await (const s of sessions.list({ + type: "chat.agent", + tag: "user:user-456", + })) { console.log(s.id, s.externalId, s.createdAt, s.closedAt); } ``` @@ -168,7 +189,6 @@ - Fix `list_deploys` MCP tool failing when deployments have null `runtime` or `runtimeVersion` fields. ([#3224](https://github.com/triggerdotdev/trigger.dev/pull/3224)) - Propagate run tags to span attributes so they can be extracted server-side for LLM cost attribution metadata. ([#3213](https://github.com/triggerdotdev/trigger.dev/pull/3213)) - Add `get_span_details` MCP tool for inspecting individual spans within a run trace. ([#3255](https://github.com/triggerdotdev/trigger.dev/pull/3255)) - - New `get_span_details` tool returns full span attributes, timing, events, and AI enrichment (model, tokens, cost, speed) - Span IDs now shown in `get_run_details` trace output for easy discovery - New API endpoint `GET /api/v1/runs/:runId/spans/:spanId` @@ -177,7 +197,6 @@ - MCP server improvements: new tools, bug fixes, and new flags. ([#3224](https://github.com/triggerdotdev/trigger.dev/pull/3224)) **New tools:** - - `get_query_schema` — discover available TRQL tables and columns - `query` — execute TRQL queries against your data - `list_dashboards` — list built-in dashboards and their widgets @@ -190,19 +209,16 @@ - `dev_server_status` — check dev server status and view recent logs **New API endpoints:** - - `GET /api/v1/query/schema` — query table schema discovery - `GET /api/v1/query/dashboards` — list built-in dashboards **New features:** - - `--readonly` flag hides write tools (`deploy`, `trigger_task`, `cancel_run`) so the AI cannot make changes - `read:query` JWT scope for query endpoint authorization - `get_run_details` trace output is now paginated with cursor support - MCP tool annotations (`readOnlyHint`, `destructiveHint`) for all tools **Bug fixes:** - - Fixed `search_docs` tool failing due to renamed upstream Mintlify tool (`SearchTriggerDev` → `search_trigger_dev`) - Fixed `list_deploys` failing when deployments have null `runtime`/`runtimeVersion` fields (#3139) - Fixed `list_preview_branches` crashing due to incorrect response shape access @@ -210,7 +226,6 @@ - Fixed dev CLI leaking build directories on rebuild — deprecated workers now clean up their build dirs when their last run completes **Context optimizations:** - - `get_query_schema` now requires a table name and returns only one table's schema (was returning all tables) - `get_current_worker` no longer inlines payload schemas; use new `get_task_schema` tool instead - Query results formatted as text tables instead of JSON (~50% fewer tokens) @@ -260,7 +275,6 @@ ### Patch Changes - Add support for AI SDK v6 (Vercel AI SDK) ([#2919](https://github.com/triggerdotdev/trigger.dev/pull/2919)) - - Updated peer dependency to allow `ai@^6.0.0` alongside v4 and v5 - Updated internal code to handle async validation from AI SDK v6's Schema type @@ -562,8 +576,14 @@ await childTask.trigger({ message: "Hello, world!" }); // This will override the task's machine preset and any defaults. Works with all trigger functions. - await childTask.trigger({ message: "Hello, world!" }, { machine: "small-2x" }); - await childTask.triggerAndWait({ message: "Hello, world!" }, { machine: "small-2x" }); + await childTask.trigger( + { message: "Hello, world!" }, + { machine: "small-2x" }, + ); + await childTask.triggerAndWait( + { message: "Hello, world!" }, + { machine: "small-2x" }, + ); await childTask.batchTrigger([ { payload: { message: "Hello, world!" }, options: { machine: "micro" } }, @@ -577,7 +597,7 @@ await tasks.trigger( "child", { message: "Hello, world!" }, - { machine: "small-2x" } + { machine: "small-2x" }, ); await tasks.batchTrigger("child", [ { payload: { message: "Hello, world!" }, options: { machine: "micro" } }, @@ -639,7 +659,6 @@ ### Minor Changes - Improved Batch Triggering: ([#1502](https://github.com/triggerdotdev/trigger.dev/pull/1502)) - - The new Batch Trigger endpoint is now asynchronous and supports up to 500 runs per request. - The new endpoint also supports triggering multiple different tasks in a single batch request (support in the SDK coming soon). - The existing `batchTrigger` method now supports the new endpoint, and shouldn't require any changes to your code. @@ -653,14 +672,19 @@ }); // Works for individual items as well: await myTask.batchTrigger([ - { payload: { foo: "bar" }, options: { idempotencyKey: "my-key", idempotencyKeyTTL: "60s" } }, + { + payload: { foo: "bar" }, + options: { idempotencyKey: "my-key", idempotencyKeyTTL: "60s" }, + }, ]); // And `trigger`: - await myTask.trigger({ foo: "bar" }, { idempotencyKey: "my-key", idempotencyKeyTTL: "60s" }); + await myTask.trigger( + { foo: "bar" }, + { idempotencyKey: "my-key", idempotencyKeyTTL: "60s" }, + ); ``` ### Breaking Changes - - We've removed the `idempotencyKey` option from `triggerAndWait` and `batchTriggerAndWait`, because it can lead to permanently frozen runs in deployed tasks. We're working on upgrading our entire system to support idempotency keys on these methods, and we'll re-add the option once that's complete. ### Patch Changes @@ -892,7 +916,6 @@ All important socket.io RPCs will now be retried with backoff. Actions relying on checkpoints will be replayed if we haven't been checkpointed and restored as expected, e.g. after reconnect. Other changes: - - Fix retry check in shared queue - Fix env var sync spinner - Heartbeat between retries @@ -1014,7 +1037,10 @@ Before: ```ts - await yourTask.trigger({ payload: { foo: "bar" }, options: { idempotencyKey: "key_1234" } }); + await yourTask.trigger({ + payload: { foo: "bar" }, + options: { idempotencyKey: "key_1234" }, + }); await yourTask.triggerAndWait({ payload: { foo: "bar" }, options: { idempotencyKey: "key_1234" }, @@ -1034,8 +1060,14 @@ await yourTask.trigger({ foo: "bar" }, { idempotencyKey: "key_1234" }); await yourTask.triggerAndWait({ foo: "bar" }, { idempotencyKey: "key_1234" }); - await yourTask.batchTrigger([{ payload: { foo: "bar" } }, { payload: { foo: "baz" } }]); - await yourTask.batchTriggerAndWait([{ payload: { foo: "bar" } }, { payload: { foo: "baz" } }]); + await yourTask.batchTrigger([ + { payload: { foo: "bar" } }, + { payload: { foo: "baz" } }, + ]); + await yourTask.batchTriggerAndWait([ + { payload: { foo: "bar" } }, + { payload: { foo: "baz" } }, + ]); ``` We've also changed the API of the `triggerAndWait` result. Before, if the subtask that was triggered finished with an error, we would automatically "rethrow" the error in the parent task. @@ -1069,7 +1101,6 @@ - e04d44866: v3: sanitize errors with null unicode characters in some places - 26093896d: When using idempotency keys, triggerAndWait and batchTriggerAndWait will still work even if the existing runs have already been completed (or even partially completed, in the case of batchTriggerAndWait) - - TaskRunExecutionResult.id is now the run friendlyId, not the attempt friendlyId - A single TaskRun can now have many batchItems, in the case of batchTriggerAndWait while using idempotency keys - A run’s idempotencyKey is now added to the ctx as well as the TaskEvent and displayed in the span view @@ -1188,7 +1219,6 @@ All important socket.io RPCs will now be retried with backoff. Actions relying on checkpoints will be replayed if we haven't been checkpointed and restored as expected, e.g. after reconnect. Other changes: - - Fix retry check in shared queue - Fix env var sync spinner - Heartbeat between retries @@ -1464,7 +1494,10 @@ Before: ```ts - await yourTask.trigger({ payload: { foo: "bar" }, options: { idempotencyKey: "key_1234" } }); + await yourTask.trigger({ + payload: { foo: "bar" }, + options: { idempotencyKey: "key_1234" }, + }); await yourTask.triggerAndWait({ payload: { foo: "bar" }, options: { idempotencyKey: "key_1234" }, @@ -1484,8 +1517,14 @@ await yourTask.trigger({ foo: "bar" }, { idempotencyKey: "key_1234" }); await yourTask.triggerAndWait({ foo: "bar" }, { idempotencyKey: "key_1234" }); - await yourTask.batchTrigger([{ payload: { foo: "bar" } }, { payload: { foo: "baz" } }]); - await yourTask.batchTriggerAndWait([{ payload: { foo: "bar" } }, { payload: { foo: "baz" } }]); + await yourTask.batchTrigger([ + { payload: { foo: "bar" } }, + { payload: { foo: "baz" } }, + ]); + await yourTask.batchTriggerAndWait([ + { payload: { foo: "bar" } }, + { payload: { foo: "baz" } }, + ]); ``` We've also changed the API of the `triggerAndWait` result. Before, if the subtask that was triggered finished with an error, we would automatically "rethrow" the error in the parent task. @@ -1518,7 +1557,6 @@ ``` - 26093896d: When using idempotency keys, triggerAndWait and batchTriggerAndWait will still work even if the existing runs have already been completed (or even partially completed, in the case of batchTriggerAndWait) - - TaskRunExecutionResult.id is now the run friendlyId, not the attempt friendlyId - A single TaskRun can now have many batchItems, in the case of batchTriggerAndWait while using idempotency keys - A run’s idempotencyKey is now added to the ctx as well as the TaskEvent and displayed in the span view diff --git a/packages/core/package.json b/packages/core/package.json index a3d220c6eac..2a3572032b3 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@trigger.dev/core", - "version": "4.5.0-rc.7", + "version": "4.5.0-rc.8", "description": "Core code used across the Trigger.dev SDK and platform", "license": "MIT", "publishConfig": { diff --git a/packages/plugins/CHANGELOG.md b/packages/plugins/CHANGELOG.md index ae387c569b8..ec356378e4a 100644 --- a/packages/plugins/CHANGELOG.md +++ b/packages/plugins/CHANGELOG.md @@ -1,5 +1,12 @@ # @trigger.dev/plugins +## 4.5.0-rc.8 + +### Patch Changes + +- Updated dependencies: + - `@trigger.dev/core@4.5.0-rc.8` + ## 4.5.0-rc.7 ### Patch Changes diff --git a/packages/plugins/package.json b/packages/plugins/package.json index dd3e8e9a639..09627225394 100644 --- a/packages/plugins/package.json +++ b/packages/plugins/package.json @@ -1,6 +1,6 @@ { "name": "@trigger.dev/plugins", - "version": "4.5.0-rc.7", + "version": "4.5.0-rc.8", "description": "Plugin contracts and interfaces for Trigger.dev", "license": "MIT", "private": true, diff --git a/packages/python/CHANGELOG.md b/packages/python/CHANGELOG.md index 656fae1b620..d677b4b9dcf 100644 --- a/packages/python/CHANGELOG.md +++ b/packages/python/CHANGELOG.md @@ -1,5 +1,14 @@ # @trigger.dev/python +## 4.5.0-rc.8 + +### Patch Changes + +- Updated dependencies: + - `@trigger.dev/sdk@4.5.0-rc.8` + - `@trigger.dev/core@4.5.0-rc.8` + - `@trigger.dev/build@4.5.0-rc.8` + ## 4.5.0-rc.7 ### Patch Changes diff --git a/packages/python/package.json b/packages/python/package.json index 0ed3e7270a8..88ff5add3fc 100644 --- a/packages/python/package.json +++ b/packages/python/package.json @@ -1,6 +1,6 @@ { "name": "@trigger.dev/python", - "version": "4.5.0-rc.7", + "version": "4.5.0-rc.8", "description": "Python runtime and build extension for Trigger.dev", "license": "MIT", "publishConfig": { @@ -45,7 +45,7 @@ "check-exports": "attw --pack ." }, "dependencies": { - "@trigger.dev/core": "workspace:4.5.0-rc.7", + "@trigger.dev/core": "workspace:4.5.0-rc.8", "tinyexec": "^0.3.2" }, "devDependencies": { @@ -56,12 +56,12 @@ "tsx": "4.17.0", "esbuild": "^0.23.0", "@arethetypeswrong/cli": "^0.15.4", - "@trigger.dev/build": "workspace:4.5.0-rc.7", - "@trigger.dev/sdk": "workspace:4.5.0-rc.7" + "@trigger.dev/build": "workspace:4.5.0-rc.8", + "@trigger.dev/sdk": "workspace:4.5.0-rc.8" }, "peerDependencies": { - "@trigger.dev/sdk": "workspace:^4.5.0-rc.7", - "@trigger.dev/build": "workspace:^4.5.0-rc.7" + "@trigger.dev/sdk": "workspace:^4.5.0-rc.8", + "@trigger.dev/build": "workspace:^4.5.0-rc.8" }, "engines": { "node": ">=18.20.0" diff --git a/packages/react-hooks/CHANGELOG.md b/packages/react-hooks/CHANGELOG.md index ef31d170e6f..ea5af1e3064 100644 --- a/packages/react-hooks/CHANGELOG.md +++ b/packages/react-hooks/CHANGELOG.md @@ -1,5 +1,12 @@ # @trigger.dev/react-hooks +## 4.5.0-rc.8 + +### Patch Changes + +- Updated dependencies: + - `@trigger.dev/core@4.5.0-rc.8` + ## 4.5.0-rc.7 ### Patch Changes @@ -604,7 +611,6 @@ ### Minor Changes - Improved Batch Triggering: ([#1502](https://github.com/triggerdotdev/trigger.dev/pull/1502)) - - The new Batch Trigger endpoint is now asynchronous and supports up to 500 runs per request. - The new endpoint also supports triggering multiple different tasks in a single batch request (support in the SDK coming soon). - The existing `batchTrigger` method now supports the new endpoint, and shouldn't require any changes to your code. @@ -618,14 +624,19 @@ }); // Works for individual items as well: await myTask.batchTrigger([ - { payload: { foo: "bar" }, options: { idempotencyKey: "my-key", idempotencyKeyTTL: "60s" } }, + { + payload: { foo: "bar" }, + options: { idempotencyKey: "my-key", idempotencyKeyTTL: "60s" }, + }, ]); // And `trigger`: - await myTask.trigger({ foo: "bar" }, { idempotencyKey: "my-key", idempotencyKeyTTL: "60s" }); + await myTask.trigger( + { foo: "bar" }, + { idempotencyKey: "my-key", idempotencyKeyTTL: "60s" }, + ); ``` ### Breaking Changes - - We've removed the `idempotencyKey` option from `triggerAndWait` and `batchTriggerAndWait`, because it can lead to permanently frozen runs in deployed tasks. We're working on upgrading our entire system to support idempotency keys on these methods, and we'll re-add the option once that's complete. ### Patch Changes diff --git a/packages/react-hooks/package.json b/packages/react-hooks/package.json index 15964513a98..8478476a20f 100644 --- a/packages/react-hooks/package.json +++ b/packages/react-hooks/package.json @@ -1,6 +1,6 @@ { "name": "@trigger.dev/react-hooks", - "version": "4.5.0-rc.7", + "version": "4.5.0-rc.8", "description": "trigger.dev react hooks", "license": "MIT", "publishConfig": { @@ -37,7 +37,7 @@ "check-exports": "attw --pack ." }, "dependencies": { - "@trigger.dev/core": "workspace:^4.5.0-rc.7", + "@trigger.dev/core": "workspace:^4.5.0-rc.8", "swr": "^2.2.5" }, "devDependencies": { diff --git a/packages/redis-worker/CHANGELOG.md b/packages/redis-worker/CHANGELOG.md index e3fcc56aca5..4a68c90be88 100644 --- a/packages/redis-worker/CHANGELOG.md +++ b/packages/redis-worker/CHANGELOG.md @@ -1,5 +1,12 @@ # @trigger.dev/redis-worker +## 4.5.0-rc.8 + +### Patch Changes + +- Updated dependencies: + - `@trigger.dev/core@4.5.0-rc.8` + ## 4.5.0-rc.7 ### Patch Changes diff --git a/packages/redis-worker/package.json b/packages/redis-worker/package.json index 9c4b228477e..c3c3df4f4d4 100644 --- a/packages/redis-worker/package.json +++ b/packages/redis-worker/package.json @@ -1,6 +1,6 @@ { "name": "@trigger.dev/redis-worker", - "version": "4.5.0-rc.7", + "version": "4.5.0-rc.8", "description": "Redis worker for trigger.dev", "license": "MIT", "publishConfig": { @@ -23,7 +23,7 @@ "test": "vitest --sequence.concurrent=false --no-file-parallelism" }, "dependencies": { - "@trigger.dev/core": "workspace:4.5.0-rc.7", + "@trigger.dev/core": "workspace:4.5.0-rc.8", "lodash.omit": "^4.5.0", "nanoid": "^5.0.7", "p-limit": "^6.2.0", diff --git a/packages/rsc/CHANGELOG.md b/packages/rsc/CHANGELOG.md index b800119490b..f7b251c91f2 100644 --- a/packages/rsc/CHANGELOG.md +++ b/packages/rsc/CHANGELOG.md @@ -1,5 +1,12 @@ # @trigger.dev/rsc +## 4.5.0-rc.8 + +### Patch Changes + +- Updated dependencies: + - `@trigger.dev/core@4.5.0-rc.8` + ## 4.5.0-rc.7 ### Patch Changes diff --git a/packages/rsc/package.json b/packages/rsc/package.json index 62379932afa..7ab0043bd3e 100644 --- a/packages/rsc/package.json +++ b/packages/rsc/package.json @@ -1,6 +1,6 @@ { "name": "@trigger.dev/rsc", - "version": "4.5.0-rc.7", + "version": "4.5.0-rc.8", "description": "trigger.dev rsc", "license": "MIT", "publishConfig": { @@ -37,14 +37,14 @@ "check-exports": "attw --pack ." }, "dependencies": { - "@trigger.dev/core": "workspace:^4.5.0-rc.7", + "@trigger.dev/core": "workspace:^4.5.0-rc.8", "mlly": "^1.7.1", "react": "19.0.0-rc.1", "react-dom": "19.0.0-rc.1" }, "devDependencies": { "@arethetypeswrong/cli": "^0.15.4", - "@trigger.dev/build": "workspace:^4.5.0-rc.7", + "@trigger.dev/build": "workspace:^4.5.0-rc.8", "@types/node": "^20.14.14", "@types/react": "*", "@types/react-dom": "*", diff --git a/packages/schema-to-json/CHANGELOG.md b/packages/schema-to-json/CHANGELOG.md index 1fb14cc02b2..f0ca1d70402 100644 --- a/packages/schema-to-json/CHANGELOG.md +++ b/packages/schema-to-json/CHANGELOG.md @@ -1,5 +1,12 @@ # @trigger.dev/schema-to-json +## 4.5.0-rc.8 + +### Patch Changes + +- Updated dependencies: + - `@trigger.dev/core@4.5.0-rc.8` + ## 4.5.0-rc.7 ### Patch Changes diff --git a/packages/schema-to-json/package.json b/packages/schema-to-json/package.json index b1be66594a5..24f3cde378d 100644 --- a/packages/schema-to-json/package.json +++ b/packages/schema-to-json/package.json @@ -1,6 +1,6 @@ { "name": "@trigger.dev/schema-to-json", - "version": "4.5.0-rc.7", + "version": "4.5.0-rc.8", "description": "Convert various schema validation libraries to JSON Schema", "license": "MIT", "publishConfig": { diff --git a/packages/trigger-sdk/CHANGELOG.md b/packages/trigger-sdk/CHANGELOG.md index 47dc203b12c..d0a220138ff 100644 --- a/packages/trigger-sdk/CHANGELOG.md +++ b/packages/trigger-sdk/CHANGELOG.md @@ -1,5 +1,38 @@ # @trigger.dev/sdk +## 4.5.0-rc.8 + +### Patch Changes + +- Fix `chat.agent` / `AgentChat` when the agent is deployed to a Trigger.dev preview branch. The realtime message-append and stream-subscribe calls now send the `x-trigger-branch` header (sourced from the same resolver `sessions.start` uses), so messaging a preview-branch chat agent no longer fails with `x-trigger-branch header required for preview env`. ([#4018](https://github.com/triggerdotdev/trigger.dev/pull/4018)) +- Fix Head Start handovers breaking when a `chat.agent` also defines a `prepareMessages` hook. A handover hands the first turn's pending tool call to the agent as a tool-approval round whose trailing tool message must reach the model untouched. A `prepareMessages` hook that rewrites the last message (for example the recommended prompt-caching breakpoint) could disturb it, so the turn failed with "tool_use ids were found without tool_result". The agent now preserves that approval tail across `prepareMessages`, so caching and Head Start compose cleanly. ([#4018](https://github.com/triggerdotdev/trigger.dev/pull/4018)) +- `chat.headStart` now accepts an `apiClient` option (base URL + access token), so the head-start route can create the session and trigger the agent run against a different project/environment than the warm server's ambient Trigger config. Useful when your `chat.agent` lives in a separate project from the app serving the route. Mirrors the `apiClient` option on `chat.createStartSessionAction`; your LLM provider keys stay in the `run` callback and are unaffected. ([#4018](https://github.com/triggerdotdev/trigger.dev/pull/4018)) + + ```ts + export const POST = chat.headStart({ + agentId: "my-agent", + apiClient: { baseURL, accessToken }, + run: async ({ chat }) => + streamText({ + ...chat.toStreamTextOptions({ tools }), + model: anthropic("claude-sonnet-4-6"), + }), + }); + ``` + +- `chat.createStartSessionAction` now accepts an `apiClient` option, so you can scope a chat session start to a specific environment's API config (`baseURL` / `accessToken`) without setting a global `TRIGGER_SECRET_KEY`. Useful when one server starts chats across more than one environment. ([#4018](https://github.com/triggerdotdev/trigger.dev/pull/4018)) + + ```ts + const startSession = chat.createStartSessionAction("my-chat", { + apiClient: { baseURL, accessToken }, + }); + + await startSession({ chatId, clientData }); + ``` + +- Updated dependencies: + - `@trigger.dev/core@4.5.0-rc.8` + ## 4.5.0-rc.7 ### Patch Changes @@ -16,7 +49,11 @@ if (isFinal) { await chat.writeTurnComplete(); // step 1 is the response, no streamText } else { - const result = streamText({ model, messages: conversation.modelMessages, tools }); + const result = streamText({ + model, + messages: conversation.modelMessages, + tools, + }); // Pass originalMessages so the handed-over tool round merges into the // step-1 assistant instead of starting a new message. const response = await chat.pipeAndCapture(result, { @@ -34,7 +71,8 @@ export const POST = chat.headStart({ agentId: "my-agent", triggerConfig: { tags: ["org:acme"], queue: "chat" }, - run: async ({ chat }) => streamText({ ...chat.toStreamTextOptions(), model }), + run: async ({ chat }) => + streamText({ ...chat.toStreamTextOptions(), model }), }); ``` @@ -51,7 +89,9 @@ // provider-agnostic equivalent chat.toStreamTextOptions({ - systemProviderOptions: { anthropic: { cacheControl: { type: "ephemeral" } } }, + systemProviderOptions: { + anthropic: { cacheControl: { type: "ephemeral" } }, + }, }); // or where the prompt is defined @@ -63,7 +103,6 @@ Without an option, `system` stays a plain string. Pairs with a `prepareMessages` cache breakpoint to cache the conversation prefix across turns too. - Three fixes for custom agent loops (`chat.customAgent`, `chat.createSession`, and hand-rolled `MessageAccumulator` loops): ([#3936](https://github.com/triggerdotdev/trigger.dev/pull/3936)) - - Continuation runs no longer replay already-answered user messages into the first turn. The `.in` resume cursor is now seeded before any listener attaches (the same boot logic `chat.agent` uses), so a chat that continues after a cancel, crash, or upgrade only sees genuinely new messages. - Steering a hand-rolled loop mid-stream no longer wipes the in-flight assistant response. `chat.pipeAndCapture` now stamps a server-generated message id on the stream, so a `prepareStep` injection keeps the partial text instead of replacing the message. - Task-backed tools (`ai.toolExecute`) now work from custom agent loops: the parent's session is threaded to the child run, so child tasks can stream progress into the chat with `chat.stream.writer({ target: "root" })` instead of failing with "session handle is not initialized". @@ -129,7 +168,6 @@ ### Patch Changes - Fix `chat.agent` HITL continuations on reasoning-heavy turns. Two changes that work together: ([#3719](https://github.com/triggerdotdev/trigger.dev/pull/3719)) - - The per-turn merge now overlays the wire copy's tool-part state advancement onto the agent's existing chain — `state` + the matching resolution field (`output` / `errorText` / `approval`) come from the wire, everything else (text, reasoning, tool `input`, provider metadata) stays whatever the snapshot or `hydrateMessages` returned. Previously a full-message replace overwrote those fields with whatever the client shipped, so a slimmed wire copy landed a tool call with no `arguments` on the next LLM call. Covers `output-available` / `output-error` (HITL `addToolOutput`) and `approval-responded` / `output-denied` (approval flow). - `TriggerChatTransport.sendMessages` and `AgentChat.sendRaw` now slim assistant messages that carry advanced tool parts. The wire payload is just `{ id, role, parts: [] }` for `submit-message` continuations; everything else passes through. Reasoning blobs and full tool inputs no longer ride the wire on every `addToolOutput` / `addToolApproveResponse`, so continuation payloads stay well under the `.in/append` cap on long agent loops. @@ -145,7 +183,10 @@ const record = await db.chat.findUnique({ where: { id: chatId } }); const stored = record?.messages ?? []; if (upsertIncomingMessage(stored, { trigger, incomingMessages })) { - await db.chat.update({ where: { id: chatId }, data: { messages: stored } }); + await db.chat.update({ + where: { id: chatId }, + data: { messages: stored }, + }); } return stored; }, @@ -223,7 +264,6 @@ ``` **What you get:** - - **Code-defined, deploy-versioned templates** — define with `prompts.define({ id, model, config, variables, content })`. Every deploy creates a new version visible in the dashboard. Mustache-style placeholders (`{{var}}`, `{{#cond}}...{{/cond}}`) with Zod / ArkType / Valibot-typed variables. - **Dashboard overrides** — change a prompt's text or model from the dashboard without redeploying. Overrides take priority over the deployed "current" version and are environment-scoped (dev / staging / production independent). - **Resolve API** — `prompt.resolve(vars, { version?, label? })` returns the compiled `text`, resolved `model`, `version`, and labels. Standalone `prompts.resolve(slug, vars)` for cross-file resolution with full type inference on slug and variable shape. @@ -237,12 +277,16 @@ - Adds `onBoot` to `chat.agent` — a lifecycle hook that fires once per worker process picking up the chat. Runs for the initial run, preloaded runs, AND reactive continuation runs (post-cancel, crash, `endRun`, `requestUpgrade`, OOM retry), before any other hook. Use it to initialize `chat.local`, open per-process resources, or re-hydrate state from your DB on continuation — anywhere the SAME run picking up after suspend/resume isn't enough. ([#3543](https://github.com/triggerdotdev/trigger.dev/pull/3543)) ```ts - const userContext = chat.local<{ name: string; plan: string }>({ id: "userContext" }); + const userContext = chat.local<{ name: string; plan: string }>({ + id: "userContext", + }); export const myChat = chat.agent({ id: "my-chat", onBoot: async ({ clientData, continuation }) => { - const user = await db.user.findUnique({ where: { id: clientData.userId } }); + const user = await db.user.findUnique({ + where: { id: clientData.userId }, + }); userContext.init({ name: user.name, plan: user.plan }); }, run: async ({ messages, signal }) => @@ -270,12 +314,15 @@ import { useChat } from "@ai-sdk/react"; import { useTriggerChatTransport } from "@trigger.dev/sdk/chat/react"; - const transport = useTriggerChatTransport({ task: "my-chat", accessToken, startSession }); + const transport = useTriggerChatTransport({ + task: "my-chat", + accessToken, + startSession, + }); const { messages, sendMessage } = useChat({ transport }); ``` **What you get:** - - **AI SDK `useChat` integration** — a custom [`ChatTransport`](https://sdk.vercel.ai/docs/ai-sdk-ui/transport) (`useTriggerChatTransport`) plugs straight into Vercel AI SDK's `useChat` hook. Text streaming, tool calls, reasoning, and `data-*` parts all work natively over Trigger.dev's realtime streams. No custom API routes needed. - **First-turn fast path (`chat.headStart`)** — opt-in handler that runs the first turn's `streamText` step in your warm server process while the agent run boots in parallel, cutting cold-start TTFC by roughly half (measured 2801ms → 1218ms on `claude-sonnet-4-6`). The agent owns step 2+ (tool execution, persistence, hooks) so heavy deps stay where they belong. Web Fetch handler works natively in Next.js, Hono, SvelteKit, Remix, Workers, etc.; bridge to Express/Fastify/Koa via `chat.toNodeListener`. New `@trigger.dev/sdk/chat-server` subpath. - **Multi-turn durability via Sessions** — every chat is backed by a durable Session that outlives any individual run. Conversations resume across page refreshes, idle timeout, crashes, and deploys; `resume: true` reconnects via `lastEventId` so clients only see new chunks. `sessions.list` enumerates chats for inbox-style UIs. @@ -305,7 +352,11 @@ onTurnComplete: async ({ responseMessage }) => { const newResults = chat.history.extractNewToolResults(responseMessage); for (const r of newResults) { - await db.toolResults.upsert({ id: r.toolCallId, output: r.output, errorText: r.errorText }); + await db.toolResults.upsert({ + id: r.toolCallId, + output: r.output, + errorText: r.errorText, + }); } }; ``` @@ -316,16 +367,23 @@ import { sessions, tasks } from "@trigger.dev/sdk"; // Trigger a task and subscribe to its session output in one call - const { runId, stream } = await tasks.triggerAndSubscribe("my-task", payload, { - externalId: "user-456", - }); + const { runId, stream } = await tasks.triggerAndSubscribe( + "my-task", + payload, + { + externalId: "user-456", + }, + ); for await (const chunk of stream) { // ... } // Enumerate existing sessions (powers inbox-style UIs without a separate index) - for await (const s of sessions.list({ type: "chat.agent", tag: "user:user-456" })) { + for await (const s of sessions.list({ + type: "chat.agent", + tag: "user:user-456", + })) { console.log(s.id, s.externalId, s.createdAt, s.closedAt); } ``` @@ -337,7 +395,10 @@ - Add Agent Skills for `chat.agent`. Drop a folder with a `SKILL.md` and any helper scripts/references next to your task code, register it with `skills.define({ id, path })`, and the CLI bundles it into the deploy image automatically — no `trigger.config.ts` changes. The agent gets a one-line summary in its system prompt and discovers full instructions on demand via `loadSkill`, with `bash` and `readFile` tools scoped per-skill (path-traversal guards, output caps, abort-signal propagation). ([#3543](https://github.com/triggerdotdev/trigger.dev/pull/3543)) ```ts - const pdfSkill = skills.define({ id: "pdf-extract", path: "./skills/pdf-extract" }); + const pdfSkill = skills.define({ + id: "pdf-extract", + path: "./skills/pdf-extract", + }); chat.skills.set([await pdfSkill.local()]); ``` @@ -363,12 +424,14 @@ import { chat } from "@trigger.dev/sdk/ai"; import type { myChat } from "@/trigger/chat"; - export const startChatSession = chat.createStartSessionAction("my-chat"); + export const startChatSession = + chat.createStartSessionAction("my-chat"); // In the browser, threaded from the transport's typed startSession callback: const transport = useTriggerChatTransport({ task: "my-chat", - startSession: ({ chatId, clientData }) => startChatSession({ chatId, clientData }), + startSession: ({ chatId, clientData }) => + startChatSession({ chatId, clientData }), // ... }); ``` @@ -446,12 +509,14 @@ import type { QueryTable } from "@trigger.dev/sdk"; // Basic untyped query - const result = await query.execute("SELECT run_id, status FROM runs LIMIT 10"); + const result = await query.execute( + "SELECT run_id, status FROM runs LIMIT 10", + ); // Type-safe query using QueryTable to pick specific columns - const typedResult = await query.execute>( - "SELECT run_id, status, triggered_at FROM runs LIMIT 10" - ); + const typedResult = await query.execute< + QueryTable<"runs", "run_id" | "status" | "triggered_at"> + >("SELECT run_id, status, triggered_at FROM runs LIMIT 10"); typedResult.results.forEach((row) => { console.log(row.run_id, row.status); // Fully typed }); @@ -459,7 +524,7 @@ // Aggregation query with inline types const stats = await query.execute<{ status: string; count: number }>( "SELECT status, COUNT(*) as count FROM runs GROUP BY status", - { scope: "project", period: "30d" } + { scope: "project", period: "30d" }, ); // CSV export @@ -495,7 +560,6 @@ ### Patch Changes - Add support for AI SDK v6 (Vercel AI SDK) ([#2919](https://github.com/triggerdotdev/trigger.dev/pull/2919)) - - Updated peer dependency to allow `ai@^6.0.0` alongside v4 and v5 - Updated internal code to handle async validation from AI SDK v6's Schema type @@ -575,7 +639,7 @@ tasks.onStartAttempt(({ ctx, payload, task }) => { console.log( `Run ${ctx.run.id} started on task ${task} attempt ${ctx.run.attempt.number}`, - ctx.run + ctx.run, ); }); ``` @@ -729,13 +793,16 @@ // Now context.active() refers to your external trace context propagation.inject(context.active(), headersObject); - const result = await fetch("http://localhost:3000/api/demo-call-from-trigger", { - headers: new Headers(headersObject), - method: "POST", - body: JSON.stringify({ - message: "Hello from Trigger.dev", - }), - }); + const result = await fetch( + "http://localhost:3000/api/demo-call-from-trigger", + { + headers: new Headers(headersObject), + method: "POST", + body: JSON.stringify({ + message: "Hello from Trigger.dev", + }), + }, + ); return result.json(); }); @@ -752,7 +819,6 @@ - Add jsonSchema support when indexing tasks ([#2353](https://github.com/triggerdotdev/trigger.dev/pull/2353)) - Fixed an issue with realtime streams that timeout and resume streaming dropping chunks ([#1993](https://github.com/triggerdotdev/trigger.dev/pull/1993)) - Added and cleaned up the run ctx param: ([#2322](https://github.com/triggerdotdev/trigger.dev/pull/2322)) - - New optional properties `ctx.run.parentTaskRunId` and `ctx.run.rootTaskRunId` reference the current run's root/parent ID. - Removed deprecated properties from `ctx` - Added a new `ctx.deployment` object that contains information about the deployment associated with the run. @@ -771,14 +837,12 @@ - Deprecate toolTask and replace with `ai.tool(mySchemaTask)` ([#1863](https://github.com/triggerdotdev/trigger.dev/pull/1863)) - Display clickable links in Cursor terminal ([#1998](https://github.com/triggerdotdev/trigger.dev/pull/1998)) - Removes the `releaseConcurrencyOnWaitpoint` option on queues and the `releaseConcurrency` option on various wait functions. Replaced with the following default behavior: ([#2284](https://github.com/triggerdotdev/trigger.dev/pull/2284)) - - Concurrency is never released when a run is first blocked via a waitpoint, at either the env or queue level. - Concurrency is always released when a run is checkpointed and shutdown, at both the env and queue level. Additionally, environment concurrency limits now have a new "Burst Factor", defaulting to 2.0x. The "Burst Factor" allows the environment-wide concurrency limit to be higher than any individual queue's concurrency limit. For example, if you have an environment concurrency limit of 100, and a Burst Factor of 2.0x, then you can execute up to 200 runs concurrently, but any one task/queue can still only execute 100 runs concurrently. We've done some work cleaning up the run statuses. The new statuses are: - - `PENDING_VERSION`: Task is waiting for a version update because it cannot execute without additional information (task, queue, etc.) - `QUEUED`: Task is waiting to be executed by a worker - `DEQUEUED`: Task has been dequeued and is being sent to a worker to start executing. @@ -794,14 +858,12 @@ - `TIMED_OUT`: Task has reached it's maxDuration and has been stopped We've removed the following statuses: - - `WAITING_FOR_DEPLOY`: This is no longer used, and is replaced by `PENDING_VERSION` - `FROZEN`: This is no longer used, and is replaced by `WAITING` - `INTERRUPTED`: This is no longer used - `REATTEMPTING`: This is no longer used, and is replaced by `EXECUTING` We've also added "boolean" helpers to runs returned via the API and from Realtime: - - `isQueued`: Returns true when the status is `QUEUED`, `PENDING_VERSION`, or `DELAYED` - `isExecuting`: Returns true when the status is `EXECUTING`, `DEQUEUED`. These count against your concurrency limits. - `isWaiting`: Returns true when the status is `WAITING`. These do not count against your concurrency limits. @@ -903,13 +965,16 @@ // Now context.active() refers to your external trace context propagation.inject(context.active(), headersObject); - const result = await fetch("http://localhost:3000/api/demo-call-from-trigger", { - headers: new Headers(headersObject), - method: "POST", - body: JSON.stringify({ - message: "Hello from Trigger.dev", - }), - }); + const result = await fetch( + "http://localhost:3000/api/demo-call-from-trigger", + { + headers: new Headers(headersObject), + method: "POST", + body: JSON.stringify({ + message: "Hello from Trigger.dev", + }), + }, + ); return result.json(); }); @@ -936,7 +1001,6 @@ - fix: importing from runEngine/index.js breaks non-node runtimes ([#2328](https://github.com/triggerdotdev/trigger.dev/pull/2328)) - Added and cleaned up the run ctx param: ([#2322](https://github.com/triggerdotdev/trigger.dev/pull/2322)) - - New optional properties `ctx.run.parentTaskRunId` and `ctx.run.rootTaskRunId` reference the current run's root/parent ID. - Removed deprecated properties from `ctx` - Added a new `ctx.deployment` object that contains information about the deployment associated with the run. @@ -965,14 +1029,12 @@ ### Patch Changes - Removes the `releaseConcurrencyOnWaitpoint` option on queues and the `releaseConcurrency` option on various wait functions. Replaced with the following default behavior: ([#2284](https://github.com/triggerdotdev/trigger.dev/pull/2284)) - - Concurrency is never released when a run is first blocked via a waitpoint, at either the env or queue level. - Concurrency is always released when a run is checkpointed and shutdown, at both the env and queue level. Additionally, environment concurrency limits now have a new "Burst Factor", defaulting to 2.0x. The "Burst Factor" allows the environment-wide concurrency limit to be higher than any individual queue's concurrency limit. For example, if you have an environment concurrency limit of 100, and a Burst Factor of 2.0x, then you can execute up to 200 runs concurrently, but any one task/queue can still only execute 100 runs concurrently. We've done some work cleaning up the run statuses. The new statuses are: - - `PENDING_VERSION`: Task is waiting for a version update because it cannot execute without additional information (task, queue, etc.) - `QUEUED`: Task is waiting to be executed by a worker - `DEQUEUED`: Task has been dequeued and is being sent to a worker to start executing. @@ -988,14 +1050,12 @@ - `TIMED_OUT`: Task has reached it's maxDuration and has been stopped We've removed the following statuses: - - `WAITING_FOR_DEPLOY`: This is no longer used, and is replaced by `PENDING_VERSION` - `FROZEN`: This is no longer used, and is replaced by `WAITING` - `INTERRUPTED`: This is no longer used - `REATTEMPTING`: This is no longer used, and is replaced by `EXECUTING` We've also added "boolean" helpers to runs returned via the API and from Realtime: - - `isQueued`: Returns true when the status is `QUEUED`, `PENDING_VERSION`, or `DELAYED` - `isExecuting`: Returns true when the status is `EXECUTING`, `DEQUEUED`. These count against your concurrency limits. - `isWaiting`: Returns true when the status is `WAITING`. These do not count against your concurrency limits. @@ -1213,11 +1273,13 @@ The main change is that there's now an SDK function to verify and parse them (similar to Stripe SDK). ```ts - const event = await webhooks.constructEvent(request, process.env.ALERT_WEBHOOK_SECRET!); + const event = await webhooks.constructEvent( + request, + process.env.ALERT_WEBHOOK_SECRET!, + ); ``` If the signature you provide matches the one from the dashboard when you create the webhook, you will get a nicely typed object back for these three types: - - "alert.run.failed" - "alert.deployment.success" - "alert.deployment.failed" @@ -1267,8 +1329,14 @@ await childTask.trigger({ message: "Hello, world!" }); // This will override the task's machine preset and any defaults. Works with all trigger functions. - await childTask.trigger({ message: "Hello, world!" }, { machine: "small-2x" }); - await childTask.triggerAndWait({ message: "Hello, world!" }, { machine: "small-2x" }); + await childTask.trigger( + { message: "Hello, world!" }, + { machine: "small-2x" }, + ); + await childTask.triggerAndWait( + { message: "Hello, world!" }, + { machine: "small-2x" }, + ); await childTask.batchTrigger([ { payload: { message: "Hello, world!" }, options: { machine: "micro" } }, @@ -1282,7 +1350,7 @@ await tasks.trigger( "child", { message: "Hello, world!" }, - { machine: "small-2x" } + { machine: "small-2x" }, ); await tasks.batchTrigger("child", [ { payload: { message: "Hello, world!" }, options: { machine: "micro" } }, @@ -1379,7 +1447,6 @@ ### Minor Changes - Improved Batch Triggering: ([#1502](https://github.com/triggerdotdev/trigger.dev/pull/1502)) - - The new Batch Trigger endpoint is now asynchronous and supports up to 500 runs per request. - The new endpoint also supports triggering multiple different tasks in a single batch request (support in the SDK coming soon). - The existing `batchTrigger` method now supports the new endpoint, and shouldn't require any changes to your code. @@ -1393,14 +1460,19 @@ }); // Works for individual items as well: await myTask.batchTrigger([ - { payload: { foo: "bar" }, options: { idempotencyKey: "my-key", idempotencyKeyTTL: "60s" } }, + { + payload: { foo: "bar" }, + options: { idempotencyKey: "my-key", idempotencyKeyTTL: "60s" }, + }, ]); // And `trigger`: - await myTask.trigger({ foo: "bar" }, { idempotencyKey: "my-key", idempotencyKeyTTL: "60s" }); + await myTask.trigger( + { foo: "bar" }, + { idempotencyKey: "my-key", idempotencyKeyTTL: "60s" }, + ); ``` ### Breaking Changes - - We've removed the `idempotencyKey` option from `triggerAndWait` and `batchTriggerAndWait`, because it can lead to permanently frozen runs in deployed tasks. We're working on upgrading our entire system to support idempotency keys on these methods, and we'll re-add the option once that's complete. ### Patch Changes @@ -1675,7 +1747,10 @@ Before: ```ts - await yourTask.trigger({ payload: { foo: "bar" }, options: { idempotencyKey: "key_1234" } }); + await yourTask.trigger({ + payload: { foo: "bar" }, + options: { idempotencyKey: "key_1234" }, + }); await yourTask.triggerAndWait({ payload: { foo: "bar" }, options: { idempotencyKey: "key_1234" }, @@ -1695,8 +1770,14 @@ await yourTask.trigger({ foo: "bar" }, { idempotencyKey: "key_1234" }); await yourTask.triggerAndWait({ foo: "bar" }, { idempotencyKey: "key_1234" }); - await yourTask.batchTrigger([{ payload: { foo: "bar" } }, { payload: { foo: "baz" } }]); - await yourTask.batchTriggerAndWait([{ payload: { foo: "bar" } }, { payload: { foo: "baz" } }]); + await yourTask.batchTrigger([ + { payload: { foo: "bar" } }, + { payload: { foo: "baz" } }, + ]); + await yourTask.batchTriggerAndWait([ + { payload: { foo: "bar" } }, + { payload: { foo: "baz" } }, + ]); ``` We've also changed the API of the `triggerAndWait` result. Before, if the subtask that was triggered finished with an error, we would automatically "rethrow" the error in the parent task. @@ -1729,7 +1810,6 @@ ``` - 26093896d: When using idempotency keys, triggerAndWait and batchTriggerAndWait will still work even if the existing runs have already been completed (or even partially completed, in the case of batchTriggerAndWait) - - TaskRunExecutionResult.id is now the run friendlyId, not the attempt friendlyId - A single TaskRun can now have many batchItems, in the case of batchTriggerAndWait while using idempotency keys - A run’s idempotencyKey is now added to the ctx as well as the TaskEvent and displayed in the span view @@ -2204,7 +2284,10 @@ Before: ```ts - await yourTask.trigger({ payload: { foo: "bar" }, options: { idempotencyKey: "key_1234" } }); + await yourTask.trigger({ + payload: { foo: "bar" }, + options: { idempotencyKey: "key_1234" }, + }); await yourTask.triggerAndWait({ payload: { foo: "bar" }, options: { idempotencyKey: "key_1234" }, @@ -2224,8 +2307,14 @@ await yourTask.trigger({ foo: "bar" }, { idempotencyKey: "key_1234" }); await yourTask.triggerAndWait({ foo: "bar" }, { idempotencyKey: "key_1234" }); - await yourTask.batchTrigger([{ payload: { foo: "bar" } }, { payload: { foo: "baz" } }]); - await yourTask.batchTriggerAndWait([{ payload: { foo: "bar" } }, { payload: { foo: "baz" } }]); + await yourTask.batchTrigger([ + { payload: { foo: "bar" } }, + { payload: { foo: "baz" } }, + ]); + await yourTask.batchTriggerAndWait([ + { payload: { foo: "bar" } }, + { payload: { foo: "baz" } }, + ]); ``` We've also changed the API of the `triggerAndWait` result. Before, if the subtask that was triggered finished with an error, we would automatically "rethrow" the error in the parent task. @@ -2258,7 +2347,6 @@ ``` - 26093896d: When using idempotency keys, triggerAndWait and batchTriggerAndWait will still work even if the existing runs have already been completed (or even partially completed, in the case of batchTriggerAndWait) - - TaskRunExecutionResult.id is now the run friendlyId, not the attempt friendlyId - A single TaskRun can now have many batchItems, in the case of batchTriggerAndWait while using idempotency keys - A run’s idempotencyKey is now added to the ctx as well as the TaskEvent and displayed in the span view diff --git a/packages/trigger-sdk/package.json b/packages/trigger-sdk/package.json index 87591c52420..c839d28ee9b 100644 --- a/packages/trigger-sdk/package.json +++ b/packages/trigger-sdk/package.json @@ -1,6 +1,6 @@ { "name": "@trigger.dev/sdk", - "version": "4.5.0-rc.7", + "version": "4.5.0-rc.8", "description": "trigger.dev Node.JS SDK", "license": "MIT", "publishConfig": { @@ -77,7 +77,7 @@ "dependencies": { "@opentelemetry/api": "1.9.1", "@opentelemetry/semantic-conventions": "1.41.1", - "@trigger.dev/core": "workspace:4.5.0-rc.7", + "@trigger.dev/core": "workspace:4.5.0-rc.8", "chalk": "^5.2.0", "cronstrue": "^2.21.0", "debug": "^4.3.4", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7c3d6c10478..fee52b34c19 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1572,7 +1572,7 @@ importers: specifier: ^6.10.0 version: 6.19.0(magicast@0.3.5) '@trigger.dev/core': - specifier: workspace:4.5.0-rc.7 + specifier: workspace:4.5.0-rc.8 version: link:../core mlly: specifier: ^1.7.1 @@ -1648,13 +1648,13 @@ importers: specifier: ^0.22.10 version: 0.22.10(supports-color@10.0.0) '@trigger.dev/build': - specifier: workspace:4.5.0-rc.7 + specifier: workspace:4.5.0-rc.8 version: link:../build '@trigger.dev/core': - specifier: workspace:4.5.0-rc.7 + specifier: workspace:4.5.0-rc.8 version: link:../core '@trigger.dev/schema-to-json': - specifier: workspace:4.5.0-rc.7 + specifier: workspace:4.5.0-rc.8 version: link:../schema-to-json ansi-escapes: specifier: ^7.0.0 @@ -2047,7 +2047,7 @@ importers: packages/python: dependencies: '@trigger.dev/core': - specifier: workspace:4.5.0-rc.7 + specifier: workspace:4.5.0-rc.8 version: link:../core tinyexec: specifier: ^0.3.2 @@ -2057,10 +2057,10 @@ importers: specifier: ^0.15.4 version: 0.15.4 '@trigger.dev/build': - specifier: workspace:4.5.0-rc.7 + specifier: workspace:4.5.0-rc.8 version: link:../build '@trigger.dev/sdk': - specifier: workspace:4.5.0-rc.7 + specifier: workspace:4.5.0-rc.8 version: link:../trigger-sdk '@types/node': specifier: 20.14.14 @@ -2084,7 +2084,7 @@ importers: packages/react-hooks: dependencies: '@trigger.dev/core': - specifier: workspace:^4.5.0-rc.7 + specifier: workspace:^4.5.0-rc.8 version: link:../core react: specifier: 18.3.1 @@ -2118,7 +2118,7 @@ importers: packages/redis-worker: dependencies: '@trigger.dev/core': - specifier: workspace:4.5.0-rc.7 + specifier: workspace:4.5.0-rc.8 version: link:../core cron-parser: specifier: ^4.9.0 @@ -2167,7 +2167,7 @@ importers: packages/rsc: dependencies: '@trigger.dev/core': - specifier: workspace:^4.5.0-rc.7 + specifier: workspace:^4.5.0-rc.8 version: link:../core mlly: specifier: ^1.7.1 @@ -2183,7 +2183,7 @@ importers: specifier: ^0.15.4 version: 0.15.4 '@trigger.dev/build': - specifier: workspace:^4.5.0-rc.7 + specifier: workspace:^4.5.0-rc.8 version: link:../build '@types/node': specifier: 20.14.14 @@ -2262,7 +2262,7 @@ importers: specifier: 1.41.1 version: 1.41.1 '@trigger.dev/core': - specifier: workspace:4.5.0-rc.7 + specifier: workspace:4.5.0-rc.8 version: link:../core chalk: specifier: ^5.2.0