@trigger.dev/sdk 4.8.4 → 4.8.6
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/v3/ai.d.ts +29 -5
- package/dist/commonjs/v3/ai.js +160 -114
- package/dist/commonjs/v3/ai.js.map +1 -1
- package/dist/commonjs/v3/auth.d.ts +4 -4
- package/dist/commonjs/v3/auth.js +21 -75
- package/dist/commonjs/v3/auth.js.map +1 -1
- package/dist/commonjs/v3/chat-client.d.ts +1 -1
- package/dist/commonjs/v3/chat.d.ts +1 -1
- package/dist/commonjs/v3/prompt.js +6 -8
- package/dist/commonjs/v3/prompt.js.map +1 -1
- package/dist/commonjs/v3/runs.d.ts +5 -1
- package/dist/commonjs/v3/runs.js.map +1 -1
- package/dist/commonjs/v3/sessions.js +10 -7
- package/dist/commonjs/v3/sessions.js.map +1 -1
- package/dist/commonjs/v3/shared.d.ts +2 -2
- package/dist/commonjs/v3/shared.js +16 -15
- package/dist/commonjs/v3/shared.js.map +1 -1
- package/dist/commonjs/v3/steeringContext.d.ts +35 -10
- package/dist/commonjs/v3/steeringContext.js +35 -12
- package/dist/commonjs/v3/steeringContext.js.map +1 -1
- package/dist/commonjs/v3/streams.js +10 -8
- package/dist/commonjs/v3/streams.js.map +1 -1
- package/dist/commonjs/v3/tasks.d.ts +2 -2
- package/dist/commonjs/v3/tasks.js.map +1 -1
- package/dist/commonjs/v3/test/mock-chat-agent.js +24 -13
- package/dist/commonjs/v3/test/mock-chat-agent.js.map +1 -1
- package/dist/commonjs/v3/webhooks.d.ts +8 -2
- package/dist/commonjs/v3/webhooks.js +20 -11
- package/dist/commonjs/v3/webhooks.js.map +1 -1
- package/dist/commonjs/version.js +1 -1
- package/dist/esm/v3/ai.d.ts +29 -5
- package/dist/esm/v3/ai.js +162 -117
- package/dist/esm/v3/ai.js.map +1 -1
- package/dist/esm/v3/auth.d.ts +4 -4
- package/dist/esm/v3/auth.js +22 -76
- package/dist/esm/v3/auth.js.map +1 -1
- package/dist/esm/v3/chat-client.d.ts +1 -1
- package/dist/esm/v3/chat.d.ts +1 -1
- package/dist/esm/v3/prompt.js +6 -8
- package/dist/esm/v3/prompt.js.map +1 -1
- package/dist/esm/v3/runs.d.ts +5 -1
- package/dist/esm/v3/runs.js.map +1 -1
- package/dist/esm/v3/sessions.js +10 -7
- package/dist/esm/v3/sessions.js.map +1 -1
- package/dist/esm/v3/shared.d.ts +2 -2
- package/dist/esm/v3/shared.js +16 -15
- package/dist/esm/v3/shared.js.map +1 -1
- package/dist/esm/v3/steeringContext.d.ts +35 -10
- package/dist/esm/v3/steeringContext.js +34 -12
- package/dist/esm/v3/steeringContext.js.map +1 -1
- package/dist/esm/v3/streams.js +10 -8
- package/dist/esm/v3/streams.js.map +1 -1
- package/dist/esm/v3/tasks.d.ts +2 -2
- package/dist/esm/v3/tasks.js.map +1 -1
- package/dist/esm/v3/test/mock-chat-agent.js +25 -14
- package/dist/esm/v3/test/mock-chat-agent.js.map +1 -1
- package/dist/esm/v3/webhooks.d.ts +8 -2
- package/dist/esm/v3/webhooks.js +20 -11
- package/dist/esm/v3/webhooks.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/docs/ai/observability.mdx +25 -19
- package/docs/ai/prompts.mdx +25 -19
- package/docs/ai-chat/actions.mdx +1 -1
- package/docs/ai-chat/anatomy.mdx +1 -1
- package/docs/ai-chat/backend.mdx +24 -24
- package/docs/ai-chat/background-injection.mdx +5 -5
- package/docs/ai-chat/chat-local.mdx +2 -2
- package/docs/ai-chat/compaction.mdx +38 -15
- package/docs/ai-chat/custom-agents.mdx +4 -4
- package/docs/ai-chat/error-handling.mdx +4 -4
- package/docs/ai-chat/fast-starts.mdx +8 -7
- package/docs/ai-chat/frontend.mdx +6 -2
- package/docs/ai-chat/lifecycle-hooks.mdx +11 -11
- package/docs/ai-chat/migrating-from-a-route-handler.mdx +4 -4
- package/docs/ai-chat/migrating-from-hydrate-messages.mdx +1 -1
- package/docs/ai-chat/overview.mdx +1 -1
- package/docs/ai-chat/patterns/branching-conversations.mdx +1 -1
- package/docs/ai-chat/patterns/database-persistence.mdx +2 -2
- package/docs/ai-chat/patterns/human-in-the-loop.mdx +1 -1
- package/docs/ai-chat/patterns/native-compaction.mdx +29 -9
- package/docs/ai-chat/patterns/persistence-and-replay.mdx +1 -1
- package/docs/ai-chat/patterns/redacting-telemetry.mdx +2 -2
- package/docs/ai-chat/patterns/skills.mdx +2 -2
- package/docs/ai-chat/patterns/sub-agents.mdx +1 -1
- package/docs/ai-chat/patterns/tool-result-auditing.mdx +1 -1
- package/docs/ai-chat/patterns/trusted-edge-signals.mdx +2 -2
- package/docs/ai-chat/patterns/version-upgrades.mdx +2 -2
- package/docs/ai-chat/pending-messages.mdx +5 -5
- package/docs/ai-chat/prompt-caching.mdx +7 -7
- package/docs/ai-chat/quick-start.mdx +2 -2
- package/docs/ai-chat/testing.mdx +9 -9
- package/docs/ai-chat/tools.mdx +9 -5
- package/docs/ai-chat/transcript-storage.mdx +2 -2
- package/docs/ai-chat/types.mdx +10 -3
- package/docs/apikeys.mdx +2 -1
- package/docs/cli-login-commands.mdx +12 -0
- package/docs/concurrency.mdx +40 -0
- package/docs/database-connections.mdx +1 -1
- package/docs/deploy-environment-variables.mdx +84 -2
- package/docs/deployment/trusted-publishing.mdx +4 -0
- package/docs/errors-retrying.mdx +25 -18
- package/docs/github-actions.mdx +1 -1
- package/docs/github-integration.mdx +21 -0
- package/docs/how-it-works.mdx +4 -2
- package/docs/introduction.mdx +1 -1
- package/docs/mcp-introduction.mdx +7 -1
- package/docs/mcp-remote.mdx +90 -0
- package/docs/oidc/azure.mdx +81 -0
- package/docs/oidc/databricks.mdx +99 -0
- package/docs/oidc/doppler.mdx +60 -0
- package/docs/oidc/gcp.mdx +109 -0
- package/docs/oidc/hugging-face.mdx +90 -0
- package/docs/oidc/openrouter.mdx +91 -0
- package/docs/oidc/snowflake.mdx +91 -0
- package/docs/oidc/vault.mdx +71 -0
- package/docs/oidc.mdx +2 -0
- package/docs/runs/metadata.mdx +1 -1
- package/docs/self-hosting/docker.mdx +2 -0
- package/docs/self-hosting/env/webapp.mdx +4 -1
- package/docs/self-hosting/kubernetes.mdx +2 -0
- package/docs/tasks/schemaTask.mdx +26 -13
- package/docs/tasks/streams.mdx +2 -2
- package/docs/troubleshooting.mdx +7 -0
- package/docs/webhooks/channels.mdx +6 -6
- package/docs/webhooks/connect.mdx +9 -75
- package/docs/webhooks/custom-providers.mdx +87 -0
- package/docs/webhooks/deliveries.mdx +7 -7
- package/docs/webhooks/filters.mdx +2 -2
- package/docs/webhooks/how-it-works.mdx +58 -0
- package/docs/webhooks/human-in-the-loop.mdx +3 -3
- package/docs/webhooks/linear.mdx +5 -3
- package/docs/webhooks/overview.mdx +20 -71
- package/docs/webhooks/own-handler.mdx +62 -0
- package/docs/webhooks/pricing-and-limits.mdx +13 -0
- package/docs/webhooks/providers/attio.mdx +38 -0
- package/docs/webhooks/providers/autumn.mdx +40 -0
- package/docs/webhooks/providers/cal-com.mdx +41 -0
- package/docs/webhooks/providers/calendly.mdx +41 -0
- package/docs/webhooks/providers/clerk.mdx +40 -0
- package/docs/webhooks/providers/discord.mdx +45 -0
- package/docs/webhooks/providers/docusign.mdx +41 -0
- package/docs/webhooks/providers/elevenlabs.mdx +41 -0
- package/docs/webhooks/providers/firecrawl.mdx +54 -0
- package/docs/webhooks/providers/github.mdx +46 -0
- package/docs/webhooks/providers/gitlab.mdx +41 -0
- package/docs/webhooks/providers/granola.mdx +44 -0
- package/docs/webhooks/providers/hookdeck.mdx +98 -0
- package/docs/webhooks/providers/infisical.mdx +41 -0
- package/docs/webhooks/providers/jira.mdx +41 -0
- package/docs/webhooks/providers/langfuse.mdx +40 -0
- package/docs/webhooks/providers/linear.mdx +45 -0
- package/docs/webhooks/providers/loops.mdx +40 -0
- package/docs/webhooks/providers/metronome.mdx +42 -0
- package/docs/webhooks/providers/mux.mdx +40 -0
- package/docs/webhooks/providers/openai.mdx +40 -0
- package/docs/webhooks/providers/pagerduty.mdx +40 -0
- package/docs/webhooks/providers/plain.mdx +41 -0
- package/docs/webhooks/providers/planetscale.mdx +40 -0
- package/docs/webhooks/providers/recall-ai.mdx +54 -0
- package/docs/webhooks/providers/replicate.mdx +41 -0
- package/docs/webhooks/providers/resend.mdx +44 -0
- package/docs/webhooks/providers/retell.mdx +41 -0
- package/docs/webhooks/providers/sentry.mdx +41 -0
- package/docs/webhooks/providers/shopify.mdx +49 -0
- package/docs/webhooks/providers/slack.mdx +48 -0
- package/docs/webhooks/providers/square.mdx +40 -0
- package/docs/webhooks/providers/stripe.mdx +86 -0
- package/docs/webhooks/providers/supabase.mdx +41 -0
- package/docs/webhooks/providers/tailscale.mdx +43 -0
- package/docs/webhooks/providers/typeform.mdx +42 -0
- package/docs/webhooks/providers/vapi.mdx +47 -0
- package/docs/webhooks/providers/vercel.mdx +40 -0
- package/docs/webhooks/providers/whatsapp.mdx +45 -0
- package/docs/webhooks/providers/workos.mdx +41 -0
- package/docs/webhooks/providers/zendesk.mdx +41 -0
- package/docs/webhooks/providers.mdx +53 -0
- package/docs/webhooks/quick-start.mdx +131 -0
- package/docs/webhooks/session-routing.mdx +6 -6
- package/docs/webhooks/signing-secrets.mdx +80 -0
- package/docs/webhooks/slack.mdx +11 -2
- package/docs/webhooks/verification.mdx +139 -0
- package/docs/webhooks/waiters.mdx +2 -2
- package/docs/webhooks/webhook-tasks.mdx +46 -0
- package/package.json +4 -5
- package/docs/migrating-from-v3.mdx +0 -332
- package/docs/webhooks/public-beta.mdx +0 -70
- package/docs/webhooks/sources.mdx +0 -252
package/dist/commonjs/v3/ai.d.ts
CHANGED
|
@@ -490,6 +490,11 @@ export type ChatNewToolResult = {
|
|
|
490
490
|
/** State stored in locals during prepareStep compaction. */
|
|
491
491
|
interface CompactionState {
|
|
492
492
|
summary: string;
|
|
493
|
+
/**
|
|
494
|
+
* How many of the generation's response messages the summary covers. Later
|
|
495
|
+
* steps rebuild from the summary plus the response messages after these.
|
|
496
|
+
* Returned by `chat.getCompactionState()` for custom `prepareStep` code.
|
|
497
|
+
*/
|
|
493
498
|
baseResponseMessageCount: number;
|
|
494
499
|
/** Completed steps summarized this turn; unlike message counts, matches UI step markers. */
|
|
495
500
|
baseResponseStepCount: number;
|
|
@@ -619,6 +624,8 @@ export type PendingMessageReceivedEvent<TUIM extends UIMessage = UIMessage> = {
|
|
|
619
624
|
chatId: string;
|
|
620
625
|
/** Current turn number (0-indexed). */
|
|
621
626
|
turn: number;
|
|
627
|
+
/** Custom data from the frontend. */
|
|
628
|
+
clientData?: unknown;
|
|
622
629
|
};
|
|
623
630
|
/**
|
|
624
631
|
* Event passed to `onInjected` callback (batch, after injection).
|
|
@@ -632,6 +639,8 @@ export type PendingMessagesInjectedEvent<TUIM extends UIMessage = UIMessage> = {
|
|
|
632
639
|
chatId: string;
|
|
633
640
|
/** Current turn number (0-indexed). */
|
|
634
641
|
turn: number;
|
|
642
|
+
/** Custom data from the frontend. */
|
|
643
|
+
clientData?: unknown;
|
|
635
644
|
/** Step number where injection occurred. */
|
|
636
645
|
stepNumber: number;
|
|
637
646
|
};
|
|
@@ -736,6 +745,8 @@ export type CompactedEvent = {
|
|
|
736
745
|
chatId?: string;
|
|
737
746
|
/** The current turn number (if running inside a chat.agent). */
|
|
738
747
|
turn?: number;
|
|
748
|
+
/** Custom data from the frontend (if inside a chat.agent). */
|
|
749
|
+
clientData?: unknown;
|
|
739
750
|
/** Stream writer — write custom `UIMessageChunk` parts to the chat stream. Lazy: no overhead if unused. */
|
|
740
751
|
writer: ChatWriter;
|
|
741
752
|
};
|
|
@@ -833,6 +844,12 @@ export type CompactOptions = {
|
|
|
833
844
|
threshold?: number;
|
|
834
845
|
/** Custom compaction trigger. When provided, used instead of `threshold`. */
|
|
835
846
|
shouldCompact?: (event: ShouldCompactEvent) => boolean | Promise<boolean>;
|
|
847
|
+
/**
|
|
848
|
+
* The `responseMessages` your `prepareStep` receives. AI SDK 7 passes them,
|
|
849
|
+
* and without them later steps cannot be rebuilt after a compaction on AI
|
|
850
|
+
* SDK 7. Earlier AI SDK versions do not need them.
|
|
851
|
+
*/
|
|
852
|
+
responseMessages?: ModelMessage[];
|
|
836
853
|
};
|
|
837
854
|
/**
|
|
838
855
|
* Read the current compaction state. Returns the summary and base message count
|
|
@@ -859,9 +876,10 @@ declare function getCompactionState(): CompactionState | undefined;
|
|
|
859
876
|
*
|
|
860
877
|
* @example
|
|
861
878
|
* ```ts
|
|
862
|
-
* prepareStep: async ({ messages, steps }) => {
|
|
879
|
+
* prepareStep: async ({ messages, steps, responseMessages }) => {
|
|
863
880
|
* // your custom logic here...
|
|
864
881
|
* const result = await chat.compact(messages, steps, {
|
|
882
|
+
* responseMessages, // needed on AI SDK 7 to rebuild the steps after a compaction
|
|
865
883
|
* threshold: 80_000,
|
|
866
884
|
* summarize: async (msgs) => generateText({ model, messages: msgs }).then(r => r.text),
|
|
867
885
|
* });
|
|
@@ -899,6 +917,7 @@ declare function chatCompact(messages: ModelMessage[], steps: CompactionStep[],
|
|
|
899
917
|
declare function chatCompactionStep(options: CompactionOptions): (args: {
|
|
900
918
|
messages: ModelMessage[];
|
|
901
919
|
steps: CompactionStep[];
|
|
920
|
+
responseMessages?: ModelMessage[];
|
|
902
921
|
}) => Promise<{
|
|
903
922
|
messages: ModelMessage[];
|
|
904
923
|
} | undefined>;
|
|
@@ -1471,6 +1490,8 @@ export type ValidateMessagesEvent<TUIM extends UIMessage = UIMessage> = {
|
|
|
1471
1490
|
chatId: string;
|
|
1472
1491
|
/** The turn number (0-indexed). */
|
|
1473
1492
|
turn: number;
|
|
1493
|
+
/** Custom data from the frontend. */
|
|
1494
|
+
clientData?: unknown;
|
|
1474
1495
|
/** The trigger type for this turn. */
|
|
1475
1496
|
trigger: "submit-message" | "regenerate-message" | "preload" | "close";
|
|
1476
1497
|
};
|
|
@@ -2220,8 +2241,11 @@ declare function makeChannelStreamTap(editor: ChannelStreamEditor, options?: {
|
|
|
2220
2241
|
stopOnEnd?: boolean;
|
|
2221
2242
|
}): TransformStream<unknown, unknown>;
|
|
2222
2243
|
export { makeChannelStreamEditor as __makeChannelStreamEditorForTests, makeChannelStreamTap as __makeChannelStreamTapForTests, makeChannelProgressObserver as __makeChannelProgressObserverForTests, makeChannelLifecycleReporter as __makeChannelLifecycleReporterForTests, };
|
|
2244
|
+
type ChatLatchReason = "settled" | "run-ended";
|
|
2223
2245
|
/** Resolves once the post-turn channel egress for `chatId` has finished (immediately when none is running). */
|
|
2224
|
-
export declare function __waitForChannelEgressForTests(chatId: string): Promise<
|
|
2246
|
+
export declare function __waitForChannelEgressForTests(chatId: string): Promise<ChatLatchReason | undefined>;
|
|
2247
|
+
/** Resolves once the post-turn hooks for `chatId` have finished (immediately when none are running). */
|
|
2248
|
+
export declare function __waitForPostTurnHooksForTests(chatId: string): Promise<ChatLatchReason | undefined>;
|
|
2225
2249
|
type ChatActionType<TActionSchema extends TaskSchema | undefined, TW extends readonly AnyChatEvent[]> = [TActionSchema] extends [TaskSchema] ? inferSchemaOut<TActionSchema> | ChatEventActions<TW> : [TW] extends [readonly []] ? unknown : ChatEventActions<TW>;
|
|
2226
2250
|
export type ChatAgentOptions<TIdentifier extends string, TClientDataSchema extends TaskSchema | undefined = undefined, TUIMessage extends UIMessage = UIMessage, TActionSchema extends TaskSchema | undefined = undefined, TTools extends ToolSet = ToolSet, TW extends readonly AnyChatEvent[] = [], TChannels extends readonly AnyChannelConnector[] = []> = Omit<TaskOptions<TIdentifier, ChatTaskWirePayload<TUIMessage, inferSchemaIn<TClientDataSchema>>, unknown>, "run" | "retry"> & {
|
|
2227
2251
|
/**
|
|
@@ -3893,7 +3917,7 @@ declare function chatLocal<T extends Record<string, unknown>>(options: {
|
|
|
3893
3917
|
* `createChatStartSessionAction`.
|
|
3894
3918
|
*
|
|
3895
3919
|
* - `"sessions"` — `POST /api/v1/sessions` (session create + first run trigger).
|
|
3896
|
-
* - `"auth"` — `POST /api/v1/auth/
|
|
3920
|
+
* - `"auth"` — `POST /api/v1/auth/public-tokens` (only fired when
|
|
3897
3921
|
* `tokenTTL` is set; otherwise the publicAccessToken from session create
|
|
3898
3922
|
* is reused as-is).
|
|
3899
3923
|
*/
|
|
@@ -3914,7 +3938,7 @@ export type CreateChatStartSessionActionOptions = {
|
|
|
3914
3938
|
triggerConfig?: Partial<SessionTriggerConfigInput>;
|
|
3915
3939
|
/**
|
|
3916
3940
|
* Override the Trigger.dev API base URL. String applies to both
|
|
3917
|
-
* `/api/v1/sessions` and `/api/v1/auth/
|
|
3941
|
+
* `/api/v1/sessions` and `/api/v1/auth/public-tokens`; function picks per
|
|
3918
3942
|
* endpoint. When unset, falls back to `apiClientManager.baseURL`
|
|
3919
3943
|
* (typically the `TRIGGER_API_URL` env var). Set this to route session
|
|
3920
3944
|
* create through a trusted edge proxy that injects server-side signal
|
|
@@ -3929,7 +3953,7 @@ export type CreateChatStartSessionActionOptions = {
|
|
|
3929
3953
|
fetch?: ChatStartSessionFetchOverride;
|
|
3930
3954
|
/**
|
|
3931
3955
|
* API client config (baseURL / accessToken) to scope this action to a specific
|
|
3932
|
-
* environment
|
|
3956
|
+
* environment without changing global `configure({ accessToken })` settings. The
|
|
3933
3957
|
* returned action runs under this config.
|
|
3934
3958
|
*/
|
|
3935
3959
|
apiClient?: ApiClientConfiguration;
|