Files
deer-flow/frontend/src/core/subagents/context.ts

13 lines
424 B
TypeScript
Raw Normal View History

2026-02-06 15:42:53 +08:00
import { createContext, useContext } from "react";
import type { SubagentState } from "../threads/types";
export const SubagentContext = createContext<Map<string, SubagentState>>(new Map());
export function useSubagentContext() {
const context = useContext(SubagentContext);
if (context === undefined) {
throw new Error("useSubagentContext must be used within a SubagentContext.Provider");
}
return context;
}