@mastra/react 1.12.0-alpha.9 → 1.13.0-alpha.0

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 (130) hide show
  1. package/dist/{accumulator-BQGsraqS.cjs → accumulator-BmD8-x9I.cjs} +52 -4
  2. package/dist/accumulator-BmD8-x9I.cjs.map +1 -0
  3. package/dist/{accumulator-C8kIc450.js → accumulator-D9jAph99.js} +52 -4
  4. package/dist/accumulator-D9jAph99.js.map +1 -0
  5. package/dist/chat/index.cjs +1 -1
  6. package/dist/chat/index.js +1 -2
  7. package/dist/combine-by-ids-D_lp6Dvq.cjs.map +1 -1
  8. package/dist/experiments-B7vRMK5T.js +306 -0
  9. package/dist/experiments-B7vRMK5T.js.map +1 -0
  10. package/dist/experiments-CJw1N3FB.cjs +353 -0
  11. package/dist/experiments-CJw1N3FB.cjs.map +1 -0
  12. package/dist/hooks/agents/index.cjs +2 -2
  13. package/dist/hooks/agents/index.cjs.map +1 -1
  14. package/dist/hooks/agents/index.js +2 -2
  15. package/dist/hooks/agents/index.js.map +1 -1
  16. package/dist/hooks/auth/index.cjs +2 -2
  17. package/dist/hooks/auth/index.cjs.map +1 -1
  18. package/dist/hooks/auth/index.js +2 -2
  19. package/dist/hooks/auth/index.js.map +1 -1
  20. package/dist/hooks/capabilities/index.cjs +58 -1
  21. package/dist/hooks/capabilities/index.cjs.map +1 -1
  22. package/dist/hooks/capabilities/index.d.ts +4 -0
  23. package/dist/hooks/capabilities/index.d.ts.map +1 -1
  24. package/dist/hooks/capabilities/index.js +55 -2
  25. package/dist/hooks/capabilities/index.js.map +1 -1
  26. package/dist/hooks/capabilities/use-span-aggregate-available.d.ts +9 -0
  27. package/dist/hooks/capabilities/use-span-aggregate-available.d.ts.map +1 -0
  28. package/dist/hooks/capabilities/use-span-query-available.d.ts +9 -0
  29. package/dist/hooks/capabilities/use-span-query-available.d.ts.map +1 -0
  30. package/dist/hooks/capabilities/use-thread-query-available.d.ts +9 -0
  31. package/dist/hooks/capabilities/use-thread-query-available.d.ts.map +1 -0
  32. package/dist/hooks/capabilities/use-trace-query-delta-polling-available.d.ts +10 -0
  33. package/dist/hooks/capabilities/use-trace-query-delta-polling-available.d.ts.map +1 -0
  34. package/dist/hooks/configuration/index.cjs.map +1 -1
  35. package/dist/hooks/datasets/index.cjs +25 -1
  36. package/dist/hooks/datasets/index.cjs.map +1 -1
  37. package/dist/hooks/datasets/index.js +25 -2
  38. package/dist/hooks/datasets/index.js.map +1 -1
  39. package/dist/hooks/datasets/use-datasets.d.ts +7 -0
  40. package/dist/hooks/datasets/use-datasets.d.ts.map +1 -1
  41. package/dist/hooks/embedders/index.cjs.map +1 -1
  42. package/dist/hooks/experiments/index.cjs +9 -235
  43. package/dist/hooks/experiments/index.d.ts +1 -0
  44. package/dist/hooks/experiments/index.d.ts.map +1 -1
  45. package/dist/hooks/experiments/index.js +1 -229
  46. package/dist/hooks/experiments/usage-accumulator.d.ts +25 -0
  47. package/dist/hooks/experiments/usage-accumulator.d.ts.map +1 -0
  48. package/dist/hooks/experiments/use-experiment-item-usage.d.ts +2 -7
  49. package/dist/hooks/experiments/use-experiment-item-usage.d.ts.map +1 -1
  50. package/dist/hooks/experiments/use-experiments-list-metrics.d.ts +19 -0
  51. package/dist/hooks/experiments/use-experiments-list-metrics.d.ts.map +1 -0
  52. package/dist/hooks/feedback/index.cjs.map +1 -1
  53. package/dist/hooks/llm/index.cjs.map +1 -1
  54. package/dist/hooks/logs/index.cjs.map +1 -1
  55. package/dist/hooks/mcps/index.cjs.map +1 -1
  56. package/dist/hooks/memory/index.cjs +10 -10
  57. package/dist/hooks/memory/index.cjs.map +1 -1
  58. package/dist/hooks/memory/index.js +10 -10
  59. package/dist/hooks/memory/index.js.map +1 -1
  60. package/dist/hooks/metrics/index.cjs +13 -11
  61. package/dist/hooks/metrics/index.cjs.map +1 -1
  62. package/dist/hooks/metrics/index.js +13 -11
  63. package/dist/hooks/metrics/index.js.map +1 -1
  64. package/dist/hooks/processors/index.cjs.map +1 -1
  65. package/dist/hooks/prompt-blocks/index.cjs.map +1 -1
  66. package/dist/hooks/query/index.cjs.map +1 -1
  67. package/dist/hooks/review/index.cjs +2 -2
  68. package/dist/hooks/review/index.cjs.map +1 -1
  69. package/dist/hooks/review/index.js +1 -1
  70. package/dist/hooks/schedules/index.cjs.map +1 -1
  71. package/dist/hooks/scores/index.cjs.map +1 -1
  72. package/dist/hooks/templates/index.cjs +20 -18
  73. package/dist/hooks/templates/index.cjs.map +1 -1
  74. package/dist/hooks/templates/index.js +20 -18
  75. package/dist/hooks/templates/index.js.map +1 -1
  76. package/dist/hooks/templates/use-templates.d.ts.map +1 -1
  77. package/dist/hooks/tool-providers/index.cjs +1 -1
  78. package/dist/hooks/tool-providers/index.cjs.map +1 -1
  79. package/dist/hooks/tool-providers/index.js +1 -1
  80. package/dist/hooks/tool-providers/index.js.map +1 -1
  81. package/dist/hooks/tools/index.cjs.map +1 -1
  82. package/dist/hooks/traces/index.cjs +292 -9
  83. package/dist/hooks/traces/index.cjs.map +1 -1
  84. package/dist/hooks/traces/index.d.ts +2 -0
  85. package/dist/hooks/traces/index.d.ts.map +1 -1
  86. package/dist/hooks/traces/index.js +285 -10
  87. package/dist/hooks/traces/index.js.map +1 -1
  88. package/dist/hooks/traces/use-query-spans.d.ts +27 -0
  89. package/dist/hooks/traces/use-query-spans.d.ts.map +1 -0
  90. package/dist/hooks/traces/use-query-threads.d.ts +30 -0
  91. package/dist/hooks/traces/use-query-threads.d.ts.map +1 -0
  92. package/dist/hooks/traces/use-trace-query.d.ts +50 -1
  93. package/dist/hooks/traces/use-trace-query.d.ts.map +1 -1
  94. package/dist/hooks/traces/use-traces.d.ts +37 -37
  95. package/dist/hooks/vectors/index.cjs.map +1 -1
  96. package/dist/hooks/voice/index.cjs.map +1 -1
  97. package/dist/hooks/workflows/index.cjs +1 -1
  98. package/dist/hooks/workflows/index.cjs.map +1 -1
  99. package/dist/hooks/workflows/index.js +1 -1
  100. package/dist/hooks/workspace/index.cjs +1 -1
  101. package/dist/hooks/workspace/index.cjs.map +1 -1
  102. package/dist/hooks/workspace/index.js +1 -1
  103. package/dist/hooks/workspace/index.js.map +1 -1
  104. package/dist/{hooks-CIutb3DO.cjs → hooks-C6CJtoOR.cjs} +6 -4
  105. package/dist/hooks-C6CJtoOR.cjs.map +1 -0
  106. package/dist/{hooks-0L0RNfau.js → hooks-DG-Y1KFe.js} +2 -2
  107. package/dist/{hooks-0L0RNfau.js.map → hooks-DG-Y1KFe.js.map} +1 -1
  108. package/dist/{hooks-FVbeHlov.js → hooks-DvLSZtUd.js} +6 -4
  109. package/dist/{hooks-FVbeHlov.js.map → hooks-DvLSZtUd.js.map} +1 -1
  110. package/dist/{hooks-_YevKidX.cjs → hooks-XYsmqFCz.cjs} +2 -2
  111. package/dist/hooks-XYsmqFCz.cjs.map +1 -0
  112. package/dist/index.cjs +3 -3
  113. package/dist/index.cjs.map +1 -1
  114. package/dist/index.js +3 -3
  115. package/dist/lib/mastra-db/accumulator.d.ts +0 -6
  116. package/dist/lib/mastra-db/accumulator.d.ts.map +1 -1
  117. package/dist/mastra-client-context-DzX3f0RF.cjs.map +1 -1
  118. package/dist/ui/index.cjs +4 -4
  119. package/dist/ui/index.cjs.map +1 -1
  120. package/dist/ui/index.js +3 -3
  121. package/dist/ui/index.js.map +1 -1
  122. package/dist/use-in-view-B6eJO9Zi.cjs.map +1 -1
  123. package/dist/voice-BOtUdMi8.cjs.map +1 -1
  124. package/package.json +7 -7
  125. package/dist/accumulator-BQGsraqS.cjs.map +0 -1
  126. package/dist/accumulator-C8kIc450.js.map +0 -1
  127. package/dist/hooks/experiments/index.cjs.map +0 -1
  128. package/dist/hooks/experiments/index.js.map +0 -1
  129. package/dist/hooks-CIutb3DO.cjs.map +0 -1
  130. package/dist/hooks-_YevKidX.cjs.map +0 -1
@@ -18,7 +18,7 @@ import { EntityType } from "@mastra/core/observability";
18
18
  * through to the store's discovery refresh. Matching the server TTL keeps the
19
19
  * client from asking more often than the answer can change.
20
20
  */
21
- const DISCOVERY_STALE_TIME = 300 * 1e3;
21
+ const DISCOVERY_STALE_TIME = 3e5;
22
22
  //#endregion
23
23
  //#region src/hooks/traces/use-branch.ts
24
24
  /**
@@ -135,7 +135,7 @@ const useServiceNames = ({ queryOptions } = {}) => {
135
135
  };
136
136
  //#endregion
137
137
  //#region src/hooks/traces/use-span-detail.ts
138
- const IMMUTABLE_CACHE_TIME$1 = 1e3 * 60 * 60 * 24 * 30;
138
+ const IMMUTABLE_CACHE_TIME$1 = 2592e6;
139
139
  /**
140
140
  * Does not guard on empty ids; pass `queryOptions: { enabled }` to skip the fetch.
141
141
  */
@@ -200,7 +200,7 @@ function useThreadHasOtherTraces({ threadId, queryOptions }) {
200
200
  }
201
201
  //#endregion
202
202
  //#region src/hooks/traces/use-trace-light-spans.ts
203
- const IMMUTABLE_CACHE_TIME = 1e3 * 60 * 60 * 24 * 30;
203
+ const IMMUTABLE_CACHE_TIME = 2592e6;
204
204
  /**
205
205
  * Does not guard on empty ids; pass `queryOptions: { enabled }` to skip the fetch.
206
206
  */
@@ -319,6 +319,8 @@ function useTraceOrBranchSpans({ traceId, anchorSpanId, listMode, depth, queryOp
319
319
  //#endregion
320
320
  //#region src/hooks/traces/use-trace-query.ts
321
321
  const TRACE_QUERY_PER_PAGE = 25;
322
+ /** Max traces per delta request; the server caps `limit` at 100. */
323
+ const TRACE_QUERY_DELTA_LIMIT = 100;
322
324
  function getTraceQueryNextPageParam(lastPage) {
323
325
  return lastPage?.page.next ?? void 0;
324
326
  }
@@ -368,16 +370,101 @@ function selectLegacyTraceQueryTraces(data) {
368
370
  function getLegacyTraceQueryNextPageParam(lastPage) {
369
371
  return lastPage.pagination?.hasMore ? lastPage.pagination.page + 1 : void 0;
370
372
  }
373
+ /** Cache key of `useTraceQuery`'s trace-query list. Pass the same `query` and `limit` to share it. */
374
+ const traceQueryKey = (query, limit = 25) => [
375
+ "trace-query",
376
+ query,
377
+ limit
378
+ ];
379
+ function traceSortValue(trace, field) {
380
+ if (field === "timeToFirstChunkMs") return trace.timeToFirstChunkMs ?? null;
381
+ const value = trace[field];
382
+ return value == null ? null : Date.parse(value);
383
+ }
384
+ /** Mirrors the server's keyset order: empty values last in both directions, ties by ascending `traceId`. */
385
+ function compareTraces(orderBy) {
386
+ return (a, b) => {
387
+ const va = traceSortValue(a, orderBy.field);
388
+ const vb = traceSortValue(b, orderBy.field);
389
+ if (va !== vb) {
390
+ if (va === null) return 1;
391
+ if (vb === null) return -1;
392
+ return orderBy.direction === "asc" ? va - vb : vb - va;
393
+ }
394
+ return a.traceId < b.traceId ? -1 : a.traceId > b.traceId ? 1 : 0;
395
+ };
396
+ }
397
+ /**
398
+ * Merges delta-polled traces into the pages of a `useTraceQuery` list, without mutating `data`.
399
+ * A trace already on a page is replaced in place when its sort value is unchanged; otherwise it is
400
+ * removed and placed again like a new trace (sorting by `endedAt`, a running trace moves once it
401
+ * ends). A new trace goes into the first page whose last row sorts after it; when no loaded page does, it is
402
+ * appended to the last page if that is the end of the list, and skipped otherwise, since keyset
403
+ * pagination returns it once the user scrolls there. Page cursors are kept as they are, and `data`
404
+ * itself is returned when nothing changed.
405
+ */
406
+ function mergeTraceQueryDelta(data, traces, orderBy) {
407
+ if (traces.length === 0 || data.pages.length === 0) return data;
408
+ const incoming = new Map(traces.map((trace) => [trace.traceId, trace]));
409
+ const rows = data.pages.map((page) => page.traces);
410
+ const changed = /* @__PURE__ */ new Set();
411
+ const write = (pageIndex, next) => {
412
+ rows[pageIndex] = next;
413
+ changed.add(pageIndex);
414
+ };
415
+ const sortBy = orderBy?.[0] ?? {
416
+ field: "startedAt",
417
+ direction: "desc"
418
+ };
419
+ const compare = compareTraces(sortBy);
420
+ const replacedInPlace = /* @__PURE__ */ new Set();
421
+ rows.forEach((pageRows, pageIndex) => {
422
+ if (!pageRows.some((row) => incoming.has(row.traceId))) return;
423
+ const next = [];
424
+ for (const row of pageRows) {
425
+ const update = incoming.get(row.traceId);
426
+ if (!update) next.push(row);
427
+ else if (traceSortValue(update, sortBy.field) === traceSortValue(row, sortBy.field)) {
428
+ next.push(update);
429
+ replacedInPlace.add(row.traceId);
430
+ }
431
+ }
432
+ write(pageIndex, next);
433
+ });
434
+ for (const traceId of replacedInPlace) incoming.delete(traceId);
435
+ const lastIndex = rows.length - 1;
436
+ for (const trace of incoming.values()) {
437
+ let pageIndex = rows.findIndex((pageRows) => {
438
+ const last = pageRows[pageRows.length - 1];
439
+ return last !== void 0 && compare(trace, last) < 0;
440
+ });
441
+ if (pageIndex === -1) {
442
+ if (data.pages[lastIndex].page.next !== null) continue;
443
+ pageIndex = lastIndex;
444
+ }
445
+ const pageRows = rows[pageIndex];
446
+ const at = pageRows.findIndex((row) => compare(trace, row) < 0);
447
+ write(pageIndex, at === -1 ? [...pageRows, trace] : [
448
+ ...pageRows.slice(0, at),
449
+ trace,
450
+ ...pageRows.slice(at)
451
+ ]);
452
+ }
453
+ if (changed.size === 0) return data;
454
+ return {
455
+ ...data,
456
+ pages: data.pages.map((page, pageIndex) => changed.has(pageIndex) ? {
457
+ ...page,
458
+ traces: rows[pageIndex]
459
+ } : page)
460
+ };
461
+ }
371
462
  /** Queries traces with cursor pagination and viewport-driven loading. */
372
463
  function useTraceQuery({ query, limit = 25, enabled = true, withQueryTrace = true, legacyFilters, queryOptions }) {
373
464
  const client = useMastraClient();
374
465
  const { inView, setRef: setEndOfListElement } = useInView();
375
466
  const queryResult = useInfiniteQuery({
376
- queryKey: [
377
- "trace-query",
378
- query,
379
- limit
380
- ],
467
+ queryKey: traceQueryKey(query, limit),
381
468
  queryFn: query ? async ({ pageParam }) => {
382
469
  const response = await new MastraClient({
383
470
  ...client.options,
@@ -455,6 +542,194 @@ function useTraceQuery({ query, limit = 25, enabled = true, withQueryTrace = tru
455
542
  setEndOfListElement
456
543
  };
457
544
  }
545
+ function omitOrderBy({ orderBy: _orderBy, ...rest }) {
546
+ return rest;
547
+ }
548
+ /** Request timeouts and rate limits clear up on their own, unlike the other 4xx refusals. */
549
+ const TRANSIENT_CLIENT_ERROR_STATUSES = /* @__PURE__ */ new Set([408, 429]);
550
+ /** The server refused the request or does not support delta polling; polling again cannot change that. */
551
+ function isRejectedDeltaRequest(error) {
552
+ if (!(error instanceof MastraClientError) || TRANSIENT_CLIENT_ERROR_STATUSES.has(error.status)) return false;
553
+ return error.status >= 400 && error.status < 500 || error.status === 501;
554
+ }
555
+ const isCursorConflict = (error) => error instanceof MastraClientError && error.status === 409;
556
+ /**
557
+ * Polls `queryTraces({ mode: 'delta' })` and merges new or updated traces into the list of a
558
+ * `useTraceQuery` rendered with the same `query` and `limit`. The first request only establishes
559
+ * the server cursor; each later poll drains every batch since that cursor. A cursor conflict (409)
560
+ * starts over with a new cursor. A poll that returns while the list is loading a page, or before
561
+ * the list has loaded at all, keeps its cursor and asks again on the next poll.
562
+ *
563
+ * The cursor is keyed on the query without `orderBy` (delta polls cannot sort) and on `limit`, so
564
+ * re-sorting the list keeps polling from the same cursor, and lists with different page sizes each
565
+ * get their own cursor.
566
+ *
567
+ * Requires the `deltaPolling` capability (see `useTraceQueryDeltaPollingAvailable`). The list's
568
+ * `timeRange.to` must not move between polls, so a live list needs a `to` in the future.
569
+ *
570
+ * Known limitation: the cursor is established in parallel with the list's first page, so a trace
571
+ * that completes between the first page's read and the cursor can be missed until the list is
572
+ * refetched. Traces returned by both are merged by `traceId`.
573
+ */
574
+ function useTraceQueryLatest({ query, limit = 25, enabled = true, refetchInterval = false, queryOptions }) {
575
+ const client = useMastraClient();
576
+ const queryClient = useQueryClient();
577
+ const deltaQuery = query && omitOrderBy(query);
578
+ const queryKey = [
579
+ "trace-query-latest",
580
+ deltaQuery,
581
+ limit
582
+ ];
583
+ return useQuery({
584
+ queryKey,
585
+ queryFn: query && deltaQuery ? async () => {
586
+ const mastra = new MastraClient({
587
+ ...client.options,
588
+ retries: 0
589
+ });
590
+ const bootstrap = async () => {
591
+ return { deltaCursor: (await mastra.queryTraces({
592
+ ...deltaQuery,
593
+ mode: "delta"
594
+ })).deltaCursor };
595
+ };
596
+ const previous = queryClient.getQueryData(queryKey);
597
+ if (!previous) return bootstrap();
598
+ const traces = [];
599
+ let deltaCursor = previous.deltaCursor;
600
+ try {
601
+ for (let hasMore = true; hasMore;) {
602
+ const response = await mastra.queryTraces({
603
+ ...deltaQuery,
604
+ mode: "delta",
605
+ after: deltaCursor,
606
+ limit: 100
607
+ });
608
+ traces.push(...response.traces);
609
+ deltaCursor = response.deltaCursor;
610
+ hasMore = response.delta.hasMore;
611
+ }
612
+ } catch (error) {
613
+ if (isCursorConflict(error)) return bootstrap();
614
+ throw error;
615
+ }
616
+ const listKey = traceQueryKey(query, limit);
617
+ const listState = queryClient.getQueryState(listKey);
618
+ if (!listState?.data || listState.fetchStatus === "fetching") return previous;
619
+ queryClient.setQueryData(listKey, (data) => data ? mergeTraceQueryDelta(data, traces, query.orderBy) : data);
620
+ return { deltaCursor };
621
+ } : skipToken,
622
+ retry: false,
623
+ refetchInterval: (q) => isRejectedDeltaRequest(q.state.error) ? false : refetchInterval,
624
+ refetchIntervalInBackground: false,
625
+ enabled: enabled && !!query,
626
+ ...queryOptions
627
+ });
628
+ }
629
+ //#endregion
630
+ //#region src/hooks/traces/use-query-spans.ts
631
+ const SPAN_QUERY_PER_PAGE = 25;
632
+ const selectSpans = (data) => data.pages.flatMap((page) => page.spans);
633
+ /** Queries completed spans with cursor pagination and viewport-driven loading. */
634
+ function useQuerySpans({ query, limit = 25, enabled = true, queryOptions }) {
635
+ const client = useMastraClient();
636
+ const { inView, setRef: setEndOfListElement } = useInView();
637
+ const { data, hasNextPage, isFetchingNextPage, fetchNextPage, isLoading, isFetching, isError, error, refetch, isFetchNextPageError } = useInfiniteQuery({
638
+ queryKey: [
639
+ "span-query",
640
+ query,
641
+ limit
642
+ ],
643
+ queryFn: query ? ({ pageParam }) => client.querySpans({
644
+ ...query,
645
+ page: pageParam ? {
646
+ limit,
647
+ after: pageParam
648
+ } : { limit }
649
+ }) : skipToken,
650
+ initialPageParam: void 0,
651
+ getNextPageParam: (lastPage) => lastPage.page.next ?? void 0,
652
+ select: selectSpans,
653
+ retry: false,
654
+ placeholderData: keepPreviousData,
655
+ enabled,
656
+ ...queryOptions
657
+ });
658
+ useEffect(() => {
659
+ if (enabled && inView && hasNextPage && !isFetching && !isFetchNextPageError) fetchNextPage();
660
+ }, [
661
+ enabled,
662
+ inView,
663
+ hasNextPage,
664
+ isFetching,
665
+ isFetchNextPageError,
666
+ fetchNextPage
667
+ ]);
668
+ return {
669
+ spans: data,
670
+ hasNextPage,
671
+ isFetchingNextPage,
672
+ fetchNextPage: () => void fetchNextPage(),
673
+ setEndOfListElement,
674
+ isLoading,
675
+ isFetching,
676
+ isError,
677
+ error,
678
+ refetch: () => void refetch()
679
+ };
680
+ }
681
+ //#endregion
682
+ //#region src/hooks/traces/use-query-threads.ts
683
+ const THREAD_QUERY_PER_PAGE = 25;
684
+ const selectThreads = (data) => data.pages.flatMap((page) => page.threads);
685
+ /** Queries thread rows with cursor pagination and viewport-driven loading. */
686
+ function useQueryThreads({ query, limit = 25, enabled = true, queryOptions }) {
687
+ const client = useMastraClient();
688
+ const { inView, setRef: setEndOfListElement } = useInView();
689
+ const { data, hasNextPage, isFetchingNextPage, fetchNextPage, isLoading, isFetching, isError, error, refetch, isFetchNextPageError } = useInfiniteQuery({
690
+ queryKey: [
691
+ "thread-query",
692
+ query,
693
+ limit
694
+ ],
695
+ queryFn: query ? ({ pageParam }) => client.queryTraceThreads({
696
+ ...query,
697
+ page: pageParam ? {
698
+ limit,
699
+ after: pageParam
700
+ } : { limit }
701
+ }) : skipToken,
702
+ initialPageParam: void 0,
703
+ getNextPageParam: (lastPage) => lastPage.page.next ?? void 0,
704
+ select: selectThreads,
705
+ retry: false,
706
+ placeholderData: keepPreviousData,
707
+ enabled,
708
+ ...queryOptions
709
+ });
710
+ useEffect(() => {
711
+ if (enabled && inView && hasNextPage && !isFetching && !isFetchNextPageError) fetchNextPage();
712
+ }, [
713
+ enabled,
714
+ inView,
715
+ hasNextPage,
716
+ isFetching,
717
+ isFetchNextPageError,
718
+ fetchNextPage
719
+ ]);
720
+ return {
721
+ threads: data,
722
+ hasNextPage,
723
+ isFetchingNextPage,
724
+ fetchNextPage: () => void fetchNextPage(),
725
+ setEndOfListElement,
726
+ isLoading,
727
+ isFetching,
728
+ isError,
729
+ error,
730
+ refetch: () => void refetch()
731
+ };
732
+ }
458
733
  //#endregion
459
734
  //#region src/hooks/traces/use-trace-usage.ts
460
735
  const INPUT_TOKEN_METRIC = "mastra_model_total_input_tokens";
@@ -551,7 +826,7 @@ const DEFAULT_POLLING_CONFIG = {
551
826
  deltaLimit: 100,
552
827
  pageModeRefetchIntervalMs: 1e4,
553
828
  page0StatusRefreshIntervalMs: 6e4,
554
- idleGuardThresholdMs: 15 * 6e4,
829
+ idleGuardThresholdMs: 9e5,
555
830
  minRefetchSpinMs: 400,
556
831
  deltaHighlightMs: 1e3
557
832
  };
@@ -1129,6 +1404,6 @@ function useTraceColumnPreferencesStorageKey() {
1129
1404
  return `mastra:traces:columns:${client.options.baseUrl || (typeof window === "undefined" ? "local" : window.location.origin || "local")}:${client.options.apiPrefix ?? "/api"}`;
1130
1405
  }
1131
1406
  //#endregion
1132
- export { DISCOVERY_STALE_TIME, ROOT_ENTITY_TYPES, TRACES_PER_PAGE, TRACE_QUERY_PER_PAGE, createTraceQueryValuesResolver, getLegacyTraceQueryNextPageParam, getTraceQueryNextPageParam, getTracesNextPageParam, lightSpanToTraceQueryTrace, mergeDeltaIntoPage0, refreshPage0Rows, selectLegacyTraceQueryTraces, selectTraceQueryTraces, selectUniqueTraces, shouldPinLightList, shouldResetAfterIdle, traceQueryFieldsQueryKey, traceSpansQueryOptions, useBranch, useCreateFeedback, useDeleteFeedback, useEntityNames, useEnvironments, useFetchTraceSpans, useServiceNames, useSpanDetail, useSpanFeedback, useTags, useThreadHasOtherTraces, useTraceColumnPreferencesStorageKey, useTraceFeedback, useTraceLightSpans, useTraceMetadataFilterFields, useTraceOrBranchSpans, useTraceQuery, useTraceSpans, useTraceSpansQueries, useTraceUsage, useTraces };
1407
+ export { DISCOVERY_STALE_TIME, ROOT_ENTITY_TYPES, SPAN_QUERY_PER_PAGE, THREAD_QUERY_PER_PAGE, TRACES_PER_PAGE, TRACE_QUERY_DELTA_LIMIT, TRACE_QUERY_PER_PAGE, createTraceQueryValuesResolver, getLegacyTraceQueryNextPageParam, getTraceQueryNextPageParam, getTracesNextPageParam, lightSpanToTraceQueryTrace, mergeDeltaIntoPage0, mergeTraceQueryDelta, refreshPage0Rows, selectLegacyTraceQueryTraces, selectTraceQueryTraces, selectUniqueTraces, shouldPinLightList, shouldResetAfterIdle, traceQueryFieldsQueryKey, traceQueryKey, traceSpansQueryOptions, useBranch, useCreateFeedback, useDeleteFeedback, useEntityNames, useEnvironments, useFetchTraceSpans, useQuerySpans, useQueryThreads, useServiceNames, useSpanDetail, useSpanFeedback, useTags, useThreadHasOtherTraces, useTraceColumnPreferencesStorageKey, useTraceFeedback, useTraceLightSpans, useTraceMetadataFilterFields, useTraceOrBranchSpans, useTraceQuery, useTraceQueryLatest, useTraceSpans, useTraceSpansQueries, useTraceUsage, useTraces };
1133
1408
 
1134
1409
  //# sourceMappingURL=index.js.map