@scenemesh/entity-engine-aimodule 1.0.0

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 (109) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +854 -0
  3. package/dist/ai-core-LBGYFGOK.mjs +17 -0
  4. package/dist/ai-core-LBGYFGOK.mjs.map +1 -0
  5. package/dist/ai-core-UGJWSCQN.js +17 -0
  6. package/dist/ai-core-UGJWSCQN.js.map +1 -0
  7. package/dist/ai-core-manager-B3Z34RHA.mjs +9 -0
  8. package/dist/ai-core-manager-B3Z34RHA.mjs.map +1 -0
  9. package/dist/ai-core-manager-W7SSDCG5.js +9 -0
  10. package/dist/ai-core-manager-W7SSDCG5.js.map +1 -0
  11. package/dist/ai-embeddings-5ED5LDXX.mjs +17 -0
  12. package/dist/ai-embeddings-5ED5LDXX.mjs.map +1 -0
  13. package/dist/ai-embeddings-WCXZMMTZ.js +17 -0
  14. package/dist/ai-embeddings-WCXZMMTZ.js.map +1 -0
  15. package/dist/ai-form-renderer-24IWNMX5.js +233 -0
  16. package/dist/ai-form-renderer-24IWNMX5.js.map +1 -0
  17. package/dist/ai-form-renderer-BORQABF2.mjs +233 -0
  18. package/dist/ai-form-renderer-BORQABF2.mjs.map +1 -0
  19. package/dist/ai-provider-3PSCVEEN.mjs +17 -0
  20. package/dist/ai-provider-3PSCVEEN.mjs.map +1 -0
  21. package/dist/ai-provider-WMPMVZFL.js +17 -0
  22. package/dist/ai-provider-WMPMVZFL.js.map +1 -0
  23. package/dist/ai-renderer-7WGGWH5D.mjs +134 -0
  24. package/dist/ai-renderer-7WGGWH5D.mjs.map +1 -0
  25. package/dist/ai-renderer-OILYWAJV.js +134 -0
  26. package/dist/ai-renderer-OILYWAJV.js.map +1 -0
  27. package/dist/ai-settings-DGCFPK3U.js +15 -0
  28. package/dist/ai-settings-DGCFPK3U.js.map +1 -0
  29. package/dist/ai-settings-DTXEAB64.mjs +15 -0
  30. package/dist/ai-settings-DTXEAB64.mjs.map +1 -0
  31. package/dist/ai-structured-EGZ26ZS4.mjs +13 -0
  32. package/dist/ai-structured-EGZ26ZS4.mjs.map +1 -0
  33. package/dist/ai-structured-N2FZLO4A.js +13 -0
  34. package/dist/ai-structured-N2FZLO4A.js.map +1 -0
  35. package/dist/ai-tools-B3R77HZ3.js +19 -0
  36. package/dist/ai-tools-B3R77HZ3.js.map +1 -0
  37. package/dist/ai-tools-JAPVYQGE.mjs +19 -0
  38. package/dist/ai-tools-JAPVYQGE.mjs.map +1 -0
  39. package/dist/ai.module-GAHVCBTP.js +7 -0
  40. package/dist/ai.module-GAHVCBTP.js.map +1 -0
  41. package/dist/ai.module-TTPMTPB3.mjs +7 -0
  42. package/dist/ai.module-TTPMTPB3.mjs.map +1 -0
  43. package/dist/chunk-25C2NRSD.mjs +611 -0
  44. package/dist/chunk-25C2NRSD.mjs.map +1 -0
  45. package/dist/chunk-4JQ7UOXH.js +427 -0
  46. package/dist/chunk-4JQ7UOXH.js.map +1 -0
  47. package/dist/chunk-6IUKES2L.js +290 -0
  48. package/dist/chunk-6IUKES2L.js.map +1 -0
  49. package/dist/chunk-COWPK7XN.mjs +834 -0
  50. package/dist/chunk-COWPK7XN.mjs.map +1 -0
  51. package/dist/chunk-CTEXPMVZ.js +512 -0
  52. package/dist/chunk-CTEXPMVZ.js.map +1 -0
  53. package/dist/chunk-DXQTHA75.js +573 -0
  54. package/dist/chunk-DXQTHA75.js.map +1 -0
  55. package/dist/chunk-DZFQ6I23.js +72 -0
  56. package/dist/chunk-DZFQ6I23.js.map +1 -0
  57. package/dist/chunk-J323UTPE.mjs +650 -0
  58. package/dist/chunk-J323UTPE.mjs.map +1 -0
  59. package/dist/chunk-LHNNALVF.js +834 -0
  60. package/dist/chunk-LHNNALVF.js.map +1 -0
  61. package/dist/chunk-O7SZSMXV.js +1621 -0
  62. package/dist/chunk-O7SZSMXV.js.map +1 -0
  63. package/dist/chunk-OTNOFOVW.js +650 -0
  64. package/dist/chunk-OTNOFOVW.js.map +1 -0
  65. package/dist/chunk-PRIGZEI4.mjs +72 -0
  66. package/dist/chunk-PRIGZEI4.mjs.map +1 -0
  67. package/dist/chunk-SBSZ3IPB.mjs +573 -0
  68. package/dist/chunk-SBSZ3IPB.mjs.map +1 -0
  69. package/dist/chunk-SXPA6SSD.mjs +1621 -0
  70. package/dist/chunk-SXPA6SSD.mjs.map +1 -0
  71. package/dist/chunk-T5A4KAVS.mjs +512 -0
  72. package/dist/chunk-T5A4KAVS.mjs.map +1 -0
  73. package/dist/chunk-TDRKKUNT.mjs +357 -0
  74. package/dist/chunk-TDRKKUNT.mjs.map +1 -0
  75. package/dist/chunk-TJFNODPE.js +357 -0
  76. package/dist/chunk-TJFNODPE.js.map +1 -0
  77. package/dist/chunk-V2SSI3SL.mjs +427 -0
  78. package/dist/chunk-V2SSI3SL.mjs.map +1 -0
  79. package/dist/chunk-X42L6MTY.mjs +290 -0
  80. package/dist/chunk-X42L6MTY.mjs.map +1 -0
  81. package/dist/chunk-YSVMY77H.js +611 -0
  82. package/dist/chunk-YSVMY77H.js.map +1 -0
  83. package/dist/core-ANYRS6EF.mjs +73 -0
  84. package/dist/core-ANYRS6EF.mjs.map +1 -0
  85. package/dist/core-K5K34DCS.js +73 -0
  86. package/dist/core-K5K34DCS.js.map +1 -0
  87. package/dist/core-index.d.mts +1668 -0
  88. package/dist/core-index.d.ts +1668 -0
  89. package/dist/core-index.js +101 -0
  90. package/dist/core-index.js.map +1 -0
  91. package/dist/core-index.mjs +101 -0
  92. package/dist/core-index.mjs.map +1 -0
  93. package/dist/index.d.mts +2911 -0
  94. package/dist/index.d.ts +2911 -0
  95. package/dist/index.js +1177 -0
  96. package/dist/index.js.map +1 -0
  97. package/dist/index.mjs +1177 -0
  98. package/dist/index.mjs.map +1 -0
  99. package/dist/tools-352X7A6X.mjs +366 -0
  100. package/dist/tools-352X7A6X.mjs.map +1 -0
  101. package/dist/tools-YLEX6GNO.js +366 -0
  102. package/dist/tools-YLEX6GNO.js.map +1 -0
  103. package/dist/ui-index.d.mts +627 -0
  104. package/dist/ui-index.d.ts +627 -0
  105. package/dist/ui-index.js +2354 -0
  106. package/dist/ui-index.js.map +1 -0
  107. package/dist/ui-index.mjs +2353 -0
  108. package/dist/ui-index.mjs.map +1 -0
  109. package/package.json +105 -0
package/dist/index.js ADDED
@@ -0,0 +1,1177 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+
16
+
17
+
18
+
19
+ var _chunkDZFQ6I23js = require('./chunk-DZFQ6I23.js');
20
+
21
+
22
+ var _chunkDXQTHA75js = require('./chunk-DXQTHA75.js');
23
+
24
+
25
+ var _chunk6IUKES2Ljs = require('./chunk-6IUKES2L.js');
26
+
27
+
28
+ var _chunkYSVMY77Hjs = require('./chunk-YSVMY77H.js');
29
+
30
+
31
+
32
+ var _chunkTJFNODPEjs = require('./chunk-TJFNODPE.js');
33
+
34
+
35
+
36
+ var _chunkLHNNALVFjs = require('./chunk-LHNNALVF.js');
37
+
38
+
39
+ var _chunkOTNOFOVWjs = require('./chunk-OTNOFOVW.js');
40
+
41
+
42
+ var _chunk4JQ7UOXHjs = require('./chunk-4JQ7UOXH.js');
43
+
44
+
45
+ var _chunkCTEXPMVZjs = require('./chunk-CTEXPMVZ.js');
46
+
47
+ // src/utils/warnings.ts
48
+ var WarningManager = class {
49
+ constructor() {
50
+ this.warnings = [];
51
+ this.handler = null;
52
+ this.maxWarnings = 100;
53
+ }
54
+ // Maximum warnings to prevent memory leaks
55
+ /**
56
+ * Initialize warning system
57
+ */
58
+ initialize() {
59
+ if (typeof globalThis !== "undefined") {
60
+ const globalHandler = globalThis.AI_SDK_LOG_WARNINGS;
61
+ if (globalHandler !== void 0) {
62
+ this.handler = globalHandler;
63
+ } else {
64
+ this.handler = true;
65
+ }
66
+ } else {
67
+ this.handler = true;
68
+ }
69
+ }
70
+ /**
71
+ * Set warning handler
72
+ */
73
+ setHandler(handler) {
74
+ this.handler = handler;
75
+ }
76
+ /**
77
+ * Add warning
78
+ */
79
+ warn(type, message, details, source) {
80
+ const warning = {
81
+ type,
82
+ message,
83
+ details,
84
+ timestamp: Date.now(),
85
+ source
86
+ };
87
+ this.warnings.push(warning);
88
+ if (this.warnings.length > this.maxWarnings) {
89
+ this.warnings = this.warnings.slice(-this.maxWarnings);
90
+ }
91
+ this.processWarning(warning);
92
+ }
93
+ /**
94
+ * Process warning
95
+ */
96
+ processWarning(warning) {
97
+ if (this.handler === false) {
98
+ return;
99
+ }
100
+ if (typeof this.handler === "function") {
101
+ try {
102
+ this.handler([warning]);
103
+ } catch (error) {
104
+ this.defaultHandler([warning]);
105
+ }
106
+ } else {
107
+ this.defaultHandler([warning]);
108
+ }
109
+ }
110
+ /**
111
+ * Default warning handler
112
+ */
113
+ defaultHandler(warnings) {
114
+ warnings.forEach((warning) => {
115
+ const prefix = "AI SDK Warning:";
116
+ const message = `${prefix} ${warning.message}`;
117
+ });
118
+ }
119
+ /**
120
+ * Get all warnings
121
+ */
122
+ getWarnings() {
123
+ return [...this.warnings];
124
+ }
125
+ /**
126
+ * Clear warnings
127
+ */
128
+ clearWarnings() {
129
+ this.warnings = [];
130
+ }
131
+ /**
132
+ * Get warnings by type
133
+ */
134
+ getWarningsByType(type) {
135
+ return this.warnings.filter((w) => w.type === type);
136
+ }
137
+ /**
138
+ * Get warning statistics
139
+ */
140
+ getWarningStats() {
141
+ const stats = {};
142
+ this.warnings.forEach((warning) => {
143
+ stats[warning.type] = (stats[warning.type] || 0) + 1;
144
+ });
145
+ return stats;
146
+ }
147
+ };
148
+ var warningManager = new WarningManager();
149
+ if (typeof globalThis !== "undefined") {
150
+ warningManager.initialize();
151
+ }
152
+ function warnUnsupportedSetting(setting, model) {
153
+ warningManager.warn(
154
+ "unsupported-setting",
155
+ `The "${setting}" setting is not supported${model ? ` by the ${model} model` : ""}`,
156
+ { setting, model },
157
+ "entity-engine-aiui"
158
+ );
159
+ }
160
+ function warnUnsupportedTool(toolName, model) {
161
+ warningManager.warn(
162
+ "unsupported-tool",
163
+ `The tool "${toolName}" is not supported${model ? ` by the ${model} model` : ""}`,
164
+ { toolName, model },
165
+ "entity-engine-aiui"
166
+ );
167
+ }
168
+ function warnDeprecatedFeature(feature, replacement) {
169
+ const message = `The "${feature}" feature is deprecated${replacement ? ` and will be replaced with "${replacement}"` : ""}`;
170
+ warningManager.warn(
171
+ "deprecated-feature",
172
+ message,
173
+ { feature, replacement },
174
+ "entity-engine-aiui"
175
+ );
176
+ }
177
+ function warnValidationError(message, details) {
178
+ warningManager.warn(
179
+ "validation-error",
180
+ message,
181
+ details,
182
+ "entity-engine-aiui"
183
+ );
184
+ }
185
+ function warnPerformance(message, details) {
186
+ warningManager.warn(
187
+ "performance-warning",
188
+ message,
189
+ details,
190
+ "entity-engine-aiui"
191
+ );
192
+ }
193
+ function warn(message, details) {
194
+ warningManager.warn(
195
+ "unknown",
196
+ message,
197
+ details,
198
+ "entity-engine-aiui"
199
+ );
200
+ }
201
+ function setWarningHandler(handler) {
202
+ warningManager.setHandler(handler);
203
+ }
204
+ function getWarnings() {
205
+ return warningManager.getWarnings();
206
+ }
207
+ function clearWarnings() {
208
+ warningManager.clearWarnings();
209
+ }
210
+ function getWarningStats() {
211
+ return warningManager.getWarningStats();
212
+ }
213
+ if (process.env.NODE_ENV === "development") {
214
+ if (typeof globalThis !== "undefined") {
215
+ globalThis.__ENTITY_ENGINE_AIUI_WARNINGS__ = {
216
+ manager: warningManager,
217
+ getWarnings,
218
+ clearWarnings,
219
+ getWarningStats,
220
+ setWarningHandler
221
+ };
222
+ }
223
+ const originalWarn = warningManager.warn.bind(warningManager);
224
+ warningManager.warn = (type, message, details, source) => {
225
+ const stack = new Error().stack;
226
+ const enhancedDetails = {
227
+ ...details,
228
+ stack: _optionalChain([stack, 'optionalAccess', _ => _.split, 'call', _2 => _2("\n"), 'access', _3 => _3.slice, 'call', _4 => _4(2, 5), 'access', _5 => _5.join, 'call', _6 => _6("\n")])
229
+ // Keep only first 3 stack levels
230
+ };
231
+ originalWarn(type, message, enhancedDetails, source);
232
+ };
233
+ }
234
+
235
+ // src/utils/streaming.ts
236
+ var UIMessageStreamReader = class {
237
+ constructor(options) {
238
+ this.options = options;
239
+ this.reader = null;
240
+ this.currentMessage = null;
241
+ this.isReading = false;
242
+ this.currentMessage = options.message || null;
243
+ }
244
+ /**
245
+ * Start reading stream
246
+ */
247
+ async *read() {
248
+ if (this.isReading) {
249
+ throw new Error("Stream is already being read");
250
+ }
251
+ this.isReading = true;
252
+ this.reader = this.options.stream.getReader();
253
+ try {
254
+ let done = false;
255
+ while (!done) {
256
+ const { value, done: streamDone } = await this.reader.read();
257
+ done = streamDone;
258
+ if (value) {
259
+ const message = this.processChunk(value);
260
+ if (message) {
261
+ _optionalChain([this, 'access', _7 => _7.options, 'access', _8 => _8.onMessage, 'optionalCall', _9 => _9(message)]);
262
+ yield message;
263
+ }
264
+ }
265
+ }
266
+ if (this.currentMessage) {
267
+ _optionalChain([this, 'access', _10 => _10.options, 'access', _11 => _11.onComplete, 'optionalCall', _12 => _12(this.currentMessage)]);
268
+ }
269
+ } catch (error) {
270
+ const err = error instanceof Error ? error : new Error(String(error));
271
+ _optionalChain([this, 'access', _13 => _13.options, 'access', _14 => _14.onError, 'optionalCall', _15 => _15(err)]);
272
+ throw err;
273
+ } finally {
274
+ this.cleanup();
275
+ }
276
+ }
277
+ /**
278
+ * Process stream chunk
279
+ */
280
+ processChunk(chunk) {
281
+ try {
282
+ if (typeof chunk === "string") {
283
+ chunk = JSON.parse(chunk);
284
+ }
285
+ if (chunk instanceof Uint8Array) {
286
+ const decoder = new TextDecoder();
287
+ chunk = JSON.parse(decoder.decode(chunk));
288
+ }
289
+ if (chunk.type) {
290
+ return this.handleStreamData(chunk);
291
+ }
292
+ return null;
293
+ } catch (error) {
294
+ return null;
295
+ }
296
+ }
297
+ /**
298
+ * Handle stream data
299
+ */
300
+ handleStreamData(data) {
301
+ switch (data.type) {
302
+ case "message-start":
303
+ return this.handleMessageStart(data);
304
+ case "message-delta":
305
+ return this.handleMessageDelta(data);
306
+ case "message-stop":
307
+ return this.handleMessageStop(data);
308
+ case "text-delta":
309
+ return this.handleTextDelta(data);
310
+ case "tool-call":
311
+ return this.handleToolCall(data);
312
+ case "tool-result":
313
+ return this.handleToolResult(data);
314
+ default:
315
+ return null;
316
+ }
317
+ }
318
+ /**
319
+ * Handle message start
320
+ */
321
+ handleMessageStart(data) {
322
+ this.currentMessage = {
323
+ id: data.messageId || this.generateId(),
324
+ role: data.role || "assistant",
325
+ parts: [],
326
+ metadata: data.metadata || {},
327
+ ...data
328
+ };
329
+ return { ...this.currentMessage };
330
+ }
331
+ /**
332
+ * Handle message delta
333
+ */
334
+ handleMessageDelta(data) {
335
+ if (!this.currentMessage) {
336
+ return null;
337
+ }
338
+ if (data.content) {
339
+ let textPart = this.currentMessage.parts.find((p) => p.type === "text");
340
+ if (!textPart) {
341
+ textPart = { type: "text", text: "" };
342
+ this.currentMessage.parts.push(textPart);
343
+ }
344
+ textPart.text += data.content;
345
+ }
346
+ return { ...this.currentMessage };
347
+ }
348
+ /**
349
+ * Handle message stop
350
+ */
351
+ handleMessageStop(data) {
352
+ if (!this.currentMessage) {
353
+ return null;
354
+ }
355
+ if (data.finishReason) {
356
+ this.currentMessage.metadata = {
357
+ ...this.currentMessage.metadata || {},
358
+ finishReason: data.finishReason
359
+ };
360
+ }
361
+ return { ...this.currentMessage };
362
+ }
363
+ /**
364
+ * Handle text delta
365
+ */
366
+ handleTextDelta(data) {
367
+ if (!this.currentMessage) {
368
+ this.currentMessage = {
369
+ id: this.generateId(),
370
+ role: "assistant",
371
+ parts: [{ type: "text", text: data.text || "" }]
372
+ };
373
+ } else {
374
+ let textPart = this.currentMessage.parts.find((p) => p.type === "text");
375
+ if (!textPart) {
376
+ textPart = { type: "text", text: "" };
377
+ this.currentMessage.parts.push(textPart);
378
+ }
379
+ textPart.text += data.text || "";
380
+ }
381
+ return { ...this.currentMessage };
382
+ }
383
+ /**
384
+ * Handle tool call
385
+ */
386
+ handleToolCall(data) {
387
+ if (!this.currentMessage) {
388
+ this.currentMessage = {
389
+ id: this.generateId(),
390
+ role: "assistant",
391
+ parts: []
392
+ };
393
+ }
394
+ const toolPart = {
395
+ type: "dynamic-tool",
396
+ toolCallId: data.toolCallId,
397
+ toolName: data.toolName,
398
+ input: data.input,
399
+ state: "input-available"
400
+ };
401
+ this.currentMessage.parts.push(toolPart);
402
+ return { ...this.currentMessage };
403
+ }
404
+ /**
405
+ * Handle tool result
406
+ */
407
+ handleToolResult(data) {
408
+ if (!this.currentMessage) {
409
+ return null;
410
+ }
411
+ const toolPart = this.currentMessage.parts.find(
412
+ (p) => p.type.startsWith("tool-") && p.toolCallId === data.toolCallId
413
+ );
414
+ if (toolPart) {
415
+ toolPart.output = data.result;
416
+ toolPart.state = data.error ? "output-error" : "output-available";
417
+ if (data.error) {
418
+ toolPart.errorText = data.error;
419
+ }
420
+ }
421
+ return { ...this.currentMessage };
422
+ }
423
+ /**
424
+ * Generate ID
425
+ */
426
+ generateId() {
427
+ return Math.random().toString(36).substr(2, 9);
428
+ }
429
+ /**
430
+ * Stop reading
431
+ */
432
+ async stop() {
433
+ if (this.reader) {
434
+ await this.reader.cancel();
435
+ }
436
+ this.cleanup();
437
+ }
438
+ /**
439
+ * Cleanup resources
440
+ */
441
+ cleanup() {
442
+ this.isReading = false;
443
+ if (this.reader) {
444
+ this.reader.releaseLock();
445
+ this.reader = null;
446
+ }
447
+ }
448
+ };
449
+ async function* readUIMessageStream(options) {
450
+ const reader = new UIMessageStreamReader(options);
451
+ yield* reader.read();
452
+ }
453
+ async function resumeStream({
454
+ chatId,
455
+ messageId,
456
+ endpoint = "/api/chat/resume",
457
+ headers = {}
458
+ }) {
459
+ const response = await fetch(endpoint, {
460
+ method: "POST",
461
+ headers: {
462
+ "Content-Type": "application/json",
463
+ ...headers
464
+ },
465
+ body: JSON.stringify({
466
+ chatId,
467
+ messageId
468
+ })
469
+ });
470
+ if (!response.ok) {
471
+ throw new Error(`Resume request failed: ${response.status}`);
472
+ }
473
+ if (!response.body) {
474
+ throw new Error("No response body received");
475
+ }
476
+ return response.body;
477
+ }
478
+ var StreamStateManager = class {
479
+ constructor() {
480
+ this.state = "idle";
481
+ this.listeners = /* @__PURE__ */ new Set();
482
+ this.abortController = null;
483
+ }
484
+ /**
485
+ * Get current state
486
+ */
487
+ getState() {
488
+ return this.state;
489
+ }
490
+ /**
491
+ * Set state
492
+ */
493
+ setState(newState) {
494
+ if (this.state !== newState) {
495
+ this.state = newState;
496
+ this.notifyListeners();
497
+ }
498
+ }
499
+ /**
500
+ * Listen to state changes
501
+ */
502
+ onStateChange(listener) {
503
+ this.listeners.add(listener);
504
+ return () => {
505
+ this.listeners.delete(listener);
506
+ };
507
+ }
508
+ /**
509
+ * Start stream
510
+ */
511
+ startStream() {
512
+ this.abortController = new AbortController();
513
+ this.setState("connecting");
514
+ return this.abortController;
515
+ }
516
+ /**
517
+ * Abort stream
518
+ */
519
+ abortStream() {
520
+ if (this.abortController) {
521
+ this.abortController.abort();
522
+ this.abortController = null;
523
+ }
524
+ this.setState("aborted");
525
+ }
526
+ /**
527
+ * Complete stream
528
+ */
529
+ completeStream() {
530
+ this.abortController = null;
531
+ this.setState("complete");
532
+ }
533
+ /**
534
+ * Stream error
535
+ */
536
+ errorStream() {
537
+ this.abortController = null;
538
+ this.setState("error");
539
+ }
540
+ /**
541
+ * Reset state
542
+ */
543
+ reset() {
544
+ this.abortController = null;
545
+ this.setState("idle");
546
+ }
547
+ /**
548
+ * Notify listeners
549
+ */
550
+ notifyListeners() {
551
+ this.listeners.forEach((listener) => {
552
+ try {
553
+ listener(this.state);
554
+ } catch (error) {
555
+ }
556
+ });
557
+ }
558
+ /**
559
+ * Dispose
560
+ */
561
+ dispose() {
562
+ this.abortController = null;
563
+ this.listeners.clear();
564
+ this.setState("idle");
565
+ }
566
+ };
567
+
568
+ // src/utils/persistence.ts
569
+ function createIdGenerator(options = {}) {
570
+ const { prefix = "", size = 12 } = options;
571
+ return () => {
572
+ const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
573
+ let result = "";
574
+ for (let i = 0; i < size; i++) {
575
+ result += chars.charAt(Math.floor(Math.random() * chars.length));
576
+ }
577
+ return prefix ? `${prefix}-${result}` : result;
578
+ };
579
+ }
580
+ function generateId() {
581
+ return createIdGenerator()();
582
+ }
583
+ async function validateUIMessages({
584
+ messages,
585
+ tools,
586
+ dataPartsSchema,
587
+ metadataSchema
588
+ }) {
589
+ const validatedMessages = [];
590
+ for (const message of messages) {
591
+ try {
592
+ const validatedMessage = await validateSingleMessage(message, {
593
+ tools,
594
+ dataPartsSchema,
595
+ metadataSchema
596
+ });
597
+ validatedMessages.push(validatedMessage);
598
+ } catch (error) {
599
+ validatedMessages.push(sanitizeMessage(message));
600
+ }
601
+ }
602
+ return validatedMessages;
603
+ }
604
+ async function validateSingleMessage(message, options) {
605
+ const { tools, dataPartsSchema, metadataSchema } = options;
606
+ if (!message.id || !message.role || !Array.isArray(message.parts)) {
607
+ throw new Error("Invalid message structure");
608
+ }
609
+ const validatedParts = [];
610
+ for (const part of message.parts) {
611
+ const validatedPart = await validateMessagePart(part, tools);
612
+ validatedParts.push(validatedPart);
613
+ }
614
+ let validatedMetadata = message.metadata;
615
+ if (metadataSchema && message.metadata) {
616
+ try {
617
+ validatedMetadata = metadataSchema.parse(message.metadata);
618
+ } catch (error) {
619
+ validatedMetadata = void 0;
620
+ }
621
+ }
622
+ return {
623
+ ...message,
624
+ parts: validatedParts,
625
+ metadata: validatedMetadata
626
+ };
627
+ }
628
+ async function validateMessagePart(part, tools) {
629
+ if (part.type === "text") {
630
+ if (typeof part.text !== "string") {
631
+ throw new Error("Text part must have a string text property");
632
+ }
633
+ return part;
634
+ }
635
+ if (part.type === "file") {
636
+ if (!part.filename || !part.url) {
637
+ throw new Error("File part must have filename and url properties");
638
+ }
639
+ return part;
640
+ }
641
+ if (part.type.startsWith("tool-") || part.type === "dynamic-tool") {
642
+ const toolName = part.type === "dynamic-tool" ? part.toolName : part.type.replace("tool-", "");
643
+ if (tools && toolName && !tools[toolName]) {
644
+ console.warn(`Tool ${toolName} not found in provided tools`);
645
+ }
646
+ return part;
647
+ }
648
+ if (part.type.startsWith("data-")) {
649
+ if (!part.data) {
650
+ throw new Error("Data part must have a data property");
651
+ }
652
+ return part;
653
+ }
654
+ return part;
655
+ }
656
+ function sanitizeMessage(message) {
657
+ const sanitizedParts = message.parts.filter(
658
+ (part) => (
659
+ // 保留有效的部分类型
660
+ part && typeof part === "object" && part.type
661
+ )
662
+ );
663
+ return {
664
+ ...message,
665
+ parts: sanitizedParts.length > 0 ? sanitizedParts : [
666
+ { type: "text", text: "[Message content could not be validated]" }
667
+ ]
668
+ };
669
+ }
670
+ var TypeValidationError = class extends Error {
671
+ constructor(message, details) {
672
+ super(message);
673
+ this.details = details;
674
+ this.name = "TypeValidationError";
675
+ }
676
+ };
677
+ var InMemoryMessageStore = class {
678
+ constructor() {
679
+ this.chats = /* @__PURE__ */ new Map();
680
+ this.metadata = /* @__PURE__ */ new Map();
681
+ }
682
+ async createChat() {
683
+ const id = generateId();
684
+ this.chats.set(id, []);
685
+ this.metadata.set(id, { updatedAt: /* @__PURE__ */ new Date() });
686
+ return id;
687
+ }
688
+ async loadChat(id) {
689
+ const messages = this.chats.get(id);
690
+ if (!messages) {
691
+ throw new Error(`Chat ${id} not found`);
692
+ }
693
+ return [...messages];
694
+ }
695
+ async saveChat({ chatId, messages }) {
696
+ this.chats.set(chatId, [...messages]);
697
+ const existing = this.metadata.get(chatId) || {};
698
+ this.metadata.set(chatId, {
699
+ ...existing,
700
+ updatedAt: /* @__PURE__ */ new Date(),
701
+ title: existing.title || this.extractTitle(messages)
702
+ });
703
+ }
704
+ async deleteChat(id) {
705
+ this.chats.delete(id);
706
+ this.metadata.delete(id);
707
+ }
708
+ async listChats() {
709
+ return Array.from(this.metadata.entries()).map(([id, meta]) => ({
710
+ id,
711
+ ...meta
712
+ }));
713
+ }
714
+ extractTitle(messages) {
715
+ const firstUserMessage = messages.find((m) => m.role === "user");
716
+ if (firstUserMessage) {
717
+ const textPart = firstUserMessage.parts.find((p) => p.type === "text");
718
+ if (_optionalChain([textPart, 'optionalAccess', _16 => _16.text])) {
719
+ return textPart.text.slice(0, 50) + (textPart.text.length > 50 ? "..." : "");
720
+ }
721
+ }
722
+ return "Untitled Chat";
723
+ }
724
+ };
725
+ var LocalStorageMessageStore = class {
726
+ constructor() {
727
+ this.keyPrefix = "entity-engine-aiui-chat-";
728
+ }
729
+ async createChat() {
730
+ const id = generateId();
731
+ const key = this.keyPrefix + id;
732
+ const chatData = {
733
+ id,
734
+ messages: [],
735
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
736
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
737
+ };
738
+ localStorage.setItem(key, JSON.stringify(chatData));
739
+ return id;
740
+ }
741
+ async loadChat(id) {
742
+ const key = this.keyPrefix + id;
743
+ const data = localStorage.getItem(key);
744
+ if (!data) {
745
+ throw new Error(`Chat ${id} not found`);
746
+ }
747
+ try {
748
+ const chatData = JSON.parse(data);
749
+ return chatData.messages || [];
750
+ } catch (error) {
751
+ throw new Error(`Failed to parse chat data: ${error}`);
752
+ }
753
+ }
754
+ async saveChat({ chatId, messages }) {
755
+ const key = this.keyPrefix + chatId;
756
+ const existing = localStorage.getItem(key);
757
+ const chatData = {
758
+ id: chatId,
759
+ messages,
760
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
761
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
762
+ };
763
+ if (existing) {
764
+ try {
765
+ const parsedExisting = JSON.parse(existing);
766
+ chatData.createdAt = parsedExisting.createdAt || chatData.createdAt;
767
+ } catch (e) {
768
+ }
769
+ }
770
+ localStorage.setItem(key, JSON.stringify(chatData));
771
+ }
772
+ async deleteChat(id) {
773
+ const key = this.keyPrefix + id;
774
+ localStorage.removeItem(key);
775
+ }
776
+ async listChats() {
777
+ const chats = [];
778
+ for (let i = 0; i < localStorage.length; i++) {
779
+ const key = localStorage.key(i);
780
+ if (_optionalChain([key, 'optionalAccess', _17 => _17.startsWith, 'call', _18 => _18(this.keyPrefix)])) {
781
+ try {
782
+ const data = localStorage.getItem(key);
783
+ if (data) {
784
+ const chatData = JSON.parse(data);
785
+ chats.push({
786
+ id: chatData.id,
787
+ title: this.extractTitle(chatData.messages || []),
788
+ updatedAt: new Date(chatData.updatedAt || chatData.createdAt)
789
+ });
790
+ }
791
+ } catch (e2) {
792
+ }
793
+ }
794
+ }
795
+ return chats.sort((a, b) => b.updatedAt.getTime() - a.updatedAt.getTime());
796
+ }
797
+ extractTitle(messages) {
798
+ const firstUserMessage = messages.find((m) => m.role === "user");
799
+ if (firstUserMessage) {
800
+ const textPart = firstUserMessage.parts.find((p) => p.type === "text");
801
+ if (_optionalChain([textPart, 'optionalAccess', _19 => _19.text])) {
802
+ return textPart.text.slice(0, 50) + (textPart.text.length > 50 ? "..." : "");
803
+ }
804
+ }
805
+ return "Untitled Chat";
806
+ }
807
+ };
808
+
809
+ // src/utils/index.ts
810
+ function extractMessageText(message) {
811
+ return message.parts.filter((part) => part.type === "text").map((part) => part.text).join("\n");
812
+ }
813
+ function hasToolCalls(message) {
814
+ return message.parts.some(
815
+ (part) => part.type.startsWith("tool-") || part.type === "dynamic-tool"
816
+ );
817
+ }
818
+ function getToolCalls(message) {
819
+ return message.parts.filter((part) => part.type.startsWith("tool-") || part.type === "dynamic-tool").map((part) => ({
820
+ toolName: part.type === "dynamic-tool" ? part.toolName : part.type.replace("tool-", ""),
821
+ state: part.state || "unknown",
822
+ input: part.input,
823
+ output: part.output
824
+ }));
825
+ }
826
+ function hasFileAttachments(message) {
827
+ return message.parts.some((part) => part.type === "file");
828
+ }
829
+ function getFileAttachments(message) {
830
+ return message.parts.filter((part) => part.type === "file").map((part) => part);
831
+ }
832
+ function formatTimestamp(timestamp, options) {
833
+ if (!timestamp) return "";
834
+ const date = new Date(timestamp);
835
+ const { format = "short", includeDate = false } = options || {};
836
+ switch (format) {
837
+ case "short":
838
+ return date.toLocaleTimeString([], {
839
+ hour: "2-digit",
840
+ minute: "2-digit",
841
+ ...includeDate && {
842
+ month: "short",
843
+ day: "numeric"
844
+ }
845
+ });
846
+ case "long":
847
+ return date.toLocaleString();
848
+ case "relative":
849
+ return formatRelativeTime(timestamp);
850
+ default:
851
+ return date.toLocaleTimeString();
852
+ }
853
+ }
854
+ function formatRelativeTime(timestamp) {
855
+ const now = Date.now();
856
+ const diff = now - timestamp;
857
+ const minute = 60 * 1e3;
858
+ const hour = minute * 60;
859
+ const day = hour * 24;
860
+ const week = day * 7;
861
+ const month = day * 30;
862
+ const year = day * 365;
863
+ if (diff < minute) {
864
+ return "Just now";
865
+ } else if (diff < hour) {
866
+ const minutes = Math.floor(diff / minute);
867
+ return `${minutes}m ago`;
868
+ } else if (diff < day) {
869
+ const hours = Math.floor(diff / hour);
870
+ return `${hours}h ago`;
871
+ } else if (diff < week) {
872
+ const days = Math.floor(diff / day);
873
+ return `${days}d ago`;
874
+ } else if (diff < month) {
875
+ const weeks = Math.floor(diff / week);
876
+ return `${weeks}w ago`;
877
+ } else if (diff < year) {
878
+ const months = Math.floor(diff / month);
879
+ return `${months}mo ago`;
880
+ } else {
881
+ const years = Math.floor(diff / year);
882
+ return `${years}y ago`;
883
+ }
884
+ }
885
+ function formatFileSize(bytes) {
886
+ if (bytes === 0) return "0 B";
887
+ const k = 1024;
888
+ const sizes = ["B", "KB", "MB", "GB", "TB"];
889
+ const i = Math.floor(Math.log(bytes) / Math.log(k));
890
+ return parseFloat((bytes / Math.pow(k, i)).toFixed(1)) + " " + sizes[i];
891
+ }
892
+ function getFileExtension(filename) {
893
+ return _optionalChain([filename, 'access', _20 => _20.split, 'call', _21 => _21("."), 'access', _22 => _22.pop, 'call', _23 => _23(), 'optionalAccess', _24 => _24.toLowerCase, 'call', _25 => _25()]) || "";
894
+ }
895
+ function isFileTypeAccepted(file, acceptedTypes) {
896
+ return acceptedTypes.some((type) => {
897
+ if (type.endsWith("/*")) {
898
+ return file.type.startsWith(type.slice(0, -1));
899
+ }
900
+ return file.type === type;
901
+ });
902
+ }
903
+ function createFileUrl(file) {
904
+ return URL.createObjectURL(file);
905
+ }
906
+ function revokeFileUrl(url) {
907
+ URL.revokeObjectURL(url);
908
+ }
909
+ function truncateText(text, maxLength) {
910
+ if (text.length <= maxLength) return text;
911
+ return text.slice(0, maxLength - 3) + "...";
912
+ }
913
+ function highlightSearchTerms(text, searchTerms) {
914
+ if (!searchTerms.length) return text;
915
+ let highlightedText = text;
916
+ searchTerms.forEach((term) => {
917
+ const regex = new RegExp(`(${term})`, "gi");
918
+ highlightedText = highlightedText.replace(regex, "<mark>$1</mark>");
919
+ });
920
+ return highlightedText;
921
+ }
922
+ function camelToSpaced(str) {
923
+ return str.replace(/([A-Z])/g, " $1").trim();
924
+ }
925
+ function isValidUrl(string) {
926
+ try {
927
+ new URL(string);
928
+ return true;
929
+ } catch (e3) {
930
+ return false;
931
+ }
932
+ }
933
+ function isValidJson(string) {
934
+ try {
935
+ JSON.parse(string);
936
+ return true;
937
+ } catch (e4) {
938
+ return false;
939
+ }
940
+ }
941
+ function safeJsonParse(string, fallback) {
942
+ try {
943
+ return JSON.parse(string);
944
+ } catch (e5) {
945
+ return fallback;
946
+ }
947
+ }
948
+ function cn(...classes) {
949
+ return classes.filter(Boolean).join(" ");
950
+ }
951
+ async function safeAsync(fn, fallback) {
952
+ try {
953
+ const data = await fn();
954
+ return { data };
955
+ } catch (error) {
956
+ return {
957
+ error: error instanceof Error ? error : new Error(String(error)),
958
+ ...fallback !== void 0 && { data: fallback }
959
+ };
960
+ }
961
+ }
962
+ function createErrorMessage(error) {
963
+ if (error instanceof Error) {
964
+ return error.message;
965
+ }
966
+ if (typeof error === "string") {
967
+ return error;
968
+ }
969
+ return "An unknown error occurred";
970
+ }
971
+ function debounce(func, delay) {
972
+ let timeoutId;
973
+ return function debouncedFunction(...args) {
974
+ clearTimeout(timeoutId);
975
+ timeoutId = setTimeout(() => func.apply(this, args), delay);
976
+ };
977
+ }
978
+ function throttle(func, delay) {
979
+ let inThrottle;
980
+ return function throttledFunction(...args) {
981
+ if (!inThrottle) {
982
+ func.apply(this, args);
983
+ inThrottle = true;
984
+ setTimeout(() => inThrottle = false, delay);
985
+ }
986
+ };
987
+ }
988
+ var storage = {
989
+ get(key, fallback) {
990
+ if (typeof window === "undefined") return fallback || null;
991
+ try {
992
+ const item = localStorage.getItem(key);
993
+ return item ? JSON.parse(item) : fallback || null;
994
+ } catch (e6) {
995
+ return fallback || null;
996
+ }
997
+ },
998
+ set(key, value) {
999
+ if (typeof window === "undefined") return false;
1000
+ try {
1001
+ localStorage.setItem(key, JSON.stringify(value));
1002
+ return true;
1003
+ } catch (e7) {
1004
+ return false;
1005
+ }
1006
+ },
1007
+ remove(key) {
1008
+ if (typeof window === "undefined") return false;
1009
+ try {
1010
+ localStorage.removeItem(key);
1011
+ return true;
1012
+ } catch (e8) {
1013
+ return false;
1014
+ }
1015
+ },
1016
+ clear() {
1017
+ if (typeof window === "undefined") return false;
1018
+ try {
1019
+ localStorage.clear();
1020
+ return true;
1021
+ } catch (e9) {
1022
+ return false;
1023
+ }
1024
+ }
1025
+ };
1026
+
1027
+ // src/types/index.ts
1028
+ var aimoduleError = class extends Error {
1029
+ constructor(message, code, details) {
1030
+ super(message);
1031
+ this.code = code;
1032
+ this.details = details;
1033
+ this.name = "aimoduleError";
1034
+ }
1035
+ };
1036
+ var aimoduleRuntimeError = class extends aimoduleError {
1037
+ constructor(message, details) {
1038
+ super(message, "RUNTIME_ERROR", details);
1039
+ this.name = "aimoduleRuntimeError";
1040
+ }
1041
+ };
1042
+
1043
+ // src/index.ts
1044
+ async function createEntityAIModule() {
1045
+ const { EntityAIModule: EntityAIModule2 } = await Promise.resolve().then(() => _interopRequireWildcard(require("./ai.module-GAHVCBTP.js")));
1046
+ return new EntityAIModule2();
1047
+ }
1048
+ var VERSION = "1.0.0";
1049
+ var PACKAGE_NAME = "@scenemesh/entity-engine-aimodule";
1050
+ var AI_SDK_COMPATIBLE_VERSION = "^5.0.10";
1051
+ async function createaimodule(config) {
1052
+ const { createAICore: createAICore2 } = await Promise.resolve().then(() => _interopRequireWildcard(require("./core-K5K34DCS.js")));
1053
+ const core = await createAICore2({
1054
+ providers: _optionalChain([config, 'optionalAccess', _26 => _26.providers]),
1055
+ settings: _optionalChain([config, 'optionalAccess', _27 => _27.settings]),
1056
+ enableEmbeddings: _optionalChain([config, 'optionalAccess', _28 => _28.enableEmbeddings]),
1057
+ enableTools: _optionalChain([config, 'optionalAccess', _29 => _29.enableTools])
1058
+ });
1059
+ const api = {
1060
+ generateText: (options) => core.aiSDK.generateText(options),
1061
+ streamText: (options) => core.aiSDK.streamText(options),
1062
+ generateObject: (options) => core.structuredData.generateObject(options),
1063
+ streamObject: (options) => core.structuredData.streamObject(options)
1064
+ };
1065
+ return {
1066
+ core,
1067
+ api
1068
+ };
1069
+ }
1070
+ async function createQuickAI(providers) {
1071
+ return createaimodule({
1072
+ providers,
1073
+ enableEmbeddings: true,
1074
+ enableTools: true
1075
+ });
1076
+ }
1077
+ var EntityEngineAIModule = {
1078
+ // 工厂函数
1079
+ create: createaimodule,
1080
+ createQuick: createQuickAI,
1081
+ // 版本信息
1082
+ VERSION,
1083
+ PACKAGE_NAME,
1084
+ AI_SDK_COMPATIBLE_VERSION,
1085
+ // 核心类导出(用于高级使用)
1086
+ Core: {
1087
+ AIProviderManagement: Promise.resolve().then(() => _interopRequireWildcard(require("./ai-provider-WMPMVZFL.js"))).then((m) => m.AIProviderManagement),
1088
+ AISDKIntegration: Promise.resolve().then(() => _interopRequireWildcard(require("./ai-core-UGJWSCQN.js"))).then((m) => m.AISDKIntegration),
1089
+ AIToolsIntegration: Promise.resolve().then(() => _interopRequireWildcard(require("./ai-tools-B3R77HZ3.js"))).then((m) => m.AIToolsIntegration),
1090
+ AIEmbeddingsIntegration: Promise.resolve().then(() => _interopRequireWildcard(require("./ai-embeddings-WCXZMMTZ.js"))).then((m) => m.AIEmbeddingsIntegration),
1091
+ AISettingsManagement: Promise.resolve().then(() => _interopRequireWildcard(require("./ai-settings-DGCFPK3U.js"))).then((m) => m.AISettingsManagement),
1092
+ AIStructuredDataIntegration: Promise.resolve().then(() => _interopRequireWildcard(require("./ai-structured-N2FZLO4A.js"))).then((m) => m.AIStructuredDataIntegration)
1093
+ }
1094
+ };
1095
+
1096
+
1097
+
1098
+
1099
+
1100
+
1101
+
1102
+
1103
+
1104
+
1105
+
1106
+
1107
+
1108
+
1109
+
1110
+
1111
+
1112
+
1113
+
1114
+
1115
+
1116
+
1117
+
1118
+
1119
+
1120
+
1121
+
1122
+
1123
+
1124
+
1125
+
1126
+
1127
+
1128
+
1129
+
1130
+
1131
+
1132
+
1133
+
1134
+
1135
+
1136
+
1137
+
1138
+
1139
+
1140
+
1141
+
1142
+
1143
+
1144
+
1145
+
1146
+
1147
+
1148
+
1149
+
1150
+
1151
+
1152
+
1153
+
1154
+
1155
+
1156
+
1157
+
1158
+
1159
+
1160
+
1161
+
1162
+
1163
+
1164
+
1165
+
1166
+
1167
+
1168
+
1169
+
1170
+
1171
+
1172
+
1173
+
1174
+
1175
+
1176
+ exports.AICoreManager = _chunkCTEXPMVZjs.AICoreManager; exports.AIEmbeddingsIntegration = _chunkTJFNODPEjs.AIEmbeddingsIntegration; exports.AIProviderManagement = _chunkOTNOFOVWjs.AIProviderManagement; exports.AISDKIntegration = _chunk6IUKES2Ljs.AISDKIntegration; exports.AISettingsManagement = _chunkLHNNALVFjs.AISettingsManagement; exports.AIStructuredDataIntegration = _chunk4JQ7UOXHjs.AIStructuredDataIntegration; exports.AIToolsIntegration = _chunkYSVMY77Hjs.AIToolsIntegration; exports.AI_SDK_COMPATIBLE_VERSION = AI_SDK_COMPATIBLE_VERSION; exports.BuiltinSettingsPresets = _chunkLHNNALVFjs.BuiltinSettingsPresets; exports.CORE_VERSION = _chunkDZFQ6I23js.CORE_VERSION; exports.EntityAIModule = _chunkDXQTHA75js.EntityAIModule; exports.EntityEngineAIModule = EntityEngineAIModule; exports.InMemoryMessageStore = InMemoryMessageStore; exports.InvalidToolInputError = _chunkDZFQ6I23js.InvalidToolInputError; exports.LocalStorageMessageStore = LocalStorageMessageStore; exports.NoSuchToolError = _chunkDZFQ6I23js.NoSuchToolError; exports.PACKAGE_NAME = PACKAGE_NAME; exports.StreamStateManager = StreamStateManager; exports.SupportedEmbeddingModels = _chunkTJFNODPEjs.SupportedEmbeddingModels; exports.TypeValidationError = TypeValidationError; exports.UIMessageStreamReader = UIMessageStreamReader; exports.VERSION = VERSION; exports.aimoduleError = aimoduleError; exports.aimoduleRuntimeError = aimoduleRuntimeError; exports.camelToSpaced = camelToSpaced; exports.clearWarnings = clearWarnings; exports.cn = cn; exports.cosineSimilarity = _chunkDZFQ6I23js.cosineSimilarity; exports.createAICore = _chunkDZFQ6I23js.createAICore; exports.createEntityAIModule = createEntityAIModule; exports.createErrorMessage = createErrorMessage; exports.createFileUrl = createFileUrl; exports.createIdGenerator = createIdGenerator; exports.createProviderRegistry = _chunkDZFQ6I23js.createProviderRegistry; exports.createQuickAI = createQuickAI; exports.createaimodule = createaimodule; exports.customProvider = _chunkDZFQ6I23js.customProvider; exports.debounce = debounce; exports.defaultSettingsMiddleware = _chunkDZFQ6I23js.defaultSettingsMiddleware; exports.embed = _chunkDZFQ6I23js.embed; exports.embedMany = _chunkDZFQ6I23js.embedMany; exports.extractMessageText = extractMessageText; exports.formatFileSize = formatFileSize; exports.formatRelativeTime = formatRelativeTime; exports.formatTimestamp = formatTimestamp; exports.generateId = generateId; exports.generateObject = _chunkDZFQ6I23js.generateObject; exports.generateText = _chunkDZFQ6I23js.generateText; exports.getFileAttachments = getFileAttachments; exports.getFileExtension = getFileExtension; exports.getToolCalls = getToolCalls; exports.getWarningStats = getWarningStats; exports.getWarnings = getWarnings; exports.hasFileAttachments = hasFileAttachments; exports.hasToolCalls = hasToolCalls; exports.highlightSearchTerms = highlightSearchTerms; exports.isFileTypeAccepted = isFileTypeAccepted; exports.isValidJson = isValidJson; exports.isValidUrl = isValidUrl; exports.readUIMessageStream = readUIMessageStream; exports.resumeStream = resumeStream; exports.revokeFileUrl = revokeFileUrl; exports.safeAsync = safeAsync; exports.safeJsonParse = safeJsonParse; exports.setWarningHandler = setWarningHandler; exports.smoothStream = _chunkDZFQ6I23js.smoothStream; exports.storage = storage; exports.streamObject = _chunkDZFQ6I23js.streamObject; exports.streamText = _chunkDZFQ6I23js.streamText; exports.throttle = throttle; exports.tool = _chunkDZFQ6I23js.tool; exports.truncateText = truncateText; exports.validateUIMessages = validateUIMessages; exports.warn = warn; exports.warnDeprecatedFeature = warnDeprecatedFeature; exports.warnPerformance = warnPerformance; exports.warnUnsupportedSetting = warnUnsupportedSetting; exports.warnUnsupportedTool = warnUnsupportedTool; exports.warnValidationError = warnValidationError; exports.wrapLanguageModel = _chunkDZFQ6I23js.wrapLanguageModel;
1177
+ //# sourceMappingURL=index.js.map