@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.
@@ -210,33 +210,16 @@ interface CustomKeywords {
210
210
  declare function createCustomDetector(customKeywords: CustomKeywords): (message: string) => IntentDetectionResult;
211
211
 
212
212
  /**
213
- * Supported LLM providers
214
- */
215
- type LLMProvider = "openai" | "anthropic" | "google" | "groq" | "ollama" | "custom";
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 ThreadManagerState as $, type ActionParameter as A, type InternalKnowledgeBaseResult as B, type ConsoleLogOptions as C, type InternalKnowledgeBaseSearchResponse as D, type Extension as E, actionToTool as F, getDefaultModel as G, type HttpMethod as H, type IntentDetectionResult as I, DEFAULT_MODELS as J, type KnowledgeBaseProvider as K, type LLMProvider as L, ThreadManager as M, type NetworkRequestOptions as N, createThreadManager as O, type ParameterType as P, createLocalStorageAdapter as Q, localStorageAdapter as R, type ScreenshotOptions as S, type ToolType as T, createMemoryAdapter as U, noopAdapter as V, SimpleThreadManagerState as W, type ThreadManagerConfig as X, type ThreadManagerCallbacks as Y, type CreateThreadOptions as Z, type UpdateThreadOptions as _, type ScreenshotResult as a, type LoadStatus as a0, type LocalStorageAdapterConfig as a1, 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 LLMConfig as q, type CloudConfig as r, type CopilotConfig as s, type ActionDefinition as t, type ActionRenderProps as u, type KnowledgeBaseConfig as v, type KnowledgeBaseResult as w, type KnowledgeBaseSearchRequest as x, type KnowledgeBaseSearchResponse as y, type InternalKnowledgeBaseConfig as z };
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
- * Supported LLM providers
214
- */
215
- type LLMProvider = "openai" | "anthropic" | "google" | "groq" | "ollama" | "custom";
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 ThreadManagerState as $, type ActionParameter as A, type InternalKnowledgeBaseResult as B, type ConsoleLogOptions as C, type InternalKnowledgeBaseSearchResponse as D, type Extension as E, actionToTool as F, getDefaultModel as G, type HttpMethod as H, type IntentDetectionResult as I, DEFAULT_MODELS as J, type KnowledgeBaseProvider as K, type LLMProvider as L, ThreadManager as M, type NetworkRequestOptions as N, createThreadManager as O, type ParameterType as P, createLocalStorageAdapter as Q, localStorageAdapter as R, type ScreenshotOptions as S, type ToolType as T, createMemoryAdapter as U, noopAdapter as V, SimpleThreadManagerState as W, type ThreadManagerConfig as X, type ThreadManagerCallbacks as Y, type CreateThreadOptions as Z, type UpdateThreadOptions as _, type ScreenshotResult as a, type LoadStatus as a0, type LocalStorageAdapterConfig as a1, 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 LLMConfig as q, type CloudConfig as r, type CopilotConfig as s, type ActionDefinition as t, type ActionRenderProps as u, type KnowledgeBaseConfig as v, type KnowledgeBaseResult as w, type KnowledgeBaseSearchRequest as x, type KnowledgeBaseSearchResponse as y, type InternalKnowledgeBaseConfig as z };
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-QSEGNATZ.js';
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-XAVZZVUL.js.map
3531
- //# sourceMappingURL=chunk-XAVZZVUL.js.map
3537
+ //# sourceMappingURL=chunk-A43DHFKL.js.map
3538
+ //# sourceMappingURL=chunk-A43DHFKL.js.map