@trigger.dev/sdk 4.7.4 → 4.7.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.
Files changed (48) hide show
  1. package/dist/commonjs/v3/ai.d.ts +26 -0
  2. package/dist/commonjs/v3/ai.js +7 -5
  3. package/dist/commonjs/v3/ai.js.map +1 -1
  4. package/dist/commonjs/v3/query.d.ts +434 -1
  5. package/dist/commonjs/v3/query.js +115 -0
  6. package/dist/commonjs/v3/query.js.map +1 -1
  7. package/dist/commonjs/version.js +1 -1
  8. package/dist/esm/v3/ai.d.ts +26 -0
  9. package/dist/esm/v3/ai.js +7 -5
  10. package/dist/esm/v3/ai.js.map +1 -1
  11. package/dist/esm/v3/query.d.ts +434 -1
  12. package/dist/esm/v3/query.js +115 -0
  13. package/dist/esm/v3/query.js.map +1 -1
  14. package/dist/esm/version.js +1 -1
  15. package/docs/ai-chat/actions.mdx +6 -1
  16. package/docs/ai-chat/backend.mdx +47 -0
  17. package/docs/ai-chat/patterns/redacting-telemetry.mdx +117 -0
  18. package/docs/ai-chat/pending-messages.mdx +2 -0
  19. package/docs/ai-chat/reference.mdx +53 -2
  20. package/docs/ai-chat/transcript-storage.mdx +1 -1
  21. package/docs/apikeys.mdx +6 -4
  22. package/docs/cli-runs-commands.mdx +2 -2
  23. package/docs/cli-tasks-commands.mdx +95 -0
  24. package/docs/config/config-file.mdx +58 -0
  25. package/docs/config/extensions/prismaExtension.mdx +4 -4
  26. package/docs/deploy-environment-variables.mdx +4 -0
  27. package/docs/deployment/atomic-deployment.mdx +3 -3
  28. package/docs/deployment/overview.mdx +1 -1
  29. package/docs/deployment/preview-branches.mdx +1 -1
  30. package/docs/github-actions.mdx +3 -3
  31. package/docs/limits.mdx +6 -0
  32. package/docs/manual-setup.mdx +1 -1
  33. package/docs/mcp-tools.mdx +99 -3
  34. package/docs/observability/dashboards.mdx +62 -0
  35. package/docs/runs/max-duration.mdx +4 -0
  36. package/docs/self-hosting/env/supervisor.mdx +1 -0
  37. package/docs/webhooks/channels.mdx +158 -0
  38. package/docs/webhooks/connect.mdx +84 -0
  39. package/docs/webhooks/deliveries.mdx +103 -0
  40. package/docs/webhooks/filters.mdx +150 -0
  41. package/docs/webhooks/human-in-the-loop.mdx +162 -0
  42. package/docs/webhooks/linear.mdx +190 -0
  43. package/docs/webhooks/overview.mdx +119 -0
  44. package/docs/webhooks/session-routing.mdx +145 -0
  45. package/docs/webhooks/slack.mdx +397 -0
  46. package/docs/webhooks/sources.mdx +224 -0
  47. package/docs/webhooks/waiters.mdx +194 -0
  48. package/package.json +3 -2
@@ -1,5 +1,6 @@
1
- import type { ApiRequestOptions, Prettify } from "@trigger.dev/core/v3";
1
+ import type { AddDashboardWidgetRequestBody, ApiRequestOptions, CreateDashboardRequestBody, Prettify, ReplaceDashboardRequestBody, UpdateDashboardRequestBody, UpdateDashboardWidgetRequestBody } from "@trigger.dev/core/v3";
2
2
  export type { QueryTable, RunsTableRow, RunFriendlyStatus } from "@trigger.dev/core/v3";
3
+ export type { DashboardObject, DashboardSummary, DashboardWidget, DashboardWidgetDisplay, DashboardWidgetInput, DashboardWidgetPosition, } from "@trigger.dev/core/v3";
3
4
  export type QueryScope = "environment" | "project" | "organization";
4
5
  export type QueryFormat = "json" | "csv";
5
6
  /**
@@ -107,6 +108,438 @@ declare function execute<TRow extends Record<string, any> = Record<string, any>>
107
108
  format: "json";
108
109
  results: Array<Prettify<TRow>>;
109
110
  }>;
111
+ /**
112
+ * Lists the built-in dashboards and your organization's custom dashboards, with their widgets.
113
+ */
114
+ declare function listDashboards(requestOptions?: ApiRequestOptions): Promise<{
115
+ dashboards: {
116
+ key: string;
117
+ title: string;
118
+ type?: "builtIn" | "custom" | undefined;
119
+ description?: string | undefined;
120
+ widgets: {
121
+ id: string;
122
+ title: string;
123
+ query: string;
124
+ type: "bignumber" | "chart" | "table" | "title";
125
+ }[];
126
+ }[];
127
+ }>;
128
+ /**
129
+ * Retrieves a custom dashboard, including every widget, its query and its grid position.
130
+ */
131
+ declare function retrieveDashboard(dashboardId: string, requestOptions?: ApiRequestOptions): import("@trigger.dev/core/v3").ApiPromise<{
132
+ id: string;
133
+ title: string;
134
+ description: string;
135
+ revision: string;
136
+ createdAt: Date;
137
+ updatedAt: Date;
138
+ widgets: {
139
+ id: string;
140
+ title: string;
141
+ query: string;
142
+ display: {
143
+ type: "table";
144
+ prettyFormatting: boolean;
145
+ sorting: {
146
+ desc: boolean;
147
+ id: string;
148
+ }[];
149
+ } | {
150
+ chartType: "bar" | "line";
151
+ xAxisColumn: string | null;
152
+ yAxisColumns: string[];
153
+ groupByColumn: string | null;
154
+ stacked: boolean;
155
+ sortByColumn: string | null;
156
+ sortDirection: "asc" | "desc";
157
+ aggregation: "avg" | "count" | "max" | "min" | "sum";
158
+ seriesColors?: Record<string, string> | undefined;
159
+ type: "chart";
160
+ } | {
161
+ column: string;
162
+ aggregation: "avg" | "count" | "first" | "last" | "max" | "min" | "sum";
163
+ sortDirection?: "asc" | "desc" | undefined;
164
+ abbreviate: boolean;
165
+ prefix?: string | undefined;
166
+ suffix?: string | undefined;
167
+ type: "bignumber";
168
+ } | {
169
+ type: "title";
170
+ };
171
+ fillGaps?: boolean | undefined;
172
+ position: {
173
+ x: number;
174
+ y: number;
175
+ w: number;
176
+ h: number;
177
+ };
178
+ }[];
179
+ }>;
180
+ /**
181
+ * Creates a custom dashboard, optionally with its widgets.
182
+ *
183
+ * @example
184
+ * ```ts
185
+ * const dashboard = await query.dashboards.create({
186
+ * title: "Email tasks",
187
+ * widgets: [
188
+ * {
189
+ * title: "Runs per day",
190
+ * query: "SELECT timeBucket(), count() AS runs FROM runs GROUP BY timeBucket ORDER BY timeBucket",
191
+ * display: {
192
+ * type: "chart",
193
+ * chartType: "bar",
194
+ * xAxisColumn: "timebucket",
195
+ * yAxisColumns: ["runs"],
196
+ * groupByColumn: null,
197
+ * stacked: false,
198
+ * sortByColumn: null,
199
+ * sortDirection: "asc",
200
+ * aggregation: "sum",
201
+ * },
202
+ * },
203
+ * ],
204
+ * });
205
+ * ```
206
+ */
207
+ declare function createDashboard(body: CreateDashboardRequestBody, requestOptions?: ApiRequestOptions): import("@trigger.dev/core/v3").ApiPromise<{
208
+ id: string;
209
+ title: string;
210
+ description: string;
211
+ revision: string;
212
+ createdAt: Date;
213
+ updatedAt: Date;
214
+ widgets: {
215
+ id: string;
216
+ title: string;
217
+ query: string;
218
+ display: {
219
+ type: "table";
220
+ prettyFormatting: boolean;
221
+ sorting: {
222
+ desc: boolean;
223
+ id: string;
224
+ }[];
225
+ } | {
226
+ chartType: "bar" | "line";
227
+ xAxisColumn: string | null;
228
+ yAxisColumns: string[];
229
+ groupByColumn: string | null;
230
+ stacked: boolean;
231
+ sortByColumn: string | null;
232
+ sortDirection: "asc" | "desc";
233
+ aggregation: "avg" | "count" | "max" | "min" | "sum";
234
+ seriesColors?: Record<string, string> | undefined;
235
+ type: "chart";
236
+ } | {
237
+ column: string;
238
+ aggregation: "avg" | "count" | "first" | "last" | "max" | "min" | "sum";
239
+ sortDirection?: "asc" | "desc" | undefined;
240
+ abbreviate: boolean;
241
+ prefix?: string | undefined;
242
+ suffix?: string | undefined;
243
+ type: "bignumber";
244
+ } | {
245
+ type: "title";
246
+ };
247
+ fillGaps?: boolean | undefined;
248
+ position: {
249
+ x: number;
250
+ y: number;
251
+ w: number;
252
+ h: number;
253
+ };
254
+ }[];
255
+ }>;
256
+ /**
257
+ * Renames a custom dashboard or changes its description.
258
+ */
259
+ declare function updateDashboard(dashboardId: string, body: UpdateDashboardRequestBody, requestOptions?: ApiRequestOptions): import("@trigger.dev/core/v3").ApiPromise<{
260
+ id: string;
261
+ title: string;
262
+ description: string;
263
+ revision: string;
264
+ createdAt: Date;
265
+ updatedAt: Date;
266
+ widgets: {
267
+ id: string;
268
+ title: string;
269
+ query: string;
270
+ display: {
271
+ type: "table";
272
+ prettyFormatting: boolean;
273
+ sorting: {
274
+ desc: boolean;
275
+ id: string;
276
+ }[];
277
+ } | {
278
+ chartType: "bar" | "line";
279
+ xAxisColumn: string | null;
280
+ yAxisColumns: string[];
281
+ groupByColumn: string | null;
282
+ stacked: boolean;
283
+ sortByColumn: string | null;
284
+ sortDirection: "asc" | "desc";
285
+ aggregation: "avg" | "count" | "max" | "min" | "sum";
286
+ seriesColors?: Record<string, string> | undefined;
287
+ type: "chart";
288
+ } | {
289
+ column: string;
290
+ aggregation: "avg" | "count" | "first" | "last" | "max" | "min" | "sum";
291
+ sortDirection?: "asc" | "desc" | undefined;
292
+ abbreviate: boolean;
293
+ prefix?: string | undefined;
294
+ suffix?: string | undefined;
295
+ type: "bignumber";
296
+ } | {
297
+ type: "title";
298
+ };
299
+ fillGaps?: boolean | undefined;
300
+ position: {
301
+ x: number;
302
+ y: number;
303
+ w: number;
304
+ h: number;
305
+ };
306
+ }[];
307
+ }>;
308
+ /**
309
+ * Replaces every widget on a custom dashboard. A widget that already exists keeps its position
310
+ * unless you pass a new one; new widgets without a `position` are placed full width below the others,
311
+ * in order. Pass the `revision` you last read to reject the write if someone else changed the
312
+ * dashboard in the meantime.
313
+ */
314
+ declare function replaceDashboard(dashboardId: string, body: ReplaceDashboardRequestBody, requestOptions?: ApiRequestOptions): import("@trigger.dev/core/v3").ApiPromise<{
315
+ id: string;
316
+ title: string;
317
+ description: string;
318
+ revision: string;
319
+ createdAt: Date;
320
+ updatedAt: Date;
321
+ widgets: {
322
+ id: string;
323
+ title: string;
324
+ query: string;
325
+ display: {
326
+ type: "table";
327
+ prettyFormatting: boolean;
328
+ sorting: {
329
+ desc: boolean;
330
+ id: string;
331
+ }[];
332
+ } | {
333
+ chartType: "bar" | "line";
334
+ xAxisColumn: string | null;
335
+ yAxisColumns: string[];
336
+ groupByColumn: string | null;
337
+ stacked: boolean;
338
+ sortByColumn: string | null;
339
+ sortDirection: "asc" | "desc";
340
+ aggregation: "avg" | "count" | "max" | "min" | "sum";
341
+ seriesColors?: Record<string, string> | undefined;
342
+ type: "chart";
343
+ } | {
344
+ column: string;
345
+ aggregation: "avg" | "count" | "first" | "last" | "max" | "min" | "sum";
346
+ sortDirection?: "asc" | "desc" | undefined;
347
+ abbreviate: boolean;
348
+ prefix?: string | undefined;
349
+ suffix?: string | undefined;
350
+ type: "bignumber";
351
+ } | {
352
+ type: "title";
353
+ };
354
+ fillGaps?: boolean | undefined;
355
+ position: {
356
+ x: number;
357
+ y: number;
358
+ w: number;
359
+ h: number;
360
+ };
361
+ }[];
362
+ }>;
363
+ /**
364
+ * Deletes a custom dashboard.
365
+ */
366
+ declare function deleteDashboard(dashboardId: string, requestOptions?: ApiRequestOptions): import("@trigger.dev/core/v3").ApiPromise<{
367
+ id: string;
368
+ }>;
369
+ /**
370
+ * Adds a widget to a custom dashboard. Without a `position` it is placed full width at the bottom.
371
+ */
372
+ declare function addDashboardWidget(dashboardId: string, body: AddDashboardWidgetRequestBody, requestOptions?: ApiRequestOptions): import("@trigger.dev/core/v3").ApiPromise<{
373
+ widgetId: string;
374
+ dashboard: {
375
+ id: string;
376
+ title: string;
377
+ description: string;
378
+ revision: string;
379
+ createdAt: Date;
380
+ updatedAt: Date;
381
+ widgets: {
382
+ id: string;
383
+ title: string;
384
+ query: string;
385
+ display: {
386
+ type: "table";
387
+ prettyFormatting: boolean;
388
+ sorting: {
389
+ desc: boolean;
390
+ id: string;
391
+ }[];
392
+ } | {
393
+ chartType: "bar" | "line";
394
+ xAxisColumn: string | null;
395
+ yAxisColumns: string[];
396
+ groupByColumn: string | null;
397
+ stacked: boolean;
398
+ sortByColumn: string | null;
399
+ sortDirection: "asc" | "desc";
400
+ aggregation: "avg" | "count" | "max" | "min" | "sum";
401
+ seriesColors?: Record<string, string> | undefined;
402
+ type: "chart";
403
+ } | {
404
+ column: string;
405
+ aggregation: "avg" | "count" | "first" | "last" | "max" | "min" | "sum";
406
+ sortDirection?: "asc" | "desc" | undefined;
407
+ abbreviate: boolean;
408
+ prefix?: string | undefined;
409
+ suffix?: string | undefined;
410
+ type: "bignumber";
411
+ } | {
412
+ type: "title";
413
+ };
414
+ fillGaps?: boolean | undefined;
415
+ position: {
416
+ x: number;
417
+ y: number;
418
+ w: number;
419
+ h: number;
420
+ };
421
+ }[];
422
+ };
423
+ }>;
424
+ /**
425
+ * Changes a widget's title, query, display, or position.
426
+ */
427
+ declare function updateDashboardWidget(dashboardId: string, widgetId: string, body: UpdateDashboardWidgetRequestBody, requestOptions?: ApiRequestOptions): import("@trigger.dev/core/v3").ApiPromise<{
428
+ id: string;
429
+ title: string;
430
+ description: string;
431
+ revision: string;
432
+ createdAt: Date;
433
+ updatedAt: Date;
434
+ widgets: {
435
+ id: string;
436
+ title: string;
437
+ query: string;
438
+ display: {
439
+ type: "table";
440
+ prettyFormatting: boolean;
441
+ sorting: {
442
+ desc: boolean;
443
+ id: string;
444
+ }[];
445
+ } | {
446
+ chartType: "bar" | "line";
447
+ xAxisColumn: string | null;
448
+ yAxisColumns: string[];
449
+ groupByColumn: string | null;
450
+ stacked: boolean;
451
+ sortByColumn: string | null;
452
+ sortDirection: "asc" | "desc";
453
+ aggregation: "avg" | "count" | "max" | "min" | "sum";
454
+ seriesColors?: Record<string, string> | undefined;
455
+ type: "chart";
456
+ } | {
457
+ column: string;
458
+ aggregation: "avg" | "count" | "first" | "last" | "max" | "min" | "sum";
459
+ sortDirection?: "asc" | "desc" | undefined;
460
+ abbreviate: boolean;
461
+ prefix?: string | undefined;
462
+ suffix?: string | undefined;
463
+ type: "bignumber";
464
+ } | {
465
+ type: "title";
466
+ };
467
+ fillGaps?: boolean | undefined;
468
+ position: {
469
+ x: number;
470
+ y: number;
471
+ w: number;
472
+ h: number;
473
+ };
474
+ }[];
475
+ }>;
476
+ /**
477
+ * Removes a widget from a custom dashboard.
478
+ */
479
+ declare function deleteDashboardWidget(dashboardId: string, widgetId: string, options?: {
480
+ revision?: string;
481
+ }, requestOptions?: ApiRequestOptions): import("@trigger.dev/core/v3").ApiPromise<{
482
+ id: string;
483
+ title: string;
484
+ description: string;
485
+ revision: string;
486
+ createdAt: Date;
487
+ updatedAt: Date;
488
+ widgets: {
489
+ id: string;
490
+ title: string;
491
+ query: string;
492
+ display: {
493
+ type: "table";
494
+ prettyFormatting: boolean;
495
+ sorting: {
496
+ desc: boolean;
497
+ id: string;
498
+ }[];
499
+ } | {
500
+ chartType: "bar" | "line";
501
+ xAxisColumn: string | null;
502
+ yAxisColumns: string[];
503
+ groupByColumn: string | null;
504
+ stacked: boolean;
505
+ sortByColumn: string | null;
506
+ sortDirection: "asc" | "desc";
507
+ aggregation: "avg" | "count" | "max" | "min" | "sum";
508
+ seriesColors?: Record<string, string> | undefined;
509
+ type: "chart";
510
+ } | {
511
+ column: string;
512
+ aggregation: "avg" | "count" | "first" | "last" | "max" | "min" | "sum";
513
+ sortDirection?: "asc" | "desc" | undefined;
514
+ abbreviate: boolean;
515
+ prefix?: string | undefined;
516
+ suffix?: string | undefined;
517
+ type: "bignumber";
518
+ } | {
519
+ type: "title";
520
+ };
521
+ fillGaps?: boolean | undefined;
522
+ position: {
523
+ x: number;
524
+ y: number;
525
+ w: number;
526
+ h: number;
527
+ };
528
+ }[];
529
+ }>;
110
530
  export declare const query: {
111
531
  execute: typeof execute;
532
+ dashboards: {
533
+ list: typeof listDashboards;
534
+ retrieve: typeof retrieveDashboard;
535
+ create: typeof createDashboard;
536
+ update: typeof updateDashboard;
537
+ replace: typeof replaceDashboard;
538
+ del: typeof deleteDashboard;
539
+ widgets: {
540
+ add: typeof addDashboardWidget;
541
+ update: typeof updateDashboardWidget;
542
+ del: typeof deleteDashboardWidget;
543
+ };
544
+ };
112
545
  };
@@ -42,7 +42,122 @@ function dateToISOString(date) {
42
42
  }
43
43
  return new Date(date).toISOString();
44
44
  }
45
+ function dashboardRequestOptions(name, attributes, requestOptions) {
46
+ return (0, v3_1.mergeRequestOptions)({ tracer: tracer_js_1.tracer, name, icon: "query", attributes }, requestOptions);
47
+ }
48
+ /**
49
+ * Lists the built-in dashboards and your organization's custom dashboards, with their widgets.
50
+ */
51
+ function listDashboards(requestOptions) {
52
+ return v3_1.apiClientManager
53
+ .clientOrThrow()
54
+ .listDashboards(dashboardRequestOptions("query.dashboards.list()", {}, requestOptions));
55
+ }
56
+ /**
57
+ * Retrieves a custom dashboard, including every widget, its query and its grid position.
58
+ */
59
+ function retrieveDashboard(dashboardId, requestOptions) {
60
+ return v3_1.apiClientManager
61
+ .clientOrThrow()
62
+ .retrieveDashboard(dashboardId, dashboardRequestOptions("query.dashboards.retrieve()", { dashboardId }, requestOptions));
63
+ }
64
+ /**
65
+ * Creates a custom dashboard, optionally with its widgets.
66
+ *
67
+ * @example
68
+ * ```ts
69
+ * const dashboard = await query.dashboards.create({
70
+ * title: "Email tasks",
71
+ * widgets: [
72
+ * {
73
+ * title: "Runs per day",
74
+ * query: "SELECT timeBucket(), count() AS runs FROM runs GROUP BY timeBucket ORDER BY timeBucket",
75
+ * display: {
76
+ * type: "chart",
77
+ * chartType: "bar",
78
+ * xAxisColumn: "timebucket",
79
+ * yAxisColumns: ["runs"],
80
+ * groupByColumn: null,
81
+ * stacked: false,
82
+ * sortByColumn: null,
83
+ * sortDirection: "asc",
84
+ * aggregation: "sum",
85
+ * },
86
+ * },
87
+ * ],
88
+ * });
89
+ * ```
90
+ */
91
+ function createDashboard(body, requestOptions) {
92
+ return v3_1.apiClientManager
93
+ .clientOrThrow()
94
+ .createDashboard(body, dashboardRequestOptions("query.dashboards.create()", { title: body.title }, requestOptions));
95
+ }
96
+ /**
97
+ * Renames a custom dashboard or changes its description.
98
+ */
99
+ function updateDashboard(dashboardId, body, requestOptions) {
100
+ return v3_1.apiClientManager
101
+ .clientOrThrow()
102
+ .updateDashboard(dashboardId, body, dashboardRequestOptions("query.dashboards.update()", { dashboardId }, requestOptions));
103
+ }
104
+ /**
105
+ * Replaces every widget on a custom dashboard. A widget that already exists keeps its position
106
+ * unless you pass a new one; new widgets without a `position` are placed full width below the others,
107
+ * in order. Pass the `revision` you last read to reject the write if someone else changed the
108
+ * dashboard in the meantime.
109
+ */
110
+ function replaceDashboard(dashboardId, body, requestOptions) {
111
+ return v3_1.apiClientManager
112
+ .clientOrThrow()
113
+ .replaceDashboard(dashboardId, body, dashboardRequestOptions("query.dashboards.replace()", { dashboardId }, requestOptions));
114
+ }
115
+ /**
116
+ * Deletes a custom dashboard.
117
+ */
118
+ function deleteDashboard(dashboardId, requestOptions) {
119
+ return v3_1.apiClientManager
120
+ .clientOrThrow()
121
+ .deleteDashboard(dashboardId, dashboardRequestOptions("query.dashboards.del()", { dashboardId }, requestOptions));
122
+ }
123
+ /**
124
+ * Adds a widget to a custom dashboard. Without a `position` it is placed full width at the bottom.
125
+ */
126
+ function addDashboardWidget(dashboardId, body, requestOptions) {
127
+ return v3_1.apiClientManager
128
+ .clientOrThrow()
129
+ .addDashboardWidget(dashboardId, body, dashboardRequestOptions("query.dashboards.widgets.add()", { dashboardId }, requestOptions));
130
+ }
131
+ /**
132
+ * Changes a widget's title, query, display, or position.
133
+ */
134
+ function updateDashboardWidget(dashboardId, widgetId, body, requestOptions) {
135
+ return v3_1.apiClientManager
136
+ .clientOrThrow()
137
+ .updateDashboardWidget(dashboardId, widgetId, body, dashboardRequestOptions("query.dashboards.widgets.update()", { dashboardId, widgetId }, requestOptions));
138
+ }
139
+ /**
140
+ * Removes a widget from a custom dashboard.
141
+ */
142
+ function deleteDashboardWidget(dashboardId, widgetId, options, requestOptions) {
143
+ return v3_1.apiClientManager
144
+ .clientOrThrow()
145
+ .deleteDashboardWidget(dashboardId, widgetId, options, dashboardRequestOptions("query.dashboards.widgets.del()", { dashboardId, widgetId }, requestOptions));
146
+ }
45
147
  exports.query = {
46
148
  execute,
149
+ dashboards: {
150
+ list: listDashboards,
151
+ retrieve: retrieveDashboard,
152
+ create: createDashboard,
153
+ update: updateDashboard,
154
+ replace: replaceDashboard,
155
+ del: deleteDashboard,
156
+ widgets: {
157
+ add: addDashboardWidget,
158
+ update: updateDashboardWidget,
159
+ del: deleteDashboardWidget,
160
+ },
161
+ },
47
162
  };
48
163
  //# sourceMappingURL=query.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"query.js","sourceRoot":"","sources":["../../../src/v3/query.ts"],"names":[],"mappings":";;;AACA,6CAA6E;AAC7E,2CAAqC;AAqHrC,iBAAiB;AACjB,SAAS,OAAO,CACd,KAAa,EACb,OAAsB,EACtB,cAAkC;IAElC,MAAM,SAAS,GAAG,qBAAgB,CAAC,aAAa,EAAE,CAAC;IAEnD,MAAM,IAAI,GAAG,eAAe,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAC5C,MAAM,EAAE,GAAG,eAAe,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IAExC,MAAM,eAAe,GAAG,IAAA,wBAAmB,EACzC;QACE,MAAM,EAAN,kBAAM;QACN,IAAI,EAAE,iBAAiB;QACvB,IAAI,EAAE,OAAO;QACb,UAAU,EAAE;YACV,KAAK,EAAE,OAAO,EAAE,KAAK,IAAI,aAAa;YACtC,MAAM,EAAE,OAAO,EAAE,MAAM,IAAI,MAAM;YACjC,KAAK;YACL,MAAM,EAAE,OAAO,EAAE,MAAM;YACvB,IAAI;YACJ,EAAE;SACH;KACF,EACD,cAAc,CACf,CAAC;IAEF,OAAO,SAAS;SACb,YAAY,CACX,KAAK,EACL;QACE,KAAK,EAAE,OAAO,EAAE,KAAK;QACrB,MAAM,EAAE,OAAO,EAAE,MAAM;QACvB,IAAI;QACJ,EAAE;QACF,MAAM,EAAE,OAAO,EAAE,MAAM;KACxB,EACD,eAAe,CAChB;SACA,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE;QACjB,OAAO,QAAQ,CAAC;IAClB,CAAC,CAA2F,CAAC;AACjG,CAAC;AAED,SAAS,eAAe,CAAC,IAA+B;IACtD,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,IAAI,IAAI,YAAY,IAAI,EAAE,CAAC;QACzB,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC;IAC5B,CAAC;IAED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,EAAE,EACzB,cAAc,CACf,CACF,CAAC;AACN,CAAC;AAEY,QAAA,KAAK,GAAG;IACnB,OAAO;IACP,UAAU,EAAE;QACV,IAAI,EAAE,cAAc;QACpB,QAAQ,EAAE,iBAAiB;QAC3B,MAAM,EAAE,eAAe;QACvB,MAAM,EAAE,eAAe;QACvB,OAAO,EAAE,gBAAgB;QACzB,GAAG,EAAE,eAAe;QACpB,OAAO,EAAE;YACP,GAAG,EAAE,kBAAkB;YACvB,MAAM,EAAE,qBAAqB;YAC7B,GAAG,EAAE,qBAAqB;SAC3B;KACF;CACF,CAAC"}
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = "4.7.4";
4
+ exports.VERSION = "4.7.6";
5
5
  //# sourceMappingURL=version.js.map
@@ -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/esm/v3/ai.js CHANGED
@@ -2867,7 +2867,6 @@ async function drainSteeringQueue(config, messages, steps, queueOverride) {
2867
2867
  // Span attributes describe the offered batch; the chunk and callback below
2868
2868
  // describe what was actually claimed and injected.
2869
2869
  const messageTexts = uiMessages.map(textOfUIMessage);
2870
- const _previewText = messageTexts.length === 1 ? messageTexts[0].slice(0, 80) : `${queue.length} messages`;
2871
2870
  return tracer.startActiveSpan("pending message injected", async () => {
2872
2871
  /**
2873
2872
  * Claim before transforming, and inject only what was claimed.
@@ -3006,7 +3005,7 @@ async function drainSteeringQueue(config, messages, steps, queueOverride) {
3006
3005
  [SemanticInternalAttributes.STYLE_ICON]: "tabler-message-forward",
3007
3006
  "pending.message_count": uiMessages.length,
3008
3007
  "pending.step_number": stepNumber,
3009
- "pending.messages": messageTexts,
3008
+ ...(ctx?.recordUserMessage === false ? {} : { "pending.messages": messageTexts }),
3010
3009
  ...(ctx?.chatId ? { "pending.chat_id": ctx.chatId } : {}),
3011
3010
  ...(ctx?.turn != null ? { "pending.turn": ctx.turn } : {}),
3012
3011
  ...accessoryAttributes({
@@ -3845,7 +3844,9 @@ function chatCustomAgent(options) {
3845
3844
  return task;
3846
3845
  }
3847
3846
  function chatAgent(options) {
3848
- 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;
3847
+ 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;
3848
+ const recordUserMessage = telemetryOptions?.recordUserMessage ?? true;
3849
+ const recordClientData = telemetryOptions?.recordClientData ?? true;
3849
3850
  if (hydrateMessages) {
3850
3851
  if (storage) {
3851
3852
  throw new Error(`chat.agent: "${options.id}" sets both \`hydrateMessages\` and \`storage\`. ` +
@@ -4982,7 +4983,7 @@ function chatAgent(options) {
4982
4983
  : "tabler-message-chatbot",
4983
4984
  [SemanticInternalAttributes.ENTITY_TYPE]: isAction ? "chat-action" : "chat-turn",
4984
4985
  };
4985
- if (lastUserMessage) {
4986
+ if (lastUserMessage && recordUserMessage) {
4986
4987
  turnAttributes["chat.user_message"] = lastUserMessage;
4987
4988
  // Show a truncated preview of the user message as an accessory
4988
4989
  const preview = lastUserMessage.length > 80
@@ -4993,7 +4994,7 @@ function chatAgent(options) {
4993
4994
  style: "codepath",
4994
4995
  }));
4995
4996
  }
4996
- if (wireMetadata !== undefined) {
4997
+ if (wireMetadata !== undefined && recordClientData) {
4997
4998
  turnAttributes["chat.client_data"] =
4998
4999
  typeof wireMetadata === "string" ? wireMetadata : JSON.stringify(wireMetadata);
4999
5000
  }
@@ -5018,6 +5019,7 @@ function chatAgent(options) {
5018
5019
  turn,
5019
5020
  continuation,
5020
5021
  clientData,
5022
+ recordUserMessage,
5021
5023
  });
5022
5024
  // Resolve the per-turn `tools` set now that turn context
5023
5025
  // (incl. parsed clientData) exists, so every toModelMessages