@yourgpt/copilot-sdk 2.1.5-alpha.5 → 2.1.5-alpha.7

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 (37) hide show
  1. package/dist/{ThreadManager-DK46fVl3.d.cts → ThreadManager-B12N-zpq.d.cts} +3 -3
  2. package/dist/{ThreadManager-D7KwT2FJ.d.ts → ThreadManager-BxGOeykx.d.ts} +3 -3
  3. package/dist/{chunk-KGYDGK3U.cjs → chunk-7GWEW2DU.cjs} +24 -8
  4. package/dist/chunk-7GWEW2DU.cjs.map +1 -0
  5. package/dist/{chunk-YLZCTR4O.js → chunk-J5D3AZF6.js} +24 -8
  6. package/dist/chunk-J5D3AZF6.js.map +1 -0
  7. package/dist/{chunk-5UGWLGFS.cjs → chunk-M66XAHSW.cjs} +84 -46
  8. package/dist/chunk-M66XAHSW.cjs.map +1 -0
  9. package/dist/{chunk-LHLVTGIP.cjs → chunk-NPBOKT63.cjs} +297 -96
  10. package/dist/chunk-NPBOKT63.cjs.map +1 -0
  11. package/dist/{chunk-DH6EO6NW.js → chunk-UZHGMDOK.js} +293 -92
  12. package/dist/chunk-UZHGMDOK.js.map +1 -0
  13. package/dist/{chunk-ZAOTYA5L.js → chunk-YHW6JZEF.js} +48 -11
  14. package/dist/chunk-YHW6JZEF.js.map +1 -0
  15. package/dist/core/index.cjs +72 -72
  16. package/dist/core/index.d.cts +2 -2
  17. package/dist/core/index.d.ts +2 -2
  18. package/dist/core/index.js +1 -1
  19. package/dist/experimental/index.cjs +3 -3
  20. package/dist/experimental/index.js +2 -2
  21. package/dist/react/index.cjs +70 -66
  22. package/dist/react/index.d.cts +207 -5
  23. package/dist/react/index.d.ts +207 -5
  24. package/dist/react/index.js +3 -3
  25. package/dist/ui/index.cjs +1178 -228
  26. package/dist/ui/index.cjs.map +1 -1
  27. package/dist/ui/index.d.cts +119 -7
  28. package/dist/ui/index.d.ts +119 -7
  29. package/dist/ui/index.js +1173 -227
  30. package/dist/ui/index.js.map +1 -1
  31. package/package.json +1 -1
  32. package/dist/chunk-5UGWLGFS.cjs.map +0 -1
  33. package/dist/chunk-DH6EO6NW.js.map +0 -1
  34. package/dist/chunk-KGYDGK3U.cjs.map +0 -1
  35. package/dist/chunk-LHLVTGIP.cjs.map +0 -1
  36. package/dist/chunk-YLZCTR4O.js.map +0 -1
  37. package/dist/chunk-ZAOTYA5L.js.map +0 -1
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var chunk5UGWLGFS_cjs = require('../chunk-5UGWLGFS.cjs');
4
- var chunkLHLVTGIP_cjs = require('../chunk-LHLVTGIP.cjs');
5
- var chunkKGYDGK3U_cjs = require('../chunk-KGYDGK3U.cjs');
3
+ var chunkM66XAHSW_cjs = require('../chunk-M66XAHSW.cjs');
4
+ var chunkNPBOKT63_cjs = require('../chunk-NPBOKT63.cjs');
5
+ var chunk7GWEW2DU_cjs = require('../chunk-7GWEW2DU.cjs');
6
6
  require('../chunk-JGPDQDY4.cjs');
7
7
  require('../chunk-BJYA5NDL.cjs');
8
8
  require('../chunk-Y2A6AMGO.cjs');
@@ -22,255 +22,259 @@ require('../chunk-JEQ2X3Z6.cjs');
22
22
 
23
23
  Object.defineProperty(exports, "ReactChat", {
24
24
  enumerable: true,
25
- get: function () { return chunk5UGWLGFS_cjs.ReactChat; }
25
+ get: function () { return chunkM66XAHSW_cjs.ReactChat; }
26
26
  });
27
27
  Object.defineProperty(exports, "ReactThreadManager", {
28
28
  enumerable: true,
29
- get: function () { return chunk5UGWLGFS_cjs.ReactThreadManager; }
29
+ get: function () { return chunkM66XAHSW_cjs.ReactThreadManager; }
30
30
  });
31
31
  Object.defineProperty(exports, "ReactThreadManagerState", {
32
32
  enumerable: true,
33
- get: function () { return chunk5UGWLGFS_cjs.ReactThreadManagerState; }
33
+ get: function () { return chunkM66XAHSW_cjs.ReactThreadManagerState; }
34
34
  });
35
35
  Object.defineProperty(exports, "createMessageIntentHandler", {
36
36
  enumerable: true,
37
- get: function () { return chunk5UGWLGFS_cjs.createMessageIntentHandler; }
37
+ get: function () { return chunkM66XAHSW_cjs.createMessageIntentHandler; }
38
38
  });
39
39
  Object.defineProperty(exports, "createPermissionStorage", {
40
40
  enumerable: true,
41
- get: function () { return chunk5UGWLGFS_cjs.createPermissionStorage; }
41
+ get: function () { return chunkM66XAHSW_cjs.createPermissionStorage; }
42
42
  });
43
43
  Object.defineProperty(exports, "createReactChat", {
44
44
  enumerable: true,
45
- get: function () { return chunk5UGWLGFS_cjs.createReactChat; }
45
+ get: function () { return chunkM66XAHSW_cjs.createReactChat; }
46
46
  });
47
47
  Object.defineProperty(exports, "createReactThreadManager", {
48
48
  enumerable: true,
49
- get: function () { return chunk5UGWLGFS_cjs.createReactThreadManager; }
49
+ get: function () { return chunkM66XAHSW_cjs.createReactThreadManager; }
50
50
  });
51
51
  Object.defineProperty(exports, "createReactThreadManagerState", {
52
52
  enumerable: true,
53
- get: function () { return chunk5UGWLGFS_cjs.createReactThreadManagerState; }
53
+ get: function () { return chunkM66XAHSW_cjs.createReactThreadManagerState; }
54
54
  });
55
55
  Object.defineProperty(exports, "createSessionPermissionCache", {
56
56
  enumerable: true,
57
- get: function () { return chunk5UGWLGFS_cjs.createSessionPermissionCache; }
57
+ get: function () { return chunkM66XAHSW_cjs.createSessionPermissionCache; }
58
58
  });
59
59
  Object.defineProperty(exports, "createToolIntentHandler", {
60
60
  enumerable: true,
61
- get: function () { return chunk5UGWLGFS_cjs.createToolIntentHandler; }
61
+ get: function () { return chunkM66XAHSW_cjs.createToolIntentHandler; }
62
62
  });
63
63
  Object.defineProperty(exports, "defineSkill", {
64
64
  enumerable: true,
65
- get: function () { return chunk5UGWLGFS_cjs.defineSkill; }
65
+ get: function () { return chunkM66XAHSW_cjs.defineSkill; }
66
66
  });
67
67
  Object.defineProperty(exports, "formatKnowledgeResultsForAI", {
68
68
  enumerable: true,
69
- get: function () { return chunk5UGWLGFS_cjs.formatKnowledgeResultsForAI; }
69
+ get: function () { return chunkM66XAHSW_cjs.formatKnowledgeResultsForAI; }
70
70
  });
71
71
  Object.defineProperty(exports, "searchKnowledgeBase", {
72
72
  enumerable: true,
73
- get: function () { return chunk5UGWLGFS_cjs.searchKnowledgeBase; }
73
+ get: function () { return chunkM66XAHSW_cjs.searchKnowledgeBase; }
74
74
  });
75
75
  Object.defineProperty(exports, "useAIAction", {
76
76
  enumerable: true,
77
- get: function () { return chunk5UGWLGFS_cjs.useAIAction; }
77
+ get: function () { return chunkM66XAHSW_cjs.useAIAction; }
78
78
  });
79
79
  Object.defineProperty(exports, "useAIActions", {
80
80
  enumerable: true,
81
- get: function () { return chunk5UGWLGFS_cjs.useAIActions; }
81
+ get: function () { return chunkM66XAHSW_cjs.useAIActions; }
82
82
  });
83
83
  Object.defineProperty(exports, "useAITools", {
84
84
  enumerable: true,
85
- get: function () { return chunk5UGWLGFS_cjs.useAITools; }
85
+ get: function () { return chunkM66XAHSW_cjs.useAITools; }
86
86
  });
87
87
  Object.defineProperty(exports, "useAgent", {
88
88
  enumerable: true,
89
- get: function () { return chunk5UGWLGFS_cjs.useAgent; }
89
+ get: function () { return chunkM66XAHSW_cjs.useAgent; }
90
90
  });
91
91
  Object.defineProperty(exports, "useCapabilities", {
92
92
  enumerable: true,
93
- get: function () { return chunk5UGWLGFS_cjs.useCapabilities; }
93
+ get: function () { return chunkM66XAHSW_cjs.useCapabilities; }
94
94
  });
95
95
  Object.defineProperty(exports, "useChat", {
96
96
  enumerable: true,
97
- get: function () { return chunk5UGWLGFS_cjs.useChat; }
97
+ get: function () { return chunkM66XAHSW_cjs.useChat; }
98
98
  });
99
99
  Object.defineProperty(exports, "useContextStats", {
100
100
  enumerable: true,
101
- get: function () { return chunk5UGWLGFS_cjs.useContextStats; }
101
+ get: function () { return chunkM66XAHSW_cjs.useContextStats; }
102
102
  });
103
103
  Object.defineProperty(exports, "useCopilotEvent", {
104
104
  enumerable: true,
105
- get: function () { return chunk5UGWLGFS_cjs.useCopilotEvent; }
105
+ get: function () { return chunkM66XAHSW_cjs.useCopilotEvent; }
106
106
  });
107
107
  Object.defineProperty(exports, "useDevLogger", {
108
108
  enumerable: true,
109
- get: function () { return chunk5UGWLGFS_cjs.useDevLogger; }
109
+ get: function () { return chunkM66XAHSW_cjs.useDevLogger; }
110
110
  });
111
111
  Object.defineProperty(exports, "useFeatureSupport", {
112
112
  enumerable: true,
113
- get: function () { return chunk5UGWLGFS_cjs.useFeatureSupport; }
113
+ get: function () { return chunkM66XAHSW_cjs.useFeatureSupport; }
114
114
  });
115
115
  Object.defineProperty(exports, "useKnowledgeBase", {
116
116
  enumerable: true,
117
- get: function () { return chunk5UGWLGFS_cjs.useKnowledgeBase; }
117
+ get: function () { return chunkM66XAHSW_cjs.useKnowledgeBase; }
118
118
  });
119
119
  Object.defineProperty(exports, "useMCPUIIntents", {
120
120
  enumerable: true,
121
- get: function () { return chunk5UGWLGFS_cjs.useMCPUIIntents; }
121
+ get: function () { return chunkM66XAHSW_cjs.useMCPUIIntents; }
122
122
  });
123
123
  Object.defineProperty(exports, "useMessageCheckpoints", {
124
124
  enumerable: true,
125
- get: function () { return chunk5UGWLGFS_cjs.useMessageCheckpoints; }
125
+ get: function () { return chunkM66XAHSW_cjs.useMessageCheckpoints; }
126
126
  });
127
127
  Object.defineProperty(exports, "useMessageMeta", {
128
128
  enumerable: true,
129
- get: function () { return chunk5UGWLGFS_cjs.useMessageMeta; }
129
+ get: function () { return chunkM66XAHSW_cjs.useMessageMeta; }
130
130
  });
131
131
  Object.defineProperty(exports, "useSkill", {
132
132
  enumerable: true,
133
- get: function () { return chunk5UGWLGFS_cjs.useSkill; }
133
+ get: function () { return chunkM66XAHSW_cjs.useSkill; }
134
134
  });
135
135
  Object.defineProperty(exports, "useSkillStatus", {
136
136
  enumerable: true,
137
- get: function () { return chunk5UGWLGFS_cjs.useSkillStatus; }
137
+ get: function () { return chunkM66XAHSW_cjs.useSkillStatus; }
138
138
  });
139
139
  Object.defineProperty(exports, "useSuggestions", {
140
140
  enumerable: true,
141
- get: function () { return chunk5UGWLGFS_cjs.useSuggestions; }
141
+ get: function () { return chunkM66XAHSW_cjs.useSuggestions; }
142
142
  });
143
143
  Object.defineProperty(exports, "useSupportedMediaTypes", {
144
144
  enumerable: true,
145
- get: function () { return chunk5UGWLGFS_cjs.useSupportedMediaTypes; }
145
+ get: function () { return chunkM66XAHSW_cjs.useSupportedMediaTypes; }
146
+ });
147
+ Object.defineProperty(exports, "useThread", {
148
+ enumerable: true,
149
+ get: function () { return chunkM66XAHSW_cjs.useThread; }
146
150
  });
147
151
  Object.defineProperty(exports, "useThreadManager", {
148
152
  enumerable: true,
149
- get: function () { return chunk5UGWLGFS_cjs.useThreadManager; }
153
+ get: function () { return chunkM66XAHSW_cjs.useThreadManager; }
150
154
  });
151
155
  Object.defineProperty(exports, "useToolExecutor", {
152
156
  enumerable: true,
153
- get: function () { return chunk5UGWLGFS_cjs.useToolExecutor; }
157
+ get: function () { return chunkM66XAHSW_cjs.useToolExecutor; }
154
158
  });
155
159
  Object.defineProperty(exports, "useToolWithSchema", {
156
160
  enumerable: true,
157
- get: function () { return chunk5UGWLGFS_cjs.useToolWithSchema; }
161
+ get: function () { return chunkM66XAHSW_cjs.useToolWithSchema; }
158
162
  });
159
163
  Object.defineProperty(exports, "useToolsWithSchema", {
160
164
  enumerable: true,
161
- get: function () { return chunk5UGWLGFS_cjs.useToolsWithSchema; }
165
+ get: function () { return chunkM66XAHSW_cjs.useToolsWithSchema; }
162
166
  });
163
167
  Object.defineProperty(exports, "AbstractAgentLoop", {
164
168
  enumerable: true,
165
- get: function () { return chunkLHLVTGIP_cjs.AbstractAgentLoop; }
169
+ get: function () { return chunkNPBOKT63_cjs.AbstractAgentLoop; }
166
170
  });
167
171
  Object.defineProperty(exports, "AbstractChat", {
168
172
  enumerable: true,
169
- get: function () { return chunkLHLVTGIP_cjs.AbstractChat; }
173
+ get: function () { return chunkNPBOKT63_cjs.AbstractChat; }
170
174
  });
171
175
  Object.defineProperty(exports, "CopilotProvider", {
172
176
  enumerable: true,
173
- get: function () { return chunkLHLVTGIP_cjs.CopilotProvider; }
177
+ get: function () { return chunkNPBOKT63_cjs.CopilotProvider; }
174
178
  });
175
179
  Object.defineProperty(exports, "MessageHistoryContext", {
176
180
  enumerable: true,
177
- get: function () { return chunkLHLVTGIP_cjs.MessageHistoryContext; }
181
+ get: function () { return chunkNPBOKT63_cjs.MessageHistoryContext; }
178
182
  });
179
183
  Object.defineProperty(exports, "MessageTree", {
180
184
  enumerable: true,
181
- get: function () { return chunkLHLVTGIP_cjs.MessageTree; }
185
+ get: function () { return chunkNPBOKT63_cjs.MessageTree; }
182
186
  });
183
187
  Object.defineProperty(exports, "ReactChatState", {
184
188
  enumerable: true,
185
- get: function () { return chunkLHLVTGIP_cjs.ReactChatState; }
189
+ get: function () { return chunkNPBOKT63_cjs.ReactChatState; }
186
190
  });
187
191
  Object.defineProperty(exports, "SkillProvider", {
188
192
  enumerable: true,
189
- get: function () { return chunkLHLVTGIP_cjs.SkillProvider; }
193
+ get: function () { return chunkNPBOKT63_cjs.SkillProvider; }
190
194
  });
191
195
  Object.defineProperty(exports, "createReactChatState", {
192
196
  enumerable: true,
193
- get: function () { return chunkLHLVTGIP_cjs.createReactChatState; }
197
+ get: function () { return chunkNPBOKT63_cjs.createReactChatState; }
194
198
  });
195
199
  Object.defineProperty(exports, "defaultMessageHistoryConfig", {
196
200
  enumerable: true,
197
- get: function () { return chunkLHLVTGIP_cjs.defaultMessageHistoryConfig; }
201
+ get: function () { return chunkNPBOKT63_cjs.defaultMessageHistoryConfig; }
198
202
  });
199
203
  Object.defineProperty(exports, "initialAgentLoopState", {
200
204
  enumerable: true,
201
- get: function () { return chunkLHLVTGIP_cjs.initialAgentLoopState; }
205
+ get: function () { return chunkNPBOKT63_cjs.initialAgentLoopState; }
202
206
  });
203
207
  Object.defineProperty(exports, "isCompactionMarker", {
204
208
  enumerable: true,
205
- get: function () { return chunkLHLVTGIP_cjs.isCompactionMarker; }
209
+ get: function () { return chunkNPBOKT63_cjs.isCompactionMarker; }
206
210
  });
207
211
  Object.defineProperty(exports, "keepToolPairsAtomic", {
208
212
  enumerable: true,
209
- get: function () { return chunkLHLVTGIP_cjs.keepToolPairsAtomic; }
213
+ get: function () { return chunkNPBOKT63_cjs.keepToolPairsAtomic; }
210
214
  });
211
215
  Object.defineProperty(exports, "toDisplayMessage", {
212
216
  enumerable: true,
213
- get: function () { return chunkLHLVTGIP_cjs.toDisplayMessage; }
217
+ get: function () { return chunkNPBOKT63_cjs.toDisplayMessage; }
214
218
  });
215
219
  Object.defineProperty(exports, "toLLMMessage", {
216
220
  enumerable: true,
217
- get: function () { return chunkLHLVTGIP_cjs.toLLMMessage; }
221
+ get: function () { return chunkNPBOKT63_cjs.toLLMMessage; }
218
222
  });
219
223
  Object.defineProperty(exports, "toLLMMessages", {
220
224
  enumerable: true,
221
- get: function () { return chunkLHLVTGIP_cjs.toLLMMessages; }
225
+ get: function () { return chunkNPBOKT63_cjs.toLLMMessages; }
222
226
  });
223
227
  Object.defineProperty(exports, "useAIContext", {
224
228
  enumerable: true,
225
- get: function () { return chunkLHLVTGIP_cjs.useAIContext; }
229
+ get: function () { return chunkNPBOKT63_cjs.useAIContext; }
226
230
  });
227
231
  Object.defineProperty(exports, "useAIContexts", {
228
232
  enumerable: true,
229
- get: function () { return chunkLHLVTGIP_cjs.useAIContexts; }
233
+ get: function () { return chunkNPBOKT63_cjs.useAIContexts; }
230
234
  });
231
235
  Object.defineProperty(exports, "useCopilot", {
232
236
  enumerable: true,
233
- get: function () { return chunkLHLVTGIP_cjs.useCopilot; }
237
+ get: function () { return chunkNPBOKT63_cjs.useCopilot; }
234
238
  });
235
239
  Object.defineProperty(exports, "useMCPClient", {
236
240
  enumerable: true,
237
- get: function () { return chunkLHLVTGIP_cjs.useMCPClient; }
241
+ get: function () { return chunkNPBOKT63_cjs.useMCPClient; }
238
242
  });
239
243
  Object.defineProperty(exports, "useMCPTools", {
240
244
  enumerable: true,
241
- get: function () { return chunkLHLVTGIP_cjs.useMCPTools; }
245
+ get: function () { return chunkNPBOKT63_cjs.useMCPTools; }
242
246
  });
243
247
  Object.defineProperty(exports, "useMessageHistory", {
244
248
  enumerable: true,
245
- get: function () { return chunkLHLVTGIP_cjs.useMessageHistory; }
249
+ get: function () { return chunkNPBOKT63_cjs.useMessageHistory; }
246
250
  });
247
251
  Object.defineProperty(exports, "useMessageHistoryContext", {
248
252
  enumerable: true,
249
- get: function () { return chunkLHLVTGIP_cjs.useMessageHistoryContext; }
253
+ get: function () { return chunkNPBOKT63_cjs.useMessageHistoryContext; }
250
254
  });
251
255
  Object.defineProperty(exports, "useTool", {
252
256
  enumerable: true,
253
- get: function () { return chunkLHLVTGIP_cjs.useTool; }
257
+ get: function () { return chunkNPBOKT63_cjs.useTool; }
254
258
  });
255
259
  Object.defineProperty(exports, "useTools", {
256
260
  enumerable: true,
257
- get: function () { return chunkLHLVTGIP_cjs.useTools; }
261
+ get: function () { return chunkNPBOKT63_cjs.useTools; }
258
262
  });
259
263
  Object.defineProperty(exports, "createLocalStorageAdapter", {
260
264
  enumerable: true,
261
- get: function () { return chunkKGYDGK3U_cjs.createLocalStorageAdapter; }
265
+ get: function () { return chunk7GWEW2DU_cjs.createLocalStorageAdapter; }
262
266
  });
263
267
  Object.defineProperty(exports, "createMemoryAdapter", {
264
268
  enumerable: true,
265
- get: function () { return chunkKGYDGK3U_cjs.createMemoryAdapter; }
269
+ get: function () { return chunk7GWEW2DU_cjs.createMemoryAdapter; }
266
270
  });
267
271
  Object.defineProperty(exports, "createServerAdapter", {
268
272
  enumerable: true,
269
- get: function () { return chunkKGYDGK3U_cjs.createServerAdapter; }
273
+ get: function () { return chunk7GWEW2DU_cjs.createServerAdapter; }
270
274
  });
271
275
  Object.defineProperty(exports, "generateSuggestionReason", {
272
276
  enumerable: true,
273
- get: function () { return chunkKGYDGK3U_cjs.generateSuggestionReason; }
277
+ get: function () { return chunk7GWEW2DU_cjs.generateSuggestionReason; }
274
278
  });
275
279
  Object.defineProperty(exports, "tool", {
276
280
  enumerable: true,
@@ -3,8 +3,8 @@ import { U as UIMessage, B as BranchInfo } from '../MessageTree-Dt9qfJ55.cjs';
3
3
  export { M as MessageTree } from '../MessageTree-Dt9qfJ55.cjs';
4
4
  import * as React$1 from 'react';
5
5
  import React__default from 'react';
6
- 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-DK46fVl3.cjs';
7
- export { A as ActionParameter, q as CloudConfig, r as CopilotConfig, _ as LocalStorageAdapterConfig, J as createLocalStorageAdapter, O as createMemoryAdapter, i as generateSuggestionReason } from '../ThreadManager-DK46fVl3.cjs';
6
+ 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-B12N-zpq.cjs';
7
+ export { A as ActionParameter, q as CloudConfig, r as CopilotConfig, _ as LocalStorageAdapterConfig, J as createLocalStorageAdapter, O as createMemoryAdapter, i as generateSuggestionReason } from '../ThreadManager-B12N-zpq.cjs';
8
8
  import { T as ToolDefinition, t as ToolOptimizationConfig, r as ContextUsage, f as ToolSource, P as PermissionLevel, c as ToolInputSchema, y as ToolExecution$1, e as ToolContext, b as ToolResponse$1, g as ToolRenderProps, i as ToolResultConfig, D as AIResponseMode, u as ToolSet, U as UnifiedToolCall, G as PermissionStorageConfig, H as PermissionStorageAdapter } from '../tools-DcS6Aeao.cjs';
9
9
  export { z as AgentLoopConfig, q as ContextUsagePart, h as ToolConfig, a as ToolExecutionStatus, F as ToolPermission, v as ToolSetEntry, I as tool } from '../tools-DcS6Aeao.cjs';
10
10
  import { A as AsyncThreadStorageAdapter, M as MessageAttachment, T as ToolCall, d as Message, S as Source, a as Thread, b as ThreadData, c as ThreadStorageAdapter } from '../types-waEqyE4K.cjs';
@@ -142,6 +142,8 @@ interface ChatResponse {
142
142
  /** Tool call ID for tool result messages */
143
143
  tool_call_id?: string;
144
144
  }>;
145
+ /** Session ID — present when server storage adapter created/resolved a session */
146
+ threadId?: string;
145
147
  /** Whether client needs to execute tools */
146
148
  requiresAction?: boolean;
147
149
  /** Tool calls with metadata (includes hidden flag for server-side tools) */
@@ -211,6 +213,8 @@ type StreamChunk = {
211
213
  tool_call_id?: string;
212
214
  }>;
213
215
  requiresAction?: boolean;
216
+ /** Session ID from server storage adapter */
217
+ threadId?: string;
214
218
  } | {
215
219
  type: "action:start";
216
220
  id: string;
@@ -427,6 +431,17 @@ interface ChatState$1<T extends UIMessage = UIMessage> {
427
431
  * Chat status
428
432
  */
429
433
  type ChatStatus$1 = "ready" | "submitted" | "streaming" | "error";
434
+ /**
435
+ * YourGPT configuration for automatic session management
436
+ */
437
+ interface YourGPTConfig {
438
+ /** YourGPT API key (sent as api-key header) */
439
+ apiKey: string;
440
+ /** Widget UID to scope sessions to */
441
+ widgetUid: string;
442
+ /** API base URL (default: https://api.yourgpt.ai) */
443
+ endpoint?: string;
444
+ }
430
445
  /**
431
446
  * Chat configuration
432
447
  *
@@ -462,6 +477,37 @@ interface ChatConfig {
462
477
  body?: Resolvable<Record<string, unknown>>;
463
478
  /** Thread ID for conversation persistence */
464
479
  threadId?: string;
480
+ /**
481
+ * Called once before the first message on a new thread to obtain a session/thread ID.
482
+ * The returned value IS the thread ID — session and thread are the same identity.
483
+ *
484
+ * Only called when `config.threadId` is not set (new thread).
485
+ * If `threadId` is already provided, this is skipped entirely.
486
+ * Takes priority over `yourgptConfig` when both are provided.
487
+ *
488
+ * @example Async server session
489
+ * ```ts
490
+ * onCreateSession={async () => {
491
+ * const res = await fetch('/api/sessions', { method: 'POST' })
492
+ * return (await res.json()).id
493
+ * }}
494
+ * ```
495
+ */
496
+ onCreateSession?: () => string | Promise<string>;
497
+ /**
498
+ * YourGPT config — enables automatic session creation with zero boilerplate.
499
+ * When provided, the SDK calls YourGPT's createSession API before the first
500
+ * message and uses the returned session_uid as `threadId`.
501
+ *
502
+ * @example
503
+ * ```tsx
504
+ * yourgptConfig={{
505
+ * apiKey: process.env.YOURGPT_API_KEY,
506
+ * widgetUid: widgetUid,
507
+ * }}
508
+ * ```
509
+ */
510
+ yourgptConfig?: YourGPTConfig;
465
511
  /** Enable debug logging */
466
512
  debug?: boolean;
467
513
  /** Available tools (passed to LLM) */
@@ -500,6 +546,17 @@ interface ChatCallbacks<T extends UIMessage = UIMessage> {
500
546
  onFinish?: (messages: T[]) => void;
501
547
  /** Called when prompt context usage changes */
502
548
  onContextUsageChange?: (usage: ContextUsage) => void;
549
+ /**
550
+ * Called once when a new session/thread ID is assigned (null → sessionId transition).
551
+ * Use this to persist the session ID in your storage layer.
552
+ * The returned ID is the same as the threadId that will be used for all subsequent requests.
553
+ */
554
+ onThreadChange?: (id: string) => void;
555
+ /**
556
+ * Called when the session creation status changes.
557
+ * Use this to show/hide a spinner while the session is being created.
558
+ */
559
+ onSessionStatusChange?: (status: "idle" | "creating" | "ready" | "error") => void;
503
560
  /** Called when a server-side tool starts executing (action:start event) */
504
561
  onServerToolStart?: (info: ServerToolInfo) => void;
505
562
  /** Called when a server-side tool receives args (action:args event) */
@@ -731,6 +788,9 @@ declare class AbstractChat<T extends UIMessage = UIMessage> {
731
788
  protected callbacks: ChatCallbacks<T>;
732
789
  protected optimizer: ChatContextOptimizer;
733
790
  protected lastContextUsage: ContextUsage | null;
791
+ private onCreateSession?;
792
+ private sessionInitPromise;
793
+ private sessionStatus;
734
794
  private eventHandlers;
735
795
  private streamState;
736
796
  constructor(init: ChatInit<T>);
@@ -880,6 +940,27 @@ declare class AbstractChat<T extends UIMessage = UIMessage> {
880
940
  * Set dynamic context (appended to system prompt)
881
941
  */
882
942
  setContext(context: string): void;
943
+ /**
944
+ * Switch to a different thread (or start a new one).
945
+ *
946
+ * - Pass the session/thread ID from persistence → used as-is, no session creation call.
947
+ * - Pass null → threadId cleared, new session created on first sendMessage.
948
+ *
949
+ * The session ID IS the thread ID: whatever is stored in persistence is passed here directly.
950
+ */
951
+ setActiveThread(id: string | null): void;
952
+ /**
953
+ * Force a new session to be created on the next sendMessage.
954
+ * Call this when the current session has expired or credits are exhausted.
955
+ * After calling this, the next sendMessage will invoke onCreateSession/yourgptConfig
956
+ * again and onThreadChange will fire with the new session ID.
957
+ */
958
+ renewSession(): void;
959
+ private setSessionStatus;
960
+ /**
961
+ * Get the current session creation status.
962
+ */
963
+ getSessionStatus(): "idle" | "creating" | "ready" | "error";
883
964
  /**
884
965
  * Set system prompt dynamically
885
966
  * This allows updating the system prompt after initialization
@@ -900,9 +981,17 @@ declare class AbstractChat<T extends UIMessage = UIMessage> {
900
981
  * Additional properties merged into every request body
901
982
  */
902
983
  setBody(body: ChatConfig["body"]): void;
984
+ /**
985
+ * Default session creation via yourgptConfig.
986
+ * Only called when yourgptConfig is set and no onCreateSession is provided.
987
+ * The returned session_uid IS the thread ID going forward.
988
+ */
989
+ private _defaultCreateSession;
903
990
  /**
904
991
  * Build the request payload
905
992
  */
993
+ /** Inline text-file attachments into message content for the LLM */
994
+ private inlineTextAttachments;
906
995
  protected buildRequest(): {
907
996
  messages: {
908
997
  role: string;
@@ -1337,8 +1426,39 @@ interface CopilotProviderProps {
1337
1426
  tools?: ToolsConfig;
1338
1427
  /** Thread ID for conversation persistence */
1339
1428
  threadId?: string;
1429
+ /**
1430
+ * Called once before the first message on a new thread to create a session.
1431
+ * The returned value IS the thread ID — session and thread are the same identity.
1432
+ * Only called when `threadId` is not set. If `threadId` is provided, this is skipped.
1433
+ * Takes priority over `yourgptConfig`.
1434
+ *
1435
+ * @example
1436
+ * ```tsx
1437
+ * onCreateSession={async () => {
1438
+ * const res = await fetch('/api/sessions', { method: 'POST', headers })
1439
+ * return (await res.json()).id
1440
+ * }}
1441
+ * ```
1442
+ */
1443
+ onCreateSession?: () => string | Promise<string>;
1444
+ /**
1445
+ * Called when a new session/thread ID is assigned (new thread created).
1446
+ * Use this to persist the session ID in your storage layer.
1447
+ */
1448
+ onThreadChange?: (id: string) => void;
1449
+ /**
1450
+ * YourGPT config — enables automatic session creation with zero boilerplate.
1451
+ * The SDK calls YourGPT's createSession API before the first message and
1452
+ * uses the returned session_uid as `threadId`.
1453
+ *
1454
+ * @example
1455
+ * ```tsx
1456
+ * yourgptConfig={{ apiKey: "your-api-key", widgetUid: widgetUid }}
1457
+ * ```
1458
+ */
1459
+ yourgptConfig?: YourGPTConfig;
1340
1460
  /** Initial messages to populate the chat */
1341
- initialMessages?: Message[];
1461
+ initialMessages?: UIMessage[];
1342
1462
  /** Callback when messages change */
1343
1463
  onMessagesChange?: (messages: Message[]) => void;
1344
1464
  /** Callback when an error occurs */
@@ -1443,6 +1563,19 @@ interface CopilotContextValue {
1443
1563
  }>) => void;
1444
1564
  agentIteration: number;
1445
1565
  threadId?: string;
1566
+ /**
1567
+ * Switch to a different thread (or start a new one).
1568
+ * Pass the session/thread ID from persistence to reuse it (no new session call),
1569
+ * or null to start a fresh thread (new session created on first sendMessage).
1570
+ */
1571
+ setActiveThread: (id: string | null) => void;
1572
+ /**
1573
+ * Force a new session to be created on the next sendMessage.
1574
+ * Call when the current session has expired or credits are exhausted.
1575
+ */
1576
+ renewSession: () => void;
1577
+ /** Current session creation status */
1578
+ sessionStatus: "idle" | "creating" | "ready" | "error";
1446
1579
  /**
1447
1580
  * Runtime URL configuration.
1448
1581
  * Can be a static string or getter function (matches what was passed to provider).
@@ -1469,7 +1602,7 @@ interface CopilotContextValue {
1469
1602
  messageMeta: MessageMetaStore;
1470
1603
  }
1471
1604
  declare function useCopilot(): CopilotContextValue;
1472
- declare function CopilotProvider({ children, runtimeUrl, systemPrompt, tools: toolsConfig, threadId, initialMessages, onMessagesChange, onError, streaming, headers, body, debug, maxIterations, maxIterationsMessage, mcpServers, optimization, messageHistory, skills, }: CopilotProviderProps): react_jsx_runtime.JSX.Element;
1605
+ declare function CopilotProvider(props: CopilotProviderProps): react_jsx_runtime.JSX.Element;
1473
1606
 
1474
1607
  /**
1475
1608
  * Chat UI state interface (UI-only state, not message data)
@@ -2722,6 +2855,71 @@ interface UseThreadManagerReturn {
2722
2855
  */
2723
2856
  declare function useThreadManager(config?: UseThreadManagerConfig): UseThreadManagerReturn;
2724
2857
 
2858
+ /**
2859
+ * useThread — Session/thread management hook
2860
+ *
2861
+ * Provides clean semantics for managing the active session/thread.
2862
+ * When yourgptConfig or onCreateSession is configured, the session ID
2863
+ * IS the thread ID — they are the same identity.
2864
+ *
2865
+ * Use this hook instead of calling setActiveThread/renewSession directly.
2866
+ */
2867
+ interface UseThreadReturn {
2868
+ /**
2869
+ * Current session/thread ID.
2870
+ * undefined until the first session is created (new thread not yet sent).
2871
+ */
2872
+ threadId: string | undefined;
2873
+ /**
2874
+ * Current session creation status.
2875
+ * - "idle" — no session config, or threadId already set
2876
+ * - "creating" — session creation request in flight
2877
+ * - "ready" — threadId is set and usable
2878
+ * - "error" — session creation failed
2879
+ */
2880
+ sessionStatus: "idle" | "creating" | "ready" | "error";
2881
+ /**
2882
+ * Switch to an existing thread/session.
2883
+ * Pass the session ID from your persistence layer — it is used as-is,
2884
+ * no new session creation call is made.
2885
+ */
2886
+ switchThread: (sessionId: string) => void;
2887
+ /**
2888
+ * Start a fresh thread.
2889
+ * Clears the current session; a new session is created on the next sendMessage.
2890
+ * onThreadChange fires with the new session ID once it is assigned.
2891
+ */
2892
+ newThread: () => void;
2893
+ /**
2894
+ * Force a new session to be created on the next sendMessage.
2895
+ * Call this when the current session has expired or credits are exhausted.
2896
+ * onThreadChange fires with the new session ID once it is assigned.
2897
+ */
2898
+ renewSession: () => void;
2899
+ }
2900
+ /**
2901
+ * useThread — Clean hook for session/thread management
2902
+ *
2903
+ * @example
2904
+ * ```tsx
2905
+ * function ChatHeader() {
2906
+ * const { threadId, sessionStatus, newThread, switchThread, renewSession } = useThread();
2907
+ *
2908
+ * const loadThread = (stored: { sessionId: string }) => {
2909
+ * switchThread(stored.sessionId); // session ID IS the thread ID
2910
+ * };
2911
+ *
2912
+ * return (
2913
+ * <>
2914
+ * {sessionStatus === "creating" && <Spinner />}
2915
+ * <button onClick={newThread}>New Chat</button>
2916
+ * </>
2917
+ * );
2918
+ * }
2919
+ * ```
2920
+ */
2921
+ declare function useThread(): UseThreadReturn;
2922
+
2725
2923
  /**
2726
2924
  * React hook for managing an MCP client connection
2727
2925
  *
@@ -3159,6 +3357,10 @@ interface ReactChatConfig {
3159
3357
  llm?: ChatConfig["llm"];
3160
3358
  /** Thread ID */
3161
3359
  threadId?: string;
3360
+ /** Called once before first message to obtain a session/thread ID */
3361
+ onCreateSession?: () => string | Promise<string>;
3362
+ /** YourGPT config — enables automatic session creation */
3363
+ yourgptConfig?: YourGPTConfig;
3162
3364
  /** Enable streaming (default: true) */
3163
3365
  streaming?: boolean;
3164
3366
  /** Request headers */
@@ -3472,4 +3674,4 @@ interface UseMessageMetaReturn<T extends Record<string, unknown>> {
3472
3674
  */
3473
3675
  declare function useMessageMeta<T extends Record<string, unknown> = Record<string, unknown>>(messageId: string | undefined): UseMessageMetaReturn<T>;
3474
3676
 
3475
- export { type AIContextItem, AbstractAgentLoop, AbstractChat, ActionDefinition, type AgentLoopActions, type AgentLoopCallbacks, type AgentLoopState, AsyncThreadStorageAdapter, BranchInfo, type CapabilitiesResponse, CapturedContext, type ChatActions, type ChatCallbacks, type ChatConfig, type ChatState, type ChatStatus, type ToolExecution as ChatToolExecution, type ToolResponse as ChatToolResponse, type CombinedChatState, type CompactedToolResult, type CompactionEvent, type CompactionMarker, type CompactionStrategy, type ContextStats, ContextUsage, type CopilotContextValue, CopilotProvider, type CopilotProviderProps, type AgentLoopState$1 as CoreAgentLoopState, type ChatState$1 as CoreChatState, type DevLoggerState, type DisplayMessage, IntentDetectionResult, type KnowledgeBaseConfig, type KnowledgeBaseResult, type KnowledgeBaseSearchResponse, LLMConfig, type LLMMessage, Message, type MessageCheckpoint, type MessageHistoryConfig, MessageHistoryContext, type MessageHistoryContextValue, MessageMetaStore, type MessageTokenUsage, PermissionLevel, PermissionStorageAdapter, PermissionStorageConfig, type ProviderCapabilities, ReactChat, type ReactChatConfig, ReactChatState, ReactThreadManager, type ReactThreadManagerConfig, ReactThreadManagerState, ResolvedSkill, type ServerAdapterConfig, type SessionCompactionState, SkillDefinition, SkillProvider, type SkillProviderProps, Source, type StreamChunkWithMessageId, type StreamEventHandler, type Suggestion, Thread, ThreadData, type TokenUsage, ToolConsentRequest, ToolConsentResponse, ToolContext, ToolDefinition, ToolExecution$1 as ToolExecution, ToolResponse$1 as ToolResponse, ToolSet, ToolType, type ToolsActions, ToolsConfig, type ToolsState, UIMessage, UnifiedToolCall, type UseAIToolsOptions, type UseAIToolsReturn, type UseAgentOptions, type UseAgentReturn, type UseChatConfig, type UseChatReturn, type UseKnowledgeBaseConfig, UseMCPClientConfig, UseMCPClientReturn, UseMCPToolsConfig, UseMCPToolsReturn, UseMCPUIIntentsConfig, UseMCPUIIntentsReturn, type UseMessageCheckpointsReturn, type UseMessageHistoryOptions, type UseMessageHistoryReturn, type UseMessageMetaReturn, type UseSkillStatusReturn, type UseSuggestionsOptions, type UseSuggestionsReturn, type UseThreadManagerConfig, type UseThreadManagerReturn, type UseToolConfig, type UseToolExecutorReturn, type UseToolWithSchemaConfig, createMessageIntentHandler, createPermissionStorage, createReactChat, createReactChatState, createReactThreadManager, createReactThreadManagerState, createServerAdapter, createSessionPermissionCache, createToolIntentHandler, defaultMessageHistoryConfig, defineSkill, formatKnowledgeResultsForAI, initialAgentLoopState, isCompactionMarker, keepToolPairsAtomic, searchKnowledgeBase, toDisplayMessage, toLLMMessage, toLLMMessages, useAIAction, useAIActions, useAIContext, useAIContexts, useAITools, useAgent, useCapabilities, useChat, useContextStats, useCopilot, useCopilotEvent, useDevLogger, useFeatureSupport, useKnowledgeBase, useMCPClient, useMCPTools, useMCPUIIntents, useMessageCheckpoints, useMessageHistory, useMessageHistoryContext, useMessageMeta, useSkill, useSkillStatus, useSuggestions, useSupportedMediaTypes, useThreadManager, useTool, useToolExecutor, useToolWithSchema, useTools, useToolsWithSchema };
3677
+ export { type AIContextItem, AbstractAgentLoop, AbstractChat, ActionDefinition, type AgentLoopActions, type AgentLoopCallbacks, type AgentLoopState, AsyncThreadStorageAdapter, BranchInfo, type CapabilitiesResponse, CapturedContext, type ChatActions, type ChatCallbacks, type ChatConfig, type ChatState, type ChatStatus, type ToolExecution as ChatToolExecution, type ToolResponse as ChatToolResponse, type CombinedChatState, type CompactedToolResult, type CompactionEvent, type CompactionMarker, type CompactionStrategy, type ContextStats, ContextUsage, type CopilotContextValue, CopilotProvider, type CopilotProviderProps, type AgentLoopState$1 as CoreAgentLoopState, type ChatState$1 as CoreChatState, type DevLoggerState, type DisplayMessage, IntentDetectionResult, type KnowledgeBaseConfig, type KnowledgeBaseResult, type KnowledgeBaseSearchResponse, LLMConfig, type LLMMessage, Message, type MessageCheckpoint, type MessageHistoryConfig, MessageHistoryContext, type MessageHistoryContextValue, MessageMetaStore, type MessageTokenUsage, PermissionLevel, PermissionStorageAdapter, PermissionStorageConfig, type ProviderCapabilities, ReactChat, type ReactChatConfig, ReactChatState, ReactThreadManager, type ReactThreadManagerConfig, ReactThreadManagerState, ResolvedSkill, type ServerAdapterConfig, type SessionCompactionState, SkillDefinition, SkillProvider, type SkillProviderProps, Source, type StreamChunkWithMessageId, type StreamEventHandler, type Suggestion, Thread, ThreadData, type TokenUsage, ToolConsentRequest, ToolConsentResponse, ToolContext, ToolDefinition, ToolExecution$1 as ToolExecution, ToolResponse$1 as ToolResponse, ToolSet, ToolType, type ToolsActions, ToolsConfig, type ToolsState, UIMessage, UnifiedToolCall, type UseAIToolsOptions, type UseAIToolsReturn, type UseAgentOptions, type UseAgentReturn, type UseChatConfig, type UseChatReturn, type UseKnowledgeBaseConfig, UseMCPClientConfig, UseMCPClientReturn, UseMCPToolsConfig, UseMCPToolsReturn, UseMCPUIIntentsConfig, UseMCPUIIntentsReturn, type UseMessageCheckpointsReturn, type UseMessageHistoryOptions, type UseMessageHistoryReturn, type UseMessageMetaReturn, type UseSkillStatusReturn, type UseSuggestionsOptions, type UseSuggestionsReturn, type UseThreadManagerConfig, type UseThreadManagerReturn, type UseThreadReturn, type UseToolConfig, type UseToolExecutorReturn, type UseToolWithSchemaConfig, createMessageIntentHandler, createPermissionStorage, createReactChat, createReactChatState, createReactThreadManager, createReactThreadManagerState, createServerAdapter, createSessionPermissionCache, createToolIntentHandler, defaultMessageHistoryConfig, defineSkill, formatKnowledgeResultsForAI, initialAgentLoopState, isCompactionMarker, keepToolPairsAtomic, searchKnowledgeBase, toDisplayMessage, toLLMMessage, toLLMMessages, useAIAction, useAIActions, useAIContext, useAIContexts, useAITools, useAgent, useCapabilities, useChat, useContextStats, useCopilot, useCopilotEvent, useDevLogger, useFeatureSupport, useKnowledgeBase, useMCPClient, useMCPTools, useMCPUIIntents, useMessageCheckpoints, useMessageHistory, useMessageHistoryContext, useMessageMeta, useSkill, useSkillStatus, useSuggestions, useSupportedMediaTypes, useThread, useThreadManager, useTool, useToolExecutor, useToolWithSchema, useTools, useToolsWithSchema };