@mastra/playground-ui 15.0.0 → 15.1.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 (88) hide show
  1. package/CHANGELOG.md +118 -0
  2. package/LICENSE.md +15 -0
  3. package/dist/{compatibility-BSJHu6pD.cjs → compatibility-BSEoV343.cjs} +45 -1
  4. package/dist/compatibility-BSEoV343.cjs.map +1 -0
  5. package/dist/{compatibility-f2FIOihW.js → compatibility-nun8AtH_.js} +43 -2
  6. package/dist/compatibility-nun8AtH_.js.map +1 -0
  7. package/dist/index.cjs.js +2009 -849
  8. package/dist/index.cjs.js.map +1 -1
  9. package/dist/index.es.js +1849 -712
  10. package/dist/index.es.js.map +1 -1
  11. package/dist/src/domains/agents/components/agent-table/agent-table.d.ts +2 -1
  12. package/dist/src/domains/auth/components/auth-required.d.ts +27 -0
  13. package/dist/src/domains/auth/components/auth-status.d.ts +24 -0
  14. package/dist/src/domains/auth/components/index.d.ts +6 -0
  15. package/dist/src/domains/auth/components/login-button.d.ts +34 -0
  16. package/dist/src/domains/auth/components/login-page.d.ts +33 -0
  17. package/dist/src/domains/auth/components/user-avatar.d.ts +20 -0
  18. package/dist/src/domains/auth/components/user-menu.d.ts +24 -0
  19. package/dist/src/domains/auth/hooks/index.d.ts +6 -0
  20. package/dist/src/domains/auth/hooks/use-auth-actions.d.ts +68 -0
  21. package/dist/src/domains/auth/hooks/use-auth-capabilities.d.ts +30 -0
  22. package/dist/src/domains/auth/hooks/use-credentials-login.d.ts +51 -0
  23. package/dist/src/domains/auth/hooks/use-credentials-signup.d.ts +54 -0
  24. package/dist/src/domains/auth/hooks/use-current-user.d.ts +27 -0
  25. package/dist/src/domains/auth/hooks/use-permissions.d.ts +61 -0
  26. package/dist/src/domains/auth/index.d.ts +10 -0
  27. package/dist/src/domains/auth/types.d.ts +104 -0
  28. package/dist/src/domains/datasets/components/experiments/comparison-item-panel.d.ts +14 -0
  29. package/dist/src/domains/datasets/components/experiments/comparison-items-list.d.ts +14 -0
  30. package/dist/src/domains/datasets/components/experiments/dataset-experiments-comparison.d.ts +12 -0
  31. package/dist/src/domains/datasets/components/experiments/experiment-in-comparison-info.d.ts +8 -0
  32. package/dist/src/domains/datasets/hooks/use-compare-experiments.d.ts +2 -2
  33. package/dist/src/domains/datasets/hooks/use-dataset-experiments.d.ts +4 -8
  34. package/dist/src/domains/datasets/index.d.ts +3 -3
  35. package/dist/src/domains/experiments/components/{experiment-results-list-and-details.d.ts → experiment-page-content.d.ts} +3 -2
  36. package/dist/src/domains/experiments/components/experiment-result-panel.d.ts +5 -2
  37. package/dist/src/domains/experiments/components/experiment-results-list.d.ts +4 -3
  38. package/dist/src/domains/experiments/components/experiment-score-panel.d.ts +8 -0
  39. package/dist/src/domains/experiments/components/experiment-scorer-summary.d.ts +5 -0
  40. package/dist/src/domains/mcps/components/mcp-table/mcp-table.d.ts +2 -1
  41. package/dist/src/domains/memory/hooks/use-memory.d.ts +5 -1
  42. package/dist/src/domains/processors/components/processor-table/processor-table.d.ts +2 -1
  43. package/dist/src/domains/scores/components/scorers-table/scorers-table.d.ts +2 -1
  44. package/dist/src/domains/scores/hooks/use-trace-span-scores.d.ts +1 -1
  45. package/dist/src/domains/tools/components/tool-table/tool-table.d.ts +2 -1
  46. package/dist/src/domains/workflows/components/workflow-table/workflow-table.d.ts +2 -1
  47. package/dist/src/ds/components/Chip/chip.d.ts +3 -2
  48. package/dist/src/ds/components/Chip/chip.stories.d.ts +1 -0
  49. package/dist/src/ds/components/Chip/chips-group.d.ts +5 -0
  50. package/dist/src/ds/components/Chip/index.d.ts +1 -0
  51. package/dist/src/ds/components/Columns/index.d.ts +1 -0
  52. package/dist/src/ds/components/Columns/multi-column.d.ts +7 -0
  53. package/dist/src/ds/components/ItemList/item-list-header.d.ts +2 -3
  54. package/dist/src/ds/components/ItemList/item-list-label-cell.d.ts +5 -0
  55. package/dist/src/ds/components/ItemList/item-list.d.ts +2 -0
  56. package/dist/src/ds/components/PermissionDenied/PermissionDenied.d.ts +14 -0
  57. package/dist/src/ds/components/PermissionDenied/index.d.ts +2 -0
  58. package/dist/src/ds/components/SideDialog/side-dialog-code-section.d.ts +2 -1
  59. package/dist/src/hooks/__tests__/use-workflow-runs.test.d.ts +1 -0
  60. package/dist/src/hooks/use-workflow-runs.d.ts +8 -0
  61. package/dist/src/index.d.ts +3 -2
  62. package/dist/src/lib/ai-ui/tools/badges/agent-badge-wrapper.d.ts +2 -1
  63. package/dist/src/lib/ai-ui/tools/badges/agent-badge.d.ts +2 -1
  64. package/dist/src/lib/form/dynamic-form.d.ts +6 -7
  65. package/dist/src/lib/form/zod-provider/compat.d.ts +105 -0
  66. package/dist/src/lib/form/zod-provider/default-values.d.ts +2 -3
  67. package/dist/src/lib/form/zod-provider/field-type-inference.d.ts +1 -2
  68. package/dist/src/lib/form/zod-provider/index.d.ts +7 -7
  69. package/dist/src/lib/query-utils.d.ts +16 -0
  70. package/dist/utils.cjs.js +1 -1
  71. package/dist/utils.es.js +1 -1
  72. package/package.json +10 -10
  73. package/dist/compatibility-BSJHu6pD.cjs.map +0 -1
  74. package/dist/compatibility-f2FIOihW.js.map +0 -1
  75. package/dist/src/domains/datasets/components/comparison/comparison-view.d.ts +0 -11
  76. package/dist/src/ds/components/Columns/list-and-details-next-prev-navigation.d.ts +0 -7
  77. package/dist/src/ds/components/ListAndDetails/index.d.ts +0 -1
  78. package/dist/src/ds/components/ListAndDetails/list-and-details-close-button.d.ts +0 -6
  79. package/dist/src/ds/components/ListAndDetails/list-and-details-column-content.d.ts +0 -5
  80. package/dist/src/ds/components/ListAndDetails/list-and-details-column-toolbar.d.ts +0 -5
  81. package/dist/src/ds/components/ListAndDetails/list-and-details-column.d.ts +0 -5
  82. package/dist/src/ds/components/ListAndDetails/list-and-details-details.d.ts +0 -6
  83. package/dist/src/ds/components/ListAndDetails/list-and-details-list.d.ts +0 -5
  84. package/dist/src/ds/components/ListAndDetails/list-and-details-next-prev-navigation.d.ts +0 -7
  85. package/dist/src/ds/components/ListAndDetails/list-and-details-root.d.ts +0 -7
  86. package/dist/src/ds/components/ListAndDetails/list-and-details-separator.d.ts +0 -3
  87. package/dist/src/ds/components/ListAndDetails/list-and-details.d.ts +0 -25
  88. /package/dist/src/domains/datasets/components/{comparison → experiments}/score-delta.d.ts +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,123 @@
1
1
  # @mastra/playground-ui
2
2
 
3
+ ## 15.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Add auth UI domain with login/signup pages, permission-gated components, and role-based access control for the studio. When no auth is configured, all permissions default to permissive (backward compatible). Includes AuthRequired wrapper, usePermissions hook, PermissionDenied component, and 403 error handling across all table views. ([#13163](https://github.com/mastra-ai/mastra/pull/13163))
8
+
9
+ - Added dataset experiments comparison view with side-by-side experiment info, per-scorer summary table, per-item score deltas, and a detail panel for inspecting individual comparison items. ([#13590](https://github.com/mastra-ai/mastra/pull/13590))
10
+
11
+ **Chip component enhancements**
12
+
13
+ Enhanced Chip component with new `intensity` prop for controlling brightness and additional color options.
14
+
15
+ ### Patch Changes
16
+
17
+ - Redesigned experiment detail page with tabbed layout, score integration, and modular column panels. ([#13663](https://github.com/mastra-ai/mastra/pull/13663))
18
+
19
+ **Experiment page layout**
20
+ - Added `ExperimentPageContent` with Summary and Results tabs, replacing the old `ExperimentResultsListAndDetails` component
21
+ - Summary tab shows `ExperimentScorerSummary` with per-scorer average scores
22
+ - Results tab displays a master-detail column layout with score columns in the results list
23
+
24
+ **Score detail panel**
25
+ - Added `ExperimentScorePanel` that opens as a column when clicking a score row in the result detail panel
26
+ - Shows score value, reason, input/output, and LLM prompts (preprocess, analyze, generate score, generate reason)
27
+ - Score and trace panels are mutually exclusive — opening one closes the other
28
+ - Prev/next navigation between scores within a result
29
+
30
+ **Score data improvements**
31
+ - `useScoresByExperimentId` now preserves full `ClientScoreRowData` instead of a minimal subset
32
+ - Added `perPage: 10000` to `listScoresByRunId` to prevent score truncation from server default limit
33
+
34
+ **Component cleanup**
35
+ - Removed `ListAndDetails` DS component — replaced by `Column` sub-components (`Column.Toolbar`, `Column.Content`)
36
+ - Extracted `MultiColumn` component for managing horizontally scrolling multi-column layouts
37
+ - Deleted `ExperimentResultsListAndDetails` (superseded by `ExperimentPageContent`)
38
+
39
+ - Fix duplicate rows appearing in workflow runs list during refetches. Improves list stability and prevents repeated entries when paginating. ([#13718](https://github.com/mastra-ai/mastra/pull/13718))
40
+
41
+ - Improved dataset selection behavior in Playground UI. ([#13585](https://github.com/mastra-ai/mastra/pull/13585))
42
+ - Improved selection UX in dataset lists with clearer checkbox interaction.
43
+ - Updated the experiments toolbar selection counter styling for consistency.
44
+ - Updated compare selection behavior: when a third item is selected, the earliest selection is kept and the other selection is replaced.
45
+
46
+ - Fixed sub-agent collapsible sections in Studio UI to automatically collapse after the sub-agent finishes processing. Previously the section would stay expanded for the entire agent lifecycle, creating visual noise. Now the sub-agent section expands while active and collapses when done. Users can still manually re-open it by clicking. ([#13558](https://github.com/mastra-ai/mastra/pull/13558))
47
+
48
+ - Add dual Zod v3/v4 compatibility to playground-ui form system ([#13662](https://github.com/mastra-ai/mastra/pull/13662))
49
+ - Add `compat.ts` layer with runtime version detection (`_zod` for v4, `_def` for v3) and version-agnostic accessors for schema properties (shape, innerType, defaultValue, checks, options, etc.)
50
+ - Refactor `zod-provider/index.ts` to implement `SchemaProvider` directly instead of extending `@autoform/zod/v4`'s `ZodProvider`, removing the hard dependency on Zod v4
51
+ - Refactor `default-values.ts` and `field-type-inference.ts` to use compat helpers instead of v4-specific `_zod.def` access and `z.core.$ZodType` checks
52
+ - Refactor `dynamic-form.tsx` to use structural type detection instead of `instanceof ZodObject`/`ZodIntersection` checks that fail across Zod versions
53
+ - Remove `@autoform/zod` dependency (no longer needed)
54
+ - Move `zod` from direct dependency to peerDependency (`^3.25.0 || ^4.0.0`) so consuming apps provide their own version
55
+
56
+ - Updated dependencies [[`504fc8b`](https://github.com/mastra-ai/mastra/commit/504fc8b9d0ddab717577ad3bf9c95ea4bd5377bd), [`f9c150b`](https://github.com/mastra-ai/mastra/commit/f9c150b7595ad05ad9cc9a11098e2944361e8c22), [`88de7e8`](https://github.com/mastra-ai/mastra/commit/88de7e8dfe4b7e1951a9e441bb33136e705ce24e), [`6dbeeb9`](https://github.com/mastra-ai/mastra/commit/6dbeeb94a8b1eebb727300d1a98961f882180794), [`edee4b3`](https://github.com/mastra-ai/mastra/commit/edee4b37dff0af515fc7cc0e8d71ee39e6a762f0), [`3790c75`](https://github.com/mastra-ai/mastra/commit/3790c7578cc6a47d854eb12d89e6b1912867fe29), [`e7a235b`](https://github.com/mastra-ai/mastra/commit/e7a235be6472e0c870ed6c791ddb17c492dc188b), [`4dfa8fa`](https://github.com/mastra-ai/mastra/commit/4dfa8fa40bfbab70aab267ed54197d68a23d55a0), [`d51d298`](https://github.com/mastra-ai/mastra/commit/d51d298953967aab1f58ec965b644d109214f085), [`6dbeeb9`](https://github.com/mastra-ai/mastra/commit/6dbeeb94a8b1eebb727300d1a98961f882180794), [`d5f0d8d`](https://github.com/mastra-ai/mastra/commit/d5f0d8d6a03e515ddaa9b5da19b7e44b8357b07b), [`09c3b18`](https://github.com/mastra-ai/mastra/commit/09c3b1802ff14e243a8a8baea327440bc8cc2e32), [`b896379`](https://github.com/mastra-ai/mastra/commit/b8963791c6afa79484645fcec596a201f936b9a2), [`85c84eb`](https://github.com/mastra-ai/mastra/commit/85c84ebb78aebfcba9d209c8e152b16d7a00cb71), [`a89272a`](https://github.com/mastra-ai/mastra/commit/a89272a5d71939b9fcd284e6a6dc1dd091a6bdcf), [`ee9c8df`](https://github.com/mastra-ai/mastra/commit/ee9c8df644f19d055af5f496bf4942705f5a47b7), [`c52bc54`](https://github.com/mastra-ai/mastra/commit/c52bc54a6b97a5bfe6044682df0da30f39183898), [`77b4a25`](https://github.com/mastra-ai/mastra/commit/77b4a254e51907f8ff3a3ba95596a18e93ae4b35), [`276246e`](https://github.com/mastra-ai/mastra/commit/276246e0b9066a1ea48bbc70df84dbe528daaf99), [`08ecfdb`](https://github.com/mastra-ai/mastra/commit/08ecfdbdad6fb8285deef86a034bdf4a6047cfca), [`d5f628c`](https://github.com/mastra-ai/mastra/commit/d5f628ca86c6f6f3ff1035d52f635df32dd81cab), [`524c0f3`](https://github.com/mastra-ai/mastra/commit/524c0f3c434c3d9d18f66338dcef383d6161b59c), [`c18a0e9`](https://github.com/mastra-ai/mastra/commit/c18a0e9cef1e4ca004b2963d35e4cfc031971eac), [`4bd21ea`](https://github.com/mastra-ai/mastra/commit/4bd21ea43d44d0a0427414fc047577f9f0aa3bec), [`115a7a4`](https://github.com/mastra-ai/mastra/commit/115a7a47db5e9896fec12ae6507501adb9ec89bf), [`22a48ae`](https://github.com/mastra-ai/mastra/commit/22a48ae2513eb54d8d79dad361fddbca97a155e8), [`3c6ef79`](https://github.com/mastra-ai/mastra/commit/3c6ef798481e00d6d22563be2de98818fd4dd5e0), [`9311c17`](https://github.com/mastra-ai/mastra/commit/9311c17d7a0640d9c4da2e71b814dc67c57c6369), [`7edf78f`](https://github.com/mastra-ai/mastra/commit/7edf78f80422c43e84585f08ba11df0d4d0b73c5), [`1c4221c`](https://github.com/mastra-ai/mastra/commit/1c4221cf6032ec98d0e094d4ee11da3e48490d96), [`6dbeeb9`](https://github.com/mastra-ai/mastra/commit/6dbeeb94a8b1eebb727300d1a98961f882180794), [`d25b9ea`](https://github.com/mastra-ai/mastra/commit/d25b9eabd400167255a97b690ffbc4ee4097ded5), [`fe1ce5c`](https://github.com/mastra-ai/mastra/commit/fe1ce5c9211c03d561606fda95cbfe7df1d9a9b5), [`b03c0e0`](https://github.com/mastra-ai/mastra/commit/b03c0e0389a799523929a458b0509c9e4244d562), [`0a8366b`](https://github.com/mastra-ai/mastra/commit/0a8366b0a692fcdde56c4d526e4cf03c502ae4ac), [`85664e9`](https://github.com/mastra-ai/mastra/commit/85664e9fd857320fbc245e301f764f45f66f32a3), [`bc79650`](https://github.com/mastra-ai/mastra/commit/bc796500c6e0334faa158a96077e3fb332274869), [`9257d01`](https://github.com/mastra-ai/mastra/commit/9257d01d1366d81f84c582fe02b5e200cf9621f4), [`3a3a59e`](https://github.com/mastra-ai/mastra/commit/3a3a59e8ffaa6a985fe3d9a126a3f5ade11a6724), [`3108d4e`](https://github.com/mastra-ai/mastra/commit/3108d4e649c9fddbf03253a6feeb388a5fa9fa5a), [`0c33b2c`](https://github.com/mastra-ai/mastra/commit/0c33b2c9db537f815e1c59e2c898ffce2e395a79), [`191e5bd`](https://github.com/mastra-ai/mastra/commit/191e5bd29b82f5bda35243945790da7bc7b695c2), [`f77cd94`](https://github.com/mastra-ai/mastra/commit/f77cd94c44eabed490384e7d19232a865e13214c), [`e8135c7`](https://github.com/mastra-ai/mastra/commit/e8135c7e300dac5040670eec7eab896ac6092e30), [`daca48f`](https://github.com/mastra-ai/mastra/commit/daca48f0fb17b7ae0b62a2ac40cf0e491b2fd0b7), [`257d14f`](https://github.com/mastra-ai/mastra/commit/257d14faca5931f2e4186fc165b6f0b1f915deee), [`352f25d`](https://github.com/mastra-ai/mastra/commit/352f25da316b24cdd5b410fd8dddf6a8b763da2a), [`93477d0`](https://github.com/mastra-ai/mastra/commit/93477d0769b8a13ea5ed73d508d967fb23eaeed9), [`31c78b3`](https://github.com/mastra-ai/mastra/commit/31c78b3eb28f58a8017f1dcc795c33214d87feac), [`0bc0720`](https://github.com/mastra-ai/mastra/commit/0bc07201095791858087cc56f353fcd65e87ab54), [`36516ac`](https://github.com/mastra-ai/mastra/commit/36516aca1021cbeb42e74751b46a2614101f37c8), [`e947652`](https://github.com/mastra-ai/mastra/commit/e9476527fdecb4449e54570e80dfaf8466901254), [`3c6ef79`](https://github.com/mastra-ai/mastra/commit/3c6ef798481e00d6d22563be2de98818fd4dd5e0), [`257d14f`](https://github.com/mastra-ai/mastra/commit/257d14faca5931f2e4186fc165b6f0b1f915deee), [`9257d01`](https://github.com/mastra-ai/mastra/commit/9257d01d1366d81f84c582fe02b5e200cf9621f4), [`ec248f6`](https://github.com/mastra-ai/mastra/commit/ec248f6b56e8a037c066c49b2178e2507471d988)]:
57
+ - @mastra/core@1.9.0
58
+ - @mastra/client-js@1.7.2
59
+ - @mastra/react@0.2.8
60
+ - @mastra/ai-sdk@1.1.1
61
+
62
+ ## 15.1.0-alpha.0
63
+
64
+ ### Minor Changes
65
+
66
+ - Add auth UI domain with login/signup pages, permission-gated components, and role-based access control for the studio. When no auth is configured, all permissions default to permissive (backward compatible). Includes AuthRequired wrapper, usePermissions hook, PermissionDenied component, and 403 error handling across all table views. ([#13163](https://github.com/mastra-ai/mastra/pull/13163))
67
+
68
+ - Added dataset experiments comparison view with side-by-side experiment info, per-scorer summary table, per-item score deltas, and a detail panel for inspecting individual comparison items. ([#13590](https://github.com/mastra-ai/mastra/pull/13590))
69
+
70
+ **Chip component enhancements**
71
+
72
+ Enhanced Chip component with new `intensity` prop for controlling brightness and additional color options.
73
+
74
+ ### Patch Changes
75
+
76
+ - Redesigned experiment detail page with tabbed layout, score integration, and modular column panels. ([#13663](https://github.com/mastra-ai/mastra/pull/13663))
77
+
78
+ **Experiment page layout**
79
+ - Added `ExperimentPageContent` with Summary and Results tabs, replacing the old `ExperimentResultsListAndDetails` component
80
+ - Summary tab shows `ExperimentScorerSummary` with per-scorer average scores
81
+ - Results tab displays a master-detail column layout with score columns in the results list
82
+
83
+ **Score detail panel**
84
+ - Added `ExperimentScorePanel` that opens as a column when clicking a score row in the result detail panel
85
+ - Shows score value, reason, input/output, and LLM prompts (preprocess, analyze, generate score, generate reason)
86
+ - Score and trace panels are mutually exclusive — opening one closes the other
87
+ - Prev/next navigation between scores within a result
88
+
89
+ **Score data improvements**
90
+ - `useScoresByExperimentId` now preserves full `ClientScoreRowData` instead of a minimal subset
91
+ - Added `perPage: 10000` to `listScoresByRunId` to prevent score truncation from server default limit
92
+
93
+ **Component cleanup**
94
+ - Removed `ListAndDetails` DS component — replaced by `Column` sub-components (`Column.Toolbar`, `Column.Content`)
95
+ - Extracted `MultiColumn` component for managing horizontally scrolling multi-column layouts
96
+ - Deleted `ExperimentResultsListAndDetails` (superseded by `ExperimentPageContent`)
97
+
98
+ - Fix duplicate rows appearing in workflow runs list during refetches. Improves list stability and prevents repeated entries when paginating. ([#13718](https://github.com/mastra-ai/mastra/pull/13718))
99
+
100
+ - Improved dataset selection behavior in Playground UI. ([#13585](https://github.com/mastra-ai/mastra/pull/13585))
101
+ - Improved selection UX in dataset lists with clearer checkbox interaction.
102
+ - Updated the experiments toolbar selection counter styling for consistency.
103
+ - Updated compare selection behavior: when a third item is selected, the earliest selection is kept and the other selection is replaced.
104
+
105
+ - Fixed sub-agent collapsible sections in Studio UI to automatically collapse after the sub-agent finishes processing. Previously the section would stay expanded for the entire agent lifecycle, creating visual noise. Now the sub-agent section expands while active and collapses when done. Users can still manually re-open it by clicking. ([#13558](https://github.com/mastra-ai/mastra/pull/13558))
106
+
107
+ - Add dual Zod v3/v4 compatibility to playground-ui form system ([#13662](https://github.com/mastra-ai/mastra/pull/13662))
108
+ - Add `compat.ts` layer with runtime version detection (`_zod` for v4, `_def` for v3) and version-agnostic accessors for schema properties (shape, innerType, defaultValue, checks, options, etc.)
109
+ - Refactor `zod-provider/index.ts` to implement `SchemaProvider` directly instead of extending `@autoform/zod/v4`'s `ZodProvider`, removing the hard dependency on Zod v4
110
+ - Refactor `default-values.ts` and `field-type-inference.ts` to use compat helpers instead of v4-specific `_zod.def` access and `z.core.$ZodType` checks
111
+ - Refactor `dynamic-form.tsx` to use structural type detection instead of `instanceof ZodObject`/`ZodIntersection` checks that fail across Zod versions
112
+ - Remove `@autoform/zod` dependency (no longer needed)
113
+ - Move `zod` from direct dependency to peerDependency (`^3.25.0 || ^4.0.0`) so consuming apps provide their own version
114
+
115
+ - Updated dependencies [[`504fc8b`](https://github.com/mastra-ai/mastra/commit/504fc8b9d0ddab717577ad3bf9c95ea4bd5377bd), [`f9c150b`](https://github.com/mastra-ai/mastra/commit/f9c150b7595ad05ad9cc9a11098e2944361e8c22), [`88de7e8`](https://github.com/mastra-ai/mastra/commit/88de7e8dfe4b7e1951a9e441bb33136e705ce24e), [`6dbeeb9`](https://github.com/mastra-ai/mastra/commit/6dbeeb94a8b1eebb727300d1a98961f882180794), [`edee4b3`](https://github.com/mastra-ai/mastra/commit/edee4b37dff0af515fc7cc0e8d71ee39e6a762f0), [`3790c75`](https://github.com/mastra-ai/mastra/commit/3790c7578cc6a47d854eb12d89e6b1912867fe29), [`e7a235b`](https://github.com/mastra-ai/mastra/commit/e7a235be6472e0c870ed6c791ddb17c492dc188b), [`4dfa8fa`](https://github.com/mastra-ai/mastra/commit/4dfa8fa40bfbab70aab267ed54197d68a23d55a0), [`d51d298`](https://github.com/mastra-ai/mastra/commit/d51d298953967aab1f58ec965b644d109214f085), [`6dbeeb9`](https://github.com/mastra-ai/mastra/commit/6dbeeb94a8b1eebb727300d1a98961f882180794), [`d5f0d8d`](https://github.com/mastra-ai/mastra/commit/d5f0d8d6a03e515ddaa9b5da19b7e44b8357b07b), [`09c3b18`](https://github.com/mastra-ai/mastra/commit/09c3b1802ff14e243a8a8baea327440bc8cc2e32), [`b896379`](https://github.com/mastra-ai/mastra/commit/b8963791c6afa79484645fcec596a201f936b9a2), [`85c84eb`](https://github.com/mastra-ai/mastra/commit/85c84ebb78aebfcba9d209c8e152b16d7a00cb71), [`a89272a`](https://github.com/mastra-ai/mastra/commit/a89272a5d71939b9fcd284e6a6dc1dd091a6bdcf), [`ee9c8df`](https://github.com/mastra-ai/mastra/commit/ee9c8df644f19d055af5f496bf4942705f5a47b7), [`c52bc54`](https://github.com/mastra-ai/mastra/commit/c52bc54a6b97a5bfe6044682df0da30f39183898), [`77b4a25`](https://github.com/mastra-ai/mastra/commit/77b4a254e51907f8ff3a3ba95596a18e93ae4b35), [`276246e`](https://github.com/mastra-ai/mastra/commit/276246e0b9066a1ea48bbc70df84dbe528daaf99), [`08ecfdb`](https://github.com/mastra-ai/mastra/commit/08ecfdbdad6fb8285deef86a034bdf4a6047cfca), [`d5f628c`](https://github.com/mastra-ai/mastra/commit/d5f628ca86c6f6f3ff1035d52f635df32dd81cab), [`524c0f3`](https://github.com/mastra-ai/mastra/commit/524c0f3c434c3d9d18f66338dcef383d6161b59c), [`c18a0e9`](https://github.com/mastra-ai/mastra/commit/c18a0e9cef1e4ca004b2963d35e4cfc031971eac), [`4bd21ea`](https://github.com/mastra-ai/mastra/commit/4bd21ea43d44d0a0427414fc047577f9f0aa3bec), [`115a7a4`](https://github.com/mastra-ai/mastra/commit/115a7a47db5e9896fec12ae6507501adb9ec89bf), [`22a48ae`](https://github.com/mastra-ai/mastra/commit/22a48ae2513eb54d8d79dad361fddbca97a155e8), [`3c6ef79`](https://github.com/mastra-ai/mastra/commit/3c6ef798481e00d6d22563be2de98818fd4dd5e0), [`9311c17`](https://github.com/mastra-ai/mastra/commit/9311c17d7a0640d9c4da2e71b814dc67c57c6369), [`7edf78f`](https://github.com/mastra-ai/mastra/commit/7edf78f80422c43e84585f08ba11df0d4d0b73c5), [`1c4221c`](https://github.com/mastra-ai/mastra/commit/1c4221cf6032ec98d0e094d4ee11da3e48490d96), [`6dbeeb9`](https://github.com/mastra-ai/mastra/commit/6dbeeb94a8b1eebb727300d1a98961f882180794), [`d25b9ea`](https://github.com/mastra-ai/mastra/commit/d25b9eabd400167255a97b690ffbc4ee4097ded5), [`fe1ce5c`](https://github.com/mastra-ai/mastra/commit/fe1ce5c9211c03d561606fda95cbfe7df1d9a9b5), [`b03c0e0`](https://github.com/mastra-ai/mastra/commit/b03c0e0389a799523929a458b0509c9e4244d562), [`0a8366b`](https://github.com/mastra-ai/mastra/commit/0a8366b0a692fcdde56c4d526e4cf03c502ae4ac), [`85664e9`](https://github.com/mastra-ai/mastra/commit/85664e9fd857320fbc245e301f764f45f66f32a3), [`bc79650`](https://github.com/mastra-ai/mastra/commit/bc796500c6e0334faa158a96077e3fb332274869), [`9257d01`](https://github.com/mastra-ai/mastra/commit/9257d01d1366d81f84c582fe02b5e200cf9621f4), [`3a3a59e`](https://github.com/mastra-ai/mastra/commit/3a3a59e8ffaa6a985fe3d9a126a3f5ade11a6724), [`3108d4e`](https://github.com/mastra-ai/mastra/commit/3108d4e649c9fddbf03253a6feeb388a5fa9fa5a), [`0c33b2c`](https://github.com/mastra-ai/mastra/commit/0c33b2c9db537f815e1c59e2c898ffce2e395a79), [`191e5bd`](https://github.com/mastra-ai/mastra/commit/191e5bd29b82f5bda35243945790da7bc7b695c2), [`f77cd94`](https://github.com/mastra-ai/mastra/commit/f77cd94c44eabed490384e7d19232a865e13214c), [`e8135c7`](https://github.com/mastra-ai/mastra/commit/e8135c7e300dac5040670eec7eab896ac6092e30), [`daca48f`](https://github.com/mastra-ai/mastra/commit/daca48f0fb17b7ae0b62a2ac40cf0e491b2fd0b7), [`257d14f`](https://github.com/mastra-ai/mastra/commit/257d14faca5931f2e4186fc165b6f0b1f915deee), [`352f25d`](https://github.com/mastra-ai/mastra/commit/352f25da316b24cdd5b410fd8dddf6a8b763da2a), [`93477d0`](https://github.com/mastra-ai/mastra/commit/93477d0769b8a13ea5ed73d508d967fb23eaeed9), [`31c78b3`](https://github.com/mastra-ai/mastra/commit/31c78b3eb28f58a8017f1dcc795c33214d87feac), [`0bc0720`](https://github.com/mastra-ai/mastra/commit/0bc07201095791858087cc56f353fcd65e87ab54), [`36516ac`](https://github.com/mastra-ai/mastra/commit/36516aca1021cbeb42e74751b46a2614101f37c8), [`e947652`](https://github.com/mastra-ai/mastra/commit/e9476527fdecb4449e54570e80dfaf8466901254), [`3c6ef79`](https://github.com/mastra-ai/mastra/commit/3c6ef798481e00d6d22563be2de98818fd4dd5e0), [`257d14f`](https://github.com/mastra-ai/mastra/commit/257d14faca5931f2e4186fc165b6f0b1f915deee), [`9257d01`](https://github.com/mastra-ai/mastra/commit/9257d01d1366d81f84c582fe02b5e200cf9621f4), [`ec248f6`](https://github.com/mastra-ai/mastra/commit/ec248f6b56e8a037c066c49b2178e2507471d988)]:
116
+ - @mastra/core@1.9.0-alpha.0
117
+ - @mastra/client-js@1.7.2-alpha.0
118
+ - @mastra/react@0.2.8-alpha.0
119
+ - @mastra/ai-sdk@1.1.1-alpha.0
120
+
3
121
  ## 15.0.0
4
122
 
5
123
  ### Minor Changes
package/LICENSE.md CHANGED
@@ -1,3 +1,18 @@
1
+ Portions of this software are licensed as follows:
2
+
3
+ - All content that resides under any directory named "ee/" within this
4
+ repository, including but not limited to:
5
+ - `packages/core/src/auth/ee/`
6
+ - `packages/server/src/server/auth/ee/`
7
+ is licensed under the license defined in `ee/LICENSE`.
8
+
9
+ - All third-party components incorporated into the Mastra Software are
10
+ licensed under the original license provided by the owner of the
11
+ applicable component.
12
+
13
+ - Content outside of the above-mentioned directories or restrictions is
14
+ available under the "Apache License 2.0" as defined below.
15
+
1
16
  # Apache License 2.0
2
17
 
3
18
  Copyright (c) 2025 Kepler Software, Inc.
@@ -2,6 +2,44 @@
2
2
 
3
3
  const features = require('@mastra/core/features');
4
4
 
5
+ const HTTP_NO_RETRY_STATUSES = [400, 401, 403, 404];
6
+ function is403ForbiddenError(error) {
7
+ if (!error || typeof error !== "object") return false;
8
+ if ("status" in error && error.status === 403) {
9
+ return true;
10
+ }
11
+ if ("statusCode" in error && error.statusCode === 403) {
12
+ return true;
13
+ }
14
+ if ("message" in error) {
15
+ const message = error.message;
16
+ return message.includes("status: 403");
17
+ }
18
+ return false;
19
+ }
20
+ function isNonRetryableError(error) {
21
+ if (!error || typeof error !== "object") return false;
22
+ if ("status" in error) {
23
+ const status = error.status;
24
+ return HTTP_NO_RETRY_STATUSES.includes(status);
25
+ }
26
+ if ("statusCode" in error) {
27
+ const statusCode = error.statusCode;
28
+ return HTTP_NO_RETRY_STATUSES.includes(statusCode);
29
+ }
30
+ if ("message" in error) {
31
+ const message = error.message;
32
+ return HTTP_NO_RETRY_STATUSES.some((code) => message.includes(`status: ${code}`));
33
+ }
34
+ return false;
35
+ }
36
+ function shouldRetryQuery(failureCount, error) {
37
+ if (isNonRetryableError(error)) {
38
+ return false;
39
+ }
40
+ return failureCount < 3;
41
+ }
42
+
5
43
  function hasMethod(obj, method) {
6
44
  return method in obj && typeof obj[method] === "function";
7
45
  }
@@ -46,10 +84,16 @@ const shouldRetryWorkspaceQuery = (failureCount, error) => {
46
84
  if (isWorkspaceNotSupportedError(error)) {
47
85
  return false;
48
86
  }
87
+ if (isNonRetryableError(error)) {
88
+ return false;
89
+ }
49
90
  return failureCount < 3;
50
91
  };
51
92
 
93
+ exports.is403ForbiddenError = is403ForbiddenError;
94
+ exports.isNonRetryableError = isNonRetryableError;
52
95
  exports.isWorkspaceNotSupportedError = isWorkspaceNotSupportedError;
53
96
  exports.isWorkspaceV1Supported = isWorkspaceV1Supported;
97
+ exports.shouldRetryQuery = shouldRetryQuery;
54
98
  exports.shouldRetryWorkspaceQuery = shouldRetryWorkspaceQuery;
55
- //# sourceMappingURL=compatibility-BSJHu6pD.cjs.map
99
+ //# sourceMappingURL=compatibility-BSEoV343.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compatibility-BSEoV343.cjs","sources":["../src/lib/query-utils.ts","../src/domains/workspace/client-utils.ts","../src/domains/workspace/compatibility.ts"],"sourcesContent":["/**\n * HTTP status codes that should not be retried.\n * - 400: Bad Request (client error, won't change)\n * - 401: Unauthorized (needs re-auth, not retry)\n * - 403: Forbidden (RBAC permission denied)\n * - 404: Not Found (resource doesn't exist)\n */\nconst HTTP_NO_RETRY_STATUSES = [400, 401, 403, 404];\n\n/**\n * Check if error is a 403 Forbidden response.\n * Handles both direct status property and client-js error message format.\n */\nexport function is403ForbiddenError(error: unknown): boolean {\n if (!error || typeof error !== 'object') return false;\n\n // Check for status property (direct response or wrapped)\n if ('status' in error && (error as { status: number }).status === 403) {\n return true;\n }\n\n // Check for statusCode property (some HTTP clients)\n if ('statusCode' in error && (error as { statusCode: number }).statusCode === 403) {\n return true;\n }\n\n // Check error message for client-js pattern: \"HTTP error! status: 403\"\n if ('message' in error) {\n const message = (error as { message: string }).message;\n return message.includes('status: 403');\n }\n\n return false;\n}\n\n/**\n * Check if error has a status code that shouldn't be retried.\n * Used to prevent retrying client errors that won't resolve.\n */\nexport function isNonRetryableError(error: unknown): boolean {\n if (!error || typeof error !== 'object') return false;\n\n // Check for status property\n if ('status' in error) {\n const status = (error as { status: number }).status;\n return HTTP_NO_RETRY_STATUSES.includes(status);\n }\n\n // Check for statusCode property\n if ('statusCode' in error) {\n const statusCode = (error as { statusCode: number }).statusCode;\n return HTTP_NO_RETRY_STATUSES.includes(statusCode);\n }\n\n // Check error message for client-js pattern\n if ('message' in error) {\n const message = (error as { message: string }).message;\n return HTTP_NO_RETRY_STATUSES.some(code => message.includes(`status: ${code}`));\n }\n\n return false;\n}\n\n/**\n * Default retry function for TanStack Query.\n * Does not retry 4xx client errors (400, 401, 403, 404).\n * Retries other errors up to 3 times.\n */\nexport function shouldRetryQuery(failureCount: number, error: unknown): boolean {\n // Don't retry client errors - they won't resolve with retries\n if (isNonRetryableError(error)) {\n return false;\n }\n // Default: retry up to 3 times for transient errors\n return failureCount < 3;\n}\n","/**\n * Checks if a method exists on an object and is callable.\n */\nexport function hasMethod<T>(obj: T, method: string): boolean {\n return method in (obj as object) && typeof (obj as Record<string, unknown>)[method] === 'function';\n}\n","import { coreFeatures } from '@mastra/core/features';\nimport { MastraClient } from '@mastra/client-js';\nimport { hasMethod } from './client-utils';\nimport { isNonRetryableError } from '../../lib/query-utils';\n\n/**\n * Checks if workspace v1 features are supported by both core and client.\n * This guards against version mismatches between playground-ui, core, and client-js.\n */\nexport const isWorkspaceV1Supported = (client: MastraClient) => {\n const workspaceClientMethods = ['listWorkspaces', 'getWorkspace'];\n\n const coreSupported = coreFeatures.has('workspaces-v1');\n const clientSupported = workspaceClientMethods.every(method => hasMethod(client, method));\n\n return coreSupported && clientSupported;\n};\n\n/**\n * Gets the HTTP status code from an error if present.\n * Supports MastraClientError, fetch Response, and other HTTP client error formats.\n */\nconst getStatusCode = (error: unknown): number | undefined => {\n if (!error || typeof error !== 'object') return undefined;\n\n // Check for status property (MastraClientError, fetch Response, etc.)\n if ('status' in error && typeof (error as { status: unknown }).status === 'number') {\n return (error as { status: number }).status;\n }\n\n // Check for statusCode property (from some HTTP clients)\n if ('statusCode' in error && typeof (error as { statusCode: unknown }).statusCode === 'number') {\n return (error as { statusCode: number }).statusCode;\n }\n\n return undefined;\n};\n\n/**\n * Checks if an error has a specific HTTP status code.\n * Supports MastraClientError, fetch Response, and other HTTP client error formats.\n */\nconst hasStatusCode = (error: unknown, statusCode: number): boolean => {\n return getStatusCode(error) === statusCode;\n};\n\n/**\n * Checks if an error is a 4xx client error (e.g., 400, 401, 403, 404).\n * Client errors won't resolve with retries.\n */\nconst isClientError = (error: unknown): boolean => {\n const status = getStatusCode(error);\n return status !== undefined && status >= 400 && status < 500;\n};\n\n/**\n * Checks if an error is a \"Not Implemented\" (501) error from the server.\n * This indicates the server's @mastra/core version doesn't support workspaces.\n */\nexport const isWorkspaceNotSupportedError = (error: unknown): boolean => {\n if (hasStatusCode(error, 501)) {\n return true;\n }\n\n // Check error message for our specific error\n if (error && typeof error === 'object' && 'message' in error) {\n const message = (error as { message: string }).message;\n return message.includes('Workspace v1 not supported') || message.includes('501');\n }\n\n return false;\n};\n\n/**\n * Checks if an error is a \"Not Found\" (404) error from the server.\n * This indicates the requested resource doesn't exist (e.g., file not found).\n */\nexport const isNotFoundError = (error: unknown): boolean => {\n if (hasStatusCode(error, 404)) {\n return true;\n }\n\n // Check error message for status code (client-js throws Error with message like \"HTTP error! status: 404 - ...\")\n if (error && typeof error === 'object' && 'message' in error) {\n const message = (error as { message: string }).message;\n return message.includes('status: 404');\n }\n\n return false;\n};\n\n/**\n * React Query retry function that doesn't retry on client errors (4xx) or 501 errors.\n * Use this to prevent infinite retries when resources don't exist, access is denied, or workspaces aren't supported.\n */\nexport const shouldRetryWorkspaceQuery = (failureCount: number, error: unknown): boolean => {\n // Don't retry 4xx client errors (400, 401, 403, 404, etc.) - these won't resolve with retries\n if (isClientError(error)) {\n return false;\n }\n // Don't retry 501 \"Not Implemented\" errors - they won't resolve with retries\n if (isWorkspaceNotSupportedError(error)) {\n return false;\n }\n // Don't retry 4xx client errors (400, 401, 403, 404)\n if (isNonRetryableError(error)) {\n return false;\n }\n // Default retry behavior: retry up to 3 times\n return failureCount < 3;\n};\n"],"names":["coreFeatures"],"mappings":";;;;AAOA,MAAM,sBAAA,GAAyB,CAAC,GAAA,EAAK,GAAA,EAAK,KAAK,GAAG,CAAA;AAM3C,SAAS,oBAAoB,KAAA,EAAyB;AAC3D,EAAA,IAAI,CAAC,KAAA,IAAS,OAAO,KAAA,KAAU,UAAU,OAAO,KAAA;AAGhD,EAAA,IAAI,QAAA,IAAY,KAAA,IAAU,KAAA,CAA6B,MAAA,KAAW,GAAA,EAAK;AACrE,IAAA,OAAO,IAAA;AAAA,EACT;AAGA,EAAA,IAAI,YAAA,IAAgB,KAAA,IAAU,KAAA,CAAiC,UAAA,KAAe,GAAA,EAAK;AACjF,IAAA,OAAO,IAAA;AAAA,EACT;AAGA,EAAA,IAAI,aAAa,KAAA,EAAO;AACtB,IAAA,MAAM,UAAW,KAAA,CAA8B,OAAA;AAC/C,IAAA,OAAO,OAAA,CAAQ,SAAS,aAAa,CAAA;AAAA,EACvC;AAEA,EAAA,OAAO,KAAA;AACT;AAMO,SAAS,oBAAoB,KAAA,EAAyB;AAC3D,EAAA,IAAI,CAAC,KAAA,IAAS,OAAO,KAAA,KAAU,UAAU,OAAO,KAAA;AAGhD,EAAA,IAAI,YAAY,KAAA,EAAO;AACrB,IAAA,MAAM,SAAU,KAAA,CAA6B,MAAA;AAC7C,IAAA,OAAO,sBAAA,CAAuB,SAAS,MAAM,CAAA;AAAA,EAC/C;AAGA,EAAA,IAAI,gBAAgB,KAAA,EAAO;AACzB,IAAA,MAAM,aAAc,KAAA,CAAiC,UAAA;AACrD,IAAA,OAAO,sBAAA,CAAuB,SAAS,UAAU,CAAA;AAAA,EACnD;AAGA,EAAA,IAAI,aAAa,KAAA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];
4
+ function is403ForbiddenError(error) {
5
+ if (!error || typeof error !== "object") return false;
6
+ if ("status" in error && error.status === 403) {
7
+ return true;
8
+ }
9
+ if ("statusCode" in error && error.statusCode === 403) {
10
+ return true;
11
+ }
12
+ if ("message" in error) {
13
+ const message = error.message;
14
+ return message.includes("status: 403");
15
+ }
16
+ return false;
17
+ }
18
+ function isNonRetryableError(error) {
19
+ if (!error || typeof error !== "object") return false;
20
+ if ("status" in error) {
21
+ const status = error.status;
22
+ return HTTP_NO_RETRY_STATUSES.includes(status);
23
+ }
24
+ if ("statusCode" in error) {
25
+ const statusCode = error.statusCode;
26
+ return HTTP_NO_RETRY_STATUSES.includes(statusCode);
27
+ }
28
+ if ("message" in error) {
29
+ const message = error.message;
30
+ return HTTP_NO_RETRY_STATUSES.some((code) => message.includes(`status: ${code}`));
31
+ }
32
+ return false;
33
+ }
34
+ function shouldRetryQuery(failureCount, error) {
35
+ if (isNonRetryableError(error)) {
36
+ return false;
37
+ }
38
+ return failureCount < 3;
39
+ }
40
+
3
41
  function hasMethod(obj, method) {
4
42
  return method in obj && typeof obj[method] === "function";
5
43
  }
@@ -44,8 +82,11 @@ const shouldRetryWorkspaceQuery = (failureCount, error) => {
44
82
  if (isWorkspaceNotSupportedError(error)) {
45
83
  return false;
46
84
  }
85
+ if (isNonRetryableError(error)) {
86
+ return false;
87
+ }
47
88
  return failureCount < 3;
48
89
  };
49
90
 
50
- export { isWorkspaceNotSupportedError as a, isWorkspaceV1Supported as i, shouldRetryWorkspaceQuery as s };
51
- //# sourceMappingURL=compatibility-f2FIOihW.js.map
91
+ export { is403ForbiddenError as a, shouldRetryQuery as b, isNonRetryableError as c, isWorkspaceNotSupportedError as d, isWorkspaceV1Supported as i, shouldRetryWorkspaceQuery as s };
92
+ //# sourceMappingURL=compatibility-nun8AtH_.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compatibility-nun8AtH_.js","sources":["../src/lib/query-utils.ts","../src/domains/workspace/client-utils.ts","../src/domains/workspace/compatibility.ts"],"sourcesContent":["/**\n * HTTP status codes that should not be retried.\n * - 400: Bad Request (client error, won't change)\n * - 401: Unauthorized (needs re-auth, not retry)\n * - 403: Forbidden (RBAC permission denied)\n * - 404: Not Found (resource doesn't exist)\n */\nconst HTTP_NO_RETRY_STATUSES = [400, 401, 403, 404];\n\n/**\n * Check if error is a 403 Forbidden response.\n * Handles both direct status property and client-js error message format.\n */\nexport function is403ForbiddenError(error: unknown): boolean {\n if (!error || typeof error !== 'object') return false;\n\n // Check for status property (direct response or wrapped)\n if ('status' in error && (error as { status: number }).status === 403) {\n return true;\n }\n\n // Check for statusCode property (some HTTP clients)\n if ('statusCode' in error && (error as { statusCode: number }).statusCode === 403) {\n return true;\n }\n\n // Check error message for client-js pattern: \"HTTP error! status: 403\"\n if ('message' in error) {\n const message = (error as { message: string }).message;\n return message.includes('status: 403');\n }\n\n return false;\n}\n\n/**\n * Check if error has a status code that shouldn't be retried.\n * Used to prevent retrying client errors that won't resolve.\n */\nexport function isNonRetryableError(error: unknown): boolean {\n if (!error || typeof error !== 'object') return false;\n\n // Check for status property\n if ('status' in error) {\n const status = (error as { status: number }).status;\n return HTTP_NO_RETRY_STATUSES.includes(status);\n }\n\n // Check for statusCode property\n if ('statusCode' in error) {\n const statusCode = (error as { statusCode: number }).statusCode;\n return HTTP_NO_RETRY_STATUSES.includes(statusCode);\n }\n\n // Check error message for client-js pattern\n if ('message' in error) {\n const message = (error as { message: string }).message;\n return HTTP_NO_RETRY_STATUSES.some(code => message.includes(`status: ${code}`));\n }\n\n return false;\n}\n\n/**\n * Default retry function for TanStack Query.\n * Does not retry 4xx client errors (400, 401, 403, 404).\n * Retries other errors up to 3 times.\n */\nexport function shouldRetryQuery(failureCount: number, error: unknown): boolean {\n // Don't retry client errors - they won't resolve with retries\n if (isNonRetryableError(error)) {\n return false;\n }\n // Default: retry up to 3 times for transient errors\n return failureCount < 3;\n}\n","/**\n * Checks if a method exists on an object and is callable.\n */\nexport function hasMethod<T>(obj: T, method: string): boolean {\n return method in (obj as object) && typeof (obj as Record<string, unknown>)[method] === 'function';\n}\n","import { coreFeatures } from '@mastra/core/features';\nimport { MastraClient } from '@mastra/client-js';\nimport { hasMethod } from './client-utils';\nimport { isNonRetryableError } from '../../lib/query-utils';\n\n/**\n * Checks if workspace v1 features are supported by both core and client.\n * This guards against version mismatches between playground-ui, core, and client-js.\n */\nexport const isWorkspaceV1Supported = (client: MastraClient) => {\n const workspaceClientMethods = ['listWorkspaces', 'getWorkspace'];\n\n const coreSupported = coreFeatures.has('workspaces-v1');\n const clientSupported = workspaceClientMethods.every(method => hasMethod(client, method));\n\n return coreSupported && clientSupported;\n};\n\n/**\n * Gets the HTTP status code from an error if present.\n * Supports MastraClientError, fetch Response, and other HTTP client error formats.\n */\nconst getStatusCode = (error: unknown): number | undefined => {\n if (!error || typeof error !== 'object') return undefined;\n\n // Check for status property (MastraClientError, fetch Response, etc.)\n if ('status' in error && typeof (error as { status: unknown }).status === 'number') {\n return (error as { status: number }).status;\n }\n\n // Check for statusCode property (from some HTTP clients)\n if ('statusCode' in error && typeof (error as { statusCode: unknown }).statusCode === 'number') {\n return (error as { statusCode: number }).statusCode;\n }\n\n return undefined;\n};\n\n/**\n * Checks if an error has a specific HTTP status code.\n * Supports MastraClientError, fetch Response, and other HTTP client error formats.\n */\nconst hasStatusCode = (error: unknown, statusCode: number): boolean => {\n return getStatusCode(error) === statusCode;\n};\n\n/**\n * Checks if an error is a 4xx client error (e.g., 400, 401, 403, 404).\n * Client errors won't resolve with retries.\n */\nconst isClientError = (error: unknown): boolean => {\n const status = getStatusCode(error);\n return status !== undefined && status >= 400 && status < 500;\n};\n\n/**\n * Checks if an error is a \"Not Implemented\" (501) error from the server.\n * This indicates the server's @mastra/core version doesn't support workspaces.\n */\nexport const isWorkspaceNotSupportedError = (error: unknown): boolean => {\n if (hasStatusCode(error, 501)) {\n return true;\n }\n\n // Check error message for our specific error\n if (error && typeof error === 'object' && 'message' in error) {\n const message = (error as { message: string }).message;\n return message.includes('Workspace v1 not supported') || message.includes('501');\n }\n\n return false;\n};\n\n/**\n * Checks if an error is a \"Not Found\" (404) error from the server.\n * This indicates the requested resource doesn't exist (e.g., file not found).\n */\nexport const isNotFoundError = (error: unknown): boolean => {\n if (hasStatusCode(error, 404)) {\n return true;\n }\n\n // Check error message for status code (client-js throws Error with message like \"HTTP error! status: 404 - ...\")\n if (error && typeof error === 'object' && 'message' in error) {\n const message = (error as { message: string }).message;\n return message.includes('status: 404');\n }\n\n return false;\n};\n\n/**\n * React Query retry function that doesn't retry on client errors (4xx) or 501 errors.\n * Use this to prevent infinite retries when resources don't exist, access is denied, or workspaces aren't supported.\n */\nexport const shouldRetryWorkspaceQuery = (failureCount: number, error: unknown): boolean => {\n // Don't retry 4xx client errors (400, 401, 403, 404, etc.) - these won't resolve with retries\n if (isClientError(error)) {\n return false;\n }\n // Don't retry 501 \"Not Implemented\" errors - they won't resolve with retries\n if (isWorkspaceNotSupportedError(error)) {\n return false;\n }\n // Don't retry 4xx client errors (400, 401, 403, 404)\n if (isNonRetryableError(error)) {\n return false;\n }\n // Default retry behavior: retry up to 3 times\n return failureCount < 3;\n};\n"],"names":[],"mappings":";;AAOA,MAAM,sBAAA,GAAyB,CAAC,GAAA,EAAK,GAAA,EAAK,KAAK,GAAG,CAAA;AAM3C,SAAS,oBAAoB,KAAA,EAAyB;AAC3D,EAAA,IAAI,CAAC,KAAA,IAAS,OAAO,KAAA,KAAU,UAAU,OAAO,KAAA;AAGhD,EAAA,IAAI,QAAA,IAAY,KAAA,IAAU,KAAA,CAA6B,MAAA,KAAW,GAAA,EAAK;AACrE,IAAA,OAAO,IAAA;AAAA,EACT;AAGA,EAAA,IAAI,YAAA,IAAgB,KAAA,IAAU,KAAA,CAAiC,UAAA,KAAe,GAAA,EAAK;AACjF,IAAA,OAAO,IAAA;AAAA,EACT;AAGA,EAAA,IAAI,aAAa,KAAA,EAAO;AACtB,IAAA,MAAM,UAAW,KAAA,CAA8B,OAAA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