Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/openstatusHQ/openstatus. ๐ซ Status page with uptime monitoring & API monitoring as code ๐ซ openstatus.dev
bun drizzle-orm monitoring monitoring-as-code nextjs observability on-call open-source shadcn-ui status-page statuspage synthetic-monitoring tinybird turso uptime uptime-checker uptime-monitor
Something went wrong. Try again.
844 B ยท 35 lines
TSX
123456789101112131415161718192021222324252627282930313233343536"use client";
import { type ReactNode, createContext, useContext } from "react";
type ChatToolContextValue = { /** `approvalId` is the SDK's `approval.id`, NOT `toolCallId`. */ confirmTool: (approvalId: string) => void; cancelTool: (approvalId: string, reason?: string) => void;};
const ChatToolContext = createContext<ChatToolContextValue | null>(null);
export function ChatToolProvider({ value, children,}: { value: ChatToolContextValue; children: ReactNode;}) { return ( <ChatToolContext.Provider value={value}> {children} </ChatToolContext.Provider> );}
export type { ChatToolContextValue };
export function useChatTool(): ChatToolContextValue { const ctx = useContext(ChatToolContext); if (!ctx) { throw new Error("useChatTool must be used within <ChatToolProvider>"); } return ctx;}