@@ -765,21 +765,252 @@ sequenceDiagram
765765 ProgressPanel->>User: Render grouped progress items with stable IDs
766766```
767767
768- ## 🚀 ** Quick Start ** (5 Minutes to Production)
768+ ## 🚀 ** Hooks ** (5 Minutes to Production)
769769
770770``` mermaid
771771%%{init: {'theme': 'dark', 'themeVariables': { 'primaryColor': '#58a6ff', 'primaryTextColor': '#c9d1d9', 'primaryBorderColor': '#30363d', 'lineColor': '#58a6ff', 'sectionBkgColor': '#161b22', 'altSectionBkgColor': '#0d1117', 'sectionTextColor': '#c9d1d9', 'gridColor': '#30363d', 'tertiaryColor': '#161b22' }}}%%
772- flowchart LR
773- A[1️⃣ Prerequisites] --> B[2️⃣ Clone & Install]
774- B --> C[3️⃣ Configure Env]
775- C --> D[4️⃣ Run Dev]
776- D --> E[5️⃣ Start Building]
772+ classDiagram
773+ class MastraQueryHooks {
774+ <<interface>>
775+ % Core access
776+ +useAgents()
777+ +useAgent(agentId, requestContext)
778+ +useAgentModelProviders()
779+ +useAgentSpeakers(agentId, requestContext)
780+ +useAgentListener(agentId, requestContext)
781+
782+ % Tools and processors
783+ +useTools(requestContext)
784+ +useTool(toolId, requestContext)
785+ +useToolProviders()
786+ +useToolProvider(providerId)
787+ +useToolProviderToolkits(providerId)
788+ +useToolProviderTools(providerId, params)
789+ +useToolProviderToolSchema(providerId, toolSlug)
790+ +useProcessors(requestContext)
791+ +useProcessor(processorId, requestContext)
792+ +useProcessorProviders()
793+ +useProcessorProvider(providerId)
794+ +useProcessorExecuteMutation(processorId)
795+
796+ % Workflows and runs
797+ +useWorkflows(requestContext, partial)
798+ +useWorkflow(workflowId, requestContext)
799+ +useWorkflowRun(workflowId, runId, options)
800+ +useWorkflowRuns(workflowId, params, requestContext)
801+ +useWorkflowSchema(workflowId)
802+ +useWorkflowStartMutation(workflowId)
803+ +useWorkflowStartAsyncMutation(workflowId)
804+ +useWorkflowDeleteRunMutation(workflowId)
805+ +useWorkflowResumeMutation(workflowId)
806+ +useWorkflowResumeAsyncMutation(workflowId)
807+ +useWorkflowCancelMutation(workflowId)
808+ +useWorkflowRestartMutation(workflowId)
809+ +useWorkflowRestartAsyncMutation(workflowId)
810+ +useWorkflowTimeTravelMutation(workflowId)
811+ +useWorkflowTimeTravelAsyncMutation(workflowId)
812+
813+ % Memory and threads
814+ +useThreads(params)
815+ +useThread(threadId, agentId, requestContext)
816+ +useThreadMessages(threadId, opts)
817+ +useThreadMessagesPaginated(threadId, opts)
818+ +useWorkingMemory(params)
819+ +useMemorySearch(params)
820+ +useMemoryStatus(agentId, requestContext, opts)
821+ +useMemoryConfig(params)
822+ +useObservationalMemory(params)
823+ +useAwaitBufferStatus(params)
824+ +useCreateThreadMutation()
825+ +useDeleteThreadMutation()
826+ +useUpdateMemoryThreadMutation(threadId, agentId)
827+ +useUpdateWorkingMemoryMutation(agentId, threadId)
828+ +useSaveMessageToMemoryMutation()
829+ +useDeleteThreadMessagesMutation(threadId, agentId)
830+ +useCloneThreadMutation(threadId, agentId)
831+
832+ % Stored agents and versions
833+ +useStoredAgents(params)
834+ +useStoredAgent(id, requestContext, options)
835+ +useStoredAgentVersions(storedAgentId, params, requestContext)
836+ +useStoredAgentVersion(storedAgentId, versionId, requestContext)
837+ +useCompareStoredAgentVersions(storedAgentId, fromId, toId, requestContext)
838+ +useCreateStoredAgentMutation()
839+ +useUpdateStoredAgentMutation(storedAgentId)
840+ +useDeleteStoredAgentMutation(storedAgentId)
841+ +useCreateStoredAgentVersionMutation(storedAgentId)
842+ +useActivateStoredAgentVersionMutation(storedAgentId)
843+ +useRestoreStoredAgentVersionMutation(storedAgentId)
844+ +useDeleteStoredAgentVersionMutation(storedAgentId)
845+
846+ % Stored prompt blocks
847+ +useStoredPromptBlocks(params)
848+ +useStoredPromptBlock(id, requestContext, options)
849+ +useStoredPromptBlockVersions(storedPromptBlockId, params, requestContext)
850+ +useStoredPromptBlockVersion(storedPromptBlockId, versionId, requestContext)
851+ +useCompareStoredPromptBlockVersions(storedPromptBlockId, fromId, toId, requestContext)
852+ +useCreateStoredPromptBlockMutation()
853+ +useUpdateStoredPromptBlockMutation(storedPromptBlockId)
854+ +useDeleteStoredPromptBlockMutation(storedPromptBlockId)
855+ +useCreateStoredPromptBlockVersionMutation(storedPromptBlockId)
856+ +useActivateStoredPromptBlockVersionMutation(storedPromptBlockId)
857+ +useRestoreStoredPromptBlockVersionMutation(storedPromptBlockId)
858+ +useDeleteStoredPromptBlockVersionMutation(storedPromptBlockId)
859+
860+ % Stored scorers
861+ +useStoredScorers(params)
862+ +useStoredScorer(id, requestContext, options)
863+ +useStoredScorerVersions(storedScorerId, params, requestContext)
864+ +useStoredScorerVersion(storedScorerId, versionId, requestContext)
865+ +useCompareStoredScorerVersions(storedScorerId, fromId, toId, requestContext)
866+ +useCreateStoredScorerMutation()
867+ +useUpdateStoredScorerMutation(storedScorerId)
868+ +useDeleteStoredScorerMutation(storedScorerId)
869+ +useCreateStoredScorerVersionMutation(storedScorerId)
870+ +useActivateStoredScorerVersionMutation(storedScorerId)
871+ +useRestoreStoredScorerVersionMutation(storedScorerId)
872+ +useDeleteStoredScorerVersionMutation(storedScorerId)
873+
874+ % Stored MCP clients and skills
875+ +useStoredMcpClients(params)
876+ +useStoredMcpClient(id, requestContext)
877+ +useCreateStoredMcpClientMutation()
878+ +useUpdateStoredMcpClientMutation(storedMcpClientId)
879+ +useDeleteStoredMcpClientMutation(storedMcpClientId)
880+ +useStoredSkills(params)
881+ +useStoredSkill(id, requestContext)
882+ +useCreateStoredSkillMutation()
883+ +useUpdateStoredSkillMutation(storedSkillId)
884+ +useDeleteStoredSkillMutation(storedSkillId)
885+
886+ % Vectors and embedders
887+ +useVectorIndexes()
888+ +useVectorDetails(indexName)
889+ +useVectors()
890+ +useEmbedders()
891+ +useVectorQueryMutation(vectorName, indexName)
892+ +useVectorUpsertMutation(vectorName, indexName)
893+
894+ % Workspaces and skills
895+ +useWorkspaces()
896+ +useWorkspace(id)
897+ +useWorkspaceInfo(id)
898+ +useWorkspaceFiles(id, params)
899+ +useWorkspaceReadFile(id, path)
900+ +useWorkspaceSearch(id, params)
901+ +useWorkspaceSkills(id)
902+ +useWorkspaceSearchSkills(workspaceId, params)
903+ +useWorkspaceSkill(workspaceId, skillName)
904+ +useWorkspaceSkillReferences(workspaceId, skillName)
905+ +useWorkspaceSkillReference(workspaceId, skillName, referencePath)
906+ +useWorkspaceWriteFileMutation(workspaceId)
907+ +useWorkspaceDeleteMutation(workspaceId)
908+ +useWorkspaceMkdirMutation(workspaceId)
909+ +useWorkspaceRenameMutation(workspaceId)
910+
911+ % A2A and Agent Builder
912+ +useA2ASendMessageMutation(agentId)
913+ +useA2ASendStreamingMessageMutation(agentId)
914+ +useA2AGetTask(agentId, params)
915+ +useA2ACancelTaskMutation(agentId)
916+ +useAgentBuilderActions()
917+ +useAgentBuilderAction(actionId)
918+ +useAgentBuilderRuns(actionId, params)
919+ +useAgentBuilderRun(actionId, runId, options)
920+ +useAgentBuilderCreateRunMutation(actionId)
921+ +useAgentBuilderStartAsyncMutation(actionId)
922+ +useAgentBuilderStartRunMutation(actionId)
923+ +useAgentBuilderResumeMutation(actionId)
924+ +useAgentBuilderResumeAsyncMutation(actionId)
925+ +useAgentBuilderCancelRunMutation(actionId)
926+ }
777927
778- style A fill:#1565c0,color:#fff
779- style B fill:#2e7d32,color:#fff
780- style C fill:#ef6c00,color:#fff
781- style D fill:#6a1b9a,color:#fff
782- style E fill:#c62828,color:#fff
928+ class MastraClient {
929+ +listTools(requestContext)
930+ +getTool(toolId)
931+ +listToolProviders()
932+ +getToolProvider(providerId)
933+ +listProcessors(requestContext)
934+ +getProcessor(processorId)
935+ +listStoredAgents(params)
936+ +getStoredAgent(id)
937+ +listStoredPromptBlocks(params)
938+ +getStoredPromptBlock(id)
939+ +listStoredScorers(params)
940+ +getStoredScorer(id)
941+ +listStoredMCPClients(params)
942+ +getStoredMCPClient(id)
943+ +listStoredSkills(params)
944+ +getStoredSkill(id)
945+ +listWorkflows(requestContext, partial)
946+ +getWorkflow(workflowId)
947+ +getWorkingMemory(params)
948+ +searchMemory(params)
949+ +getObservationalMemory(params)
950+ +awaitBufferStatus(params)
951+ +listVectors()
952+ +listEmbedders()
953+ +getWorkspace(id)
954+ +getA2A(agentId)
955+ +getAgentBuilderActions()
956+ +getAgentBuilderAction(actionId)
957+ }
958+
959+ class ReactQueryClient {
960+ +useQuery(options)
961+ +useMutation(options)
962+ +invalidateQueries(options)
963+ }
964+
965+ MastraQueryHooks ..> MastraClient : uses
966+ MastraQueryHooks ..> ReactQueryClient : uses
967+ MastraClient <|.. MastraClientStoredAgent
968+ class MastraClientStoredAgent {
969+ +details(requestContext, options)
970+ +listVersions(params, requestContext)
971+ +getVersion(versionId, requestContext)
972+ +compareVersions(fromId, toId, requestContext)
973+ +update(params)
974+ +delete(requestContext)
975+ +createVersion(params, requestContext)
976+ +activateVersion(versionId, requestContext)
977+ +restoreVersion(versionId, requestContext)
978+ +deleteVersion(versionId, requestContext)
979+ }
980+
981+ MastraClient <|.. MastraClientWorkflow
982+ class MastraClientWorkflow {
983+ +details(requestContext)
984+ +runs(params, requestContext)
985+ +runById(runId, options)
986+ +getSchema()
987+ +createRun(params)
988+ +deleteRunById(runId)
989+ }
990+
991+ MastraClient <|.. MastraClientProcessor
992+ class MastraClientProcessor {
993+ +details(requestContext)
994+ +execute(params)
995+ }
996+
997+ MastraClient <|.. MastraClientAgentBuilderAction
998+ class MastraClientAgentBuilderAction {
999+ +details()
1000+ +runs(params)
1001+ +runById(runId, options)
1002+ +createRun(params)
1003+ +startAsync(params, runId)
1004+ +startActionRun(params, runId)
1005+ +resume(params, runId)
1006+ +resumeAsync(params, runId)
1007+ +cancelRun(runId)
1008+ }
1009+
1010+ MastraQueryHooks ..> MastraClientStoredAgent : stored agent hooks
1011+ MastraQueryHooks ..> MastraClientWorkflow : workflow hooks
1012+ MastraQueryHooks ..> MastraClientProcessor : processor hooks
1013+ MastraQueryHooks ..> MastraClientAgentBuilderAction : agent builder hooks
7831014```
7841015
7851016### 1️⃣ Prerequisites
@@ -853,7 +1084,7 @@ npm run dev
8531084
8541085** Expected startup output:**
8551086
856- ```
1087+ ``` bash
8571088✓ Mastra Dev Server: http://localhost:4111
8581089✓ Next.js Dev Server: http://localhost:3000
8591090✓ 48 agents registered
@@ -1001,10 +1232,10 @@ export function AgentsList() {
10011232
10021233- ` lib/mastra-client.ts ` - MastraClient configuration for frontend
10031234- ` lib/hooks/ ` - TanStack Query hooks for data fetching (15+ hooks)
1004- - ` use-dashboard-queries.ts ` - Agents, workflows, tools, traces, threads, messages, vectors
1005- - ` use-mastra.ts ` - Generic fetch hook with loading/error states
1235+ - ` use-dashboard-queries.ts ` - Agents, workflows, tools, traces, threads, messages, vectors
1236+ - ` use-mastra.ts ` - Generic fetch hook with loading/error states
10061237- ` lib/types/ ` - Zod schemas and TypeScript types
1007- - ` mastra-api.ts ` - Agent, Workflow, Tool, Trace, Message, Vector types
1238+ - ` mastra-api.ts ` - Agent, Workflow, Tool, Trace, Message, Vector types
10081239- ` lib/utils.ts ` - Shared utilities (cn, formatDate, etc.)
10091240- ` lib/a2a.ts ` - Agent-to-agent coordination utilities
10101241- ` lib/auth.ts ` - Authentication utilities
@@ -1535,12 +1766,12 @@ npx vitest --watch
15351766
15361767### **Testing Philosophy**
15371768
1538- ```
1769+ ```bash
15391770┌─────────────────────────────────────────────────────────┐
1540- │ Every Tool → Unit Test + Integration Test + Mock │
1541- │ Every Agent → Evaluation Scorer + Behavior Test │
1542- │ Every Workflow → E2E Test + Step Validation │
1543- │ Every API → Contract Test + Response Validation │
1771+ │ Every Tool → Unit Test + Integration Test + Mock │
1772+ │ Every Agent → Evaluation Scorer + Behavior Test │
1773+ │ Every Workflow → E2E Test + Step Validation │
1774+ │ Every API → Contract Test + Response Validation │
15441775└─────────────────────────────────────────────────────────┘
15451776```
15461777
@@ -1632,16 +1863,16 @@ AgentStack implements enterprise-grade security controls for production deployme
16321863
16331864### **Security Layers**
16341865
1635- ```
1866+ ```bash
16361867┌─────────────────────────────────────────────────────────────┐
1637- │ Security Architecture │
1868+ │ Security Architecture │
16381869├─────────────────────────────────────────────────────────────┤
1639- │ 🔐 Authentication │ JWT tokens + Role-based access │
1640- │ 🛡️ Authorization │ RBAC with policy definitions │
1641- │ 🔍 Input Validation │ Zod schemas for all inputs │
1642- │ 🧹 Output Sanitizing │ HTML/JS sanitization │
1643- │ 🔒 Secrets Handling │ Automatic masking in logs/traces │
1644- │ 📁 File Security │ Path traversal prevention │
1870+ │ 🔐 Authentication │ JWT tokens + Role-based access │
1871+ │ 🛡️ Authorization │ RBAC with policy definitions │
1872+ │ 🔍 Input Validation │ Zod schemas for all inputs │
1873+ │ 🧹 Output Sanitizing │ HTML/JS sanitization │
1874+ │ 🔒 Secrets Handling │ Automatic masking in logs/traces │
1875+ │ 📁 File Security │ Path traversal prevention │
16451876└─────────────────────────────────────────────────────────────┘
16461877```
16471878
@@ -2088,10 +2319,10 @@ We are committed to providing a welcoming and inclusive experience for everyone:
20882319** Shared Libraries:**
20892320
20902321- ** [lib/hooks](lib/hooks/)** : TanStack Query hooks for data fetching (15+ hooks)
2091- - ` use-dashboard-queries.ts` - Agents, workflows, tools, traces, threads, messages, vectors
2092- - ` use-mastra.ts` - Generic fetch hook with loading/error states
2322+ - ` use-dashboard-queries.ts` - Agents, workflows, tools, traces, threads, messages, vectors
2323+ - ` use-mastra.ts` - Generic fetch hook with loading/error states
20932324- ** [lib/types](lib/types/)** : Zod schemas and TypeScript types
2094- - ` mastra-api.ts` - Agent, Workflow, Tool, Trace, Message, Vector types
2325+ - ` mastra-api.ts` - Agent, Workflow, Tool, Trace, Message, Vector types
20952326- ** [lib/](lib/)** : Client SDK, utilities, auth, A2A coordination
20962327
20972328** Core Components:**
0 commit comments