Files
triggerdotdev--trigger.dev/packages
Eric Allam f063a2ffe0 feat(sdk): chat.headStart for fast first-turn TTFC
Adds an opt-in fast path that runs step 1 streamText in the warm
customer process (Next.js, Hono, Workers, Express, etc.) while the
trigger agent run boots in parallel. Pure-text turns finish on the
handler side; tool-call turns hand ownership to the agent at the
tool-call boundary via a `kind: "handover"` chunk on session.in.

- New @trigger.dev/sdk/chat-server subpath with chat.headStart,
  chat.openSession (escape hatch), and chat.toNodeListener (Express /
  Fastify / Koa bridge from Web Fetch handler to (req, res)).
- Wire-format: ChatInputChunk gains kind: "handover" with isFinal flag
  and partialAssistantMessage; trigger payload kind: "handover-prepare"
  for the boot-and-wait variant.
- Run-loop: handover-prepare branch waits on session.in, then either
  skips userRun (isFinal: true → pure-text) or seeds accumulators and
  resumes step 2+ from tool-output-available (isFinal: false).
- Browser: TriggerChatTransport gains an optional `headStart` URL.
  First-turn POSTs go there; turn 2+ bypasses and writes session.in.
- Tests: chat-server.test.ts (handover dispatch, isFinal routing) and
  chatHandover.test.ts (run-loop branching, hook ordering, idle-timeout
  exit, schema-only-on-handler / executes-on-agent tool round).
2026-05-10 22:11:25 +01:00
..
2026-05-01 15:13:11 +01:00
2026-05-01 15:13:11 +01:00
2026-05-01 15:13:11 +01:00