@workglow/ai 0.1.1 → 0.2.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 (137) hide show
  1. package/README.md +8 -7
  2. package/dist/browser.js +1436 -397
  3. package/dist/browser.js.map +64 -58
  4. package/dist/bun.js +1436 -397
  5. package/dist/bun.js.map +64 -58
  6. package/dist/common.d.ts +1 -0
  7. package/dist/common.d.ts.map +1 -1
  8. package/dist/execution/DirectExecutionStrategy.d.ts +1 -1
  9. package/dist/execution/DirectExecutionStrategy.d.ts.map +1 -1
  10. package/dist/execution/QueuedExecutionStrategy.d.ts +2 -2
  11. package/dist/execution/QueuedExecutionStrategy.d.ts.map +1 -1
  12. package/dist/job/AiJob.d.ts +2 -1
  13. package/dist/job/AiJob.d.ts.map +1 -1
  14. package/dist/model/ModelRegistry.d.ts.map +1 -1
  15. package/dist/model/ModelRepository.d.ts +11 -15
  16. package/dist/model/ModelRepository.d.ts.map +1 -1
  17. package/dist/model/ModelSchema.d.ts.map +1 -1
  18. package/dist/node.js +1436 -397
  19. package/dist/node.js.map +64 -58
  20. package/dist/provider/AiProvider.d.ts +2 -2
  21. package/dist/provider/AiProvider.d.ts.map +1 -1
  22. package/dist/provider/AiProviderRegistry.d.ts +3 -2
  23. package/dist/provider/AiProviderRegistry.d.ts.map +1 -1
  24. package/dist/provider/QueuedAiProvider.d.ts +2 -1
  25. package/dist/provider/QueuedAiProvider.d.ts.map +1 -1
  26. package/dist/task/AgentTask.d.ts +525 -0
  27. package/dist/task/AgentTask.d.ts.map +1 -0
  28. package/dist/task/AgentTypes.d.ts +183 -0
  29. package/dist/task/AgentTypes.d.ts.map +1 -0
  30. package/dist/task/AgentUtils.d.ts +55 -0
  31. package/dist/task/AgentUtils.d.ts.map +1 -0
  32. package/dist/task/BackgroundRemovalTask.d.ts +6 -34
  33. package/dist/task/BackgroundRemovalTask.d.ts.map +1 -1
  34. package/dist/task/ChunkRetrievalTask.d.ts +6 -4
  35. package/dist/task/ChunkRetrievalTask.d.ts.map +1 -1
  36. package/dist/task/ChunkToVectorTask.d.ts +6 -26
  37. package/dist/task/ChunkToVectorTask.d.ts.map +1 -1
  38. package/dist/task/ChunkVectorHybridSearchTask.d.ts +6 -25
  39. package/dist/task/ChunkVectorHybridSearchTask.d.ts.map +1 -1
  40. package/dist/task/ChunkVectorSearchTask.d.ts +6 -12
  41. package/dist/task/ChunkVectorSearchTask.d.ts.map +1 -1
  42. package/dist/task/ChunkVectorUpsertTask.d.ts +6 -13
  43. package/dist/task/ChunkVectorUpsertTask.d.ts.map +1 -1
  44. package/dist/task/ContextBuilderTask.d.ts +6 -30
  45. package/dist/task/ContextBuilderTask.d.ts.map +1 -1
  46. package/dist/task/CountTokensTask.d.ts +6 -21
  47. package/dist/task/CountTokensTask.d.ts.map +1 -1
  48. package/dist/task/DocumentEnricherTask.d.ts +6 -40
  49. package/dist/task/DocumentEnricherTask.d.ts.map +1 -1
  50. package/dist/task/DownloadModelTask.d.ts +7 -21
  51. package/dist/task/DownloadModelTask.d.ts.map +1 -1
  52. package/dist/task/FaceDetectorTask.d.ts +6 -36
  53. package/dist/task/FaceDetectorTask.d.ts.map +1 -1
  54. package/dist/task/FaceLandmarkerTask.d.ts +6 -40
  55. package/dist/task/FaceLandmarkerTask.d.ts.map +1 -1
  56. package/dist/task/GestureRecognizerTask.d.ts +6 -38
  57. package/dist/task/GestureRecognizerTask.d.ts.map +1 -1
  58. package/dist/task/HandLandmarkerTask.d.ts +6 -38
  59. package/dist/task/HandLandmarkerTask.d.ts.map +1 -1
  60. package/dist/task/HierarchicalChunkerTask.d.ts +6 -26
  61. package/dist/task/HierarchicalChunkerTask.d.ts.map +1 -1
  62. package/dist/task/HierarchyJoinTask.d.ts +6 -29
  63. package/dist/task/HierarchyJoinTask.d.ts.map +1 -1
  64. package/dist/task/ImageClassificationTask.d.ts +6 -36
  65. package/dist/task/ImageClassificationTask.d.ts.map +1 -1
  66. package/dist/task/ImageEmbeddingTask.d.ts +6 -47
  67. package/dist/task/ImageEmbeddingTask.d.ts.map +1 -1
  68. package/dist/task/ImageSegmentationTask.d.ts +6 -36
  69. package/dist/task/ImageSegmentationTask.d.ts.map +1 -1
  70. package/dist/task/ImageToTextTask.d.ts +6 -35
  71. package/dist/task/ImageToTextTask.d.ts.map +1 -1
  72. package/dist/task/MessageConversion.d.ts +52 -0
  73. package/dist/task/MessageConversion.d.ts.map +1 -0
  74. package/dist/task/ModelInfoTask.d.ts +7 -22
  75. package/dist/task/ModelInfoTask.d.ts.map +1 -1
  76. package/dist/task/ModelSearchTask.d.ts +6 -7
  77. package/dist/task/ModelSearchTask.d.ts.map +1 -1
  78. package/dist/task/ObjectDetectionTask.d.ts +6 -36
  79. package/dist/task/ObjectDetectionTask.d.ts.map +1 -1
  80. package/dist/task/PoseLandmarkerTask.d.ts +6 -39
  81. package/dist/task/PoseLandmarkerTask.d.ts.map +1 -1
  82. package/dist/task/QueryExpanderTask.d.ts +6 -9
  83. package/dist/task/QueryExpanderTask.d.ts.map +1 -1
  84. package/dist/task/RerankerTask.d.ts +6 -28
  85. package/dist/task/RerankerTask.d.ts.map +1 -1
  86. package/dist/task/StructuralParserTask.d.ts +6 -10
  87. package/dist/task/StructuralParserTask.d.ts.map +1 -1
  88. package/dist/task/StructuredGenerationTask.d.ts +6 -26
  89. package/dist/task/StructuredGenerationTask.d.ts.map +1 -1
  90. package/dist/task/TextChunkerTask.d.ts +6 -9
  91. package/dist/task/TextChunkerTask.d.ts.map +1 -1
  92. package/dist/task/TextClassificationTask.d.ts +6 -23
  93. package/dist/task/TextClassificationTask.d.ts.map +1 -1
  94. package/dist/task/TextEmbeddingTask.d.ts +6 -21
  95. package/dist/task/TextEmbeddingTask.d.ts.map +1 -1
  96. package/dist/task/TextFillMaskTask.d.ts +6 -21
  97. package/dist/task/TextFillMaskTask.d.ts.map +1 -1
  98. package/dist/task/TextGenerationTask.d.ts +6 -26
  99. package/dist/task/TextGenerationTask.d.ts.map +1 -1
  100. package/dist/task/TextLanguageDetectionTask.d.ts +6 -22
  101. package/dist/task/TextLanguageDetectionTask.d.ts.map +1 -1
  102. package/dist/task/TextNamedEntityRecognitionTask.d.ts +6 -22
  103. package/dist/task/TextNamedEntityRecognitionTask.d.ts.map +1 -1
  104. package/dist/task/TextQuestionAnswerTask.d.ts +6 -22
  105. package/dist/task/TextQuestionAnswerTask.d.ts.map +1 -1
  106. package/dist/task/TextRewriterTask.d.ts +6 -22
  107. package/dist/task/TextRewriterTask.d.ts.map +1 -1
  108. package/dist/task/TextSummaryTask.d.ts +6 -21
  109. package/dist/task/TextSummaryTask.d.ts.map +1 -1
  110. package/dist/task/TextTranslationTask.d.ts +6 -23
  111. package/dist/task/TextTranslationTask.d.ts.map +1 -1
  112. package/dist/task/ToolCallingTask.d.ts +348 -0
  113. package/dist/task/ToolCallingTask.d.ts.map +1 -0
  114. package/dist/task/ToolCallingUtils.d.ts +75 -0
  115. package/dist/task/ToolCallingUtils.d.ts.map +1 -0
  116. package/dist/task/TopicSegmenterTask.d.ts +6 -10
  117. package/dist/task/TopicSegmenterTask.d.ts.map +1 -1
  118. package/dist/task/UnloadModelTask.d.ts +6 -20
  119. package/dist/task/UnloadModelTask.d.ts.map +1 -1
  120. package/dist/task/VectorQuantizeTask.d.ts +6 -8
  121. package/dist/task/VectorQuantizeTask.d.ts.map +1 -1
  122. package/dist/task/VectorSimilarityTask.d.ts +7 -10
  123. package/dist/task/VectorSimilarityTask.d.ts.map +1 -1
  124. package/dist/task/base/AiTask.d.ts +8 -5
  125. package/dist/task/base/AiTask.d.ts.map +1 -1
  126. package/dist/task/base/AiTaskSchemas.d.ts.map +1 -1
  127. package/dist/task/base/AiVisionTask.d.ts +3 -7
  128. package/dist/task/base/AiVisionTask.d.ts.map +1 -1
  129. package/dist/task/base/StreamingAiTask.d.ts +4 -7
  130. package/dist/task/base/StreamingAiTask.d.ts.map +1 -1
  131. package/dist/task/index.d.ts +9 -1
  132. package/dist/task/index.d.ts.map +1 -1
  133. package/dist/worker.d.ts +2 -0
  134. package/dist/worker.d.ts.map +1 -1
  135. package/dist/worker.js +247 -25
  136. package/dist/worker.js.map +9 -7
  137. package/package.json +16 -11
package/dist/worker.js CHANGED
@@ -1,8 +1,5 @@
1
1
  // src/provider/AiProvider.ts
2
- import {
3
- globalServiceRegistry as globalServiceRegistry2,
4
- WORKER_MANAGER as WORKER_MANAGER2
5
- } from "@workglow/util/worker";
2
+ import { globalServiceRegistry as globalServiceRegistry2, WORKER_MANAGER as WORKER_MANAGER2 } from "@workglow/util/worker";
6
3
 
7
4
  // src/provider/AiProviderRegistry.ts
8
5
  import { globalServiceRegistry, WORKER_MANAGER } from "@workglow/util/worker";
@@ -13,20 +10,18 @@ import {
13
10
  Job,
14
11
  JobStatus,
15
12
  PermanentJobError,
16
- RetryableJobError
13
+ RetryableJobError,
14
+ withJobErrorDiagnostics
17
15
  } from "@workglow/job-queue";
18
16
  import { getLogger } from "@workglow/util/worker";
19
17
  var DEFAULT_AI_TIMEOUT_MS = 120000;
20
- var LOCAL_MODEL_DEFAULT_TIMEOUT_MS = 600000;
18
+ var LOCAL_INFERENCE_DEFAULT_TIMEOUT_MS = 300000;
21
19
  function resolveAiJobTimeoutMs(aiProvider, explicitMs) {
22
20
  if (explicitMs !== undefined) {
23
21
  return explicitMs;
24
22
  }
25
- if (aiProvider === "LOCAL_LLAMACPP") {
26
- return LOCAL_MODEL_DEFAULT_TIMEOUT_MS;
27
- }
28
- if (aiProvider === "HF_TRANSFORMERS_ONNX" || aiProvider.startsWith("HF_TRANSFORMERS_ONNX")) {
29
- return LOCAL_MODEL_DEFAULT_TIMEOUT_MS;
23
+ if (aiProvider === "LOCAL_LLAMACPP" || aiProvider === "HF_TRANSFORMERS_ONNX") {
24
+ return LOCAL_INFERENCE_DEFAULT_TIMEOUT_MS;
30
25
  }
31
26
  return DEFAULT_AI_TIMEOUT_MS;
32
27
  }
@@ -39,39 +34,39 @@ function classifyProviderError(err, taskType, provider) {
39
34
  const m = message.match(/\b([45]\d{2})\b/);
40
35
  return m ? parseInt(m[1], 10) : undefined;
41
36
  })();
42
- if (err instanceof DOMException && err.name === "AbortError") {
43
- return new AbortSignalJobError(`Provider call aborted for ${taskType} (${provider})`);
37
+ if (err instanceof Error && err.name === "AbortError") {
38
+ return new AbortSignalJobError(withJobErrorDiagnostics(`Provider call aborted for ${taskType} (${provider})`, err));
44
39
  }
45
- if (err instanceof DOMException && err.name === "TimeoutError") {
46
- return new AbortSignalJobError(`Provider call timed out for ${taskType} (${provider})`);
40
+ if (err instanceof Error && err.name === "TimeoutError") {
41
+ return new AbortSignalJobError(withJobErrorDiagnostics(`Provider call timed out for ${taskType} (${provider})`, err));
47
42
  }
48
43
  if (message.includes("Pipeline download aborted") || message.includes("Operation aborted") || message.includes("operation was aborted") || message.includes("The operation was aborted")) {
49
- return new AbortSignalJobError(`Provider call aborted for ${taskType} (${provider}): ${message}`);
44
+ return new AbortSignalJobError(withJobErrorDiagnostics(`Provider call aborted for ${taskType} (${provider}): ${message}`, err));
50
45
  }
51
46
  if (message.startsWith("HFT_NULL_PROCESSOR:")) {
52
- return new RetryableJobError(message);
47
+ return new RetryableJobError(withJobErrorDiagnostics(message, err));
53
48
  }
54
49
  if (status === 429) {
55
50
  const retryAfterMatch = message.match(/retry.after[:\s]*(\d+)/i);
56
51
  const retryMs = retryAfterMatch ? parseInt(retryAfterMatch[1], 10) * 1000 : 30000;
57
- return new RetryableJobError(`Rate limited by ${provider} for ${taskType}: ${message}`, new Date(Date.now() + retryMs));
52
+ return new RetryableJobError(withJobErrorDiagnostics(`Rate limited by ${provider} for ${taskType}: ${message}`, err), new Date(Date.now() + retryMs));
58
53
  }
59
54
  if (status === 401 || status === 403) {
60
- return new PermanentJobError(`Authentication failed for ${provider} (${taskType}): ${message}`);
55
+ return new PermanentJobError(withJobErrorDiagnostics(`Authentication failed for ${provider} (${taskType}): ${message}`, err));
61
56
  }
62
57
  if (status === 400 || status === 404) {
63
- return new PermanentJobError(`Invalid request to ${provider} for ${taskType}: ${message}`);
58
+ return new PermanentJobError(withJobErrorDiagnostics(`Invalid request to ${provider} for ${taskType}: ${message}`, err));
64
59
  }
65
60
  if (status && status >= 500) {
66
- return new RetryableJobError(`Server error from ${provider} for ${taskType} (HTTP ${status}): ${message}`);
61
+ return new RetryableJobError(withJobErrorDiagnostics(`Server error from ${provider} for ${taskType} (HTTP ${status}): ${message}`, err));
67
62
  }
68
63
  if (message.includes("ECONNREFUSED") || message.includes("ECONNRESET") || message.includes("ETIMEDOUT") || message.includes("fetch failed") || message.includes("network") || err instanceof TypeError && message.includes("fetch")) {
69
- return new RetryableJobError(`Network error calling ${provider} for ${taskType}: ${message}`);
64
+ return new RetryableJobError(withJobErrorDiagnostics(`Network error calling ${provider} for ${taskType}: ${message}`, err));
70
65
  }
71
66
  if (message.includes("timed out") || message.includes("timeout")) {
72
- return new RetryableJobError(`Timeout calling ${provider} for ${taskType}: ${message}`);
67
+ return new RetryableJobError(withJobErrorDiagnostics(`Timeout calling ${provider} for ${taskType}: ${message}`, err));
73
68
  }
74
- return new PermanentJobError(`Provider ${provider} failed for ${taskType}: ${message}`);
69
+ return new PermanentJobError(withJobErrorDiagnostics(`Provider ${provider} failed for ${taskType}: ${message}`, err));
75
70
  }
76
71
 
77
72
  class AiJob extends Job {
@@ -401,6 +396,228 @@ class AiProvider {
401
396
  async dispose() {}
402
397
  async afterRegister(_options) {}
403
398
  }
399
+ // src/task/ToolCallingUtils.ts
400
+ import { getLogger as getLogger2 } from "@workglow/util/worker";
401
+ function buildToolDescription(tool) {
402
+ let desc = tool.description;
403
+ if (tool.outputSchema && typeof tool.outputSchema === "object") {
404
+ desc += `
405
+
406
+ Returns: ${JSON.stringify(tool.outputSchema)}`;
407
+ }
408
+ return desc;
409
+ }
410
+ function isAllowedToolName(name, allowedTools) {
411
+ return allowedTools.some((t) => t.name === name);
412
+ }
413
+ function filterValidToolCalls(toolCalls, allowedTools) {
414
+ return toolCalls.filter((tc) => {
415
+ if (tc.name && isAllowedToolName(tc.name, allowedTools)) {
416
+ return true;
417
+ }
418
+ getLogger2().warn(`Filtered out tool call with unknown name "${tc.name ?? "(missing)"}"`, {
419
+ callId: tc.id,
420
+ toolName: tc.name
421
+ });
422
+ return false;
423
+ });
424
+ }
425
+ // src/task/MessageConversion.ts
426
+ function getInputMessages(input) {
427
+ const messages = input.messages;
428
+ if (!messages || messages.length === 0)
429
+ return;
430
+ return messages;
431
+ }
432
+ function toOpenAIMessages(input) {
433
+ const messages = [];
434
+ if (input.systemPrompt) {
435
+ messages.push({ role: "system", content: input.systemPrompt });
436
+ }
437
+ const inputMessages = getInputMessages(input);
438
+ if (!inputMessages) {
439
+ if (!Array.isArray(input.prompt)) {
440
+ messages.push({ role: "user", content: input.prompt });
441
+ } else if (input.prompt.every((item) => typeof item === "string")) {
442
+ messages.push({ role: "user", content: input.prompt.join(`
443
+ `) });
444
+ } else {
445
+ const parts = [];
446
+ for (const item of input.prompt) {
447
+ if (typeof item === "string") {
448
+ parts.push({ type: "text", text: item });
449
+ } else {
450
+ const b = item;
451
+ if (b.type === "text") {
452
+ parts.push({ type: "text", text: b.text });
453
+ } else if (b.type === "image") {
454
+ parts.push({
455
+ type: "image_url",
456
+ image_url: { url: `data:${b.mimeType};base64,${b.data}` }
457
+ });
458
+ } else if (b.type === "audio") {
459
+ const format = b.mimeType.replace(/^audio\//, "");
460
+ parts.push({
461
+ type: "input_audio",
462
+ input_audio: { data: b.data, format }
463
+ });
464
+ }
465
+ }
466
+ }
467
+ messages.push({ role: "user", content: parts });
468
+ }
469
+ return messages;
470
+ }
471
+ for (const msg of inputMessages) {
472
+ if (msg.role === "user") {
473
+ if (typeof msg.content === "string") {
474
+ messages.push({ role: "user", content: msg.content });
475
+ } else if (Array.isArray(msg.content) && msg.content.length > 0 && typeof msg.content[0]?.type === "string") {
476
+ const parts = [];
477
+ for (const block of msg.content) {
478
+ const b = block;
479
+ if (b.type === "text") {
480
+ parts.push({ type: "text", text: b.text });
481
+ } else if (b.type === "image") {
482
+ parts.push({
483
+ type: "image_url",
484
+ image_url: { url: `data:${b.mimeType};base64,${b.data}` }
485
+ });
486
+ } else if (b.type === "audio") {
487
+ const format = b.mimeType.replace(/^audio\//, "");
488
+ parts.push({
489
+ type: "input_audio",
490
+ input_audio: { data: b.data, format }
491
+ });
492
+ }
493
+ }
494
+ messages.push({ role: "user", content: parts });
495
+ } else {
496
+ try {
497
+ messages.push({ role: "user", content: JSON.stringify(msg.content) });
498
+ } catch {
499
+ messages.push({ role: "user", content: String(msg.content) });
500
+ }
501
+ }
502
+ } else if (msg.role === "assistant") {
503
+ if (typeof msg.content === "string") {
504
+ messages.push({ role: "assistant", content: msg.content.length > 0 ? msg.content : null });
505
+ } else if (Array.isArray(msg.content)) {
506
+ const textParts = msg.content.filter((b) => b.type === "text").map((b) => b.text).join("");
507
+ const toolCalls = msg.content.filter((b) => b.type === "tool_use").map((b) => ({
508
+ id: b.id,
509
+ type: "function",
510
+ function: {
511
+ name: b.name,
512
+ arguments: JSON.stringify(b.input)
513
+ }
514
+ }));
515
+ const entry = {
516
+ role: "assistant",
517
+ content: textParts.length > 0 ? textParts : null
518
+ };
519
+ if (toolCalls.length > 0) {
520
+ entry.tool_calls = toolCalls;
521
+ }
522
+ messages.push(entry);
523
+ }
524
+ } else if (msg.role === "tool" && Array.isArray(msg.content)) {
525
+ for (const block of msg.content) {
526
+ const b = block;
527
+ let content;
528
+ if (typeof b.content === "string") {
529
+ content = b.content;
530
+ } else if (Array.isArray(b.content)) {
531
+ const parts = [];
532
+ for (const inner of b.content) {
533
+ if (inner.type === "text") {
534
+ parts.push({ type: "text", text: inner.text });
535
+ } else if (inner.type === "image") {
536
+ parts.push({
537
+ type: "image_url",
538
+ image_url: { url: `data:${inner.mimeType};base64,${inner.data}` }
539
+ });
540
+ }
541
+ }
542
+ content = parts;
543
+ } else {
544
+ content = "";
545
+ }
546
+ messages.push({
547
+ role: "tool",
548
+ content,
549
+ tool_call_id: b.tool_use_id
550
+ });
551
+ }
552
+ }
553
+ }
554
+ return messages;
555
+ }
556
+ function toTextFlatMessages(input) {
557
+ const messages = [];
558
+ if (input.systemPrompt) {
559
+ messages.push({ role: "system", content: input.systemPrompt });
560
+ }
561
+ const inputMessages = getInputMessages(input);
562
+ if (!inputMessages) {
563
+ let promptContent;
564
+ if (!Array.isArray(input.prompt)) {
565
+ promptContent = input.prompt;
566
+ } else {
567
+ promptContent = input.prompt.map((item) => {
568
+ if (typeof item === "string")
569
+ return item;
570
+ const b = item;
571
+ return b.type === "text" ? b.text : "";
572
+ }).filter((s) => s !== "").join(`
573
+ `);
574
+ }
575
+ messages.push({ role: "user", content: promptContent });
576
+ return messages;
577
+ }
578
+ for (const msg of inputMessages) {
579
+ if (msg.role === "user") {
580
+ let content = "";
581
+ if (typeof msg.content === "string") {
582
+ content = msg.content;
583
+ } else if (Array.isArray(msg.content) && msg.content.length > 0 && typeof msg.content[0]?.type === "string") {
584
+ content = msg.content.filter((b) => b.type === "text").map((b) => b.text).join("");
585
+ } else if (msg.content != null) {
586
+ try {
587
+ content = JSON.stringify(msg.content);
588
+ } catch {
589
+ content = String(msg.content);
590
+ }
591
+ }
592
+ messages.push({ role: "user", content });
593
+ } else if (msg.role === "assistant") {
594
+ if (typeof msg.content === "string") {
595
+ if (msg.content) {
596
+ messages.push({ role: "assistant", content: msg.content });
597
+ }
598
+ } else if (Array.isArray(msg.content)) {
599
+ const text = msg.content.filter((b) => b.type === "text").map((b) => b.text).join("");
600
+ if (text) {
601
+ messages.push({ role: "assistant", content: text });
602
+ }
603
+ }
604
+ } else if (msg.role === "tool" && Array.isArray(msg.content)) {
605
+ for (const block of msg.content) {
606
+ const b = block;
607
+ let content;
608
+ if (typeof b.content === "string") {
609
+ content = b.content;
610
+ } else if (Array.isArray(b.content)) {
611
+ content = b.content.filter((inner) => inner.type === "text").map((inner) => inner.text).join("");
612
+ } else {
613
+ content = "";
614
+ }
615
+ messages.push({ role: "tool", content });
616
+ }
617
+ }
618
+ }
619
+ return messages;
620
+ }
404
621
  // src/model/ModelSchema.ts
405
622
  var ModelConfigSchema = {
406
623
  type: "object",
@@ -443,9 +660,14 @@ var ModelRecordSchema = {
443
660
  };
444
661
  var ModelPrimaryKeyNames = ["model_id"];
445
662
  export {
663
+ toTextFlatMessages,
664
+ toOpenAIMessages,
446
665
  setAiProviderRegistry,
447
666
  resolveAiProviderGpuQueueConcurrency,
667
+ isAllowedToolName,
448
668
  getAiProviderRegistry,
669
+ filterValidToolCalls,
670
+ buildToolDescription,
449
671
  ModelRecordSchema,
450
672
  ModelPrimaryKeyNames,
451
673
  ModelConfigSchema,
@@ -453,4 +675,4 @@ export {
453
675
  AiProvider
454
676
  };
455
677
 
456
- //# debugId=EA397FAD8CAF3E1B64756E2164756E21
678
+ //# debugId=D34633C7196C310D64756E2164756E21