@mastra/core 1.23.0-alpha.4 → 1.23.0-alpha.5
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.
- package/CHANGELOG.md +8 -0
- package/dist/agent/index.cjs +8 -8
- package/dist/agent/index.js +1 -1
- package/dist/base.cjs +2 -2
- package/dist/base.d.ts.map +1 -1
- package/dist/base.js +1 -1
- package/dist/browser/index.cjs +6 -6
- package/dist/browser/index.js +3 -3
- package/dist/bundler/index.cjs +2 -2
- package/dist/bundler/index.js +1 -1
- package/dist/cache/index.cjs +3 -3
- package/dist/cache/index.js +1 -1
- package/dist/channels/index.cjs +4 -4
- package/dist/channels/index.js +1 -1
- package/dist/{chunk-CIV5MFO6.cjs → chunk-25EDFTQD.cjs} +4 -4
- package/dist/{chunk-CIV5MFO6.cjs.map → chunk-25EDFTQD.cjs.map} +1 -1
- package/dist/{chunk-K6W2C7PA.js → chunk-3APK6ZID.js} +3 -3
- package/dist/{chunk-K6W2C7PA.js.map → chunk-3APK6ZID.js.map} +1 -1
- package/dist/{chunk-YRDMMXBW.cjs → chunk-47RKHZIP.cjs} +34 -2
- package/dist/chunk-47RKHZIP.cjs.map +1 -0
- package/dist/{chunk-JK5YBBUS.cjs → chunk-4W26D7S6.cjs} +13 -13
- package/dist/chunk-4W26D7S6.cjs.map +1 -0
- package/dist/{chunk-7273BIRR.js → chunk-6UQKQBIB.js} +3 -3
- package/dist/{chunk-7273BIRR.js.map → chunk-6UQKQBIB.js.map} +1 -1
- package/dist/{chunk-G5WUD7SF.js → chunk-72EQLBZY.js} +3 -3
- package/dist/{chunk-G5WUD7SF.js.map → chunk-72EQLBZY.js.map} +1 -1
- package/dist/{chunk-C3G6OQ52.cjs → chunk-7DONY7OL.cjs} +10 -11
- package/dist/chunk-7DONY7OL.cjs.map +1 -0
- package/dist/{chunk-HBO2PK7W.cjs → chunk-7GW2TQXP.cjs} +4 -3
- package/dist/chunk-7GW2TQXP.cjs.map +1 -0
- package/dist/{chunk-74IXDLKF.cjs → chunk-7STIIXEL.cjs} +3 -3
- package/dist/{chunk-74IXDLKF.cjs.map → chunk-7STIIXEL.cjs.map} +1 -1
- package/dist/{chunk-44P7C37G.js → chunk-BMS7MLQV.js} +31 -3
- package/dist/chunk-BMS7MLQV.js.map +1 -0
- package/dist/{chunk-GEI2HTYE.js → chunk-C77V6J36.js} +3 -3
- package/dist/{chunk-GEI2HTYE.js.map → chunk-C77V6J36.js.map} +1 -1
- package/dist/{chunk-ANFGVHG2.cjs → chunk-DAQ4JZQA.cjs} +4 -4
- package/dist/{chunk-ANFGVHG2.cjs.map → chunk-DAQ4JZQA.cjs.map} +1 -1
- package/dist/{chunk-M3LRSDLL.js → chunk-DBBWTK24.js} +4 -3
- package/dist/chunk-DBBWTK24.js.map +1 -0
- package/dist/{chunk-JSG6FULW.cjs → chunk-DO4JBKMT.cjs} +109 -110
- package/dist/chunk-DO4JBKMT.cjs.map +1 -0
- package/dist/{chunk-PGXL3YYH.js → chunk-EG3UGEUZ.js} +4 -4
- package/dist/{chunk-PGXL3YYH.js.map → chunk-EG3UGEUZ.js.map} +1 -1
- package/dist/{chunk-KRDAO5BB.js → chunk-EXORPYDN.js} +3 -3
- package/dist/{chunk-KRDAO5BB.js.map → chunk-EXORPYDN.js.map} +1 -1
- package/dist/{chunk-DKK77FIJ.cjs → chunk-FCQNDFEW.cjs} +7 -7
- package/dist/chunk-FCQNDFEW.cjs.map +1 -0
- package/dist/{chunk-SQXNHM6M.cjs → chunk-FSHOQBGF.cjs} +28 -28
- package/dist/{chunk-SQXNHM6M.cjs.map → chunk-FSHOQBGF.cjs.map} +1 -1
- package/dist/{chunk-3EXOZA2Y.js → chunk-HQXVBGBM.js} +3 -3
- package/dist/{chunk-3EXOZA2Y.js.map → chunk-HQXVBGBM.js.map} +1 -1
- package/dist/{chunk-UUVQS3OG.js → chunk-HWAEQSOO.js} +12 -12
- package/dist/{chunk-UUVQS3OG.js.map → chunk-HWAEQSOO.js.map} +1 -1
- package/dist/{chunk-OF675HEC.cjs → chunk-I4YMMVQ3.cjs} +4 -4
- package/dist/{chunk-OF675HEC.cjs.map → chunk-I4YMMVQ3.cjs.map} +1 -1
- package/dist/{chunk-C264FG5X.js → chunk-I6XSSR4Z.js} +8 -8
- package/dist/{chunk-C264FG5X.js.map → chunk-I6XSSR4Z.js.map} +1 -1
- package/dist/{chunk-JAAICSXU.cjs → chunk-JF3WPB75.cjs} +32 -32
- package/dist/{chunk-JAAICSXU.cjs.map → chunk-JF3WPB75.cjs.map} +1 -1
- package/dist/{chunk-R577LMHJ.cjs → chunk-JJFGNYVY.cjs} +7 -7
- package/dist/{chunk-R577LMHJ.cjs.map → chunk-JJFGNYVY.cjs.map} +1 -1
- package/dist/{chunk-MISEF5LK.js → chunk-JNXWDPCZ.js} +6 -6
- package/dist/chunk-JNXWDPCZ.js.map +1 -0
- package/dist/{chunk-AQUKI2MV.js → chunk-L2MCWEEX.js} +6 -6
- package/dist/{chunk-AQUKI2MV.js.map → chunk-L2MCWEEX.js.map} +1 -1
- package/dist/{chunk-6VIWRHC3.js → chunk-QIJFD7ZC.js} +5 -5
- package/dist/{chunk-6VIWRHC3.js.map → chunk-QIJFD7ZC.js.map} +1 -1
- package/dist/{chunk-7QI6WHSE.js → chunk-QRK2HWHI.js} +8 -8
- package/dist/{chunk-7QI6WHSE.js.map → chunk-QRK2HWHI.js.map} +1 -1
- package/dist/{chunk-KCVSVDQ2.js → chunk-QYQSXRFZ.js} +13 -14
- package/dist/chunk-QYQSXRFZ.js.map +1 -0
- package/dist/{chunk-T26CFBWF.cjs → chunk-RAD2NM47.cjs} +4 -4
- package/dist/{chunk-T26CFBWF.cjs.map → chunk-RAD2NM47.cjs.map} +1 -1
- package/dist/{chunk-NBOTSCZC.js → chunk-TG46FM6X.js} +4 -4
- package/dist/{chunk-NBOTSCZC.js.map → chunk-TG46FM6X.js.map} +1 -1
- package/dist/{chunk-Y67VWDR7.cjs → chunk-TKH2A57J.cjs} +185 -185
- package/dist/{chunk-Y67VWDR7.cjs.map → chunk-TKH2A57J.cjs.map} +1 -1
- package/dist/{chunk-DBN5B2LH.cjs → chunk-UENWRQLR.cjs} +18 -18
- package/dist/{chunk-DBN5B2LH.cjs.map → chunk-UENWRQLR.cjs.map} +1 -1
- package/dist/{chunk-ZOLIH66J.cjs → chunk-V7AX2MSJ.cjs} +20 -20
- package/dist/{chunk-ZOLIH66J.cjs.map → chunk-V7AX2MSJ.cjs.map} +1 -1
- package/dist/{chunk-Z2IR7J5I.js → chunk-VO6R5RZT.js} +8 -9
- package/dist/chunk-VO6R5RZT.js.map +1 -0
- package/dist/{chunk-DNW46JHP.js → chunk-WENZPAHS.js} +4 -4
- package/dist/chunk-WENZPAHS.js.map +1 -0
- package/dist/{chunk-HIC3WGQU.cjs → chunk-X6CDTXAM.cjs} +11 -11
- package/dist/{chunk-HIC3WGQU.cjs.map → chunk-X6CDTXAM.cjs.map} +1 -1
- package/dist/{chunk-CHY6AP6N.cjs → chunk-XFLQVMNH.cjs} +26 -26
- package/dist/{chunk-CHY6AP6N.cjs.map → chunk-XFLQVMNH.cjs.map} +1 -1
- package/dist/{chunk-OFABGAOY.cjs → chunk-XZCYFQ4N.cjs} +64 -65
- package/dist/chunk-XZCYFQ4N.cjs.map +1 -0
- package/dist/{chunk-LBL7GNPF.cjs → chunk-YR7XRMDN.cjs} +10 -10
- package/dist/{chunk-LBL7GNPF.cjs.map → chunk-YR7XRMDN.cjs.map} +1 -1
- package/dist/{chunk-XGUUUEE4.js → chunk-Z34TVGNZ.js} +4 -4
- package/dist/{chunk-XGUUUEE4.js.map → chunk-Z34TVGNZ.js.map} +1 -1
- package/dist/{chunk-EHBTASCW.js → chunk-Z63F3XHK.js} +5 -6
- package/dist/chunk-Z63F3XHK.js.map +1 -0
- package/dist/{chunk-KJDRVBAH.cjs → chunk-Z67JQNEH.cjs} +11 -11
- package/dist/{chunk-KJDRVBAH.cjs.map → chunk-Z67JQNEH.cjs.map} +1 -1
- package/dist/{chunk-QVTTP5HC.js → chunk-ZCBMZ24O.js} +3 -3
- package/dist/{chunk-QVTTP5HC.js.map → chunk-ZCBMZ24O.js.map} +1 -1
- package/dist/{chunk-NMO7ITAY.js → chunk-ZHYPWNWS.js} +5 -5
- package/dist/{chunk-NMO7ITAY.js.map → chunk-ZHYPWNWS.js.map} +1 -1
- package/dist/{chunk-B7JN64YW.cjs → chunk-ZUN5CMDY.cjs} +86 -86
- package/dist/{chunk-B7JN64YW.cjs.map → chunk-ZUN5CMDY.cjs.map} +1 -1
- package/dist/datasets/index.cjs +17 -17
- package/dist/datasets/index.js +2 -2
- package/dist/deployer/index.cjs +2 -2
- package/dist/deployer/index.js +1 -1
- package/dist/docs/SKILL.md +2 -2
- package/dist/docs/assets/SOURCE_MAP.json +499 -499
- package/dist/docs/references/reference-templates-overview.md +88 -14
- package/dist/evals/index.cjs +23 -23
- package/dist/evals/index.js +3 -3
- package/dist/evals/scoreTraces/index.cjs +7 -7
- package/dist/evals/scoreTraces/index.js +3 -3
- package/dist/harness/index.cjs +13 -13
- package/dist/harness/index.js +7 -7
- package/dist/index.cjs +2 -2
- package/dist/index.js +1 -1
- package/dist/llm/index.cjs +20 -20
- package/dist/llm/index.js +5 -5
- package/dist/logger/default-logger.d.ts +1 -1
- package/dist/logger/default-logger.d.ts.map +1 -1
- package/dist/logger/index.cjs +12 -12
- package/dist/logger/index.js +2 -2
- package/dist/loop/index.cjs +14 -14
- package/dist/loop/index.js +1 -1
- package/dist/mastra/index.cjs +2 -2
- package/dist/mastra/index.js +1 -1
- package/dist/mastra-O4WWP6N5.js +3 -0
- package/dist/{mastra-5WYO5ZWG.js.map → mastra-O4WWP6N5.js.map} +1 -1
- package/dist/mastra-VHS7LVQG.cjs +12 -0
- package/dist/{mastra-LIISVKXT.cjs.map → mastra-VHS7LVQG.cjs.map} +1 -1
- package/dist/mcp/index.cjs +4 -4
- package/dist/mcp/index.js +2 -2
- package/dist/memory/index.cjs +17 -17
- package/dist/memory/index.js +1 -1
- package/dist/models-dev-3IPTEPRM.cjs +12 -0
- package/dist/{models-dev-GD4LL56A.cjs.map → models-dev-3IPTEPRM.cjs.map} +1 -1
- package/dist/models-dev-4W7JQVWR.js +3 -0
- package/dist/{models-dev-CJ7IIPNG.js.map → models-dev-4W7JQVWR.js.map} +1 -1
- package/dist/netlify-FZBGNFDI.js +3 -0
- package/dist/{netlify-PMGHRONJ.js.map → netlify-FZBGNFDI.js.map} +1 -1
- package/dist/netlify-XT32D45G.cjs +12 -0
- package/dist/{netlify-6V7UBVTK.cjs.map → netlify-XT32D45G.cjs.map} +1 -1
- package/dist/observability/context-storage.cjs +28 -14
- package/dist/observability/context-storage.cjs.map +1 -1
- package/dist/observability/context-storage.d.ts.map +1 -1
- package/dist/observability/context-storage.js +28 -1
- package/dist/observability/context-storage.js.map +1 -1
- package/dist/observability/index.cjs +26 -10
- package/dist/observability/index.js +1 -1
- package/dist/observability/utils.d.ts +27 -0
- package/dist/observability/utils.d.ts.map +1 -1
- package/dist/processor-provider/index.cjs +10 -10
- package/dist/processor-provider/index.js +1 -1
- package/dist/processors/index.cjs +44 -44
- package/dist/processors/index.js +1 -1
- package/dist/provider-registry-AWL2JDVF.js +3 -0
- package/dist/{provider-registry-JV46DWD7.js.map → provider-registry-AWL2JDVF.js.map} +1 -1
- package/dist/provider-registry-X5PBSJ2G.cjs +40 -0
- package/dist/{provider-registry-U26G7C4O.cjs.map → provider-registry-X5PBSJ2G.cjs.map} +1 -1
- package/dist/relevance/index.cjs +3 -3
- package/dist/relevance/index.js +1 -1
- package/dist/server/index.cjs +5 -5
- package/dist/server/index.js +2 -2
- package/dist/storage/constants.cjs +56 -56
- package/dist/storage/constants.js +1 -1
- package/dist/storage/index.cjs +286 -286
- package/dist/storage/index.js +3 -3
- package/dist/stream/index.cjs +8 -8
- package/dist/stream/index.js +1 -1
- package/dist/test-utils/llm-mock.cjs +4 -4
- package/dist/test-utils/llm-mock.js +1 -1
- package/dist/tool-loop-agent/index.cjs +4 -4
- package/dist/tool-loop-agent/index.js +1 -1
- package/dist/tts/index.cjs +2 -2
- package/dist/tts/index.js +1 -1
- package/dist/utils.cjs +25 -25
- package/dist/utils.js +1 -1
- package/dist/vector/index.cjs +9 -9
- package/dist/vector/index.js +2 -2
- package/dist/voice/index.cjs +6 -6
- package/dist/voice/index.js +1 -1
- package/dist/workflows/evented/index.cjs +10 -10
- package/dist/workflows/evented/index.js +1 -1
- package/dist/workflows/index.cjs +24 -24
- package/dist/workflows/index.js +1 -1
- package/dist/workspace/index.cjs +68 -68
- package/dist/workspace/index.js +1 -1
- package/package.json +5 -5
- package/dist/chunk-2DKOLMVJ.js +0 -28
- package/dist/chunk-2DKOLMVJ.js.map +0 -1
- package/dist/chunk-44P7C37G.js.map +0 -1
- package/dist/chunk-C3G6OQ52.cjs.map +0 -1
- package/dist/chunk-D5FMOLQZ.cjs +0 -32
- package/dist/chunk-D5FMOLQZ.cjs.map +0 -1
- package/dist/chunk-DKK77FIJ.cjs.map +0 -1
- package/dist/chunk-DNW46JHP.js.map +0 -1
- package/dist/chunk-EHBTASCW.js.map +0 -1
- package/dist/chunk-HBO2PK7W.cjs.map +0 -1
- package/dist/chunk-JK5YBBUS.cjs.map +0 -1
- package/dist/chunk-JSG6FULW.cjs.map +0 -1
- package/dist/chunk-KCVSVDQ2.js.map +0 -1
- package/dist/chunk-M3LRSDLL.js.map +0 -1
- package/dist/chunk-MISEF5LK.js.map +0 -1
- package/dist/chunk-OFABGAOY.cjs.map +0 -1
- package/dist/chunk-YRDMMXBW.cjs.map +0 -1
- package/dist/chunk-Z2IR7J5I.js.map +0 -1
- package/dist/mastra-5WYO5ZWG.js +0 -3
- package/dist/mastra-LIISVKXT.cjs +0 -12
- package/dist/models-dev-CJ7IIPNG.js +0 -3
- package/dist/models-dev-GD4LL56A.cjs +0 -12
- package/dist/netlify-6V7UBVTK.cjs +0 -12
- package/dist/netlify-PMGHRONJ.js +0 -3
- package/dist/provider-registry-JV46DWD7.js +0 -3
- package/dist/provider-registry-U26G7C4O.cjs +0 -40
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../_internal-core/src/storage/domains/shared.ts","../../_internal-core/src/storage/domains/observability/logs.ts","../../_internal-core/src/storage/domains/observability/scores.ts","../../_internal-core/src/storage/domains/observability/feedback.ts","../../_internal-core/src/storage/domains/observability/metrics.ts","../../_internal-core/src/storage/domains/observability/discovery.ts","../src/observability/types/tracing.ts","../src/observability/utils.ts"],"names":["EntityType","z","SpanType","InternalSpans","TracingEventType"],"mappings":";;;;;AAGO,IAAK,UAAA,qBAAAA,WAAAA,KAAL;AAELA,EAAAA,WAAAA,CAAA,OAAA,CAAA,GAAQ,OAAA;AAERA,EAAAA,WAAAA,CAAA,QAAA,CAAA,GAAS,QAAA;AAETA,EAAAA,WAAAA,CAAA,YAAA,CAAA,GAAa,YAAA;AAEbA,EAAAA,WAAAA,CAAA,iBAAA,CAAA,GAAkB,iBAAA;AAElBA,EAAAA,WAAAA,CAAA,sBAAA,CAAA,GAAuB,sBAAA;AAEvBA,EAAAA,WAAAA,CAAA,kBAAA,CAAA,GAAmB,kBAAA;AAEnBA,EAAAA,WAAAA,CAAA,uBAAA,CAAA,GAAwB,uBAAA;AAExBA,EAAAA,WAAAA,CAAA,eAAA,CAAA,GAAgB,eAAA;AAEhBA,EAAAA,WAAAA,CAAA,MAAA,CAAA,GAAO,MAAA;AAEPA,EAAAA,WAAAA,CAAA,cAAA,CAAA,GAAe,cAAA;AApBL,EAAA,OAAAA,WAAAA;AAAA,CAAA,EAAA,UAAA,IAAA,EAAA;AA0BL,IAAM,cAAA,GAAiBC,IAAA,CAAE,IAAA,EAAA,CAAO,SAAS,+BAA+B;AAExE,IAAM,cAAA,GAAiBA,IAAA,CAAE,IAAA,EAAA,CAAO,SAAS,kCAAkC;AAE3E,IAAM,YAAA,GAAe;EAC1B,SAAA,EAAW,cAAA;AACX,EAAA,SAAA,EAAW,eAAe,QAAA;AAC5B;AAMO,IAAM,oBAA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IAAI,KAAK,UAAA,IAAc,gBAAA,CAAiB,GAAA,CAAI,IAAA,CAAK,UAAwB,CAAA,EAAG;AAC1E,IAAA,OAAO,IAAA,CAAK,UAAA;AAAA,EACd;AAEA,EAAA,QAAQ,KAAK,QAAA;AAAU,IACrB,KAAA,WAAA;AACE,MAAA,OAAO,UAAA,CAAW,KAAA;AAAA,IACpB,KAAA,YAAA;AAAA,IACA,KAAA,aAAA;AACE,MAAA,OAAO,UAAA,CAAW,MAAA;AAAA,IACpB,KAAA,cAAA;AACE,MAAA,OAAO,UAAA,CAAW,YAAA;AAAA,IACpB,KAAA,eAAA;AACE,MAAA,OAAO,UAAA,CAAW,aAAA;AAAA,IACpB,KAAA,WAAA;AAAA,IACA,KAAA,eAAA;AACE,MAAA,OAAO,UAAA,CAAW,IAAA;AAAA,IACpB,KAAA,eAAA;AACE,MAAA,OAAO,UAAA,CAAW,gBAAA;AAAA,IACpB;AACE,MAAA,OAAO,MAAA;AAAA;AAEb","file":"chunk-47RKHZIP.cjs","sourcesContent":["import { z } from 'zod/v4';\n\n/** Types of entities that can produce observability spans. */\nexport enum EntityType {\n /** Agent/Model execution */\n AGENT = 'agent',\n /** Scorer definition/execution */\n SCORER = 'scorer',\n /** Trajectory evaluation target */\n TRAJECTORY = 'trajectory',\n /** Input Processor */\n INPUT_PROCESSOR = 'input_processor',\n /** Input Step Processor */\n INPUT_STEP_PROCESSOR = 'input_step_processor',\n /** Output Processor */\n OUTPUT_PROCESSOR = 'output_processor',\n /** Output Step Processor */\n OUTPUT_STEP_PROCESSOR = 'output_step_processor',\n /** Workflow Step */\n WORKFLOW_STEP = 'workflow_step',\n /** Tool */\n TOOL = 'tool',\n /** Workflow */\n WORKFLOW_RUN = 'workflow_run',\n}\n\n/**\n * Common DB fields\n */\nexport const createdAtField = z.date().describe('Database record creation time');\n\nexport const updatedAtField = z.date().describe('Database record last update time');\n\nexport const dbTimestamps = {\n createdAt: createdAtField,\n updatedAt: updatedAtField.nullable(),\n} as const satisfies z.ZodRawShape;\n\n/**\n * Pagination arguments for list queries (page and perPage only)\n * Uses z.coerce to handle string → number conversion from query params\n */\nexport const paginationArgsSchema = z\n .object({\n page: z.coerce.number().int().min(0).optional().default(0).describe('Zero-indexed page number'),\n perPage: z.coerce.number().int().min(1).max(100).optional().default(10).describe('Number of items per page'),\n })\n .describe('Pagination options for list queries');\n\n/** Input type for pagination arguments (page and perPage). */\nexport type PaginationArgs = z.input<typeof paginationArgsSchema>;\n\n/**\n * Pagination response info\n * Used across all paginated endpoints\n */\nexport const paginationInfoSchema = z.object({\n total: z.number().describe('Total number of items available'),\n page: z.number().describe('Current page'),\n perPage: z\n .union([z.number(), z.literal(false)])\n .describe('Number of items per page, or false if pagination is disabled'),\n hasMore: z.boolean().describe('True if more pages are available'),\n});\n\n/**\n * Date range for filtering by time\n * Uses z.coerce to handle ISO string → Date conversion from query params\n */\nexport const dateRangeSchema = z\n .object({\n start: z.coerce.date().optional().describe('Start of date range (inclusive by default)'),\n end: z.coerce.date().optional().describe('End of date range (inclusive by default)'),\n startExclusive: z\n .boolean()\n .optional()\n .describe('When true, excludes the start date from results (uses > instead of >=)'),\n endExclusive: z\n .boolean()\n .optional()\n .describe('When true, excludes the end date from results (uses < instead of <=)'),\n })\n .describe('Date range filter for timestamps');\n\n/** Date range with optional inclusive/exclusive boundaries. */\nexport type DateRange = z.input<typeof dateRangeSchema>;\n\nexport const sortDirectionSchema = z.enum(['ASC', 'DESC']).describe(\"Sort direction: 'ASC' | 'DESC'\");\n\n/** Aggregation type schema shared across OLAP-style observability queries. */\nexport const aggregationTypeSchema = z\n .enum(['sum', 'avg', 'min', 'max', 'count', 'last'])\n .describe('Aggregation function');\nexport type AggregationType = z.infer<typeof aggregationTypeSchema>;\n\n/** Aggregation interval schema shared across OLAP-style observability queries. */\nexport const aggregationIntervalSchema = z.enum(['1m', '5m', '15m', '1h', '1d']).describe('Time bucket interval');\nexport type AggregationInterval = z.infer<typeof aggregationIntervalSchema>;\n\n/** Compare period for aggregate queries with period-over-period comparison. */\nexport const comparePeriodSchema = z\n .enum(['previous_period', 'previous_day', 'previous_week'])\n .describe('Comparison period for aggregate queries');\nexport type ComparePeriod = z.infer<typeof comparePeriodSchema>;\n\n/** Shared groupBy schema for OLAP-style breakdown and time-series queries. */\nexport const groupBySchema = z.array(z.string()).min(1).describe('Fields to group by');\nexport type GroupBy = z.infer<typeof groupBySchema>;\n\n/** Shared percentiles schema for percentile queries. */\nexport const percentilesSchema = z.array(z.number().min(0).max(1)).min(1).describe('Percentile values (0-1)');\nexport type Percentiles = z.infer<typeof percentilesSchema>;\n\n/** Shared fields for aggregate OLAP responses across observability signals. */\nexport const aggregateResponseFields = {\n value: z.number().nullable().describe('Aggregated value'),\n previousValue: z.number().nullable().optional().describe('Value from comparison period'),\n changePercent: z.number().nullable().optional().describe('Percentage change from comparison period'),\n} as const;\n\n/** Shared field for OLAP breakdown dimension values. */\nexport const dimensionsField = z.record(z.string(), z.string().nullable()).describe('Dimension values for this group');\n\n/** Shared field for non-null OLAP aggregated values. */\nexport const aggregatedValueField = z.number().describe('Aggregated value');\n\n/** Shared field for OLAP bucket timestamps. */\nexport const bucketTimestampField = z.date().describe('Bucket timestamp');\n\n/** Shared field for percentile identifiers in OLAP responses. */\nexport const percentileField = z.number().describe('Percentile value');\n\n/** Shared field for percentile values within a time bucket. */\nexport const percentileBucketValueField = z.number().describe('Percentile value at this bucket');\n\nexport const entityTypeField = z\n .nativeEnum(EntityType)\n .describe(`Entity type (e.g., 'agent' | 'processor' | 'tool' | 'workflow')`);\n\nexport const entityIdField = z.string().describe('ID of the entity (e.g., \"weatherAgent\", \"orderWorkflow\")');\n\nexport const entityNameField = z.string().describe('Name of the entity');\n\nexport const userIdField = z.string().describe('Human end-user who triggered execution');\n\nexport const organizationIdField = z.string().describe('Multi-tenant organization/account');\n\nexport const resourceIdField = z.string().describe('Broader resource context (Mastra memory compatibility)');\n\nexport const runIdField = z.string().describe('Unique execution run identifier');\n\nexport const sessionIdField = z.string().describe('Session identifier for grouping traces');\n\nexport const threadIdField = z.string().describe('Conversation thread identifier');\n\nexport const requestIdField = z.string().describe('HTTP request ID for log correlation');\n\nexport const environmentField = z.string().describe(`Environment (e.g., \"production\" | \"staging\" | \"development\")`);\n\nexport const sourceField = z.string().describe(`Source of execution (e.g., \"local\" | \"cloud\" | \"ci\")`);\nexport const executionSourceField = z.string().describe(`Source of execution (e.g., \"local\" | \"cloud\" | \"ci\")`);\n\nexport const serviceNameField = z.string().describe('Name of the service');\n\n// Parent entity hierarchy fields\nexport const parentEntityTypeField = z.nativeEnum(EntityType).describe('Entity type of the parent entity');\nexport const parentEntityIdField = z.string().describe('ID of the parent entity');\nexport const parentEntityNameField = z.string().describe('Name of the parent entity');\n\n// Root entity hierarchy fields\nexport const rootEntityTypeField = z.nativeEnum(EntityType).describe('Entity type of the root entity');\nexport const rootEntityIdField = z.string().describe('ID of the root entity');\nexport const rootEntityNameField = z.string().describe('Name of the root entity');\n\n// Experimentation\nexport const experimentIdField = z.string().describe('Experiment or eval run identifier');\n\n// ============================================================================\n// Common observability fields (shared across tracing, metrics, logs)\n// ============================================================================\n\nexport const scopeField = z\n .record(z.string(), z.unknown())\n .describe('Arbitrary package/app version info (e.g., {\"core\": \"1.0.0\", \"memory\": \"1.0.0\", \"gitSha\": \"abcd1234\"})');\n\nexport const metadataField = z.record(z.string(), z.unknown()).describe('User-defined metadata for custom filtering');\n\nexport const tagsField = z.array(z.string()).describe('Labels for filtering');\n\n/**\n * Base context fields shared across tracing and non-tracing observability records.\n * Source/provenance is intentionally excluded because tracing uses `source`\n * while signals use `executionSource`.\n */\nconst contextFieldsBase = {\n // Entity identification\n entityType: entityTypeField.nullish(),\n entityId: entityIdField.nullish(),\n entityName: entityNameField.nullish(),\n\n // Parent entity hierarchy\n parentEntityType: parentEntityTypeField.nullish(),\n parentEntityId: parentEntityIdField.nullish(),\n parentEntityName: parentEntityNameField.nullish(),\n\n // Root entity hierarchy\n rootEntityType: rootEntityTypeField.nullish(),\n rootEntityId: rootEntityIdField.nullish(),\n rootEntityName: rootEntityNameField.nullish(),\n\n // Identity & tenancy\n userId: userIdField.nullish(),\n organizationId: organizationIdField.nullish(),\n resourceId: resourceIdField.nullish(),\n\n // Correlation IDs\n runId: runIdField.nullish(),\n sessionId: sessionIdField.nullish(),\n threadId: threadIdField.nullish(),\n requestId: requestIdField.nullish(),\n\n // Deployment context\n environment: environmentField.nullish(),\n serviceName: serviceNameField.nullish(),\n scope: scopeField.nullish(),\n\n // Experimentation\n experimentId: experimentIdField.nullish(),\n} as const;\n\n/**\n * Context fields shared across observability signals other than spans (metrics, logs, scores, feedback).\n * These use `executionSource` to avoid colliding with signal-specific provenance fields.\n */\nexport const contextFields = {\n ...contextFieldsBase,\n executionSource: executionSourceField.nullish(),\n tags: tagsField.nullish(),\n} as const;\n\n/**\n * Context fields used by tracing/span records.\n * Tracing continues to expose execution provenance as `source`.\n */\nexport const spanContextFields = {\n ...contextFieldsBase,\n source: sourceField.nullish(),\n} as const;\n\n/**\n * Common filter fields shared across observability signal filters (metrics, logs, scores, feedback).\n * All fields are optional — each signal extends this with signal-specific filters.\n */\nexport const commonFilterFields = {\n timestamp: dateRangeSchema.optional().describe('Filter by timestamp range'),\n traceId: z.string().optional().describe('Filter by trace ID'),\n spanId: z.string().optional().describe('Filter by span ID'),\n entityType: entityTypeField.optional(),\n entityName: entityNameField.optional(),\n userId: userIdField.optional(),\n organizationId: organizationIdField.optional(),\n experimentId: experimentIdField.optional(),\n serviceName: serviceNameField.optional(),\n environment: environmentField.optional(),\n parentEntityType: parentEntityTypeField.optional(),\n parentEntityName: parentEntityNameField.optional(),\n rootEntityType: rootEntityTypeField.optional(),\n rootEntityName: rootEntityNameField.optional(),\n resourceId: resourceIdField.optional(),\n runId: runIdField.optional(),\n sessionId: sessionIdField.optional(),\n threadId: threadIdField.optional(),\n requestId: requestIdField.optional(),\n executionSource: executionSourceField.optional(),\n tags: z.array(z.string()).optional().describe('Filter by tags (must have all specified tags)'),\n} as const;\n\n// ============================================================================\n// Tracing identifier fields (shared across scores, feedback, metrics)\n// ============================================================================\n\n/** Zod schema for trace ID field */\nexport const traceIdField = z.string().describe('Unique trace identifier');\n\n/** Zod schema for span ID field */\nexport const spanIdField = z.string().describe('Unique span identifier within a trace');\n","import { z } from 'zod/v4';\nimport {\n commonFilterFields,\n contextFields,\n metadataField,\n paginationArgsSchema,\n paginationInfoSchema,\n sortDirectionSchema,\n spanIdField,\n tagsField,\n traceIdField,\n} from '../shared';\n\n// ============================================================================\n// Field Schemas\n// ============================================================================\n\n/** Log level schema for validation */\nexport const logLevelSchema = z.enum(['debug', 'info', 'warn', 'error', 'fatal']);\n\nconst messageField = z.string().describe('Log message');\nconst logDataField = z.record(z.string(), z.unknown()).describe('Structured data attached to the log');\n\n// ============================================================================\n// LogRecord Schema (Storage Format)\n// ============================================================================\n\n/**\n * Schema for logs as stored in the database.\n * Includes all fields from ExportedLog plus storage-specific fields.\n */\nexport const logRecordSchema = z\n .object({\n timestamp: z.date().describe('When the log was created'),\n level: logLevelSchema.describe('Log severity level'),\n message: messageField,\n data: logDataField.nullish(),\n\n // Correlation\n traceId: traceIdField.nullish(),\n spanId: spanIdField.nullish(),\n\n // Context fields\n ...contextFields,\n /**\n * @deprecated Use `executionSource` instead.\n */\n source: z.string().nullish().describe('Execution source'),\n\n metadata: metadataField.nullish(),\n })\n .describe('Log record as stored in the database');\n\n/** Log record type for storage */\nexport type LogRecord = z.infer<typeof logRecordSchema>;\n\n// ============================================================================\n// LogRecordInput Schema (User-Facing API)\n// ============================================================================\n\n/**\n * Schema for user-provided log input (minimal required fields).\n * The logger enriches this with context before emitting ExportedLog.\n */\nexport const logRecordInputSchema = z\n .object({\n level: logLevelSchema,\n message: messageField,\n data: logDataField.optional(),\n tags: tagsField.optional(),\n })\n .describe('User-provided log input');\n\n/** User-facing log input type */\nexport type LogRecordInput = z.infer<typeof logRecordInputSchema>;\n\n// ============================================================================\n// Create Log Schemas\n// ============================================================================\n\n/** Schema for creating a log record */\nexport const createLogRecordSchema = logRecordSchema;\n\n/** Log record for creation (excludes db timestamps) */\nexport type CreateLogRecord = z.infer<typeof createLogRecordSchema>;\n\n/** Schema for batchCreateLogs operation arguments */\nexport const batchCreateLogsArgsSchema = z\n .object({\n logs: z.array(createLogRecordSchema),\n })\n .describe('Arguments for batch creating logs');\n\n/** Arguments for batch creating logs */\nexport type BatchCreateLogsArgs = z.infer<typeof batchCreateLogsArgsSchema>;\n\n// ============================================================================\n// Log Filter Schema\n// ============================================================================\n\n/** Schema for filtering logs in list queries */\nexport const logsFilterSchema = z\n .object({\n ...commonFilterFields,\n\n // Log-specific filters\n /**\n * @deprecated Use `executionSource` instead.\n */\n source: z.string().optional().describe('Filter by execution source'),\n level: z\n .union([logLevelSchema, z.array(logLevelSchema)])\n .optional()\n .describe('Filter by log level(s)'),\n })\n .describe('Filters for querying logs');\n\n/** Filters for querying logs */\nexport type LogsFilter = z.infer<typeof logsFilterSchema>;\n\n// ============================================================================\n// List Logs Schemas\n// ============================================================================\n\n/** Fields available for ordering log results */\nexport const logsOrderByFieldSchema = z.enum(['timestamp']).describe(\"Field to order by: 'timestamp'\");\n\n/** Order by configuration for log queries */\nexport const logsOrderBySchema = z\n .object({\n field: logsOrderByFieldSchema.default('timestamp').describe('Field to order by'),\n direction: sortDirectionSchema.default('DESC').describe('Sort direction'),\n })\n .describe('Order by configuration');\n\n/** Schema for listLogs operation arguments */\nexport const listLogsArgsSchema = z\n .object({\n filters: logsFilterSchema.optional().describe('Optional filters to apply'),\n pagination: paginationArgsSchema.default({ page: 0, perPage: 10 }).describe('Pagination settings'),\n orderBy: logsOrderBySchema\n .default({ field: 'timestamp', direction: 'DESC' })\n .describe('Ordering configuration (defaults to timestamp desc)'),\n })\n .describe('Arguments for listing logs');\n\n/** Arguments for listing logs */\nexport type ListLogsArgs = z.input<typeof listLogsArgsSchema>;\n\n/** Schema for listLogs operation response */\nexport const listLogsResponseSchema = z.object({\n pagination: paginationInfoSchema,\n logs: z.array(logRecordSchema),\n});\n\n/** Response containing paginated logs */\nexport type ListLogsResponse = z.infer<typeof listLogsResponseSchema>;\n","import { z } from 'zod/v4';\nimport {\n aggregateResponseFields,\n aggregationIntervalSchema,\n aggregationTypeSchema,\n aggregatedValueField,\n bucketTimestampField,\n comparePeriodSchema,\n commonFilterFields,\n experimentIdField,\n contextFields,\n dimensionsField,\n entityTypeField,\n groupBySchema,\n paginationArgsSchema,\n paginationInfoSchema,\n percentileField,\n percentileBucketValueField,\n percentilesSchema,\n sortDirectionSchema,\n spanIdField,\n traceIdField,\n} from '../shared';\n\n// ============================================================================\n// Field Schemas\n// ============================================================================\n\nconst scorerIdField = z.string().describe('Identifier of the scorer (e.g., relevance, accuracy)');\nconst scorerNameField = z.string().describe('Display name of the scorer');\nconst scorerVersionField = z.string().describe('Version of the scorer');\nconst scoreSourceField = z.string().describe('How the score was produced (e.g., manual, automated, experiment)');\nconst scoreValueField = z.number().describe('Score value (range defined by scorer)');\nconst scoreReasonField = z.string().describe('Explanation for the score');\n\n// ============================================================================\n// ScoreRecord Schema (Storage Format)\n// ============================================================================\n\n/**\n * Schema for scores as stored in the database.\n * Includes all fields from ExportedScore plus storage-specific fields.\n */\nexport const scoreRecordSchema = z\n .object({\n timestamp: z.date().describe('When the score was recorded'),\n\n // Target\n traceId: traceIdField.nullish().describe('Trace that anchors the scored target when available'),\n spanId: spanIdField.nullish().describe('Span ID this score applies to'),\n\n // Score data\n scorerId: scorerIdField,\n scorerName: scorerNameField.nullish(),\n scorerVersion: scorerVersionField.nullish(),\n scoreSource: scoreSourceField.nullish(),\n /**\n * @deprecated Use `scoreSource` instead.\n */\n source: scoreSourceField.nullish(),\n score: scoreValueField,\n reason: scoreReasonField.nullish(),\n\n // Context (entity hierarchy, identity, correlation, deployment, experimentation)\n ...contextFields,\n\n /** Trace ID of the scoring run (links to trace that generated this score) */\n scoreTraceId: z.string().nullish().describe('Trace ID of the scoring run for debugging score generation'),\n\n // User-defined metadata (context fields stored here)\n metadata: z.record(z.string(), z.unknown()).nullish().describe('User-defined metadata'),\n })\n .describe('Score record as stored in the database');\n\n/** Score record type for storage */\nexport type ScoreRecord = z.infer<typeof scoreRecordSchema>;\n\n// ============================================================================\n// ScoreInput Schema (User-Facing API)\n// ============================================================================\n\n/**\n * Schema for user-provided score input (minimal required fields).\n * The span/trace context adds traceId/spanId before emitting ExportedScore.\n */\nexport const scoreInputSchema = z\n .object({\n scorerId: scorerIdField,\n scorerName: scorerNameField.optional(),\n scorerVersion: scorerVersionField.optional(),\n scoreSource: scoreSourceField.optional(),\n /**\n * @deprecated Use `scoreSource` instead.\n */\n source: scoreSourceField.optional(),\n score: scoreValueField,\n reason: scoreReasonField.optional(),\n metadata: z.record(z.string(), z.unknown()).optional().describe('Additional scorer-specific metadata'),\n experimentId: experimentIdField.optional(),\n scoreTraceId: z.string().optional().describe('Trace ID of the scoring run for debugging score generation'),\n targetEntityType: entityTypeField.optional().describe('Entity type the scorer evaluated when known'),\n })\n .describe('User-provided score input');\n\n/** User-facing score input type */\nexport type ScoreInput = z.infer<typeof scoreInputSchema>;\n\n// ============================================================================\n// Create Score Schemas\n// ============================================================================\n\n/** Schema for creating a score record */\nexport const createScoreRecordSchema = scoreRecordSchema;\n\n/** Score record for creation */\nexport type CreateScoreRecord = z.infer<typeof createScoreRecordSchema>;\n\n/** Schema for createScore operation arguments */\nexport const createScoreArgsSchema = z\n .object({\n score: createScoreRecordSchema,\n })\n .describe('Arguments for creating a score');\n\n/** Arguments for creating a score */\nexport type CreateScoreArgs = z.infer<typeof createScoreArgsSchema>;\n\n/** Schema for createScore operation body in client/server */\nexport const createScoreBodySchema = z\n .object({\n score: createScoreRecordSchema.omit({ timestamp: true }),\n })\n .describe('Arguments for creating a score');\n\n/** Body for creating a score in client/server */\nexport type CreateScoreBody = z.infer<typeof createScoreBodySchema>;\n\n/** Schema for createScore operation response */\nexport const createScoreResponseSchema = z.object({ success: z.boolean() }).describe('Response from creating a score');\n\n/** Response from creating a score */\nexport type CreateScoreResponse = z.infer<typeof createScoreResponseSchema>;\n\n/** Schema for batchCreateScores operation arguments */\nexport const batchCreateScoresArgsSchema = z\n .object({\n scores: z.array(createScoreRecordSchema),\n })\n .describe('Arguments for batch recording scores');\n\n/** Arguments for batch creating scores */\nexport type BatchCreateScoresArgs = z.infer<typeof batchCreateScoresArgsSchema>;\n\n// ============================================================================\n// Score Filter Schema\n// ============================================================================\n\n/** Schema for filtering scores in list queries */\nexport const scoresFilterSchema = z\n .object({\n ...commonFilterFields,\n\n // Score-specific filters\n scorerId: z\n .union([z.string(), z.array(z.string())])\n .optional()\n .describe('Filter by scorer ID(s)'),\n scoreSource: scoreSourceField.optional().describe('Filter by how the score was produced'),\n /**\n * @deprecated Use `scoreSource` instead.\n */\n source: scoreSourceField.optional().describe('Filter by how the score was produced'),\n })\n .describe('Filters for querying scores');\n\n/** Filters for querying scores */\nexport type ScoresFilter = z.infer<typeof scoresFilterSchema>;\n\n// ============================================================================\n// List Scores Schemas\n// ============================================================================\n\n/** Fields available for ordering score results */\nexport const scoresOrderByFieldSchema = z\n .enum(['timestamp', 'score'])\n .describe(\"Field to order by: 'timestamp' | 'score'\");\n\n/** Order by configuration for score queries */\nexport const scoresOrderBySchema = z\n .object({\n field: scoresOrderByFieldSchema.default('timestamp').describe('Field to order by'),\n direction: sortDirectionSchema.default('DESC').describe('Sort direction'),\n })\n .describe('Order by configuration');\n\n/** Schema for listScores operation arguments */\nexport const listScoresArgsSchema = z\n .object({\n filters: scoresFilterSchema.optional(),\n pagination: paginationArgsSchema.default({ page: 0, perPage: 10 }).describe('Pagination settings'),\n orderBy: scoresOrderBySchema\n .default({ field: 'timestamp', direction: 'DESC' })\n .describe('Ordering configuration (defaults to timestamp desc)'),\n })\n .describe('Arguments for listing scores');\n\n/** Arguments for listing scores */\nexport type ListScoresArgs = z.input<typeof listScoresArgsSchema>;\n\n/** Schema for listScores operation response */\nexport const listScoresResponseSchema = z.object({\n pagination: paginationInfoSchema,\n scores: z.array(scoreRecordSchema),\n});\n\n/** Response containing paginated scores */\nexport type ListScoresResponse = z.infer<typeof listScoresResponseSchema>;\n\n// ============================================================================\n// OLAP Query Schemas\n// ============================================================================\n\nexport const getScoreAggregateArgsSchema = z\n .object({\n scorerId: scorerIdField,\n scoreSource: scoreSourceField.optional(),\n aggregation: aggregationTypeSchema,\n filters: scoresFilterSchema.optional(),\n comparePeriod: comparePeriodSchema.optional(),\n })\n .describe('Arguments for getting a score aggregate');\n\nexport type GetScoreAggregateArgs = z.infer<typeof getScoreAggregateArgsSchema>;\n\nexport const getScoreAggregateResponseSchema = z.object(aggregateResponseFields);\n\nexport type GetScoreAggregateResponse = z.infer<typeof getScoreAggregateResponseSchema>;\n\nexport const getScoreBreakdownArgsSchema = z\n .object({\n scorerId: scorerIdField,\n scoreSource: scoreSourceField.optional(),\n groupBy: groupBySchema,\n aggregation: aggregationTypeSchema,\n filters: scoresFilterSchema.optional(),\n })\n .describe('Arguments for getting a score breakdown');\n\nexport type GetScoreBreakdownArgs = z.infer<typeof getScoreBreakdownArgsSchema>;\n\nexport const getScoreBreakdownResponseSchema = z.object({\n groups: z.array(\n z.object({\n dimensions: dimensionsField,\n value: aggregatedValueField,\n }),\n ),\n});\n\nexport type GetScoreBreakdownResponse = z.infer<typeof getScoreBreakdownResponseSchema>;\n\nexport const getScoreTimeSeriesArgsSchema = z\n .object({\n scorerId: scorerIdField,\n scoreSource: scoreSourceField.optional(),\n interval: aggregationIntervalSchema,\n aggregation: aggregationTypeSchema,\n filters: scoresFilterSchema.optional(),\n groupBy: groupBySchema.optional(),\n })\n .describe('Arguments for getting score time series');\n\nexport type GetScoreTimeSeriesArgs = z.infer<typeof getScoreTimeSeriesArgsSchema>;\n\nexport const getScoreTimeSeriesResponseSchema = z.object({\n series: z.array(\n z.object({\n name: z.string().describe('Series name (scorer ID or group key)'),\n points: z.array(\n z.object({\n timestamp: bucketTimestampField,\n value: aggregatedValueField,\n }),\n ),\n }),\n ),\n});\n\nexport type GetScoreTimeSeriesResponse = z.infer<typeof getScoreTimeSeriesResponseSchema>;\n\nexport const getScorePercentilesArgsSchema = z\n .object({\n scorerId: scorerIdField,\n scoreSource: scoreSourceField.optional(),\n percentiles: percentilesSchema,\n interval: aggregationIntervalSchema,\n filters: scoresFilterSchema.optional(),\n })\n .describe('Arguments for getting score percentiles');\n\nexport type GetScorePercentilesArgs = z.infer<typeof getScorePercentilesArgsSchema>;\n\nexport const getScorePercentilesResponseSchema = z.object({\n series: z.array(\n z.object({\n percentile: percentileField,\n points: z.array(\n z.object({\n timestamp: bucketTimestampField,\n value: percentileBucketValueField,\n }),\n ),\n }),\n ),\n});\n\nexport type GetScorePercentilesResponse = z.infer<typeof getScorePercentilesResponseSchema>;\n","import { z } from 'zod/v4';\nimport {\n aggregateResponseFields,\n aggregationIntervalSchema,\n aggregationTypeSchema,\n aggregatedValueField,\n bucketTimestampField,\n comparePeriodSchema,\n commonFilterFields,\n experimentIdField,\n contextFields,\n dimensionsField,\n groupBySchema,\n paginationArgsSchema,\n paginationInfoSchema,\n percentileField,\n percentileBucketValueField,\n percentilesSchema,\n sortDirectionSchema,\n spanIdField,\n traceIdField,\n} from '../shared';\n\n// ============================================================================\n// Field Schemas\n// ============================================================================\n\nconst feedbackSourceField = z.string().describe(\"Source of feedback (e.g., 'user', 'system', 'manual')\");\nconst feedbackTypeField = z.string().describe(\"Type of feedback (e.g., 'thumbs', 'rating', 'correction')\");\nconst feedbackValueField = z\n .union([z.number(), z.string()])\n .describe('Feedback value (rating number or correction text)');\nconst feedbackCommentField = z.string().describe('Additional comment or context');\nconst feedbackUserIdField = z.string().describe('User who provided the feedback');\n\nfunction normalizeLegacyFeedbackActor<T>(input: T): T {\n if (!input || typeof input !== 'object' || Array.isArray(input)) {\n return input;\n }\n\n const record = { ...(input as Record<string, unknown>) };\n if (typeof record.userId === 'string' && record.feedbackUserId == null) {\n record.feedbackUserId = record.userId;\n delete record.userId;\n }\n\n return record as T;\n}\n\n// ============================================================================\n// FeedbackRecord Schema (Storage Format)\n// ============================================================================\n\n/**\n * Schema for feedback as stored in the database.\n * Includes all fields from ExportedFeedback plus storage-specific fields.\n */\nconst feedbackRecordObjectSchema = z.object({\n timestamp: z.date().describe('When the feedback was recorded'),\n\n // Target\n traceId: traceIdField.nullish().describe('Trace that anchors the feedback target when available'),\n spanId: spanIdField.nullish().describe('Span ID this feedback applies to'),\n\n // Feedback data\n feedbackSource: feedbackSourceField.nullish(),\n /**\n * @deprecated Use `feedbackSource` instead.\n */\n source: feedbackSourceField.nullish(),\n feedbackType: feedbackTypeField,\n value: feedbackValueField,\n comment: feedbackCommentField.nullish(),\n\n // Feedback actor identity\n feedbackUserId: feedbackUserIdField.nullish(),\n\n // Context (entity hierarchy, identity, correlation, deployment, experimentation)\n ...contextFields,\n\n // Source linkage (e.g. dataset item result ID)\n sourceId: z\n .string()\n .nullish()\n .describe('ID of the source record this feedback is linked to (e.g. experiment result ID)'),\n\n // User-defined metadata (context fields stored here)\n metadata: z.record(z.string(), z.unknown()).nullish().describe('User-defined metadata'),\n});\n\nexport const feedbackRecordSchema = z\n .object(feedbackRecordObjectSchema.shape)\n .describe('Feedback record as stored in the database');\n\n/** Feedback record type for storage */\nexport type FeedbackRecord = z.infer<typeof feedbackRecordSchema>;\n\n// ============================================================================\n// FeedbackInput Schema (User-Facing API)\n// ============================================================================\n\n/**\n * Schema for user-provided feedback input (minimal required fields).\n * The span/trace context adds traceId/spanId before emitting ExportedFeedback.\n */\nconst feedbackInputObjectSchema = z.object({\n feedbackSource: feedbackSourceField.optional(),\n /**\n * @deprecated Use `feedbackSource` instead.\n */\n source: feedbackSourceField.optional(),\n feedbackType: feedbackTypeField,\n value: feedbackValueField,\n comment: feedbackCommentField.optional(),\n feedbackUserId: feedbackUserIdField.optional(),\n /**\n * @deprecated Use `feedbackUserId` instead.\n */\n userId: feedbackUserIdField.optional(),\n metadata: z.record(z.string(), z.unknown()).optional().describe('Additional feedback-specific metadata'),\n experimentId: experimentIdField.optional(),\n sourceId: z.string().optional().describe('ID of the source record this feedback is linked to'),\n});\n\nexport const feedbackInputSchema = z.object(feedbackInputObjectSchema.shape).describe('User-provided feedback input');\n\n/** User-facing feedback input type */\nexport type FeedbackInput = z.infer<typeof feedbackInputSchema>;\n\n// ============================================================================\n// Create Feedback Schemas\n// ============================================================================\n\n/** Schema for creating a feedback record */\nexport const createFeedbackRecordSchema = feedbackRecordSchema;\n\n/** Feedback record for creation */\nexport type CreateFeedbackRecord = z.infer<typeof createFeedbackRecordSchema>;\n\n/** Schema for createFeedback operation arguments */\nexport const createFeedbackArgsSchema = z\n .object({\n feedback: z.preprocess(normalizeLegacyFeedbackActor, feedbackRecordObjectSchema),\n })\n .describe('Arguments for creating feedback');\n\n/** Arguments for creating feedback */\nexport type CreateFeedbackArgs = z.infer<typeof createFeedbackArgsSchema>;\n\n/** Schema for createFeedback operation body in client/server */\nexport const createFeedbackBodySchema = z\n .object({\n feedback: feedbackRecordObjectSchema.omit({ timestamp: true }),\n })\n .describe('Arguments for creating feedback');\n\n/** Body for creating feedback in client/server */\nexport type CreateFeedbackBody = z.infer<typeof createFeedbackBodySchema>;\n\n/** Schema for createFeedback operation response */\nexport const createFeedbackResponseSchema = z\n .object({ success: z.boolean() })\n .describe('Response from creating feedback');\n\n/** Response from creating feedback */\nexport type CreateFeedbackResponse = z.infer<typeof createFeedbackResponseSchema>;\n\n/** Schema for batchCreateFeedback operation arguments */\nexport const batchCreateFeedbackArgsSchema = z\n .object({\n feedbacks: z.array(z.preprocess(normalizeLegacyFeedbackActor, feedbackRecordObjectSchema)),\n })\n .describe('Arguments for batch recording feedback');\n\n/** Arguments for batch creating feedback */\nexport type BatchCreateFeedbackArgs = z.infer<typeof batchCreateFeedbackArgsSchema>;\n\n// ============================================================================\n// Feedback Filter Schema\n// ============================================================================\n\n/** Schema for filtering feedback in list queries */\nconst feedbackFilterObjectSchema = z.object({\n ...commonFilterFields,\n\n // Feedback-specific filters\n feedbackType: z\n .union([z.string(), z.array(z.string())])\n .optional()\n .describe('Filter by feedback type(s)'),\n feedbackSource: feedbackSourceField.optional(),\n /**\n * @deprecated Use `feedbackSource` instead.\n */\n source: feedbackSourceField.optional(),\n feedbackUserId: feedbackUserIdField.optional(),\n});\n\nexport const feedbackFilterSchema = z\n .object(feedbackFilterObjectSchema.shape)\n .describe('Filters for querying feedback');\n\n/** Filters for querying feedback */\nexport type FeedbackFilter = z.infer<typeof feedbackFilterSchema>;\n\n// ============================================================================\n// List Feedback Schemas\n// ============================================================================\n\n/** Fields available for ordering feedback results */\nexport const feedbackOrderByFieldSchema = z.enum(['timestamp']).describe(\"Field to order by: 'timestamp'\");\n\n/** Order by configuration for feedback queries */\nexport const feedbackOrderBySchema = z\n .object({\n field: feedbackOrderByFieldSchema.default('timestamp').describe('Field to order by'),\n direction: sortDirectionSchema.default('DESC').describe('Sort direction'),\n })\n .describe('Order by configuration');\n\n/** Schema for listFeedback operation arguments */\nexport const listFeedbackArgsSchema = z\n .object({\n filters: z\n .preprocess(normalizeLegacyFeedbackActor, feedbackFilterObjectSchema)\n .optional()\n .describe('Optional filters to apply'),\n pagination: paginationArgsSchema.default({ page: 0, perPage: 10 }).describe('Pagination settings'),\n orderBy: feedbackOrderBySchema\n .default({ field: 'timestamp', direction: 'DESC' })\n .describe('Ordering configuration (defaults to timestamp desc)'),\n })\n .describe('Arguments for listing feedback');\n\n/** Arguments for listing feedback */\nexport type ListFeedbackArgs = z.input<typeof listFeedbackArgsSchema>;\n\n/** Schema for listFeedback operation response */\nexport const listFeedbackResponseSchema = z.object({\n pagination: paginationInfoSchema,\n feedback: z.array(feedbackRecordSchema),\n});\n\n/** Response containing paginated feedback */\nexport type ListFeedbackResponse = z.infer<typeof listFeedbackResponseSchema>;\n\n// ============================================================================\n// OLAP Query Schemas\n// ============================================================================\n\nexport const getFeedbackAggregateArgsSchema = z\n .object({\n feedbackType: feedbackTypeField,\n feedbackSource: feedbackSourceField.optional(),\n aggregation: aggregationTypeSchema,\n filters: feedbackFilterSchema.optional(),\n comparePeriod: comparePeriodSchema.optional(),\n })\n .describe('Arguments for getting a feedback aggregate over numeric values');\n\nexport type GetFeedbackAggregateArgs = z.infer<typeof getFeedbackAggregateArgsSchema>;\n\nexport const getFeedbackAggregateResponseSchema = z.object(aggregateResponseFields);\n\nexport type GetFeedbackAggregateResponse = z.infer<typeof getFeedbackAggregateResponseSchema>;\n\nexport const getFeedbackBreakdownArgsSchema = z\n .object({\n feedbackType: feedbackTypeField,\n feedbackSource: feedbackSourceField.optional(),\n groupBy: groupBySchema,\n aggregation: aggregationTypeSchema,\n filters: feedbackFilterSchema.optional(),\n })\n .describe('Arguments for getting a feedback breakdown over numeric values');\n\nexport type GetFeedbackBreakdownArgs = z.infer<typeof getFeedbackBreakdownArgsSchema>;\n\nexport const getFeedbackBreakdownResponseSchema = z.object({\n groups: z.array(\n z.object({\n dimensions: dimensionsField,\n value: aggregatedValueField,\n }),\n ),\n});\n\nexport type GetFeedbackBreakdownResponse = z.infer<typeof getFeedbackBreakdownResponseSchema>;\n\nexport const getFeedbackTimeSeriesArgsSchema = z\n .object({\n feedbackType: feedbackTypeField,\n feedbackSource: feedbackSourceField.optional(),\n interval: aggregationIntervalSchema,\n aggregation: aggregationTypeSchema,\n filters: feedbackFilterSchema.optional(),\n groupBy: groupBySchema.optional(),\n })\n .describe('Arguments for getting feedback time series over numeric values');\n\nexport type GetFeedbackTimeSeriesArgs = z.infer<typeof getFeedbackTimeSeriesArgsSchema>;\n\nexport const getFeedbackTimeSeriesResponseSchema = z.object({\n series: z.array(\n z.object({\n name: z.string().describe('Series name (feedback type or group key)'),\n points: z.array(\n z.object({\n timestamp: bucketTimestampField,\n value: aggregatedValueField,\n }),\n ),\n }),\n ),\n});\n\nexport type GetFeedbackTimeSeriesResponse = z.infer<typeof getFeedbackTimeSeriesResponseSchema>;\n\nexport const getFeedbackPercentilesArgsSchema = z\n .object({\n feedbackType: feedbackTypeField,\n feedbackSource: feedbackSourceField.optional(),\n percentiles: percentilesSchema,\n interval: aggregationIntervalSchema,\n filters: feedbackFilterSchema.optional(),\n })\n .describe('Arguments for getting feedback percentiles over numeric values');\n\nexport type GetFeedbackPercentilesArgs = z.infer<typeof getFeedbackPercentilesArgsSchema>;\n\nexport const getFeedbackPercentilesResponseSchema = z.object({\n series: z.array(\n z.object({\n percentile: percentileField,\n points: z.array(\n z.object({\n timestamp: bucketTimestampField,\n value: percentileBucketValueField,\n }),\n ),\n }),\n ),\n});\n\nexport type GetFeedbackPercentilesResponse = z.infer<typeof getFeedbackPercentilesResponseSchema>;\n","import { z } from 'zod/v4';\nimport {\n aggregateResponseFields,\n aggregationIntervalSchema,\n aggregationTypeSchema,\n aggregatedValueField,\n bucketTimestampField,\n comparePeriodSchema,\n commonFilterFields,\n contextFields,\n dimensionsField,\n groupBySchema,\n paginationArgsSchema,\n paginationInfoSchema,\n percentileField,\n percentileBucketValueField,\n percentilesSchema,\n sortDirectionSchema,\n spanIdField,\n traceIdField,\n metadataField,\n} from '../shared';\n\n// ============================================================================\n// Field Schemas\n// ============================================================================\n\n/**\n * @deprecated MetricType is no longer stored. All metrics are raw events\n * with aggregation determined at query time.\n */\nexport const metricTypeSchema = z.enum(['counter', 'gauge', 'histogram']);\n\nconst metricNameField = z.string().describe('Metric name (e.g., mastra_agent_duration_ms)');\nconst metricValueField = z.number().describe('Metric value');\nconst labelsField = z.record(z.string(), z.string()).describe('Metric labels for dimensional filtering');\nconst providerField = z.string().describe('Model provider');\nconst modelField = z.string().describe('Model');\nconst estimatedCostField = z.number().describe('Estimated cost');\nconst costUnitField = z.string().describe('Unit for the estimated cost (e.g., usd)');\nconst costMetadField = z.record(z.string(), z.unknown()).nullish().describe('Structured costing metadata');\n\n// ============================================================================\n// MetricRecord Schema (Storage Format)\n// ============================================================================\n\n/**\n * Schema for metrics as stored in the database.\n * Each record is a single metric observation.\n */\nexport const metricRecordSchema = z\n .object({\n timestamp: z.date().describe('When the metric was recorded'),\n name: metricNameField,\n value: metricValueField,\n\n // Correlation\n traceId: traceIdField.nullish(),\n spanId: spanIdField.nullish(),\n\n // Context (entity hierarchy, identity, correlation, deployment, experimentation)\n ...contextFields,\n /**\n * @deprecated Use `executionSource` instead.\n */\n source: z.string().nullish().describe('Execution source'),\n\n // Canonical costing fields\n provider: providerField.nullish(),\n model: modelField.nullish(),\n\n // Estimated cost related fields\n estimatedCost: estimatedCostField.nullish(),\n costUnit: costUnitField.nullish(),\n costMetadata: costMetadField.nullish(),\n\n // User-defined labels used for filtering\n labels: labelsField.default({}),\n\n // User-defined metadata\n metadata: metadataField.nullish(),\n })\n .describe('Metric record as stored in the database');\n\n/** Metric record type for storage */\nexport type MetricRecord = z.infer<typeof metricRecordSchema>;\n\n// ============================================================================\n// MetricInput Schema (User-Facing API)\n// ============================================================================\n\n/**\n * Schema for user-provided metric input (minimal required fields).\n * The metrics context enriches this with environment before emitting ExportedMetric.\n */\nexport const metricInputSchema = z\n .object({\n name: metricNameField,\n value: metricValueField,\n labels: labelsField.optional(),\n })\n .describe('User-provided metric input');\n\n/** User-facing metric input type */\nexport type MetricInput = z.infer<typeof metricInputSchema>;\n\n// ============================================================================\n// Create Metric Schemas\n// ============================================================================\n\n/** Schema for creating a metric record (without db timestamps) */\nexport const createMetricRecordSchema = metricRecordSchema;\n\n/** Metric record for creation (excludes db timestamps) */\nexport type CreateMetricRecord = z.infer<typeof createMetricRecordSchema>;\n\n/** Schema for batchCreateMetrics operation arguments */\nexport const batchCreateMetricsArgsSchema = z\n .object({\n metrics: z.array(createMetricRecordSchema),\n })\n .describe('Arguments for batch recording metrics');\n\n/** Arguments for batch recording metrics */\nexport type BatchCreateMetricsArgs = z.infer<typeof batchCreateMetricsArgsSchema>;\n\n// ============================================================================\n// Metric Aggregation Schemas\n// ============================================================================\n\n/** Schema for metric aggregation configuration */\nexport const metricsAggregationSchema = z\n .object({\n type: aggregationTypeSchema,\n interval: aggregationIntervalSchema.optional(),\n groupBy: groupBySchema.optional(),\n })\n .describe('Metrics aggregation configuration');\n\n/** Metrics aggregation configuration type */\nexport type MetricsAggregation = z.infer<typeof metricsAggregationSchema>;\n\n// ============================================================================\n// Metric Filter Schema\n// ============================================================================\n\n/** Schema for filtering metrics in queries */\nexport const metricsFilterSchema = z\n .object({\n ...commonFilterFields,\n\n // Metric identification\n name: z.array(z.string()).nonempty().optional().describe('Filter by metric name(s)'),\n\n /**\n * @deprecated Use `executionSource` instead.\n */\n source: z.string().optional().describe('Filter by execution source'),\n\n // Canonical costing filters\n provider: providerField.optional(),\n model: modelField.optional(),\n costUnit: costUnitField.optional(),\n\n // Label filters (exact match on label values)\n labels: z.record(z.string(), z.string()).optional().describe('Exact match on label key-value pairs'),\n })\n .describe('Filters for querying metrics');\n\n/** Filters for querying metrics */\nexport type MetricsFilter = z.infer<typeof metricsFilterSchema>;\n\n/** Fields available for ordering metric list results */\nexport const metricsOrderByFieldSchema = z.enum(['timestamp']).describe(\"Field to order by: 'timestamp'\");\n\n/** Order by configuration for metric list queries */\nexport const metricsOrderBySchema = z\n .object({\n field: metricsOrderByFieldSchema.default('timestamp').describe('Field to order by'),\n direction: sortDirectionSchema.default('DESC').describe('Sort direction'),\n })\n .describe('Order by configuration');\n\n/** Schema for listMetrics operation arguments */\nexport const listMetricsArgsSchema = z\n .object({\n filters: metricsFilterSchema.optional(),\n pagination: paginationArgsSchema.default({ page: 0, perPage: 10 }).describe('Pagination settings'),\n orderBy: metricsOrderBySchema\n .default({ field: 'timestamp', direction: 'DESC' })\n .describe('Ordering configuration (defaults to timestamp desc)'),\n })\n .describe('Arguments for listing metrics');\n\n/** Arguments for listing metrics */\nexport type ListMetricsArgs = z.input<typeof listMetricsArgsSchema>;\n\n/** Schema for listMetrics operation response */\nexport const listMetricsResponseSchema = z.object({\n pagination: paginationInfoSchema,\n metrics: z.array(metricRecordSchema),\n});\n\n/** Response containing paginated metrics */\nexport type ListMetricsResponse = z.infer<typeof listMetricsResponseSchema>;\n\n// ============================================================================\n// OLAP Query Schemas\n// ============================================================================\n\n// --- getMetricAggregate ---\n\nexport const getMetricAggregateArgsSchema = z\n .object({\n name: z.array(z.string()).nonempty().describe('Metric name(s) to aggregate'),\n aggregation: aggregationTypeSchema,\n filters: metricsFilterSchema.optional(),\n comparePeriod: comparePeriodSchema.optional(),\n })\n .describe('Arguments for getting a metric aggregate');\n\nexport type GetMetricAggregateArgs = z.infer<typeof getMetricAggregateArgsSchema>;\n\nexport const getMetricAggregateResponseSchema = z.object({\n ...aggregateResponseFields,\n estimatedCost: z.number().nullable().optional().describe('Aggregated estimated cost from the same filtered row set'),\n costUnit: z\n .string()\n .nullable()\n .optional()\n .describe('Shared cost unit for the aggregated rows, or null when mixed/unknown'),\n previousEstimatedCost: z\n .number()\n .nullable()\n .optional()\n .describe('Aggregated estimated cost from the comparison period'),\n costChangePercent: z\n .number()\n .nullable()\n .optional()\n .describe('Percentage change in estimated cost from comparison period'),\n});\n\nexport type GetMetricAggregateResponse = z.infer<typeof getMetricAggregateResponseSchema>;\n\n// --- getMetricBreakdown ---\n\nexport const getMetricBreakdownArgsSchema = z\n .object({\n name: z.array(z.string()).nonempty().describe('Metric name(s) to break down'),\n groupBy: groupBySchema,\n aggregation: aggregationTypeSchema,\n filters: metricsFilterSchema.optional(),\n })\n .describe('Arguments for getting a metric breakdown');\n\nexport type GetMetricBreakdownArgs = z.infer<typeof getMetricBreakdownArgsSchema>;\n\nexport const getMetricBreakdownResponseSchema = z.object({\n groups: z.array(\n z.object({\n dimensions: dimensionsField,\n value: aggregatedValueField,\n estimatedCost: z.number().nullable().optional().describe('Summed estimated cost for this group'),\n costUnit: z\n .string()\n .nullable()\n .optional()\n .describe('Shared cost unit for this group, or null when mixed/unknown'),\n }),\n ),\n});\n\nexport type GetMetricBreakdownResponse = z.infer<typeof getMetricBreakdownResponseSchema>;\n\n// --- getMetricTimeSeries ---\n\nexport const getMetricTimeSeriesArgsSchema = z\n .object({\n name: z.array(z.string()).nonempty().describe('Metric name(s)'),\n interval: aggregationIntervalSchema,\n aggregation: aggregationTypeSchema,\n filters: metricsFilterSchema.optional(),\n groupBy: groupBySchema.optional(),\n })\n .describe('Arguments for getting metric time series');\n\nexport type GetMetricTimeSeriesArgs = z.infer<typeof getMetricTimeSeriesArgsSchema>;\n\nexport const getMetricTimeSeriesResponseSchema = z.object({\n series: z.array(\n z.object({\n name: z.string().describe('Series name (metric name or group key)'),\n costUnit: z\n .string()\n .nullable()\n .optional()\n .describe('Shared cost unit for this series, or null when mixed/unknown'),\n points: z.array(\n z.object({\n timestamp: bucketTimestampField,\n value: aggregatedValueField,\n estimatedCost: z.number().nullable().optional().describe('Summed estimated cost in this bucket'),\n }),\n ),\n }),\n ),\n});\n\nexport type GetMetricTimeSeriesResponse = z.infer<typeof getMetricTimeSeriesResponseSchema>;\n\n// --- getMetricPercentiles ---\n\nexport const getMetricPercentilesArgsSchema = z\n .object({\n name: z.string().describe('Metric name'),\n percentiles: percentilesSchema,\n interval: aggregationIntervalSchema,\n filters: metricsFilterSchema.optional(),\n })\n .describe('Arguments for getting metric percentiles');\n\nexport type GetMetricPercentilesArgs = z.infer<typeof getMetricPercentilesArgsSchema>;\n\nexport const getMetricPercentilesResponseSchema = z.object({\n series: z.array(\n z.object({\n percentile: percentileField,\n points: z.array(\n z.object({\n timestamp: bucketTimestampField,\n value: percentileBucketValueField,\n }),\n ),\n }),\n ),\n});\n\nexport type GetMetricPercentilesResponse = z.infer<typeof getMetricPercentilesResponseSchema>;\n","import { z } from 'zod/v4';\nimport { entityTypeField } from '../shared';\n\n// ============================================================================\n// Metric Discovery\n// ============================================================================\n\n// --- getMetricNames ---\n\nexport const getMetricNamesArgsSchema = z\n .object({\n prefix: z.string().optional().describe('Filter metric names by prefix'),\n limit: z.number().int().min(1).optional().describe('Maximum number of names to return'),\n })\n .describe('Arguments for getting metric names');\n\nexport type GetMetricNamesArgs = z.infer<typeof getMetricNamesArgsSchema>;\n\nexport const getMetricNamesResponseSchema = z.object({\n names: z.array(z.string()).describe('Distinct metric names'),\n});\n\nexport type GetMetricNamesResponse = z.infer<typeof getMetricNamesResponseSchema>;\n\n// --- getMetricLabelKeys ---\n\nexport const getMetricLabelKeysArgsSchema = z\n .object({\n metricName: z.string().describe('Metric name to get label keys for'),\n })\n .describe('Arguments for getting metric label keys');\n\nexport type GetMetricLabelKeysArgs = z.infer<typeof getMetricLabelKeysArgsSchema>;\n\nexport const getMetricLabelKeysResponseSchema = z.object({\n keys: z.array(z.string()).describe('Distinct label keys for the metric'),\n});\n\nexport type GetMetricLabelKeysResponse = z.infer<typeof getMetricLabelKeysResponseSchema>;\n\n// --- getMetricLabelValues ---\n\nexport const getMetricLabelValuesArgsSchema = z\n .object({\n metricName: z.string().describe('Metric name'),\n labelKey: z.string().describe('Label key to get values for'),\n prefix: z.string().optional().describe('Filter values by prefix'),\n limit: z.number().int().min(1).optional().describe('Maximum number of values to return'),\n })\n .describe('Arguments for getting label values');\n\nexport type GetMetricLabelValuesArgs = z.infer<typeof getMetricLabelValuesArgsSchema>;\n\nexport const getMetricLabelValuesResponseSchema = z.object({\n values: z.array(z.string()).describe('Distinct label values'),\n});\n\nexport type GetMetricLabelValuesResponse = z.infer<typeof getMetricLabelValuesResponseSchema>;\n\n// ============================================================================\n// Entity & Environment Discovery\n// ============================================================================\n\n// --- getEntityTypes ---\n\nexport const getEntityTypesArgsSchema = z.object({}).describe('Arguments for getting entity types');\n\nexport type GetEntityTypesArgs = z.infer<typeof getEntityTypesArgsSchema>;\n\nexport const getEntityTypesResponseSchema = z.object({\n entityTypes: z.array(entityTypeField).describe('Distinct entity types'),\n});\n\nexport type GetEntityTypesResponse = z.infer<typeof getEntityTypesResponseSchema>;\n\n// --- getEntityNames ---\n\nexport const getEntityNamesArgsSchema = z\n .object({\n entityType: entityTypeField.optional().describe('Optional entity type filter'),\n })\n .describe('Arguments for getting entity names');\n\nexport type GetEntityNamesArgs = z.infer<typeof getEntityNamesArgsSchema>;\n\nexport const getEntityNamesResponseSchema = z.object({\n names: z.array(z.string()).describe('Distinct entity names'),\n});\n\nexport type GetEntityNamesResponse = z.infer<typeof getEntityNamesResponseSchema>;\n\n// --- getServiceNames ---\n\nexport const getServiceNamesArgsSchema = z.object({}).describe('Arguments for getting service names');\n\nexport type GetServiceNamesArgs = z.infer<typeof getServiceNamesArgsSchema>;\n\nexport const getServiceNamesResponseSchema = z.object({\n serviceNames: z.array(z.string()).describe('Distinct service names'),\n});\n\nexport type GetServiceNamesResponse = z.infer<typeof getServiceNamesResponseSchema>;\n\n// --- getEnvironments ---\n\nexport const getEnvironmentsArgsSchema = z.object({}).describe('Arguments for getting environments');\n\nexport type GetEnvironmentsArgs = z.infer<typeof getEnvironmentsArgsSchema>;\n\nexport const getEnvironmentsResponseSchema = z.object({\n environments: z.array(z.string()).describe('Distinct environments'),\n});\n\nexport type GetEnvironmentsResponse = z.infer<typeof getEnvironmentsResponseSchema>;\n\n// --- getTags ---\n\nexport const getTagsArgsSchema = z\n .object({\n entityType: entityTypeField.optional().describe('Optional entity type filter'),\n })\n .describe('Arguments for getting tags');\n\nexport type GetTagsArgs = z.infer<typeof getTagsArgsSchema>;\n\nexport const getTagsResponseSchema = z.object({\n tags: z.array(z.string()).describe('Distinct tags'),\n});\n\nexport type GetTagsResponse = z.infer<typeof getTagsResponseSchema>;\n","/**\n * Tracing interfaces\n *\n * Span types, attributes, span lifecycle, and tracing-specific types.\n * For top-level observability infrastructure (instances, exporters, bridges, config),\n * see observability.ts.\n */\nimport { EntityType } from '@internal/core/storage';\n\nimport type { MastraError } from '../../error';\nimport type { Mastra } from '../../mastra';\nimport type { RequestContext } from '../../request-context';\nimport type { LanguageModelUsage, ProviderMetadata, StepStartPayload } from '../../stream/types';\nimport type { WorkflowRunStatus, WorkflowStepStatus } from '../../workflows';\nimport type {\n CustomSamplerOptions,\n ObservabilityInstance,\n CorrelationContext,\n DefinitionSource,\n ScorerScoreSource,\n ScorerStepType,\n ScorerTargetScope,\n} from './core';\nimport type { FeedbackInput } from './feedback';\nimport type { ScoreInput } from './scores';\n\n// ============================================================================\n// Span Types\n// ============================================================================\n\n/**\n * AI-specific span types with their associated metadata\n */\nexport enum SpanType {\n /** Agent run - root span for agent processes */\n AGENT_RUN = 'agent_run',\n /** Scorer execution */\n SCORER_RUN = 'scorer_run',\n /** Individual scorer pipeline step */\n SCORER_STEP = 'scorer_step',\n /** Generic span for custom operations */\n GENERIC = 'generic',\n /** Model generation with model calls, token usage, prompts, completions */\n MODEL_GENERATION = 'model_generation',\n /** Single model execution step within a generation (one API call) */\n MODEL_STEP = 'model_step',\n /** Individual model streaming chunk/event */\n MODEL_CHUNK = 'model_chunk',\n /** MCP (Model Context Protocol) tool execution */\n MCP_TOOL_CALL = 'mcp_tool_call',\n /** Input or Output Processor execution */\n PROCESSOR_RUN = 'processor_run',\n /** Function/tool execution with inputs, outputs, errors */\n TOOL_CALL = 'tool_call',\n /** Workflow run - root span for workflow processes */\n WORKFLOW_RUN = 'workflow_run',\n /** Workflow step execution with step status, data flow */\n WORKFLOW_STEP = 'workflow_step',\n /** Workflow conditional execution with condition evaluation */\n WORKFLOW_CONDITIONAL = 'workflow_conditional',\n /** Individual condition evaluation within conditional */\n WORKFLOW_CONDITIONAL_EVAL = 'workflow_conditional_eval',\n /** Workflow parallel execution */\n WORKFLOW_PARALLEL = 'workflow_parallel',\n /** Workflow loop execution */\n WORKFLOW_LOOP = 'workflow_loop',\n /** Workflow sleep operation */\n WORKFLOW_SLEEP = 'workflow_sleep',\n /** Workflow wait for event operation */\n WORKFLOW_WAIT_EVENT = 'workflow_wait_event',\n}\n\nexport { EntityType };\n\n// ============================================================================\n// Type-Specific Attributes Interfaces\n// ============================================================================\n\n/**\n * Base attributes that all spans can have\n */\nexport interface AIBaseAttributes {}\n\n/**\n * Agent Run attributes\n */\nexport interface AgentRunAttributes extends AIBaseAttributes {\n /** Conversation/thread/session identifier for multi-turn interactions */\n conversationId?: string;\n /** Agent Instructions **/\n instructions?: string;\n /** Agent Prompt **/\n prompt?: string;\n /** Available tools for this execution */\n availableTools?: string[];\n /** Maximum steps allowed */\n maxSteps?: number;\n /** The resolved agent version ID used for this execution */\n resolvedVersionId?: string;\n /** Tripwire abort details when a processor triggered a tripwire */\n tripwireAbort?: {\n /** Abort reason */\n reason?: string;\n /** Processor that triggered the tripwire */\n processorId?: string;\n /** Whether retry was requested */\n retry?: boolean;\n /** Additional metadata */\n metadata?: unknown;\n };\n}\n\n/**\n * Scorer Run attributes\n */\nexport interface ScorerRunAttributes extends AIBaseAttributes {\n scorerId?: string;\n scorerName?: string;\n scoreSource?: ScorerScoreSource;\n targetScope?: ScorerTargetScope;\n targetEntityType?: EntityType;\n scorerDefinition?: DefinitionSource;\n}\n\n/**\n * Scorer Step attributes\n */\nexport interface ScorerStepAttributes extends AIBaseAttributes {\n step?: string;\n stepType?: ScorerStepType;\n prompt?: string;\n judgeModel?: string;\n}\n\n/**\n * Detailed breakdown of input token usage by type.\n * Based on OpenInference semantic conventions.\n */\nexport interface InputTokenDetails {\n /** Regular text tokens (non-cached, non-audio, non-image) */\n text?: number;\n /** Tokens served from cache (cache hit/read) */\n cacheRead?: number;\n /** Tokens written to cache (cache creation - Anthropic only) */\n cacheWrite?: number;\n /** Audio input tokens */\n audio?: number;\n /** Image input tokens (includes PDF pages) */\n image?: number;\n}\n\n/**\n * Detailed breakdown of output token usage by type.\n * Based on OpenInference semantic conventions.\n */\nexport interface OutputTokenDetails {\n /** Regular text output tokens */\n text?: number;\n /** Reasoning/thinking tokens (o1, Claude thinking, Gemini thoughts) */\n reasoning?: number;\n /** Audio output tokens */\n audio?: number;\n /** Image output tokens (DALL-E, etc.) */\n image?: number;\n}\n\n/** Token usage statistics */\nexport interface UsageStats {\n /** Total input tokens (sum of all input details) */\n inputTokens?: number;\n /** Total output tokens (sum of all output details) */\n outputTokens?: number;\n /** Detailed breakdown of input token usage */\n inputDetails?: InputTokenDetails;\n /** Detailed breakdown of output token usage */\n outputDetails?: OutputTokenDetails;\n}\n\n/**\n * Model Generation attributes\n */\nexport interface ModelGenerationAttributes extends AIBaseAttributes {\n /** Model name (e.g., 'gpt-4', 'claude-3') */\n model?: string;\n /** Model provider (e.g., 'openai', 'anthropic') */\n provider?: string;\n /** Type of result/output this LLM call produced */\n resultType?: 'tool_selection' | 'response_generation' | 'reasoning' | 'planning';\n /** Token usage statistics */\n usage?: UsageStats;\n /** Model parameters */\n parameters?: {\n maxOutputTokens?: number;\n temperature?: number;\n topP?: number;\n topK?: number;\n presencePenalty?: number;\n frequencyPenalty?: number;\n stopSequences?: string[];\n seed?: number;\n maxRetries?: number;\n abortSignal?: any;\n headers?: Record<string, string | undefined>;\n };\n /** Whether this was a streaming response */\n streaming?: boolean;\n /** Reason the generation finished */\n finishReason?: string;\n /**\n * When the first token/chunk of the completion was received.\n * Used to calculate time-to-first-token (TTFT) metrics.\n * Only applicable for streaming responses.\n */\n completionStartTime?: Date;\n /** Actual model used in the response (may differ from request model) */\n responseModel?: string;\n /** Unique identifier for the response */\n responseId?: string;\n /** Server address for the model endpoint */\n serverAddress?: string;\n /** Server port for the model endpoint */\n serverPort?: number;\n}\n\n/**\n * Model Step attributes - for a single model execution within a generation\n */\nexport interface ModelStepAttributes extends AIBaseAttributes {\n /** Index of this step in the generation (0, 1, 2, ...) */\n stepIndex?: number;\n /** Token usage statistics */\n usage?: UsageStats;\n /** Reason this step finished (stop, tool-calls, length, etc.) */\n finishReason?: string;\n /** Should execution continue */\n isContinued?: boolean;\n /** Result warnings */\n warnings?: Record<string, any>;\n}\n\n/**\n * Model Chunk attributes - for individual streaming chunks/events\n */\nexport interface ModelChunkAttributes extends AIBaseAttributes {\n /** Type of chunk (text-delta, reasoning-delta, tool-call, etc.) */\n chunkType?: string;\n /** Sequence number of this chunk in the stream */\n sequenceNumber?: number;\n}\n\n/**\n * Tool Call attributes\n */\nexport interface ToolCallAttributes extends AIBaseAttributes {\n toolType?: string;\n toolDescription?: string;\n success?: boolean;\n}\n\n/**\n * MCP Tool Call attributes\n */\nexport interface MCPToolCallAttributes extends AIBaseAttributes {\n /** MCP server identifier */\n mcpServer: string;\n /** MCP server version */\n serverVersion?: string;\n /** Tool description */\n toolDescription?: string;\n /** Whether tool execution was successful */\n success?: boolean;\n}\n\n/**\n * Processor attributes\n */\nexport interface ProcessorRunAttributes extends AIBaseAttributes {\n /** Processor executor type (workflow or legacy) */\n processorExecutor?: 'workflow' | 'legacy';\n /** Processor index in the agent */\n processorIndex?: number;\n /** MessageList mutations performed by this processor */\n messageListMutations?: Array<{\n type: 'add' | 'addSystem' | 'removeByIds' | 'clear';\n source?: string;\n count?: number;\n ids?: string[];\n text?: string;\n tag?: string;\n message?: any;\n }>;\n /** Tripwire abort details when a processor triggered a tripwire */\n tripwireAbort?: {\n /** Abort reason */\n reason?: string;\n /** Whether retry was requested */\n retry?: boolean;\n /** Additional metadata */\n metadata?: unknown;\n };\n}\n\n/**\n * Workflow Run attributes\n */\nexport interface WorkflowRunAttributes extends AIBaseAttributes {\n /** Workflow status */\n status?: WorkflowRunStatus;\n}\n\n/**\n * Workflow Step attributes\n */\nexport interface WorkflowStepAttributes extends AIBaseAttributes {\n /** Step status */\n status?: WorkflowStepStatus;\n}\n\n/**\n * Workflow Conditional attributes\n */\nexport interface WorkflowConditionalAttributes extends AIBaseAttributes {\n /** Number of conditions evaluated */\n conditionCount: number;\n /** Which condition indexes evaluated to true */\n truthyIndexes?: number[];\n /** Which steps will be executed */\n selectedSteps?: string[];\n}\n\n/**\n * Workflow Conditional Evaluation attributes\n */\nexport interface WorkflowConditionalEvalAttributes extends AIBaseAttributes {\n /** Index of this condition in the conditional */\n conditionIndex: number;\n /** Result of condition evaluation */\n result?: boolean;\n}\n\n/**\n * Workflow Parallel attributes\n */\nexport interface WorkflowParallelAttributes extends AIBaseAttributes {\n /** Number of parallel branches */\n branchCount: number;\n /** Step IDs being executed in parallel */\n parallelSteps?: string[];\n}\n\n/**\n * Workflow Loop attributes\n */\nexport interface WorkflowLoopAttributes extends AIBaseAttributes {\n /** Type of loop (foreach, dowhile, dountil) */\n loopType?: 'foreach' | 'dowhile' | 'dountil';\n /** Current iteration number (for individual iterations) */\n iteration?: number;\n /** Total iterations (if known) */\n totalIterations?: number;\n /** Number of steps to run concurrently in foreach loop */\n concurrency?: number;\n}\n\n/**\n * Workflow Sleep attributes\n */\nexport interface WorkflowSleepAttributes extends AIBaseAttributes {\n /** Sleep duration in milliseconds */\n durationMs?: number;\n /** Sleep until date */\n untilDate?: Date;\n /** Sleep type */\n sleepType?: 'fixed' | 'dynamic';\n}\n\n/**\n * Workflow Wait Event attributes\n */\nexport interface WorkflowWaitEventAttributes extends AIBaseAttributes {\n /** Event name being waited for */\n eventName?: string;\n /** Timeout in milliseconds */\n timeoutMs?: number;\n /** Whether event was received or timed out */\n eventReceived?: boolean;\n /** Wait duration in milliseconds */\n waitDurationMs?: number;\n}\n\n/**\n * AI-specific span types mapped to their attributes\n */\nexport interface SpanTypeMap {\n [SpanType.AGENT_RUN]: AgentRunAttributes;\n [SpanType.SCORER_RUN]: ScorerRunAttributes;\n [SpanType.SCORER_STEP]: ScorerStepAttributes;\n [SpanType.WORKFLOW_RUN]: WorkflowRunAttributes;\n [SpanType.MODEL_GENERATION]: ModelGenerationAttributes;\n [SpanType.MODEL_STEP]: ModelStepAttributes;\n [SpanType.MODEL_CHUNK]: ModelChunkAttributes;\n [SpanType.TOOL_CALL]: ToolCallAttributes;\n [SpanType.MCP_TOOL_CALL]: MCPToolCallAttributes;\n [SpanType.PROCESSOR_RUN]: ProcessorRunAttributes;\n [SpanType.WORKFLOW_STEP]: WorkflowStepAttributes;\n [SpanType.WORKFLOW_CONDITIONAL]: WorkflowConditionalAttributes;\n [SpanType.WORKFLOW_CONDITIONAL_EVAL]: WorkflowConditionalEvalAttributes;\n [SpanType.WORKFLOW_PARALLEL]: WorkflowParallelAttributes;\n [SpanType.WORKFLOW_LOOP]: WorkflowLoopAttributes;\n [SpanType.WORKFLOW_SLEEP]: WorkflowSleepAttributes;\n [SpanType.WORKFLOW_WAIT_EVENT]: WorkflowWaitEventAttributes;\n [SpanType.GENERIC]: AIBaseAttributes;\n}\n\n/**\n * Union type for cases that need to handle any span type\n */\nexport type AnySpanAttributes = SpanTypeMap[keyof SpanTypeMap];\n\n// ============================================================================\n// Span Interfaces\n// ============================================================================\n\n/** Error information attached to a span when it fails. */\nexport interface SpanErrorInfo {\n message: string;\n id?: string;\n /** Error class name (e.g. \"TypeError\", \"ValidationError\") */\n name?: string;\n /** Stack trace string */\n stack?: string;\n domain?: string;\n category?: string;\n details?: Record<string, any>;\n}\n\n/**\n * Base Span interface\n */\ninterface BaseSpan<TType extends SpanType> {\n /** Unique span identifier */\n id: string;\n /** OpenTelemetry-compatible trace ID (32 hex chars) - present on all spans */\n traceId: string;\n /** Name of the span */\n name: string;\n /** Type of the span */\n type: TType;\n /** Entity type that created the span */\n entityType?: EntityType;\n /** Entity id that created the span */\n entityId?: string;\n /** Entity name that created the span */\n entityName?: string;\n /** When span started */\n startTime: Date;\n /** When span ended */\n endTime?: Date;\n /** Span-type specific attributes */\n attributes?: SpanTypeMap[TType];\n /** User-defined metadata */\n metadata?: Record<string, any>;\n /** Labels used to categorize and filter traces. Only valid on root spans. */\n tags?: string[];\n /** Input passed at the start of the span */\n input?: any;\n /** Output generated at the end of the span */\n output?: any;\n /** Error information if span failed */\n errorInfo?: SpanErrorInfo;\n /** Snapshot of the RequestContext */\n requestContext?: Record<string, any>;\n /** Is an event span? (event occurs at startTime, has no endTime) */\n isEvent: boolean;\n}\n\n/**\n * Span interface, used internally for tracing\n */\nexport interface Span<TType extends SpanType> extends BaseSpan<TType> {\n /** Is an internal span? (spans internal to the operation of mastra) */\n isInternal: boolean;\n /** Parent span reference (undefined for root spans) */\n parent?: AnySpan;\n /** Pointer to the ObservabilityInstance instance */\n observabilityInstance: ObservabilityInstance;\n /** Trace-level state shared across all spans in this trace */\n traceState?: TraceState;\n\n // Methods for span lifecycle\n /** End the span */\n end(options?: EndSpanOptions<TType>): void;\n\n /** Record an error for the span, optionally end the span as well */\n error(options: ErrorSpanOptions<TType>): void;\n\n /** Update span attributes */\n update(options: UpdateSpanOptions<TType>): void;\n\n /** Create child span - can be any span type independent of parent */\n createChildSpan(options: ChildSpanOptions<SpanType.MODEL_GENERATION>): AIModelGenerationSpan;\n createChildSpan<TChildType extends SpanType>(options: ChildSpanOptions<TChildType>): Span<TChildType>;\n\n /** Create event span - can be any span type independent of parent */\n createEventSpan<TChildType extends SpanType>(options: ChildEventOptions<TChildType>): Span<TChildType>;\n\n /** Returns `TRUE` if the span is the root span of a trace */\n get isRootSpan(): boolean;\n\n /** Returns `TRUE` if the span is a valid span (not a NO-OP Span) */\n get isValid(): boolean;\n\n /** Get the closest parent spanId that isn't an internal span */\n getParentSpanId(includeInternalSpans?: boolean): string | undefined;\n\n /** Find the closest parent span of a specific type by walking up the parent chain */\n findParent<T extends SpanType>(spanType: T): Span<T> | undefined;\n\n /**\n * Optional hook for implementations that expose canonical correlation\n * context directly from the span instance.\n */\n getCorrelationContext?(): CorrelationContext;\n\n /** Returns a lightweight span ready for export */\n exportSpan(includeInternalSpans?: boolean): ExportedSpan<TType> | undefined;\n\n /** Returns the traceId on span, unless NoOpSpan, then undefined */\n get externalTraceId(): string | undefined;\n\n /**\n * Execute an async function within this span's tracing context.\n *\n * When a bridge is configured, this enables auto-instrumented operations\n * (HTTP requests, database queries, etc.) to be properly nested under this\n * span in the external tracing system.\n *\n * @param fn - The async function to execute within the span context\n * @returns The result of the function execution\n *\n * @example\n * ```typescript\n * const result = await modelSpan.executeInContext(async () => {\n * return model.generateText(...);\n * });\n * ```\n */\n executeInContext<T>(fn: () => Promise<T>): Promise<T>;\n\n /**\n * Execute a synchronous function within this span's tracing context.\n *\n * When a bridge is configured, this enables auto-instrumented operations\n * (HTTP requests, database queries, etc.) to be properly nested under this\n * span in the external tracing system.\n *\n * @param fn - The synchronous function to execute within the span context\n * @returns The result of the function execution\n *\n * @example\n * ```typescript\n * const result = modelSpan.executeInContextSync(() => {\n * return model.streamText(...);\n * });\n * ```\n */\n executeInContextSync<T>(fn: () => T): T;\n}\n\n/** Context for bridging Mastra spans with external tracing systems (e.g., OpenTelemetry). */\nexport interface BridgeSpanContext {\n /**\n * Execute an async function within this span's tracing context.\n *\n * When a bridge is configured, this enables auto-instrumented operations\n * (HTTP requests, database queries, etc.) to be properly nested under this\n * span in the external tracing system.\n *\n * @param fn - The async function to execute within the span context\n * @returns The result of the function execution\n *\n * @example\n * ```typescript\n * const result = await modelSpan.executeInContext(async () => {\n * return model.generateText(...);\n * });\n * ```\n */\n executeInContext<T>(fn: () => Promise<T>): Promise<T>;\n\n /**\n * Execute a synchronous function within this span's tracing context.\n *\n * When a bridge is configured, this enables auto-instrumented operations\n * (HTTP requests, database queries, etc.) to be properly nested under this\n * span in the external tracing system.\n *\n * @param fn - The synchronous function to execute within the span context\n * @returns The result of the function execution\n *\n * @example\n * ```typescript\n * const result = modelSpan.executeInContextSync(() => {\n * return model.streamText(...);\n * });\n * ```\n */\n executeInContextSync<T>(fn: () => T): T;\n}\n\n/**\n * Specialized span interface for MODEL_GENERATION spans\n * Provides access to creating a ModelSpanTracker for tracking MODEL_STEP and MODEL_CHUNK spans\n */\nexport interface AIModelGenerationSpan extends Span<SpanType.MODEL_GENERATION> {\n /** Create a ModelSpanTracker for tracking model execution steps and chunks */\n createTracker(): IModelSpanTracker | undefined;\n}\n\n/**\n * Span data structure shared between exported and recorded spans.\n * Contains all span fields in a serializable format (no object references).\n *\n * This is the common base for:\n * - ExportedSpan: span data sent to exporters\n * - RecordedSpan: span data loaded from storage with annotation methods\n */\nexport interface SpanData<TType extends SpanType> extends BaseSpan<TType> {\n /** Parent span id reference (undefined for root spans) */\n parentSpanId?: string;\n /** `TRUE` if the span is the root span of a trace */\n isRootSpan: boolean;\n /**\n * Tags for this trace (only present on root spans).\n * Tags are string labels used to categorize and filter traces.\n */\n tags?: string[];\n}\n\n/**\n * Exported Span interface, used for tracing exporters.\n * This is the format sent to ObservabilityExporter implementations.\n */\nexport interface ExportedSpan<TType extends SpanType> extends SpanData<TType> {}\n\n/**\n * Options for ending a model generation span\n */\nexport interface EndGenerationOptions extends EndSpanOptions<SpanType.MODEL_GENERATION> {\n /** Raw usage data from AI SDK - will be converted to UsageStats with cache token details */\n usage?: LanguageModelUsage;\n /** Provider-specific metadata for extracting cache tokens */\n providerMetadata?: ProviderMetadata;\n}\n\n/** Tracks model execution steps and streaming chunks within a MODEL_GENERATION span. */\nexport interface IModelSpanTracker {\n getTracingContext(): TracingContext;\n reportGenerationError(options: ErrorSpanOptions<SpanType.MODEL_GENERATION>): void;\n endGeneration(options?: EndGenerationOptions): void;\n updateGeneration(options: UpdateSpanOptions<SpanType.MODEL_GENERATION>): void;\n wrapStream<T extends { pipeThrough: Function }>(stream: T): T;\n startStep(payload?: StepStartPayload): void;\n}\n\n/**\n * Union type for cases that need to handle any span\n */\nexport type AnySpan = Span<keyof SpanTypeMap>;\n\n/**\n * Union type for cases that need to handle any exported span\n */\nexport type AnyExportedSpan = ExportedSpan<keyof SpanTypeMap>;\n\n// ============================================================================\n// Recorded Span & Trace Interfaces\n// ============================================================================\n\n/**\n * A recorded span is span data that has been captured/persisted and can have\n * scores and feedback attached post-hoc. Unlike live Span objects, RecordedSpan\n * has immutable core data but supports annotation methods.\n *\n * Spans are organized in a tree structure via parent/children references,\n * with all references pointing to the same objects in memory.\n *\n * Use cases:\n * - Spans loaded from storage for evaluation\n * - Spans from completed traces being annotated\n * - Post-hoc quality scoring and user feedback\n *\n * RecordedSpan objects are hydrated runtime wrappers and should not be treated as\n * durable serialized state. Persist `traceId` / `spanId` and rehydrate, or use\n * top-level observability annotation APIs after resume.\n */\nexport interface RecordedSpan<TType extends SpanType> extends SpanData<TType> {\n /** Parent span reference (undefined for root spans) */\n readonly parent?: AnyRecordedSpan;\n\n /** Child spans in execution order */\n readonly children: ReadonlyArray<AnyRecordedSpan>;\n\n /**\n * Add a quality score to this recorded span.\n * Scores are emitted via the ObservabilityBus and can be persisted/exported.\n */\n addScore(score: ScoreInput): Promise<void>;\n\n /**\n * Add user feedback to this recorded span.\n * Feedback is emitted via the ObservabilityBus and can be persisted/exported.\n */\n addFeedback(feedback: FeedbackInput): Promise<void>;\n}\n\n/**\n * Union type for cases that need to handle any recorded span\n */\nexport type AnyRecordedSpan = RecordedSpan<keyof SpanTypeMap>;\n\n/**\n * A recorded trace is a complete execution trace loaded from storage.\n * Provides both tree access (via rootSpan) and flat access (via spans).\n * All references point to the same span objects - no memory duplication.\n *\n * Obtained via mastra.observability.getRecordedTrace({ traceId }) for post-execution annotation.\n * RecordedTrace objects are hydrated runtime wrappers and should not be stored\n * across durable workflow serialization boundaries. Persist identifiers instead\n * and rehydrate, or use top-level observability annotation APIs after resume.\n */\nexport interface RecordedTrace {\n /** The trace identifier */\n readonly traceId: string;\n\n /** Root span of the trace tree (entry point for tree traversal) */\n readonly rootSpan: AnyRecordedSpan;\n\n /** All spans in flat array for iteration (same objects as in tree) */\n readonly spans: ReadonlyArray<AnyRecordedSpan>;\n\n /**\n * Get a specific recorded span by ID.\n * @param spanId - The span identifier\n * @returns The recorded span if found, null otherwise\n */\n getSpan(spanId: string): AnyRecordedSpan | null;\n\n /**\n * Add a score at the trace level.\n * Uses root span's metadata for context inheritance.\n */\n addScore(score: ScoreInput): Promise<void>;\n\n /**\n * Add feedback at the trace level.\n * Uses root span's metadata for context inheritance.\n */\n addFeedback(feedback: FeedbackInput): Promise<void>;\n}\n\n// ============================================================================\n// Tracing Interfaces\n// ============================================================================\n\n// ============================================================================\n// Span Create/Update/Error Option Types\n// ============================================================================\n\ninterface CreateBaseOptions<TType extends SpanType> {\n /** Span attributes */\n attributes?: SpanTypeMap[TType];\n /** Span metadata */\n metadata?: Record<string, any>;\n /** Span name */\n name: string;\n /** Span type */\n type: TType;\n /** Entity type that created the span */\n entityType?: EntityType;\n /** Entity id that created the span */\n entityId?: string;\n /** Entity name that created the span */\n entityName?: string;\n /** Policy-level tracing configuration */\n tracingPolicy?: TracingPolicy;\n /** Request Context for metadata extraction */\n requestContext?: RequestContext;\n}\n\n/**\n * Options for creating new spans\n */\nexport interface CreateSpanOptions<TType extends SpanType> extends CreateBaseOptions<TType> {\n /** Input data */\n input?: any;\n /** Output data (for event spans) */\n output?: any;\n /** Labels used to categorize and filter traces. Only valid on root spans. */\n tags?: string[];\n /** Parent span */\n parent?: AnySpan;\n /** Is an event span? */\n isEvent?: boolean;\n /**\n * Trace ID to use for this span (1-32 hexadecimal characters).\n * Only used for root spans without a parent.\n */\n traceId?: string;\n /**\n * Span ID to use for this span (1-16 hexadecimal characters).\n * Only used when rebuilding a span from cached data.\n */\n spanId?: string;\n /**\n * Parent span ID to use for this span (1-16 hexadecimal characters).\n * Only used for root spans without a parent.\n */\n parentSpanId?: string;\n /**\n * Start time for this span.\n * Only used when rebuilding a span from cached data.\n */\n startTime?: Date;\n /** Trace-level state shared across all spans in this trace */\n traceState?: TraceState;\n}\n\n/**\n * Options for starting new spans\n */\nexport interface StartSpanOptions<TType extends SpanType> extends CreateSpanOptions<TType> {\n /**\n * Options passed when using a custom sampler strategy\n */\n customSamplerOptions?: CustomSamplerOptions;\n /** Tracing options for this execution */\n tracingOptions?: TracingOptions;\n}\n\n/**\n * Options for new child spans\n */\nexport interface ChildSpanOptions<TType extends SpanType> extends CreateBaseOptions<TType> {\n /** Input data */\n input?: any;\n}\n\n/**\n * Options for new child events\n * Event spans have no input, and no endTime\n */\nexport interface ChildEventOptions<TType extends SpanType> extends CreateBaseOptions<TType> {\n /** Output data */\n output?: any;\n}\n\ninterface UpdateBaseOptions<TType extends SpanType> {\n /** Span attributes */\n attributes?: Partial<SpanTypeMap[TType]>;\n /** Span metadata */\n metadata?: Record<string, any>;\n}\n\n/** Options for ending a span, with optional final attributes and output. */\nexport interface EndSpanOptions<TType extends SpanType> extends UpdateBaseOptions<TType> {\n /** Output data */\n output?: any;\n}\n\n/** Options for updating a span's attributes, input, or output mid-flight. */\nexport interface UpdateSpanOptions<TType extends SpanType> extends UpdateBaseOptions<TType> {\n /** Span name override */\n name?: string;\n /** Input data */\n input?: any;\n /** Output data */\n output?: any;\n}\n\n/** Options for recording an error on a span. */\nexport interface ErrorSpanOptions<TType extends SpanType> extends UpdateBaseOptions<TType> {\n /** The error associated with the issue */\n error: MastraError | Error;\n /** End the span when true */\n endSpan?: boolean;\n}\n\n/** Options for retrieving an existing span or creating a new one from a tracing context. */\nexport interface GetOrCreateSpanOptions<TType extends SpanType> {\n type: TType;\n name: string;\n entityType?: EntityType;\n entityId?: string;\n entityName?: string;\n input?: any;\n attributes?: SpanTypeMap[TType];\n metadata?: Record<string, any>;\n tracingPolicy?: TracingPolicy;\n tracingOptions?: TracingOptions;\n tracingContext?: TracingContext;\n requestContext?: RequestContext;\n mastra?: Mastra;\n}\n\n/**\n * Bitwise options to set different types of spans as internal in\n * a workflow or agent execution.\n */\nexport enum InternalSpans {\n /** No spans are marked internal */\n NONE = 0,\n /** Workflow spans are marked internal */\n WORKFLOW = 1 << 0, // 0001\n /** Agent spans are marked internal */\n AGENT = 1 << 1, // 0010\n /** Tool spans are marked internal */\n TOOL = 1 << 2, // 0100\n /** Model spans are marked internal */\n MODEL = 1 << 3, // 1000\n\n /** All spans are marked internal */\n ALL = (1 << 4) - 1, // 1111 (all bits set up to 3)\n}\n\n/**\n * Policy-level tracing configuration applied when creating\n * a workflow or agent. Unlike TracingOptions, which are\n * provided at execution time, policies define persistent rules\n * for how spans are treated across all executions of the\n * workflow/agent.\n */\nexport interface TracingPolicy {\n /**\n * Bitwise options to set different types of spans as Internal in\n * a workflow or agent execution. Internal spans are hidden by\n * default in exported traces.\n */\n internal?: InternalSpans;\n}\n\n/**\n * Trace-level state computed once at the start of a trace\n * and shared by all spans within that trace.\n */\nexport interface TraceState {\n /**\n * RequestContext keys to extract as metadata for all spans in this trace.\n * Computed by merging the tracing config's requestContextKeys\n * with the per-request requestContextKeys.\n */\n requestContextKeys: string[];\n /**\n * When true, input data will be hidden from all spans in this trace.\n */\n hideInput?: boolean;\n /**\n * When true, output data will be hidden from all spans in this trace.\n */\n hideOutput?: boolean;\n}\n\n/**\n * Options passed when starting a new agent or workflow execution\n */\nexport interface TracingOptions {\n /** Metadata to add to the root trace span */\n metadata?: Record<string, any>;\n /**\n * Additional RequestContext keys to extract as metadata for this trace.\n * These keys are added to the requestContextKeys config.\n * Supports dot notation for nested values (e.g., 'user.id', 'session.data.experimentId').\n */\n requestContextKeys?: string[];\n /**\n * Trace ID to use for this execution (1-32 hexadecimal characters).\n * If provided, this trace will be part of the specified trace rather than starting a new one.\n */\n traceId?: string;\n /**\n * Parent span ID to use for this execution (1-16 hexadecimal characters).\n * If provided, the root span will be created as a child of this span.\n */\n parentSpanId?: string;\n /**\n * Tags to apply to this trace.\n * Tags are string labels that can be used to categorize and filter traces\n * Note: Tags are only applied to the root span of a trace.\n */\n tags?: string[];\n /**\n * When true, input data will be hidden from all spans in this trace.\n * Useful for protecting sensitive data from being logged.\n */\n hideInput?: boolean;\n /**\n * When true, output data will be hidden from all spans in this trace.\n * Useful for protecting sensitive data from being logged.\n */\n hideOutput?: boolean;\n}\n\n/** Trace and span identifiers for correlating spans across systems. */\nexport interface SpanIds {\n traceId: string;\n spanId: string;\n parentSpanId?: string;\n}\n\n/**\n * Context for tracing that flows through workflow and agent execution\n */\nexport interface TracingContext {\n /** Current Span for creating child spans and adding metadata */\n currentSpan?: AnySpan;\n}\n\n/**\n * Properties returned to the user for working with traces externally.\n */\nexport type TracingProperties = {\n /** Trace ID used on the execution (if the execution was traced). */\n traceId?: string;\n /** Root span ID used on the execution (if the execution was traced). */\n spanId?: string;\n};\n\n// ============================================================================\n// Exporter and Processor Interfaces\n// ============================================================================\n\n/**\n * Tracing event types\n */\nexport enum TracingEventType {\n SPAN_STARTED = 'span_started',\n SPAN_UPDATED = 'span_updated',\n SPAN_ENDED = 'span_ended',\n}\n\n/**\n * Tracing events that can be exported\n */\nexport type TracingEvent =\n | { type: TracingEventType.SPAN_STARTED; exportedSpan: AnyExportedSpan }\n | { type: TracingEventType.SPAN_UPDATED; exportedSpan: AnyExportedSpan }\n | { type: TracingEventType.SPAN_ENDED; exportedSpan: AnyExportedSpan };\n\n/**\n * Interface for span processors\n */\nexport interface SpanOutputProcessor {\n /** Processor name */\n name: string;\n /** Process span before export */\n process(span?: AnySpan): AnySpan | undefined;\n /** Shutdown processor */\n shutdown(): Promise<void>;\n}\n\n/**\n * Function type for formatting exported spans at the exporter level.\n *\n * This allows customization of how spans appear in vendor-specific observability platforms\n * (e.g., Langfuse, Braintrust). Unlike SpanOutputProcessor which operates on the internal\n * Span object before export, this formatter operates on the ExportedSpan data structure\n * after the span has been prepared for export.\n *\n * Formatters can be synchronous or asynchronous, enabling use cases like:\n * - Extract plain text from structured AI SDK messages for better readability\n * - Transform input/output format for specific vendor requirements\n * - Add or remove fields based on the target platform\n * - Redact or transform sensitive data in a vendor-specific way\n * - Enrich spans with data from external APIs (async)\n * - Perform database lookups to add context (async)\n *\n * @param span - The exported span to format\n * @returns The formatted span (sync) or a Promise resolving to the formatted span (async)\n *\n * @example\n * ```typescript\n * // Synchronous formatter that extracts plain text from AI messages\n * const plainTextFormatter: CustomSpanFormatter = (span) => {\n * if (span.type === SpanType.AGENT_RUN && Array.isArray(span.input)) {\n * const userMessage = span.input.find(m => m.role === 'user');\n * return {\n * ...span,\n * input: userMessage?.content ?? span.input,\n * };\n * }\n * return span;\n * };\n *\n * // Async formatter that enriches spans with external data\n * const enrichmentFormatter: CustomSpanFormatter = async (span) => {\n * const userData = await fetchUserData(span.metadata?.userId);\n * return {\n * ...span,\n * metadata: { ...span.metadata, userName: userData.name },\n * };\n * };\n *\n * // Use with an exporter\n * new BraintrustExporter({\n * customSpanFormatter: plainTextFormatter,\n * });\n * ```\n */\nexport type CustomSpanFormatter = (span: AnyExportedSpan) => AnyExportedSpan | Promise<AnyExportedSpan>;\n","/**\n * Browser-safe observability utilities.\n *\n * Functions that depend on AsyncLocalStorage (getCurrentSpan, executeWithContext,\n * executeWithContextSync) are in context-storage.ts and should only be imported\n * by server-side code.\n */\n\nimport { EntityType, SpanType } from './types';\nimport type { Span, GetOrCreateSpanOptions, AnySpan } from './types';\n\nconst entityTypeValues = new Set(Object.values(EntityType));\nlet currentSpanResolver: (() => AnySpan | undefined) | undefined;\n\nexport function setCurrentSpanResolver(resolver: (() => AnySpan | undefined) | undefined): void {\n currentSpanResolver = resolver;\n}\n\nexport function resolveCurrentSpan(): AnySpan | undefined {\n return currentSpanResolver?.();\n}\n\n// --- Lazy resolvers for executeWithContext / executeWithContextSync ---\n// The real implementations live in context-storage.ts (which imports AsyncLocalStorage).\n// context-storage.ts registers them at import time so that consumer code can call these\n// browser-safe wrappers without pulling async_hooks into shared chunks.\n\ntype ExecuteWithContextFn = <T>(params: { span?: AnySpan; fn: () => Promise<T> }) => Promise<T>;\ntype ExecuteWithContextSyncFn = <T>(params: { span?: AnySpan; fn: () => T }) => T;\n\nlet executeWithContextImpl: ExecuteWithContextFn | undefined;\nlet executeWithContextSyncImpl: ExecuteWithContextSyncFn | undefined;\n\nexport function setExecuteWithContext(impl: ExecuteWithContextFn): void {\n executeWithContextImpl = impl;\n}\n\nexport function setExecuteWithContextSync(impl: ExecuteWithContextSyncFn): void {\n executeWithContextSyncImpl = impl;\n}\n\n/**\n * Execute an async function within a span's tracing context.\n * Falls back to direct execution if no context-storage implementation is registered or no span exists.\n */\nexport async function executeWithContext<T>(params: { span?: AnySpan; fn: () => Promise<T> }): Promise<T> {\n if (executeWithContextImpl) {\n return executeWithContextImpl(params);\n }\n const { span, fn } = params;\n if (span?.executeInContext) {\n return span.executeInContext(fn);\n }\n return fn();\n}\n\n/**\n * Execute a sync function within a span's tracing context.\n * Falls back to direct execution if no context-storage implementation is registered or no span exists.\n */\nexport function executeWithContextSync<T>(params: { span?: AnySpan; fn: () => T }): T {\n if (executeWithContextSyncImpl) {\n return executeWithContextSyncImpl(params);\n }\n const { span, fn } = params;\n if (span?.executeInContextSync) {\n return span.executeInContextSync(fn);\n }\n return fn();\n}\n\n/**\n * Creates or gets a child span from existing tracing context or starts a new trace.\n * This helper consolidates the common pattern of creating spans that can either be:\n * 1. Children of an existing span (when tracingContext.currentSpan exists)\n * 2. New root spans (when no current span exists)\n *\n * @param options - Configuration object for span creation\n * @returns The created Span or undefined if tracing is disabled\n */\nexport function getOrCreateSpan<T extends SpanType>(options: GetOrCreateSpanOptions<T>): Span<T> | undefined {\n const { type, attributes, tracingContext, requestContext, tracingOptions, ...rest } = options;\n\n const metadata = {\n ...(rest.metadata ?? {}),\n ...(tracingOptions?.metadata ?? {}),\n };\n\n // If we have a current span, create a child span\n if (tracingContext?.currentSpan) {\n return tracingContext.currentSpan.createChildSpan({\n type,\n attributes,\n ...rest,\n metadata,\n requestContext,\n });\n }\n\n // Otherwise, try to create a new root span\n const instance = options.mastra?.observability?.getSelectedInstance({ requestContext });\n\n return instance?.startSpan<T>({\n type,\n attributes,\n ...rest,\n metadata,\n requestContext,\n tracingOptions,\n traceId: tracingOptions?.traceId,\n parentSpanId: tracingOptions?.parentSpanId,\n customSamplerOptions: {\n requestContext,\n metadata,\n },\n });\n}\n\n/**\n * Returns the top-most non-internal span that would appear in exported tracing output.\n *\n * Public API results should use this span for trace/span correlation because internal Mastra\n * workflow spans are omitted from external exporters.\n */\nexport function getRootExportSpan(span?: AnySpan): AnySpan | undefined {\n if (!span?.isValid) {\n return undefined;\n }\n\n let current: AnySpan | undefined = span;\n let rootExportSpan: AnySpan | undefined = span.isInternal ? undefined : span;\n\n while (current?.parent) {\n current = current.parent;\n\n if (!current.isInternal) {\n rootExportSpan = current;\n }\n }\n\n return rootExportSpan;\n}\n\n/**\n * Resolves the best available entity type for a span-like record.\n *\n * Prefers an explicit `entityType` when present and valid, then falls back to the\n * span type for common observability entities.\n */\nexport function getEntityTypeForSpan(span: {\n entityType?: string | null;\n spanType?: SpanType | string | null;\n}): EntityType | undefined {\n if (span.entityType && entityTypeValues.has(span.entityType as EntityType)) {\n return span.entityType as EntityType;\n }\n\n switch (span.spanType) {\n case SpanType.AGENT_RUN:\n return EntityType.AGENT;\n case SpanType.SCORER_RUN:\n case SpanType.SCORER_STEP:\n return EntityType.SCORER;\n case SpanType.WORKFLOW_RUN:\n return EntityType.WORKFLOW_RUN;\n case SpanType.WORKFLOW_STEP:\n return EntityType.WORKFLOW_STEP;\n case SpanType.TOOL_CALL:\n case SpanType.MCP_TOOL_CALL:\n return EntityType.TOOL;\n case SpanType.PROCESSOR_RUN:\n return EntityType.OUTPUT_PROCESSOR;\n default:\n return undefined;\n }\n}\n"]}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunkSQINVD7G_cjs = require('./chunk-SQINVD7G.cjs');
|
|
4
|
-
var
|
|
5
|
-
var chunkD5FMOLQZ_cjs = require('./chunk-D5FMOLQZ.cjs');
|
|
6
|
-
var chunkB4OOPFD3_cjs = require('./chunk-B4OOPFD3.cjs');
|
|
4
|
+
var chunk7DONY7OL_cjs = require('./chunk-7DONY7OL.cjs');
|
|
7
5
|
var chunkXB4FLS7A_cjs = require('./chunk-XB4FLS7A.cjs');
|
|
8
6
|
var chunkRLPRSIR2_cjs = require('./chunk-RLPRSIR2.cjs');
|
|
7
|
+
var chunkB4OOPFD3_cjs = require('./chunk-B4OOPFD3.cjs');
|
|
8
|
+
var chunk47RKHZIP_cjs = require('./chunk-47RKHZIP.cjs');
|
|
9
9
|
var chunk4U7ZLI36_cjs = require('./chunk-4U7ZLI36.cjs');
|
|
10
|
-
var
|
|
10
|
+
var chunkFCQNDFEW_cjs = require('./chunk-FCQNDFEW.cjs');
|
|
11
11
|
var schemaCompat = require('@mastra/schema-compat');
|
|
12
12
|
var crypto = require('crypto');
|
|
13
13
|
|
|
@@ -23,7 +23,7 @@ function convertV4Usage(usage) {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
// src/llm/model/model.ts
|
|
26
|
-
var MastraLLMV1 = class extends
|
|
26
|
+
var MastraLLMV1 = class extends chunkFCQNDFEW_cjs.MastraBase {
|
|
27
27
|
#model;
|
|
28
28
|
#mastra;
|
|
29
29
|
#options;
|
|
@@ -108,7 +108,7 @@ var MastraLLMV1 = class extends chunkDKK77FIJ_cjs.MastraBase {
|
|
|
108
108
|
this.logger.debug("Using experimental output", {
|
|
109
109
|
runId
|
|
110
110
|
});
|
|
111
|
-
if (
|
|
111
|
+
if (chunk7DONY7OL_cjs.isZodType(experimental_output)) {
|
|
112
112
|
schema = experimental_output;
|
|
113
113
|
if (chunkRLPRSIR2_cjs.isZodArray(schema)) {
|
|
114
114
|
schema = chunkRLPRSIR2_cjs.getZodDef(schema).type;
|
|
@@ -206,7 +206,7 @@ var MastraLLMV1 = class extends chunkDKK77FIJ_cjs.MastraBase {
|
|
|
206
206
|
const remainingTokens = parseInt(props?.response?.headers?.["x-ratelimit-remaining-tokens"] ?? "", 10);
|
|
207
207
|
if (!isNaN(remainingTokens) && remainingTokens > 0 && remainingTokens < 2e3) {
|
|
208
208
|
this.logger.warn("Rate limit approaching, waiting 10 seconds", { runId });
|
|
209
|
-
await
|
|
209
|
+
await chunk7DONY7OL_cjs.delay(10 * 1e3);
|
|
210
210
|
}
|
|
211
211
|
},
|
|
212
212
|
experimental_output: schema ? chunkSQINVD7G_cjs.output_exports.object({
|
|
@@ -214,7 +214,7 @@ var MastraLLMV1 = class extends chunkDKK77FIJ_cjs.MastraBase {
|
|
|
214
214
|
}) : void 0
|
|
215
215
|
};
|
|
216
216
|
try {
|
|
217
|
-
const result = await
|
|
217
|
+
const result = await chunk47RKHZIP_cjs.executeWithContext({
|
|
218
218
|
span: llmSpan,
|
|
219
219
|
fn: () => chunkSQINVD7G_cjs.generateText(argsForExecute)
|
|
220
220
|
});
|
|
@@ -459,7 +459,7 @@ var MastraLLMV1 = class extends chunkDKK77FIJ_cjs.MastraBase {
|
|
|
459
459
|
requestContext
|
|
460
460
|
});
|
|
461
461
|
if (llmSpan) {
|
|
462
|
-
|
|
462
|
+
chunk47RKHZIP_cjs.executeWithContextSync({
|
|
463
463
|
span: llmSpan,
|
|
464
464
|
fn: () => this.logger.debug("Streaming text", {
|
|
465
465
|
runId,
|
|
@@ -530,7 +530,7 @@ var MastraLLMV1 = class extends chunkDKK77FIJ_cjs.MastraBase {
|
|
|
530
530
|
const remainingTokens = parseInt(props?.response?.headers?.["x-ratelimit-remaining-tokens"] ?? "", 10);
|
|
531
531
|
if (!isNaN(remainingTokens) && remainingTokens > 0 && remainingTokens < 2e3) {
|
|
532
532
|
this.logger.warn("Rate limit approaching, waiting 10 seconds", { runId });
|
|
533
|
-
await
|
|
533
|
+
await chunk7DONY7OL_cjs.delay(10 * 1e3);
|
|
534
534
|
}
|
|
535
535
|
},
|
|
536
536
|
onFinish: async (props) => {
|
|
@@ -619,7 +619,7 @@ var MastraLLMV1 = class extends chunkDKK77FIJ_cjs.MastraBase {
|
|
|
619
619
|
}) : void 0
|
|
620
620
|
};
|
|
621
621
|
try {
|
|
622
|
-
return
|
|
622
|
+
return chunk47RKHZIP_cjs.executeWithContextSync({ span: llmSpan, fn: () => chunkSQINVD7G_cjs.streamText(argsForExecute) });
|
|
623
623
|
} catch (e) {
|
|
624
624
|
const mastraError = new chunk4U7ZLI36_cjs.MastraError(
|
|
625
625
|
{
|
|
@@ -1074,5 +1074,5 @@ var AISDKV5LanguageModel = class {
|
|
|
1074
1074
|
exports.AISDKV5LanguageModel = AISDKV5LanguageModel;
|
|
1075
1075
|
exports.MastraLLMV1 = MastraLLMV1;
|
|
1076
1076
|
exports.createStreamFromGenerateResult = createStreamFromGenerateResult;
|
|
1077
|
-
//# sourceMappingURL=chunk-
|
|
1078
|
-
//# sourceMappingURL=chunk-
|
|
1077
|
+
//# sourceMappingURL=chunk-4W26D7S6.cjs.map
|
|
1078
|
+
//# sourceMappingURL=chunk-4W26D7S6.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/stream/aisdk/v4/usage.ts","../src/llm/model/model.ts","../src/llm/model/aisdk/generate-to-stream.ts","../src/llm/model/aisdk/v5/model.ts"],"names":["MastraBase","OpenAIReasoningSchemaCompatLayer","OpenAISchemaCompatLayer","GoogleSchemaCompatLayer","AnthropicSchemaCompatLayer","DeepSeekSchemaCompatLayer","MetaSchemaCompatLayer","applyCompatLayer","resolveObservabilityContext","isZodType","isZodArray","getZodDef","toStandardSchema","standardSchemaToJSONSchema","jsonSchema","isStandardSchemaWithJSON","MastraError","delay","output_exports","executeWithContext","generateText","generateObject","executeWithContextSync","streamText","streamObject","onFinish","randomUUID"],"mappings":";;;;;;;;;;;;;;AAkBO,SAAS,eAAe,KAAA,EAAqD;AAClF,EAAA,IAAI,CAAC,KAAA,EAAO;AACV,IAAA,OAAO,EAAC;AAAA,EACV;AAEA,EAAA,OAAO;AAAA,IACL,aAAa,KAAA,CAAM,YAAA;AAAA,IACnB,cAAc,KAAA,CAAM;AAAA,GACtB;AACF;;;ACuBO,IAAM,WAAA,GAAN,cAA0BA,4BAAA,CAAW;AAAA,EAC1C,MAAA;AAAA,EACA,OAAA;AAAA,EACA,QAAA;AAAA,EAEA,WAAA,CAAY,EAAE,KAAA,EAAO,MAAA,EAAQ,SAAQ,EAA4E;AAC/G,IAAA,KAAA,CAAM,EAAE,IAAA,EAAM,OAAA,EAAS,CAAA;AAEvB,IAAA,IAAA,CAAK,MAAA,GAAS,KAAA;AACd,IAAA,IAAA,CAAK,QAAA,GAAW,OAAA;AAEhB,IAAA,IAAI,MAAA,EAAQ;AACV,MAAA,IAAA,CAAK,OAAA,GAAU,MAAA;AACf,MAAA,IAAI,MAAA,CAAO,WAAU,EAAG;AACtB,QAAA,IAAA,CAAK,WAAA,CAAY,IAAA,CAAK,OAAA,CAAQ,SAAA,EAAW,CAAA;AAAA,MAC3C;AAAA,IACF;AAAA,EACF;AAAA,EAEA,qBAAqB,CAAA,EAAqB;AACxC,IAAA,IAAI,EAAE,MAAA,EAAQ;AACZ,MAAA,IAAA,CAAK,WAAA,CAAY,EAAE,MAAM,CAAA;AAAA,IAC3B;AAAA,EACF;AAAA,EAEA,iBAAiB,CAAA,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,EACF;AAAA,EAEA,MAAM,SAAS,OAAA,EAAqC;AAClD,IAAA,OAAO,MAAM,IAAA,CAAK,MAAA,CAAO,QAAA,CAAS,OAAO,CAAA;AAAA,EAC3C;AACF","file":"chunk-4W26D7S6.cjs","sourcesContent":["import type { UsageStats } from '../../../observability';\n\n/**\n * AI SDK v4 LanguageModelUsage type definition\n * (matches the ai package's LanguageModelUsage)\n */\ninterface LanguageModelUsageV4 {\n promptTokens: number;\n completionTokens: number;\n totalTokens?: number;\n}\n\n/**\n * Converts AI SDK v4 LanguageModelUsage to our UsageStats format.\n *\n * @param usage - The LanguageModelUsage from AI SDK v4\n * @returns Normalized UsageStats\n */\nexport function convertV4Usage(usage: LanguageModelUsageV4 | undefined): UsageStats {\n if (!usage) {\n return {};\n }\n\n return {\n inputTokens: usage.promptTokens,\n outputTokens: usage.completionTokens,\n };\n}\n","import { generateObject, generateText, Output, streamObject, streamText } from '@internal/ai-sdk-v4';\nimport type {\n CoreMessage,\n LanguageModelV1 as LanguageModel,\n StreamObjectOnFinishCallback,\n StreamTextOnFinishCallback,\n} from '@internal/ai-sdk-v4';\nimport {\n AnthropicSchemaCompatLayer,\n applyCompatLayer,\n DeepSeekSchemaCompatLayer,\n GoogleSchemaCompatLayer,\n MetaSchemaCompatLayer,\n OpenAIReasoningSchemaCompatLayer,\n OpenAISchemaCompatLayer,\n jsonSchema,\n} from '@mastra/schema-compat';\nimport type { JSONSchema7, Schema } from '@mastra/schema-compat';\nimport type { z } from 'zod/v4';\nimport type { MastraPrimitives } from '../../action';\nimport { MastraBase } from '../../base';\nimport { MastraError, ErrorDomain, ErrorCategory } from '../../error';\nimport type { Mastra } from '../../mastra';\nimport { SpanType, resolveObservabilityContext } from '../../observability';\nimport { executeWithContext, executeWithContextSync } from '../../observability/utils';\nimport { toStandardSchema, standardSchemaToJSONSchema, isStandardSchemaWithJSON } from '../../schema';\nimport type { ZodSchema } from '../../schema';\nimport { convertV4Usage } from '../../stream/aisdk/v4/usage';\nimport { delay, isZodType } from '../../utils';\nimport { isZodArray, getZodDef } from '../../utils/zod-utils';\n\nimport type {\n GenerateObjectWithMessagesArgs,\n GenerateTextResult,\n GenerateObjectResult,\n GenerateTextWithMessagesArgs,\n OriginalGenerateTextOptions,\n ToolSet,\n GenerateReturn,\n OriginalGenerateObjectOptions,\n StreamTextWithMessagesArgs,\n StreamTextResult,\n OriginalStreamTextOptions,\n StreamObjectWithMessagesArgs,\n OriginalStreamObjectOptions,\n StreamObjectResult,\n StreamReturn,\n} from './base.types';\nimport type { inferOutput, MastraModelOptions } from './shared.types';\n\nexport class MastraLLMV1 extends MastraBase {\n #model: LanguageModel;\n #mastra?: Mastra;\n #options?: MastraModelOptions;\n\n constructor({ model, mastra, options }: { model: LanguageModel; mastra?: Mastra; options?: MastraModelOptions }) {\n super({ name: 'aisdk' });\n\n this.#model = model;\n this.#options = options;\n\n if (mastra) {\n this.#mastra = mastra;\n if (mastra.getLogger()) {\n this.__setLogger(this.#mastra.getLogger());\n }\n }\n }\n\n __registerPrimitives(p: MastraPrimitives) {\n if (p.logger) {\n this.__setLogger(p.logger);\n }\n }\n\n __registerMastra(p: Mastra) {\n this.#mastra = p;\n }\n\n getProvider() {\n return this.#model.provider;\n }\n\n getModelId() {\n return this.#model.modelId;\n }\n\n getModel() {\n return this.#model;\n }\n\n private _applySchemaCompat(schema: ZodSchema | JSONSchema7): Schema {\n const model = this.#model;\n\n const schemaCompatLayers = [];\n\n if (model) {\n const modelInfo = {\n modelId: model.modelId,\n supportsStructuredOutputs: model.supportsStructuredOutputs ?? false,\n provider: model.provider,\n };\n schemaCompatLayers.push(\n new OpenAIReasoningSchemaCompatLayer(modelInfo),\n new OpenAISchemaCompatLayer(modelInfo),\n new GoogleSchemaCompatLayer(modelInfo),\n new AnthropicSchemaCompatLayer(modelInfo),\n new DeepSeekSchemaCompatLayer(modelInfo),\n new MetaSchemaCompatLayer(modelInfo),\n );\n }\n\n // \"Type instantiation is excessively deep\" error from complex ZodSchema generic inference\n return applyCompatLayer({\n schema: schema as any,\n compatLayers: schemaCompatLayers,\n mode: 'aiSdkSchema',\n });\n }\n\n async __text<Tools extends ToolSet, Z extends ZodSchema | JSONSchema7 | undefined>({\n runId,\n messages,\n maxSteps = 5,\n tools = {},\n temperature,\n toolChoice = 'auto',\n onStepFinish,\n experimental_output,\n threadId,\n resourceId,\n requestContext,\n ...rest\n }: GenerateTextWithMessagesArgs<Tools, Z>): Promise<GenerateTextResult<Tools, Z>> {\n const model = this.#model;\n const observabilityContext = resolveObservabilityContext(rest);\n\n this.logger.debug('Generating text', {\n runId,\n messages,\n maxSteps,\n threadId,\n resourceId,\n tools: Object.keys(tools),\n });\n\n let schema: z.ZodType<inferOutput<Z>> | Schema<inferOutput<Z>> | undefined = undefined;\n\n if (experimental_output) {\n this.logger.debug('Using experimental output', {\n runId,\n });\n\n if (isZodType(experimental_output)) {\n schema = experimental_output as z.ZodType<inferOutput<Z>>;\n if (isZodArray(schema)) {\n schema = getZodDef(schema).type as z.ZodType<inferOutput<Z>>;\n }\n\n // Convert Zod schema to JSON Schema via standard schema interface\n const standardSchema = toStandardSchema(schema as any);\n const jsonSchemaToUse = standardSchemaToJSONSchema(standardSchema);\n\n schema = jsonSchema<inferOutput<Z>>(jsonSchemaToUse);\n } else {\n schema = jsonSchema<inferOutput<Z>>(experimental_output);\n }\n }\n\n // make json schema a ai sdk schema\n if (tools && Object.keys(tools).length > 0) {\n for (const tool of Object.values(tools)) {\n if (tool.parameters) {\n if ('validate' in tool.parameters) {\n tool.parameters = tool.parameters;\n } else if (isStandardSchemaWithJSON(tool.parameters)) {\n tool.parameters = jsonSchema(standardSchemaToJSONSchema(tool.parameters));\n } else {\n tool.parameters = jsonSchema(tool.parameters);\n }\n }\n }\n }\n\n const llmSpan = observabilityContext.tracingContext.currentSpan?.createChildSpan({\n name: `llm: '${model.modelId}'`,\n type: SpanType.MODEL_GENERATION,\n input: {\n messages,\n schema,\n },\n attributes: {\n model: model.modelId,\n provider: model.provider,\n parameters: {\n temperature,\n maxOutputTokens: rest.maxTokens,\n topP: rest.topP,\n frequencyPenalty: rest.frequencyPenalty,\n presencePenalty: rest.presencePenalty,\n },\n streaming: false,\n },\n metadata: {\n runId,\n threadId,\n resourceId,\n },\n tracingPolicy: this.#options?.tracingPolicy,\n requestContext,\n });\n\n const argsForExecute: OriginalGenerateTextOptions<Tools, Z> = {\n ...rest,\n messages,\n model,\n temperature,\n tools: {\n ...(tools as Tools),\n },\n toolChoice,\n maxSteps,\n onStepFinish: async props => {\n try {\n await onStepFinish?.({ ...props, runId: runId! });\n } catch (e: unknown) {\n const mastraError = new MastraError(\n {\n id: 'LLM_TEXT_ON_STEP_FINISH_CALLBACK_EXECUTION_FAILED',\n domain: ErrorDomain.LLM,\n category: ErrorCategory.USER,\n details: {\n modelId: model.modelId,\n modelProvider: model.provider,\n runId: runId ?? 'unknown',\n threadId: threadId ?? 'unknown',\n resourceId: resourceId ?? 'unknown',\n finishReason: props?.finishReason,\n toolCalls: props?.toolCalls ? JSON.stringify(props.toolCalls) : '',\n toolResults: props?.toolResults ? JSON.stringify(props.toolResults) : '',\n usage: props?.usage ? JSON.stringify(props.usage) : '',\n },\n },\n e,\n );\n throw mastraError;\n }\n\n this.logger.debug('Text step change', {\n text: props?.text,\n toolCalls: props?.toolCalls,\n toolResults: props?.toolResults,\n finishReason: props?.finishReason,\n usage: props?.usage,\n runId,\n });\n\n const remainingTokens = parseInt(props?.response?.headers?.['x-ratelimit-remaining-tokens'] ?? '', 10);\n if (!isNaN(remainingTokens) && remainingTokens > 0 && remainingTokens < 2000) {\n this.logger.warn('Rate limit approaching, waiting 10 seconds', { runId });\n await delay(10 * 1000);\n }\n },\n experimental_output: schema\n ? Output.object({\n schema,\n })\n : undefined,\n };\n\n try {\n const result: GenerateTextResult<Tools, Z> = await executeWithContext({\n span: llmSpan,\n fn: () => generateText(argsForExecute),\n });\n\n if (schema && result.finishReason === 'stop') {\n result.object = (result as any).experimental_output;\n }\n llmSpan?.end({\n output: {\n text: result.text,\n object: result.object,\n reasoning: result.reasoningDetails,\n reasoningText: result.reasoning,\n files: result.files,\n sources: result.sources,\n toolCalls: result.toolCalls,\n warnings: result.warnings,\n },\n attributes: {\n finishReason: result.finishReason,\n responseId: result.response?.id,\n responseModel: result.response?.modelId,\n usage: convertV4Usage(result.usage),\n },\n });\n\n return result;\n } catch (e: unknown) {\n const mastraError = new MastraError(\n {\n id: 'LLM_GENERATE_TEXT_AI_SDK_EXECUTION_FAILED',\n domain: ErrorDomain.LLM,\n category: ErrorCategory.THIRD_PARTY,\n details: {\n modelId: model.modelId,\n modelProvider: model.provider,\n runId: runId ?? 'unknown',\n threadId: threadId ?? 'unknown',\n resourceId: resourceId ?? 'unknown',\n },\n },\n e,\n );\n this.logger.error('Generate text failed', {\n error: mastraError,\n runId,\n threadId,\n resourceId,\n modelId: model.modelId,\n modelProvider: model.provider,\n });\n llmSpan?.error({ error: mastraError });\n throw mastraError;\n }\n }\n\n async __textObject<Z extends ZodSchema | JSONSchema7>({\n messages,\n structuredOutput,\n runId,\n threadId,\n resourceId,\n requestContext,\n ...rest\n }: GenerateObjectWithMessagesArgs<Z>): Promise<GenerateObjectResult<Z>> {\n const model = this.#model;\n const observabilityContext = resolveObservabilityContext(rest);\n\n this.logger.debug('Generating text object', { runId });\n\n const llmSpan = observabilityContext.tracingContext.currentSpan?.createChildSpan({\n name: `llm: '${model.modelId}'`,\n type: SpanType.MODEL_GENERATION,\n input: {\n messages,\n },\n attributes: {\n model: model.modelId,\n provider: model.provider,\n parameters: {\n temperature: rest.temperature,\n maxOutputTokens: rest.maxTokens,\n topP: rest.topP,\n frequencyPenalty: rest.frequencyPenalty,\n presencePenalty: rest.presencePenalty,\n },\n streaming: false,\n },\n metadata: {\n runId,\n threadId,\n resourceId,\n },\n tracingPolicy: this.#options?.tracingPolicy,\n requestContext,\n });\n\n try {\n let output: 'object' | 'array' = 'object';\n if (isZodArray(structuredOutput)) {\n output = 'array';\n const zodDef = getZodDef(structuredOutput);\n if ('element' in zodDef) {\n structuredOutput = zodDef.element;\n } else {\n structuredOutput = zodDef.type;\n }\n }\n\n const processedSchema = this._applySchemaCompat(structuredOutput!);\n llmSpan?.update({\n input: {\n messages,\n schema: processedSchema,\n },\n });\n\n const argsForExecute: OriginalGenerateObjectOptions<Z> = {\n ...rest,\n messages,\n model,\n output,\n schema: processedSchema as Schema<Z>,\n };\n\n try {\n // @ts-expect-error - output in our implementation can only be object or array\n const result = await generateObject(argsForExecute);\n\n llmSpan?.end({\n output: {\n object: result.object,\n warnings: result.warnings,\n },\n attributes: {\n finishReason: result.finishReason,\n responseId: result.response?.id,\n responseModel: result.response?.modelId,\n usage: convertV4Usage(result.usage),\n },\n });\n\n // @ts-expect-error - output in our implementation can only be object or array\n return result;\n } catch (e: unknown) {\n const mastraError = new MastraError(\n {\n id: 'LLM_GENERATE_OBJECT_AI_SDK_EXECUTION_FAILED',\n domain: ErrorDomain.LLM,\n category: ErrorCategory.THIRD_PARTY,\n details: {\n modelId: model.modelId,\n modelProvider: model.provider,\n runId: runId ?? 'unknown',\n threadId: threadId ?? 'unknown',\n resourceId: resourceId ?? 'unknown',\n },\n },\n e,\n );\n this.logger.error('Generate object failed', {\n error: mastraError,\n runId,\n threadId,\n resourceId,\n modelId: model.modelId,\n modelProvider: model.provider,\n });\n llmSpan?.error({ error: mastraError });\n throw mastraError;\n }\n } catch (e: unknown) {\n if (e instanceof MastraError) {\n throw e;\n }\n\n const mastraError = new MastraError(\n {\n id: 'LLM_GENERATE_OBJECT_AI_SDK_SCHEMA_CONVERSION_FAILED',\n domain: ErrorDomain.LLM,\n category: ErrorCategory.USER,\n details: {\n modelId: model.modelId,\n modelProvider: model.provider,\n runId: runId ?? 'unknown',\n threadId: threadId ?? 'unknown',\n resourceId: resourceId ?? 'unknown',\n },\n },\n e,\n );\n this.logger.error('Generate object schema conversion failed', {\n error: mastraError,\n runId,\n threadId,\n resourceId,\n modelId: model.modelId,\n modelProvider: model.provider,\n });\n llmSpan?.error({ error: mastraError });\n throw mastraError;\n }\n }\n\n __stream<Tools extends ToolSet, Z extends ZodSchema | JSONSchema7 | undefined = undefined>({\n messages,\n onStepFinish,\n onFinish,\n maxSteps = 5,\n tools = {},\n runId,\n temperature,\n toolChoice = 'auto',\n experimental_output,\n threadId,\n resourceId,\n requestContext,\n ...rest\n }: StreamTextWithMessagesArgs<Tools, Z>): StreamTextResult<Tools, Z> {\n const model = this.#model;\n const observabilityContext = resolveObservabilityContext(rest);\n\n let schema: z.ZodType<Z> | Schema<Z> | undefined;\n if (experimental_output) {\n if (typeof (experimental_output as any).parse === 'function') {\n schema = experimental_output as z.ZodType<Z>;\n if (isZodArray(schema)) {\n schema = getZodDef(schema).type as z.ZodType<Z>;\n }\n } else {\n schema = jsonSchema(experimental_output as JSONSchema7) as Schema<Z>;\n }\n }\n\n const llmSpan = observabilityContext.tracingContext.currentSpan?.createChildSpan({\n name: `llm: '${model.modelId}'`,\n type: SpanType.MODEL_GENERATION,\n input: {\n messages,\n },\n attributes: {\n model: model.modelId,\n provider: model.provider,\n parameters: {\n temperature,\n maxOutputTokens: rest.maxTokens,\n topP: rest.topP,\n frequencyPenalty: rest.frequencyPenalty,\n presencePenalty: rest.presencePenalty,\n },\n streaming: true,\n },\n metadata: {\n runId,\n threadId,\n resourceId,\n },\n tracingPolicy: this.#options?.tracingPolicy,\n requestContext,\n });\n\n if (llmSpan) {\n executeWithContextSync({\n span: llmSpan,\n fn: () =>\n this.logger.debug('Streaming text', {\n runId,\n threadId,\n resourceId,\n messages,\n maxSteps,\n tools: Object.keys(tools || {}),\n }),\n });\n }\n\n // make json schema a ai sdk schema\n if (tools && Object.keys(tools).length > 0) {\n for (const tool of Object.values(tools)) {\n if (tool.parameters) {\n if ('validate' in tool.parameters) {\n tool.parameters = tool.parameters;\n } else if (isStandardSchemaWithJSON(tool.parameters)) {\n tool.parameters = jsonSchema(standardSchemaToJSONSchema(tool.parameters));\n } else {\n tool.parameters = jsonSchema(tool.parameters);\n }\n }\n }\n }\n\n const argsForExecute: OriginalStreamTextOptions<Tools, Z> = {\n model,\n temperature,\n tools: {\n ...(tools as Tools),\n },\n maxSteps,\n toolChoice,\n onStepFinish: async props => {\n try {\n await onStepFinish?.({ ...props, runId: runId! });\n } catch (e: unknown) {\n const mastraError = new MastraError(\n {\n id: 'LLM_STREAM_ON_STEP_FINISH_CALLBACK_EXECUTION_FAILED',\n domain: ErrorDomain.LLM,\n category: ErrorCategory.USER,\n details: {\n modelId: model.modelId,\n modelProvider: model.provider,\n runId: runId ?? 'unknown',\n threadId: threadId ?? 'unknown',\n resourceId: resourceId ?? 'unknown',\n finishReason: props?.finishReason,\n toolCalls: props?.toolCalls ? JSON.stringify(props.toolCalls) : '',\n toolResults: props?.toolResults ? JSON.stringify(props.toolResults) : '',\n usage: props?.usage ? JSON.stringify(props.usage) : '',\n },\n },\n e,\n );\n this.logger.trackException(mastraError);\n llmSpan?.error({ error: mastraError });\n throw mastraError;\n }\n\n this.logger.debug('Stream step change', {\n text: props?.text,\n toolCalls: props?.toolCalls,\n toolResults: props?.toolResults,\n finishReason: props?.finishReason,\n usage: props?.usage,\n runId,\n });\n\n const remainingTokens = parseInt(props?.response?.headers?.['x-ratelimit-remaining-tokens'] ?? '', 10);\n if (!isNaN(remainingTokens) && remainingTokens > 0 && remainingTokens < 2000) {\n this.logger.warn('Rate limit approaching, waiting 10 seconds', { runId });\n await delay(10 * 1000);\n }\n },\n onFinish: async props => {\n // End the model generation span BEFORE calling the user's onFinish callback\n // This ensures the model span ends before the agent span\n llmSpan?.end({\n output: {\n text: props?.text,\n reasoning: props?.reasoningDetails,\n reasoningText: props?.reasoning,\n files: props?.files,\n sources: props?.sources,\n toolCalls: props?.toolCalls,\n warnings: props?.warnings,\n },\n attributes: {\n finishReason: props?.finishReason,\n usage: convertV4Usage(props?.usage),\n },\n });\n\n try {\n await onFinish?.({ ...props, runId: runId! });\n } catch (e: unknown) {\n const mastraError = new MastraError(\n {\n id: 'LLM_STREAM_ON_FINISH_CALLBACK_EXECUTION_FAILED',\n domain: ErrorDomain.LLM,\n category: ErrorCategory.USER,\n details: {\n modelId: model.modelId,\n modelProvider: model.provider,\n runId: runId ?? 'unknown',\n threadId: threadId ?? 'unknown',\n resourceId: resourceId ?? 'unknown',\n finishReason: props?.finishReason,\n toolCalls: props?.toolCalls ? JSON.stringify(props.toolCalls) : '',\n toolResults: props?.toolResults ? JSON.stringify(props.toolResults) : '',\n usage: props?.usage ? JSON.stringify(props.usage) : '',\n },\n },\n e,\n );\n llmSpan?.error({ error: mastraError });\n this.logger.trackException(mastraError);\n throw mastraError;\n }\n\n this.logger.debug('Stream finished', {\n text: props?.text,\n toolCalls: props?.toolCalls,\n toolResults: props?.toolResults,\n finishReason: props?.finishReason,\n usage: props?.usage,\n runId,\n threadId,\n resourceId,\n });\n },\n onError: ({ error }) => {\n const mastraError = new MastraError(\n {\n id: 'LLM_STREAM_TEXT_AI_SDK_STREAMING_ERROR',\n domain: ErrorDomain.LLM,\n category: ErrorCategory.THIRD_PARTY,\n details: {\n modelId: model.modelId,\n modelProvider: model.provider,\n runId: runId ?? 'unknown',\n threadId: threadId ?? 'unknown',\n resourceId: resourceId ?? 'unknown',\n },\n },\n error,\n );\n this.logger.error('Stream text error', {\n error: mastraError,\n runId,\n threadId,\n resourceId,\n modelId: model.modelId,\n modelProvider: model.provider,\n });\n llmSpan?.error({ error: mastraError });\n },\n ...rest,\n messages,\n experimental_output: schema\n ? (Output.object({\n schema,\n }) as any)\n : undefined,\n };\n\n try {\n return executeWithContextSync({ span: llmSpan, fn: () => streamText(argsForExecute) });\n } catch (e: unknown) {\n const mastraError = new MastraError(\n {\n id: 'LLM_STREAM_TEXT_AI_SDK_EXECUTION_FAILED',\n domain: ErrorDomain.LLM,\n category: ErrorCategory.THIRD_PARTY,\n details: {\n modelId: model.modelId,\n modelProvider: model.provider,\n runId: runId ?? 'unknown',\n threadId: threadId ?? 'unknown',\n resourceId: resourceId ?? 'unknown',\n },\n },\n e,\n );\n this.logger.error('Stream text failed', {\n error: mastraError,\n runId,\n threadId,\n resourceId,\n modelId: model.modelId,\n modelProvider: model.provider,\n });\n llmSpan?.error({ error: mastraError });\n throw mastraError;\n }\n }\n\n __streamObject<T extends ZodSchema | JSONSchema7>({\n messages,\n runId,\n requestContext,\n threadId,\n resourceId,\n onFinish,\n structuredOutput,\n ...rest\n }: StreamObjectWithMessagesArgs<T>): StreamObjectResult<T> {\n const model = this.#model;\n const observabilityContext = resolveObservabilityContext(rest);\n\n this.logger.debug('Streaming structured output', {\n runId,\n messages,\n });\n\n const llmSpan = observabilityContext.tracingContext.currentSpan?.createChildSpan({\n name: `llm: '${model.modelId}'`,\n type: SpanType.MODEL_GENERATION,\n input: {\n messages,\n },\n attributes: {\n model: model.modelId,\n provider: model.provider,\n parameters: {\n temperature: rest.temperature,\n maxOutputTokens: rest.maxTokens,\n topP: rest.topP,\n frequencyPenalty: rest.frequencyPenalty,\n presencePenalty: rest.presencePenalty,\n },\n streaming: true,\n },\n metadata: {\n runId,\n threadId,\n resourceId,\n },\n tracingPolicy: this.#options?.tracingPolicy,\n requestContext,\n });\n\n try {\n let output: 'object' | 'array' = 'object';\n if (isZodArray(structuredOutput)) {\n output = 'array';\n structuredOutput = getZodDef(structuredOutput).type;\n }\n\n const processedSchema = this._applySchemaCompat(structuredOutput!);\n llmSpan?.update({\n input: {\n messages,\n schema: processedSchema,\n },\n });\n\n const argsForExecute: OriginalStreamObjectOptions<T> = {\n ...rest,\n model,\n onFinish: async (props: any) => {\n // End the model generation span BEFORE calling the user's onFinish callback\n // This ensures the model span ends before the agent span\n llmSpan?.end({\n output: {\n text: props?.text,\n object: props?.object,\n reasoning: props?.reasoningDetails,\n reasoningText: props?.reasoning,\n files: props?.files,\n sources: props?.sources,\n warnings: props?.warnings,\n },\n attributes: {\n finishReason: props?.finishReason,\n usage: props?.usage,\n },\n });\n\n try {\n await onFinish?.({ ...props, runId: runId! });\n } catch (e: unknown) {\n const mastraError = new MastraError(\n {\n id: 'LLM_STREAM_OBJECT_ON_FINISH_CALLBACK_EXECUTION_FAILED',\n domain: ErrorDomain.LLM,\n category: ErrorCategory.USER,\n details: {\n modelId: model.modelId,\n modelProvider: model.provider,\n runId: runId ?? 'unknown',\n threadId: threadId ?? 'unknown',\n resourceId: resourceId ?? 'unknown',\n toolCalls: '',\n toolResults: '',\n finishReason: '',\n usage: props?.usage ? JSON.stringify(props.usage) : '',\n },\n },\n e,\n );\n this.logger.trackException(mastraError);\n llmSpan?.error({ error: mastraError });\n throw mastraError;\n }\n\n this.logger.debug('Object stream finished', {\n usage: props?.usage,\n runId,\n threadId,\n resourceId,\n });\n },\n onError: ({ error }) => {\n const mastraError = new MastraError(\n {\n id: 'LLM_STREAM_OBJECT_AI_SDK_STREAMING_ERROR',\n domain: ErrorDomain.LLM,\n category: ErrorCategory.THIRD_PARTY,\n details: {\n modelId: model.modelId,\n modelProvider: model.provider,\n runId: runId ?? 'unknown',\n threadId: threadId ?? 'unknown',\n resourceId: resourceId ?? 'unknown',\n },\n },\n error,\n );\n this.logger.error('Stream object error', {\n error: mastraError,\n runId,\n threadId,\n resourceId,\n modelId: model.modelId,\n modelProvider: model.provider,\n });\n llmSpan?.error({ error: mastraError });\n },\n messages,\n output,\n schema: processedSchema as Schema<inferOutput<T>>,\n };\n\n try {\n return streamObject(argsForExecute as any);\n } catch (e: unknown) {\n const mastraError = new MastraError(\n {\n id: 'LLM_STREAM_OBJECT_AI_SDK_EXECUTION_FAILED',\n domain: ErrorDomain.LLM,\n category: ErrorCategory.THIRD_PARTY,\n details: {\n modelId: model.modelId,\n modelProvider: model.provider,\n runId: runId ?? 'unknown',\n threadId: threadId ?? 'unknown',\n resourceId: resourceId ?? 'unknown',\n },\n },\n e,\n );\n this.logger.error('Stream object failed', {\n error: mastraError,\n runId,\n threadId,\n resourceId,\n modelId: model.modelId,\n modelProvider: model.provider,\n });\n llmSpan?.error({ error: mastraError });\n throw mastraError;\n }\n } catch (e: unknown) {\n if (e instanceof MastraError) {\n llmSpan?.error({ error: e });\n throw e;\n }\n\n const mastraError = new MastraError(\n {\n id: 'LLM_STREAM_OBJECT_AI_SDK_SCHEMA_CONVERSION_FAILED',\n domain: ErrorDomain.LLM,\n category: ErrorCategory.USER,\n details: {\n modelId: model.modelId,\n modelProvider: model.provider,\n runId: runId ?? 'unknown',\n threadId: threadId ?? 'unknown',\n resourceId: resourceId ?? 'unknown',\n },\n },\n e,\n );\n this.logger.error('Stream object schema conversion failed', {\n error: mastraError,\n runId,\n threadId,\n resourceId,\n modelId: model.modelId,\n modelProvider: model.provider,\n });\n llmSpan?.error({ error: mastraError });\n throw mastraError;\n }\n }\n\n convertToMessages(messages: string | string[] | CoreMessage[]): CoreMessage[] {\n if (Array.isArray(messages)) {\n return messages.map(m => {\n if (typeof m === 'string') {\n return {\n role: 'user',\n content: m,\n };\n }\n return m;\n });\n }\n\n return [\n {\n role: 'user',\n content: messages,\n },\n ];\n }\n\n async generate<\n Output extends ZodSchema | JSONSchema7 | undefined = undefined,\n StructuredOutput extends ZodSchema | JSONSchema7 | undefined = undefined,\n Tools extends ToolSet = ToolSet,\n >(\n messages: string | string[] | CoreMessage[],\n args?: Omit<\n Output extends undefined\n ? GenerateTextWithMessagesArgs<Tools, StructuredOutput>\n : Omit<GenerateObjectWithMessagesArgs<NonNullable<Output>>, 'structuredOutput' | 'output'>,\n 'messages'\n > & { output?: Output },\n ): Promise<GenerateReturn<Tools, Output, StructuredOutput>> {\n const msgs = this.convertToMessages(messages);\n const { output, ...rest } = args ?? ({} as NonNullable<typeof args>);\n\n if (!output) {\n return (await this.__text<Tools, StructuredOutput>({\n messages: msgs,\n ...(rest as unknown as Omit<GenerateTextWithMessagesArgs<Tools, StructuredOutput>, 'messages'>),\n })) as GenerateReturn<Tools, Output, StructuredOutput>;\n }\n\n return (await this.__textObject({\n messages: msgs,\n structuredOutput: output as NonNullable<Output>,\n ...(rest as unknown as Omit<\n GenerateObjectWithMessagesArgs<NonNullable<Output>>,\n 'messages' | 'structuredOutput'\n >),\n })) as GenerateReturn<Tools, Output, StructuredOutput>;\n }\n\n stream<\n Output extends ZodSchema | JSONSchema7 | undefined = undefined,\n StructuredOutput extends ZodSchema | JSONSchema7 | undefined = undefined,\n Tools extends ToolSet = ToolSet,\n >(\n messages: string | string[] | CoreMessage[],\n args?: Omit<\n Output extends undefined\n ? StreamTextWithMessagesArgs<Tools, StructuredOutput>\n : Omit<StreamObjectWithMessagesArgs<NonNullable<Output>>, 'structuredOutput' | 'output'> & { maxSteps?: never },\n 'messages'\n > & { output?: Output },\n ): StreamReturn<Tools, Output, StructuredOutput> {\n const msgs = this.convertToMessages(messages);\n const { output, ...rest } = args ?? ({} as NonNullable<typeof args>);\n\n if (!output) {\n const {\n maxSteps = 5,\n onFinish,\n ...streamRest\n } = rest as unknown as Omit<StreamTextWithMessagesArgs<Tools, StructuredOutput>, 'messages'>;\n return this.__stream({\n messages: msgs,\n maxSteps,\n onFinish: onFinish as StreamTextOnFinishCallback<Tools> | undefined,\n ...streamRest,\n }) as StreamReturn<Tools, Output, StructuredOutput>;\n }\n\n const { onFinish, ...objectRest } = rest as unknown as Omit<\n StreamObjectWithMessagesArgs<NonNullable<Output>>,\n 'messages' | 'structuredOutput'\n >;\n return this.__streamObject({\n messages: msgs,\n structuredOutput: output as NonNullable<Output>,\n onFinish: onFinish as StreamObjectOnFinishCallback<inferOutput<Output>> | undefined,\n ...objectRest,\n }) as StreamReturn<Tools, Output, StructuredOutput>;\n }\n}\n","import { randomUUID } from 'node:crypto';\n\n/**\n * Converts a doGenerate result to a ReadableStream format.\n * This is shared between V2 and V3 model wrappers since the content/result structure is compatible.\n */\nexport function createStreamFromGenerateResult(result: {\n warnings: unknown[];\n response?: {\n id?: string;\n modelId?: string;\n timestamp?: Date;\n };\n content: Array<{\n type: string;\n [key: string]: unknown;\n }>;\n finishReason: unknown;\n usage: unknown;\n providerMetadata?: unknown;\n}): ReadableStream {\n return new ReadableStream({\n start(controller) {\n controller.enqueue({ type: 'stream-start', warnings: result.warnings });\n controller.enqueue({\n type: 'response-metadata',\n id: result.response?.id,\n modelId: result.response?.modelId,\n timestamp: result.response?.timestamp,\n });\n\n const toolCallMeta: Record<string, { providerExecuted?: boolean }> = {};\n for (const message of result.content) {\n if (message.type === 'tool-call') {\n const toolCall = message as {\n type: 'tool-call';\n toolCallId: string;\n toolName: string;\n input: unknown;\n providerExecuted?: boolean;\n dynamic?: boolean;\n providerMetadata?: unknown;\n };\n toolCallMeta[toolCall.toolCallId] = { providerExecuted: toolCall.providerExecuted };\n controller.enqueue({\n type: 'tool-input-start',\n id: toolCall.toolCallId,\n toolName: toolCall.toolName,\n providerExecuted: toolCall.providerExecuted,\n dynamic: toolCall.dynamic,\n providerMetadata: toolCall.providerMetadata,\n });\n controller.enqueue({\n type: 'tool-input-delta',\n id: toolCall.toolCallId,\n delta: toolCall.input,\n providerMetadata: toolCall.providerMetadata,\n });\n controller.enqueue({\n type: 'tool-input-end',\n id: toolCall.toolCallId,\n providerMetadata: toolCall.providerMetadata,\n });\n controller.enqueue(toolCall);\n } else if (message.type === 'tool-result') {\n const toolResult = message as { type: 'tool-result'; toolCallId: string; [key: string]: unknown };\n const meta = toolCallMeta[toolResult.toolCallId];\n if (meta?.providerExecuted) {\n controller.enqueue({ ...toolResult, providerExecuted: meta.providerExecuted });\n } else {\n controller.enqueue(message);\n }\n } else if (message.type === 'text') {\n const text = message as {\n type: 'text';\n text: string;\n providerMetadata?: unknown;\n };\n const id = `msg_${randomUUID()}`;\n controller.enqueue({\n type: 'text-start',\n id,\n providerMetadata: text.providerMetadata,\n });\n controller.enqueue({\n type: 'text-delta',\n id,\n delta: text.text,\n });\n controller.enqueue({\n type: 'text-end',\n id,\n });\n } else if (message.type === 'reasoning') {\n const id = `reasoning_${randomUUID()}`;\n const reasoning = message as {\n type: 'reasoning';\n text: string;\n providerMetadata?: unknown;\n };\n controller.enqueue({\n type: 'reasoning-start',\n id,\n providerMetadata: reasoning.providerMetadata,\n });\n controller.enqueue({\n type: 'reasoning-delta',\n id,\n delta: reasoning.text,\n providerMetadata: reasoning.providerMetadata,\n });\n controller.enqueue({\n type: 'reasoning-end',\n id,\n providerMetadata: reasoning.providerMetadata,\n });\n } else if (message.type === 'file') {\n const file = message as {\n type: 'file';\n mediaType: string;\n data: unknown;\n };\n controller.enqueue({\n type: 'file',\n mediaType: file.mediaType,\n data: file.data,\n });\n } else if (message.type === 'source') {\n const source = message as {\n type: 'source';\n sourceType: 'url' | 'document';\n id: string;\n url?: string;\n mediaType?: string;\n filename?: string;\n title?: string;\n providerMetadata?: unknown;\n };\n if (source.sourceType === 'url') {\n controller.enqueue({\n type: 'source',\n id: source.id,\n sourceType: 'url',\n url: source.url,\n title: source.title,\n providerMetadata: source.providerMetadata,\n });\n } else {\n controller.enqueue({\n type: 'source',\n id: source.id,\n sourceType: 'document',\n mediaType: source.mediaType,\n filename: source.filename,\n title: source.title,\n providerMetadata: source.providerMetadata,\n });\n }\n }\n }\n\n controller.enqueue({\n type: 'finish',\n finishReason: result.finishReason,\n usage: result.usage,\n providerMetadata: result.providerMetadata,\n });\n\n controller.close();\n },\n });\n}\n","import type { LanguageModelV2, LanguageModelV2CallOptions } from '@ai-sdk/provider-v5';\nimport type { MastraLanguageModelV2 } from '../../shared.types';\nimport { createStreamFromGenerateResult } from '../generate-to-stream';\n\ntype StreamResult = Awaited<ReturnType<LanguageModelV2['doStream']>>;\n\n/**\n * Wrapper class for AI SDK V5 (LanguageModelV2) that converts doGenerate to return\n * a stream format for consistency with Mastra's streaming architecture.\n */\nexport class AISDKV5LanguageModel implements MastraLanguageModelV2 {\n /**\n * The language model must specify which language model interface version it implements.\n */\n readonly specificationVersion: 'v2' = 'v2';\n /**\n * Name of the provider for logging purposes.\n */\n readonly provider: string;\n /**\n * Provider-specific model ID for logging purposes.\n */\n readonly modelId: string;\n /**\n * Supported URL patterns by media type for the provider.\n *\n * The keys are media type patterns or full media types (e.g. `*\\/*` for everything, `audio/*`, `video/*`, or `application/pdf`).\n * and the values are arrays of regular expressions that match the URL paths.\n * The matching should be against lower-case URLs.\n * Matched URLs are supported natively by the model and are not downloaded.\n * @returns A map of supported URL patterns by media type (as a promise or a plain object).\n */\n supportedUrls: PromiseLike<Record<string, RegExp[]>> | Record<string, RegExp[]>;\n\n #model: LanguageModelV2;\n\n constructor(config: LanguageModelV2) {\n this.#model = config;\n this.provider = this.#model.provider;\n this.modelId = this.#model.modelId;\n this.supportedUrls = this.#model.supportedUrls;\n }\n\n async doGenerate(options: LanguageModelV2CallOptions) {\n const result = await this.#model.doGenerate(options);\n\n return {\n ...result,\n request: result.request!,\n response: result.response as unknown as StreamResult['response'],\n stream: createStreamFromGenerateResult(result),\n };\n }\n\n async doStream(options: LanguageModelV2CallOptions) {\n return await this.#model.doStream(options);\n }\n}\n"]}
|