@trigger.dev/sdk 0.0.0-prerelease-20260909071038 → 0.0.0-prerelease-streamfix-20260909094302
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commonjs/imports/ai-runtime-cjs.cjs.map +1 -1
- package/dist/commonjs/imports/ai-runtime.js +0 -2
- package/dist/commonjs/v3/ai-shared.d.ts +0 -15
- package/dist/commonjs/v3/ai-shared.js +1 -35
- package/dist/commonjs/v3/ai-shared.js.map +1 -1
- package/dist/commonjs/v3/ai.d.ts +25 -275
- package/dist/commonjs/v3/ai.js +308 -1283
- package/dist/commonjs/v3/ai.js.map +1 -1
- package/dist/commonjs/v3/chat-client.d.ts +2 -11
- package/dist/commonjs/v3/chat-client.js +111 -227
- package/dist/commonjs/v3/chat-client.js.map +1 -1
- package/dist/commonjs/v3/chat-react.d.ts +0 -88
- package/dist/commonjs/v3/chat-react.js +1 -130
- package/dist/commonjs/v3/chat-react.js.map +1 -1
- package/dist/commonjs/v3/chat-server.d.ts +6 -42
- package/dist/commonjs/v3/chat-server.js +7 -52
- package/dist/commonjs/v3/chat-server.js.map +1 -1
- package/dist/commonjs/v3/chat.d.ts +10 -92
- package/dist/commonjs/v3/chat.js +73 -328
- package/dist/commonjs/v3/chat.js.map +1 -1
- package/dist/commonjs/v3/sessions.d.ts +2 -15
- package/dist/commonjs/v3/sessions.js +1 -12
- package/dist/commonjs/v3/sessions.js.map +1 -1
- package/dist/commonjs/v3/shared.js +36 -30
- package/dist/commonjs/v3/shared.js.map +1 -1
- package/dist/commonjs/v3/test/index.d.ts +0 -1
- package/dist/commonjs/v3/test/index.js +1 -3
- package/dist/commonjs/v3/test/index.js.map +1 -1
- package/dist/commonjs/v3/test/mock-chat-agent.d.ts +4 -47
- package/dist/commonjs/v3/test/mock-chat-agent.js +4 -115
- package/dist/commonjs/v3/test/mock-chat-agent.js.map +1 -1
- package/dist/commonjs/v3/test/test-session-handle.js +0 -6
- package/dist/commonjs/v3/test/test-session-handle.js.map +1 -1
- package/dist/commonjs/version.js +1 -1
- package/dist/esm/imports/ai-runtime.d.ts +2 -2
- package/dist/esm/imports/ai-runtime.js +2 -2
- package/dist/esm/imports/ai-runtime.js.map +1 -1
- package/dist/esm/v3/ai-shared.d.ts +0 -15
- package/dist/esm/v3/ai-shared.js +0 -33
- package/dist/esm/v3/ai-shared.js.map +1 -1
- package/dist/esm/v3/ai.d.ts +25 -275
- package/dist/esm/v3/ai.js +305 -1275
- package/dist/esm/v3/ai.js.map +1 -1
- package/dist/esm/v3/chat-client.d.ts +2 -11
- package/dist/esm/v3/chat-client.js +112 -228
- package/dist/esm/v3/chat-client.js.map +1 -1
- package/dist/esm/v3/chat-react.d.ts +0 -88
- package/dist/esm/v3/chat-react.js +1 -127
- package/dist/esm/v3/chat-react.js.map +1 -1
- package/dist/esm/v3/chat-server.d.ts +6 -42
- package/dist/esm/v3/chat-server.js +8 -53
- package/dist/esm/v3/chat-server.js.map +1 -1
- package/dist/esm/v3/chat.d.ts +10 -92
- package/dist/esm/v3/chat.js +74 -329
- package/dist/esm/v3/chat.js.map +1 -1
- package/dist/esm/v3/sessions.d.ts +2 -15
- package/dist/esm/v3/sessions.js +1 -11
- package/dist/esm/v3/sessions.js.map +1 -1
- package/dist/esm/v3/shared.js +23 -17
- package/dist/esm/v3/shared.js.map +1 -1
- package/dist/esm/v3/test/index.d.ts +0 -1
- package/dist/esm/v3/test/index.js +0 -1
- package/dist/esm/v3/test/index.js.map +1 -1
- package/dist/esm/v3/test/mock-chat-agent.d.ts +4 -47
- package/dist/esm/v3/test/mock-chat-agent.js +6 -117
- package/dist/esm/v3/test/mock-chat-agent.js.map +1 -1
- package/dist/esm/v3/test/test-session-handle.js +0 -6
- package/dist/esm/v3/test/test-session-handle.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/docs/ai-chat/actions.mdx +23 -55
- package/docs/ai-chat/anatomy.mdx +3 -3
- package/docs/ai-chat/backend.mdx +48 -125
- package/docs/ai-chat/background-injection.mdx +19 -69
- package/docs/ai-chat/client-protocol.mdx +4 -5
- package/docs/ai-chat/compaction.mdx +7 -13
- package/docs/ai-chat/custom-agents.mdx +0 -23
- package/docs/ai-chat/fast-starts.mdx +20 -27
- package/docs/ai-chat/frontend.mdx +14 -19
- package/docs/ai-chat/lifecycle-hooks.mdx +2 -6
- package/docs/ai-chat/migrating-from-a-route-handler.mdx +14 -16
- package/docs/ai-chat/patterns/database-persistence.mdx +2 -6
- package/docs/ai-chat/patterns/persistence-and-replay.mdx +23 -34
- package/docs/ai-chat/patterns/skills.mdx +10 -7
- package/docs/ai-chat/patterns/version-upgrades.mdx +6 -79
- package/docs/ai-chat/pending-messages.mdx +3 -3
- package/docs/ai-chat/prompt-caching.mdx +25 -23
- package/docs/ai-chat/quick-start.mdx +11 -11
- package/docs/ai-chat/reference.mdx +9 -67
- package/docs/ai-chat/sessions.mdx +1 -6
- package/docs/ai-chat/testing.mdx +1 -2
- package/docs/ai-chat/tools.mdx +13 -18
- package/docs/ai-chat/upgrade-guide.mdx +2 -2
- package/docs/apikeys.mdx +45 -27
- package/docs/config/extensions/syncEnvVars.mdx +0 -6
- package/docs/deploy-environment-variables.mdx +2 -23
- package/docs/deployment/overview.mdx +8 -4
- package/docs/deployment/preview-branches.mdx +4 -4
- package/docs/deployment/version-skew-protection.mdx +0 -62
- package/docs/manual-setup.mdx +7 -7
- package/docs/mcp-tools.mdx +0 -9
- package/docs/quick-start.mdx +3 -3
- package/docs/realtime/auth.mdx +1 -1
- package/docs/self-hosting/security.mdx +0 -5
- package/docs/tasks/scheduled.mdx +0 -24
- package/docs/triggering.mdx +1 -1
- package/package.json +4 -4
- package/skills/trigger-authoring-chat-agent/SKILL.md +29 -41
- package/skills/trigger-chat-agent-advanced/SKILL.md +12 -31
- package/dist/commonjs/v3/chatSnapshotIo.d.ts +0 -2
- package/dist/commonjs/v3/chatSnapshotIo.js +0 -174
- package/dist/commonjs/v3/chatSnapshotIo.js.map +0 -1
- package/dist/commonjs/v3/chatVersionSkew.d.ts +0 -12
- package/dist/commonjs/v3/chatVersionSkew.js +0 -30
- package/dist/commonjs/v3/chatVersionSkew.js.map +0 -1
- package/dist/commonjs/v3/externalDeploymentId.d.ts +0 -23
- package/dist/commonjs/v3/externalDeploymentId.js +0 -43
- package/dist/commonjs/v3/externalDeploymentId.js.map +0 -1
- package/dist/commonjs/v3/test/transcript-storage-tests.d.ts +0 -40
- package/dist/commonjs/v3/test/transcript-storage-tests.js +0 -258
- package/dist/commonjs/v3/test/transcript-storage-tests.js.map +0 -1
- package/dist/commonjs/v3/transcriptStorage.d.ts +0 -229
- package/dist/commonjs/v3/transcriptStorage.js +0 -321
- package/dist/commonjs/v3/transcriptStorage.js.map +0 -1
- package/dist/esm/v3/chatSnapshotIo.d.ts +0 -2
- package/dist/esm/v3/chatSnapshotIo.js +0 -166
- package/dist/esm/v3/chatSnapshotIo.js.map +0 -1
- package/dist/esm/v3/chatVersionSkew.d.ts +0 -12
- package/dist/esm/v3/chatVersionSkew.js +0 -27
- package/dist/esm/v3/chatVersionSkew.js.map +0 -1
- package/dist/esm/v3/externalDeploymentId.d.ts +0 -23
- package/dist/esm/v3/externalDeploymentId.js +0 -38
- package/dist/esm/v3/externalDeploymentId.js.map +0 -1
- package/dist/esm/v3/test/transcript-storage-tests.d.ts +0 -40
- package/dist/esm/v3/test/transcript-storage-tests.js +0 -255
- package/dist/esm/v3/test/transcript-storage-tests.js.map +0 -1
- package/dist/esm/v3/transcriptStorage.d.ts +0 -229
- package/dist/esm/v3/transcriptStorage.js +0 -309
- package/dist/esm/v3/transcriptStorage.js.map +0 -1
- package/docs/ai-chat/patterns/native-compaction.mdx +0 -310
- package/docs/ai-chat/transcript-storage.mdx +0 -233
- package/docs/reports.mdx +0 -157
- package/docs/troubleshooting-zod.mdx +0 -158
|
@@ -177,20 +177,6 @@ export type ChatTransportSendSource = "submit-message" | "regenerate-message" |
|
|
|
177
177
|
* stream fails unrecoverably.
|
|
178
178
|
*/
|
|
179
179
|
export type ChatTransportEvent = {
|
|
180
|
-
/**
|
|
181
|
-
* The chat's run is parked waiting for its deployment (version skew protection). Messages
|
|
182
|
-
* sent meanwhile are durable and drain when it lands, but nothing answers until then.
|
|
183
|
-
* Re-emitted on every send while parked; clear the notice on `first-chunk`.
|
|
184
|
-
*/
|
|
185
|
-
type: "run-pending-version";
|
|
186
|
-
chatId: string;
|
|
187
|
-
timestamp: number;
|
|
188
|
-
/**
|
|
189
|
-
* Where we learned it: creating the session, a send, the `headStart` POST, or an
|
|
190
|
-
* upgrade handing over to a deployment that has not landed yet.
|
|
191
|
-
*/
|
|
192
|
-
source: "start" | "send" | "head-start" | "upgrade";
|
|
193
|
-
} | {
|
|
194
180
|
type: "message-sent";
|
|
195
181
|
chatId: string;
|
|
196
182
|
timestamp: number;
|
|
@@ -227,14 +213,6 @@ export type ChatTransportEvent = {
|
|
|
227
213
|
timestamp: number;
|
|
228
214
|
error: Error;
|
|
229
215
|
status?: number;
|
|
230
|
-
} | {
|
|
231
|
-
type: "session-closed";
|
|
232
|
-
chatId: string;
|
|
233
|
-
timestamp: number;
|
|
234
|
-
/** The reason supplied to `chat.close()` / `sessions.close()`, if any. */
|
|
235
|
-
reason?: string;
|
|
236
|
-
/** How the transport learned: the terminal record, or a refused send. */
|
|
237
|
-
source: "stream" | "append";
|
|
238
216
|
} | {
|
|
239
217
|
type: "first-chunk";
|
|
240
218
|
chatId: string;
|
|
@@ -310,11 +288,6 @@ export type StartSessionParams<TClientData = unknown> = {
|
|
|
310
288
|
export type StartSessionResult = {
|
|
311
289
|
/** Session-scoped PAT — `read:sessions:{chatId} + write:sessions:{chatId}`. */
|
|
312
290
|
publicAccessToken: string;
|
|
313
|
-
/**
|
|
314
|
-
* Pass through `pendingVersion` from `chat.createStartSessionAction` (or `POST
|
|
315
|
-
* /api/v1/sessions`) and the transport emits `run-pending-version`.
|
|
316
|
-
*/
|
|
317
|
-
pendingVersion?: boolean;
|
|
318
291
|
};
|
|
319
292
|
/**
|
|
320
293
|
* Public surface of {@link TriggerChatTransport}'s session state. Everything
|
|
@@ -328,10 +301,6 @@ export type ChatSessionPersistedState = {
|
|
|
328
301
|
/** The `.in` append sequence of the last send this client owned; reused as `sinceInSeq` on reconnect. */
|
|
329
302
|
activeInputSeq?: number;
|
|
330
303
|
isStreaming?: boolean;
|
|
331
|
-
/** Set once the session is closed. Persisted so a reload doesn't retry a dead session. */
|
|
332
|
-
closed?: boolean;
|
|
333
|
-
/** The reason the session was closed, when one was given. */
|
|
334
|
-
closedReason?: string;
|
|
335
304
|
};
|
|
336
305
|
/**
|
|
337
306
|
* Common options for the {@link TriggerChatTransport}.
|
|
@@ -524,10 +493,10 @@ export type TriggerChatTransportOptions<TClientData = unknown> = {
|
|
|
524
493
|
*/
|
|
525
494
|
export declare class TriggerChatTransport implements ChatTransport<UIMessage> {
|
|
526
495
|
private readonly taskId;
|
|
527
|
-
private resolveAccessToken;
|
|
528
|
-
private resolveStartSession;
|
|
496
|
+
private readonly resolveAccessToken;
|
|
497
|
+
private readonly resolveStartSession;
|
|
529
498
|
private readonly resolveBaseURLFn;
|
|
530
|
-
private fetchOverride;
|
|
499
|
+
private readonly fetchOverride;
|
|
531
500
|
private readonly extraHeaders;
|
|
532
501
|
private readonly streamTimeoutSeconds;
|
|
533
502
|
private defaultMetadata;
|
|
@@ -537,7 +506,6 @@ export declare class TriggerChatTransport implements ChatTransport<UIMessage> {
|
|
|
537
506
|
private _onSessionChange;
|
|
538
507
|
private _onEvent;
|
|
539
508
|
private sessions;
|
|
540
|
-
private pendingResumeCursors;
|
|
541
509
|
private activeStreams;
|
|
542
510
|
private pendingStarts;
|
|
543
511
|
private lastTurnSends;
|
|
@@ -610,36 +578,17 @@ export declare class TriggerChatTransport implements ChatTransport<UIMessage> {
|
|
|
610
578
|
* message.
|
|
611
579
|
*/
|
|
612
580
|
stopGeneration: (chatId: string) => Promise<boolean>;
|
|
613
|
-
/**
|
|
614
|
-
* Clear the supersede gate armed by a stop. Call this when the stopped
|
|
615
|
-
* turn died without ever writing its `trigger:turn-complete` boundary,
|
|
616
|
-
* otherwise the next turn stays gated forever.
|
|
617
|
-
*/
|
|
618
|
-
clearSupersedeGate: (chatId: string) => void;
|
|
619
581
|
/**
|
|
620
582
|
* Send a custom action chunk (for `chat.agent`'s `actionSchema` /
|
|
621
|
-
* `onAction` hook).
|
|
622
|
-
* `onAction` fire on the agent side
|
|
623
|
-
*
|
|
624
|
-
*
|
|
625
|
-
*
|
|
626
|
-
*/
|
|
627
|
-
sendAction: (chatId: string, action: unknown
|
|
628
|
-
abortSignal?: AbortSignal;
|
|
629
|
-
metadata?: Record<string, unknown>;
|
|
630
|
-
}) => Promise<ReadableStream<UIMessageChunk>>;
|
|
583
|
+
* `onAction` hook). Actions are not turns — only `hydrateMessages`
|
|
584
|
+
* and `onAction` fire on the agent side. The returned stream
|
|
585
|
+
* carries any model response `onAction` produced (when it returns a
|
|
586
|
+
* `StreamTextResult`); for `void`-returning side-effect-only actions
|
|
587
|
+
* the stream completes immediately with `trigger:turn-complete`.
|
|
588
|
+
*/
|
|
589
|
+
sendAction: (chatId: string, action: unknown) => Promise<ReadableStream<UIMessageChunk>>;
|
|
631
590
|
getSession: (chatId: string) => ChatSessionPersistedState | undefined;
|
|
632
591
|
setSession(chatId: string, session: ChatSessionPersistedState): void;
|
|
633
|
-
/**
|
|
634
|
-
* Seed the `.out` resume cursor from a loaded transcript. Applied to the
|
|
635
|
-
* session now if it exists, otherwise held until the session is created so
|
|
636
|
-
* the first live subscription opens past the persisted history instead of
|
|
637
|
-
* replaying it. Never moves an existing cursor backward: the transcript load
|
|
638
|
-
* is async, so a live `.out` record can already have advanced the session
|
|
639
|
-
* past the snapshot, and overwriting it would replay those records.
|
|
640
|
-
*/
|
|
641
|
-
seedResumeCursor: (chatId: string, lastEventId: string) => void;
|
|
642
|
-
private applyPendingResumeCursor;
|
|
643
592
|
setOnSessionChange(callback: ((chatId: string, session: ChatSessionPersistedState | null) => void) | undefined): void;
|
|
644
593
|
/** Update the `onEvent` callback without recreating the transport. */
|
|
645
594
|
setOnEvent(callback: ((event: ChatTransportEvent) => void) | undefined): void;
|
|
@@ -657,16 +606,6 @@ export declare class TriggerChatTransport implements ChatTransport<UIMessage> {
|
|
|
657
606
|
* transport see the latest value the next time they fire.
|
|
658
607
|
*/
|
|
659
608
|
setClientData(clientData: Record<string, unknown> | undefined): void;
|
|
660
|
-
/**
|
|
661
|
-
* Update the request-time callbacks. Same reason as `setClientData`:
|
|
662
|
-
* a host that rebuilds these per render (a dashboard navigating between
|
|
663
|
-
* projects) would otherwise keep hitting the endpoint captured at
|
|
664
|
-
* construction. Every read goes through the live field, so the next
|
|
665
|
-
* request uses the latest callback.
|
|
666
|
-
*/
|
|
667
|
-
setAccessToken(accessToken: (params: AccessTokenParams) => string | Promise<string>): void;
|
|
668
|
-
setStartSession(startSession: ((params: StartSessionParams<Record<string, unknown>>) => Promise<StartSessionResult>) | undefined): void;
|
|
669
|
-
setFetch(fetchOverride: ChatFetchOverride | undefined): void;
|
|
670
609
|
isReadOnly(chatId: string): boolean;
|
|
671
610
|
hasClaim(chatId: string): boolean;
|
|
672
611
|
addReadOnlyListener(fn: (chatId: string, isReadOnly: boolean) => void): void;
|
|
@@ -677,20 +616,6 @@ export declare class TriggerChatTransport implements ChatTransport<UIMessage> {
|
|
|
677
616
|
dispose(): void;
|
|
678
617
|
private serializeInputChunk;
|
|
679
618
|
private toPersisted;
|
|
680
|
-
/**
|
|
681
|
-
* Flip a session to closed and tell listeners once. Terminal: sends and
|
|
682
|
-
* reconnects stop from here on, and there is no reopening.
|
|
683
|
-
*/
|
|
684
|
-
private markSessionClosed;
|
|
685
|
-
/**
|
|
686
|
-
* Whether the conversation has been closed — by the agent via
|
|
687
|
-
* `chat.close()`, or from outside via `sessions.close()`. Closed is
|
|
688
|
-
* one-way: the transport refuses further sends and reconnects, and the
|
|
689
|
-
* transcript stays readable.
|
|
690
|
-
*/
|
|
691
|
-
sessionStatus: (chatId: string) => "open" | "closed";
|
|
692
|
-
/** The reason the session was closed, when one was given. */
|
|
693
|
-
sessionClosedReason: (chatId: string) => string | undefined;
|
|
694
619
|
private notifySessionChange;
|
|
695
620
|
/**
|
|
696
621
|
* Resolves the session state for a chatId, starting the session if
|
|
@@ -706,13 +631,6 @@ export declare class TriggerChatTransport implements ChatTransport<UIMessage> {
|
|
|
706
631
|
* via `accessToken` and retry once. Surfaces non-auth errors as-is.
|
|
707
632
|
*/
|
|
708
633
|
private resolveBaseURL;
|
|
709
|
-
/**
|
|
710
|
-
* `fetchClient` for an `out` subscription. Reads `this.fetchOverride` on
|
|
711
|
-
* every call, not once per subscription: a watch-mode subscription
|
|
712
|
-
* reconnects for the lifetime of the page, and `setFetch` may have swapped
|
|
713
|
-
* the override in between.
|
|
714
|
-
*/
|
|
715
|
-
private sseFetchClient;
|
|
716
634
|
private doFetch;
|
|
717
635
|
private appendInputChunk;
|
|
718
636
|
private callWithAuthRetry;
|