@mastra/core 0.24.7 → 0.24.8-alpha.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 (78) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/dist/agent/index.cjs +13 -13
  3. package/dist/agent/index.js +2 -2
  4. package/dist/agent/input-processor/index.cjs +6 -6
  5. package/dist/agent/input-processor/index.js +1 -1
  6. package/dist/ai-tracing/index.cjs +36 -36
  7. package/dist/ai-tracing/index.js +1 -1
  8. package/dist/{chunk-GIK7MM2K.js → chunk-2KSE77GL.js} +3 -3
  9. package/dist/{chunk-GIK7MM2K.js.map → chunk-2KSE77GL.js.map} +1 -1
  10. package/dist/{chunk-FQTJPLCW.cjs → chunk-4G3YJRW5.cjs} +15 -15
  11. package/dist/{chunk-FQTJPLCW.cjs.map → chunk-4G3YJRW5.cjs.map} +1 -1
  12. package/dist/{chunk-6VB52TJV.js → chunk-4RXCP6HM.js} +3 -3
  13. package/dist/{chunk-6VB52TJV.js.map → chunk-4RXCP6HM.js.map} +1 -1
  14. package/dist/{chunk-2YN6HGEH.js → chunk-53WB5OXR.js} +3 -3
  15. package/dist/{chunk-2YN6HGEH.js.map → chunk-53WB5OXR.js.map} +1 -1
  16. package/dist/{chunk-YPYLWTZI.cjs → chunk-BNQUN4AP.cjs} +4 -4
  17. package/dist/{chunk-YPYLWTZI.cjs.map → chunk-BNQUN4AP.cjs.map} +1 -1
  18. package/dist/{chunk-RWPKCFZT.cjs → chunk-BWCZZ3JR.cjs} +4 -4
  19. package/dist/{chunk-RWPKCFZT.cjs.map → chunk-BWCZZ3JR.cjs.map} +1 -1
  20. package/dist/{chunk-Y2BH2LUD.js → chunk-CASJBGBM.js} +8 -8
  21. package/dist/{chunk-Y2BH2LUD.js.map → chunk-CASJBGBM.js.map} +1 -1
  22. package/dist/{chunk-4YYPQOP7.cjs → chunk-DSDIDSG5.cjs} +4 -4
  23. package/dist/{chunk-4YYPQOP7.cjs.map → chunk-DSDIDSG5.cjs.map} +1 -1
  24. package/dist/{chunk-Z6ZIJYKK.js → chunk-EEMW5S2E.js} +4 -4
  25. package/dist/{chunk-Z6ZIJYKK.js.map → chunk-EEMW5S2E.js.map} +1 -1
  26. package/dist/{chunk-N6P5GJRO.js → chunk-G3L4ZD2T.js} +6 -6
  27. package/dist/{chunk-N6P5GJRO.js.map → chunk-G3L4ZD2T.js.map} +1 -1
  28. package/dist/{chunk-CNIM7N4E.cjs → chunk-GH47ARSY.cjs} +13 -13
  29. package/dist/{chunk-CNIM7N4E.cjs.map → chunk-GH47ARSY.cjs.map} +1 -1
  30. package/dist/{chunk-RQPGIUUA.cjs → chunk-JZB25TWH.cjs} +6 -6
  31. package/dist/{chunk-RQPGIUUA.cjs.map → chunk-JZB25TWH.cjs.map} +1 -1
  32. package/dist/{chunk-ICICKWAG.cjs → chunk-OPWVVCHZ.cjs} +6 -6
  33. package/dist/{chunk-ICICKWAG.cjs.map → chunk-OPWVVCHZ.cjs.map} +1 -1
  34. package/dist/{chunk-2BY7C6Y7.js → chunk-PE2PFJQ3.js} +4 -4
  35. package/dist/{chunk-2BY7C6Y7.js.map → chunk-PE2PFJQ3.js.map} +1 -1
  36. package/dist/{chunk-YYKN3NDZ.cjs → chunk-Q3KCYA73.cjs} +48 -48
  37. package/dist/{chunk-YYKN3NDZ.cjs.map → chunk-Q3KCYA73.cjs.map} +1 -1
  38. package/dist/{chunk-PPAIPZ6C.js → chunk-QE7J6M6C.js} +4 -4
  39. package/dist/{chunk-PPAIPZ6C.js.map → chunk-QE7J6M6C.js.map} +1 -1
  40. package/dist/{chunk-2YE6RNCZ.cjs → chunk-SGXTRKZ7.cjs} +4 -4
  41. package/dist/{chunk-2YE6RNCZ.cjs.map → chunk-SGXTRKZ7.cjs.map} +1 -1
  42. package/dist/{chunk-E5NCEJEJ.js → chunk-UBQ4CZKE.js} +3 -3
  43. package/dist/{chunk-E5NCEJEJ.js.map → chunk-UBQ4CZKE.js.map} +1 -1
  44. package/dist/{chunk-RLYWCJQ6.js → chunk-UEAPU6M5.js} +3 -3
  45. package/dist/{chunk-RLYWCJQ6.js.map → chunk-UEAPU6M5.js.map} +1 -1
  46. package/dist/{chunk-X5JTTWMF.cjs → chunk-YNRIIUEW.cjs} +9 -9
  47. package/dist/{chunk-X5JTTWMF.cjs.map → chunk-YNRIIUEW.cjs.map} +1 -1
  48. package/dist/index.cjs +64 -64
  49. package/dist/index.js +9 -9
  50. package/dist/loop/index.cjs +2 -2
  51. package/dist/loop/index.js +1 -1
  52. package/dist/mastra/index.cjs +2 -2
  53. package/dist/mastra/index.js +1 -1
  54. package/dist/memory/index.cjs +4 -4
  55. package/dist/memory/index.js +1 -1
  56. package/dist/processors/index.cjs +11 -11
  57. package/dist/processors/index.js +1 -1
  58. package/dist/relevance/index.cjs +4 -4
  59. package/dist/relevance/index.js +1 -1
  60. package/dist/scores/index.cjs +9 -9
  61. package/dist/scores/index.js +2 -2
  62. package/dist/scores/scoreTraces/index.cjs +8 -8
  63. package/dist/scores/scoreTraces/index.js +3 -3
  64. package/dist/storage/index.cjs +3 -3
  65. package/dist/storage/index.js +1 -1
  66. package/dist/stream/index.cjs +11 -11
  67. package/dist/stream/index.js +2 -2
  68. package/dist/test-utils/llm-mock.cjs +2 -2
  69. package/dist/test-utils/llm-mock.js +1 -1
  70. package/dist/utils.cjs +22 -22
  71. package/dist/utils.js +1 -1
  72. package/dist/workflows/evented/index.cjs +10 -10
  73. package/dist/workflows/evented/index.js +1 -1
  74. package/dist/workflows/index.cjs +17 -17
  75. package/dist/workflows/index.js +1 -1
  76. package/dist/workflows/legacy/index.cjs +22 -22
  77. package/dist/workflows/legacy/index.js +1 -1
  78. package/package.json +3 -3
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkYPYLWTZI_cjs = require('./chunk-YPYLWTZI.cjs');
3
+ var chunkBNQUN4AP_cjs = require('./chunk-BNQUN4AP.cjs');
4
4
  var zod = require('zod');
5
5
 
6
6
  var scoringExtractStepResultSchema = zod.z.record(zod.z.string(), zod.z.any()).optional();
@@ -18,7 +18,7 @@ var saveScorePayloadSchema = zod.z.object({
18
18
  input: zod.z.any().optional(),
19
19
  output: zod.z.any(),
20
20
  source: zod.z.enum(["LIVE", "TEST"]),
21
- entityType: zod.z.enum(["AGENT", "WORKFLOW", ...Object.values(chunkYPYLWTZI_cjs.AISpanType)]).optional(),
21
+ entityType: zod.z.enum(["AGENT", "WORKFLOW", ...Object.values(chunkBNQUN4AP_cjs.AISpanType)]).optional(),
22
22
  scorer: zod.z.record(zod.z.string(), zod.z.any()),
23
23
  traceId: zod.z.string().optional(),
24
24
  spanId: zod.z.string().optional(),
@@ -43,5 +43,5 @@ exports.saveScorePayloadSchema = saveScorePayloadSchema;
43
43
  exports.scoreResultSchema = scoreResultSchema;
44
44
  exports.scoringExtractStepResultSchema = scoringExtractStepResultSchema;
45
45
  exports.scoringValueSchema = scoringValueSchema;
46
- //# sourceMappingURL=chunk-RWPKCFZT.cjs.map
47
- //# sourceMappingURL=chunk-RWPKCFZT.cjs.map
46
+ //# sourceMappingURL=chunk-BWCZZ3JR.cjs.map
47
+ //# sourceMappingURL=chunk-BWCZZ3JR.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/scores/types.ts"],"names":["z","AISpanType"],"mappings":";;;;;AA6CO,IAAM,8BAAA,GAAiCA,KAAA,CAAE,MAAA,CAAOA,KAAA,CAAE,MAAA,IAAUA,KAAA,CAAE,GAAA,EAAK,CAAA,CAAE,QAAA;AAIrE,IAAM,kBAAA,GAAqBA,MAAE,MAAA;AAE7B,IAAM,iBAAA,GAAoBA,MAAE,MAAA,CAAO;AAAA,EACxC,MAAA,EAAQA,KAAA,CAAE,MAAA,CAAOA,KAAA,CAAE,MAAA,IAAUA,KAAA,CAAE,GAAA,EAAK,CAAA,CAAE,QAAA,EAAS;AAAA,EAC/C,KAAA,EAAO,kBAAA;AAAA,EACP,MAAA,EAAQA,KAAA,CAAE,MAAA,E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A,CAAE,MAAA,EAAO,CAAE,QAAA,EAAS;AAAA,EAC5B,QAAA,EAAUA,KAAA,CAAE,MAAA,CAAOA,KAAA,CAAE,MAAA,IAAUA,KAAA,CAAE,GAAA,EAAK,CAAA,CAAE,QAAA,EAAS;AAAA,EACjD,gBAAA,EAAkBA,KAAA,CAAE,MAAA,EAAO,CAAE,QAAA,EAAS;AAAA,EACtC,aAAA,EAAeA,KAAA,CAAE,MAAA,EAAO,CAAE,QAAA,EAAS;AAAA,EACnC,mBAAA,EAAqBA,KAAA,CAAE,MAAA,EAAO,CAAE,QAAA,EAAS;AAAA,EACzC,oBAAA,EAAsBA,KAAA,CAAE,MAAA,EAAO,CAAE,QAAA,EAAS;AAAA,EAC1C,aAAA,EAAeA,KAAA,CAAE,MAAA,EAAO,CAAE,QAAA,EAAS;AAAA,EACnC,iBAAA,EAAmBA,KAAA,CAAE,MAAA,CAAOA,KAAA,CAAE,MAAA,IAAUA,KAAA,CAAE,GAAA,EAAK,CAAA,CAAE,QAAA,EAAS;AAAA,EAC1D,cAAA,EAAgBA,KAAA,CAAE,MAAA,CAAOA,KAAA,CAAE,MAAA,IAAUA,KAAA,CAAE,GAAA,EAAK,CAAA,CAAE,QAAA,EAAS;AAAA,EACvD,MAAA,EAAQA,KAAA,CAAE,MAAA,CAAOA,KAAA,CAAE,MAAA,IAAUA,KAAA,CAAE,GAAA,EAAK,CAAA,CAAE,QAAA,EAAS;AAAA,EAC/C,UAAA,EAAYA,KAAA,CAAE,MAAA,EAAO,CAAE,QAAA,EAAS;AAAA,EAChC,QAAA,EAAUA,KAAA,CAAE,MAAA,EAAO,CAAE,QAAA;AACvB,CAAC","file":"chunk-RWPKCFZT.cjs","sourcesContent":["import type { CoreMessage, CoreSystemMessage } from 'ai';\nimport { z } from 'zod';\nimport type { UIMessageWithMetadata } from '../agent';\nimport { AISpanType } from '../ai-tracing';\nimport type { TracingContext } from '../ai-tracing';\n\nexport type ScoringSamplingConfig = { type: 'none' } | { type: 'ratio'; rate: number };\n\nexport type ScoringSource = 'LIVE' | 'TEST';\n\nexport type ScoringEntityType = 'AGENT' | 'WORKFLOW' | AISpanType;\n\nexport type ScoringPrompts = {\n description: string;\n prompt: string;\n};\n\nexport type ScoringInput = {\n runId?: string;\n input?: any;\n output: any;\n additionalContext?: Record<string, any>;\n runtimeContext?: Record<string, any>;\n tracingContext?: TracingContext;\n};\n\nexport type ScoringHookInput = {\n runId?: string;\n scorer: Record<string, any>;\n input: any;\n output: any;\n metadata?: Record<string, any>;\n additionalContext?: Record<string, any>;\n source: ScoringSource;\n entity: Record<string, any>;\n entityType: ScoringEntityType;\n runtimeContext?: Record<string, any>;\n tracingContext?: TracingContext;\n structuredOutput?: boolean;\n traceId?: string;\n spanId?: string;\n resourceId?: string;\n threadId?: string;\n};\n\nexport const scoringExtractStepResultSchema = z.record(z.string(), z.any()).optional();\n\nexport type ScoringExtractStepResult = z.infer<typeof scoringExtractStepResultSchema>;\n\nexport const scoringValueSchema = z.number();\n\nexport const scoreResultSchema = z.object({\n result: z.record(z.string(), z.any()).optional(),\n score: scoringValueSchema,\n prompt: z.string().optional(),\n});\n\nexport type ScoringAnalyzeStepResult = z.infer<typeof scoreResultSchema>;\n\nexport type ScoringInputWithExtractStepResult<TExtract = any> = ScoringInput & {\n runId: string;\n extractStepResult?: TExtract;\n extractPrompt?: string;\n};\n\nexport type ScoringInputWithExtractStepResultAndAnalyzeStepResult<\n TExtract = any,\n TScore = any,\n> = ScoringInputWithExtractStepResult<TExtract> & {\n score: number;\n analyzeStepResult?: TScore;\n analyzePrompt?: string;\n};\n\nexport type ScoringInputWithExtractStepResultAndScoreAndReason =\n ScoringInputWithExtractStepResultAndAnalyzeStepResult & {\n reason?: string;\n reasonPrompt?: string;\n };\n\nexport type ScoreRowData = ScoringInputWithExtractStepResultAndScoreAndReason &\n ScoringHookInput & {\n id: string;\n entityId: string;\n scorerId: string;\n createdAt: Date;\n updatedAt: Date;\n preprocessStepResult?: Record<string, any>;\n preprocessPrompt?: string;\n generateScorePrompt?: string;\n generateReasonPrompt?: string;\n };\n\nexport type ExtractionStepFn = (input: ScoringInput) => Promise<Record<string, any>>;\n\nexport type AnalyzeStepFn = (input: ScoringInputWithExtractStepResult) => Promise<ScoringAnalyzeStepResult>;\n\nexport type ReasonStepFn = (\n input: ScoringInputWithExtractStepResultAndAnalyzeStepResult,\n) => Promise<{ reason: string; reasonPrompt?: string } | null>;\n\nexport type ScorerOptions = {\n name: string;\n description: string;\n extract?: ExtractionStepFn;\n analyze: AnalyzeStepFn;\n reason?: ReasonStepFn;\n metadata?: Record<string, any>;\n isLLMScorer?: boolean;\n};\n\nexport type ScorerRunInputForAgent = {\n inputMessages: UIMessageWithMetadata[];\n rememberedMessages: UIMessageWithMetadata[];\n systemMessages: CoreMessage[];\n taggedSystemMessages: Record<string, CoreSystemMessage[]>;\n};\n\nexport type ScorerRunOutputForAgent = UIMessageWithMetadata[];\n\nexport const saveScorePayloadSchema = z.object({\n runId: z.string(),\n scorerId: z.string(),\n entityId: z.string(),\n score: z.number(),\n input: z.any().optional(),\n output: z.any(),\n source: z.enum(['LIVE', 'TEST']),\n entityType: z.enum(['AGENT', 'WORKFLOW', ...Object.values(AISpanType)]).optional(),\n scorer: z.record(z.string(), z.any()),\n\n traceId: z.string().optional(),\n spanId: z.string().optional(),\n preprocessStepResult: z.record(z.string(), z.any()).optional(),\n extractStepResult: z.record(z.string(), z.any()).optional(),\n analyzeStepResult: z.record(z.string(), z.any()).optional(),\n reason: z.string().optional(),\n metadata: z.record(z.string(), z.any()).optional(),\n preprocessPrompt: z.string().optional(),\n extractPrompt: z.string().optional(),\n generateScorePrompt: z.string().optional(),\n generateReasonPrompt: z.string().optional(),\n analyzePrompt: z.string().optional(),\n additionalContext: z.record(z.string(), z.any()).optional(),\n runtimeContext: z.record(z.string(), z.any()).optional(),\n entity: z.record(z.string(), z.any()).optional(),\n resourceId: z.string().optional(),\n threadId: z.string().optional(),\n});\n\nexport type ValidatedSaveScorePayload = z.inf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AK,CAAA,CAAE,QAAA,EAAS;AAAA,EACvD,MAAA,EAAQA,KAAA,CAAE,MAAA,CAAOA,KAAA,CAAE,MAAA,IAAUA,KAAA,CAAE,GAAA,EAAK,CAAA,CAAE,QAAA,EAAS;AAAA,EAC/C,UAAA,EAAYA,KAAA,CAAE,MAAA,EAAO,CAAE,QAAA,EAAS;AAAA,EAChC,QAAA,EAAUA,KAAA,CAAE,MAAA,EAAO,CAAE,QAAA;AACvB,CAAC","file":"chunk-BWCZZ3JR.cjs","sourcesContent":["import type { CoreMessage, CoreSystemMessage } from 'ai';\nimport { z } from 'zod';\nimport type { UIMessageWithMetadata } from '../agent';\nimport { AISpanType } from '../ai-tracing';\nimport type { TracingContext } from '../ai-tracing';\n\nexport type ScoringSamplingConfig = { type: 'none' } | { type: 'ratio'; rate: number };\n\nexport type ScoringSource = 'LIVE' | 'TEST';\n\nexport type ScoringEntityType = 'AGENT' | 'WORKFLOW' | AISpanType;\n\nexport type ScoringPrompts = {\n description: string;\n prompt: string;\n};\n\nexport type ScoringInput = {\n runId?: string;\n input?: any;\n output: any;\n additionalContext?: Record<string, any>;\n runtimeContext?: Record<string, any>;\n tracingContext?: TracingContext;\n};\n\nexport type ScoringHookInput = {\n runId?: string;\n scorer: Record<string, any>;\n input: any;\n output: any;\n metadata?: Record<string, any>;\n additionalContext?: Record<string, any>;\n source: ScoringSource;\n entity: Record<string, any>;\n entityType: ScoringEntityType;\n runtimeContext?: Record<string, any>;\n tracingContext?: TracingContext;\n structuredOutput?: boolean;\n traceId?: string;\n spanId?: string;\n resourceId?: string;\n threadId?: string;\n};\n\nexport const scoringExtractStepResultSchema = z.record(z.string(), z.any()).optional();\n\nexport type ScoringExtractStepResult = z.infer<typeof scoringExtractStepResultSchema>;\n\nexport const scoringValueSchema = z.number();\n\nexport const scoreResultSchema = z.object({\n result: z.record(z.string(), z.any()).optional(),\n score: scoringValueSchema,\n prompt: z.string().optional(),\n});\n\nexport type ScoringAnalyzeStepResult = z.infer<typeof scoreResultSchema>;\n\nexport type ScoringInputWithExtractStepResult<TExtract = any> = ScoringInput & {\n runId: string;\n extractStepResult?: TExtract;\n extractPrompt?: string;\n};\n\nexport type ScoringInputWithExtractStepResultAndAnalyzeStepResult<\n TExtract = any,\n TScore = any,\n> = ScoringInputWithExtractStepResult<TExtract> & {\n score: number;\n analyzeStepResult?: TScore;\n analyzePrompt?: string;\n};\n\nexport type ScoringInputWithExtractStepResultAndScoreAndReason =\n ScoringInputWithExtractStepResultAndAnalyzeStepResult & {\n reason?: string;\n reasonPrompt?: string;\n };\n\nexport type ScoreRowData = ScoringInputWithExtractStepResultAndScoreAndReason &\n ScoringHookInput & {\n id: string;\n entityId: string;\n scorerId: string;\n createdAt: Date;\n updatedAt: Date;\n preprocessStepResult?: Record<string, any>;\n preprocessPrompt?: string;\n generateScorePrompt?: string;\n generateReasonPrompt?: string;\n };\n\nexport type ExtractionStepFn = (input: ScoringInput) => Promise<Record<string, any>>;\n\nexport type AnalyzeStepFn = (input: ScoringInputWithExtractStepResult) => Promise<ScoringAnalyzeStepResult>;\n\nexport type ReasonStepFn = (\n input: ScoringInputWithExtractStepResultAndAnalyzeStepResult,\n) => Promise<{ reason: string; reasonPrompt?: string } | null>;\n\nexport type ScorerOptions = {\n name: string;\n description: string;\n extract?: ExtractionStepFn;\n analyze: AnalyzeStepFn;\n reason?: ReasonStepFn;\n metadata?: Record<string, any>;\n isLLMScorer?: boolean;\n};\n\nexport type ScorerRunInputForAgent = {\n inputMessages: UIMessageWithMetadata[];\n rememberedMessages: UIMessageWithMetadata[];\n systemMessages: CoreMessage[];\n taggedSystemMessages: Record<string, CoreSystemMessage[]>;\n};\n\nexport type ScorerRunOutputForAgent = UIMessageWithMetadata[];\n\nexport const saveScorePayloadSchema = z.object({\n runId: z.string(),\n scorerId: z.string(),\n entityId: z.string(),\n score: z.number(),\n input: z.any().optional(),\n output: z.any(),\n source: z.enum(['LIVE', 'TEST']),\n entityType: z.enum(['AGENT', 'WORKFLOW', ...Object.values(AISpanType)]).optional(),\n scorer: z.record(z.string(), z.any()),\n\n traceId: z.string().optional(),\n spanId: z.string().optional(),\n preprocessStepResult: z.record(z.string(), z.any()).optional(),\n extractStepResult: z.record(z.string(), z.any()).optional(),\n analyzeStepResult: z.record(z.string(), z.any()).optional(),\n reason: z.string().optional(),\n metadata: z.record(z.string(), z.any()).optional(),\n preprocessPrompt: z.string().optional(),\n extractPrompt: z.string().optional(),\n generateScorePrompt: z.string().optional(),\n generateReasonPrompt: z.string().optional(),\n analyzePrompt: z.string().optional(),\n additionalContext: z.record(z.string(), z.any()).optional(),\n runtimeContext: z.record(z.string(), z.any()).optional(),\n entity: z.record(z.string(), z.any()).optional(),\n resourceId: z.string().optional(),\n threadId: z.string().optional(),\n});\n\nexport type ValidatedSaveScorePayload = z.infer<typeof saveScorePayloadSchema>;\n"]}
@@ -1,16 +1,16 @@
1
1
  import { DefaultVoice } from './chunk-RP4YCZP7.js';
2
2
  import { STREAM_FORMAT_SYMBOL, EMITTER_SYMBOL } from './chunk-NLNKQD2T.js';
3
3
  import { InstrumentClass, Telemetry } from './chunk-DSUKMFZY.js';
4
- import { MessageList, DefaultGeneratedFile, DefaultGeneratedFileWithType } from './chunk-GIK7MM2K.js';
5
- import { resolveModelConfig } from './chunk-72F4RGK7.js';
6
- import { MastraLLMV1 } from './chunk-6VB52TJV.js';
4
+ import { MessageList, DefaultGeneratedFile, DefaultGeneratedFileWithType } from './chunk-2KSE77GL.js';
7
5
  import { executeHook } from './chunk-TTELJD4F.js';
6
+ import { resolveModelConfig } from './chunk-72F4RGK7.js';
7
+ import { MastraLLMV1 } from './chunk-4RXCP6HM.js';
8
8
  import { zodToJsonSchema } from './chunk-PJKCPRYF.js';
9
- import { removeUndefinedValues, wrapMastra, selectFields, getOrCreateSpan, getValidTraceId, ensureToolProperties, makeCoreTool, createMastraProxy, isZodType, ModelSpanTracker, delay } from './chunk-PPAIPZ6C.js';
10
- import { RuntimeContext } from './chunk-HLRWYUFN.js';
11
- import { MastraError, safeParseErrorObject, getErrorFromUnknown } from './chunk-PZUZNPFM.js';
9
+ import { removeUndefinedValues, wrapMastra, selectFields, getOrCreateSpan, getValidTraceId, ensureToolProperties, makeCoreTool, createMastraProxy, isZodType, ModelSpanTracker, delay } from './chunk-QE7J6M6C.js';
12
10
  import { ToolStream } from './chunk-5O52O25J.js';
13
11
  import { Tool, createTool } from './chunk-WM4RO23J.js';
12
+ import { RuntimeContext } from './chunk-HLRWYUFN.js';
13
+ import { MastraError, safeParseErrorObject, getErrorFromUnknown } from './chunk-PZUZNPFM.js';
14
14
  import { MastraBase } from './chunk-VQASQG5D.js';
15
15
  import { RegisteredLogger, ConsoleLogger } from './chunk-UXG7PYML.js';
16
16
  import { __commonJS, __toESM, __decoratorStart, __decorateElement, __runInitializers } from './chunk-3HXBPDKN.js';
@@ -1223,5 +1223,5 @@ providerMetadata:baseFinishStep.providerMetadata,text:baseFinishStep.text,warnin
1223
1223
  /** @internal */_getImmediateToolCalls(){return this.#toolCalls;}/** @internal */_getImmediateToolResults(){return this.#toolResults;}/** @internal */_getImmediateText(){return this.#bufferedText.join("");}/** @internal */_getImmediateObject(){return this.#bufferedObject;}/** @internal */_getImmediateUsage(){return this.#usageCount;}/** @internal */_getImmediateWarnings(){return this.#warnings;}/** @internal */_getImmediateFinishReason(){return this.#finishReason;}/** @internal */_getBaseStream(){return this.#baseStream;}#getTotalUsage(){let total=this.#usageCount.totalTokens;if(total===void 0){const input=this.#usageCount.inputTokens??0;const output=this.#usageCount.outputTokens??0;const reasoning=this.#usageCount.reasoningTokens??0;total=input+output+reasoning;}return {inputTokens:this.#usageCount.inputTokens,outputTokens:this.#usageCount.outputTokens,totalTokens:total,reasoningTokens:this.#usageCount.reasoningTokens,cachedInputTokens:this.#usageCount.cachedInputTokens};}#emitChunk(chunk){this.#bufferedChunks.push(chunk);this.#emitter.emit("chunk",chunk);}#createEventedStream(){const self=this;return new ReadableStream$1({start(controller){self.#bufferedChunks.forEach(chunk=>{controller.enqueue(chunk);});if(self.#streamFinished){controller.close();return;}const chunkHandler=chunk=>{controller.enqueue(chunk);};const finishHandler=()=>{self.#emitter.off("chunk",chunkHandler);self.#emitter.off("finish",finishHandler);controller.close();};self.#emitter.on("chunk",chunkHandler);self.#emitter.on("finish",finishHandler);},pull(_controller){if(!self.#consumptionStarted){void self.consumeStream();}},cancel(){self.#emitter.removeAllListeners();}});}get status(){return this.#status;}serializeState(){return {status:this.#status,bufferedSteps:this.#bufferedSteps,bufferedReasoningDetails:this.#bufferedReasoningDetails,bufferedByStep:this.#bufferedByStep,bufferedText:this.#bufferedText,bufferedTextChunks:this.#bufferedTextChunks,bufferedSources:this.#bufferedSources,bufferedReasoning:this.#bufferedReasoning,bufferedFiles:this.#bufferedFiles,toolCallArgsDeltas:this.#toolCallArgsDeltas,toolCallDeltaIdNameMap:this.#toolCallDeltaIdNameMap,toolCalls:this.#toolCalls,toolResults:this.#toolResults,warnings:this.#warnings,finishReason:this.#finishReason,request:this.#request,usageCount:this.#usageCount,tripwire:this.#tripwire,tripwireReason:this.#tripwireReason,messageList:this.messageList.serialize()};}deserializeState(state){this.#status=state.status;this.#bufferedSteps=state.bufferedSteps;this.#bufferedReasoningDetails=state.bufferedReasoningDetails;this.#bufferedByStep=state.bufferedByStep;this.#bufferedText=state.bufferedText;this.#bufferedTextChunks=state.bufferedTextChunks;this.#bufferedSources=state.bufferedSources;this.#bufferedReasoning=state.bufferedReasoning;this.#bufferedFiles=state.bufferedFiles;this.#toolCallArgsDeltas=state.toolCallArgsDeltas;this.#toolCallDeltaIdNameMap=state.toolCallDeltaIdNameMap;this.#toolCalls=state.toolCalls;this.#toolResults=state.toolResults;this.#warnings=state.warnings;this.#finishReason=state.finishReason;this.#request=state.request;this.#usageCount=state.usageCount;this.#tripwire=state.tripwire;this.#tripwireReason=state.tripwireReason;this.messageList=this.messageList.deserialize(state.messageList);}};
1224
1224
 
1225
1225
  export { AISDKV5OutputStream, Agent, BatchPartsProcessor, ChunkFrom, DefaultExecutionEngine, ExecutionEngine, LanguageDetector, LanguageDetectorInputProcessor, LegacyStep, LegacyWorkflow, MastraAgentNetworkStream, MastraModelOutput, ModerationInputProcessor, ModerationProcessor, PIIDetector, PIIDetectorInputProcessor, ProcessorState, PromptInjectionDetector, PromptInjectionDetectorInputProcessor, Run, StructuredOutputProcessor, SystemPromptScrubber, TokenLimiterProcessor, TripWire, UnicodeNormalizer, UnicodeNormalizerInputProcessor, WhenConditionReturnValue, Workflow, WorkflowRunOutput, agentToStep, cloneStep, cloneWorkflow, convertFullStreamChunkToUIMessageStream, convertMastraChunkToAISDKv5, createStep, createTimeTravelExecutionParams, createWorkflow, getActivePathsAndStatus, getResultActivePaths, getResumeLabelsByStepId, getStepIds, getStepResult, getStepResult2, getSuspendedPaths, getZodErrors, isAgent, isConditionalKey, isErrorEvent, isFinalState, isLimboState, isTransitionEvent, isVariableReference, isWorkflow, loop, mapVariable, mergeChildValue, recursivelyCheckForFinalState, resolveVariables, tryGenerateWithJsonFallback, tryStreamWithJsonFallback, updateStepInHierarchy, validateStepInput, validateStepResumeData, workflowToStep };
1226
- //# sourceMappingURL=chunk-Y2BH2LUD.js.map
1227
- //# sourceMappingURL=chunk-Y2BH2LUD.js.map
1226
+ //# sourceMappingURL=chunk-CASJBGBM.js.map
1227
+ //# sourceMappingURL=chunk-CASJBGBM.js.map