@mastra/core 0.13.2 → 0.14.0-alpha.1
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/README.md +5 -44
- package/dist/agent/agent.types.d.ts +12 -2
- package/dist/agent/agent.types.d.ts.map +1 -1
- package/dist/agent/index.cjs +14 -14
- package/dist/agent/index.d.ts +17 -17
- package/dist/agent/index.d.ts.map +1 -1
- package/dist/agent/index.js +2 -2
- package/dist/agent/input-processor/index.cjs +28 -0
- package/dist/agent/input-processor/index.js +3 -0
- package/dist/agent/input-processor/processors/index.d.ts +4 -4
- package/dist/agent/input-processor/processors/index.d.ts.map +1 -1
- package/dist/agent/input-processor/processors/language-detector.d.ts +6 -139
- package/dist/agent/input-processor/processors/language-detector.d.ts.map +1 -1
- package/dist/agent/input-processor/processors/moderation.d.ts +5 -94
- package/dist/agent/input-processor/processors/moderation.d.ts.map +1 -1
- package/dist/agent/input-processor/processors/pii-detector.d.ts +6 -164
- package/dist/agent/input-processor/processors/pii-detector.d.ts.map +1 -1
- package/dist/agent/input-processor/processors/prompt-injection-detector.d.ts +6 -96
- package/dist/agent/input-processor/processors/prompt-injection-detector.d.ts.map +1 -1
- package/dist/agent/input-processor/processors/unicode-normalizer.d.ts +9 -25
- package/dist/agent/input-processor/processors/unicode-normalizer.d.ts.map +1 -1
- package/dist/agent/message-list/index.d.ts +138 -39
- package/dist/agent/message-list/index.d.ts.map +1 -1
- package/dist/agent/message-list/types.d.ts +3 -0
- package/dist/agent/message-list/types.d.ts.map +1 -0
- package/dist/agent/message-list/utils/ai-v4-v5/core-model-message.d.ts +3 -0
- package/dist/agent/message-list/utils/ai-v4-v5/core-model-message.d.ts.map +1 -0
- package/dist/agent/message-list/utils/ai-v4-v5/ui-message.d.ts +3 -0
- package/dist/agent/message-list/utils/ai-v4-v5/ui-message.d.ts.map +1 -0
- package/dist/agent/message-list/utils/ai-v5/tool.d.ts +16 -0
- package/dist/agent/message-list/utils/ai-v5/tool.d.ts.map +1 -0
- package/dist/agent/types.d.ts +34 -4
- package/dist/agent/types.d.ts.map +1 -1
- package/dist/ai-tracing/base.d.ts +22 -7
- package/dist/ai-tracing/base.d.ts.map +1 -1
- package/dist/ai-tracing/default.d.ts +3 -3
- package/dist/ai-tracing/default.d.ts.map +1 -1
- package/dist/ai-tracing/index.cjs +253 -72
- package/dist/ai-tracing/index.cjs.map +1 -1
- package/dist/ai-tracing/index.d.ts +1 -0
- package/dist/ai-tracing/index.d.ts.map +1 -1
- package/dist/ai-tracing/index.js +243 -71
- package/dist/ai-tracing/index.js.map +1 -1
- package/dist/ai-tracing/no-op.d.ts +39 -7
- package/dist/ai-tracing/no-op.d.ts.map +1 -1
- package/dist/ai-tracing/registry.d.ts +29 -4
- package/dist/ai-tracing/registry.d.ts.map +1 -1
- package/dist/ai-tracing/types.d.ts +112 -53
- package/dist/ai-tracing/types.d.ts.map +1 -1
- package/dist/ai-tracing/utils.d.ts +24 -0
- package/dist/ai-tracing/utils.d.ts.map +1 -0
- package/dist/base.cjs +2 -2
- package/dist/base.js +1 -1
- package/dist/bundler/index.cjs +2 -2
- package/dist/bundler/index.js +1 -1
- package/dist/{chunk-N3VGOJZV.cjs → chunk-4BMFOQDC.cjs} +27 -47
- package/dist/chunk-4BMFOQDC.cjs.map +1 -0
- package/dist/{chunk-MTRRRTB4.js → chunk-4XDSHUFK.js} +7 -6
- package/dist/chunk-4XDSHUFK.js.map +1 -0
- package/dist/{chunk-SSJVFUBZ.js → chunk-67L5DRLO.js} +3 -3
- package/dist/{chunk-SSJVFUBZ.js.map → chunk-67L5DRLO.js.map} +1 -1
- package/dist/{chunk-FUERFM46.js → chunk-6GF5M4GX.js} +3 -3
- package/dist/{chunk-FUERFM46.js.map → chunk-6GF5M4GX.js.map} +1 -1
- package/dist/{chunk-7E2SNI5D.cjs → chunk-7AXX55C5.cjs} +5 -5
- package/dist/chunk-7AXX55C5.cjs.map +1 -0
- package/dist/{chunk-6W6LYR7M.js → chunk-7XGDFDZ2.js} +3 -3
- package/dist/{chunk-6W6LYR7M.js.map → chunk-7XGDFDZ2.js.map} +1 -1
- package/dist/{chunk-R4HT5XUH.cjs → chunk-ASJVWHIK.cjs} +993 -124
- package/dist/chunk-ASJVWHIK.cjs.map +1 -0
- package/dist/{chunk-ZDZ57MIU.js → chunk-AWILTHBM.js} +3 -3
- package/dist/{chunk-ZDZ57MIU.js.map → chunk-AWILTHBM.js.map} +1 -1
- package/dist/{chunk-DDYSOZ25.js → chunk-AYXRNQH3.js} +3 -3
- package/dist/{chunk-DDYSOZ25.js.map → chunk-AYXRNQH3.js.map} +1 -1
- package/dist/{chunk-U2CK6AN5.cjs → chunk-BCCEYWAV.cjs} +4 -4
- package/dist/{chunk-U2CK6AN5.cjs.map → chunk-BCCEYWAV.cjs.map} +1 -1
- package/dist/{chunk-MH64VYGF.cjs → chunk-CSTWQQ3C.cjs} +14 -13
- package/dist/chunk-CSTWQQ3C.cjs.map +1 -0
- package/dist/{chunk-FTPL7ILZ.js → chunk-CWZDKGJ6.js} +3 -3
- package/dist/{chunk-FTPL7ILZ.js.map → chunk-CWZDKGJ6.js.map} +1 -1
- package/dist/{chunk-MVSUZXER.cjs → chunk-D7P76YH6.cjs} +4 -4
- package/dist/{chunk-MVSUZXER.cjs.map → chunk-D7P76YH6.cjs.map} +1 -1
- package/dist/{chunk-IL5SHDY4.js → chunk-DAMIFZPW.js} +949 -103
- package/dist/chunk-DAMIFZPW.js.map +1 -0
- package/dist/{chunk-KLXRYVVQ.cjs → chunk-DVI6XHUC.cjs} +4 -4
- package/dist/{chunk-KLXRYVVQ.cjs.map → chunk-DVI6XHUC.cjs.map} +1 -1
- package/dist/chunk-ELKY3FEM.cjs +14 -0
- package/dist/{chunk-IP5NGA2S.cjs.map → chunk-ELKY3FEM.cjs.map} +1 -1
- package/dist/{chunk-TOODGJKM.js → chunk-GZVSHXPP.js} +3 -3
- package/dist/chunk-GZVSHXPP.js.map +1 -0
- package/dist/{chunk-WA3SWCXD.cjs → chunk-I4XP6RAN.cjs} +9 -9
- package/dist/{chunk-WA3SWCXD.cjs.map → chunk-I4XP6RAN.cjs.map} +1 -1
- package/dist/{chunk-PLVSXEQP.cjs → chunk-IAP4IWKM.cjs} +4 -4
- package/dist/{chunk-PLVSXEQP.cjs.map → chunk-IAP4IWKM.cjs.map} +1 -1
- package/dist/{chunk-YT4RGZYO.cjs → chunk-KXCUCBEI.cjs} +8 -8
- package/dist/{chunk-YT4RGZYO.cjs.map → chunk-KXCUCBEI.cjs.map} +1 -1
- package/dist/{chunk-Z74LG5VH.cjs → chunk-LFAAEOQC.cjs} +21 -4
- package/dist/chunk-LFAAEOQC.cjs.map +1 -0
- package/dist/{chunk-DK7AVDMI.cjs → chunk-LVVAUDVQ.cjs} +4 -4
- package/dist/{chunk-DK7AVDMI.cjs.map → chunk-LVVAUDVQ.cjs.map} +1 -1
- package/dist/{chunk-HBMZEZTO.js → chunk-ON4S33NP.js} +3 -3
- package/dist/{chunk-HBMZEZTO.js.map → chunk-ON4S33NP.js.map} +1 -1
- package/dist/{chunk-L6YBPFYF.js → chunk-OPT2L5AM.js} +1089 -81
- package/dist/chunk-OPT2L5AM.js.map +1 -0
- package/dist/{chunk-N2KMAW6T.js → chunk-P7WF6NQU.js} +20 -4
- package/dist/chunk-P7WF6NQU.js.map +1 -0
- package/dist/{chunk-KEMW2BER.js → chunk-PY4MHJTE.js} +3 -3
- package/dist/{chunk-KEMW2BER.js.map → chunk-PY4MHJTE.js.map} +1 -1
- package/dist/{chunk-TZVJV7EV.js → chunk-QSJZLHWA.js} +5 -5
- package/dist/{chunk-TZVJV7EV.js.map → chunk-QSJZLHWA.js.map} +1 -1
- package/dist/{chunk-DCOKWJ5G.cjs → chunk-RJCNC57P.cjs} +1110 -79
- package/dist/chunk-RJCNC57P.cjs.map +1 -0
- package/dist/{chunk-LMW44O4V.cjs → chunk-RPV7GQAX.cjs} +4 -4
- package/dist/{chunk-LMW44O4V.cjs.map → chunk-RPV7GQAX.cjs.map} +1 -1
- package/dist/{chunk-TZOR5M7H.js → chunk-RYCRCJCY.js} +25 -45
- package/dist/chunk-RYCRCJCY.js.map +1 -0
- package/dist/{chunk-IDDUQR6P.cjs → chunk-V5WKCX3G.cjs} +3 -3
- package/dist/chunk-V5WKCX3G.cjs.map +1 -0
- package/dist/{chunk-6AR2Z5ZG.js → chunk-X3GXU6TZ.js} +3 -3
- package/dist/chunk-X3GXU6TZ.js.map +1 -0
- package/dist/deployer/index.cjs +2 -2
- package/dist/deployer/index.js +1 -1
- package/dist/index.cjs +74 -70
- package/dist/index.js +14 -14
- package/dist/llm/index.d.ts +2 -1
- package/dist/llm/index.d.ts.map +1 -1
- package/dist/llm/model/base.types.d.ts +2 -6
- package/dist/llm/model/base.types.d.ts.map +1 -1
- package/dist/llm/model/index.d.ts +0 -1
- package/dist/llm/model/index.d.ts.map +1 -1
- package/dist/llm/model/model.d.ts +3 -2
- package/dist/llm/model/model.d.ts.map +1 -1
- package/dist/llm/model/model.loop.d.ts +25 -0
- package/dist/llm/model/model.loop.d.ts.map +1 -0
- package/dist/llm/model/model.loop.types.d.ts +39 -0
- package/dist/llm/model/model.loop.types.d.ts.map +1 -0
- package/dist/llm/model/shared.types.d.ts +8 -0
- package/dist/llm/model/shared.types.d.ts.map +1 -0
- package/dist/logger/constants.d.ts +1 -1
- package/dist/logger/index.cjs +6 -6
- package/dist/logger/index.js +1 -1
- package/dist/loop/index.cjs +2848 -0
- package/dist/loop/index.cjs.map +1 -0
- package/dist/loop/index.d.ts +2 -0
- package/dist/loop/index.d.ts.map +1 -0
- package/dist/loop/index.js +2842 -0
- package/dist/loop/index.js.map +1 -0
- package/dist/loop/loop.d.ts +5 -0
- package/dist/loop/loop.d.ts.map +1 -0
- package/dist/loop/telemetry/index.d.ts +36 -0
- package/dist/loop/telemetry/index.d.ts.map +1 -0
- package/dist/loop/telemetry/noop.d.ts +3 -0
- package/dist/loop/telemetry/noop.d.ts.map +1 -0
- package/dist/loop/test-utils/fullStream.d.ts +6 -0
- package/dist/loop/test-utils/fullStream.d.ts.map +1 -0
- package/dist/loop/test-utils/generateText.d.ts +6 -0
- package/dist/loop/test-utils/generateText.d.ts.map +1 -0
- package/dist/loop/test-utils/mockTracer.d.ts +47 -0
- package/dist/loop/test-utils/mockTracer.d.ts.map +1 -0
- package/dist/loop/test-utils/options.d.ts +6 -0
- package/dist/loop/test-utils/options.d.ts.map +1 -0
- package/dist/loop/test-utils/resultObject.d.ts +6 -0
- package/dist/loop/test-utils/resultObject.d.ts.map +1 -0
- package/dist/loop/test-utils/streamObject.d.ts +6 -0
- package/dist/loop/test-utils/streamObject.d.ts.map +1 -0
- package/dist/loop/test-utils/telemetry.d.ts +6 -0
- package/dist/loop/test-utils/telemetry.d.ts.map +1 -0
- package/dist/loop/test-utils/textStream.d.ts +6 -0
- package/dist/loop/test-utils/textStream.d.ts.map +1 -0
- package/dist/loop/test-utils/toUIMessageStream.d.ts +6 -0
- package/dist/loop/test-utils/toUIMessageStream.d.ts.map +1 -0
- package/dist/loop/test-utils/tools.d.ts +6 -0
- package/dist/loop/test-utils/tools.d.ts.map +1 -0
- package/dist/loop/test-utils/utils.d.ts +40 -0
- package/dist/loop/test-utils/utils.d.ts.map +1 -0
- package/dist/loop/types.d.ts +68 -0
- package/dist/loop/types.d.ts.map +1 -0
- package/dist/loop/workflow/llm-execution.d.ts +80 -0
- package/dist/loop/workflow/llm-execution.d.ts.map +1 -0
- package/dist/loop/workflow/outer-llm-step.d.ts +43 -0
- package/dist/loop/workflow/outer-llm-step.d.ts.map +1 -0
- package/dist/loop/workflow/run-state.d.ts +24 -0
- package/dist/loop/workflow/run-state.d.ts.map +1 -0
- package/dist/loop/workflow/schema.d.ts +80 -0
- package/dist/loop/workflow/schema.d.ts.map +1 -0
- package/dist/loop/workflow/stream.d.ts +6 -0
- package/dist/loop/workflow/stream.d.ts.map +1 -0
- package/dist/loop/workflow/tool-call-step.d.ts +41 -0
- package/dist/loop/workflow/tool-call-step.d.ts.map +1 -0
- package/dist/mastra/index.cjs +2 -2
- package/dist/mastra/index.d.ts +4 -5
- package/dist/mastra/index.d.ts.map +1 -1
- package/dist/mastra/index.js +1 -1
- package/dist/mcp/index.cjs +4 -4
- package/dist/mcp/index.js +2 -2
- package/dist/memory/index.cjs +4 -4
- package/dist/memory/index.js +1 -1
- package/dist/network/index.cjs +6 -6
- package/dist/network/index.cjs.map +1 -1
- package/dist/network/index.js +3 -3
- package/dist/network/index.js.map +1 -1
- package/dist/network/network.d.ts +8 -7
- package/dist/network/network.d.ts.map +1 -1
- package/dist/network/vNext/index.cjs +21 -21
- package/dist/network/vNext/index.cjs.map +1 -1
- package/dist/network/vNext/index.d.ts +7 -7
- package/dist/network/vNext/index.d.ts.map +1 -1
- package/dist/network/vNext/index.js +7 -7
- package/dist/network/vNext/index.js.map +1 -1
- package/dist/processors/index.cjs +512 -0
- package/dist/processors/index.cjs.map +1 -0
- package/dist/processors/index.d.ts +38 -0
- package/dist/processors/index.d.ts.map +1 -0
- package/dist/processors/index.js +481 -0
- package/dist/processors/index.js.map +1 -0
- package/dist/processors/processors/batch-parts.d.ts +42 -0
- package/dist/processors/processors/batch-parts.d.ts.map +1 -0
- package/dist/processors/processors/index.d.ts +10 -0
- package/dist/processors/processors/index.d.ts.map +1 -0
- package/dist/processors/processors/language-detector.d.ts +151 -0
- package/dist/processors/processors/language-detector.d.ts.map +1 -0
- package/dist/processors/processors/moderation.d.ts +130 -0
- package/dist/processors/processors/moderation.d.ts.map +1 -0
- package/dist/processors/processors/pii-detector.d.ts +197 -0
- package/dist/processors/processors/pii-detector.d.ts.map +1 -0
- package/dist/processors/processors/prompt-injection-detector.d.ts +108 -0
- package/dist/processors/processors/prompt-injection-detector.d.ts.map +1 -0
- package/dist/processors/processors/structured-output.d.ts +42 -0
- package/dist/processors/processors/structured-output.d.ts.map +1 -0
- package/dist/processors/processors/system-prompt-scrubber.d.ts +92 -0
- package/dist/processors/processors/system-prompt-scrubber.d.ts.map +1 -0
- package/dist/processors/processors/token-limiter.d.ts +66 -0
- package/dist/processors/processors/token-limiter.d.ts.map +1 -0
- package/dist/processors/processors/unicode-normalizer.d.ts +34 -0
- package/dist/processors/processors/unicode-normalizer.d.ts.map +1 -0
- package/dist/processors/runner.d.ts +41 -0
- package/dist/processors/runner.d.ts.map +1 -0
- package/dist/relevance/index.cjs +4 -4
- package/dist/relevance/index.js +1 -1
- package/dist/scores/index.cjs +5 -5
- package/dist/scores/index.js +2 -2
- package/dist/server/index.cjs +2 -2
- package/dist/server/index.js +1 -1
- package/dist/storage/domains/operations/base.d.ts.map +1 -1
- package/dist/storage/index.cjs +15 -17
- package/dist/storage/index.cjs.map +1 -1
- package/dist/storage/index.js +4 -6
- package/dist/storage/index.js.map +1 -1
- package/dist/stream/aisdk/v4/transform.d.ts +26 -0
- package/dist/stream/aisdk/v4/transform.d.ts.map +1 -1
- package/dist/stream/aisdk/v5/compat.d.ts +159 -0
- package/dist/stream/aisdk/v5/compat.d.ts.map +1 -0
- package/dist/stream/aisdk/v5/execute.d.ts +29 -0
- package/dist/stream/aisdk/v5/execute.d.ts.map +1 -0
- package/dist/stream/aisdk/v5/file.d.ts +38 -0
- package/dist/stream/aisdk/v5/file.d.ts.map +1 -0
- package/dist/stream/aisdk/v5/input.d.ts +15 -0
- package/dist/stream/aisdk/v5/input.d.ts.map +1 -0
- package/dist/stream/aisdk/v5/object/schema.d.ts +4 -0
- package/dist/stream/aisdk/v5/object/schema.d.ts.map +1 -0
- package/dist/stream/aisdk/v5/object/stream-object.d.ts +34 -0
- package/dist/stream/aisdk/v5/object/stream-object.d.ts.map +1 -0
- package/dist/stream/aisdk/v5/output-helpers.d.ts +76 -0
- package/dist/stream/aisdk/v5/output-helpers.d.ts.map +1 -0
- package/dist/stream/aisdk/v5/output.d.ts +119 -0
- package/dist/stream/aisdk/v5/output.d.ts.map +1 -0
- package/dist/stream/aisdk/v5/test-utils.d.ts +19 -0
- package/dist/stream/aisdk/v5/test-utils.d.ts.map +1 -0
- package/dist/stream/aisdk/v5/transform.d.ts +31 -0
- package/dist/stream/aisdk/v5/transform.d.ts.map +1 -0
- package/dist/stream/base/input.d.ts +1 -1
- package/dist/stream/base/output.d.ts +89 -0
- package/dist/stream/base/output.d.ts.map +1 -0
- package/dist/stream/types.d.ts +30 -0
- package/dist/stream/types.d.ts.map +1 -1
- package/dist/test-utils/llm-mock.cjs +2 -2
- package/dist/test-utils/llm-mock.cjs.map +1 -1
- package/dist/test-utils/llm-mock.d.ts +2 -2
- package/dist/test-utils/llm-mock.d.ts.map +1 -1
- package/dist/test-utils/llm-mock.js +2 -2
- package/dist/test-utils/llm-mock.js.map +1 -1
- package/dist/tools/tool-builder/builder.d.ts +3 -2
- package/dist/tools/tool-builder/builder.d.ts.map +1 -1
- package/dist/tools/types.d.ts +9 -0
- package/dist/tools/types.d.ts.map +1 -1
- package/dist/tts/index.cjs +2 -2
- package/dist/tts/index.js +1 -1
- package/dist/types.d.ts +2 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/utils.cjs +19 -15
- package/dist/utils.d.ts +3 -2
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +1 -1
- package/dist/vector/index.cjs +2 -2
- package/dist/vector/index.js +1 -1
- package/dist/voice/index.cjs +4 -4
- package/dist/voice/index.js +1 -1
- package/dist/workflows/default.d.ts.map +1 -1
- package/dist/workflows/index.cjs +10 -10
- package/dist/workflows/index.js +1 -1
- package/dist/workflows/legacy/index.cjs +22 -22
- package/dist/workflows/legacy/index.js +1 -1
- package/loop.d.ts +1 -0
- package/package.json +16 -1
- package/processors.d.ts +1 -0
- package/dist/agent/input-processor/processors/index.cjs +0 -28
- package/dist/agent/input-processor/processors/index.js +0 -3
- package/dist/agent/input-processor/runner.d.ts +0 -4
- package/dist/agent/input-processor/runner.d.ts.map +0 -1
- package/dist/chunk-6AR2Z5ZG.js.map +0 -1
- package/dist/chunk-7E2SNI5D.cjs.map +0 -1
- package/dist/chunk-DCOKWJ5G.cjs.map +0 -1
- package/dist/chunk-IDDUQR6P.cjs.map +0 -1
- package/dist/chunk-IL5SHDY4.js.map +0 -1
- package/dist/chunk-IP5NGA2S.cjs +0 -14
- package/dist/chunk-L6YBPFYF.js.map +0 -1
- package/dist/chunk-MH64VYGF.cjs.map +0 -1
- package/dist/chunk-MTRRRTB4.js.map +0 -1
- package/dist/chunk-N2KMAW6T.js.map +0 -1
- package/dist/chunk-N3VGOJZV.cjs.map +0 -1
- package/dist/chunk-R4HT5XUH.cjs.map +0 -1
- package/dist/chunk-TOODGJKM.js.map +0 -1
- package/dist/chunk-TZOR5M7H.js.map +0 -1
- package/dist/chunk-Z74LG5VH.cjs.map +0 -1
- package/dist/llm/model/base.d.ts +0 -26
- package/dist/llm/model/base.d.ts.map +0 -1
- /package/dist/agent/input-processor/{processors/index.cjs.map → index.cjs.map} +0 -0
- /package/dist/agent/input-processor/{processors/index.js.map → index.js.map} +0 -0
|
@@ -1,107 +1,18 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ModerationOptions, ModerationResult, ModerationCategoryScores } from '../../../processors/processors/moderation.js';
|
|
2
2
|
import type { MastraMessageV2 } from '../../message-list/index.js';
|
|
3
3
|
import type { InputProcessor } from '../index.js';
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
6
|
-
|
|
7
|
-
export interface ModerationCategoryScores {
|
|
8
|
-
hate?: number;
|
|
9
|
-
'hate/threatening'?: number;
|
|
10
|
-
harassment?: number;
|
|
11
|
-
'harassment/threatening'?: number;
|
|
12
|
-
'self-harm'?: number;
|
|
13
|
-
'self-harm/intent'?: number;
|
|
14
|
-
'self-harm/instructions'?: number;
|
|
15
|
-
sexual?: number;
|
|
16
|
-
'sexual/minors'?: number;
|
|
17
|
-
violence?: number;
|
|
18
|
-
'violence/graphic'?: number;
|
|
19
|
-
[customCategory: string]: number | undefined;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Result structure for moderation
|
|
23
|
-
*/
|
|
24
|
-
export interface ModerationResult {
|
|
25
|
-
category_scores?: ModerationCategoryScores;
|
|
26
|
-
reason?: string;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Configuration options for ModerationInputProcessor
|
|
30
|
-
*/
|
|
31
|
-
export interface ModerationOptions {
|
|
32
|
-
/** Model configuration for the moderation agent */
|
|
33
|
-
model: MastraLanguageModel;
|
|
34
|
-
/**
|
|
35
|
-
* Categories to check for moderation.
|
|
36
|
-
* If not specified, uses default OpenAI categories.
|
|
37
|
-
*/
|
|
38
|
-
categories?: string[];
|
|
39
|
-
/**
|
|
40
|
-
* Confidence threshold for flagging (0-1, default: 0.5)
|
|
41
|
-
* Content is flagged if any category score exceeds this threshold
|
|
42
|
-
*/
|
|
43
|
-
threshold?: number;
|
|
44
|
-
/**
|
|
45
|
-
* Strategy when content is flagged:
|
|
46
|
-
* - 'block': Reject the entire input with an error (default)
|
|
47
|
-
* - 'warn': Log warning but allow content through
|
|
48
|
-
* - 'filter': Remove flagged messages but continue with remaining
|
|
49
|
-
*/
|
|
50
|
-
strategy?: 'block' | 'warn' | 'filter';
|
|
51
|
-
/**
|
|
52
|
-
* Custom moderation instructions for the agent
|
|
53
|
-
* If not provided, uses default instructions based on categories
|
|
54
|
-
*/
|
|
55
|
-
instructions?: string;
|
|
56
|
-
/**
|
|
57
|
-
* Whether to include confidence scores in logs (default: false)
|
|
58
|
-
* Useful for tuning thresholds and debugging
|
|
59
|
-
*/
|
|
60
|
-
includeScores?: boolean;
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* ModerationInputProcessor uses an internal Mastra agent to evaluate content
|
|
64
|
-
* against configurable moderation categories for content safety.
|
|
65
|
-
*
|
|
66
|
-
* Provides flexible moderation with custom categories, thresholds, and strategies
|
|
67
|
-
* while maintaining compatibility with OpenAI's moderation API structure.
|
|
5
|
+
* Backward-compatible wrapper for ModerationProcessor that implements the old InputProcessor interface
|
|
6
|
+
* @deprecated Use ModerationProcessor directly instead from @mastra/core/processors
|
|
68
7
|
*/
|
|
69
8
|
export declare class ModerationInputProcessor implements InputProcessor {
|
|
70
9
|
readonly name = "moderation";
|
|
71
|
-
private
|
|
72
|
-
private categories;
|
|
73
|
-
private threshold;
|
|
74
|
-
private strategy;
|
|
75
|
-
private includeScores;
|
|
76
|
-
private static readonly DEFAULT_CATEGORIES;
|
|
10
|
+
private processor;
|
|
77
11
|
constructor(options: ModerationOptions);
|
|
78
12
|
process(args: {
|
|
79
13
|
messages: MastraMessageV2[];
|
|
80
14
|
abort: (reason?: string) => never;
|
|
81
15
|
}): Promise<MastraMessageV2[]>;
|
|
82
|
-
/**
|
|
83
|
-
* Moderate content using the internal agent
|
|
84
|
-
*/
|
|
85
|
-
private moderateContent;
|
|
86
|
-
/**
|
|
87
|
-
* Determine if content is flagged based on category scores above threshold
|
|
88
|
-
*/
|
|
89
|
-
private isModerationFlagged;
|
|
90
|
-
/**
|
|
91
|
-
* Handle flagged content based on strategy
|
|
92
|
-
*/
|
|
93
|
-
private handleFlaggedContent;
|
|
94
|
-
/**
|
|
95
|
-
* Extract text content from message for moderation
|
|
96
|
-
*/
|
|
97
|
-
private extractTextContent;
|
|
98
|
-
/**
|
|
99
|
-
* Create default moderation instructions
|
|
100
|
-
*/
|
|
101
|
-
private createDefaultInstructions;
|
|
102
|
-
/**
|
|
103
|
-
* Create moderation prompt for the agent
|
|
104
|
-
*/
|
|
105
|
-
private createModerationPrompt;
|
|
106
16
|
}
|
|
17
|
+
export type { ModerationOptions, ModerationResult, ModerationCategoryScores };
|
|
107
18
|
//# sourceMappingURL=moderation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"moderation.d.ts","sourceRoot":"","sources":["../../../../src/agent/input-processor/processors/moderation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"moderation.d.ts","sourceRoot":"","sources":["../../../../src/agent/input-processor/processors/moderation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,iBAAiB,EACjB,gBAAgB,EAChB,wBAAwB,EACzB,MAAM,2CAA2C,CAAC;AACnD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/C;;;GAGG;AACH,qBAAa,wBAAyB,YAAW,cAAc;IAC7D,QAAQ,CAAC,IAAI,gBAAgB;IAC7B,OAAO,CAAC,SAAS,CAAsB;gBAE3B,OAAO,EAAE,iBAAiB;IAIhC,OAAO,CAAC,IAAI,EAAE;QAAE,QAAQ,EAAE,eAAe,EAAE,CAAC;QAAC,KAAK,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,KAAK,KAAK,CAAA;KAAE,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;CAGpH;AAED,YAAY,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,CAAC"}
|
|
@@ -1,176 +1,18 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PIIDetectorOptions, PIIDetectionResult, PIICategories, PIICategoryScores, PIIDetection } from '../../../processors/processors/pii-detector.js';
|
|
2
2
|
import type { MastraMessageV2 } from '../../message-list/index.js';
|
|
3
3
|
import type { InputProcessor } from '../index.js';
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Backward-compatible wrapper for PIIDetector that implements the old InputProcessor interface
|
|
6
|
+
* @deprecated Use PIIDetector directly instead from @mastra/core/processors
|
|
6
7
|
*/
|
|
7
|
-
export
|
|
8
|
-
email?: boolean;
|
|
9
|
-
phone?: boolean;
|
|
10
|
-
'credit-card'?: boolean;
|
|
11
|
-
ssn?: boolean;
|
|
12
|
-
'api-key'?: boolean;
|
|
13
|
-
'ip-address'?: boolean;
|
|
14
|
-
name?: boolean;
|
|
15
|
-
address?: boolean;
|
|
16
|
-
'date-of-birth'?: boolean;
|
|
17
|
-
url?: boolean;
|
|
18
|
-
uuid?: boolean;
|
|
19
|
-
'crypto-wallet'?: boolean;
|
|
20
|
-
iban?: boolean;
|
|
21
|
-
[customType: string]: boolean | undefined;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Confidence scores for each PII category (0-1)
|
|
25
|
-
*/
|
|
26
|
-
export interface PIICategoryScores {
|
|
27
|
-
email?: number;
|
|
28
|
-
phone?: number;
|
|
29
|
-
'credit-card'?: number;
|
|
30
|
-
ssn?: number;
|
|
31
|
-
'api-key'?: number;
|
|
32
|
-
'ip-address'?: number;
|
|
33
|
-
name?: number;
|
|
34
|
-
address?: number;
|
|
35
|
-
'date-of-birth'?: number;
|
|
36
|
-
url?: number;
|
|
37
|
-
uuid?: number;
|
|
38
|
-
'crypto-wallet'?: number;
|
|
39
|
-
iban?: number;
|
|
40
|
-
[customType: string]: number | undefined;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Individual PII detection with location and redaction info
|
|
44
|
-
*/
|
|
45
|
-
export interface PIIDetection {
|
|
46
|
-
type: string;
|
|
47
|
-
value: string;
|
|
48
|
-
confidence: number;
|
|
49
|
-
start: number;
|
|
50
|
-
end: number;
|
|
51
|
-
redacted_value?: string;
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Result structure for PII detection (simplified for minimal tokens)
|
|
55
|
-
*/
|
|
56
|
-
export interface PIIDetectionResult {
|
|
57
|
-
categories?: PIICategoryScores;
|
|
58
|
-
detections?: PIIDetection[];
|
|
59
|
-
redacted_content?: string;
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Configuration options for PIIDetector
|
|
63
|
-
*/
|
|
64
|
-
export interface PIIDetectorOptions {
|
|
65
|
-
/** Model configuration for the detection agent */
|
|
66
|
-
model: MastraLanguageModel;
|
|
67
|
-
/**
|
|
68
|
-
* PII types to detect.
|
|
69
|
-
* If not specified, uses default types.
|
|
70
|
-
*/
|
|
71
|
-
detectionTypes?: string[];
|
|
72
|
-
/**
|
|
73
|
-
* Confidence threshold for flagging (0-1, default: 0.6)
|
|
74
|
-
* PII is flagged if any category score exceeds this threshold
|
|
75
|
-
*/
|
|
76
|
-
threshold?: number;
|
|
77
|
-
/**
|
|
78
|
-
* Strategy when PII is detected:
|
|
79
|
-
* - 'block': Reject the entire input with an error
|
|
80
|
-
* - 'warn': Log warning but allow content through
|
|
81
|
-
* - 'filter': Remove flagged messages but continue with remaining
|
|
82
|
-
* - 'redact': Replace detected PII with redacted versions (default)
|
|
83
|
-
*/
|
|
84
|
-
strategy?: 'block' | 'warn' | 'filter' | 'redact';
|
|
85
|
-
/**
|
|
86
|
-
* Redaction method for PII:
|
|
87
|
-
* - 'mask': Replace with asterisks (***@***.com)
|
|
88
|
-
* - 'hash': Replace with SHA256 hash
|
|
89
|
-
* - 'remove': Remove entirely
|
|
90
|
-
* - 'placeholder': Replace with type placeholder ([EMAIL], [PHONE], etc.)
|
|
91
|
-
*/
|
|
92
|
-
redactionMethod?: 'mask' | 'hash' | 'remove' | 'placeholder';
|
|
93
|
-
/**
|
|
94
|
-
* Custom detection instructions for the agent
|
|
95
|
-
* If not provided, uses default instructions based on detection types
|
|
96
|
-
*/
|
|
97
|
-
instructions?: string;
|
|
98
|
-
/**
|
|
99
|
-
* Whether to include detection details in logs (default: false)
|
|
100
|
-
* Useful for compliance auditing and debugging
|
|
101
|
-
*/
|
|
102
|
-
includeDetections?: boolean;
|
|
103
|
-
/**
|
|
104
|
-
* Whether to preserve PII format during redaction (default: true)
|
|
105
|
-
* When true, maintains structure like ***-**-1234 for phone numbers
|
|
106
|
-
*/
|
|
107
|
-
preserveFormat?: boolean;
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* PIIDetector uses an internal Mastra agent to identify and redact
|
|
111
|
-
* personally identifiable information for privacy compliance.
|
|
112
|
-
*
|
|
113
|
-
* Supports multiple redaction strategies and maintains audit trails
|
|
114
|
-
* for compliance with GDPR, CCPA, HIPAA, and other privacy regulations.
|
|
115
|
-
*/
|
|
116
|
-
export declare class PIIDetector implements InputProcessor {
|
|
8
|
+
export declare class PIIDetectorInputProcessor implements InputProcessor {
|
|
117
9
|
readonly name = "pii-detector";
|
|
118
|
-
private
|
|
119
|
-
private detectionTypes;
|
|
120
|
-
private threshold;
|
|
121
|
-
private strategy;
|
|
122
|
-
private redactionMethod;
|
|
123
|
-
private includeDetections;
|
|
124
|
-
private preserveFormat;
|
|
125
|
-
private static readonly DEFAULT_DETECTION_TYPES;
|
|
10
|
+
private processor;
|
|
126
11
|
constructor(options: PIIDetectorOptions);
|
|
127
12
|
process(args: {
|
|
128
13
|
messages: MastraMessageV2[];
|
|
129
14
|
abort: (reason?: string) => never;
|
|
130
15
|
}): Promise<MastraMessageV2[]>;
|
|
131
|
-
/**
|
|
132
|
-
* Detect PII using the internal agent
|
|
133
|
-
*/
|
|
134
|
-
private detectPII;
|
|
135
|
-
/**
|
|
136
|
-
* Determine if PII is flagged based on detections or category scores above threshold
|
|
137
|
-
*/
|
|
138
|
-
private isPIIFlagged;
|
|
139
|
-
/**
|
|
140
|
-
* Handle detected PII based on strategy
|
|
141
|
-
*/
|
|
142
|
-
private handleDetectedPII;
|
|
143
|
-
/**
|
|
144
|
-
* Create a redacted message with PII removed/masked
|
|
145
|
-
*/
|
|
146
|
-
private createRedactedMessage;
|
|
147
|
-
/**
|
|
148
|
-
* Apply redaction method to content
|
|
149
|
-
*/
|
|
150
|
-
private applyRedactionMethod;
|
|
151
|
-
/**
|
|
152
|
-
* Redact individual PII value based on method and type
|
|
153
|
-
*/
|
|
154
|
-
private redactValue;
|
|
155
|
-
/**
|
|
156
|
-
* Mask PII value while optionally preserving format
|
|
157
|
-
*/
|
|
158
|
-
private maskValue;
|
|
159
|
-
/**
|
|
160
|
-
* Hash PII value using SHA256
|
|
161
|
-
*/
|
|
162
|
-
private hashValue;
|
|
163
|
-
/**
|
|
164
|
-
* Extract text content from message for analysis
|
|
165
|
-
*/
|
|
166
|
-
private extractTextContent;
|
|
167
|
-
/**
|
|
168
|
-
* Create default detection instructions
|
|
169
|
-
*/
|
|
170
|
-
private createDefaultInstructions;
|
|
171
|
-
/**
|
|
172
|
-
* Create detection prompt for the agent
|
|
173
|
-
*/
|
|
174
|
-
private createDetectionPrompt;
|
|
175
16
|
}
|
|
17
|
+
export type { PIIDetectorOptions, PIIDetectionResult, PIICategories, PIICategoryScores, PIIDetection };
|
|
176
18
|
//# sourceMappingURL=pii-detector.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pii-detector.d.ts","sourceRoot":"","sources":["../../../../src/agent/input-processor/processors/pii-detector.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pii-detector.d.ts","sourceRoot":"","sources":["../../../../src/agent/input-processor/processors/pii-detector.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,kBAAkB,EAClB,kBAAkB,EAClB,aAAa,EACb,iBAAiB,EACjB,YAAY,EACb,MAAM,6CAA6C,CAAC;AACrD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/C;;;GAGG;AACH,qBAAa,yBAA0B,YAAW,cAAc;IAC9D,QAAQ,CAAC,IAAI,kBAAkB;IAC/B,OAAO,CAAC,SAAS,CAAc;gBAEnB,OAAO,EAAE,kBAAkB;IAIjC,OAAO,CAAC,IAAI,EAAE;QAAE,QAAQ,EAAE,eAAe,EAAE,CAAC;QAAC,KAAK,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,KAAK,KAAK,CAAA;KAAE,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;CAGpH;AAED,YAAY,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,aAAa,EAAE,iBAAiB,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -1,108 +1,18 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PromptInjectionOptions, PromptInjectionResult, PromptInjectionCategoryScores } from '../../../processors/processors/prompt-injection-detector.js';
|
|
2
2
|
import type { MastraMessageV2 } from '../../message-list/index.js';
|
|
3
3
|
import type { InputProcessor } from '../index.js';
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Backward-compatible wrapper for PromptInjectionDetector that implements the old InputProcessor interface
|
|
6
|
+
* @deprecated Use PromptInjectionDetector directly instead from @mastra/core/processors
|
|
6
7
|
*/
|
|
7
|
-
export
|
|
8
|
-
injection?: number;
|
|
9
|
-
jailbreak?: number;
|
|
10
|
-
'tool-exfiltration'?: number;
|
|
11
|
-
'data-exfiltration'?: number;
|
|
12
|
-
'system-override'?: number;
|
|
13
|
-
'role-manipulation'?: number;
|
|
14
|
-
[customType: string]: number | undefined;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Result structure for prompt injection detection
|
|
18
|
-
*/
|
|
19
|
-
export interface PromptInjectionResult {
|
|
20
|
-
categories?: PromptInjectionCategoryScores;
|
|
21
|
-
reason?: string;
|
|
22
|
-
rewritten_content?: string;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Configuration options for PromptInjectionDetector
|
|
26
|
-
*/
|
|
27
|
-
export interface PromptInjectionOptions {
|
|
28
|
-
/** Model configuration for the detection agent */
|
|
29
|
-
model: MastraLanguageModel;
|
|
30
|
-
/**
|
|
31
|
-
* Detection types to check for.
|
|
32
|
-
* If not specified, uses default categories.
|
|
33
|
-
*/
|
|
34
|
-
detectionTypes?: string[];
|
|
35
|
-
/**
|
|
36
|
-
* Confidence threshold for flagging (0-1, default: 0.7)
|
|
37
|
-
* Higher threshold = less sensitive to avoid false positives
|
|
38
|
-
*/
|
|
39
|
-
threshold?: number;
|
|
40
|
-
/**
|
|
41
|
-
* Strategy when injection is detected:
|
|
42
|
-
* - 'block': Reject the entire input with an error (default)
|
|
43
|
-
* - 'warn': Log warning but allow content through
|
|
44
|
-
* - 'filter': Remove flagged messages but continue with remaining
|
|
45
|
-
* - 'rewrite': Attempt to neutralize the injection while preserving intent
|
|
46
|
-
*/
|
|
47
|
-
strategy?: 'block' | 'warn' | 'filter' | 'rewrite';
|
|
48
|
-
/**
|
|
49
|
-
* Custom detection instructions for the agent
|
|
50
|
-
* If not provided, uses default instructions based on detection types
|
|
51
|
-
*/
|
|
52
|
-
instructions?: string;
|
|
53
|
-
/**
|
|
54
|
-
* Whether to include confidence scores in logs (default: false)
|
|
55
|
-
* Useful for tuning thresholds and debugging
|
|
56
|
-
*/
|
|
57
|
-
includeScores?: boolean;
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* PromptInjectionDetector uses an internal Mastra agent to identify and handle
|
|
61
|
-
* prompt injection attacks, jailbreaks, and tool/data exfiltration attempts.
|
|
62
|
-
*
|
|
63
|
-
* Provides multiple response strategies including content rewriting to neutralize
|
|
64
|
-
* attacks while preserving legitimate user intent.
|
|
65
|
-
*/
|
|
66
|
-
export declare class PromptInjectionDetector implements InputProcessor {
|
|
8
|
+
export declare class PromptInjectionDetectorInputProcessor implements InputProcessor {
|
|
67
9
|
readonly name = "prompt-injection-detector";
|
|
68
|
-
private
|
|
69
|
-
private detectionTypes;
|
|
70
|
-
private threshold;
|
|
71
|
-
private strategy;
|
|
72
|
-
private includeScores;
|
|
73
|
-
private static readonly DEFAULT_DETECTION_TYPES;
|
|
10
|
+
private processor;
|
|
74
11
|
constructor(options: PromptInjectionOptions);
|
|
75
12
|
process(args: {
|
|
76
13
|
messages: MastraMessageV2[];
|
|
77
14
|
abort: (reason?: string) => never;
|
|
78
15
|
}): Promise<MastraMessageV2[]>;
|
|
79
|
-
/**
|
|
80
|
-
* Detect prompt injection using the internal agent
|
|
81
|
-
*/
|
|
82
|
-
private detectPromptInjection;
|
|
83
|
-
/**
|
|
84
|
-
* Determine if prompt injection is flagged based on category scores above threshold
|
|
85
|
-
*/
|
|
86
|
-
private isInjectionFlagged;
|
|
87
|
-
/**
|
|
88
|
-
* Handle detected prompt injection based on strategy
|
|
89
|
-
*/
|
|
90
|
-
private handleDetectedInjection;
|
|
91
|
-
/**
|
|
92
|
-
* Create a rewritten message with neutralized content
|
|
93
|
-
*/
|
|
94
|
-
private createRewrittenMessage;
|
|
95
|
-
/**
|
|
96
|
-
* Extract text content from message for analysis
|
|
97
|
-
*/
|
|
98
|
-
private extractTextContent;
|
|
99
|
-
/**
|
|
100
|
-
* Create default detection instructions
|
|
101
|
-
*/
|
|
102
|
-
private createDefaultInstructions;
|
|
103
|
-
/**
|
|
104
|
-
* Create detection prompt for the agent
|
|
105
|
-
*/
|
|
106
|
-
private createDetectionPrompt;
|
|
107
16
|
}
|
|
17
|
+
export type { PromptInjectionOptions, PromptInjectionResult, PromptInjectionCategoryScores };
|
|
108
18
|
//# sourceMappingURL=prompt-injection-detector.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompt-injection-detector.d.ts","sourceRoot":"","sources":["../../../../src/agent/input-processor/processors/prompt-injection-detector.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"prompt-injection-detector.d.ts","sourceRoot":"","sources":["../../../../src/agent/input-processor/processors/prompt-injection-detector.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,sBAAsB,EACtB,qBAAqB,EACrB,6BAA6B,EAC9B,MAAM,0DAA0D,CAAC;AAClE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/C;;;GAGG;AACH,qBAAa,qCAAsC,YAAW,cAAc;IAC1E,QAAQ,CAAC,IAAI,+BAA+B;IAC5C,OAAO,CAAC,SAAS,CAA0B;gBAE/B,OAAO,EAAE,sBAAsB;IAIrC,OAAO,CAAC,IAAI,EAAE;QAAE,QAAQ,EAAE,eAAe,EAAE,CAAC;QAAC,KAAK,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,KAAK,KAAK,CAAA;KAAE,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;CAGpH;AAED,YAAY,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,6BAA6B,EAAE,CAAC"}
|
|
@@ -1,34 +1,18 @@
|
|
|
1
|
+
import type { UnicodeNormalizerOptions } from '../../../processors/processors/unicode-normalizer.js';
|
|
1
2
|
import type { MastraMessageV2 } from '../../message-list/index.js';
|
|
2
3
|
import type { InputProcessor } from '../index.js';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
stripControlChars?: boolean;
|
|
9
|
-
/**
|
|
10
|
-
* Whether to preserve emojis (default: true)
|
|
11
|
-
* When disabled, emojis may be removed if they contain control characters
|
|
12
|
-
*/
|
|
13
|
-
preserveEmojis?: boolean;
|
|
14
|
-
/**
|
|
15
|
-
* Whether to collapse consecutive whitespace (default: true)
|
|
16
|
-
* When enabled, multiple spaces/tabs/newlines are collapsed to single instances
|
|
17
|
-
*/
|
|
18
|
-
collapseWhitespace?: boolean;
|
|
19
|
-
/**
|
|
20
|
-
* Whether to trim leading and trailing whitespace (default: true)
|
|
21
|
-
*/
|
|
22
|
-
trim?: boolean;
|
|
23
|
-
}
|
|
24
|
-
export declare class UnicodeNormalizer implements InputProcessor {
|
|
4
|
+
/**
|
|
5
|
+
* Backward-compatible wrapper for UnicodeNormalizer that implements the old InputProcessor interface
|
|
6
|
+
* @deprecated Use UnicodeNormalizer directly instead from @mastra/core/processors
|
|
7
|
+
*/
|
|
8
|
+
export declare class UnicodeNormalizerInputProcessor implements InputProcessor {
|
|
25
9
|
readonly name = "unicode-normalizer";
|
|
26
|
-
private
|
|
10
|
+
private processor;
|
|
27
11
|
constructor(options?: UnicodeNormalizerOptions);
|
|
28
12
|
process(args: {
|
|
29
13
|
messages: MastraMessageV2[];
|
|
30
14
|
abort: (reason?: string) => never;
|
|
31
|
-
}): MastraMessageV2[];
|
|
32
|
-
private normalizeText;
|
|
15
|
+
}): Promise<MastraMessageV2[]> | MastraMessageV2[];
|
|
33
16
|
}
|
|
17
|
+
export type { UnicodeNormalizerOptions };
|
|
34
18
|
//# sourceMappingURL=unicode-normalizer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unicode-normalizer.d.ts","sourceRoot":"","sources":["../../../../src/agent/input-processor/processors/unicode-normalizer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"unicode-normalizer.d.ts","sourceRoot":"","sources":["../../../../src/agent/input-processor/processors/unicode-normalizer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,mDAAmD,CAAC;AAClG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/C;;;GAGG;AACH,qBAAa,+BAAgC,YAAW,cAAc;IACpE,QAAQ,CAAC,IAAI,wBAAwB;IACrC,OAAO,CAAC,SAAS,CAAoB;gBAEzB,OAAO,GAAE,wBAA6B;IAIlD,OAAO,CAAC,IAAI,EAAE;QACZ,QAAQ,EAAE,eAAe,EAAE,CAAC;QAC5B,KAAK,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,KAAK,KAAK,CAAC;KACnC,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC,GAAG,eAAe,EAAE;CAGnD;AAED,YAAY,EAAE,wBAAwB,EAAE,CAAC"}
|