@yourgpt/copilot-sdk 2.1.0 → 2.1.2

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.
Files changed (75) hide show
  1. package/dist/{chunk-33JSFVGH.cjs → chunk-7MZLBGFQ.cjs} +23 -23
  2. package/dist/{chunk-33JSFVGH.cjs.map → chunk-7MZLBGFQ.cjs.map} +1 -1
  3. package/dist/{chunk-BRUDSHCV.js → chunk-BMYNG3WM.js} +2 -2
  4. package/dist/{chunk-BRUDSHCV.js.map → chunk-BMYNG3WM.js.map} +1 -1
  5. package/dist/{chunk-MUZ2RYS2.cjs → chunk-BNBEKK3U.cjs} +226 -33
  6. package/dist/chunk-BNBEKK3U.cjs.map +1 -0
  7. package/dist/{chunk-HNRFRNMY.cjs → chunk-CSEZZ5DX.cjs} +2 -2
  8. package/dist/{chunk-HNRFRNMY.cjs.map → chunk-CSEZZ5DX.cjs.map} +1 -1
  9. package/dist/{chunk-O33I4HBL.cjs → chunk-GSTTJ46F.cjs} +5 -5
  10. package/dist/{chunk-O33I4HBL.cjs.map → chunk-GSTTJ46F.cjs.map} +1 -1
  11. package/dist/{chunk-7YZVSG62.js → chunk-VUHP6TAN.js} +3 -3
  12. package/dist/{chunk-7YZVSG62.js.map → chunk-VUHP6TAN.js.map} +1 -1
  13. package/dist/{chunk-3SP6V22Y.js → chunk-VXT2O6R6.js} +202 -9
  14. package/dist/chunk-VXT2O6R6.js.map +1 -0
  15. package/dist/{chunk-7PJ4GAJR.js → chunk-XAC7NTIO.js} +4 -4
  16. package/dist/{chunk-7PJ4GAJR.js.map → chunk-XAC7NTIO.js.map} +1 -1
  17. package/dist/core/index.cjs +80 -80
  18. package/dist/core/index.d.cts +3 -3
  19. package/dist/core/index.d.ts +3 -3
  20. package/dist/core/index.js +3 -3
  21. package/dist/{index-25qIYJ21.d.ts → index-Du3Akr_E.d.ts} +1 -1
  22. package/dist/{index-C261xY-B.d.cts → index-jwRcC2QD.d.cts} +1 -1
  23. package/dist/mcp/index.d.cts +3 -3
  24. package/dist/mcp/index.d.ts +3 -3
  25. package/dist/react/index.cjs +49 -49
  26. package/dist/react/index.d.cts +130 -15
  27. package/dist/react/index.d.ts +130 -15
  28. package/dist/react/index.js +4 -4
  29. package/dist/tools/anthropic/index.d.cts +1 -1
  30. package/dist/tools/anthropic/index.d.ts +1 -1
  31. package/dist/tools/brave/index.cjs +2 -2
  32. package/dist/tools/brave/index.d.cts +1 -1
  33. package/dist/tools/brave/index.d.ts +1 -1
  34. package/dist/tools/brave/index.js +1 -1
  35. package/dist/tools/exa/index.cjs +2 -2
  36. package/dist/tools/exa/index.d.cts +1 -1
  37. package/dist/tools/exa/index.d.ts +1 -1
  38. package/dist/tools/exa/index.js +1 -1
  39. package/dist/tools/google/index.cjs +2 -2
  40. package/dist/tools/google/index.d.cts +1 -1
  41. package/dist/tools/google/index.d.ts +1 -1
  42. package/dist/tools/google/index.js +1 -1
  43. package/dist/tools/openai/index.cjs +2 -2
  44. package/dist/tools/openai/index.d.cts +1 -1
  45. package/dist/tools/openai/index.d.ts +1 -1
  46. package/dist/tools/openai/index.js +1 -1
  47. package/dist/tools/searxng/index.cjs +2 -2
  48. package/dist/tools/searxng/index.d.cts +1 -1
  49. package/dist/tools/searxng/index.d.ts +1 -1
  50. package/dist/tools/searxng/index.js +1 -1
  51. package/dist/tools/serper/index.cjs +2 -2
  52. package/dist/tools/serper/index.d.cts +1 -1
  53. package/dist/tools/serper/index.d.ts +1 -1
  54. package/dist/tools/serper/index.js +1 -1
  55. package/dist/tools/tavily/index.cjs +2 -2
  56. package/dist/tools/tavily/index.d.cts +1 -1
  57. package/dist/tools/tavily/index.d.ts +1 -1
  58. package/dist/tools/tavily/index.js +1 -1
  59. package/dist/tools/web-search/index.cjs +3 -3
  60. package/dist/tools/web-search/index.d.cts +2 -2
  61. package/dist/tools/web-search/index.d.ts +2 -2
  62. package/dist/tools/web-search/index.js +2 -2
  63. package/dist/{tools-Clyufshc.d.cts → tools-BHQRB_YT.d.cts} +5 -0
  64. package/dist/{tools-Clyufshc.d.ts → tools-BHQRB_YT.d.ts} +5 -0
  65. package/dist/{types-DM6M_pv_.d.cts → types-8_Hp2rmm.d.cts} +1 -1
  66. package/dist/{types-wudOhedT.d.ts → types-OYi-iUVY.d.ts} +1 -1
  67. package/dist/ui/index.cjs +39 -18
  68. package/dist/ui/index.cjs.map +1 -1
  69. package/dist/ui/index.d.cts +6 -1
  70. package/dist/ui/index.d.ts +6 -1
  71. package/dist/ui/index.js +35 -14
  72. package/dist/ui/index.js.map +1 -1
  73. package/package.json +1 -1
  74. package/dist/chunk-3SP6V22Y.js.map +0 -1
  75. package/dist/chunk-MUZ2RYS2.cjs.map +0 -1
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
- var chunkMUZ2RYS2_cjs = require('../chunk-MUZ2RYS2.cjs');
4
- var chunk33JSFVGH_cjs = require('../chunk-33JSFVGH.cjs');
3
+ var chunkBNBEKK3U_cjs = require('../chunk-BNBEKK3U.cjs');
4
+ var chunk7MZLBGFQ_cjs = require('../chunk-7MZLBGFQ.cjs');
5
5
  require('../chunk-JGPDQDY4.cjs');
6
- require('../chunk-O33I4HBL.cjs');
7
- require('../chunk-HNRFRNMY.cjs');
6
+ require('../chunk-GSTTJ46F.cjs');
7
+ require('../chunk-CSEZZ5DX.cjs');
8
8
  require('../chunk-ASV6JLYG.cjs');
9
9
  require('../chunk-CBAHCI4R.cjs');
10
10
  require('../chunk-MEBXW75C.cjs');
@@ -20,183 +20,183 @@ require('../chunk-JEQ2X3Z6.cjs');
20
20
 
21
21
  Object.defineProperty(exports, "AbstractAgentLoop", {
22
22
  enumerable: true,
23
- get: function () { return chunkMUZ2RYS2_cjs.AbstractAgentLoop; }
23
+ get: function () { return chunkBNBEKK3U_cjs.AbstractAgentLoop; }
24
24
  });
25
25
  Object.defineProperty(exports, "AbstractChat", {
26
26
  enumerable: true,
27
- get: function () { return chunkMUZ2RYS2_cjs.AbstractChat; }
27
+ get: function () { return chunkBNBEKK3U_cjs.AbstractChat; }
28
28
  });
29
29
  Object.defineProperty(exports, "CopilotProvider", {
30
30
  enumerable: true,
31
- get: function () { return chunkMUZ2RYS2_cjs.CopilotProvider; }
31
+ get: function () { return chunkBNBEKK3U_cjs.CopilotProvider; }
32
32
  });
33
33
  Object.defineProperty(exports, "ReactChat", {
34
34
  enumerable: true,
35
- get: function () { return chunkMUZ2RYS2_cjs.ReactChat; }
35
+ get: function () { return chunkBNBEKK3U_cjs.ReactChat; }
36
36
  });
37
37
  Object.defineProperty(exports, "ReactChatState", {
38
38
  enumerable: true,
39
- get: function () { return chunkMUZ2RYS2_cjs.ReactChatState; }
39
+ get: function () { return chunkBNBEKK3U_cjs.ReactChatState; }
40
40
  });
41
41
  Object.defineProperty(exports, "ReactThreadManager", {
42
42
  enumerable: true,
43
- get: function () { return chunkMUZ2RYS2_cjs.ReactThreadManager; }
43
+ get: function () { return chunkBNBEKK3U_cjs.ReactThreadManager; }
44
44
  });
45
45
  Object.defineProperty(exports, "ReactThreadManagerState", {
46
46
  enumerable: true,
47
- get: function () { return chunkMUZ2RYS2_cjs.ReactThreadManagerState; }
47
+ get: function () { return chunkBNBEKK3U_cjs.ReactThreadManagerState; }
48
48
  });
49
49
  Object.defineProperty(exports, "createMessageIntentHandler", {
50
50
  enumerable: true,
51
- get: function () { return chunkMUZ2RYS2_cjs.createMessageIntentHandler; }
51
+ get: function () { return chunkBNBEKK3U_cjs.createMessageIntentHandler; }
52
52
  });
53
53
  Object.defineProperty(exports, "createPermissionStorage", {
54
54
  enumerable: true,
55
- get: function () { return chunkMUZ2RYS2_cjs.createPermissionStorage; }
55
+ get: function () { return chunkBNBEKK3U_cjs.createPermissionStorage; }
56
56
  });
57
57
  Object.defineProperty(exports, "createReactChat", {
58
58
  enumerable: true,
59
- get: function () { return chunkMUZ2RYS2_cjs.createReactChat; }
59
+ get: function () { return chunkBNBEKK3U_cjs.createReactChat; }
60
60
  });
61
61
  Object.defineProperty(exports, "createReactChatState", {
62
62
  enumerable: true,
63
- get: function () { return chunkMUZ2RYS2_cjs.createReactChatState; }
63
+ get: function () { return chunkBNBEKK3U_cjs.createReactChatState; }
64
64
  });
65
65
  Object.defineProperty(exports, "createReactThreadManager", {
66
66
  enumerable: true,
67
- get: function () { return chunkMUZ2RYS2_cjs.createReactThreadManager; }
67
+ get: function () { return chunkBNBEKK3U_cjs.createReactThreadManager; }
68
68
  });
69
69
  Object.defineProperty(exports, "createReactThreadManagerState", {
70
70
  enumerable: true,
71
- get: function () { return chunkMUZ2RYS2_cjs.createReactThreadManagerState; }
71
+ get: function () { return chunkBNBEKK3U_cjs.createReactThreadManagerState; }
72
72
  });
73
73
  Object.defineProperty(exports, "createSessionPermissionCache", {
74
74
  enumerable: true,
75
- get: function () { return chunkMUZ2RYS2_cjs.createSessionPermissionCache; }
75
+ get: function () { return chunkBNBEKK3U_cjs.createSessionPermissionCache; }
76
76
  });
77
77
  Object.defineProperty(exports, "createToolIntentHandler", {
78
78
  enumerable: true,
79
- get: function () { return chunkMUZ2RYS2_cjs.createToolIntentHandler; }
79
+ get: function () { return chunkBNBEKK3U_cjs.createToolIntentHandler; }
80
80
  });
81
81
  Object.defineProperty(exports, "formatKnowledgeResultsForAI", {
82
82
  enumerable: true,
83
- get: function () { return chunkMUZ2RYS2_cjs.formatKnowledgeResultsForAI; }
83
+ get: function () { return chunkBNBEKK3U_cjs.formatKnowledgeResultsForAI; }
84
84
  });
85
85
  Object.defineProperty(exports, "initialAgentLoopState", {
86
86
  enumerable: true,
87
- get: function () { return chunkMUZ2RYS2_cjs.initialAgentLoopState; }
87
+ get: function () { return chunkBNBEKK3U_cjs.initialAgentLoopState; }
88
88
  });
89
89
  Object.defineProperty(exports, "searchKnowledgeBase", {
90
90
  enumerable: true,
91
- get: function () { return chunkMUZ2RYS2_cjs.searchKnowledgeBase; }
91
+ get: function () { return chunkBNBEKK3U_cjs.searchKnowledgeBase; }
92
92
  });
93
93
  Object.defineProperty(exports, "useAIAction", {
94
94
  enumerable: true,
95
- get: function () { return chunkMUZ2RYS2_cjs.useAIAction; }
95
+ get: function () { return chunkBNBEKK3U_cjs.useAIAction; }
96
96
  });
97
97
  Object.defineProperty(exports, "useAIActions", {
98
98
  enumerable: true,
99
- get: function () { return chunkMUZ2RYS2_cjs.useAIActions; }
99
+ get: function () { return chunkBNBEKK3U_cjs.useAIActions; }
100
100
  });
101
101
  Object.defineProperty(exports, "useAIContext", {
102
102
  enumerable: true,
103
- get: function () { return chunkMUZ2RYS2_cjs.useAIContext; }
103
+ get: function () { return chunkBNBEKK3U_cjs.useAIContext; }
104
104
  });
105
105
  Object.defineProperty(exports, "useAIContexts", {
106
106
  enumerable: true,
107
- get: function () { return chunkMUZ2RYS2_cjs.useAIContexts; }
107
+ get: function () { return chunkBNBEKK3U_cjs.useAIContexts; }
108
108
  });
109
109
  Object.defineProperty(exports, "useAITools", {
110
110
  enumerable: true,
111
- get: function () { return chunkMUZ2RYS2_cjs.useAITools; }
111
+ get: function () { return chunkBNBEKK3U_cjs.useAITools; }
112
112
  });
113
113
  Object.defineProperty(exports, "useAgent", {
114
114
  enumerable: true,
115
- get: function () { return chunkMUZ2RYS2_cjs.useAgent; }
115
+ get: function () { return chunkBNBEKK3U_cjs.useAgent; }
116
116
  });
117
117
  Object.defineProperty(exports, "useCapabilities", {
118
118
  enumerable: true,
119
- get: function () { return chunkMUZ2RYS2_cjs.useCapabilities; }
119
+ get: function () { return chunkBNBEKK3U_cjs.useCapabilities; }
120
120
  });
121
121
  Object.defineProperty(exports, "useChat", {
122
122
  enumerable: true,
123
- get: function () { return chunkMUZ2RYS2_cjs.useChat; }
123
+ get: function () { return chunkBNBEKK3U_cjs.useChat; }
124
124
  });
125
125
  Object.defineProperty(exports, "useCopilot", {
126
126
  enumerable: true,
127
- get: function () { return chunkMUZ2RYS2_cjs.useCopilot; }
127
+ get: function () { return chunkBNBEKK3U_cjs.useCopilot; }
128
128
  });
129
129
  Object.defineProperty(exports, "useDevLogger", {
130
130
  enumerable: true,
131
- get: function () { return chunkMUZ2RYS2_cjs.useDevLogger; }
131
+ get: function () { return chunkBNBEKK3U_cjs.useDevLogger; }
132
132
  });
133
133
  Object.defineProperty(exports, "useFeatureSupport", {
134
134
  enumerable: true,
135
- get: function () { return chunkMUZ2RYS2_cjs.useFeatureSupport; }
135
+ get: function () { return chunkBNBEKK3U_cjs.useFeatureSupport; }
136
136
  });
137
137
  Object.defineProperty(exports, "useKnowledgeBase", {
138
138
  enumerable: true,
139
- get: function () { return chunkMUZ2RYS2_cjs.useKnowledgeBase; }
139
+ get: function () { return chunkBNBEKK3U_cjs.useKnowledgeBase; }
140
140
  });
141
141
  Object.defineProperty(exports, "useMCPClient", {
142
142
  enumerable: true,
143
- get: function () { return chunkMUZ2RYS2_cjs.useMCPClient; }
143
+ get: function () { return chunkBNBEKK3U_cjs.useMCPClient; }
144
144
  });
145
145
  Object.defineProperty(exports, "useMCPTools", {
146
146
  enumerable: true,
147
- get: function () { return chunkMUZ2RYS2_cjs.useMCPTools; }
147
+ get: function () { return chunkBNBEKK3U_cjs.useMCPTools; }
148
148
  });
149
149
  Object.defineProperty(exports, "useMCPUIIntents", {
150
150
  enumerable: true,
151
- get: function () { return chunkMUZ2RYS2_cjs.useMCPUIIntents; }
151
+ get: function () { return chunkBNBEKK3U_cjs.useMCPUIIntents; }
152
152
  });
153
153
  Object.defineProperty(exports, "useSuggestions", {
154
154
  enumerable: true,
155
- get: function () { return chunkMUZ2RYS2_cjs.useSuggestions; }
155
+ get: function () { return chunkBNBEKK3U_cjs.useSuggestions; }
156
156
  });
157
157
  Object.defineProperty(exports, "useSupportedMediaTypes", {
158
158
  enumerable: true,
159
- get: function () { return chunkMUZ2RYS2_cjs.useSupportedMediaTypes; }
159
+ get: function () { return chunkBNBEKK3U_cjs.useSupportedMediaTypes; }
160
160
  });
161
161
  Object.defineProperty(exports, "useThreadManager", {
162
162
  enumerable: true,
163
- get: function () { return chunkMUZ2RYS2_cjs.useThreadManager; }
163
+ get: function () { return chunkBNBEKK3U_cjs.useThreadManager; }
164
164
  });
165
165
  Object.defineProperty(exports, "useTool", {
166
166
  enumerable: true,
167
- get: function () { return chunkMUZ2RYS2_cjs.useTool; }
167
+ get: function () { return chunkBNBEKK3U_cjs.useTool; }
168
168
  });
169
169
  Object.defineProperty(exports, "useToolExecutor", {
170
170
  enumerable: true,
171
- get: function () { return chunkMUZ2RYS2_cjs.useToolExecutor; }
171
+ get: function () { return chunkBNBEKK3U_cjs.useToolExecutor; }
172
172
  });
173
173
  Object.defineProperty(exports, "useToolWithSchema", {
174
174
  enumerable: true,
175
- get: function () { return chunkMUZ2RYS2_cjs.useToolWithSchema; }
175
+ get: function () { return chunkBNBEKK3U_cjs.useToolWithSchema; }
176
176
  });
177
177
  Object.defineProperty(exports, "useTools", {
178
178
  enumerable: true,
179
- get: function () { return chunkMUZ2RYS2_cjs.useTools; }
179
+ get: function () { return chunkBNBEKK3U_cjs.useTools; }
180
180
  });
181
181
  Object.defineProperty(exports, "useToolsWithSchema", {
182
182
  enumerable: true,
183
- get: function () { return chunkMUZ2RYS2_cjs.useToolsWithSchema; }
183
+ get: function () { return chunkBNBEKK3U_cjs.useToolsWithSchema; }
184
184
  });
185
185
  Object.defineProperty(exports, "createLocalStorageAdapter", {
186
186
  enumerable: true,
187
- get: function () { return chunk33JSFVGH_cjs.createLocalStorageAdapter; }
187
+ get: function () { return chunk7MZLBGFQ_cjs.createLocalStorageAdapter; }
188
188
  });
189
189
  Object.defineProperty(exports, "createMemoryAdapter", {
190
190
  enumerable: true,
191
- get: function () { return chunk33JSFVGH_cjs.createMemoryAdapter; }
191
+ get: function () { return chunk7MZLBGFQ_cjs.createMemoryAdapter; }
192
192
  });
193
193
  Object.defineProperty(exports, "createServerAdapter", {
194
194
  enumerable: true,
195
- get: function () { return chunk33JSFVGH_cjs.createServerAdapter; }
195
+ get: function () { return chunk7MZLBGFQ_cjs.createServerAdapter; }
196
196
  });
197
197
  Object.defineProperty(exports, "generateSuggestionReason", {
198
198
  enumerable: true,
199
- get: function () { return chunk33JSFVGH_cjs.generateSuggestionReason; }
199
+ get: function () { return chunk7MZLBGFQ_cjs.generateSuggestionReason; }
200
200
  });
201
201
  //# sourceMappingURL=index.cjs.map
202
202
  //# sourceMappingURL=index.cjs.map
@@ -2,14 +2,44 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import React__default from 'react';
3
3
  import { L as LLMConfig, l as ToolsConfig, s as ActionDefinition, o as CapturedContext, m as ToolConsentRequest, T as ToolType, n as ToolConsentResponse, S as ScreenshotOptions, C as ConsoleLogOptions, N as NetworkRequestOptions, I as IntentDetectionResult, y as InternalKnowledgeBaseConfig, B as InternalKnowledgeBaseSearchResponse, z as InternalKnowledgeBaseResult, Y as ThreadManagerState, Z as LoadStatus, U as ThreadManagerConfig, F as ThreadManager, V as ThreadManagerCallbacks, W as CreateThreadOptions, X as UpdateThreadOptions } from '../ThreadManager-LfFRhr4e.cjs';
4
4
  export { A as ActionParameter, q as CloudConfig, r as CopilotConfig, _ as LocalStorageAdapterConfig, J as createLocalStorageAdapter, O as createMemoryAdapter, i as generateSuggestionReason } from '../ThreadManager-LfFRhr4e.cjs';
5
- import { T as ToolDefinition, f as ToolSource, P as PermissionLevel, c as ToolInputSchema, l as ToolExecution$1, e as ToolContext, b as ToolResponse$1, g as ToolRenderProps, i as ToolSet, U as UnifiedToolCall, r as PermissionStorageConfig, s as PermissionStorageAdapter } from '../tools-Clyufshc.cjs';
6
- export { m as AgentLoopConfig, a as ToolExecutionStatus, q as ToolPermission } from '../tools-Clyufshc.cjs';
5
+ import { T as ToolDefinition, f as ToolSource, P as PermissionLevel, c as ToolInputSchema, l as ToolExecution$1, e as ToolContext, b as ToolResponse$1, g as ToolRenderProps, i as ToolSet, U as UnifiedToolCall, r as PermissionStorageConfig, s as PermissionStorageAdapter } from '../tools-BHQRB_YT.cjs';
6
+ export { m as AgentLoopConfig, a as ToolExecutionStatus, q as ToolPermission } from '../tools-BHQRB_YT.cjs';
7
7
  import { A as AsyncThreadStorageAdapter, c as MessageAttachment, f as ToolCall, S as Source, M as Message, T as Thread, a as ThreadData, b as ThreadStorageAdapter } from '../types-DG2ya08y.cjs';
8
8
  export { P as PersistenceConfig, h as ThreadStorageAdapter } from '../types-DG2ya08y.cjs';
9
- import { G as MCPServerConfig, U as UseMCPClientConfig, D as UseMCPClientReturn, E as UseMCPToolsConfig, F as UseMCPToolsReturn } from '../types-DM6M_pv_.cjs';
10
- export { b as MCPClientState } from '../types-DM6M_pv_.cjs';
9
+ import { G as MCPServerConfig, U as UseMCPClientConfig, D as UseMCPClientReturn, E as UseMCPToolsConfig, F as UseMCPToolsReturn } from '../types-8_Hp2rmm.cjs';
10
+ export { b as MCPClientState } from '../types-8_Hp2rmm.cjs';
11
11
  import { U as UseMCPUIIntentsConfig, m as UseMCPUIIntentsReturn } from '../types-B20VCJXL.cjs';
12
12
 
13
+ /**
14
+ * Resolvable - Type utility for values that can be static or dynamic
15
+ *
16
+ * This pattern allows SDK consumers to pass either:
17
+ * - Static value: `headers: { "x-api-key": "abc123" }`
18
+ * - Getter function: `headers: () => ({ "x-api-key": getToken() })`
19
+ *
20
+ * Values are resolved at request time, ensuring fresh data on every API call.
21
+ * This is the modern pattern used by tanstack-query, tRPC, and axios interceptors.
22
+ *
23
+ * @example
24
+ * ```tsx
25
+ * // Static (for values that never change)
26
+ * <CopilotProvider headers={{ "x-api-key": "static-key" }} />
27
+ *
28
+ * // Dynamic (for values that change at runtime)
29
+ * <CopilotProvider
30
+ * headers={() => ({
31
+ * Authorization: `Bearer ${getToken()}`,
32
+ * ...getCustomHeaders(),
33
+ * })}
34
+ * />
35
+ * ```
36
+ */
37
+ /**
38
+ * A value that can be either static or a getter function
39
+ * Getter can be sync or async for flexibility
40
+ */
41
+ type Resolvable<T> = T | (() => T) | (() => Promise<T>);
42
+
13
43
  /**
14
44
  * Server Thread Storage Adapter
15
45
  *
@@ -59,6 +89,7 @@ declare function createServerAdapter(config: ServerAdapterConfig): AsyncThreadSt
59
89
  * Contract for different transport implementations.
60
90
  * HTTP, WebSocket, or mock for testing.
61
91
  */
92
+
62
93
  /**
63
94
  * Chat request to send
64
95
  */
@@ -93,9 +124,18 @@ interface ChatResponse {
93
124
  role: string;
94
125
  content: string | null;
95
126
  tool_calls?: unknown[];
127
+ /** Tool call ID for tool result messages */
128
+ tool_call_id?: string;
96
129
  }>;
97
130
  /** Whether client needs to execute tools */
98
131
  requiresAction?: boolean;
132
+ /** Tool calls with metadata (includes hidden flag for server-side tools) */
133
+ toolCalls?: Array<{
134
+ id: string;
135
+ name: string;
136
+ args: Record<string, unknown>;
137
+ hidden?: boolean;
138
+ }>;
99
139
  }
100
140
  /**
101
141
  * Tool result from server
@@ -149,12 +189,18 @@ type StreamChunk = {
149
189
  message: string;
150
190
  } | {
151
191
  type: "done";
152
- messages?: unknown[];
192
+ messages?: Array<{
193
+ role: string;
194
+ content: string | null;
195
+ tool_calls?: unknown[];
196
+ tool_call_id?: string;
197
+ }>;
153
198
  requiresAction?: boolean;
154
199
  } | {
155
200
  type: "action:start";
156
201
  id: string;
157
202
  name: string;
203
+ hidden?: boolean;
158
204
  } | {
159
205
  type: "action:args";
160
206
  id: string;
@@ -220,6 +266,21 @@ interface ChatTransport {
220
266
  * Check if currently streaming
221
267
  */
222
268
  isStreaming(): boolean;
269
+ /**
270
+ * Update headers configuration (optional)
271
+ * Can be static headers or a getter function for dynamic resolution
272
+ */
273
+ setHeaders?(headers: Resolvable<Record<string, string>>): void;
274
+ /**
275
+ * Update URL configuration (optional)
276
+ * Can be static URL or a getter function for dynamic resolution
277
+ */
278
+ setUrl?(url: Resolvable<string>): void;
279
+ /**
280
+ * Update body configuration (optional)
281
+ * Additional properties merged into every request body
282
+ */
283
+ setBody?(body: Resolvable<Record<string, unknown>>): void;
223
284
  }
224
285
 
225
286
  /**
@@ -369,18 +430,37 @@ interface ChatState$1<T extends UIMessage = UIMessage> {
369
430
  type ChatStatus$1 = "ready" | "submitted" | "streaming" | "error";
370
431
  /**
371
432
  * Chat configuration
433
+ *
434
+ * Supports both static values and getter functions for dynamic configuration.
435
+ * Using getter functions ensures fresh values on every request.
436
+ *
437
+ * @example
438
+ * ```typescript
439
+ * const config: ChatConfig = {
440
+ * // Static URL
441
+ * runtimeUrl: "/api/chat",
442
+ *
443
+ * // Dynamic headers - resolved fresh on every request
444
+ * headers: () => ({
445
+ * Authorization: `Bearer ${getToken()}`,
446
+ * ...getCustomHeaders(),
447
+ * }),
448
+ * };
449
+ * ```
372
450
  */
373
451
  interface ChatConfig {
374
- /** Runtime API endpoint */
375
- runtimeUrl: string;
452
+ /** Runtime API endpoint - can be static or getter function */
453
+ runtimeUrl: Resolvable<string>;
376
454
  /** LLM configuration */
377
455
  llm?: Partial<LLMConfig>;
378
456
  /** System prompt */
379
457
  systemPrompt?: string;
380
458
  /** Enable streaming (default: true) */
381
459
  streaming?: boolean;
382
- /** Request headers */
383
- headers?: Record<string, string>;
460
+ /** Request headers - can be static or getter function */
461
+ headers?: Resolvable<Record<string, string>>;
462
+ /** Additional body properties - can be static or getter function */
463
+ body?: Resolvable<Record<string, unknown>>;
384
464
  /** Thread ID for conversation persistence */
385
465
  threadId?: string;
386
466
  /** Debug mode */
@@ -460,6 +540,11 @@ interface ToolExecution {
460
540
  approvalMessage?: string;
461
541
  /** Data passed from user's approval action (e.g., selected supervisor) */
462
542
  approvalData?: Record<string, unknown>;
543
+ /**
544
+ * Whether this tool execution should be hidden from the UI.
545
+ * When true, the tool won't appear in the chat, but still executes normally.
546
+ */
547
+ hidden?: boolean;
463
548
  }
464
549
  /**
465
550
  * Tool response
@@ -659,6 +744,21 @@ declare class AbstractChat<T extends UIMessage = UIMessage> {
659
744
  * This allows updating the system prompt after initialization
660
745
  */
661
746
  setSystemPrompt(prompt: string): void;
747
+ /**
748
+ * Set headers configuration
749
+ * Can be static headers or a getter function for dynamic resolution
750
+ */
751
+ setHeaders(headers: ChatConfig["headers"]): void;
752
+ /**
753
+ * Set URL configuration
754
+ * Can be static URL or a getter function for dynamic resolution
755
+ */
756
+ setUrl(url: ChatConfig["runtimeUrl"]): void;
757
+ /**
758
+ * Set body configuration
759
+ * Additional properties merged into every request body
760
+ */
761
+ setBody(body: ChatConfig["body"]): void;
662
762
  /**
663
763
  * Build the request payload
664
764
  */
@@ -870,8 +970,11 @@ declare class AbstractAgentLoop implements AgentLoopActions {
870
970
 
871
971
  interface CopilotProviderProps {
872
972
  children: React__default.ReactNode;
873
- /** Runtime API endpoint URL */
874
- runtimeUrl: string;
973
+ /**
974
+ * Runtime API endpoint URL
975
+ * Can be static string or getter function for dynamic resolution.
976
+ */
977
+ runtimeUrl: Resolvable<string>;
875
978
  /** System prompt sent with each request */
876
979
  systemPrompt?: string;
877
980
  /** @deprecated Use useTools() hook instead */
@@ -886,8 +989,16 @@ interface CopilotProviderProps {
886
989
  onError?: (error: Error) => void;
887
990
  /** Enable/disable streaming (default: true) */
888
991
  streaming?: boolean;
889
- /** Custom headers to send with each request */
890
- headers?: Record<string, string>;
992
+ /**
993
+ * Custom headers to send with each request
994
+ * Can be static object or getter function for dynamic resolution.
995
+ */
996
+ headers?: Resolvable<Record<string, string>>;
997
+ /**
998
+ * Additional body properties to include in each request
999
+ * Can be static object or getter function for dynamic resolution.
1000
+ */
1001
+ body?: Resolvable<Record<string, unknown>>;
891
1002
  /** Enable debug logging */
892
1003
  debug?: boolean;
893
1004
  /** Max tool execution iterations (default: 20) */
@@ -921,11 +1032,15 @@ interface CopilotContextValue {
921
1032
  removeContext: (id: string) => void;
922
1033
  setSystemPrompt: (prompt: string) => void;
923
1034
  threadId?: string;
924
- runtimeUrl: string;
1035
+ /**
1036
+ * Runtime URL configuration.
1037
+ * Can be a static string or getter function (matches what was passed to provider).
1038
+ */
1039
+ runtimeUrl: Resolvable<string>;
925
1040
  toolsConfig?: ToolsConfig;
926
1041
  }
927
1042
  declare function useCopilot(): CopilotContextValue;
928
- declare function CopilotProvider({ children, runtimeUrl, systemPrompt, tools: toolsConfig, threadId, initialMessages, onMessagesChange, onError, streaming, headers, debug, maxIterations, maxIterationsMessage, mcpServers, }: CopilotProviderProps): react_jsx_runtime.JSX.Element;
1043
+ declare function CopilotProvider({ children, runtimeUrl, systemPrompt, tools: toolsConfig, threadId, initialMessages, onMessagesChange, onError, streaming, headers, body, debug, maxIterations, maxIterationsMessage, mcpServers, }: CopilotProviderProps): react_jsx_runtime.JSX.Element;
929
1044
 
930
1045
  /**
931
1046
  * Chat UI state interface (UI-only state, not message data)