Files
triggerdotdev--trigger.dev/packages/core/src
Eric Allam 0eb750fa34 feat(sdk,core): Session client SDK + hello-world smoke test
Client-side pair to the Session primitive server PR (TRI-8627).
Run-scoped streams.pipe / streams.input are untouched.

@trigger.dev/core ApiClient
- createSession / retrieveSession / updateSession / closeSession —
  zodfetch against /api/v1/sessions control plane
- listSessions — CursorPagePromise<SessionItem>, follows the runs/waitpoints
  convention (page[size], page[after], page[before] + filter[*])
- initializeSessionStream — PUT /realtime/v1/sessions/:session/:io,
  returns S2 creds in headers (feeds StreamsWriterV2 directly)
- appendToSessionStream — POST …/append
- subscribeToSessionStream — reuses SSEStreamSubscription for SSE
  subscribes (auto-retry, Last-Event-ID resume, abort propagation), so
  session subscribers get the exact same semantics as runs.fetchStream.
  Returns AsyncIterableStream<T>.

@trigger.dev/sdk sessions namespace
- sessions.create / retrieve / update / close / list — wraps the ApiClient
  with the standard tracer + accessoryAttributes + mergeRequestOptions.
  Returns ApiPromise / CursorPagePromise.
- sessions.open(id) returns a SessionHandle with .out and .in
  SessionChannels. Each channel exposes append / send / subscribe /
  initialize. The handle is polymorphic on friendlyId or externalId.
- auth.ts adds the `sessions` permission on PublicTokenPermissionProperties
  so auth.createPublicToken({ read: { sessions: ["session_abc"] } }) works.

Reference
- references/hello-world/src/trigger/sessionsSmoke.ts — idempotent
  Trigger.dev task that exercises every code path (control-plane CRUD,
  polymorphic lookup, list with tag/type/status/externalId filters, cursor
  pagination, out.initialize + append + subscribe SSE round-trip, in.send,
  close + idempotent re-close). Trigger via
  mcp__trigger__trigger_task(taskId: "sessions-smoke").

Verified live against the local webapp (project hello-world): 10/10
steps pass end-to-end, S2 round-trip returns appended chunks through the
shared SSEStreamSubscription pipeline.
2026-05-05 11:06:25 +01:00
..
2025-03-08 14:53:06 +00:00
2025-03-05 14:40:14 +00:00
2025-03-08 14:53:06 +00:00
2025-03-08 14:53:06 +00:00
2024-08-23 13:10:15 +01:00