Skip to content

feat(integrations): add Trigger.dev integration#4974

Merged
waleedlatif1 merged 6 commits into
stagingfrom
feat/trigger-dev-integration
Jun 11, 2026
Merged

feat(integrations): add Trigger.dev integration#4974
waleedlatif1 merged 6 commits into
stagingfrom
feat/trigger-dev-integration

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • Add Trigger.dev integration covering the full management API: trigger and batch trigger tasks, get/list/cancel/replay/reschedule runs, update run metadata, schedules CRUD with activate/deactivate, env vars CRUD, and queue get/pause/resume (23 tools)
  • Add trigger_dev block with operation dropdown, JSON payload/batch-items/metadata code fields with wand support, list-run filters, and advanced-mode options
  • Add TriggerDevIcon and register tools/block in the registries
  • Generate docs page with manual intro section

Type of Change

  • New feature

Testing

Tested manually; typecheck, biome, blocks/tools registry test suites, and check:api-validation all pass

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Jun 11, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Jun 11, 2026 7:45pm

Request Review

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor

cursor Bot commented Jun 11, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Large new surface that calls Trigger.dev with secret keys and can expose env var values in run history; executor name normalization changes reference resolution for dotted block names (mitigated by collision rules and tests).

Overview
Adds a Trigger.dev integration end-to-end: ~44 API tools (tasks, runs, batches, schedules, env vars, queues, deployments, TRQL, waitpoints), a trigger_dev workflow block with operation-specific fields and wand helpers, docs, TriggerDevIcon, and registry/catalog wiring. Auth is a project secret API key (tr_); docs call out that env-var read operations return plaintext in workflow outputs.

Separately, normalizeName now strips dots (so names like Trigger.dev 1 resolve as <triggerdev1.field>), with BlockResolver collision rules favoring dot-free legacy names and UI paths (chat outputs, deploy streaming, connection drag tags, variables) switched to the shared helper. Cal.com display naming is corrected to Cal.com in block, docs, and integrations metadata.

Reviewed by Cursor Bugbot for commit a82a717. Configure here.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 506b284. Configure here.

@greptile-apps

greptile-apps Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds a full Trigger.dev management API integration to Sim, covering 42 tools (task triggering, run lifecycle management, schedules CRUD, env vars, queues, deployments, waitpoint tokens, and TRQL query). It also includes a normalizeName fix that strips dots from block names so blocks like "Trigger.dev 1" can be unambiguously referenced with the <triggerdev1.output> syntax.

  • 42 new tools registered under trigger_dev/, each with a shared utils.ts library for header building, JSON normalisation, and response mapping; output schemas are centralised as constants and reused across related tools.
  • normalizeName now strips . in addition to whitespace; collision resolution in BlockResolver ensures dot-free block names keep ownership of their normalised key so no previously working reference changes target.
  • Block definition (trigger_dev.ts, 1 259 lines) wires all operations to conditional subBlocks with wand-enabled code fields, advanced-mode options, and proper required conditions.

Confidence Score: 5/5

Safe to merge — the integration adds entirely new files, and the one cross-cutting change (stripping dots from normalised block names) is carefully guarded with collision-resolution logic and backed by tests covering the legacy-collision scenario.

All 42 tools follow consistent patterns with proper URL encoding, input normalisation via shared helpers, and centralised output schemas. The normalizeName change is safe: dotted names were already unreferenceable before this PR because the dot doubles as the path delimiter, so no existing workflow reference can regress. Collision resolution is tested for both iteration orders. No logic errors were found in the tool request builders or response transforms.

No files require special attention.

Important Files Changed

Filename Overview
apps/sim/executor/constants.ts normalizeName now strips dots; safe change since dotted names were never referenceable before (dot is the path delimiter).
apps/sim/executor/variables/resolvers/block.ts Collision resolution correctly gives dot-free names ownership of a normalised key; blockById is populated before the name-map check, so lookup is always valid.
apps/sim/tools/trigger_dev/utils.ts Shared utilities (header builder, JSON input normaliser, response mapper functions, centralised output-property schemas) are well-structured and reused consistently across all tools.
apps/sim/blocks/blocks/trigger_dev.ts Large block definition with 42 operations; conditional subBlock visibility, wand configs, and required flags are correctly wired for each operation group.
apps/sim/tools/trigger_dev/batch_trigger_task.ts Correctly targets the per-task batch endpoint /api/v1/tasks/{id}/batch; items schema (no task field) matches the documented spec for that endpoint.
apps/sim/tools/trigger_dev/import_env_vars.ts Properly validates variables is an array before sending; the count output is derived from submitted params (API response has no count) which is acceptable given the success flag covers failure.
apps/sim/tools/trigger_dev/types.ts Comprehensive type definitions with clear separation between raw API shapes (TriggerDevApi*) and normalised output shapes; no structural issues.

Sequence Diagram

sequenceDiagram
    participant W as Sim Workflow
    participant B as TriggerDev Block
    participant E as Sim Executor
    participant T as Trigger.dev API

    W->>B: Select operation
    B->>E: Resolve block variables via normalizeName
    E->>T: HTTP request with Bearer apiKey
    T-->>E: JSON response
    E->>W: Mapped output properties
Loading

Reviews (5): Last reviewed commit: "improvement(executor): dot-free names ke..." | Re-trigger Greptile

Comment thread apps/sim/tools/trigger_dev/batch_trigger_task.ts
Comment thread apps/sim/tools/trigger_dev/list_env_vars.ts
@greptile-apps

greptile-apps Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds a full Trigger.dev management integration with 23 tools covering task triggering, run lifecycle (get, list, cancel, replay, reschedule, update metadata), cron schedule CRUD (create, get, list, update, delete, activate, deactivate), environment variable CRUD, and queue operations (get, pause, resume). A trigger_dev block wires all operations behind a single dropdown with conditional sub-blocks, parseJsonInput/splitCommaSeparated helpers, and correct param-name remapping in tools.config.params.

  • All API endpoint versions are correct per the Trigger.dev OpenAPI spec: GET /api/v3/runs/{id}, POST /api/v2/runs/{id}/cancel, /api/v1/... for the rest; resume_queue correctly shares the /pause URL with action: 'resume' in the body, matching the documented single-endpoint design.
  • delete_schedule always returns deleted: true without reading the API response body, unlike the other destructive tools which read at least one response field.
  • list_env_vars and get_env_var surface plaintext environment variable values (potentially secrets) as first-class workflow output properties that persist in run history.

Confidence Score: 4/5

The integration is broadly correct — all endpoint versions, URL patterns, and request/response shapes match the Trigger.dev management API spec. Two quality observations (hardcoded deletion status, plaintext secret exposure in outputs) are non-blocking and don't affect core task-triggering functionality.

The implementation correctly uses the right API versions across all 23 tools (v1/v2/v3 per endpoint), param-name remapping is correctly merged by the executor, and the resume_queue URL is correct per the Trigger.dev spec. The two open points — delete_schedule ignoring the response body, and env-var tools surfacing plaintext secret values as workflow outputs — are real design gaps worth addressing before shipping to users.

apps/sim/tools/trigger_dev/delete_schedule.ts (hardcoded success), apps/sim/tools/trigger_dev/list_env_vars.ts and get_env_var.ts (plaintext secrets in outputs).

Security Review

  • list_env_vars (apps/sim/tools/trigger_dev/list_env_vars.ts) and get_env_var (apps/sim/tools/trigger_dev/get_env_var.ts) return plaintext environment variable values as workflow output properties. Secrets stored in Trigger.dev project environments (API keys, DB passwords, etc.) will appear in Sim's workflow run history and are accessible to downstream blocks. This is the intended behavior of the Trigger.dev management API, but users should be explicitly warned in tool descriptions and the docs page.
  • All apiKey params carry visibility: 'user-only', correctly preventing the secret key from being injected by the LLM or exposed in LLM context — consistent with the project's credential-handling rule.

Important Files Changed

Filename Overview
apps/sim/blocks/blocks/trigger_dev.ts Block wires 23 operations with correct param-name remapping and Number coercions; all sub-block conditions and tool registrations align.
apps/sim/tools/trigger_dev/utils.ts Shared utilities: header builder, JSON parser, URL builder, and five map* normalizers — well-structured with no issues found.
apps/sim/tools/trigger_dev/types.ts Comprehensive type definitions for raw API objects, normalized shapes, and response unions; consistent with the Trigger.dev API schema.
apps/sim/tools/trigger_dev/delete_schedule.ts Always returns deleted: true without reading the API response; potentially masks soft-failure responses from the API.
apps/sim/tools/trigger_dev/list_env_vars.ts Returns all env var values in plaintext as workflow output; correct per the management API design but secrets are exposed in run history.
apps/sim/tools/trigger_dev/get_env_var.ts Returns the plaintext env var value as a workflow output — same secret-exposure concern as list_env_vars.
apps/sim/tools/trigger_dev/resume_queue.ts Correctly uses the shared /pause endpoint with action: 'resume' in the body — matches the Trigger.dev OpenAPI spec.
apps/sim/tools/trigger_dev/trigger_task.ts Triggers a single task with optional payload, options, and tags; URL encoding, JSON parsing, and option assembly are all correct.
apps/sim/tools/trigger_dev/batch_trigger_task.ts Single-task batch trigger using correct /api/v1/tasks/{id}/batch endpoint; items array is validated and response mapped accurately.
apps/sim/tools/trigger_dev/cancel_run.ts Correctly uses /api/v2/runs/{runId}/cancel (the documented v2 cancel endpoint); clean implementation.
apps/sim/tools/trigger_dev/get_run.ts Uses the correct /api/v3/runs/{runId} endpoint and maps the full run detail shape.
apps/sim/tools/trigger_dev/list_runs.ts Correctly builds cursor-paginated URL with all documented filter parameters; response mapping and output schema are accurate.
apps/sim/tools/trigger_dev/reschedule_run.ts Uses /api/v1/runs/{runId}/reschedule with mapTriggerDevRunDetail — consistent with the Trigger.dev API returning RetrieveRunResponse for this endpoint.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    Block["trigger_dev Block\n(operation dropdown)"]
    Block --> T1["Trigger Task\n/api/v1/tasks/{id}/trigger"]
    Block --> T2["Batch Trigger Task\n/api/v1/tasks/{id}/batch"]
    Block --> R1["Get Run\n/api/v3/runs/{id}"]
    Block --> R2["List Runs\n/api/v1/runs"]
    Block --> R3["Cancel Run\n/api/v2/runs/{id}/cancel"]
    Block --> R4["Replay Run\n/api/v1/runs/{id}/replay"]
    Block --> R5["Reschedule Run\n/api/v1/runs/{id}/reschedule"]
    Block --> R6["Update Run Metadata\n/api/v1/runs/{id}/metadata"]
    Block --> S1["Schedule CRUD\n/api/v1/schedules/..."]
    Block --> E1["Env Var CRUD\n/api/v1/projects/{ref}/envvars/{env}/..."]
    Block --> Q1["Queue Ops\n/api/v1/queues/{name}/pause"]

    subgraph params ["tools.config.params remapping"]
        P1["filterTaskIdentifier → taskIdentifier"]
        P2["rescheduleDelay → delay"]
        P3["pageSize/page/perPage → Number()"]
    end

    Block --> params
Loading

Reviews (2): Last reviewed commit: "feat(integrations): add Trigger.dev inte..." | Re-trigger Greptile

Comment thread apps/sim/tools/trigger_dev/delete_schedule.ts
Comment thread apps/sim/tools/trigger_dev/list_env_vars.ts
Adds batch retrieve/results, run result/events/trace/tags, queue list and
concurrency override/reset, deployments, TRQL query + schema, waitpoint
tokens, env var import, and timezones (44 tools total). Marks
deduplicationKey required on create schedule and switches list-run filters
to the documented comma-separated form, both per the OpenAPI spec.
… resolve

References split on '.', so a block named "Hunter.io 1" could never be
resolved (the first path segment cut the name at the dot). normalizeName now
strips dots on both the tag-generation and lookup sides, which cannot break
any previously working reference. Aligns the inline normalizers in
connection drag-drop, deploy modal, output select, and tag dropdown, and
renames Cal Com to Cal.com now that dotted display names work.
@waleedlatif1 waleedlatif1 force-pushed the feat/trigger-dev-integration branch from 506b284 to f49784d Compare June 11, 2026 19:18
Reads the delete schedule response instead of hardcoding success, and adds
explicit plaintext-secret warnings to the env var read operations and docs.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

Comment thread apps/sim/tools/trigger_dev/delete_env_var.ts
Comment thread apps/sim/blocks/blocks/trigger_dev.ts
…ration

Advanced sub-block values with non-empty content are serialized regardless
of their operation condition, so values left over from a previously selected
operation could leak into another operation's API call (e.g., a trigger-task
idempotency key filtering the waitpoint list). The params function now routes
every shared or remapped param by the selected operation and clears it
otherwise. Also derives delete env var success from the response like
delete schedule, via a shared helper.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

Comment thread apps/sim/executor/constants.ts
…acy collisions

Name uniqueness is enforced at the normalized level on create and rename, so
new collisions cannot be created. For legacy workflows that already contain
names differing only by dots, the resolver now lets the dot-free name own the
reference key regardless of block order, so previously working references
never change targets.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit a82a717. Configure here.

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1 waleedlatif1 merged commit 354653b into staging Jun 11, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant