Skip to content

Commit 81b2d51

Browse files
merge: bring upstream v4.5.0-rc.2 into gs-v4.4.4
Co-authored-by: Cursor <cursoragent@cursor.com> # Conflicts: # hosting/k8s/helm/Chart.yaml
2 parents f392a80 + d34014d commit 81b2d51

393 files changed

Lines changed: 33966 additions & 3628 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
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 `chat.agent` skills silently missing in `trigger dev` for projects whose task files read `process.env` at module top level (e.g. a third-party SDK client initialized at import). Skill folders now bundle into `.trigger/skills/` reliably regardless of which env vars are set when the CLI launches.

.changeset/chat-slim-wire-merge.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
"@trigger.dev/sdk": patch
3+
---
4+
5+
Fix `chat.agent` HITL continuations on reasoning-heavy turns. Two changes that work together:
6+
7+
- 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).
8+
- `TriggerChatTransport.sendMessages` and `AgentChat.sendRaw` now slim assistant messages that carry advanced tool parts. The wire payload is just `{ id, role, parts: [<state + resolution field>] }` 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.
9+
10+
Note: `onValidateMessages` receives the slim wire on HITL turns. If you call `validateUIMessages` from `ai` against the full `messages` array it will reject the slim assistant; filter to user messages (or skip on HITL turns) — see the updated docstring on `onValidateMessages` for the recommended pattern.
11+
12+
For `hydrateMessages` hooks that persist the chain, this release also adds a small helper to the `@trigger.dev/sdk/ai` surface:
13+
14+
```ts
15+
import { chat, upsertIncomingMessage } from "@trigger.dev/sdk/ai";
16+
17+
chat.agent({
18+
hydrateMessages: async ({ chatId, trigger, incomingMessages }) => {
19+
const record = await db.chat.findUnique({ where: { id: chatId } });
20+
const stored = record?.messages ?? [];
21+
if (upsertIncomingMessage(stored, { trigger, incomingMessages })) {
22+
await db.chat.update({ where: { id: chatId }, data: { messages: stored } });
23+
}
24+
return stored;
25+
},
26+
});
27+
```
28+
29+
It pushes fresh user messages by id, no-ops on HITL continuations (the incoming shares an id with the existing assistant — the runtime overlays the new tool-state advance), and skips on non-`submit-message` triggers. Returns `true` if it mutated `stored` so the caller knows whether to persist.
30+
31+
Net effect: `chat.addToolOutput(...)` / `chat.addToolApproveResponse(...)` on multi-step reasoning agents (OpenAI Responses with `store: false`, Anthropic extended thinking, etc.) no longer blows the cap and no longer corrupts the LLM input.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
"@trigger.dev/sdk": patch
3+
---
4+
5+
Type `chat.createStartSessionAction` against your chat agent so `clientData` is typed end-to-end on the first turn:
6+
7+
```ts
8+
import { chat } from "@trigger.dev/sdk/ai";
9+
import type { myChat } from "@/trigger/chat";
10+
11+
export const startChatSession = chat.createStartSessionAction<typeof myChat>("my-chat");
12+
13+
// In the browser, threaded from the transport's typed startSession callback:
14+
const transport = useTriggerChatTransport<typeof myChat>({
15+
task: "my-chat",
16+
startSession: ({ chatId, clientData }) =>
17+
startChatSession({ chatId, clientData }),
18+
// ...
19+
});
20+
```
21+
22+
`ChatStartSessionParams` gains a typed `clientData` field — folded into the first run's `payload.metadata` so `onPreload` / `onChatStart` see the same shape per-turn `metadata` carries via the transport. The opaque session-level `metadata` field is unchanged.
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 `TRIGGER_BUILD_SKIP_REWRITE_TIMESTAMP=1` escape hatch for local self-hosted builds whose buildx driver doesn't support `rewrite-timestamp` alongside push (e.g. orbstack's default `docker` driver).
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
"@trigger.dev/redis-worker": patch
3+
---
4+
5+
Add MollifierBuffer and MollifierDrainer primitives for trigger burst smoothing.
6+
7+
MollifierBuffer (`accept`, `pop`, `ack`, `requeue`, `fail`, `evaluateTrip`) is a per-env FIFO over Redis with atomic Lua transitions for status tracking. `evaluateTrip` is a sliding-window trip evaluator the webapp gate uses to detect per-env trigger bursts.
8+
9+
MollifierDrainer pops entries through a polling loop with a user-supplied handler. The loop survives transient Redis errors via capped exponential backoff (up to 5s), and per-env pop failures don't poison the rest of the batch — one env's blip is logged and counted as failed for that tick. Rotation is two-level: orgs at the top, envs within each org. The buffer maintains `mollifier:orgs` and `mollifier:org-envs:${orgId}` atomically with per-env queues, so the drainer walks orgs → envs directly without an in-memory cache. The `maxOrgsPerTick` option (default 500) caps how many orgs are scheduled per tick; for each picked org, one env is popped (rotating round-robin within the org). An org with N envs gets the same per-tick scheduling slot as an org with 1 env, so tenant-level drainage throughput is determined by org count rather than env count.

.changeset/pre.json

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,29 @@
1818
"@trigger.dev/schema-to-json": "4.4.6",
1919
"@trigger.dev/sdk": "4.4.6"
2020
},
21-
"changesets": []
21+
"changesets": [
22+
"agent-skills",
23+
"ai-prompts",
24+
"ai-tool-helpers",
25+
"bundle-skills-single-pass",
26+
"cap-idempotency-key-length",
27+
"chat-agent-on-boot-hook",
28+
"chat-agent",
29+
"chat-history-read-primitives",
30+
"chat-session-attributes",
31+
"chat-slim-wire-merge",
32+
"chat-start-session-action-typed-client-data",
33+
"cli-deploy-skip-rewrite-timestamp",
34+
"locals-key-dual-package-fix",
35+
"mcp-agent-chat-sessions",
36+
"mcp-list-runs-region",
37+
"mock-chat-agent-test-harness",
38+
"mollifier-redis-worker-primitives",
39+
"plugin-auth-path",
40+
"resource-catalog-runtime-registration",
41+
"retry-sigsegv",
42+
"runs-list-region-filter",
43+
"sessions-primitive",
44+
"trigger-client"
45+
]
2246
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@trigger.dev/core": patch
3+
"trigger.dev": patch
4+
---
5+
6+
Fix `COULD_NOT_FIND_EXECUTOR` when a task's definition is loaded via `await import(...)` from inside another task's `run()`. The runtime workers now register such tasks with a sentinel file context, and the catalog logs a one-time warning per task id.

.changeset/trigger-client.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
"@trigger.dev/sdk": patch
3+
---
4+
5+
Add `TriggerClient` for running multiple SDK clients side-by-side, each with its own auth, preview branch, and baseURL. Useful when a single process needs to trigger tasks or read runs across multiple projects, environments, or preview branches without mutating shared global state.
6+
7+
```ts
8+
import { TriggerClient } from "@trigger.dev/sdk";
9+
10+
const prod = new TriggerClient({ accessToken: process.env.TRIGGER_PROD_KEY });
11+
const preview = new TriggerClient({
12+
accessToken: process.env.TRIGGER_PREVIEW_KEY,
13+
previewBranch: "signup-flow",
14+
});
15+
16+
await prod.tasks.trigger("send-email", payload);
17+
await preview.runs.list({ status: ["COMPLETED"] });
18+
```

.cursor/mcp.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
{
2-
"mcpServers": {}
2+
"mcpServers": {
3+
"linear": {
4+
"url": "https://mcp.linear.app/mcp"
5+
}
6+
}
37
}

.env.example

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,52 @@ REDIS_TLS_DISABLED="true"
2929
DEV_OTEL_EXPORTER_OTLP_ENDPOINT="http://localhost:3030/otel"
3030
DEV_OTEL_BATCH_PROCESSING_ENABLED="0"
3131

32+
# Realtime streams v2 (Sessions, chat.agent, large stream backfills) backed
33+
# by S2 (https://s2.dev). The `s2` service in docker/docker-compose.yml runs
34+
# the open-source s2-lite binary and pre-creates a basin named `trigger-local`
35+
# (see docker/config/s2-spec.json). Comment these out to fall back to v1
36+
# (Redis-only) streams; Sessions and chat.agent then become unavailable.
37+
REALTIME_STREAMS_S2_BASIN=trigger-local
38+
REALTIME_STREAMS_S2_ACCESS_TOKEN=ignored
39+
REALTIME_STREAMS_S2_ENDPOINT=http://localhost:4566/v1
40+
REALTIME_STREAMS_S2_SKIP_ACCESS_TOKENS=true
41+
REALTIME_STREAMS_DEFAULT_VERSION=v2
42+
43+
# Running multiple instances side by side (worktrees, branch experiments)
44+
#
45+
# Every host port in docker/docker-compose.yml is `${VAR:-default}` and the
46+
# project name comes from `COMPOSE_PROJECT_NAME`. To stand up a second stack
47+
# alongside the default one, uncomment the block below in this clone's `.env`
48+
# (pick any offset that doesn't clash with anything else running), then update
49+
# the URL/PORT vars further up to match. Default values are commented for
50+
# reference.
51+
#
52+
# --- core (pnpm run docker) ---
53+
# COMPOSE_PROJECT_NAME=triggerdotdev-docker-alt
54+
# CONTAINER_PREFIX=alt-
55+
# POSTGRES_HOST_PORT=15432 # default 5432
56+
# REDIS_HOST_PORT=16379 # default 6379
57+
# ELECTRIC_HOST_PORT=13060 # default 3060
58+
# MINIO_API_HOST_PORT=19005 # default 9005
59+
# MINIO_CONSOLE_HOST_PORT=19006 # default 9006
60+
# CLICKHOUSE_HTTP_HOST_PORT=18123 # default 8123
61+
# CLICKHOUSE_TCP_HOST_PORT=19000 # default 9000
62+
# S2_HOST_PORT=14566 # default 4566
63+
# REMIX_APP_PORT=13030 # default 3030
64+
# --- extras (only needed if you also run `pnpm run docker:full`) ---
65+
# ELECTRIC_SHARD_1_HOST_PORT=13061 # default 3061
66+
# CH_UI_HOST_PORT=15521 # default 5521
67+
# TOXIPROXY_PROXY_HOST_PORT=40303 # default 30303
68+
# TOXIPROXY_API_HOST_PORT=18474 # default 8474
69+
# NGINX_H2_HOST_PORT=18443 # default 8443
70+
# OTEL_GRPC_HOST_PORT=14317 # default 4317
71+
# OTEL_HTTP_HOST_PORT=14318 # default 4318
72+
# OTEL_PROMETHEUS_HOST_PORT=18889 # default 8889
73+
# PROMETHEUS_HOST_PORT=19090 # default 9090
74+
# GRAFANA_HOST_PORT=13001 # default 3001
75+
# (and update DATABASE_URL / CLICKHOUSE_URL / REDIS_PORT / APP_ORIGIN /
76+
# LOGIN_ORIGIN / ELECTRIC_ORIGIN / REALTIME_STREAMS_S2_ENDPOINT to match)
77+
3278
# When the domain is set to `localhost` the CLI deploy command will only --load the image by default and not --push it
3379
DEPLOY_REGISTRY_HOST=localhost:5000
3480

@@ -106,7 +152,7 @@ POSTHOG_PROJECT_KEY=
106152
# INTERNAL_OTEL_TRACE_LOGGING_ENABLED=1
107153
# INTERNAL_OTEL_TRACE_INSTRUMENT_PRISMA_ENABLED=0
108154

109-
# Enable local observability stack (requires `pnpm run docker` to start otel-collector)
155+
# Enable local observability stack (requires `pnpm run docker:full` to bring up otel-collector + prometheus + grafana)
110156
# Uncomment these to send metrics to the local Prometheus via OTEL Collector:
111157
# INTERNAL_OTEL_METRIC_EXPORTER_ENABLED=1
112158
# INTERNAL_OTEL_METRIC_EXPORTER_URL=http://localhost:4318/v1/metrics

0 commit comments

Comments
 (0)