Skip to content

feat(sdk/typescript): trigger system parity — dispatch, sugar, testing, demo - #796

Merged
santoshkumarradha merged 1 commit into
Agent-Field:mainfrom
7vignesh:feat/ts-sdk-trigger-parity-510-511-512
Jul 19, 2026
Merged

feat(sdk/typescript): trigger system parity — dispatch, sugar, testing, demo#796
santoshkumarradha merged 1 commit into
Agent-Field:mainfrom
7vignesh:feat/ts-sdk-trigger-parity-510-511-512

Conversation

@7vignesh

Copy link
Copy Markdown
Contributor

Summary

Brings the TypeScript SDK to trigger system feature parity with the Python SDK (#507). Implements:


Type of Change

  • Bug fix
  • New feature
  • Refactor / cleanup
  • Docs only
  • Tests only
  • CI / tooling
  • Breaking change

Test Plan

  • cd sdk/typescript && npx tsc --noEmit — TypeScript compilation clean
  • cd sdk/typescript && npm run build — ESM + DTS build success
  • cd sdk/typescript && npx vitest run744 tests pass (75 files), 0 failures
  • cd sdk/typescript && npx vitest run tests/triggers_dispatch.test.ts tests/triggers_sugar.test.ts tests/triggers_testing.test.ts tests/triggers.test.ts74 trigger-specific tests pass
  • cd examples/triggers-demo-ts && docker compose up --build — control-plane + ts-agent start, fire-events.sh dispatches successfully (manual, requires Docker)

Test Coverage

  • I ran tests for the surface(s) I changed locally.
  • New code paths are covered by tests in this PR (no bare additions).
  • If I removed code, I updated coverage-baseline.json in this PR only if the removal caused a legitimate regression and I called it out in the summary above.
  • The coverage gate check is green in CI before requesting review.

New Test Files — 74 Tests Total

File Tests Covers
tests/triggers_dispatch.test.ts 25 Envelope detection, unwrap, transform, Agent integration
tests/triggers_sugar.test.ts 12 onEvent / onSchedule registration parity, dispatch
tests/triggers_testing.test.ts 19 simulateTrigger, simulateSchedule, loadFixture, all 6 fixtures
tests/triggers.test.ts (existing) 20 Types, factories, registration — unchanged, regression-free

Checklist


Related Issues / PRs

Reference Description
Closes #510 Dispatch envelope unwrap + TriggerContext injection
Closes #511 onEvent / onSchedule sugar + test helpers + fixtures
Closes #512 examples/triggers-demo-ts end-to-end demo + skill docs
Parent epic #507 [TypeScript SDK] Trigger system parity
Depends on #509 (closed)
Depends on #506 (closed)

…g, demo (Agent-Field#510, Agent-Field#511, Agent-Field#512)

Implements the three remaining sub-issues of the TypeScript SDK trigger
parity epic (Agent-Field#507):

Agent-Field#510 — Dispatch envelope unwrap + TriggerContext injection
- New src/triggers/dispatch.ts: isTriggerEnvelope(), unwrapEnvelope(),
  applyTriggerTransform() — detects {event, _meta} envelope shape from
  the control plane dispatcher, constructs TriggerContext, applies the
  matched binding's transform
- ReasonerContext gains trigger?: TriggerContext field
- Agent.ts runReasoner() and local call() path wired to unwrap envelopes
- Direct calls (no envelope) pass through unchanged

Agent-Field#511 — onEvent/onSchedule sugar + test helpers + fixtures
- Agent.ts: app.onEvent(spec, handler) and app.onSchedule(cron, handler)
  sugar methods that forward to app.reasoner() with triggers
- New src/triggers/testing.ts: simulateTrigger(), simulateSchedule(),
  loadFixture() for unit testing without a control plane
- Copied 6 fixture JSONs from Python SDK (stripe, github, slack, cron,
  generic_hmac, generic_bearer)

Agent-Field#512 — examples/triggers-demo-ts + skill docs
- New examples/triggers-demo-ts/: agent.ts (3 deterministic reasoners),
  Dockerfile, docker-compose.yml, README.md, fire-events.sh
- New skills/agentfield-multi-reasoner-builder/references/triggers.md
  with Python + TypeScript scaffold reference

Tests: 744 pass (75 files), including 74 new trigger-specific tests.
Build: tsc clean, tsup ESM+DTS success.
Copilot AI review requested due to automatic review settings July 18, 2026 17:46
@7vignesh
7vignesh requested review from a team and AbirAbbas as code owners July 18, 2026 17:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

Copy link
Copy Markdown
Contributor

Performance

SDK Memory Δ Latency Δ Tests Status
TS 502 B +43% 1.76 µs -12%

Regression detected:

  • TypeScript memory: 350 B → 502 B (+43%)

@github-actions

Copy link
Copy Markdown
Contributor

📊 Coverage gate

Thresholds from .coverage-gate.toml: per-surface ≥ 84%, aggregate ≥ 85%, max per-surface regression ≤ 1.0 pp, max aggregate regression ≤ 0.50 pp.

Surface Current Baseline Δ
control-plane 86.90% 87.40% ↓ -0.50 pp 🟡
sdk-go 92.50% 92.00% ↑ +0.50 pp 🟢
sdk-python 93.82% 93.73% ↑ +0.09 pp 🟢
sdk-typescript 90.57% 90.42% ↑ +0.15 pp 🟢
web-ui 84.76% 84.79% ↓ -0.03 pp 🟡
aggregate 85.55% 85.75% ↓ -0.20 pp 🟡

✅ Gate passed

No surface regressed past the allowed threshold and the aggregate stayed above the floor.

@github-actions

Copy link
Copy Markdown
Contributor

📐 Patch coverage gate

Threshold: 80% on lines this PR touches vs origin/main (from .coverage-gate.toml:thresholds.min_patch).

Surface Touched lines Patch coverage Status
control-plane 0 ➖ no changes
sdk-go 0 ➖ no changes
sdk-python 0 ➖ no changes
sdk-typescript 71 95.00%
web-ui 0 ➖ no changes

✅ Patch gate passed

Every surface whose lines were touched by this PR has patch coverage at or above the threshold.

@santoshkumarradha santoshkumarradha left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for packaging the whole trigger parity slice together. I checked the dispatch path, the helper surface, and the trigger-focused TypeScript tests locally on the current head. The feature set lines up with #510, #511, and #512, and the direct-call path stays intact.

@santoshkumarradha
santoshkumarradha added this pull request to the merge queue Jul 19, 2026
Merged via the queue into Agent-Field:main with commit 95fe429 Jul 19, 2026
23 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

3 participants