Skip to content

Commit 27d4a8f

Browse files
authored
Merge branch 'main' into feat/runtime-api-origin
2 parents da151f6 + 37eeaa3 commit 27d4a8f

291 files changed

Lines changed: 23380 additions & 1816 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.

.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
}

.github/workflows/changesets-pr.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ jobs:
2222
permissions:
2323
contents: write
2424
pull-requests: write
25+
checks: write
2526
if: github.repository == 'triggerdotdev/trigger.dev'
2627
steps:
2728
- name: Checkout
@@ -72,3 +73,27 @@ jobs:
7273
-f body="$ENHANCED_BODY"
7374
fi
7475
fi
76+
77+
# The changesets bot authors release PRs with GITHUB_TOKEN, which by GitHub
78+
# design cannot trigger downstream workflows. That leaves the required
79+
# "All PR Checks" status permanently Expected and the PR unmergeable.
80+
# The release PR only bumps package.json + lockfile + CHANGELOGs from
81+
# changesets already on main, so we self-report the required check as
82+
# success. If a human ever pushes to changeset-release/main, the real
83+
# pr_checks.yml fires and its result overwrites this one (last write wins
84+
# for the same context on the same SHA).
85+
- name: Self-report "All PR Checks" success on release PR
86+
if: steps.changesets.outputs.published != 'true'
87+
env:
88+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
89+
run: |
90+
PR_NUMBER=$(gh pr list --head changeset-release/main --json number --jq '.[0].number')
91+
if [ -z "$PR_NUMBER" ]; then exit 0; fi
92+
HEAD_SHA=$(gh pr view "$PR_NUMBER" --json headRefOid --jq '.headRefOid')
93+
gh api -X POST repos/${{ github.repository }}/check-runs \
94+
-f name="All PR Checks" \
95+
-f head_sha="$HEAD_SHA" \
96+
-f status=completed \
97+
-f conclusion=success \
98+
-f 'output[title]=Auto-pass for changeset release PR' \
99+
-f 'output[summary]=Required check auto-satisfied for changeset-release/main PRs. Full CI ran on the underlying commits before they landed on main.'
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: Dependabot Critical Alerts
2+
3+
on:
4+
schedule:
5+
- cron: "0 8 * * *" # Daily 08:00 UTC
6+
workflow_dispatch:
7+
inputs:
8+
severity:
9+
description: "Severity to alert on"
10+
type: choice
11+
options:
12+
- critical
13+
- high
14+
- medium
15+
- low
16+
default: critical
17+
18+
concurrency:
19+
group: ${{ github.workflow }}
20+
cancel-in-progress: false
21+
22+
permissions:
23+
contents: read
24+
25+
jobs:
26+
alert:
27+
name: Post critical alerts
28+
runs-on: ubuntu-latest
29+
environment: dependabot-summary
30+
env:
31+
SEVERITY: ${{ inputs.severity || 'critical' }}
32+
steps:
33+
- name: Fetch alerts
34+
id: alerts
35+
env:
36+
GH_TOKEN: ${{ secrets.DEPENDABOT_ALERTS_TOKEN }}
37+
REPO: ${{ github.repository }}
38+
run: |
39+
set -euo pipefail
40+
gh api -X GET "/repos/$REPO/dependabot/alerts" \
41+
-F state=open -F severity="$SEVERITY" --paginate > pages.json
42+
jq -s 'add' pages.json > alerts.json
43+
TOTAL=$(jq 'length' alerts.json)
44+
echo "total=$TOTAL" >> "$GITHUB_OUTPUT"
45+
if [ "$TOTAL" = "0" ]; then
46+
exit 0
47+
fi
48+
LIST=$(jq -r '
49+
map("• <\(.html_url)|#\(.number)> *\(.dependency.package.name)* - \(.security_advisory.summary)")
50+
| join("\n")
51+
' alerts.json)
52+
{
53+
echo "list<<EOF"
54+
echo "$LIST"
55+
echo "EOF"
56+
} >> "$GITHUB_OUTPUT"
57+
58+
- name: Build Slack payload
59+
if: steps.alerts.outputs.total != '0'
60+
env:
61+
REPO: ${{ github.repository }}
62+
CHANNEL: ${{ vars.SLACK_CHANNEL_ID }}
63+
TOTAL: ${{ steps.alerts.outputs.total }}
64+
LIST: ${{ steps.alerts.outputs.list }}
65+
run: |
66+
jq -n \
67+
--arg channel "$CHANNEL" \
68+
--arg repo "$REPO" \
69+
--arg total "$TOTAL" \
70+
--arg list "$LIST" \
71+
--arg severity "$SEVERITY" \
72+
'{
73+
channel: $channel,
74+
text: ":bufo-alarma: `\($repo)` - *\($total) open \($severity) alert(s)*\n\($list)\n\n<https://github.com/\($repo)/security/dependabot?q=is%3Aopen+severity%3A\($severity)|View \($severity) alerts>"
75+
}' > payload.json
76+
77+
- name: Post Slack alert
78+
if: steps.alerts.outputs.total != '0'
79+
uses: slackapi/slack-github-action@45a88b9581bfab2566dc881e2cd66d334e621e2c # v3.0.3
80+
with:
81+
method: chat.postMessage
82+
token: ${{ secrets.SLACK_BOT_TOKEN }}
83+
payload-file-path: payload.json

.github/workflows/vouch-check-pr.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ jobs:
3232
github.event.pull_request.author_association != 'OWNER' &&
3333
github.event.pull_request.author_association != 'COLLABORATOR' &&
3434
github.event.pull_request.user.login != 'devin-ai-integration[bot]' &&
35-
github.event.pull_request.user.login != 'dependabot[bot]'
35+
github.event.pull_request.user.login != 'dependabot[bot]' &&
36+
github.event.pull_request.user.login != 'github-actions[bot]'
3637
runs-on: ubuntu-latest
3738
steps:
3839
- name: Close non-draft PR

0 commit comments

Comments
 (0)