@trigger.dev/sdk 4.7.3 → 4.7.5
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 +26 -0
- package/dist/commonjs/v3/ai.js +7 -5
- package/dist/commonjs/v3/ai.js.map +1 -1
- package/dist/commonjs/v3/concurrencyLimits.d.ts +37 -7
- package/dist/commonjs/v3/concurrencyLimits.js +38 -70
- package/dist/commonjs/v3/concurrencyLimits.js.map +1 -1
- package/dist/commonjs/v3/index.d.ts +1 -1
- package/dist/commonjs/v3/index.js.map +1 -1
- package/dist/commonjs/v3/query.d.ts +434 -1
- package/dist/commonjs/v3/query.js +115 -0
- package/dist/commonjs/v3/query.js.map +1 -1
- package/dist/commonjs/v3/runs.d.ts +22 -1
- package/dist/commonjs/v3/runs.js +6 -3
- package/dist/commonjs/v3/runs.js.map +1 -1
- package/dist/commonjs/version.js +1 -1
- package/dist/esm/v3/ai.d.ts +26 -0
- package/dist/esm/v3/ai.js +7 -5
- package/dist/esm/v3/ai.js.map +1 -1
- package/dist/esm/v3/concurrencyLimits.d.ts +37 -7
- package/dist/esm/v3/concurrencyLimits.js +38 -70
- package/dist/esm/v3/concurrencyLimits.js.map +1 -1
- package/dist/esm/v3/index.d.ts +1 -1
- package/dist/esm/v3/index.js.map +1 -1
- package/dist/esm/v3/query.d.ts +434 -1
- package/dist/esm/v3/query.js +115 -0
- package/dist/esm/v3/query.js.map +1 -1
- package/dist/esm/v3/runs.d.ts +22 -1
- package/dist/esm/v3/runs.js +6 -3
- package/dist/esm/v3/runs.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/docs/ai-chat/actions.mdx +6 -1
- package/docs/ai-chat/backend.mdx +47 -0
- package/docs/ai-chat/patterns/redacting-telemetry.mdx +117 -0
- package/docs/ai-chat/patterns/sub-agents.mdx +33 -0
- package/docs/ai-chat/pending-messages.mdx +2 -0
- package/docs/ai-chat/reference.mdx +53 -2
- package/docs/ai-chat/transcript-storage.mdx +1 -1
- package/docs/apikeys.mdx +9 -7
- package/docs/billing-limits.mdx +1 -1
- package/docs/cli-env-commands.mdx +5 -4
- package/docs/cli-init-commands.mdx +27 -1
- package/docs/cli-login-commands.mdx +20 -0
- package/docs/cli-projects-commands.mdx +13 -1
- package/docs/cli-runs-commands.mdx +3 -2
- package/docs/cli-tasks-commands.mdx +95 -0
- package/docs/cli-update-commands.mdx +9 -3
- package/docs/cli-whoami-commands.mdx +12 -0
- package/docs/concurrency.mdx +32 -0
- package/docs/config/config-file.mdx +58 -0
- package/docs/config/extensions/audioWaveform.mdx +4 -1
- package/docs/config/extensions/overview.mdx +2 -0
- package/docs/config/extensions/prismaExtension.mdx +6 -7
- package/docs/config/extensions/puppeteer.mdx +3 -5
- package/docs/config/extensions/pythonExtension.mdx +9 -1
- package/docs/config/extensions/syncEnvVars.mdx +6 -0
- package/docs/deploy-environment-variables.mdx +5 -1
- package/docs/deployment/atomic-deployment.mdx +5 -3
- package/docs/deployment/dev-branches.mdx +5 -5
- package/docs/deployment/overview.mdx +9 -8
- package/docs/deployment/preview-branches.mdx +7 -4
- package/docs/errors-retrying.mdx +4 -4
- package/docs/github-actions.mdx +3 -3
- package/docs/how-it-works.mdx +5 -5
- package/docs/introduction.mdx +6 -0
- package/docs/limits.mdx +32 -8
- package/docs/logging.mdx +1 -1
- package/docs/machines.mdx +1 -1
- package/docs/manual-setup.mdx +1 -1
- package/docs/mcp-introduction.mdx +8 -7
- package/docs/mcp-tools.mdx +113 -3
- package/docs/migrating-from-v3.mdx +1 -1
- package/docs/observability/dashboards.mdx +64 -0
- package/docs/observability/query.mdx +6 -2
- package/docs/private-networking/aws-console-setup.mdx +1 -1
- package/docs/private-networking/overview.mdx +1 -1
- package/docs/quick-start.mdx +3 -40
- package/docs/realtime/auth.mdx +1 -1
- package/docs/realtime/backend/input-streams.mdx +159 -0
- package/docs/realtime/backend/streams.mdx +25 -10
- package/docs/realtime/how-it-works.mdx +1 -1
- package/docs/realtime/react-hooks/overview.mdx +1 -1
- package/docs/realtime/react-hooks/streams.mdx +2 -2
- package/docs/realtime/react-hooks/subscribe.mdx +19 -3
- package/docs/realtime/react-hooks/triggering.mdx +2 -2
- package/docs/realtime/react-hooks/use-wait-token.mdx +1 -1
- package/docs/realtime/run-object.mdx +47 -24
- package/docs/replaying.mdx +26 -1
- package/docs/reports.mdx +4 -2
- package/docs/run-tests.mdx +2 -2
- package/docs/run-usage.mdx +3 -3
- package/docs/runs/heartbeats.mdx +2 -2
- package/docs/runs/list-best-practices.mdx +234 -0
- package/docs/runs/max-duration.mdx +4 -0
- package/docs/runs/metadata.mdx +7 -10
- package/docs/runs.mdx +18 -8
- package/docs/self-hosting/env/supervisor.mdx +3 -0
- package/docs/self-hosting/env/webapp.mdx +5 -0
- package/docs/self-hosting/overview.mdx +26 -0
- package/docs/tags.mdx +6 -0
- package/docs/tasks/scheduled.mdx +11 -5
- package/docs/triggering.mdx +8 -0
- package/docs/troubleshooting-alerts.mdx +102 -3
- package/docs/troubleshooting.mdx +1 -1
- package/docs/upgrading-packages.mdx +3 -3
- package/docs/vercel-integration.mdx +13 -3
- package/docs/versioning.mdx +1 -1
- package/docs/wait-for-token.mdx +3 -3
- package/docs/webhooks/channels.mdx +158 -0
- package/docs/webhooks/connect.mdx +84 -0
- package/docs/webhooks/deliveries.mdx +103 -0
- package/docs/webhooks/filters.mdx +144 -0
- package/docs/webhooks/human-in-the-loop.mdx +162 -0
- package/docs/webhooks/linear.mdx +190 -0
- package/docs/webhooks/overview.mdx +119 -0
- package/docs/webhooks/session-routing.mdx +145 -0
- package/docs/webhooks/slack.mdx +397 -0
- package/docs/webhooks/sources.mdx +221 -0
- package/docs/webhooks/waiters.mdx +194 -0
- package/package.json +3 -2
package/dist/commonjs/v3/ai.d.ts
CHANGED
|
@@ -33,6 +33,7 @@ type ChatTurnContext<TClientData = unknown> = {
|
|
|
33
33
|
turn: number;
|
|
34
34
|
continuation: boolean;
|
|
35
35
|
clientData?: TClientData;
|
|
36
|
+
recordUserMessage?: boolean;
|
|
36
37
|
};
|
|
37
38
|
export { __readChatSnapshotProductionPathForTests, __setReadChatSnapshotImplForTests, __setWriteChatSnapshotImplForTests, __writeChatSnapshotProductionPathForTests, } from "./chatSnapshotIo.js";
|
|
38
39
|
export { defaultStorage, memoryTranscriptStorage, reduceTranscriptChanges, snapshotTranscriptStorage, type LoadContextEvent, type MemoryTranscriptStorage, type TranscriptChange, type TranscriptChangeReason, type TranscriptChangeset, type TranscriptCursors, type TranscriptLoadOptions, type TranscriptLoadResult, type TranscriptScope, type TranscriptState, type TranscriptStorage, type TranscriptStorageContext, } from "./transcriptStorage.js";
|
|
@@ -1677,6 +1678,31 @@ export type ChatAgentOptions<TIdentifier extends string, TClientDataSchema exten
|
|
|
1677
1678
|
* Ignored for sessions with no pin, and for sessions using `lockToVersion`.
|
|
1678
1679
|
*/
|
|
1679
1680
|
versionSkew?: ChatVersionSkewPolicy;
|
|
1681
|
+
/**
|
|
1682
|
+
* Controls which chat content the chat runtime records on its spans in the run trace.
|
|
1683
|
+
*
|
|
1684
|
+
* - `recordUserMessage` (default `true`) records the last user message as `chat.user_message`
|
|
1685
|
+
* and as the turn span's preview text, and messages sent mid-turn as `pending.messages`.
|
|
1686
|
+
* - `recordClientData` (default `true`) records the raw `clientData` sent by the frontend as
|
|
1687
|
+
* `chat.client_data`.
|
|
1688
|
+
*
|
|
1689
|
+
* Set either to `false` to keep that content out of telemetry. Content recorded by the AI SDK's
|
|
1690
|
+
* own spans is controlled separately, through `experimental_telemetry` on the model call.
|
|
1691
|
+
*
|
|
1692
|
+
* @example
|
|
1693
|
+
* ```ts
|
|
1694
|
+
* chat.agent({
|
|
1695
|
+
* id: "my-chat",
|
|
1696
|
+
* telemetry: { recordUserMessage: false, recordClientData: false },
|
|
1697
|
+
* run: async ({ messages, signal, streamText }) =>
|
|
1698
|
+
* streamText({ model, messages, abortSignal: signal }),
|
|
1699
|
+
* });
|
|
1700
|
+
* ```
|
|
1701
|
+
*/
|
|
1702
|
+
telemetry?: {
|
|
1703
|
+
recordUserMessage?: boolean;
|
|
1704
|
+
recordClientData?: boolean;
|
|
1705
|
+
};
|
|
1680
1706
|
/**
|
|
1681
1707
|
* Schema for validating `clientData` from the frontend.
|
|
1682
1708
|
* Accepts Zod, ArkType, Valibot, or any supported schema library.
|
package/dist/commonjs/v3/ai.js
CHANGED
|
@@ -2880,7 +2880,6 @@ async function drainSteeringQueue(config, messages, steps, queueOverride) {
|
|
|
2880
2880
|
// Span attributes describe the offered batch; the chunk and callback below
|
|
2881
2881
|
// describe what was actually claimed and injected.
|
|
2882
2882
|
const messageTexts = uiMessages.map(textOfUIMessage);
|
|
2883
|
-
const _previewText = messageTexts.length === 1 ? messageTexts[0].slice(0, 80) : `${queue.length} messages`;
|
|
2884
2883
|
return tracer_js_1.tracer.startActiveSpan("pending message injected", async () => {
|
|
2885
2884
|
/**
|
|
2886
2885
|
* Claim before transforming, and inject only what was claimed.
|
|
@@ -3019,7 +3018,7 @@ async function drainSteeringQueue(config, messages, steps, queueOverride) {
|
|
|
3019
3018
|
[v3_1.SemanticInternalAttributes.STYLE_ICON]: "tabler-message-forward",
|
|
3020
3019
|
"pending.message_count": uiMessages.length,
|
|
3021
3020
|
"pending.step_number": stepNumber,
|
|
3022
|
-
"pending.messages": messageTexts,
|
|
3021
|
+
...(ctx?.recordUserMessage === false ? {} : { "pending.messages": messageTexts }),
|
|
3023
3022
|
...(ctx?.chatId ? { "pending.chat_id": ctx.chatId } : {}),
|
|
3024
3023
|
...(ctx?.turn != null ? { "pending.turn": ctx.turn } : {}),
|
|
3025
3024
|
...(0, v3_1.accessoryAttributes)({
|
|
@@ -3858,7 +3857,9 @@ function chatCustomAgent(options) {
|
|
|
3858
3857
|
return task;
|
|
3859
3858
|
}
|
|
3860
3859
|
function chatAgent(options) {
|
|
3861
|
-
const { run: userRun, clientDataSchema, onBoot, onRecoveryBoot, onPreload, onChatStart, onValidateMessages, hydrateMessages, storage, actionSchema, onAction, onTurnStart, onBeforeTurnComplete, onCompacted, compaction, pendingMessages: pendingMessagesConfig, prepareMessages, tools: toolsOption, onTurnComplete, maxTurns = 100, turnTimeout = "1h", idleTimeoutInSeconds = 30, chatAccessTokenTTL = "1h", preloadIdleTimeoutInSeconds, preloadTimeout, uiMessageStreamOptions, onChatSuspend, onChatResume, exitAfterPreloadIdle = false, oomMachine, registry: promptRegistry, system: agentSystem, cacheControl: agentCacheControl, systemProviderOptions: agentSystemProviderOptions, versionSkew, ...restOptions } = options;
|
|
3860
|
+
const { run: userRun, clientDataSchema, onBoot, onRecoveryBoot, onPreload, onChatStart, onValidateMessages, hydrateMessages, storage, actionSchema, onAction, onTurnStart, onBeforeTurnComplete, onCompacted, compaction, pendingMessages: pendingMessagesConfig, prepareMessages, tools: toolsOption, onTurnComplete, maxTurns = 100, turnTimeout = "1h", idleTimeoutInSeconds = 30, chatAccessTokenTTL = "1h", preloadIdleTimeoutInSeconds, preloadTimeout, uiMessageStreamOptions, onChatSuspend, onChatResume, exitAfterPreloadIdle = false, oomMachine, registry: promptRegistry, system: agentSystem, cacheControl: agentCacheControl, systemProviderOptions: agentSystemProviderOptions, versionSkew, telemetry: telemetryOptions, ...restOptions } = options;
|
|
3861
|
+
const recordUserMessage = telemetryOptions?.recordUserMessage ?? true;
|
|
3862
|
+
const recordClientData = telemetryOptions?.recordClientData ?? true;
|
|
3862
3863
|
if (hydrateMessages) {
|
|
3863
3864
|
if (storage) {
|
|
3864
3865
|
throw new Error(`chat.agent: "${options.id}" sets both \`hydrateMessages\` and \`storage\`. ` +
|
|
@@ -4995,7 +4996,7 @@ function chatAgent(options) {
|
|
|
4995
4996
|
: "tabler-message-chatbot",
|
|
4996
4997
|
[v3_1.SemanticInternalAttributes.ENTITY_TYPE]: isAction ? "chat-action" : "chat-turn",
|
|
4997
4998
|
};
|
|
4998
|
-
if (lastUserMessage) {
|
|
4999
|
+
if (lastUserMessage && recordUserMessage) {
|
|
4999
5000
|
turnAttributes["chat.user_message"] = lastUserMessage;
|
|
5000
5001
|
// Show a truncated preview of the user message as an accessory
|
|
5001
5002
|
const preview = lastUserMessage.length > 80
|
|
@@ -5006,7 +5007,7 @@ function chatAgent(options) {
|
|
|
5006
5007
|
style: "codepath",
|
|
5007
5008
|
}));
|
|
5008
5009
|
}
|
|
5009
|
-
if (wireMetadata !== undefined) {
|
|
5010
|
+
if (wireMetadata !== undefined && recordClientData) {
|
|
5010
5011
|
turnAttributes["chat.client_data"] =
|
|
5011
5012
|
typeof wireMetadata === "string" ? wireMetadata : JSON.stringify(wireMetadata);
|
|
5012
5013
|
}
|
|
@@ -5031,6 +5032,7 @@ function chatAgent(options) {
|
|
|
5031
5032
|
turn,
|
|
5032
5033
|
continuation,
|
|
5033
5034
|
clientData,
|
|
5035
|
+
recordUserMessage,
|
|
5034
5036
|
});
|
|
5035
5037
|
// Resolve the per-turn `tools` set now that turn context
|
|
5036
5038
|
// (incl. parsed clientData) exists, so every toModelMessages
|