@yourgpt/copilot-sdk 1.4.32 → 1.4.34

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.
@@ -1,4 +1,4 @@
1
- import { ThreadManager, isConsoleCaptureActive, startConsoleCapture, isNetworkCaptureActive, startNetworkCapture, stopConsoleCapture, stopNetworkCapture, isScreenshotSupported, captureScreenshot, getConsoleLogs, getNetworkRequests, clearConsoleLogs, clearNetworkRequests, formatLogsForAI, formatRequestsForAI, detectIntent, streamSSE, zodObjectToInputSchema } from './chunk-55EABH45.js';
1
+ import { ThreadManager, isConsoleCaptureActive, startConsoleCapture, isNetworkCaptureActive, startNetworkCapture, stopConsoleCapture, stopNetworkCapture, isScreenshotSupported, captureScreenshot, getConsoleLogs, getNetworkRequests, clearConsoleLogs, clearNetworkRequests, formatLogsForAI, formatRequestsForAI, detectIntent, streamSSE, zodObjectToInputSchema } from './chunk-JM7PB2LP.js';
2
2
  import { createContext, useContext, useCallback, useEffect, useState, useRef, useSyncExternalStore, useMemo } from 'react';
3
3
  import { jsx } from 'react/jsx-runtime';
4
4
  import * as z from 'zod';
@@ -2509,16 +2509,6 @@ function useTools(tools) {
2509
2509
  };
2510
2510
  }, [toolsKey]);
2511
2511
  }
2512
- var CopilotContext2 = createContext(null);
2513
- function useCopilotContext() {
2514
- const context = useContext(CopilotContext2);
2515
- if (!context) {
2516
- throw new Error("useCopilotContext must be used within a CopilotProvider");
2517
- }
2518
- return context;
2519
- }
2520
-
2521
- // src/react/hooks/useToolWithSchema.ts
2522
2512
  function convertZodSchema(schema, _toolName) {
2523
2513
  try {
2524
2514
  const zodWithJsonSchema = z;
@@ -2539,7 +2529,7 @@ function convertZodSchema(schema, _toolName) {
2539
2529
  return zodObjectToInputSchema(schema);
2540
2530
  }
2541
2531
  function useToolWithSchema(config, dependencies = []) {
2542
- const { registerTool, unregisterTool } = useCopilotContext();
2532
+ const { registerTool, unregisterTool } = useCopilot();
2543
2533
  const configRef = useRef(config);
2544
2534
  configRef.current = config;
2545
2535
  const inputSchema = useMemo(() => {
@@ -2575,7 +2565,7 @@ function useToolWithSchema(config, dependencies = []) {
2575
2565
  }, [config.name, inputSchema, ...dependencies]);
2576
2566
  }
2577
2567
  function useToolsWithSchema(tools, dependencies = []) {
2578
- const { registerTool, unregisterTool } = useCopilotContext();
2568
+ const { registerTool, unregisterTool } = useCopilot();
2579
2569
  const toolsRef = useRef(tools);
2580
2570
  toolsRef.current = tools;
2581
2571
  useEffect(() => {
@@ -2617,6 +2607,16 @@ function useToolsWithSchema(tools, dependencies = []) {
2617
2607
  };
2618
2608
  }, [tools.map((t) => t.name).join(","), ...dependencies]);
2619
2609
  }
2610
+ var CopilotContext2 = createContext(null);
2611
+ function useCopilotContext() {
2612
+ const context = useContext(CopilotContext2);
2613
+ if (!context) {
2614
+ throw new Error("useCopilotContext must be used within a CopilotProvider");
2615
+ }
2616
+ return context;
2617
+ }
2618
+
2619
+ // src/react/hooks/useToolExecutor.ts
2620
2620
  function useToolExecutor() {
2621
2621
  const {
2622
2622
  registeredTools,
@@ -2957,7 +2957,7 @@ function formatKnowledgeResultsForAI(results) {
2957
2957
 
2958
2958
  // src/react/hooks/useKnowledgeBase.ts
2959
2959
  function useKnowledgeBase(config) {
2960
- const { registerTool, unregisterTool } = useCopilotContext();
2960
+ const { registerTool, unregisterTool } = useCopilot();
2961
2961
  const configRef = useRef(config);
2962
2962
  configRef.current = config;
2963
2963
  const handleSearch = useCallback(
@@ -3863,5 +3863,5 @@ function useChat(config) {
3863
3863
  }
3864
3864
 
3865
3865
  export { AbstractAgentLoop, AbstractChat, CopilotProvider, ReactChat, ReactChatState, ReactThreadManager, ReactThreadManagerState, createPermissionStorage, createReactChat, createReactChatState, createReactThreadManager, createReactThreadManagerState, createSessionPermissionCache, formatKnowledgeResultsForAI, initialAgentLoopState, searchKnowledgeBase, useAIAction, useAIActions, useAIContext, useAIContexts, useAITools, useAgent, useCapabilities, useChat, useCopilot, useDevLogger, useFeatureSupport, useKnowledgeBase, useSuggestions, useSupportedMediaTypes, useThreadManager, useTool, useToolExecutor, useToolWithSchema, useTools, useToolsWithSchema };
3866
- //# sourceMappingURL=chunk-VZ4RYZQT.js.map
3867
- //# sourceMappingURL=chunk-VZ4RYZQT.js.map
3866
+ //# sourceMappingURL=chunk-CJ7UWN2Y.js.map
3867
+ //# sourceMappingURL=chunk-CJ7UWN2Y.js.map