@mastra/react 0.0.0-studio-cli-20260504022012 → 0.0.0-sugared-octave-20261030170102
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +6 -4
- package/README.md +37 -0
- package/dist/accumulator-Bjfckb5t.cjs +1753 -0
- package/dist/accumulator-Bjfckb5t.cjs.map +1 -0
- package/dist/accumulator-DysrPe6U.js +1712 -0
- package/dist/accumulator-DysrPe6U.js.map +1 -0
- package/dist/agent/extract-tasks.d.ts +10 -0
- package/dist/agent/extract-tasks.d.ts.map +1 -0
- package/dist/agent/extractRunIdFromMessages.d.ts +9 -2
- package/dist/agent/extractRunIdFromMessages.d.ts.map +1 -1
- package/dist/agent/hooks.d.ts +77 -13
- package/dist/agent/hooks.d.ts.map +1 -1
- package/dist/agent/merge-history.d.ts +7 -0
- package/dist/agent/merge-history.d.ts.map +1 -0
- package/dist/agent/signal-data.d.ts +5 -0
- package/dist/agent/signal-data.d.ts.map +1 -0
- package/dist/agent/types.d.ts +15 -1
- package/dist/agent/types.d.ts.map +1 -1
- package/dist/agent/user-message.d.ts +4 -0
- package/dist/agent/user-message.d.ts.map +1 -0
- package/dist/chat/index.cjs +3 -0
- package/dist/chat/index.d.ts +3 -0
- package/dist/chat/index.d.ts.map +1 -0
- package/dist/chat/index.js +1 -0
- package/dist/combine-by-ids-C-0oe4eH.js +23 -0
- package/dist/combine-by-ids-C-0oe4eH.js.map +1 -0
- package/dist/combine-by-ids-ERVPXXBi.cjs +28 -0
- package/dist/combine-by-ids-ERVPXXBi.cjs.map +1 -0
- package/dist/experiments-Duv0RgkM.cjs +346 -0
- package/dist/experiments-Duv0RgkM.cjs.map +1 -0
- package/dist/experiments-DyecjEut.js +299 -0
- package/dist/experiments-DyecjEut.js.map +1 -0
- package/dist/feedback-refetch-interval-BBcT9r8s.cjs +16 -0
- package/dist/feedback-refetch-interval-BBcT9r8s.cjs.map +1 -0
- package/dist/feedback-refetch-interval-C12Nzb2r.js +11 -0
- package/dist/feedback-refetch-interval-C12Nzb2r.js.map +1 -0
- package/dist/hooks/agents/index.cjs +994 -0
- package/dist/hooks/agents/index.cjs.map +1 -0
- package/dist/hooks/agents/index.d.ts +19 -0
- package/dist/hooks/agents/index.d.ts.map +1 -0
- package/dist/hooks/agents/index.js +957 -0
- package/dist/hooks/agents/index.js.map +1 -0
- package/dist/hooks/agents/is-model-not-allowed.d.ts +15 -0
- package/dist/hooks/agents/is-model-not-allowed.d.ts.map +1 -0
- package/dist/hooks/agents/use-agent-messages.d.ts +18 -0
- package/dist/hooks/agents/use-agent-messages.d.ts.map +1 -0
- package/dist/hooks/agents/use-agent-plan.d.ts +14 -0
- package/dist/hooks/agents/use-agent-plan.d.ts.map +1 -0
- package/dist/hooks/agents/use-agent-skills.d.ts +2043 -0
- package/dist/hooks/agents/use-agent-skills.d.ts.map +1 -0
- package/dist/hooks/agents/use-agent-versions.d.ts +72 -0
- package/dist/hooks/agents/use-agent-versions.d.ts.map +1 -0
- package/dist/hooks/agents/use-agent-working-memory.d.ts +11 -0
- package/dist/hooks/agents/use-agent-working-memory.d.ts.map +1 -0
- package/dist/hooks/agents/use-agent-workspace.d.ts +2044 -0
- package/dist/hooks/agents/use-agent-workspace.d.ts.map +1 -0
- package/dist/hooks/agents/use-agent.d.ts +12 -0
- package/dist/hooks/agents/use-agent.d.ts.map +1 -0
- package/dist/hooks/agents/use-agents-model-providers.d.ts +9 -0
- package/dist/hooks/agents/use-agents-model-providers.d.ts.map +1 -0
- package/dist/hooks/agents/use-agents.d.ts +28 -0
- package/dist/hooks/agents/use-agents.d.ts.map +1 -0
- package/dist/hooks/agents/use-background-tasks.d.ts +51 -0
- package/dist/hooks/agents/use-background-tasks.d.ts.map +1 -0
- package/dist/hooks/agents/use-browser-session-probe.d.ts +34 -0
- package/dist/hooks/agents/use-browser-session-probe.d.ts.map +1 -0
- package/dist/hooks/agents/use-channels.d.ts +45 -0
- package/dist/hooks/agents/use-channels.d.ts.map +1 -0
- package/dist/hooks/agents/use-close-browser.d.ts +17 -0
- package/dist/hooks/agents/use-close-browser.d.ts.map +1 -0
- package/dist/hooks/agents/use-execute-agent-tool.d.ts +14 -0
- package/dist/hooks/agents/use-execute-agent-tool.d.ts.map +1 -0
- package/dist/hooks/agents/use-preview-instructions.d.ts +20 -0
- package/dist/hooks/agents/use-preview-instructions.d.ts.map +1 -0
- package/dist/hooks/agents/use-stored-agents.d.ts +8111 -0
- package/dist/hooks/agents/use-stored-agents.d.ts.map +1 -0
- package/dist/hooks/agents/use-stored-skills.d.ts +8 -0
- package/dist/hooks/agents/use-stored-skills.d.ts.map +1 -0
- package/dist/hooks/auth/fetch-with-refresh.d.ts +28 -0
- package/dist/hooks/auth/fetch-with-refresh.d.ts.map +1 -0
- package/dist/hooks/auth/get-client-query-key.d.ts +7 -0
- package/dist/hooks/auth/get-client-query-key.d.ts.map +1 -0
- package/dist/hooks/auth/index.cjs +482 -0
- package/dist/hooks/auth/index.cjs.map +1 -0
- package/dist/hooks/auth/index.d.ts +11 -0
- package/dist/hooks/auth/index.d.ts.map +1 -0
- package/dist/hooks/auth/index.js +464 -0
- package/dist/hooks/auth/index.js.map +1 -0
- package/dist/hooks/auth/sso-login.d.ts +8 -0
- package/dist/hooks/auth/sso-login.d.ts.map +1 -0
- package/dist/hooks/auth/types.d.ts +107 -0
- package/dist/hooks/auth/types.d.ts.map +1 -0
- package/dist/hooks/auth/use-auth-actions.d.ts +99 -0
- package/dist/hooks/auth/use-auth-actions.d.ts.map +1 -0
- package/dist/hooks/auth/use-auth-capabilities.d.ts +43 -0
- package/dist/hooks/auth/use-auth-capabilities.d.ts.map +1 -0
- package/dist/hooks/auth/use-credentials-login.d.ts +63 -0
- package/dist/hooks/auth/use-credentials-login.d.ts.map +1 -0
- package/dist/hooks/auth/use-credentials-signup.d.ts +66 -0
- package/dist/hooks/auth/use-credentials-signup.d.ts.map +1 -0
- package/dist/hooks/auth/use-current-user.d.ts +40 -0
- package/dist/hooks/auth/use-current-user.d.ts.map +1 -0
- package/dist/hooks/auth/use-permission-patterns.d.ts +24 -0
- package/dist/hooks/auth/use-permission-patterns.d.ts.map +1 -0
- package/dist/hooks/capabilities/index.cjs +139 -0
- package/dist/hooks/capabilities/index.cjs.map +1 -0
- package/dist/hooks/capabilities/index.d.ts +11 -0
- package/dist/hooks/capabilities/index.d.ts.map +1 -0
- package/dist/hooks/capabilities/index.js +129 -0
- package/dist/hooks/capabilities/index.js.map +1 -0
- package/dist/hooks/capabilities/use-feedback-available.d.ts +9 -0
- package/dist/hooks/capabilities/use-feedback-available.d.ts.map +1 -0
- package/dist/hooks/capabilities/use-observability-capabilities.d.ts +9 -0
- package/dist/hooks/capabilities/use-observability-capabilities.d.ts.map +1 -0
- package/dist/hooks/capabilities/use-span-aggregate-available.d.ts +9 -0
- package/dist/hooks/capabilities/use-span-aggregate-available.d.ts.map +1 -0
- package/dist/hooks/capabilities/use-span-query-available.d.ts +9 -0
- package/dist/hooks/capabilities/use-span-query-available.d.ts.map +1 -0
- package/dist/hooks/capabilities/use-thread-query-available.d.ts +9 -0
- package/dist/hooks/capabilities/use-thread-query-available.d.ts.map +1 -0
- package/dist/hooks/capabilities/use-trace-aggregate-available.d.ts +10 -0
- package/dist/hooks/capabilities/use-trace-aggregate-available.d.ts.map +1 -0
- package/dist/hooks/capabilities/use-trace-query-available.d.ts +9 -0
- package/dist/hooks/capabilities/use-trace-query-available.d.ts.map +1 -0
- package/dist/hooks/capabilities/use-trace-query-delta-polling-available.d.ts +10 -0
- package/dist/hooks/capabilities/use-trace-query-delta-polling-available.d.ts.map +1 -0
- package/dist/hooks/capabilities/use-trace-query-discovery-available.d.ts +10 -0
- package/dist/hooks/capabilities/use-trace-query-discovery-available.d.ts.map +1 -0
- package/dist/hooks/capabilities/use-trace-query-root-duration-available.d.ts +10 -0
- package/dist/hooks/capabilities/use-trace-query-root-duration-available.d.ts.map +1 -0
- package/dist/hooks/configuration/index.cjs +17 -0
- package/dist/hooks/configuration/index.cjs.map +1 -0
- package/dist/hooks/configuration/index.d.ts +2 -0
- package/dist/hooks/configuration/index.d.ts.map +1 -0
- package/dist/hooks/configuration/index.js +16 -0
- package/dist/hooks/configuration/index.js.map +1 -0
- package/dist/hooks/configuration/use-mastra-packages.d.ts +9 -0
- package/dist/hooks/configuration/use-mastra-packages.d.ts.map +1 -0
- package/dist/hooks/datasets/index.cjs +726 -0
- package/dist/hooks/datasets/index.cjs.map +1 -0
- package/dist/hooks/datasets/index.d.ts +10 -0
- package/dist/hooks/datasets/index.d.ts.map +1 -0
- package/dist/hooks/datasets/index.js +703 -0
- package/dist/hooks/datasets/index.js.map +1 -0
- package/dist/hooks/datasets/use-compare-experiments.d.ts +19 -0
- package/dist/hooks/datasets/use-compare-experiments.d.ts.map +1 -0
- package/dist/hooks/datasets/use-dataset-experiments.d.ts +92 -0
- package/dist/hooks/datasets/use-dataset-experiments.d.ts.map +1 -0
- package/dist/hooks/datasets/use-dataset-item-versions.d.ts +31 -0
- package/dist/hooks/datasets/use-dataset-item-versions.d.ts.map +1 -0
- package/dist/hooks/datasets/use-dataset-items.d.ts +38 -0
- package/dist/hooks/datasets/use-dataset-items.d.ts.map +1 -0
- package/dist/hooks/datasets/use-dataset-mutations.d.ts +315 -0
- package/dist/hooks/datasets/use-dataset-mutations.d.ts.map +1 -0
- package/dist/hooks/datasets/use-dataset-versions.d.ts +23 -0
- package/dist/hooks/datasets/use-dataset-versions.d.ts.map +1 -0
- package/dist/hooks/datasets/use-datasets.d.ts +51 -0
- package/dist/hooks/datasets/use-datasets.d.ts.map +1 -0
- package/dist/hooks/datasets/use-experiments.d.ts +24 -0
- package/dist/hooks/datasets/use-experiments.d.ts.map +1 -0
- package/dist/hooks/datasets/use-workflow-schema.d.ts +16 -0
- package/dist/hooks/datasets/use-workflow-schema.d.ts.map +1 -0
- package/dist/hooks/embedders/index.cjs +18 -0
- package/dist/hooks/embedders/index.cjs.map +1 -0
- package/dist/hooks/embedders/index.d.ts +2 -0
- package/dist/hooks/embedders/index.d.ts.map +1 -0
- package/dist/hooks/embedders/index.js +17 -0
- package/dist/hooks/embedders/index.js.map +1 -0
- package/dist/hooks/embedders/use-embedders.d.ts +17 -0
- package/dist/hooks/embedders/use-embedders.d.ts.map +1 -0
- package/dist/hooks/experiments/index.cjs +10 -0
- package/dist/hooks/experiments/index.d.ts +7 -0
- package/dist/hooks/experiments/index.d.ts.map +1 -0
- package/dist/hooks/experiments/index.js +1 -0
- package/dist/hooks/experiments/usage-accumulator.d.ts +25 -0
- package/dist/hooks/experiments/usage-accumulator.d.ts.map +1 -0
- package/dist/hooks/experiments/use-experiment-item-usage.d.ts +23 -0
- package/dist/hooks/experiments/use-experiment-item-usage.d.ts.map +1 -0
- package/dist/hooks/experiments/use-experiment-metrics.d.ts +30 -0
- package/dist/hooks/experiments/use-experiment-metrics.d.ts.map +1 -0
- package/dist/hooks/experiments/use-experiment-trace.d.ts +13 -0
- package/dist/hooks/experiments/use-experiment-trace.d.ts.map +1 -0
- package/dist/hooks/experiments/use-experiments-for-dataset-filter.d.ts +22 -0
- package/dist/hooks/experiments/use-experiments-for-dataset-filter.d.ts.map +1 -0
- package/dist/hooks/experiments/use-experiments-list-metrics.d.ts +19 -0
- package/dist/hooks/experiments/use-experiments-list-metrics.d.ts.map +1 -0
- package/dist/hooks/experiments/use-infinite-experiments.d.ts +22 -0
- package/dist/hooks/experiments/use-infinite-experiments.d.ts.map +1 -0
- package/dist/hooks/feedback/feedback-refetch-interval.d.ts +7 -0
- package/dist/hooks/feedback/feedback-refetch-interval.d.ts.map +1 -0
- package/dist/hooks/feedback/index.cjs +21 -0
- package/dist/hooks/feedback/index.cjs.map +1 -0
- package/dist/hooks/feedback/index.d.ts +3 -0
- package/dist/hooks/feedback/index.d.ts.map +1 -0
- package/dist/hooks/feedback/index.js +19 -0
- package/dist/hooks/feedback/index.js.map +1 -0
- package/dist/hooks/feedback/use-feedback.d.ts +56 -0
- package/dist/hooks/feedback/use-feedback.d.ts.map +1 -0
- package/dist/hooks/llm/index.cjs +16 -0
- package/dist/hooks/llm/index.cjs.map +1 -0
- package/dist/hooks/llm/index.d.ts +2 -0
- package/dist/hooks/llm/index.d.ts.map +1 -0
- package/dist/hooks/llm/index.js +15 -0
- package/dist/hooks/llm/index.js.map +1 -0
- package/dist/hooks/llm/use-llm-providers.d.ts +7 -0
- package/dist/hooks/llm/use-llm-providers.d.ts.map +1 -0
- package/dist/hooks/logs/index.cjs +83 -0
- package/dist/hooks/logs/index.cjs.map +1 -0
- package/dist/hooks/logs/index.d.ts +4 -0
- package/dist/hooks/logs/index.d.ts.map +1 -0
- package/dist/hooks/logs/index.js +81 -0
- package/dist/hooks/logs/index.js.map +1 -0
- package/dist/hooks/logs/types.d.ts +36 -0
- package/dist/hooks/logs/types.d.ts.map +1 -0
- package/dist/hooks/logs/use-logs.d.ts +79 -0
- package/dist/hooks/logs/use-logs.d.ts.map +1 -0
- package/dist/hooks/mcps/index.cjs +231 -0
- package/dist/hooks/mcps/index.cjs.map +1 -0
- package/dist/hooks/mcps/index.d.ts +8 -0
- package/dist/hooks/mcps/index.d.ts.map +1 -0
- package/dist/hooks/mcps/index.js +223 -0
- package/dist/hooks/mcps/index.js.map +1 -0
- package/dist/hooks/mcps/use-mcp-app-html.d.ts +17 -0
- package/dist/hooks/mcps/use-mcp-app-html.d.ts.map +1 -0
- package/dist/hooks/mcps/use-mcp-app-tools.d.ts +21 -0
- package/dist/hooks/mcps/use-mcp-app-tools.d.ts.map +1 -0
- package/dist/hooks/mcps/use-mcp-server-tool.d.ts +25 -0
- package/dist/hooks/mcps/use-mcp-server-tool.d.ts.map +1 -0
- package/dist/hooks/mcps/use-mcp-server-tools-by-id.d.ts +13 -0
- package/dist/hooks/mcps/use-mcp-server-tools-by-id.d.ts.map +1 -0
- package/dist/hooks/mcps/use-mcp-server-tools.d.ts +9 -0
- package/dist/hooks/mcps/use-mcp-server-tools.d.ts.map +1 -0
- package/dist/hooks/mcps/use-mcp-servers.d.ts +8 -0
- package/dist/hooks/mcps/use-mcp-servers.d.ts.map +1 -0
- package/dist/hooks/mcps/use-try-connect-mcp.d.ts +15 -0
- package/dist/hooks/mcps/use-try-connect-mcp.d.ts.map +1 -0
- package/dist/hooks/memory/index.cjs +324 -0
- package/dist/hooks/memory/index.cjs.map +1 -0
- package/dist/hooks/memory/index.d.ts +5 -0
- package/dist/hooks/memory/index.d.ts.map +1 -0
- package/dist/hooks/memory/index.js +308 -0
- package/dist/hooks/memory/index.js.map +1 -0
- package/dist/hooks/memory/use-memory-status.d.ts +12 -0
- package/dist/hooks/memory/use-memory-status.d.ts.map +1 -0
- package/dist/hooks/memory/use-memory-thread-messages.d.ts +13 -0
- package/dist/hooks/memory/use-memory-thread-messages.d.ts.map +1 -0
- package/dist/hooks/memory/use-memory.d.ts +159 -0
- package/dist/hooks/memory/use-memory.d.ts.map +1 -0
- package/dist/hooks/memory/use-observational-memory.d.ts +13 -0
- package/dist/hooks/memory/use-observational-memory.d.ts.map +1 -0
- package/dist/hooks/metrics/index.cjs +989 -0
- package/dist/hooks/metrics/index.cjs.map +1 -0
- package/dist/hooks/metrics/index.d.ts +16 -0
- package/dist/hooks/metrics/index.d.ts.map +1 -0
- package/dist/hooks/metrics/index.js +973 -0
- package/dist/hooks/metrics/index.js.map +1 -0
- package/dist/hooks/metrics/metrics-interval.d.ts +8 -0
- package/dist/hooks/metrics/metrics-interval.d.ts.map +1 -0
- package/dist/hooks/metrics/metrics-query-filters.d.ts +62 -0
- package/dist/hooks/metrics/metrics-query-filters.d.ts.map +1 -0
- package/dist/hooks/metrics/use-active-resources-kpi-metrics.d.ts +12 -0
- package/dist/hooks/metrics/use-active-resources-kpi-metrics.d.ts.map +1 -0
- package/dist/hooks/metrics/use-active-threads-kpi-metrics.d.ts +12 -0
- package/dist/hooks/metrics/use-active-threads-kpi-metrics.d.ts.map +1 -0
- package/dist/hooks/metrics/use-agent-runs-kpi-metrics.d.ts +9 -0
- package/dist/hooks/metrics/use-agent-runs-kpi-metrics.d.ts.map +1 -0
- package/dist/hooks/metrics/use-latency-metrics.d.ts +23 -0
- package/dist/hooks/metrics/use-latency-metrics.d.ts.map +1 -0
- package/dist/hooks/metrics/use-model-cost-kpi-metrics.d.ts +14 -0
- package/dist/hooks/metrics/use-model-cost-kpi-metrics.d.ts.map +1 -0
- package/dist/hooks/metrics/use-model-usage-cost-metrics.d.ts +17 -0
- package/dist/hooks/metrics/use-model-usage-cost-metrics.d.ts.map +1 -0
- package/dist/hooks/metrics/use-scores-metrics.d.ts +24 -0
- package/dist/hooks/metrics/use-scores-metrics.d.ts.map +1 -0
- package/dist/hooks/metrics/use-token-usage-by-agent-metrics.d.ts +15 -0
- package/dist/hooks/metrics/use-token-usage-by-agent-metrics.d.ts.map +1 -0
- package/dist/hooks/metrics/use-token-usage-timeseries.d.ts +22 -0
- package/dist/hooks/metrics/use-token-usage-timeseries.d.ts.map +1 -0
- package/dist/hooks/metrics/use-top-active-threads-metrics.d.ts +21 -0
- package/dist/hooks/metrics/use-top-active-threads-metrics.d.ts.map +1 -0
- package/dist/hooks/metrics/use-top-resources-by-threads-metrics.d.ts +20 -0
- package/dist/hooks/metrics/use-top-resources-by-threads-metrics.d.ts.map +1 -0
- package/dist/hooks/metrics/use-total-tokens-kpi-metrics.d.ts +13 -0
- package/dist/hooks/metrics/use-total-tokens-kpi-metrics.d.ts.map +1 -0
- package/dist/hooks/metrics/use-trace-volume-metrics.d.ts +17 -0
- package/dist/hooks/metrics/use-trace-volume-metrics.d.ts.map +1 -0
- package/dist/hooks/processors/index.cjs +42 -0
- package/dist/hooks/processors/index.cjs.map +1 -0
- package/dist/hooks/processors/index.d.ts +2 -0
- package/dist/hooks/processors/index.d.ts.map +1 -0
- package/dist/hooks/processors/index.js +39 -0
- package/dist/hooks/processors/index.js.map +1 -0
- package/dist/hooks/processors/use-processors.d.ts +64 -0
- package/dist/hooks/processors/use-processors.d.ts.map +1 -0
- package/dist/hooks/prompt-blocks/index.cjs +179 -0
- package/dist/hooks/prompt-blocks/index.cjs.map +1 -0
- package/dist/hooks/prompt-blocks/index.d.ts +3 -0
- package/dist/hooks/prompt-blocks/index.d.ts.map +1 -0
- package/dist/hooks/prompt-blocks/index.js +170 -0
- package/dist/hooks/prompt-blocks/index.js.map +1 -0
- package/dist/hooks/prompt-blocks/use-prompt-block-versions.d.ts +59 -0
- package/dist/hooks/prompt-blocks/use-prompt-block-versions.d.ts.map +1 -0
- package/dist/hooks/prompt-blocks/use-stored-prompt-blocks.d.ts +180 -0
- package/dist/hooks/prompt-blocks/use-stored-prompt-blocks.d.ts.map +1 -0
- package/dist/hooks/query/index.cjs +33 -0
- package/dist/hooks/query/index.cjs.map +1 -0
- package/dist/hooks/query/index.d.ts +4 -0
- package/dist/hooks/query/index.d.ts.map +1 -0
- package/dist/hooks/query/index.js +24 -0
- package/dist/hooks/query/index.js.map +1 -0
- package/dist/hooks/query/query-client-provider.d.ts +8 -0
- package/dist/hooks/query/query-client-provider.d.ts.map +1 -0
- package/dist/hooks/query/query-utils.d.ts +48 -0
- package/dist/hooks/query/query-utils.d.ts.map +1 -0
- package/dist/hooks/review/index.cjs +90 -0
- package/dist/hooks/review/index.cjs.map +1 -0
- package/dist/hooks/review/index.d.ts +4 -0
- package/dist/hooks/review/index.d.ts.map +1 -0
- package/dist/hooks/review/index.js +87 -0
- package/dist/hooks/review/index.js.map +1 -0
- package/dist/hooks/review/types.d.ts +24 -0
- package/dist/hooks/review/types.d.ts.map +1 -0
- package/dist/hooks/review/use-dataset-review-items.d.ts +19 -0
- package/dist/hooks/review/use-dataset-review-items.d.ts.map +1 -0
- package/dist/hooks/review/use-review-summary.d.ts +9 -0
- package/dist/hooks/review/use-review-summary.d.ts.map +1 -0
- package/dist/hooks/schedules/index.cjs +106 -0
- package/dist/hooks/schedules/index.cjs.map +1 -0
- package/dist/hooks/schedules/index.d.ts +5 -0
- package/dist/hooks/schedules/index.d.ts.map +1 -0
- package/dist/hooks/schedules/index.js +102 -0
- package/dist/hooks/schedules/index.js.map +1 -0
- package/dist/hooks/schedules/use-schedule-triggers.d.ts +18 -0
- package/dist/hooks/schedules/use-schedule-triggers.d.ts.map +1 -0
- package/dist/hooks/schedules/use-schedule.d.ts +11 -0
- package/dist/hooks/schedules/use-schedule.d.ts.map +1 -0
- package/dist/hooks/schedules/use-schedules.d.ts +7 -0
- package/dist/hooks/schedules/use-schedules.d.ts.map +1 -0
- package/dist/hooks/schedules/use-toggle-schedule.d.ts +13 -0
- package/dist/hooks/schedules/use-toggle-schedule.d.ts.map +1 -0
- package/dist/hooks/scores/index.cjs +334 -0
- package/dist/hooks/scores/index.cjs.map +1 -0
- package/dist/hooks/scores/index.d.ts +6 -0
- package/dist/hooks/scores/index.d.ts.map +1 -0
- package/dist/hooks/scores/index.js +318 -0
- package/dist/hooks/scores/index.js.map +1 -0
- package/dist/hooks/scores/use-scorer-versions.d.ts +71 -0
- package/dist/hooks/scores/use-scorer-versions.d.ts.map +1 -0
- package/dist/hooks/scores/use-scorers.d.ts +34 -0
- package/dist/hooks/scores/use-scorers.d.ts.map +1 -0
- package/dist/hooks/scores/use-stored-scorers.d.ts +151 -0
- package/dist/hooks/scores/use-stored-scorers.d.ts.map +1 -0
- package/dist/hooks/scores/use-trace-span-scores.d.ts +20 -0
- package/dist/hooks/scores/use-trace-span-scores.d.ts.map +1 -0
- package/dist/hooks/scores/use-trigger-scorer.d.ts +17 -0
- package/dist/hooks/scores/use-trigger-scorer.d.ts.map +1 -0
- package/dist/hooks/shared/combine-by-ids.d.ts +15 -0
- package/dist/hooks/shared/combine-by-ids.d.ts.map +1 -0
- package/dist/hooks/shared/cost.d.ts +7 -0
- package/dist/hooks/shared/cost.d.ts.map +1 -0
- package/dist/hooks/shared/date-format.d.ts +30 -0
- package/dist/hooks/shared/date-format.d.ts.map +1 -0
- package/dist/hooks/shared/map.d.ts +2 -0
- package/dist/hooks/shared/map.d.ts.map +1 -0
- package/dist/hooks/shared/query-options.d.ts +19 -0
- package/dist/hooks/shared/query-options.d.ts.map +1 -0
- package/dist/hooks/shared/use-in-view.d.ts +23 -0
- package/dist/hooks/shared/use-in-view.d.ts.map +1 -0
- package/dist/hooks/templates/index.cjs +465 -0
- package/dist/hooks/templates/index.cjs.map +1 -0
- package/dist/hooks/templates/index.d.ts +2 -0
- package/dist/hooks/templates/index.d.ts.map +1 -0
- package/dist/hooks/templates/index.js +457 -0
- package/dist/hooks/templates/index.js.map +1 -0
- package/dist/hooks/templates/use-templates.d.ts +139 -0
- package/dist/hooks/templates/use-templates.d.ts.map +1 -0
- package/dist/hooks/tool-providers/index.cjs +333 -0
- package/dist/hooks/tool-providers/index.cjs.map +1 -0
- package/dist/hooks/tool-providers/index.d.ts +10 -0
- package/dist/hooks/tool-providers/index.d.ts.map +1 -0
- package/dist/hooks/tool-providers/index.js +323 -0
- package/dist/hooks/tool-providers/index.js.map +1 -0
- package/dist/hooks/tool-providers/use-all-connections.d.ts +41 -0
- package/dist/hooks/tool-providers/use-all-connections.d.ts.map +1 -0
- package/dist/hooks/tool-providers/use-all-provider-tools.d.ts +25 -0
- package/dist/hooks/tool-providers/use-all-provider-tools.d.ts.map +1 -0
- package/dist/hooks/tool-providers/use-authorize.d.ts +45 -0
- package/dist/hooks/tool-providers/use-authorize.d.ts.map +1 -0
- package/dist/hooks/tool-providers/use-disconnect-connection.d.ts +24 -0
- package/dist/hooks/tool-providers/use-disconnect-connection.d.ts.map +1 -0
- package/dist/hooks/tool-providers/use-existing-connections.d.ts +33 -0
- package/dist/hooks/tool-providers/use-existing-connections.d.ts.map +1 -0
- package/dist/hooks/tool-providers/use-provider-tools.d.ts +17 -0
- package/dist/hooks/tool-providers/use-provider-tools.d.ts.map +1 -0
- package/dist/hooks/tool-providers/use-tool-providers.d.ts +23 -0
- package/dist/hooks/tool-providers/use-tool-providers.d.ts.map +1 -0
- package/dist/hooks/tool-providers/use-toolkits.d.ts +13 -0
- package/dist/hooks/tool-providers/use-toolkits.d.ts.map +1 -0
- package/dist/hooks/tool-providers/use-update-connection.d.ts +24 -0
- package/dist/hooks/tool-providers/use-update-connection.d.ts.map +1 -0
- package/dist/hooks/tools/index.cjs +47 -0
- package/dist/hooks/tools/index.cjs.map +1 -0
- package/dist/hooks/tools/index.d.ts +3 -0
- package/dist/hooks/tools/index.d.ts.map +1 -0
- package/dist/hooks/tools/index.js +44 -0
- package/dist/hooks/tools/index.js.map +1 -0
- package/dist/hooks/tools/use-all-tools.d.ts +16 -0
- package/dist/hooks/tools/use-all-tools.d.ts.map +1 -0
- package/dist/hooks/tools/use-execute-tool.d.ts +13 -0
- package/dist/hooks/tools/use-execute-tool.d.ts.map +1 -0
- package/dist/hooks/traces/discovery-cache.d.ts +12 -0
- package/dist/hooks/traces/discovery-cache.d.ts.map +1 -0
- package/dist/hooks/traces/index.cjs +1473 -0
- package/dist/hooks/traces/index.cjs.map +1 -0
- package/dist/hooks/traces/index.d.ts +26 -0
- package/dist/hooks/traces/index.d.ts.map +1 -0
- package/dist/hooks/traces/index.js +1424 -0
- package/dist/hooks/traces/index.js.map +1 -0
- package/dist/hooks/traces/types.d.ts +21 -0
- package/dist/hooks/traces/types.d.ts.map +1 -0
- package/dist/hooks/traces/use-branch.d.ts +18 -0
- package/dist/hooks/traces/use-branch.d.ts.map +1 -0
- package/dist/hooks/traces/use-create-feedback.d.ts +21 -0
- package/dist/hooks/traces/use-create-feedback.d.ts.map +1 -0
- package/dist/hooks/traces/use-delete-feedback.d.ts +21 -0
- package/dist/hooks/traces/use-delete-feedback.d.ts.map +1 -0
- package/dist/hooks/traces/use-entity-names.d.ts +14 -0
- package/dist/hooks/traces/use-entity-names.d.ts.map +1 -0
- package/dist/hooks/traces/use-environments.d.ts +10 -0
- package/dist/hooks/traces/use-environments.d.ts.map +1 -0
- package/dist/hooks/traces/use-query-spans.d.ts +27 -0
- package/dist/hooks/traces/use-query-spans.d.ts.map +1 -0
- package/dist/hooks/traces/use-query-threads.d.ts +30 -0
- package/dist/hooks/traces/use-query-threads.d.ts.map +1 -0
- package/dist/hooks/traces/use-service-names.d.ts +10 -0
- package/dist/hooks/traces/use-service-names.d.ts.map +1 -0
- package/dist/hooks/traces/use-span-aggregate.d.ts +16 -0
- package/dist/hooks/traces/use-span-aggregate.d.ts.map +1 -0
- package/dist/hooks/traces/use-span-detail.d.ts +14 -0
- package/dist/hooks/traces/use-span-detail.d.ts.map +1 -0
- package/dist/hooks/traces/use-span-feedback.d.ts +19 -0
- package/dist/hooks/traces/use-span-feedback.d.ts.map +1 -0
- package/dist/hooks/traces/use-tags.d.ts +10 -0
- package/dist/hooks/traces/use-tags.d.ts.map +1 -0
- package/dist/hooks/traces/use-thread-has-other-traces.d.ts +17 -0
- package/dist/hooks/traces/use-thread-has-other-traces.d.ts.map +1 -0
- package/dist/hooks/traces/use-trace-aggregate.d.ts +17 -0
- package/dist/hooks/traces/use-trace-aggregate.d.ts.map +1 -0
- package/dist/hooks/traces/use-trace-column-preferences-storage-key.d.ts +8 -0
- package/dist/hooks/traces/use-trace-column-preferences-storage-key.d.ts.map +1 -0
- package/dist/hooks/traces/use-trace-feedback.d.ts +16 -0
- package/dist/hooks/traces/use-trace-feedback.d.ts.map +1 -0
- package/dist/hooks/traces/use-trace-light-spans.d.ts +16 -0
- package/dist/hooks/traces/use-trace-light-spans.d.ts.map +1 -0
- package/dist/hooks/traces/use-trace-metadata-filter-fields.d.ts +42 -0
- package/dist/hooks/traces/use-trace-metadata-filter-fields.d.ts.map +1 -0
- package/dist/hooks/traces/use-trace-or-branch-spans.d.ts +39 -0
- package/dist/hooks/traces/use-trace-or-branch-spans.d.ts.map +1 -0
- package/dist/hooks/traces/use-trace-query.d.ts +106 -0
- package/dist/hooks/traces/use-trace-query.d.ts.map +1 -0
- package/dist/hooks/traces/use-trace-spans.d.ts +46 -0
- package/dist/hooks/traces/use-trace-spans.d.ts.map +1 -0
- package/dist/hooks/traces/use-trace-usage.d.ts +10 -0
- package/dist/hooks/traces/use-trace-usage.d.ts.map +1 -0
- package/dist/hooks/traces/use-traces.d.ts +244 -0
- package/dist/hooks/traces/use-traces.d.ts.map +1 -0
- package/dist/hooks/vectors/index.cjs +18 -0
- package/dist/hooks/vectors/index.cjs.map +1 -0
- package/dist/hooks/vectors/index.d.ts +2 -0
- package/dist/hooks/vectors/index.d.ts.map +1 -0
- package/dist/hooks/vectors/index.js +17 -0
- package/dist/hooks/vectors/index.js.map +1 -0
- package/dist/hooks/vectors/use-vectors.d.ts +14 -0
- package/dist/hooks/vectors/use-vectors.d.ts.map +1 -0
- package/dist/hooks/voice/index.cjs +86 -0
- package/dist/hooks/voice/index.cjs.map +1 -0
- package/dist/hooks/voice/index.d.ts +2 -0
- package/dist/hooks/voice/index.d.ts.map +1 -0
- package/dist/hooks/voice/index.js +85 -0
- package/dist/hooks/voice/index.js.map +1 -0
- package/dist/hooks/voice/use-read-aloud.d.ts +20 -0
- package/dist/hooks/voice/use-read-aloud.d.ts.map +1 -0
- package/dist/hooks/workflows/index.cjs +169 -0
- package/dist/hooks/workflows/index.cjs.map +1 -0
- package/dist/hooks/workflows/index.d.ts +7 -0
- package/dist/hooks/workflows/index.d.ts.map +1 -0
- package/dist/hooks/workflows/index.js +153 -0
- package/dist/hooks/workflows/index.js.map +1 -0
- package/dist/hooks/workflows/use-workflow-runs.d.ts +51 -0
- package/dist/hooks/workflows/use-workflow-runs.d.ts.map +1 -0
- package/dist/hooks/workflows/use-workflow.d.ts +14 -0
- package/dist/hooks/workflows/use-workflow.d.ts.map +1 -0
- package/dist/hooks/workflows/use-workflows-run-counts.d.ts +25 -0
- package/dist/hooks/workflows/use-workflows-run-counts.d.ts.map +1 -0
- package/dist/hooks/workflows/use-workflows.d.ts +10 -0
- package/dist/hooks/workflows/use-workflows.d.ts.map +1 -0
- package/dist/hooks/workspace/client-utils.d.ts +5 -0
- package/dist/hooks/workspace/client-utils.d.ts.map +1 -0
- package/dist/hooks/workspace/compatibility.d.ts +22 -0
- package/dist/hooks/workspace/compatibility.d.ts.map +1 -0
- package/dist/hooks/workspace/file-type.d.ts +7 -0
- package/dist/hooks/workspace/file-type.d.ts.map +1 -0
- package/dist/hooks/workspace/index.cjs +614 -0
- package/dist/hooks/workspace/index.cjs.map +1 -0
- package/dist/hooks/workspace/index.d.ts +11 -0
- package/dist/hooks/workspace/index.d.ts.map +1 -0
- package/dist/hooks/workspace/index.js +584 -0
- package/dist/hooks/workspace/index.js.map +1 -0
- package/dist/hooks/workspace/types.d.ts +199 -0
- package/dist/hooks/workspace/types.d.ts.map +1 -0
- package/dist/hooks/workspace/use-skills-sh.d.ts +104 -0
- package/dist/hooks/workspace/use-skills-sh.d.ts.map +1 -0
- package/dist/hooks/workspace/use-stored-workspaces.d.ts +12 -0
- package/dist/hooks/workspace/use-stored-workspaces.d.ts.map +1 -0
- package/dist/hooks/workspace/use-workspace-directory.d.ts +13 -0
- package/dist/hooks/workspace/use-workspace-directory.d.ts.map +1 -0
- package/dist/hooks/workspace/use-workspace-file-content.d.ts +15 -0
- package/dist/hooks/workspace/use-workspace-file-content.d.ts.map +1 -0
- package/dist/hooks/workspace/use-workspace-search.d.ts +20 -0
- package/dist/hooks/workspace/use-workspace-search.d.ts.map +1 -0
- package/dist/hooks/workspace/use-workspace-skills.d.ts +23 -0
- package/dist/hooks/workspace/use-workspace-skills.d.ts.map +1 -0
- package/dist/hooks/workspace/use-workspace.d.ts +56 -0
- package/dist/hooks/workspace/use-workspace.d.ts.map +1 -0
- package/dist/hooks-Bt15IwzP.cjs +266 -0
- package/dist/hooks-Bt15IwzP.cjs.map +1 -0
- package/dist/hooks-Btt7PyI-.js +249 -0
- package/dist/hooks-Btt7PyI-.js.map +1 -0
- package/dist/hooks-Czqwakn0.cjs +1347 -0
- package/dist/hooks-Czqwakn0.cjs.map +1 -0
- package/dist/hooks-MRtQ3GE8.js +1330 -0
- package/dist/hooks-MRtQ3GE8.js.map +1 -0
- package/dist/index.cjs +56 -3001
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +5 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +39 -2936
- package/dist/index.js.map +1 -1
- package/dist/lib/mastra-db/accumulator.d.ts +42 -0
- package/dist/lib/mastra-db/accumulator.d.ts.map +1 -0
- package/dist/lib/mastra-db/formatCompletionFeedback.d.ts.map +1 -0
- package/dist/lib/mastra-db/fromCoreUserMessage.d.ts +13 -0
- package/dist/lib/mastra-db/fromCoreUserMessage.d.ts.map +1 -0
- package/dist/lib/mastra-db/index.d.ts +6 -0
- package/dist/lib/mastra-db/index.d.ts.map +1 -0
- package/dist/lib/mastra-db/types.d.ts +173 -0
- package/dist/lib/mastra-db/types.d.ts.map +1 -0
- package/dist/map-5-4U5rwA.js +11 -0
- package/dist/map-5-4U5rwA.js.map +1 -0
- package/dist/map-BGoWBTGy.cjs +16 -0
- package/dist/map-BGoWBTGy.cjs.map +1 -0
- package/dist/mastra-client-context-DQ5z_ze9.js +49 -0
- package/dist/mastra-client-context-DQ5z_ze9.js.map +1 -0
- package/dist/mastra-client-context-DX8wJM9p.cjs +60 -0
- package/dist/mastra-client-context-DX8wJM9p.cjs.map +1 -0
- package/dist/mastra-client-context.d.ts +1 -1
- package/dist/mastra-client-context.d.ts.map +1 -1
- package/dist/mastra-react-provider.d.ts +2 -2
- package/dist/mastra-react-provider.d.ts.map +1 -1
- package/dist/query-utils-BVgE_xxj.cjs +173 -0
- package/dist/query-utils-BVgE_xxj.cjs.map +1 -0
- package/dist/query-utils-DvMERIwf.js +126 -0
- package/dist/query-utils-DvMERIwf.js.map +1 -0
- package/dist/react.css +72 -127
- package/dist/ui/Code/Code.d.ts +3 -2
- package/dist/ui/Code/Code.d.ts.map +1 -1
- package/dist/ui/Entity/Entity.d.ts +4 -4
- package/dist/ui/Entity/Entity.d.ts.map +1 -1
- package/dist/ui/Entity/Entry.d.ts +2 -2
- package/dist/ui/Entity/Entry.d.ts.map +1 -1
- package/dist/ui/Entity/ToolApproval.d.ts +5 -5
- package/dist/ui/Entity/ToolApproval.d.ts.map +1 -1
- package/dist/ui/Icon/Icon.d.ts +1 -1
- package/dist/ui/Icon/Icon.d.ts.map +1 -1
- package/dist/ui/IconButton/IconButton.d.ts +1 -1
- package/dist/ui/IconButton/IconButton.d.ts.map +1 -1
- package/dist/ui/Icons/AgentIcon.d.ts +1 -1
- package/dist/ui/Icons/AgentIcon.d.ts.map +1 -1
- package/dist/ui/Icons/ToolsIcon.d.ts +1 -1
- package/dist/ui/Icons/ToolsIcon.d.ts.map +1 -1
- package/dist/ui/Icons/WorkflowIcon.d.ts +1 -1
- package/dist/ui/Icons/WorkflowIcon.d.ts.map +1 -1
- package/dist/ui/Message/Message.d.ts +9 -9
- package/dist/ui/Message/Message.d.ts.map +1 -1
- package/dist/ui/MessageFactory/MessageFactory.d.ts +24 -0
- package/dist/ui/MessageFactory/MessageFactory.d.ts.map +1 -0
- package/dist/ui/MessageFactory/index.d.ts +3 -0
- package/dist/ui/MessageFactory/index.d.ts.map +1 -0
- package/dist/ui/MessageFactory/types.d.ts +183 -0
- package/dist/ui/MessageFactory/types.d.ts.map +1 -0
- package/dist/ui/Tooltip/Tooltip.d.ts +3 -3
- package/dist/ui/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/ui/index.cjs +561 -0
- package/dist/ui/index.cjs.map +1 -0
- package/dist/ui/index.d.ts +1 -0
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/index.js +484 -0
- package/dist/ui/index.js.map +1 -0
- package/dist/use-in-view-BxdrrnCw.cjs +36 -0
- package/dist/use-in-view-BxdrrnCw.cjs.map +1 -0
- package/dist/use-in-view-CyjKdplM.js +31 -0
- package/dist/use-in-view-CyjKdplM.js.map +1 -0
- package/dist/voice/index.d.ts +5 -0
- package/dist/voice/index.d.ts.map +1 -0
- package/dist/voice/play-stream-with-web-audio.d.ts +2 -0
- package/dist/voice/play-stream-with-web-audio.d.ts.map +1 -0
- package/dist/voice/record-mic-to-file.d.ts +2 -0
- package/dist/voice/record-mic-to-file.d.ts.map +1 -0
- package/dist/voice/use-speech-recognition.d.ts +20 -0
- package/dist/voice/use-speech-recognition.d.ts.map +1 -0
- package/dist/voice-Didej2E1.cjs +278 -0
- package/dist/voice-Didej2E1.cjs.map +1 -0
- package/dist/voice-ugGu7VyA.js +261 -0
- package/dist/voice-ugGu7VyA.js.map +1 -0
- package/dist/workflows/WorkflowStepFactory/WorkflowStepFactory.d.ts +8 -0
- package/dist/workflows/WorkflowStepFactory/WorkflowStepFactory.d.ts.map +1 -0
- package/dist/workflows/WorkflowStepFactory/index.d.ts +3 -0
- package/dist/workflows/WorkflowStepFactory/index.d.ts.map +1 -0
- package/dist/workflows/WorkflowStepFactory/types.d.ts +96 -0
- package/dist/workflows/WorkflowStepFactory/types.d.ts.map +1 -0
- package/dist/workflows/hooks.d.ts.map +1 -1
- package/dist/workflows/index.d.ts +1 -0
- package/dist/workflows/index.d.ts.map +1 -1
- package/dist/workflows/types.d.ts +4 -0
- package/dist/workflows/types.d.ts.map +1 -1
- package/dist/workflows/use-stream-workflow.d.ts +1 -29
- package/dist/workflows/use-stream-workflow.d.ts.map +1 -1
- package/package.json +70 -38
- package/CHANGELOG.md +0 -2495
- package/dist/lib/ai-sdk/index.d.ts +0 -5
- package/dist/lib/ai-sdk/index.d.ts.map +0 -1
- package/dist/lib/ai-sdk/memory/resolveInitialMessages.d.ts +0 -13
- package/dist/lib/ai-sdk/memory/resolveInitialMessages.d.ts.map +0 -1
- package/dist/lib/ai-sdk/transformers/AISdkNetworkTransformer.d.ts +0 -11
- package/dist/lib/ai-sdk/transformers/AISdkNetworkTransformer.d.ts.map +0 -1
- package/dist/lib/ai-sdk/transformers/types.d.ts +0 -11
- package/dist/lib/ai-sdk/transformers/types.d.ts.map +0 -1
- package/dist/lib/ai-sdk/types.d.ts +0 -143
- package/dist/lib/ai-sdk/types.d.ts.map +0 -1
- package/dist/lib/ai-sdk/utils/formatCompletionFeedback.d.ts.map +0 -1
- package/dist/lib/ai-sdk/utils/fromCoreUserMessageToUIMessage.d.ts +0 -11
- package/dist/lib/ai-sdk/utils/fromCoreUserMessageToUIMessage.d.ts.map +0 -1
- package/dist/lib/ai-sdk/utils/toAssistantUIMessage.d.ts +0 -15
- package/dist/lib/ai-sdk/utils/toAssistantUIMessage.d.ts.map +0 -1
- package/dist/lib/ai-sdk/utils/toUIMessage.d.ts +0 -18
- package/dist/lib/ai-sdk/utils/toUIMessage.d.ts.map +0 -1
- /package/dist/lib/{ai-sdk/utils → mastra-db}/formatCompletionFeedback.d.ts +0 -0
|
@@ -0,0 +1,584 @@
|
|
|
1
|
+
import { n as useMastraClient } from "../../mastra-client-context-DQ5z_ze9.js";
|
|
2
|
+
import { a as isNonRetryableError } from "../../query-utils-DvMERIwf.js";
|
|
3
|
+
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
4
|
+
import { coreFeatures } from "@mastra/core/features";
|
|
5
|
+
// src/hooks/workspace/client-utils.ts
|
|
6
|
+
/**
|
|
7
|
+
* Checks if a method exists on an object and is callable.
|
|
8
|
+
*/
|
|
9
|
+
function hasMethod(obj, method) {
|
|
10
|
+
return method in obj && typeof obj[method] === "function";
|
|
11
|
+
}
|
|
12
|
+
// src/hooks/workspace/compatibility.ts
|
|
13
|
+
/**
|
|
14
|
+
* Checks if workspace v1 features are supported by both core and client.
|
|
15
|
+
* This guards against version mismatches between playground-ui, core, and client-js.
|
|
16
|
+
*/
|
|
17
|
+
const isWorkspaceV1Supported = (client) => {
|
|
18
|
+
const workspaceClientMethods = ["listWorkspaces", "getWorkspace"];
|
|
19
|
+
const coreSupported = coreFeatures.has("workspaces-v1");
|
|
20
|
+
const clientSupported = workspaceClientMethods.every((method) => hasMethod(client, method));
|
|
21
|
+
return coreSupported && clientSupported;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Gets the HTTP status code from an error if present.
|
|
25
|
+
* Supports MastraClientError, fetch Response, and other HTTP client error formats.
|
|
26
|
+
*/
|
|
27
|
+
const getStatusCode = (error) => {
|
|
28
|
+
if (!error || typeof error !== "object") return void 0;
|
|
29
|
+
if ("status" in error && typeof error.status === "number") return error.status;
|
|
30
|
+
if ("statusCode" in error && typeof error.statusCode === "number") return error.statusCode;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Checks if an error has a specific HTTP status code.
|
|
34
|
+
* Supports MastraClientError, fetch Response, and other HTTP client error formats.
|
|
35
|
+
*/
|
|
36
|
+
const hasStatusCode = (error, statusCode) => {
|
|
37
|
+
return getStatusCode(error) === statusCode;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Checks if an error is a 4xx client error (e.g., 400, 401, 403, 404).
|
|
41
|
+
* Client errors won't resolve with retries.
|
|
42
|
+
*/
|
|
43
|
+
const isClientError = (error) => {
|
|
44
|
+
const status = getStatusCode(error);
|
|
45
|
+
return status !== void 0 && status >= 400 && status < 500;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Checks if an error is a "Not Implemented" (501) error from the server.
|
|
49
|
+
* This indicates the server's @mastra/core version doesn't support workspaces.
|
|
50
|
+
*/
|
|
51
|
+
const isWorkspaceNotSupportedError = (error) => {
|
|
52
|
+
if (hasStatusCode(error, 501)) return true;
|
|
53
|
+
if (error && typeof error === "object" && "message" in error) {
|
|
54
|
+
const message = error.message;
|
|
55
|
+
return message.includes("Workspace v1 not supported") || message.includes("501");
|
|
56
|
+
}
|
|
57
|
+
return false;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* React Query retry function that doesn't retry on client errors (4xx) or 501 errors.
|
|
61
|
+
* Use this to prevent infinite retries when resources don't exist, access is denied, or workspaces aren't supported.
|
|
62
|
+
*/
|
|
63
|
+
const shouldRetryWorkspaceQuery = (failureCount, error) => {
|
|
64
|
+
if (isClientError(error)) return false;
|
|
65
|
+
if (isWorkspaceNotSupportedError(error)) return false;
|
|
66
|
+
if (isNonRetryableError(error)) return false;
|
|
67
|
+
return failureCount < 3;
|
|
68
|
+
};
|
|
69
|
+
// src/hooks/workspace/file-type.ts
|
|
70
|
+
const IMAGE_EXTENSIONS = [
|
|
71
|
+
"png",
|
|
72
|
+
"jpg",
|
|
73
|
+
"jpeg",
|
|
74
|
+
"gif",
|
|
75
|
+
"svg",
|
|
76
|
+
"webp",
|
|
77
|
+
"bmp",
|
|
78
|
+
"avif",
|
|
79
|
+
"tiff",
|
|
80
|
+
"tif"
|
|
81
|
+
];
|
|
82
|
+
const VIDEO_MIME_TYPES = {
|
|
83
|
+
mp4: "video/mp4",
|
|
84
|
+
webm: "video/webm",
|
|
85
|
+
mov: "video/quicktime",
|
|
86
|
+
m4v: "video/mp4",
|
|
87
|
+
ogv: "video/ogg"
|
|
88
|
+
};
|
|
89
|
+
const extension = (path) => path.split("/").pop()?.split(".").pop()?.toLowerCase() ?? "";
|
|
90
|
+
const isImageFile = (path, mimeType) => mimeType?.startsWith("image/") || IMAGE_EXTENSIONS.includes(extension(path));
|
|
91
|
+
const isVideoFile = (path, mimeType) => mimeType?.startsWith("video/") || extension(path) in VIDEO_MIME_TYPES;
|
|
92
|
+
/** Media must be read as base64: reading it as utf-8 corrupts the bytes. */
|
|
93
|
+
const isMediaFile = (path) => isImageFile(path) || isVideoFile(path);
|
|
94
|
+
const videoMimeType = (path, mimeType) => mimeType?.startsWith("video/") ? mimeType : VIDEO_MIME_TYPES[extension(path)] ?? "video/mp4";
|
|
95
|
+
const isMarkdownFile = (path) => /\.mdx?$/i.test(path);
|
|
96
|
+
// src/hooks/workspace/use-skills-sh.ts
|
|
97
|
+
/**
|
|
98
|
+
* Search skills on skills.sh (via server proxy)
|
|
99
|
+
*/
|
|
100
|
+
const useSearchSkillsSh = ({ workspaceId, queryOptions }) => {
|
|
101
|
+
const client = useMastraClient();
|
|
102
|
+
return useMutation({
|
|
103
|
+
mutationFn: (query) => {
|
|
104
|
+
if (!workspaceId) throw new Error("Workspace ID is required");
|
|
105
|
+
return client.getWorkspace(workspaceId).searchSkillsSh({
|
|
106
|
+
q: query,
|
|
107
|
+
limit: 10
|
|
108
|
+
});
|
|
109
|
+
},
|
|
110
|
+
...queryOptions
|
|
111
|
+
});
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* Get popular skills from skills.sh (via server proxy, cached for 5 minutes)
|
|
115
|
+
*
|
|
116
|
+
* Does not guard on empty ids; pass `queryOptions: { enabled }` to skip the fetch.
|
|
117
|
+
*/
|
|
118
|
+
const usePopularSkillsSh = ({ workspaceId, queryOptions }) => {
|
|
119
|
+
const client = useMastraClient();
|
|
120
|
+
return useQuery({
|
|
121
|
+
queryKey: [
|
|
122
|
+
"skills-sh",
|
|
123
|
+
"popular",
|
|
124
|
+
workspaceId
|
|
125
|
+
],
|
|
126
|
+
queryFn: () => {
|
|
127
|
+
if (!workspaceId) throw new Error("Workspace ID is required");
|
|
128
|
+
return client.getWorkspace(workspaceId).listPopularSkillsSh({
|
|
129
|
+
limit: 10,
|
|
130
|
+
offset: 0
|
|
131
|
+
});
|
|
132
|
+
},
|
|
133
|
+
staleTime: 3e5,
|
|
134
|
+
...queryOptions
|
|
135
|
+
});
|
|
136
|
+
};
|
|
137
|
+
/**
|
|
138
|
+
* Preview a skill by fetching its SKILL.md (via server proxy to avoid CORS)
|
|
139
|
+
*
|
|
140
|
+
* Does not guard on empty ids; pass `queryOptions: { enabled }` to skip the fetch.
|
|
141
|
+
*/
|
|
142
|
+
const useSkillPreview = ({ workspaceId, owner, repo, skillPath, queryOptions }) => {
|
|
143
|
+
const client = useMastraClient();
|
|
144
|
+
return useQuery({
|
|
145
|
+
queryKey: [
|
|
146
|
+
"skills-sh",
|
|
147
|
+
"preview",
|
|
148
|
+
workspaceId,
|
|
149
|
+
owner,
|
|
150
|
+
repo,
|
|
151
|
+
skillPath
|
|
152
|
+
],
|
|
153
|
+
queryFn: async () => {
|
|
154
|
+
if (!workspaceId || !owner || !repo || !skillPath) throw new Error("workspaceId, owner, repo, and skillPath are required");
|
|
155
|
+
const { content } = await client.getWorkspace(workspaceId).previewSkillsSh({
|
|
156
|
+
owner,
|
|
157
|
+
repo,
|
|
158
|
+
path: skillPath
|
|
159
|
+
});
|
|
160
|
+
return content;
|
|
161
|
+
},
|
|
162
|
+
retry: false,
|
|
163
|
+
...queryOptions
|
|
164
|
+
});
|
|
165
|
+
};
|
|
166
|
+
/**
|
|
167
|
+
* Parse a skill's topSource field to extract GitHub repository info
|
|
168
|
+
*
|
|
169
|
+
* skills.sh topSource formats:
|
|
170
|
+
* - "owner/repo" (e.g., "vercel-labs/agent-skills")
|
|
171
|
+
* - "owner/repo/path" (e.g., "anthropics/skills/frontend-design")
|
|
172
|
+
* - "github.com/owner/repo/path" (full URL format)
|
|
173
|
+
*
|
|
174
|
+
* The skill name is used as the path within the repo when not specified
|
|
175
|
+
*/
|
|
176
|
+
function parseSkillSource(topSource, skillName) {
|
|
177
|
+
let cleanSource = topSource.replace(/^https?:\/\//, "");
|
|
178
|
+
cleanSource = cleanSource.replace(/^github\.com\//, "");
|
|
179
|
+
cleanSource = cleanSource.replace(/\/$/, "");
|
|
180
|
+
const parts = cleanSource.split("/").filter(Boolean);
|
|
181
|
+
const [owner, repo] = parts;
|
|
182
|
+
if (!owner || !repo) return null;
|
|
183
|
+
let skillPath;
|
|
184
|
+
if (parts.length > 2) skillPath = parts.slice(2).join("/");
|
|
185
|
+
else if (skillName) skillPath = skillName;
|
|
186
|
+
else return null;
|
|
187
|
+
return {
|
|
188
|
+
owner,
|
|
189
|
+
repo,
|
|
190
|
+
skillPath
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Install a skill by fetching from GitHub and writing to workspace filesystem.
|
|
195
|
+
*/
|
|
196
|
+
const useInstallSkill = ({ queryOptions } = {}) => {
|
|
197
|
+
const client = useMastraClient();
|
|
198
|
+
const queryClient = useQueryClient();
|
|
199
|
+
return useMutation({
|
|
200
|
+
mutationFn: (params) => {
|
|
201
|
+
const [owner, repo] = params.repository.split("/");
|
|
202
|
+
if (!owner || !repo) throw new Error("Invalid repository format. Expected owner/repo");
|
|
203
|
+
return client.getWorkspace(params.workspaceId).installSkillsSh({
|
|
204
|
+
owner,
|
|
205
|
+
repo,
|
|
206
|
+
skillName: params.skillName,
|
|
207
|
+
mount: params.mount
|
|
208
|
+
});
|
|
209
|
+
},
|
|
210
|
+
onSuccess: (_, variables) => {
|
|
211
|
+
queryClient.invalidateQueries({ queryKey: [
|
|
212
|
+
"workspace",
|
|
213
|
+
"skills",
|
|
214
|
+
variables.workspaceId
|
|
215
|
+
] });
|
|
216
|
+
},
|
|
217
|
+
...queryOptions
|
|
218
|
+
});
|
|
219
|
+
};
|
|
220
|
+
/**
|
|
221
|
+
* Update installed skills by re-fetching from GitHub.
|
|
222
|
+
*/
|
|
223
|
+
const useUpdateSkills = ({ queryOptions } = {}) => {
|
|
224
|
+
const client = useMastraClient();
|
|
225
|
+
const queryClient = useQueryClient();
|
|
226
|
+
return useMutation({
|
|
227
|
+
mutationFn: (params) => client.getWorkspace(params.workspaceId).updateSkillsSh({ skillName: params.skillName }),
|
|
228
|
+
onSuccess: (_, variables) => {
|
|
229
|
+
queryClient.invalidateQueries({ queryKey: [
|
|
230
|
+
"workspace",
|
|
231
|
+
"skills",
|
|
232
|
+
variables.workspaceId
|
|
233
|
+
] });
|
|
234
|
+
},
|
|
235
|
+
...queryOptions
|
|
236
|
+
});
|
|
237
|
+
};
|
|
238
|
+
/**
|
|
239
|
+
* Remove an installed skill by deleting its directory.
|
|
240
|
+
*/
|
|
241
|
+
const useRemoveSkill = ({ queryOptions } = {}) => {
|
|
242
|
+
const client = useMastraClient();
|
|
243
|
+
const queryClient = useQueryClient();
|
|
244
|
+
return useMutation({
|
|
245
|
+
mutationFn: (params) => client.getWorkspace(params.workspaceId).removeSkillsSh({ skillName: params.skillName }),
|
|
246
|
+
onSuccess: (_, variables) => {
|
|
247
|
+
queryClient.invalidateQueries({ queryKey: [
|
|
248
|
+
"workspace",
|
|
249
|
+
"skills",
|
|
250
|
+
variables.workspaceId
|
|
251
|
+
] });
|
|
252
|
+
},
|
|
253
|
+
...queryOptions
|
|
254
|
+
});
|
|
255
|
+
};
|
|
256
|
+
// src/hooks/workspace/use-stored-workspaces.ts
|
|
257
|
+
/**
|
|
258
|
+
* Hook to list stored workspaces from the database.
|
|
259
|
+
* These are workspaces that have been persisted via the stored workspaces API,
|
|
260
|
+
* as opposed to runtime-registered workspaces from code-defined agents.
|
|
261
|
+
*/
|
|
262
|
+
const useStoredWorkspaces = ({ queryOptions, ...params } = {}) => {
|
|
263
|
+
const client = useMastraClient();
|
|
264
|
+
return useQuery({
|
|
265
|
+
queryKey: ["stored-workspaces", params],
|
|
266
|
+
queryFn: async () => {
|
|
267
|
+
return client.listStoredWorkspaces(params);
|
|
268
|
+
},
|
|
269
|
+
...queryOptions
|
|
270
|
+
});
|
|
271
|
+
};
|
|
272
|
+
// src/hooks/workspace/use-workspace.ts
|
|
273
|
+
function getParentPath(path) {
|
|
274
|
+
return path.split("/").slice(0, -1).join("/") || (path.startsWith("/") ? "/" : ".");
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Does not guard on empty ids; pass `queryOptions: { enabled }` to skip the fetch.
|
|
278
|
+
*/
|
|
279
|
+
const useWorkspaceInfo = ({ workspaceId, queryOptions } = {}) => {
|
|
280
|
+
const client = useMastraClient();
|
|
281
|
+
return useQuery({
|
|
282
|
+
queryKey: [
|
|
283
|
+
"workspace",
|
|
284
|
+
"info",
|
|
285
|
+
workspaceId
|
|
286
|
+
],
|
|
287
|
+
queryFn: async () => {
|
|
288
|
+
if (!isWorkspaceV1Supported(client)) throw new Error("Workspace v1 not supported by core or client");
|
|
289
|
+
if (!workspaceId) throw new Error("workspaceId is required");
|
|
290
|
+
return client.getWorkspace(workspaceId).info();
|
|
291
|
+
},
|
|
292
|
+
retry: shouldRetryWorkspaceQuery,
|
|
293
|
+
...queryOptions,
|
|
294
|
+
enabled: isWorkspaceV1Supported(client) && (queryOptions?.enabled ?? true)
|
|
295
|
+
});
|
|
296
|
+
};
|
|
297
|
+
const useWorkspaces = ({ queryOptions } = {}) => {
|
|
298
|
+
const client = useMastraClient();
|
|
299
|
+
return useQuery({
|
|
300
|
+
queryKey: ["workspaces"],
|
|
301
|
+
queryFn: async () => {
|
|
302
|
+
if (!isWorkspaceV1Supported(client)) throw new Error("Workspace v1 not supported by core or client");
|
|
303
|
+
return client.listWorkspaces();
|
|
304
|
+
},
|
|
305
|
+
retry: shouldRetryWorkspaceQuery,
|
|
306
|
+
...queryOptions
|
|
307
|
+
});
|
|
308
|
+
};
|
|
309
|
+
/**
|
|
310
|
+
* Does not guard on empty ids; pass `queryOptions: { enabled }` to skip the fetch.
|
|
311
|
+
*/
|
|
312
|
+
const useWorkspaceFileStat = ({ path, workspaceId, queryOptions }) => {
|
|
313
|
+
const client = useMastraClient();
|
|
314
|
+
return useQuery({
|
|
315
|
+
queryKey: [
|
|
316
|
+
"workspace",
|
|
317
|
+
"stat",
|
|
318
|
+
path,
|
|
319
|
+
workspaceId
|
|
320
|
+
],
|
|
321
|
+
queryFn: async () => {
|
|
322
|
+
if (!isWorkspaceV1Supported(client)) throw new Error("Workspace v1 not supported by core or client");
|
|
323
|
+
if (!workspaceId) throw new Error("workspaceId is required");
|
|
324
|
+
return client.getWorkspace(workspaceId).stat(path);
|
|
325
|
+
},
|
|
326
|
+
retry: shouldRetryWorkspaceQuery,
|
|
327
|
+
...queryOptions,
|
|
328
|
+
enabled: isWorkspaceV1Supported(client) && (queryOptions?.enabled ?? true)
|
|
329
|
+
});
|
|
330
|
+
};
|
|
331
|
+
const useWriteWorkspaceFile = ({ queryOptions } = {}) => {
|
|
332
|
+
const client = useMastraClient();
|
|
333
|
+
const queryClient = useQueryClient();
|
|
334
|
+
return useMutation({
|
|
335
|
+
mutationFn: async (params) => {
|
|
336
|
+
if (!isWorkspaceV1Supported(client)) throw new Error("Workspace v1 not supported by core or client");
|
|
337
|
+
return client.getWorkspace(params.workspaceId).writeFile(params.path, params.content, {
|
|
338
|
+
encoding: params.encoding,
|
|
339
|
+
recursive: params.recursive ?? true
|
|
340
|
+
});
|
|
341
|
+
},
|
|
342
|
+
onSuccess: (_, variables) => {
|
|
343
|
+
const parentPath = getParentPath(variables.path);
|
|
344
|
+
queryClient.invalidateQueries({ queryKey: [
|
|
345
|
+
"workspace",
|
|
346
|
+
"files",
|
|
347
|
+
parentPath
|
|
348
|
+
] });
|
|
349
|
+
queryClient.invalidateQueries({ queryKey: [
|
|
350
|
+
"workspace",
|
|
351
|
+
"file",
|
|
352
|
+
variables.path
|
|
353
|
+
] });
|
|
354
|
+
},
|
|
355
|
+
...queryOptions
|
|
356
|
+
});
|
|
357
|
+
};
|
|
358
|
+
const useWriteWorkspaceFileFromFile = ({ queryOptions } = {}) => {
|
|
359
|
+
const client = useMastraClient();
|
|
360
|
+
const queryClient = useQueryClient();
|
|
361
|
+
return useMutation({
|
|
362
|
+
mutationFn: async (params) => {
|
|
363
|
+
if (!isWorkspaceV1Supported(client)) throw new Error("Workspace v1 not supported by core or client");
|
|
364
|
+
const arrayBuffer = await params.file.arrayBuffer();
|
|
365
|
+
const base64 = btoa(new Uint8Array(arrayBuffer).reduce((data, byte) => data + String.fromCharCode(byte), ""));
|
|
366
|
+
return client.getWorkspace(params.workspaceId).writeFile(params.path, base64, {
|
|
367
|
+
encoding: "base64",
|
|
368
|
+
recursive: params.recursive ?? true
|
|
369
|
+
});
|
|
370
|
+
},
|
|
371
|
+
onSuccess: (_, variables) => {
|
|
372
|
+
const parentPath = getParentPath(variables.path);
|
|
373
|
+
queryClient.invalidateQueries({ queryKey: [
|
|
374
|
+
"workspace",
|
|
375
|
+
"files",
|
|
376
|
+
parentPath
|
|
377
|
+
] });
|
|
378
|
+
queryClient.invalidateQueries({ queryKey: [
|
|
379
|
+
"workspace",
|
|
380
|
+
"file",
|
|
381
|
+
variables.path
|
|
382
|
+
] });
|
|
383
|
+
},
|
|
384
|
+
...queryOptions
|
|
385
|
+
});
|
|
386
|
+
};
|
|
387
|
+
const useDeleteWorkspaceFile = ({ queryOptions } = {}) => {
|
|
388
|
+
const client = useMastraClient();
|
|
389
|
+
const queryClient = useQueryClient();
|
|
390
|
+
return useMutation({
|
|
391
|
+
mutationFn: async (params) => {
|
|
392
|
+
if (!isWorkspaceV1Supported(client)) throw new Error("Workspace v1 not supported by core or client");
|
|
393
|
+
return client.getWorkspace(params.workspaceId).delete(params.path, {
|
|
394
|
+
recursive: params.recursive,
|
|
395
|
+
force: params.force
|
|
396
|
+
});
|
|
397
|
+
},
|
|
398
|
+
onSuccess: (_, variables) => {
|
|
399
|
+
const parentPath = getParentPath(variables.path);
|
|
400
|
+
queryClient.invalidateQueries({ queryKey: [
|
|
401
|
+
"workspace",
|
|
402
|
+
"files",
|
|
403
|
+
parentPath
|
|
404
|
+
] });
|
|
405
|
+
queryClient.invalidateQueries({ queryKey: [
|
|
406
|
+
"workspace",
|
|
407
|
+
"file",
|
|
408
|
+
variables.path
|
|
409
|
+
] });
|
|
410
|
+
},
|
|
411
|
+
...queryOptions
|
|
412
|
+
});
|
|
413
|
+
};
|
|
414
|
+
const useCreateWorkspaceDirectory = ({ queryOptions } = {}) => {
|
|
415
|
+
const client = useMastraClient();
|
|
416
|
+
const queryClient = useQueryClient();
|
|
417
|
+
return useMutation({
|
|
418
|
+
mutationFn: async (params) => {
|
|
419
|
+
if (!isWorkspaceV1Supported(client)) throw new Error("Workspace v1 not supported by core or client");
|
|
420
|
+
return client.getWorkspace(params.workspaceId).mkdir(params.path, params.recursive);
|
|
421
|
+
},
|
|
422
|
+
onSuccess: (_, variables) => {
|
|
423
|
+
const parentPath = getParentPath(variables.path);
|
|
424
|
+
queryClient.invalidateQueries({ queryKey: [
|
|
425
|
+
"workspace",
|
|
426
|
+
"files",
|
|
427
|
+
parentPath
|
|
428
|
+
] });
|
|
429
|
+
},
|
|
430
|
+
...queryOptions
|
|
431
|
+
});
|
|
432
|
+
};
|
|
433
|
+
const useIndexWorkspaceContent = ({ queryOptions } = {}) => {
|
|
434
|
+
const client = useMastraClient();
|
|
435
|
+
return useMutation({
|
|
436
|
+
mutationFn: async (params) => {
|
|
437
|
+
if (!isWorkspaceV1Supported(client)) throw new Error("Workspace v1 not supported by core or client");
|
|
438
|
+
return client.getWorkspace(params.workspaceId).index({
|
|
439
|
+
path: params.path,
|
|
440
|
+
content: params.content,
|
|
441
|
+
metadata: params.metadata
|
|
442
|
+
});
|
|
443
|
+
},
|
|
444
|
+
...queryOptions
|
|
445
|
+
});
|
|
446
|
+
};
|
|
447
|
+
// src/hooks/workspace/use-workspace-directory.ts
|
|
448
|
+
const WORKSPACE_REFETCH_INTERVAL = 1e4;
|
|
449
|
+
function useWorkspaceDirectory({ workspaceId, path, queryOptions }) {
|
|
450
|
+
const client = useMastraClient();
|
|
451
|
+
return useQuery({
|
|
452
|
+
queryKey: [
|
|
453
|
+
"workspace",
|
|
454
|
+
workspaceId,
|
|
455
|
+
"fs",
|
|
456
|
+
"list",
|
|
457
|
+
path
|
|
458
|
+
],
|
|
459
|
+
queryFn: async () => (await client.getWorkspace(workspaceId).listFiles(path, false)).entries,
|
|
460
|
+
refetchInterval: WORKSPACE_REFETCH_INTERVAL,
|
|
461
|
+
...queryOptions
|
|
462
|
+
});
|
|
463
|
+
}
|
|
464
|
+
// src/hooks/workspace/use-workspace-file-content.ts
|
|
465
|
+
/**
|
|
466
|
+
* Does not guard on empty ids; pass `queryOptions: { enabled }` to skip the fetch.
|
|
467
|
+
*/
|
|
468
|
+
function useWorkspaceFileContent({ workspaceId, path, queryOptions }) {
|
|
469
|
+
const client = useMastraClient();
|
|
470
|
+
const encoding = path && isMediaFile(path) ? "base64" : void 0;
|
|
471
|
+
return useQuery({
|
|
472
|
+
queryKey: [
|
|
473
|
+
"workspace",
|
|
474
|
+
workspaceId,
|
|
475
|
+
"fs",
|
|
476
|
+
"read",
|
|
477
|
+
path,
|
|
478
|
+
encoding
|
|
479
|
+
],
|
|
480
|
+
queryFn: () => client.getWorkspace(workspaceId).readFile(path ?? "", encoding),
|
|
481
|
+
refetchInterval: WORKSPACE_REFETCH_INTERVAL,
|
|
482
|
+
...queryOptions
|
|
483
|
+
});
|
|
484
|
+
}
|
|
485
|
+
// src/hooks/workspace/use-workspace-search.ts
|
|
486
|
+
const filePathFromId = (id) => id.replace(/#chunk-\d+$/, "");
|
|
487
|
+
const basename = (path) => path.split("/").filter(Boolean).pop() ?? path;
|
|
488
|
+
const skillFilePath = (result) => result.skillPath ? `${result.skillPath.replace(/\/$/, "")}/SKILL.md` : result.source;
|
|
489
|
+
/** Searches files and skills in parallel; one failing source (e.g. 501 not configured) keeps the other's hits. */
|
|
490
|
+
/**
|
|
491
|
+
* Does not guard on empty ids; pass `queryOptions: { enabled }` to skip the fetch.
|
|
492
|
+
*/
|
|
493
|
+
function useWorkspaceSearch({ workspaceId, query, files: searchFiles = true, skills: searchSkills = true, queryOptions }) {
|
|
494
|
+
const client = useMastraClient();
|
|
495
|
+
const trimmed = query.trim();
|
|
496
|
+
return useQuery({
|
|
497
|
+
queryKey: [
|
|
498
|
+
"workspace",
|
|
499
|
+
workspaceId,
|
|
500
|
+
"search",
|
|
501
|
+
trimmed,
|
|
502
|
+
searchFiles,
|
|
503
|
+
searchSkills
|
|
504
|
+
],
|
|
505
|
+
queryFn: async () => {
|
|
506
|
+
const workspace = client.getWorkspace(workspaceId);
|
|
507
|
+
const [files, skills] = await Promise.allSettled([searchFiles ? workspace.search({ query: trimmed }) : Promise.reject(/* @__PURE__ */ new Error("File search disabled")), searchSkills ? workspace.searchSkills({ query: trimmed }) : Promise.reject(/* @__PURE__ */ new Error("Skill search disabled"))]);
|
|
508
|
+
if (files.status === "rejected" && skills.status === "rejected") throw (searchFiles ? files : skills).reason;
|
|
509
|
+
const hits = /* @__PURE__ */ new Map();
|
|
510
|
+
const add = (hit) => {
|
|
511
|
+
const existing = hits.get(hit.path);
|
|
512
|
+
if (!existing || existing.score < hit.score) hits.set(hit.path, hit);
|
|
513
|
+
};
|
|
514
|
+
if (files.status === "fulfilled") for (const result of files.value.results) {
|
|
515
|
+
const path = filePathFromId(result.id);
|
|
516
|
+
add({
|
|
517
|
+
kind: "file",
|
|
518
|
+
path,
|
|
519
|
+
label: basename(path),
|
|
520
|
+
score: result.score
|
|
521
|
+
});
|
|
522
|
+
}
|
|
523
|
+
if (skills.status === "fulfilled") for (const result of skills.value.results) add({
|
|
524
|
+
kind: "skill",
|
|
525
|
+
path: skillFilePath(result),
|
|
526
|
+
label: result.skillName,
|
|
527
|
+
score: result.score
|
|
528
|
+
});
|
|
529
|
+
return [...hits.values()].sort((a, b) => b.score - a.score);
|
|
530
|
+
},
|
|
531
|
+
...queryOptions
|
|
532
|
+
});
|
|
533
|
+
}
|
|
534
|
+
// src/hooks/workspace/use-workspace-skills.ts
|
|
535
|
+
/**
|
|
536
|
+
* Does not guard on empty ids; pass `queryOptions: { enabled }` to skip the fetch.
|
|
537
|
+
*/
|
|
538
|
+
const useWorkspaceSkills = ({ workspaceId, queryOptions } = {}) => {
|
|
539
|
+
const client = useMastraClient();
|
|
540
|
+
return useQuery({
|
|
541
|
+
queryKey: [
|
|
542
|
+
"workspace",
|
|
543
|
+
"skills",
|
|
544
|
+
workspaceId
|
|
545
|
+
],
|
|
546
|
+
queryFn: async () => {
|
|
547
|
+
if (!isWorkspaceV1Supported(client)) throw new Error("Workspace v1 not supported by core or client");
|
|
548
|
+
if (!workspaceId) throw new Error("workspaceId is required");
|
|
549
|
+
return client.getWorkspace(workspaceId).listSkills();
|
|
550
|
+
},
|
|
551
|
+
retry: shouldRetryWorkspaceQuery,
|
|
552
|
+
...queryOptions,
|
|
553
|
+
enabled: isWorkspaceV1Supported(client) && (queryOptions?.enabled ?? true)
|
|
554
|
+
});
|
|
555
|
+
};
|
|
556
|
+
/**
|
|
557
|
+
* Hook to get a specific skill from an agent's workspace
|
|
558
|
+
*
|
|
559
|
+
* Does not guard on empty ids; pass `queryOptions: { enabled }` to skip the fetch.
|
|
560
|
+
*/
|
|
561
|
+
const useAgentSkill = ({ agentId, skillName, workspaceId, path, queryOptions }) => {
|
|
562
|
+
const client = useMastraClient();
|
|
563
|
+
return useQuery({
|
|
564
|
+
queryKey: [
|
|
565
|
+
"agents",
|
|
566
|
+
agentId,
|
|
567
|
+
"skills",
|
|
568
|
+
skillName,
|
|
569
|
+
path,
|
|
570
|
+
workspaceId
|
|
571
|
+
],
|
|
572
|
+
queryFn: async () => {
|
|
573
|
+
if (!isWorkspaceV1Supported(client)) throw new Error("Workspace v1 not supported by core or client");
|
|
574
|
+
if (!workspaceId) throw new Error("workspaceId is required");
|
|
575
|
+
return client.getWorkspace(workspaceId).getSkill(skillName, path).details();
|
|
576
|
+
},
|
|
577
|
+
retry: shouldRetryWorkspaceQuery,
|
|
578
|
+
...queryOptions,
|
|
579
|
+
enabled: isWorkspaceV1Supported(client) && (queryOptions?.enabled ?? true)
|
|
580
|
+
});
|
|
581
|
+
};
|
|
582
|
+
export { WORKSPACE_REFETCH_INTERVAL, isImageFile, isMarkdownFile, isMediaFile, isVideoFile, isWorkspaceNotSupportedError, isWorkspaceV1Supported, parseSkillSource, shouldRetryWorkspaceQuery, useAgentSkill, useCreateWorkspaceDirectory, useDeleteWorkspaceFile, useIndexWorkspaceContent, useInstallSkill, usePopularSkillsSh, useRemoveSkill, useSearchSkillsSh, useSkillPreview, useStoredWorkspaces, useUpdateSkills, useWorkspaceDirectory, useWorkspaceFileContent, useWorkspaceFileStat, useWorkspaceInfo, useWorkspaceSearch, useWorkspaceSkills, useWorkspaces, useWriteWorkspaceFile, useWriteWorkspaceFileFromFile, videoMimeType };
|
|
583
|
+
|
|
584
|
+
//# sourceMappingURL=index.js.map
|