@yourgpt/copilot-sdk 2.1.3 → 2.1.4
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/dist/{chunk-VFV5FVVI.js → chunk-37KEHUCE.js} +12 -8
- package/dist/chunk-37KEHUCE.js.map +1 -0
- package/dist/{chunk-DMBFN7KO.js → chunk-7PKGRYHY.js} +16 -5
- package/dist/chunk-7PKGRYHY.js.map +1 -0
- package/dist/{chunk-R6LKHKAI.cjs → chunk-N6VZ7FOW.cjs} +40 -29
- package/dist/chunk-N6VZ7FOW.cjs.map +1 -0
- package/dist/{chunk-WQSK3Z4K.cjs → chunk-OQPRIB73.cjs} +12 -8
- package/dist/chunk-OQPRIB73.cjs.map +1 -0
- package/dist/core/index.cjs +70 -70
- package/dist/core/index.d.cts +16 -5
- package/dist/core/index.d.ts +16 -5
- package/dist/core/index.js +1 -1
- package/dist/react/index.cjs +47 -47
- package/dist/react/index.d.cts +30 -13
- package/dist/react/index.d.ts +30 -13
- package/dist/react/index.js +2 -2
- package/dist/ui/index.cjs +6 -6
- package/dist/ui/index.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-DMBFN7KO.js.map +0 -1
- package/dist/chunk-R6LKHKAI.cjs.map +0 -1
- package/dist/chunk-VFV5FVVI.js.map +0 -1
- package/dist/chunk-WQSK3Z4K.cjs.map +0 -1
|
@@ -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-
|
|
1
|
+
import { ThreadManager, isConsoleCaptureActive, startConsoleCapture, isNetworkCaptureActive, startNetworkCapture, stopConsoleCapture, stopNetworkCapture, isScreenshotSupported, captureScreenshot, getConsoleLogs, getNetworkRequests, clearConsoleLogs, clearNetworkRequests, formatLogsForAI, formatRequestsForAI, detectIntent, zodToJsonSchema, streamSSE, zodObjectToInputSchema } from './chunk-37KEHUCE.js';
|
|
2
2
|
import { createMCPClient, MCPToolAdapter } from './chunk-EWVQWTNV.js';
|
|
3
3
|
import { createContext, useRef, useState, useCallback, useEffect, useMemo, useContext, useSyncExternalStore } from 'react';
|
|
4
4
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
@@ -3159,16 +3159,27 @@ function useAITools(options = {}) {
|
|
|
3159
3159
|
]
|
|
3160
3160
|
);
|
|
3161
3161
|
}
|
|
3162
|
+
function isZodSchema(value) {
|
|
3163
|
+
if (value === null || typeof value !== "object") return false;
|
|
3164
|
+
const obj = value;
|
|
3165
|
+
return "_def" in obj && typeof obj._def === "object" || "_zod" in obj && typeof obj._zod === "object" || "~standard" in obj;
|
|
3166
|
+
}
|
|
3162
3167
|
function useTool(config, dependencies = []) {
|
|
3163
3168
|
const { registerTool, unregisterTool } = useCopilot();
|
|
3164
3169
|
const configRef = useRef(config);
|
|
3165
3170
|
configRef.current = config;
|
|
3171
|
+
const inputSchema = useMemo(() => {
|
|
3172
|
+
if (isZodSchema(config.inputSchema)) {
|
|
3173
|
+
return zodToJsonSchema(config.inputSchema);
|
|
3174
|
+
}
|
|
3175
|
+
return config.inputSchema;
|
|
3176
|
+
}, [config.inputSchema]);
|
|
3166
3177
|
useEffect(() => {
|
|
3167
3178
|
const tool2 = {
|
|
3168
3179
|
name: config.name,
|
|
3169
3180
|
description: config.description,
|
|
3170
3181
|
location: "client",
|
|
3171
|
-
inputSchema
|
|
3182
|
+
inputSchema,
|
|
3172
3183
|
handler: async (params, context) => {
|
|
3173
3184
|
return configRef.current.handler(params, context);
|
|
3174
3185
|
},
|
|
@@ -3182,7 +3193,7 @@ function useTool(config, dependencies = []) {
|
|
|
3182
3193
|
return () => {
|
|
3183
3194
|
unregisterTool(config.name);
|
|
3184
3195
|
};
|
|
3185
|
-
}, [config.name, ...dependencies]);
|
|
3196
|
+
}, [config.name, inputSchema, ...dependencies]);
|
|
3186
3197
|
}
|
|
3187
3198
|
function useTools(tools) {
|
|
3188
3199
|
const { registerTool, unregisterTool } = useCopilot();
|
|
@@ -4658,5 +4669,5 @@ function useChat(config) {
|
|
|
4658
4669
|
}
|
|
4659
4670
|
|
|
4660
4671
|
export { AbstractAgentLoop, AbstractChat, CopilotProvider, ReactChat, ReactChatState, ReactThreadManager, ReactThreadManagerState, createMessageIntentHandler, createPermissionStorage, createReactChat, createReactChatState, createReactThreadManager, createReactThreadManagerState, createSessionPermissionCache, createToolIntentHandler, formatKnowledgeResultsForAI, initialAgentLoopState, searchKnowledgeBase, useAIAction, useAIActions, useAIContext, useAIContexts, useAITools, useAgent, useCapabilities, useChat, useCopilot, useDevLogger, useFeatureSupport, useKnowledgeBase, useMCPClient, useMCPTools, useMCPUIIntents, useSuggestions, useSupportedMediaTypes, useThreadManager, useTool, useToolExecutor, useToolWithSchema, useTools, useToolsWithSchema };
|
|
4661
|
-
//# sourceMappingURL=chunk-
|
|
4662
|
-
//# sourceMappingURL=chunk-
|
|
4672
|
+
//# sourceMappingURL=chunk-7PKGRYHY.js.map
|
|
4673
|
+
//# sourceMappingURL=chunk-7PKGRYHY.js.map
|