@mastra/server 1.86.0-alpha.8 → 1.86.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_types/{@mastra_schema-compat@1.4.1-alpha.0 → @mastra_schema-compat@1.4.1}/dist/provider-compats/anthropic.d.ts +1 -1
- package/dist/_types/{@mastra_schema-compat@1.4.1-alpha.0 → @mastra_schema-compat@1.4.1}/dist/provider-compats/deepseek.d.ts +1 -1
- package/dist/_types/{@mastra_schema-compat@1.4.1-alpha.0 → @mastra_schema-compat@1.4.1}/dist/provider-compats/meta.d.ts +1 -1
- package/dist/_types/{@mastra_schema-compat@1.4.1-alpha.0 → @mastra_schema-compat@1.4.1}/dist/schema.types.d.ts +3 -3
- package/dist/{a2a-BfWMjFe2.js → a2a-CY7rgzPe.js} +1 -1
- package/dist/{a2a-DQIwTZyo.cjs → a2a-DwjvHqcb.cjs} +1 -1
- package/dist/{agent-builder-DpuK5-6A.js → agent-builder-DHnNRROR.js} +1 -1
- package/dist/{agent-builder-NSemjs4B.cjs → agent-builder-anRH1X35.cjs} +1 -1
- package/dist/{agents-YvaBPFiS.js → agents-CAXsXenf.js} +18 -0
- package/dist/{agents-BO1mcMDf.cjs → agents-GHhuyz5x.cjs} +18 -0
- package/dist/{api-schema-manifest-CAZsA5Lk.js → api-schema-manifest-4PK1dBWt.js} +1 -1
- package/dist/{api-schema-manifest-016lHJO2.cjs → api-schema-manifest-CX16hC7V.cjs} +1 -1
- package/dist/{auth-CM5AgF9l.cjs → auth-BR7vRIrY.cjs} +5 -3
- package/dist/{auth-CjT_a76k.js → auth-ChZ3dUvo.js} +5 -3
- package/dist/{catalogue-DN4dvU88.js → catalogue-BOzHZ1xt.js} +5 -5
- package/dist/{catalogue-Cf7Zz7zb.cjs → catalogue-DNy7Fog6.cjs} +5 -5
- package/dist/{conversations-4ZO0Pjvk.js → conversations-BjD8wOc3.js} +1 -1
- package/dist/{conversations-BaYtooZZ.cjs → conversations-CgogBOHO.cjs} +1 -1
- package/dist/dist-BWVxgpEw.js +1 -0
- package/dist/{dist-DaRCrkAU.cjs → dist-Brw_H26B.cjs} +296 -72
- package/dist/{dist-uiPbWl5E.cjs → dist-C5_WGwU1.cjs} +1 -1
- package/dist/{dist-yny1avqv.js → dist-NBGkHBIE.js} +296 -72
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/docs/references/docs-knowledge-overview.md +1 -1
- package/dist/{editor-builder-CwsIbd0F.js → editor-builder-BRzXnsRW.js} +1 -1
- package/dist/{editor-builder-ChYG8YTs.cjs → editor-builder-G1ub9j0s.cjs} +1 -1
- package/dist/{knowledge-DL03nbSW.cjs → knowledge-B3768ERP.cjs} +1 -0
- package/dist/{knowledge-DAqUHFK5.js → knowledge-wqC0nrmu.js} +1 -0
- package/dist/{plans-CbR8EDiT.js → plans-DGC1grMp.js} +1 -1
- package/dist/{plans-k3UN9Nd1.cjs → plans-kA8E3Auv.cjs} +1 -1
- package/dist/{probe-image-size-z8zXmjaH.cjs → probe-image-size-ntJyQKKB.cjs} +1 -1
- package/dist/{probe-image-size-DZvSdjzK.js → probe-image-size-zXQBlFaQ.js} +1 -1
- package/dist/{responses-Blzxy0XP.js → responses--nGf7l3O.js} +1 -1
- package/dist/{responses-B-BKx236.cjs → responses-B4GDz-Nm.cjs} +1 -1
- package/dist/{routes-D-I2voQe.js → routes-BZVlqLly.js} +12 -12
- package/dist/{routes-jiZyt9kU.cjs → routes-vuZLexcc.cjs} +12 -12
- package/dist/{scores-DAv6Uisq.js → scores-Biv7XGW_.js} +1 -1
- package/dist/{scores-BikU9phm.cjs → scores-D0Qq7TfU.cjs} +1 -1
- package/dist/server/handlers/a2a.cjs +1 -1
- package/dist/server/handlers/a2a.js +1 -1
- package/dist/server/handlers/agent-builder.cjs +1 -1
- package/dist/server/handlers/agent-builder.js +1 -1
- package/dist/server/handlers/agents.cjs +1 -1
- package/dist/server/handlers/agents.js +1 -1
- package/dist/server/handlers/auth.cjs +6 -2
- package/dist/server/handlers/auth.d.ts +12 -4
- package/dist/server/handlers/auth.js +6 -2
- package/dist/server/handlers/conversations.cjs +1 -1
- package/dist/server/handlers/conversations.js +1 -1
- package/dist/server/handlers/editor-builder.cjs +1 -1
- package/dist/server/handlers/editor-builder.js +1 -1
- package/dist/server/handlers/error.cjs +1 -1
- package/dist/server/handlers/error.js +1 -1
- package/dist/server/handlers/favorites-enrichment.cjs +1 -1
- package/dist/server/handlers/favorites-enrichment.js +1 -1
- package/dist/server/handlers/knowledge.cjs +1 -1
- package/dist/server/handlers/knowledge.js +1 -1
- package/dist/server/handlers/plans.cjs +1 -1
- package/dist/server/handlers/plans.js +1 -1
- package/dist/server/handlers/responses.cjs +1 -1
- package/dist/server/handlers/responses.js +1 -1
- package/dist/server/handlers/scores.cjs +1 -1
- package/dist/server/handlers/scores.js +1 -1
- package/dist/server/handlers/stored-agent-favorites.cjs +1 -1
- package/dist/server/handlers/stored-agent-favorites.js +1 -1
- package/dist/server/handlers/stored-agents.cjs +1 -1
- package/dist/server/handlers/stored-agents.js +1 -1
- package/dist/server/handlers/stored-skill-favorites.cjs +1 -1
- package/dist/server/handlers/stored-skill-favorites.js +1 -1
- package/dist/server/handlers/stored-skills.cjs +1 -1
- package/dist/server/handlers/stored-skills.js +1 -1
- package/dist/server/handlers/system.cjs +1 -1
- package/dist/server/handlers/system.js +1 -1
- package/dist/server/handlers/tools.cjs +1 -1
- package/dist/server/handlers/tools.js +1 -1
- package/dist/server/handlers/voice.cjs +1 -1
- package/dist/server/handlers/voice.js +1 -1
- package/dist/server/handlers.cjs +9 -9
- package/dist/server/handlers.js +9 -9
- package/dist/server/mcp/catalogue.d.ts +1 -1
- package/dist/server/mcp/schema.d.ts +1 -1
- package/dist/server/schemas/agents.d.ts +1 -1
- package/dist/server/schemas/auth.d.ts +3 -1
- package/dist/server/schemas/index.cjs +1 -1
- package/dist/server/schemas/index.js +1 -1
- package/dist/server/server-adapter/api-schema-manifest.d.ts +1 -1
- package/dist/server/server-adapter/index.cjs +2 -2
- package/dist/server/server-adapter/index.js +2 -2
- package/dist/server/server-adapter/openapi-utils.d.ts +1 -1
- package/dist/server/server-adapter/routes/conversations.d.ts +3 -3
- package/dist/{server-adapter-BB2Lw2Ig.cjs → server-adapter-CurME3ch.cjs} +1 -1
- package/dist/{server-adapter-CMJcvkpD.js → server-adapter-h8YRQXAC.js} +1 -1
- package/dist/{tools-CoamSJif.cjs → tools-By0RVh_O.cjs} +1 -1
- package/dist/{tools-DsSk01Ti.js → tools-C3KBdlil.js} +1 -1
- package/dist/{voice-CquR7YyA.cjs → voice-CESew8Fc.cjs} +1 -1
- package/dist/{voice-BFh2Zx5m.js → voice-PfxY_vQg.js} +1 -1
- package/package.json +10 -10
- package/dist/dist-Bz6gINFc.js +0 -1
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/@internal_core@0.1.4/dist/request-context/index.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/@internal_core@0.1.4/dist/routes/index.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/@internal_core@0.1.4/dist/types/index.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/classic/checks.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/classic/coerce.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/classic/compat.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/classic/deep-partial.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/classic/errors.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/classic/external.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/classic/from-json-schema.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/classic/in-out.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/classic/index.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/classic/iso.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/classic/parse.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/classic/schemas.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/core/api.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/core/checks.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/core/compile.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/core/core.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/core/doc.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/core/errors.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/core/index.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/core/json-schema-generator.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/core/json-schema-processors.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/core/json-schema.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/core/memoizer.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/core/parse.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/core/regexes.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/core/registries.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/core/schemas.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/core/standard-schema.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/core/to-json-schema.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/core/util.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/core/versions.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/index.d.cts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/locales/ar.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/locales/az.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/locales/be.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/locales/bg.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/locales/bn.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/locales/ca.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/locales/ckb.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/locales/cs.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/locales/da.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/locales/de.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/locales/el.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/locales/en.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/locales/eo.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/locales/es.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/locales/fa.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/locales/fi.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/locales/fr-CA.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/locales/fr.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/locales/gu.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/locales/he.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/locales/hi.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/locales/hr.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/locales/hu.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/locales/hy.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/locales/id.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/locales/index.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/locales/is.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/locales/it.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/locales/ja.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/locales/ka.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/locales/kh.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/locales/km.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/locales/kn.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/locales/ko.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/locales/lt.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/locales/mk.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/locales/ms.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/locales/ne.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/locales/nl.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/locales/nn.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/locales/no.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/locales/ota.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/locales/pl.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/locales/ps.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/locales/pt-BR.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/locales/pt.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/locales/ro.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/locales/ru.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/locales/sk.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/locales/sl.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/locales/sv.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/locales/ta.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/locales/tg.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/locales/th.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/locales/tk.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/locales/tr.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/locales/ua.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/locales/uk.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/locales/ur.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/locales/uz.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/locales/vi.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/locales/yo.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/locales/zh-CN.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/_types/zod@4.6.7/v4/locales/zh-TW.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/dist/routes/index.d.ts +0 -0
- /package/dist/_types/{@internal_voice@0.0.47 → @internal_voice@0.0.48}/package.json +0 -0
- /package/dist/_types/{@mastra_schema-compat@1.4.1-alpha.0/dist/_types/@internal_ai-sdk-v4@0.0.98 → @mastra_schema-compat@1.4.1/dist/_types/@internal_ai-sdk-v4@0.0.99}/dist/index.d.ts +0 -0
- /package/dist/_types/{@mastra_schema-compat@1.4.1-alpha.0/dist/_types/@internal_ai-sdk-v5@0.0.98 → @mastra_schema-compat@1.4.1/dist/_types/@internal_ai-sdk-v5@0.0.99}/dist/index.d.ts +0 -0
- /package/dist/_types/{@mastra_schema-compat@1.4.1-alpha.0/dist/_types/@internal_ai-v6@0.0.98 → @mastra_schema-compat@1.4.1/dist/_types/@internal_ai-v6@0.0.99}/dist/index.d.ts +0 -0
- /package/dist/_types/{@mastra_schema-compat@1.4.1-alpha.0 → @mastra_schema-compat@1.4.1}/dist/_types/@standard-schema_spec@1.1.0/dist/index.d.ts +0 -0
- /package/dist/_types/{@mastra_schema-compat@1.4.1-alpha.0 → @mastra_schema-compat@1.4.1}/dist/_types/@types_json-schema@7.0.15/index.d.ts +0 -0
- /package/dist/_types/{@mastra_schema-compat@1.4.1-alpha.0 → @mastra_schema-compat@1.4.1}/dist/index.d.ts +0 -0
- /package/dist/_types/{@mastra_schema-compat@1.4.1-alpha.0 → @mastra_schema-compat@1.4.1}/dist/null-to-undefined.d.ts +0 -0
- /package/dist/_types/{@mastra_schema-compat@1.4.1-alpha.0 → @mastra_schema-compat@1.4.1}/dist/provider-compats/google.d.ts +0 -0
- /package/dist/_types/{@mastra_schema-compat@1.4.1-alpha.0 → @mastra_schema-compat@1.4.1}/dist/provider-compats/openai-reasoning.d.ts +0 -0
- /package/dist/_types/{@mastra_schema-compat@1.4.1-alpha.0 → @mastra_schema-compat@1.4.1}/dist/provider-compats/openai.d.ts +0 -0
- /package/dist/_types/{@mastra_schema-compat@1.4.1-alpha.0 → @mastra_schema-compat@1.4.1}/dist/schema-compatibility-v3.d.ts +0 -0
- /package/dist/_types/{@mastra_schema-compat@1.4.1-alpha.0 → @mastra_schema-compat@1.4.1}/dist/schema-compatibility-v4.d.ts +0 -0
- /package/dist/_types/{@mastra_schema-compat@1.4.1-alpha.0 → @mastra_schema-compat@1.4.1}/dist/schema-compatibility.d.ts +0 -0
- /package/dist/_types/{@mastra_schema-compat@1.4.1-alpha.0 → @mastra_schema-compat@1.4.1}/dist/schema.d.ts +0 -0
- /package/dist/_types/{@mastra_schema-compat@1.4.1-alpha.0 → @mastra_schema-compat@1.4.1}/dist/standard-schema/standard-schema.d.ts +0 -0
- /package/dist/_types/{@mastra_schema-compat@1.4.1-alpha.0 → @mastra_schema-compat@1.4.1}/dist/standard-schema/standard-schema.types.d.ts +0 -0
- /package/dist/_types/{@mastra_schema-compat@1.4.1-alpha.0 → @mastra_schema-compat@1.4.1}/dist/standard-schema-compat.d.ts +0 -0
- /package/dist/_types/{@mastra_schema-compat@1.4.1-alpha.0 → @mastra_schema-compat@1.4.1}/dist/types.d.ts +0 -0
- /package/dist/_types/{@mastra_schema-compat@1.4.1-alpha.0 → @mastra_schema-compat@1.4.1}/dist/utils.d.ts +0 -0
- /package/dist/_types/{@mastra_schema-compat@1.4.1-alpha.0 → @mastra_schema-compat@1.4.1}/dist/zod-to-json.d.ts +0 -0
- /package/dist/_types/{@mastra_schema-compat@1.4.1-alpha.0 → @mastra_schema-compat@1.4.1}/package.json +0 -0
|
@@ -8656,7 +8656,7 @@ function splitLines(text) {
|
|
|
8656
8656
|
else result.push(result.pop().slice(0, -1));
|
|
8657
8657
|
return result;
|
|
8658
8658
|
}
|
|
8659
|
-
// ../memory/dist/src-
|
|
8659
|
+
// ../memory/dist/src-C6oJP8WI.js
|
|
8660
8660
|
var __defProp$3 = Object.defineProperty;
|
|
8661
8661
|
var __exportAll = (all, no_symbols) => {
|
|
8662
8662
|
let target = {};
|
|
@@ -33640,6 +33640,17 @@ function isTransientLLMError(error) {
|
|
|
33640
33640
|
return visit(error);
|
|
33641
33641
|
}
|
|
33642
33642
|
/**
|
|
33643
|
+
* Returns true when the error says the provider account has no credits or quota left, as core's
|
|
33644
|
+
* provider-error classifier decides it. These can carry a retryable status (OpenAI's are HTTP 429,
|
|
33645
|
+
* the status of a rate limit), so `withRetry` stops on them even though `isTransientLLMError`
|
|
33646
|
+
* matches: the account stays unusable until someone adds credits. Rate limits are still retried.
|
|
33647
|
+
*
|
|
33648
|
+
* @internal
|
|
33649
|
+
*/
|
|
33650
|
+
function isExhaustedAccountError(error) {
|
|
33651
|
+
return (0, _mastra_core_error.classifyProviderError)(error) === "quota";
|
|
33652
|
+
}
|
|
33653
|
+
/**
|
|
33643
33654
|
* Compute the backoff delay (ms) for the Nth retry (0-indexed).
|
|
33644
33655
|
*
|
|
33645
33656
|
* Exponential growth (`initialDelayMs * backoffFactor^attempt`) capped at
|
|
@@ -33723,7 +33734,8 @@ async function attemptWithIdleTimeout(fn, label, idleTimeoutMs, abortSignal) {
|
|
|
33723
33734
|
/**
|
|
33724
33735
|
* Run `fn` with retries on transient transport-class errors.
|
|
33725
33736
|
*
|
|
33726
|
-
* Non-transient errors (auth, validation, schema, etc.)
|
|
33737
|
+
* Non-transient errors (auth, validation, schema, etc.) and errors from an
|
|
33738
|
+
* account with no credits or quota left (see `isExhaustedAccountError`) are rethrown
|
|
33727
33739
|
* immediately. User-initiated aborts are rethrown without delay.
|
|
33728
33740
|
*
|
|
33729
33741
|
* @internal
|
|
@@ -33739,7 +33751,7 @@ async function withRetry(fn, opts) {
|
|
|
33739
33751
|
} catch (error) {
|
|
33740
33752
|
if (abortSignal?.aborted) throw error;
|
|
33741
33753
|
if (!(error instanceof OmModelCallTimeoutError) && hasAbortInChain(error)) throw error;
|
|
33742
|
-
if (attempt >= maxRetries || !isTransientLLMError(error)) {
|
|
33754
|
+
if (attempt >= maxRetries || !isTransientLLMError(error) || isExhaustedAccountError(error)) {
|
|
33743
33755
|
if (attempt > 0) omDebug(`[OM:retry:${label}] giving up after ${attempt} retry/retries: ${error instanceof Error ? error.message : String(error)}`);
|
|
33744
33756
|
throw error;
|
|
33745
33757
|
}
|
|
@@ -34485,7 +34497,7 @@ const OBSERVER_TOOL_ARGUMENT_MAX_DEPTH = 5;
|
|
|
34485
34497
|
const OBSERVER_TOOL_ARGUMENT_MAX_ENTRIES_PER_CONTAINER = 20;
|
|
34486
34498
|
const OBSERVER_TOOL_ARGUMENT_MAX_OUTLINE_ENTRIES = 100;
|
|
34487
34499
|
const OBSERVER_TOOL_ARGUMENT_MAX_PATH_CHARS = 160;
|
|
34488
|
-
function isObjectLike
|
|
34500
|
+
function isObjectLike(value) {
|
|
34489
34501
|
return typeof value === "object" && value !== null;
|
|
34490
34502
|
}
|
|
34491
34503
|
function sanitizeSurrogates(value) {
|
|
@@ -34671,7 +34683,7 @@ function formatToolArgumentsForObserver(value, options) {
|
|
|
34671
34683
|
maxCharacters: options?.maxCharacters ?? Number.POSITIVE_INFINITY
|
|
34672
34684
|
};
|
|
34673
34685
|
if (limits.maxTokens <= 0 || limits.maxCharacters <= 0) return "";
|
|
34674
|
-
if (!isObjectLike
|
|
34686
|
+
if (!isObjectLike(value)) {
|
|
34675
34687
|
if (typeof value !== "string" || value.length <= OBSERVER_TOOL_ARGUMENT_INLINE_STRING_MAX_CHARS) {
|
|
34676
34688
|
const primitive = formatPrimitive(value);
|
|
34677
34689
|
return fits(primitive, limits) ? primitive : fits("\u2026", limits) ? "\u2026" : "";
|
|
@@ -34750,7 +34762,7 @@ function formatToolArgumentsForObserver(value, options) {
|
|
|
34750
34762
|
});
|
|
34751
34763
|
continue;
|
|
34752
34764
|
}
|
|
34753
|
-
if (!isObjectLike
|
|
34765
|
+
if (!isObjectLike(entryValue)) {
|
|
34754
34766
|
outline.push({
|
|
34755
34767
|
text: `${path}: ${formatPrimitive(entryValue)}`,
|
|
34756
34768
|
depth: current.depth,
|
|
@@ -34831,28 +34843,22 @@ function formatToolArgumentsForObserver(value, options) {
|
|
|
34831
34843
|
}
|
|
34832
34844
|
const ENCRYPTED_CONTENT_KEY = "encryptedContent";
|
|
34833
34845
|
const ENCRYPTED_CONTENT_REDACTION_THRESHOLD = 256;
|
|
34834
|
-
|
|
34835
|
-
|
|
34836
|
-
|
|
34837
|
-
|
|
34838
|
-
|
|
34839
|
-
|
|
34840
|
-
|
|
34841
|
-
|
|
34842
|
-
seen.set(value, sanitizedArray);
|
|
34843
|
-
for (const item of value) sanitizedArray.push(sanitizeToolResultValue(item, seen));
|
|
34844
|
-
return sanitizedArray;
|
|
34845
|
-
}
|
|
34846
|
-
const sanitizedObject = {};
|
|
34847
|
-
seen.set(value, sanitizedObject);
|
|
34848
|
-
for (const [key, entry] of Object.entries(value)) {
|
|
34849
|
-
if (key === ENCRYPTED_CONTENT_KEY && typeof entry === "string" && entry.length > ENCRYPTED_CONTENT_REDACTION_THRESHOLD) {
|
|
34850
|
-
sanitizedObject[key] = `[stripped encryptedContent: ${entry.length} characters]`;
|
|
34851
|
-
continue;
|
|
34852
|
-
}
|
|
34853
|
-
sanitizedObject[key] = sanitizeToolResultValue(entry, seen);
|
|
34846
|
+
/** The string a boxed `String` serializes to; JSON.stringify unboxes it only after the replacer has run. */
|
|
34847
|
+
function unboxedString(value) {
|
|
34848
|
+
if (typeof value === "string") return value;
|
|
34849
|
+
if (typeof value !== "object" || value === null) return void 0;
|
|
34850
|
+
try {
|
|
34851
|
+
String.prototype.valueOf.call(value);
|
|
34852
|
+
} catch {
|
|
34853
|
+
return;
|
|
34854
34854
|
}
|
|
34855
|
-
return
|
|
34855
|
+
return String(value);
|
|
34856
|
+
}
|
|
34857
|
+
/** Redacts long `encryptedContent` strings: opaque provider data that would otherwise dominate the count. */
|
|
34858
|
+
function redactEncryptedContent(key, value) {
|
|
34859
|
+
if (key !== ENCRYPTED_CONTENT_KEY) return value;
|
|
34860
|
+
const text = unboxedString(value);
|
|
34861
|
+
return text !== void 0 && text.length > ENCRYPTED_CONTENT_REDACTION_THRESHOLD ? `[stripped encryptedContent: ${text.length} characters]` : value;
|
|
34856
34862
|
}
|
|
34857
34863
|
/**
|
|
34858
34864
|
* Serializes a tool result without truncating it.
|
|
@@ -34872,14 +34878,20 @@ function serializeToolResultForTokenCounting(value) {
|
|
|
34872
34878
|
function toolErrorTextToString(errorText) {
|
|
34873
34879
|
return errorText == null ? "" : stringifyToolResult(errorText);
|
|
34874
34880
|
}
|
|
34881
|
+
/**
|
|
34882
|
+
* Serializes with `JSON.stringify` itself, the serializer storage uses, so a count of this text describes what
|
|
34883
|
+
* storage holds and a reload reads back (`toJSON()`, boxed primitives, class instances, array indices).
|
|
34884
|
+
*/
|
|
34875
34885
|
function stringifyToolResult(value) {
|
|
34876
34886
|
if (typeof value === "string") return value;
|
|
34877
|
-
|
|
34887
|
+
let json;
|
|
34878
34888
|
try {
|
|
34879
|
-
|
|
34889
|
+
json = JSON.stringify(value, redactEncryptedContent, 2);
|
|
34880
34890
|
} catch {
|
|
34881
|
-
return String(
|
|
34891
|
+
return String(value);
|
|
34882
34892
|
}
|
|
34893
|
+
if (json === void 0) return "";
|
|
34894
|
+
return json.startsWith("\"") ? JSON.parse(json) : json;
|
|
34883
34895
|
}
|
|
34884
34896
|
function resolveToolResultValue(part, invocationResult) {
|
|
34885
34897
|
const mastraMetadata = part?.providerMetadata?.mastra;
|
|
@@ -34893,13 +34905,58 @@ function resolveToolResultValue(part, invocationResult) {
|
|
|
34893
34905
|
usingStoredModelOutput: false
|
|
34894
34906
|
};
|
|
34895
34907
|
}
|
|
34908
|
+
const PREFIX_CHUNK_MIN_LENGTH = 256;
|
|
34909
|
+
function isAsciiAlphanumeric(code) {
|
|
34910
|
+
return code >= 48 && code <= 57 || code >= 65 && code <= 90 || code >= 97 && code <= 122;
|
|
34911
|
+
}
|
|
34912
|
+
function isSplitWhitespace(code) {
|
|
34913
|
+
return code === 32 || code === 10 || code === 9 || code === 13;
|
|
34914
|
+
}
|
|
34915
|
+
/**
|
|
34916
|
+
* Returns a function that counts `estimateTokenCount(text.slice(0, end) + suffix)` without rescanning the
|
|
34917
|
+
* whole prefix on every call.
|
|
34918
|
+
*
|
|
34919
|
+
* tokenx splits text into segments on whitespace and punctuation runs and sums a per-segment estimate.
|
|
34920
|
+
* Letters and digits are never separators and whitespace always is, so the position between an ASCII
|
|
34921
|
+
* letter or digit and a following whitespace character is always a segment boundary: the count of any
|
|
34922
|
+
* string that shares the text up to such a position equals the count before it plus the count after it.
|
|
34923
|
+
* The text is cut at those boundaries once, and each call only rescans the chunk it ends in.
|
|
34924
|
+
*/
|
|
34925
|
+
function createPrefixTokenCounter(text) {
|
|
34926
|
+
const boundaries = [0];
|
|
34927
|
+
const tokensBefore = [0];
|
|
34928
|
+
let chunkStart = 0;
|
|
34929
|
+
let runningTokens = 0;
|
|
34930
|
+
for (let i = PREFIX_CHUNK_MIN_LENGTH; i < text.length; i++) if (i - chunkStart >= PREFIX_CHUNK_MIN_LENGTH && isSplitWhitespace(text.charCodeAt(i)) && isAsciiAlphanumeric(text.charCodeAt(i - 1))) {
|
|
34931
|
+
runningTokens += estimateTokenCount(text.slice(chunkStart, i));
|
|
34932
|
+
boundaries.push(i);
|
|
34933
|
+
tokensBefore.push(runningTokens);
|
|
34934
|
+
chunkStart = i;
|
|
34935
|
+
}
|
|
34936
|
+
return (end, suffix = "") => {
|
|
34937
|
+
let low = 0;
|
|
34938
|
+
let high = boundaries.length - 1;
|
|
34939
|
+
while (low < high) {
|
|
34940
|
+
const mid = low + high + 1 >> 1;
|
|
34941
|
+
if (boundaries[mid] <= end) low = mid;
|
|
34942
|
+
else high = mid - 1;
|
|
34943
|
+
}
|
|
34944
|
+
return tokensBefore[low] + estimateTokenCount(text.slice(boundaries[low], end) + suffix);
|
|
34945
|
+
};
|
|
34946
|
+
}
|
|
34896
34947
|
function truncateStringByTokens(text, maxTokens) {
|
|
34897
34948
|
if (!text || maxTokens <= 0) return "";
|
|
34898
|
-
const
|
|
34949
|
+
const countPrefixTokens = createPrefixTokenCounter(text);
|
|
34950
|
+
const totalTokens = countPrefixTokens(text.length);
|
|
34899
34951
|
if (totalTokens <= maxTokens) return text;
|
|
34900
34952
|
const buildCandidate = (sliceEnd) => {
|
|
34901
|
-
const
|
|
34902
|
-
|
|
34953
|
+
const visibleEnd = safeSlice(text, sliceEnd).length;
|
|
34954
|
+
const suffix = `\n... [truncated ~${totalTokens - countPrefixTokens(visibleEnd)} tokens]`;
|
|
34955
|
+
return {
|
|
34956
|
+
visibleEnd,
|
|
34957
|
+
suffix,
|
|
34958
|
+
tokens: countPrefixTokens(visibleEnd, suffix)
|
|
34959
|
+
};
|
|
34903
34960
|
};
|
|
34904
34961
|
let low = 0;
|
|
34905
34962
|
let high = text.length;
|
|
@@ -34907,12 +34964,12 @@ function truncateStringByTokens(text, maxTokens) {
|
|
|
34907
34964
|
while (low <= high) {
|
|
34908
34965
|
const mid = Math.floor((low + high) / 2);
|
|
34909
34966
|
const candidate = buildCandidate(mid);
|
|
34910
|
-
if (
|
|
34967
|
+
if (candidate.tokens <= maxTokens) {
|
|
34911
34968
|
best = candidate;
|
|
34912
34969
|
low = mid + 1;
|
|
34913
34970
|
} else high = mid - 1;
|
|
34914
34971
|
}
|
|
34915
|
-
return best;
|
|
34972
|
+
return text.slice(0, best.visibleEnd) + best.suffix;
|
|
34916
34973
|
}
|
|
34917
34974
|
function formatToolResultForObserver(value, options) {
|
|
34918
34975
|
return truncateStringByTokens(stringifyToolResult(value), options?.maxTokens ?? 5e3);
|
|
@@ -37128,9 +37185,24 @@ function mergeCacheEntry(cache, key, entry) {
|
|
|
37128
37185
|
function getPartCacheEntry(part, key) {
|
|
37129
37186
|
return getCacheEntry(getPartMastraMetadata(part)?.tokenEstimate, key);
|
|
37130
37187
|
}
|
|
37188
|
+
/**
|
|
37189
|
+
* Parts this process gave a new stored count. A part loaded from storage with its count is never in here,
|
|
37190
|
+
* so a message holding one of these parts has a count storage does not have yet.
|
|
37191
|
+
*/
|
|
37192
|
+
const partsWithUnsavedCount = /* @__PURE__ */ new WeakSet();
|
|
37193
|
+
/** Whether `part` gained a stored count in this process that has not been handed to a save yet. */
|
|
37194
|
+
function hasUnsavedTokenEstimate(part) {
|
|
37195
|
+
return typeof part === "object" && part !== null && partsWithUnsavedCount.has(part);
|
|
37196
|
+
}
|
|
37197
|
+
/** Note that `part`'s count is on its way to storage, so later steps do not save it again. */
|
|
37198
|
+
function markTokenEstimateSaved(part) {
|
|
37199
|
+
if (typeof part === "object" && part !== null) partsWithUnsavedCount.delete(part);
|
|
37200
|
+
}
|
|
37201
|
+
const partCountMemo = /* @__PURE__ */ new WeakMap();
|
|
37131
37202
|
function setPartCacheEntry(part, key, entry) {
|
|
37132
37203
|
const mastraMetadata = ensurePartMastraMetadata(part);
|
|
37133
37204
|
mastraMetadata.tokenEstimate = mergeCacheEntry(mastraMetadata.tokenEstimate, key, entry);
|
|
37205
|
+
partsWithUnsavedCount.add(part);
|
|
37134
37206
|
}
|
|
37135
37207
|
/**
|
|
37136
37208
|
* Extracts a caller-supplied token estimate stamped on a part via
|
|
@@ -37289,7 +37361,7 @@ async function resolveImageDimensionsAsync(part) {
|
|
|
37289
37361
|
const url = resolveHttpAssetUrl(getObjectValue(part, "image") ?? getObjectValue(part, "data"));
|
|
37290
37362
|
if (!url) return existing;
|
|
37291
37363
|
try {
|
|
37292
|
-
const probeImageSize = (await Promise.resolve().then(() => /* @__PURE__ */ require_rolldown_runtime.__toESM(require("./probe-image-size-
|
|
37364
|
+
const probeImageSize = (await Promise.resolve().then(() => /* @__PURE__ */ require_rolldown_runtime.__toESM(require("./probe-image-size-ntJyQKKB.cjs").default, 1))).default;
|
|
37293
37365
|
const probed = await probeImageSize(url, {
|
|
37294
37366
|
open_timeout: REMOTE_IMAGE_PROBE_TIMEOUT_MS,
|
|
37295
37367
|
response_timeout: REMOTE_IMAGE_PROBE_TIMEOUT_MS,
|
|
@@ -37824,14 +37896,19 @@ async function fetchGoogleAttachmentTokenEstimate(modelId, part) {
|
|
|
37824
37896
|
* undercounted as generic JSON blobs.
|
|
37825
37897
|
*/
|
|
37826
37898
|
var TokenCounter = class TokenCounter {
|
|
37827
|
-
|
|
37899
|
+
/**
|
|
37900
|
+
* Stored counts belong to the stock estimator. A subclass or instance that overrides `countString`
|
|
37901
|
+
* reads and writes its own namespace, so it never reuses a count the stock estimator saved.
|
|
37902
|
+
*/
|
|
37903
|
+
get cacheSource() {
|
|
37904
|
+
return this.countString === TokenCounter.prototype.countString ? `v${TOKEN_ESTIMATE_CACHE_VERSION}:${resolveEstimatorId()}` : `v${TOKEN_ESTIMATE_CACHE_VERSION}:custom`;
|
|
37905
|
+
}
|
|
37828
37906
|
defaultModelContext;
|
|
37829
37907
|
inFlightAttachmentCounts = /* @__PURE__ */ new Map();
|
|
37830
37908
|
multimodalToolResultCounts = /* @__PURE__ */ new WeakMap();
|
|
37831
37909
|
static TOKENS_PER_MESSAGE = 3.8;
|
|
37832
37910
|
static TOKENS_PER_CONVERSATION = 24;
|
|
37833
37911
|
constructor(options) {
|
|
37834
|
-
this.cacheSource = `v${TOKEN_ESTIMATE_CACHE_VERSION}:${resolveEstimatorId()}`;
|
|
37835
37912
|
this.defaultModelContext = parseModelContext(options?.model);
|
|
37836
37913
|
}
|
|
37837
37914
|
runWithModelContext(model, fn) {
|
|
@@ -37862,6 +37939,28 @@ var TokenCounter = class TokenCounter {
|
|
|
37862
37939
|
});
|
|
37863
37940
|
return tokens;
|
|
37864
37941
|
}
|
|
37942
|
+
/**
|
|
37943
|
+
* Count one content-only piece of a part (its text, a tool's args or result) the same way as
|
|
37944
|
+
* {@link readOrPersistPartEstimate}: a stored count is reused only when its content hash matches.
|
|
37945
|
+
* `refs` are the values the payload is built from. While the same part object still holds the same
|
|
37946
|
+
* refs, the count from the last call is returned without serializing or hashing again, so a part
|
|
37947
|
+
* counted by `getStatus` and then by the next step is hashed once per process.
|
|
37948
|
+
* Only string refs are memoized (object payloads are hashed every time, since they can change in place).
|
|
37949
|
+
*/
|
|
37950
|
+
readOrPersistMemoizedPartEstimate(part, kind, refs, getPayload) {
|
|
37951
|
+
if (!refs.every((ref) => typeof ref === "string")) return this.readOrPersistPartEstimate(part, kind, getPayload());
|
|
37952
|
+
let byKind = partCountMemo.get(part);
|
|
37953
|
+
const memo = byKind?.get(kind);
|
|
37954
|
+
if (memo && memo.owner === this && memo.refs.length === refs.length && memo.refs.every((ref, i) => ref === refs[i])) return memo.tokens;
|
|
37955
|
+
const tokens = this.readOrPersistPartEstimate(part, kind, getPayload());
|
|
37956
|
+
if (!byKind) partCountMemo.set(part, byKind = /* @__PURE__ */ new Map());
|
|
37957
|
+
byKind.set(kind, {
|
|
37958
|
+
owner: this,
|
|
37959
|
+
refs,
|
|
37960
|
+
tokens
|
|
37961
|
+
});
|
|
37962
|
+
return tokens;
|
|
37963
|
+
}
|
|
37865
37964
|
readOrPersistFixedPartEstimate(part, kind, payload, tokens) {
|
|
37866
37965
|
const key = buildEstimateKey(kind, payload);
|
|
37867
37966
|
const cached = getPartCacheEntry(part, key);
|
|
@@ -38212,18 +38311,23 @@ var TokenCounter = class TokenCounter {
|
|
|
38212
38311
|
/**
|
|
38213
38312
|
* Count the name and the arguments of a tool call. Every state before the tool produces an
|
|
38214
38313
|
* output holds the same call signature in the context window, so all of those states share
|
|
38215
|
-
* these cache kinds
|
|
38216
|
-
*
|
|
38314
|
+
* these cache kinds, and the estimate stays warm while the invocation moves from one state to
|
|
38315
|
+
* the next. Name and args don't change across those states once the call stops streaming.
|
|
38217
38316
|
*/
|
|
38218
38317
|
countToolCallSignature(part, invocation) {
|
|
38219
38318
|
let tokens = 0;
|
|
38220
38319
|
let overheadDelta = 0;
|
|
38221
|
-
|
|
38320
|
+
const storable = invocation.state !== "partial-call";
|
|
38321
|
+
const count = (kind, ref, getPayload) => storable ? this.readOrPersistMemoizedPartEstimate(part, kind, [ref], getPayload) : this.readOrPersistPartEstimate(part, kind, getPayload());
|
|
38322
|
+
if (invocation.toolName) {
|
|
38323
|
+
const toolName = invocation.toolName;
|
|
38324
|
+
tokens += count("tool-call-name", toolName, () => toolName);
|
|
38325
|
+
}
|
|
38222
38326
|
if (invocation.args !== void 0) {
|
|
38223
|
-
|
|
38327
|
+
const args = invocation.args;
|
|
38328
|
+
if (typeof args === "string") tokens += count("tool-call-args", args, () => args);
|
|
38224
38329
|
else {
|
|
38225
|
-
|
|
38226
|
-
tokens += this.readOrPersistPartEstimate(part, "tool-call-args-json", argsJson);
|
|
38330
|
+
tokens += count("tool-call-args-json", args, () => JSON.stringify(args));
|
|
38227
38331
|
overheadDelta -= 12;
|
|
38228
38332
|
}
|
|
38229
38333
|
}
|
|
@@ -38235,11 +38339,14 @@ var TokenCounter = class TokenCounter {
|
|
|
38235
38339
|
countNonAttachmentPart(part) {
|
|
38236
38340
|
let overheadDelta = 0;
|
|
38237
38341
|
let extraMessageDelta = 0;
|
|
38238
|
-
if (part.type === "text")
|
|
38239
|
-
|
|
38240
|
-
|
|
38241
|
-
|
|
38242
|
-
|
|
38342
|
+
if (part.type === "text") {
|
|
38343
|
+
const text = part.text;
|
|
38344
|
+
return {
|
|
38345
|
+
tokens: this.readOrPersistMemoizedPartEstimate(part, "text", [text], () => text),
|
|
38346
|
+
overheadDelta,
|
|
38347
|
+
extraMessageDelta
|
|
38348
|
+
};
|
|
38349
|
+
}
|
|
38243
38350
|
if (part.type === "tool-invocation") {
|
|
38244
38351
|
const invocation = part.toolInvocation;
|
|
38245
38352
|
const state = invocation.state;
|
|
@@ -38258,7 +38365,7 @@ var TokenCounter = class TokenCounter {
|
|
|
38258
38365
|
tokens += signature.tokens;
|
|
38259
38366
|
overheadDelta += signature.overheadDelta;
|
|
38260
38367
|
const reason = invocation.approval?.reason;
|
|
38261
|
-
if (reason) tokens += this.
|
|
38368
|
+
if (reason) tokens += this.readOrPersistMemoizedPartEstimate(part, "tool-approval-reason", [reason], () => reason);
|
|
38262
38369
|
return {
|
|
38263
38370
|
tokens,
|
|
38264
38371
|
overheadDelta,
|
|
@@ -38274,15 +38381,12 @@ var TokenCounter = class TokenCounter {
|
|
|
38274
38381
|
if (resultForCounting !== void 0 && (typeof resultForCounting !== "string" || resultForCounting.trim().length > 0)) {
|
|
38275
38382
|
const contentTokens = this.countMultimodalToolResultContent(part, resultForCounting);
|
|
38276
38383
|
if (contentTokens !== void 0) tokens += contentTokens;
|
|
38277
|
-
else
|
|
38278
|
-
const formattedResult = serializeToolResultForTokenCounting(resultForCounting);
|
|
38279
|
-
tokens += this.readOrPersistPartEstimate(part, usingStoredModelOutput ? "tool-result-model-output-json" : "tool-result-json", formattedResult);
|
|
38280
|
-
}
|
|
38384
|
+
else tokens += this.readOrPersistMemoizedPartEstimate(part, usingStoredModelOutput ? "tool-result-model-output-json" : "tool-result-json", [resultForCounting], () => serializeToolResultForTokenCounting(resultForCounting));
|
|
38281
38385
|
if (typeof resultForCounting !== "string") overheadDelta -= 12;
|
|
38282
38386
|
} else {
|
|
38283
38387
|
const errorText = toolErrorTextToString(invocation.errorText);
|
|
38284
38388
|
const fallback = invocation.isError ? errorText.trim() ? errorText : "Tool execution failed" : "[empty result]";
|
|
38285
|
-
tokens += this.
|
|
38389
|
+
tokens += this.readOrPersistMemoizedPartEstimate(part, invocation.isError ? "tool-result-error" : "tool-result-json", [fallback], () => fallback);
|
|
38286
38390
|
}
|
|
38287
38391
|
return {
|
|
38288
38392
|
tokens,
|
|
@@ -38296,7 +38400,7 @@ var TokenCounter = class TokenCounter {
|
|
|
38296
38400
|
tokens += signature.tokens;
|
|
38297
38401
|
overheadDelta += signature.overheadDelta;
|
|
38298
38402
|
const reason = invocation.approval?.reason?.trim() ? invocation.approval.reason : "Tool call was not approved by the user";
|
|
38299
|
-
tokens += this.
|
|
38403
|
+
tokens += this.readOrPersistMemoizedPartEstimate(part, "tool-result-denied", [reason], () => reason);
|
|
38300
38404
|
return {
|
|
38301
38405
|
tokens,
|
|
38302
38406
|
overheadDelta,
|
|
@@ -38310,7 +38414,7 @@ var TokenCounter = class TokenCounter {
|
|
|
38310
38414
|
overheadDelta += signature.overheadDelta;
|
|
38311
38415
|
const errorText = toolErrorTextToString(invocation.errorText);
|
|
38312
38416
|
const errorMessage = errorText.trim() ? errorText : "Tool execution failed";
|
|
38313
|
-
tokens += this.
|
|
38417
|
+
tokens += this.readOrPersistMemoizedPartEstimate(part, "tool-result-error", [errorMessage], () => errorMessage);
|
|
38314
38418
|
return {
|
|
38315
38419
|
tokens,
|
|
38316
38420
|
overheadDelta,
|
|
@@ -38323,6 +38427,11 @@ var TokenCounter = class TokenCounter {
|
|
|
38323
38427
|
overheadDelta,
|
|
38324
38428
|
extraMessageDelta
|
|
38325
38429
|
};
|
|
38430
|
+
if (part.type === "step-start") return {
|
|
38431
|
+
tokens: 0,
|
|
38432
|
+
overheadDelta,
|
|
38433
|
+
extraMessageDelta
|
|
38434
|
+
};
|
|
38326
38435
|
if (part.type === "reasoning") return {
|
|
38327
38436
|
tokens: 0,
|
|
38328
38437
|
overheadDelta,
|
|
@@ -41700,6 +41809,7 @@ const threadTitleInstructions = `A short, noun-phrase title for this conversatio
|
|
|
41700
41809
|
- "Auth bug fix" \u2014 not "Fixing the auth bug"
|
|
41701
41810
|
- "Dark mode toggle" \u2014 not "User wants dark mode toggle added"
|
|
41702
41811
|
- "Deployment pipeline setup" \u2014 not "Setting up deployment pipeline for project"
|
|
41812
|
+
Write the title in the same language the user's messages are written in.
|
|
41703
41813
|
Only update when the topic meaningfully changes.`;
|
|
41704
41814
|
function createCurrentTaskExtractor() {
|
|
41705
41815
|
return new Extractor({
|
|
@@ -43651,13 +43761,54 @@ ObservationStrategy.create = ((om, opts) => {
|
|
|
43651
43761
|
if (deps.scope === "resource" && opts.resourceId) return new ResourceScopedObservationStrategy(deps, opts);
|
|
43652
43762
|
return new SyncObservationStrategy(deps, opts);
|
|
43653
43763
|
});
|
|
43764
|
+
/**
|
|
43765
|
+
* Mark the stored history of `threadId` in `messageList` that OM gave new token counts, so the counts are saved
|
|
43766
|
+
* with the messages. Call the returned function once the counting is done: every message holding a part that
|
|
43767
|
+
* gained a count in this process is marked for resave, and the normal save writes it back whole. Counts made
|
|
43768
|
+
* before this is called (while the turn loaded history) are caught too.
|
|
43769
|
+
*
|
|
43770
|
+
* Only messages of `threadId` are marked. A message recalled from another thread of the resource is counted but
|
|
43771
|
+
* never written, because saving it would bump that thread's `updatedAt` and reorder the recent-thread list.
|
|
43772
|
+
*
|
|
43773
|
+
* A Core without `markForResave` is left alone: counting still works, the counts are just not saved.
|
|
43774
|
+
*/
|
|
43775
|
+
function resaveCountedMessagesFor(messageList, threadId) {
|
|
43776
|
+
if (typeof messageList.markForResave !== "function") return () => {};
|
|
43777
|
+
return () => {
|
|
43778
|
+
for (const message of messageList.get.remembered.db()) {
|
|
43779
|
+
if (message.threadId !== threadId) continue;
|
|
43780
|
+
const parts = message.content?.parts ?? [];
|
|
43781
|
+
if (!parts.some(hasUnsavedTokenEstimate)) continue;
|
|
43782
|
+
messageList.markForResave(message);
|
|
43783
|
+
parts.forEach(markTokenEstimateSaved);
|
|
43784
|
+
}
|
|
43785
|
+
};
|
|
43786
|
+
}
|
|
43787
|
+
/** The stored messages marked for resave in `messageList`; none for a Core without `markForResave`. */
|
|
43788
|
+
function messagesMarkedForResave(messageList) {
|
|
43789
|
+
return typeof messageList.getMessagesToResave === "function" ? messageList.getMessagesToResave() : [];
|
|
43790
|
+
}
|
|
43791
|
+
/**
|
|
43792
|
+
* Ids of the stored messages marked for resave in `messageList` that are not in `ownMessages` (the turn's
|
|
43793
|
+
* own input and output). Those are saved whole; the rest only gained counts and are patched onto storage.
|
|
43794
|
+
*/
|
|
43795
|
+
function idsMarkedForResave(messageList, ownMessages = []) {
|
|
43796
|
+
const own = new Set(ownMessages.map((message) => message.id));
|
|
43797
|
+
return new Set(messagesMarkedForResave(messageList).map((message) => message.id).filter((id) => !own.has(id)));
|
|
43798
|
+
}
|
|
43799
|
+
/** `messages` with the messages marked for resave added, each message once. */
|
|
43800
|
+
function withMessagesMarkedForResave(messageList, messages) {
|
|
43801
|
+
const ids = new Set(messages.map((message) => message.id));
|
|
43802
|
+
return [...messages, ...messagesMarkedForResave(messageList).filter((message) => !ids.has(message.id))];
|
|
43803
|
+
}
|
|
43654
43804
|
async function loadMemoryContextMessages({ memory, messageList, threadId, resourceId, runState }) {
|
|
43655
43805
|
const ctx = await memory.getContext({
|
|
43656
43806
|
threadId,
|
|
43657
43807
|
resourceId,
|
|
43658
43808
|
runState
|
|
43659
43809
|
});
|
|
43660
|
-
|
|
43810
|
+
const messages = ctx.messages.filter((msg) => msg.role !== "system");
|
|
43811
|
+
if (messages.length) messageList.add(messages, "memory");
|
|
43661
43812
|
return ctx;
|
|
43662
43813
|
}
|
|
43663
43814
|
function hasPendingToolCall(message) {
|
|
@@ -43862,7 +44013,7 @@ var ObservationStep = class {
|
|
|
43862
44013
|
const inputIds = new Set(messageList.get.input.db().map((msg) => msg.id));
|
|
43863
44014
|
const sealedOutput = safeCandidates.filter((msg) => !inputIds.has(msg.id));
|
|
43864
44015
|
messageList.removeByIds(sealedOutput.map((msg) => msg.id));
|
|
43865
|
-
|
|
44016
|
+
if (sealedOutput.length) messageList.add(sealedOutput, "memory");
|
|
43866
44017
|
}
|
|
43867
44018
|
if (!deferred) {
|
|
43868
44019
|
om.trackBackgroundWork(om.buffer({
|
|
@@ -43911,7 +44062,7 @@ var ObservationStep = class {
|
|
|
43911
44062
|
}).map((msg) => msg.id);
|
|
43912
44063
|
inFlightIds = [...new Set(unreadIds)];
|
|
43913
44064
|
if (messagesToSave.length > 0) {
|
|
43914
|
-
|
|
44065
|
+
messageList.add(messagesToSave, "memory");
|
|
43915
44066
|
try {
|
|
43916
44067
|
await om.persistMessages(messagesToSave, threadId, resourceId);
|
|
43917
44068
|
} catch (error) {
|
|
@@ -44413,8 +44564,8 @@ var ObservationTurn = class {
|
|
|
44413
44564
|
this._ended = true;
|
|
44414
44565
|
const unsavedInput = messageList.get.input.db();
|
|
44415
44566
|
const unsavedOutput = messageList.get.response.db();
|
|
44416
|
-
const unsavedMessages = [...unsavedInput, ...unsavedOutput];
|
|
44417
|
-
if (unsavedMessages.length > 0) await this.om.persistMessages(unsavedMessages, this.threadId, this.resourceId);
|
|
44567
|
+
const unsavedMessages = withMessagesMarkedForResave(messageList, [...unsavedInput, ...unsavedOutput]);
|
|
44568
|
+
if (unsavedMessages.length > 0) await this.om.persistMessages(unsavedMessages, this.threadId, this.resourceId, idsMarkedForResave(messageList, [...unsavedInput, ...unsavedOutput]));
|
|
44418
44569
|
const asyncObservationEnabled = this.om.buffering.isAsyncObservationEnabled();
|
|
44419
44570
|
const bufferOnIdle = this.om.getObservationConfig().bufferOnIdle;
|
|
44420
44571
|
if (!this.abortSignal?.aborted && asyncObservationEnabled && bufferOnIdle) {
|
|
@@ -47318,18 +47469,86 @@ var ObservationalMemory = class ObservationalMemory {
|
|
|
47318
47469
|
* to detect already-persisted messages, avoiding redundant DB operations.
|
|
47319
47470
|
*
|
|
47320
47471
|
* Messages with observation markers are always saved (upserted) even if sealed,
|
|
47321
|
-
* because the markers need to be persisted to storage.
|
|
47472
|
+
* because the markers need to be persisted to storage. A stored message in `resaveIds` gained token
|
|
47473
|
+
* counts after it was stored, whether or not it is sealed: only those counts are copied onto the stored
|
|
47474
|
+
* copy, see {@link persistTokenEstimatesOntoStored}; one with no stored row was deleted during the turn and stays deleted. Ids in `resaveIds` must not be this turn's own
|
|
47475
|
+
* input or output, which are saved whole.
|
|
47322
47476
|
*/
|
|
47323
|
-
async persistMessages(messagesToSave, threadId, resourceId) {
|
|
47477
|
+
async persistMessages(messagesToSave, threadId, resourceId, resaveIds) {
|
|
47324
47478
|
const filteredMessages = [];
|
|
47325
|
-
|
|
47326
|
-
|
|
47327
|
-
|
|
47479
|
+
const storedWithNewCounts = [];
|
|
47480
|
+
for (const msg of messagesToSave) {
|
|
47481
|
+
if (!!(msg.content?.metadata)?.mastra?.sealed && findLastCompletedObservationBoundary(msg) === -1 && !resaveIds?.has(msg.id)) continue;
|
|
47482
|
+
if (resaveIds?.has(msg.id) && findLastCompletedObservationBoundary(msg) === -1) storedWithNewCounts.push(msg);
|
|
47483
|
+
else filteredMessages.push(msg);
|
|
47484
|
+
}
|
|
47328
47485
|
if (filteredMessages.length > 0) await this.messageHistory.persistMessages({
|
|
47329
47486
|
messages: filteredMessages,
|
|
47330
47487
|
threadId,
|
|
47331
47488
|
resourceId
|
|
47332
47489
|
});
|
|
47490
|
+
try {
|
|
47491
|
+
await this.persistTokenEstimatesOntoStored(storedWithNewCounts);
|
|
47492
|
+
} catch (error) {
|
|
47493
|
+
omError("[OM] Failed to save token counts for stored messages", error);
|
|
47494
|
+
}
|
|
47495
|
+
}
|
|
47496
|
+
/**
|
|
47497
|
+
* Copy the token counts of `messages` onto their stored copies. A stored copy can hold
|
|
47498
|
+
* parts the in-memory one lacks (markers written straight to storage), so it is patched
|
|
47499
|
+
* instead of saved whole. Each count goes to the first stored part whose content matches the counted
|
|
47500
|
+
* part, so a part that changed in storage keeps no count and is counted again on read.
|
|
47501
|
+
*/
|
|
47502
|
+
async persistTokenEstimatesOntoStored(messages) {
|
|
47503
|
+
if (messages.length === 0) return;
|
|
47504
|
+
const contentOf = (part) => {
|
|
47505
|
+
const { tokenEstimate: _tokenEstimate, ...mastra } = part.providerMetadata?.mastra ?? {};
|
|
47506
|
+
return JSON.stringify({
|
|
47507
|
+
...part,
|
|
47508
|
+
providerMetadata: {
|
|
47509
|
+
...part.providerMetadata,
|
|
47510
|
+
mastra
|
|
47511
|
+
}
|
|
47512
|
+
});
|
|
47513
|
+
};
|
|
47514
|
+
const live = new Map(messages.map((message) => [message.id, message]));
|
|
47515
|
+
const { messages: stored } = await this.storage.listMessagesById({ messageIds: [...live.keys()] });
|
|
47516
|
+
const updates = [];
|
|
47517
|
+
for (const row of stored) {
|
|
47518
|
+
const counts = /* @__PURE__ */ new Map();
|
|
47519
|
+
for (const part of live.get(row.id)?.content.parts ?? []) {
|
|
47520
|
+
const tokenEstimate = part.providerMetadata?.mastra?.tokenEstimate;
|
|
47521
|
+
if (!tokenEstimate) continue;
|
|
47522
|
+
const key = contentOf(part);
|
|
47523
|
+
counts.set(key, [...counts.get(key) ?? [], tokenEstimate]);
|
|
47524
|
+
}
|
|
47525
|
+
if (counts.size === 0) continue;
|
|
47526
|
+
let changed = false;
|
|
47527
|
+
const parts = row.content.parts.map((part) => {
|
|
47528
|
+
const tokenEstimate = counts.get(contentOf(part))?.shift();
|
|
47529
|
+
if (!tokenEstimate) return part;
|
|
47530
|
+
changed = true;
|
|
47531
|
+
const providerMetadata = part.providerMetadata ?? {};
|
|
47532
|
+
return {
|
|
47533
|
+
...part,
|
|
47534
|
+
providerMetadata: {
|
|
47535
|
+
...providerMetadata,
|
|
47536
|
+
mastra: {
|
|
47537
|
+
...providerMetadata.mastra,
|
|
47538
|
+
tokenEstimate
|
|
47539
|
+
}
|
|
47540
|
+
}
|
|
47541
|
+
};
|
|
47542
|
+
});
|
|
47543
|
+
if (changed) updates.push({
|
|
47544
|
+
id: row.id,
|
|
47545
|
+
content: {
|
|
47546
|
+
...row.content,
|
|
47547
|
+
parts
|
|
47548
|
+
}
|
|
47549
|
+
});
|
|
47550
|
+
}
|
|
47551
|
+
if (updates.length > 0) await this.storage.updateMessages({ messages: updates });
|
|
47333
47552
|
}
|
|
47334
47553
|
/**
|
|
47335
47554
|
* Load messages from storage that haven't been observed yet.
|
|
@@ -49130,11 +49349,12 @@ var ObservationalMemoryProcessor = class {
|
|
|
49130
49349
|
state.__omTurn = void 0;
|
|
49131
49350
|
if (!activeTurn || activeTurn.ended) return;
|
|
49132
49351
|
const terminalList = messageList ?? activeTurn.messageList;
|
|
49133
|
-
const
|
|
49352
|
+
const ownMessages = [...terminalList.get.input.db(), ...terminalList.get.response.db()];
|
|
49353
|
+
const unsavedMessages = withMessagesMarkedForResave(terminalList, ownMessages);
|
|
49134
49354
|
try {
|
|
49135
49355
|
await activeTurn.end(terminalList);
|
|
49136
49356
|
} catch (error) {
|
|
49137
|
-
if (unsavedMessages.length > 0) await this.engine.persistMessages(unsavedMessages, activeTurn.threadId, activeTurn.resourceId).catch(() => {});
|
|
49357
|
+
if (unsavedMessages.length > 0) await this.engine.persistMessages(unsavedMessages, activeTurn.threadId, activeTurn.resourceId, idsMarkedForResave(terminalList, ownMessages)).catch(() => {});
|
|
49138
49358
|
throw error;
|
|
49139
49359
|
}
|
|
49140
49360
|
}
|
|
@@ -49276,6 +49496,7 @@ var ObservationalMemoryProcessor = class {
|
|
|
49276
49496
|
this.turn.responseMessageId = responseMessageId;
|
|
49277
49497
|
{
|
|
49278
49498
|
const step = this.turn.step(stepNumber);
|
|
49499
|
+
const resaveCounted = resaveCountedMessagesFor(messageList, threadId);
|
|
49279
49500
|
let ctx;
|
|
49280
49501
|
try {
|
|
49281
49502
|
ctx = await step.prepare();
|
|
@@ -49310,6 +49531,7 @@ var ObservationalMemoryProcessor = class {
|
|
|
49310
49531
|
threadId,
|
|
49311
49532
|
resourceId
|
|
49312
49533
|
});
|
|
49534
|
+
resaveCounted();
|
|
49313
49535
|
const finalTotalPending = ctx.status.pendingTokens;
|
|
49314
49536
|
try {
|
|
49315
49537
|
await runOMCommit(this.engine.buffering.getLockKey(threadId, resourceId), () => this.engine.getStorage().setPendingMessageTokens(turnRecord.id, finalTotalPending), { abortSignal });
|
|
@@ -49349,6 +49571,7 @@ var ObservationalMemoryProcessor = class {
|
|
|
49349
49571
|
return this.engine.getTokenCounter().runWithModelContext(state.__omActorModelContext, async () => {
|
|
49350
49572
|
if ((0, _mastra_core_memory.parseMemoryRequestContext)(requestContext)?.memoryConfig?.readOnly) return messageList;
|
|
49351
49573
|
const persistenceMessageList = messageList.cloneForPersistence();
|
|
49574
|
+
this.engine.getTokenCounter().countMessages(persistenceMessageList.get.response.db());
|
|
49352
49575
|
const turn = asLiveTurn(state.__omTurn) ?? this.turn;
|
|
49353
49576
|
const liveTurn = turn && !turn.ended ? turn : void 0;
|
|
49354
49577
|
if (liveTurn) await liveTurn.end(persistenceMessageList);
|
|
@@ -49356,8 +49579,9 @@ var ObservationalMemoryProcessor = class {
|
|
|
49356
49579
|
state.__omTurn = void 0;
|
|
49357
49580
|
if (!liveTurn) {
|
|
49358
49581
|
const newOutput = persistenceMessageList.get.response.db();
|
|
49359
|
-
const
|
|
49360
|
-
|
|
49582
|
+
const ownMessages = [...persistenceMessageList.get.input.db(), ...newOutput];
|
|
49583
|
+
const messagesToSave = withMessagesMarkedForResave(persistenceMessageList, ownMessages);
|
|
49584
|
+
if (messagesToSave.length > 0 && context.threadId) await this.engine.persistMessages(messagesToSave, context.threadId, context.resourceId, idsMarkedForResave(persistenceMessageList, ownMessages));
|
|
49361
49585
|
}
|
|
49362
49586
|
return messageList;
|
|
49363
49587
|
});
|
|
@@ -53072,7 +53296,7 @@ const createModelInstance = async (provider, modelId, version = "v2") => {
|
|
|
53072
53296
|
try {
|
|
53073
53297
|
const providerFn = version === `v1` ? { v1: {
|
|
53074
53298
|
openai: async () => {
|
|
53075
|
-
const { openai } = await Promise.resolve().then(() => require("./dist-
|
|
53299
|
+
const { openai } = await Promise.resolve().then(() => require("./dist-C5_WGwU1.cjs"));
|
|
53076
53300
|
return openai(modelId);
|
|
53077
53301
|
},
|
|
53078
53302
|
anthropic: async () => {
|