@yourgpt/copilot-sdk 1.1.0 → 1.2.1
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/{ThreadManager-BCVt-_k_.d.cts → ThreadManager-CUq5Ocu2.d.cts} +5 -30
- package/dist/{ThreadManager-BjC15mh8.d.ts → ThreadManager-JT0sqSSD.d.ts} +5 -30
- package/dist/{chunk-XAVZZVUL.js → chunk-A43DHFKL.js} +17 -10
- package/dist/chunk-A43DHFKL.js.map +1 -0
- package/dist/{chunk-BN75ZW24.cjs → chunk-C7YQX7ZT.cjs} +41 -34
- package/dist/chunk-C7YQX7ZT.cjs.map +1 -0
- package/dist/{chunk-QSEGNATZ.js → chunk-CVD3X4MN.js} +3 -16
- package/dist/chunk-CVD3X4MN.js.map +1 -0
- package/dist/{chunk-42YQ4ATO.cjs → chunk-MTFU6EHR.cjs} +2 -17
- package/dist/chunk-MTFU6EHR.cjs.map +1 -0
- package/dist/core/index.cjs +76 -84
- package/dist/core/index.d.cts +2 -2
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.js +1 -1
- package/dist/react/index.cjs +42 -42
- package/dist/react/index.d.cts +13 -8
- package/dist/react/index.d.ts +13 -8
- package/dist/react/index.js +2 -2
- package/dist/ui/index.cjs +14 -18
- package/dist/ui/index.cjs.map +1 -1
- package/dist/ui/index.d.cts +0 -2
- package/dist/ui/index.d.ts +0 -2
- package/dist/ui/index.js +10 -14
- package/dist/ui/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-42YQ4ATO.cjs.map +0 -1
- package/dist/chunk-BN75ZW24.cjs.map +0 -1
- package/dist/chunk-QSEGNATZ.js.map +0 -1
- package/dist/chunk-XAVZZVUL.js.map +0 -1
|
@@ -210,33 +210,16 @@ interface CustomKeywords {
|
|
|
210
210
|
declare function createCustomDetector(customKeywords: CustomKeywords): (message: string) => IntentDetectionResult;
|
|
211
211
|
|
|
212
212
|
/**
|
|
213
|
-
*
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
* LLM configuration
|
|
213
|
+
* LLM configuration (optional overrides sent to server)
|
|
214
|
+
*
|
|
215
|
+
* Note: The server uses its own configured model.
|
|
216
|
+
* These are optional hints that the server may use.
|
|
218
217
|
*/
|
|
219
218
|
interface LLMConfig {
|
|
220
|
-
/** LLM provider */
|
|
221
|
-
provider: LLMProvider;
|
|
222
|
-
/** Model name (e.g., 'gpt-4o', 'claude-3-5-sonnet-latest') */
|
|
223
|
-
model?: string;
|
|
224
|
-
/** API key for the provider */
|
|
225
|
-
apiKey?: string;
|
|
226
|
-
/** Base URL for custom/self-hosted models */
|
|
227
|
-
baseUrl?: string;
|
|
228
219
|
/** Temperature (0-2) */
|
|
229
220
|
temperature?: number;
|
|
230
221
|
/** Maximum tokens in response */
|
|
231
222
|
maxTokens?: number;
|
|
232
|
-
/** Top P sampling */
|
|
233
|
-
topP?: number;
|
|
234
|
-
/** Frequency penalty */
|
|
235
|
-
frequencyPenalty?: number;
|
|
236
|
-
/** Presence penalty */
|
|
237
|
-
presencePenalty?: number;
|
|
238
|
-
/** Enable streaming responses (default: true) */
|
|
239
|
-
streaming?: boolean;
|
|
240
223
|
}
|
|
241
224
|
/**
|
|
242
225
|
* Cloud configuration (for managed hosting)
|
|
@@ -277,14 +260,6 @@ interface CopilotConfig {
|
|
|
277
260
|
/** Enable debug logging */
|
|
278
261
|
debug?: boolean;
|
|
279
262
|
}
|
|
280
|
-
/**
|
|
281
|
-
* Default LLM configurations per provider
|
|
282
|
-
*/
|
|
283
|
-
declare const DEFAULT_MODELS: Record<LLMProvider, string>;
|
|
284
|
-
/**
|
|
285
|
-
* Get default model for a provider
|
|
286
|
-
*/
|
|
287
|
-
declare function getDefaultModel(provider: LLMProvider): string;
|
|
288
263
|
|
|
289
264
|
/**
|
|
290
265
|
* Parameter types for actions
|
|
@@ -860,4 +835,4 @@ declare class ThreadManager {
|
|
|
860
835
|
*/
|
|
861
836
|
declare function createThreadManager(config?: ThreadManagerConfig, callbacks?: ThreadManagerCallbacks): ThreadManager;
|
|
862
837
|
|
|
863
|
-
export { type
|
|
838
|
+
export { type ActionParameter as A, type InternalKnowledgeBaseSearchResponse as B, type ConsoleLogOptions as C, actionToTool as D, type Extension as E, ThreadManager as F, createThreadManager as G, type HttpMethod as H, type IntentDetectionResult as I, createLocalStorageAdapter as J, type KnowledgeBaseProvider as K, type LLMConfig as L, localStorageAdapter as M, type NetworkRequestOptions as N, createMemoryAdapter as O, type ParameterType as P, noopAdapter as Q, SimpleThreadManagerState as R, type ScreenshotOptions as S, type ToolType as T, type ThreadManagerConfig as U, type ThreadManagerCallbacks as V, type CreateThreadOptions as W, type UpdateThreadOptions as X, type ThreadManagerState as Y, type LoadStatus as Z, type LocalStorageAdapterConfig as _, type ScreenshotResult as a, type ConsoleLogResult as b, type ConsoleLogEntry as c, type NetworkRequestResult as d, type NetworkRequestEntry as e, detectIntent as f, getPrimaryTool as g, hasToolSuggestions as h, generateSuggestionReason as i, createCustomDetector as j, type ConsoleLogType as k, type ToolsConfig as l, type ToolConsentRequest as m, type ToolConsentResponse as n, type CapturedContext as o, type CustomKeywords as p, type CloudConfig as q, type CopilotConfig as r, type ActionDefinition as s, type ActionRenderProps as t, type KnowledgeBaseConfig as u, type KnowledgeBaseResult as v, type KnowledgeBaseSearchRequest as w, type KnowledgeBaseSearchResponse as x, type InternalKnowledgeBaseConfig as y, type InternalKnowledgeBaseResult as z };
|
|
@@ -210,33 +210,16 @@ interface CustomKeywords {
|
|
|
210
210
|
declare function createCustomDetector(customKeywords: CustomKeywords): (message: string) => IntentDetectionResult;
|
|
211
211
|
|
|
212
212
|
/**
|
|
213
|
-
*
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
* LLM configuration
|
|
213
|
+
* LLM configuration (optional overrides sent to server)
|
|
214
|
+
*
|
|
215
|
+
* Note: The server uses its own configured model.
|
|
216
|
+
* These are optional hints that the server may use.
|
|
218
217
|
*/
|
|
219
218
|
interface LLMConfig {
|
|
220
|
-
/** LLM provider */
|
|
221
|
-
provider: LLMProvider;
|
|
222
|
-
/** Model name (e.g., 'gpt-4o', 'claude-3-5-sonnet-latest') */
|
|
223
|
-
model?: string;
|
|
224
|
-
/** API key for the provider */
|
|
225
|
-
apiKey?: string;
|
|
226
|
-
/** Base URL for custom/self-hosted models */
|
|
227
|
-
baseUrl?: string;
|
|
228
219
|
/** Temperature (0-2) */
|
|
229
220
|
temperature?: number;
|
|
230
221
|
/** Maximum tokens in response */
|
|
231
222
|
maxTokens?: number;
|
|
232
|
-
/** Top P sampling */
|
|
233
|
-
topP?: number;
|
|
234
|
-
/** Frequency penalty */
|
|
235
|
-
frequencyPenalty?: number;
|
|
236
|
-
/** Presence penalty */
|
|
237
|
-
presencePenalty?: number;
|
|
238
|
-
/** Enable streaming responses (default: true) */
|
|
239
|
-
streaming?: boolean;
|
|
240
223
|
}
|
|
241
224
|
/**
|
|
242
225
|
* Cloud configuration (for managed hosting)
|
|
@@ -277,14 +260,6 @@ interface CopilotConfig {
|
|
|
277
260
|
/** Enable debug logging */
|
|
278
261
|
debug?: boolean;
|
|
279
262
|
}
|
|
280
|
-
/**
|
|
281
|
-
* Default LLM configurations per provider
|
|
282
|
-
*/
|
|
283
|
-
declare const DEFAULT_MODELS: Record<LLMProvider, string>;
|
|
284
|
-
/**
|
|
285
|
-
* Get default model for a provider
|
|
286
|
-
*/
|
|
287
|
-
declare function getDefaultModel(provider: LLMProvider): string;
|
|
288
263
|
|
|
289
264
|
/**
|
|
290
265
|
* Parameter types for actions
|
|
@@ -860,4 +835,4 @@ declare class ThreadManager {
|
|
|
860
835
|
*/
|
|
861
836
|
declare function createThreadManager(config?: ThreadManagerConfig, callbacks?: ThreadManagerCallbacks): ThreadManager;
|
|
862
837
|
|
|
863
|
-
export { type
|
|
838
|
+
export { type ActionParameter as A, type InternalKnowledgeBaseSearchResponse as B, type ConsoleLogOptions as C, actionToTool as D, type Extension as E, ThreadManager as F, createThreadManager as G, type HttpMethod as H, type IntentDetectionResult as I, createLocalStorageAdapter as J, type KnowledgeBaseProvider as K, type LLMConfig as L, localStorageAdapter as M, type NetworkRequestOptions as N, createMemoryAdapter as O, type ParameterType as P, noopAdapter as Q, SimpleThreadManagerState as R, type ScreenshotOptions as S, type ToolType as T, type ThreadManagerConfig as U, type ThreadManagerCallbacks as V, type CreateThreadOptions as W, type UpdateThreadOptions as X, type ThreadManagerState as Y, type LoadStatus as Z, type LocalStorageAdapterConfig as _, type ScreenshotResult as a, type ConsoleLogResult as b, type ConsoleLogEntry as c, type NetworkRequestResult as d, type NetworkRequestEntry as e, detectIntent as f, getPrimaryTool as g, hasToolSuggestions as h, generateSuggestionReason as i, createCustomDetector as j, type ConsoleLogType as k, type ToolsConfig as l, type ToolConsentRequest as m, type ToolConsentResponse as n, type CapturedContext as o, type CustomKeywords as p, type CloudConfig as q, type CopilotConfig as r, type ActionDefinition as s, type ActionRenderProps as t, type KnowledgeBaseConfig as u, type KnowledgeBaseResult as v, type KnowledgeBaseSearchRequest as w, type KnowledgeBaseSearchResponse as x, type InternalKnowledgeBaseConfig as y, type InternalKnowledgeBaseResult as z };
|
|
@@ -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, streamSSE, zodObjectToInputSchema } from './chunk-CVD3X4MN.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';
|
|
@@ -1199,6 +1199,16 @@ var ChatWithTools = class {
|
|
|
1199
1199
|
result: r.success ? r.result : { success: false, error: r.error }
|
|
1200
1200
|
}));
|
|
1201
1201
|
await this.chat.continueWithToolResults(toolResults);
|
|
1202
|
+
} else if (this.agentLoop.maxIterationsReached && toolCallInfos.length > 0) {
|
|
1203
|
+
this.debug("Max iterations reached, adding blocked tool results");
|
|
1204
|
+
const blockedResults = toolCallInfos.map((tc) => ({
|
|
1205
|
+
toolCallId: tc.id,
|
|
1206
|
+
result: {
|
|
1207
|
+
success: false,
|
|
1208
|
+
error: "Tool execution blocked: maximum iterations reached"
|
|
1209
|
+
}
|
|
1210
|
+
}));
|
|
1211
|
+
await this.chat.continueWithToolResults(blockedResults);
|
|
1202
1212
|
}
|
|
1203
1213
|
} catch (error) {
|
|
1204
1214
|
this.debug("Error executing tools:", error);
|
|
@@ -1566,8 +1576,6 @@ function useCopilot() {
|
|
|
1566
1576
|
function CopilotProvider({
|
|
1567
1577
|
children,
|
|
1568
1578
|
runtimeUrl,
|
|
1569
|
-
config,
|
|
1570
|
-
cloud,
|
|
1571
1579
|
systemPrompt,
|
|
1572
1580
|
tools: toolsConfig,
|
|
1573
1581
|
threadId,
|
|
@@ -1575,7 +1583,8 @@ function CopilotProvider({
|
|
|
1575
1583
|
onMessagesChange,
|
|
1576
1584
|
onError,
|
|
1577
1585
|
streaming,
|
|
1578
|
-
debug = false
|
|
1586
|
+
debug = false,
|
|
1587
|
+
maxIterations
|
|
1579
1588
|
}) {
|
|
1580
1589
|
const debugLog = useCallback(
|
|
1581
1590
|
(...args) => {
|
|
@@ -1607,12 +1616,12 @@ function CopilotProvider({
|
|
|
1607
1616
|
chatRef.current = new ReactChatWithTools(
|
|
1608
1617
|
{
|
|
1609
1618
|
runtimeUrl,
|
|
1610
|
-
llm: config,
|
|
1611
1619
|
systemPrompt,
|
|
1612
1620
|
threadId,
|
|
1613
1621
|
initialMessages: uiInitialMessages,
|
|
1614
1622
|
streaming,
|
|
1615
|
-
debug
|
|
1623
|
+
debug,
|
|
1624
|
+
maxIterations
|
|
1616
1625
|
},
|
|
1617
1626
|
{
|
|
1618
1627
|
onToolExecutionsChange: (executions) => {
|
|
@@ -2839,8 +2848,6 @@ function useDevLogger() {
|
|
|
2839
2848
|
loaded: ctx.permissionsLoaded || false
|
|
2840
2849
|
},
|
|
2841
2850
|
config: {
|
|
2842
|
-
provider: ctx.config?.config?.provider || (ctx.config?.cloud ? "yourgpt-cloud" : "unknown"),
|
|
2843
|
-
model: ctx.config?.config?.model || "default",
|
|
2844
2851
|
runtimeUrl: ctx.config?.runtimeUrl || ctx.config?.cloud?.endpoint || ""
|
|
2845
2852
|
}
|
|
2846
2853
|
};
|
|
@@ -3527,5 +3534,5 @@ function useChat(config) {
|
|
|
3527
3534
|
}
|
|
3528
3535
|
|
|
3529
3536
|
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 };
|
|
3530
|
-
//# sourceMappingURL=chunk-
|
|
3531
|
-
//# sourceMappingURL=chunk-
|
|
3537
|
+
//# sourceMappingURL=chunk-A43DHFKL.js.map
|
|
3538
|
+
//# sourceMappingURL=chunk-A43DHFKL.js.map
|