You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(sdk,core): add TriggerClient for per-instance SDK configuration
`new TriggerClient({...})` exposes the management surface (tasks, runs,
schedules, envvars, batch, queues, deployments, prompts, auth) as an
explicit instance with its own auth, preview branch, and baseURL.
Multiple clients can coexist in one process without mutating shared
global state.
Identity fields (`accessToken`, `secretKey`, `previewBranch`) and
task-runtime reads (`parentRunId`, `lockToVersion`, `taskContext.ctx`)
are scope-only by default, so a call from inside a task does not leak
parent context into a trigger that hits a different project. `baseURL`
still falls back to `TRIGGER_API_URL` so local-dev and CI overrides
apply without forcing every consumer to pass it explicitly.
Two correctness fixes folded in:
- `configure()` actually overrides on second call (was silent no-op).
- `auth.withAuth()` is concurrency-safe (no longer mutates the global
config, uses an AsyncLocalStorage scope instead).
Ships with a `references/multi-client` reference project containing an
echo task, a fan-out task, and two external scripts that smoke-test the
isolation guarantees.
Run multiple SDK clients side-by-side. `new TriggerClient({...})` exposes the management API as an explicit instance with its own auth, preview branch, and baseURL, so a single process can trigger tasks across different projects, environments, or preview branches without mutating shared global state.
Instance calls are isolated by default: identity fields (auth, branch) and task-runtime reads (`parentRunId`, `lockToVersion`, `taskContext.ctx`) are scope-only, so a call from inside a task does not leak parent context into a trigger that hits a different project. `baseURL` still falls back to `TRIGGER_API_URL` so local-dev and CI overrides apply without forcing every consumer to pass it explicitly.
22
+
23
+
Also fixes `configure()` silently no-op-ing on the second call, and makes `auth.withAuth()` concurrency-safe (parallel calls with different configs no longer stomp each other).
0 commit comments