@yourgpt/copilot-sdk 1.2.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.
@@ -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) => {
@@ -3525,5 +3534,5 @@ function useChat(config) {
3525
3534
  }
3526
3535
 
3527
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 };
3528
- //# sourceMappingURL=chunk-HPNLS3PQ.js.map
3529
- //# sourceMappingURL=chunk-HPNLS3PQ.js.map
3537
+ //# sourceMappingURL=chunk-A43DHFKL.js.map
3538
+ //# sourceMappingURL=chunk-A43DHFKL.js.map