@mastra/core 1.0.0-beta.10 → 1.0.0-beta.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +90 -0
- package/dist/agent/agent-legacy.d.ts +16 -8
- package/dist/agent/agent-legacy.d.ts.map +1 -1
- package/dist/agent/agent.d.ts +19 -4
- package/dist/agent/agent.d.ts.map +1 -1
- package/dist/agent/agent.types.d.ts +11 -5
- package/dist/agent/agent.types.d.ts.map +1 -1
- package/dist/agent/index.cjs +9 -9
- package/dist/agent/index.js +2 -2
- package/dist/agent/message-list/index.cjs +3 -3
- package/dist/agent/message-list/index.d.ts +1 -0
- package/dist/agent/message-list/index.d.ts.map +1 -1
- package/dist/agent/message-list/index.js +1 -1
- package/dist/agent/trip-wire.d.ts +38 -4
- package/dist/agent/trip-wire.d.ts.map +1 -1
- package/dist/agent/types.d.ts +25 -8
- package/dist/agent/types.d.ts.map +1 -1
- package/dist/agent/utils.d.ts +1 -2
- package/dist/agent/utils.d.ts.map +1 -1
- package/dist/agent/workflows/prepare-stream/index.d.ts +28 -6
- package/dist/agent/workflows/prepare-stream/index.d.ts.map +1 -1
- package/dist/agent/workflows/prepare-stream/prepare-memory-step.d.ts +28 -6
- package/dist/agent/workflows/prepare-stream/prepare-memory-step.d.ts.map +1 -1
- package/dist/agent/workflows/prepare-stream/schema.d.ts +32 -9
- package/dist/agent/workflows/prepare-stream/schema.d.ts.map +1 -1
- package/dist/{chunk-6CYYFT4O.js → chunk-2ULLRN4Y.js} +16194 -14889
- package/dist/chunk-2ULLRN4Y.js.map +1 -0
- package/dist/{chunk-MSZP3FNH.cjs → chunk-3E3ILV6T.cjs} +10 -10
- package/dist/{chunk-MSZP3FNH.cjs.map → chunk-3E3ILV6T.cjs.map} +1 -1
- package/dist/{chunk-SL7Q6IZF.cjs → chunk-52RSUALV.cjs} +16287 -14961
- package/dist/chunk-52RSUALV.cjs.map +1 -0
- package/dist/{chunk-CDRYT2A5.js → chunk-5PAEYE3Q.js} +4 -4
- package/dist/{chunk-CDRYT2A5.js.map → chunk-5PAEYE3Q.js.map} +1 -1
- package/dist/{chunk-SSPUH2N7.cjs → chunk-5Q6WAYEY.cjs} +5 -3
- package/dist/chunk-5Q6WAYEY.cjs.map +1 -0
- package/dist/{chunk-6ONQWD6S.js → chunk-7P6BNIJH.js} +102 -90
- package/dist/chunk-7P6BNIJH.js.map +1 -0
- package/dist/{chunk-WX2DLWXF.cjs → chunk-BJXKH4LG.cjs} +5 -5
- package/dist/{chunk-WX2DLWXF.cjs.map → chunk-BJXKH4LG.cjs.map} +1 -1
- package/dist/{chunk-P2D2VO2O.cjs → chunk-BUKY6CTR.cjs} +103 -91
- package/dist/chunk-BUKY6CTR.cjs.map +1 -0
- package/dist/{chunk-4Q3Z6QRE.js → chunk-C36YRTZ6.js} +3 -3
- package/dist/{chunk-4Q3Z6QRE.js.map → chunk-C36YRTZ6.js.map} +1 -1
- package/dist/{chunk-267YOF47.js → chunk-IVV5TOMD.js} +3 -3
- package/dist/chunk-IVV5TOMD.js.map +1 -0
- package/dist/{chunk-BXONP7HX.js → chunk-JIGDJK2O.js} +3 -3
- package/dist/{chunk-BXONP7HX.js.map → chunk-JIGDJK2O.js.map} +1 -1
- package/dist/{chunk-OIDPIW42.js → chunk-O2BJW7YA.js} +4 -4
- package/dist/{chunk-OIDPIW42.js.map → chunk-O2BJW7YA.js.map} +1 -1
- package/dist/{chunk-QD3UWFAV.cjs → chunk-PG5H6QIO.cjs} +3 -3
- package/dist/chunk-PG5H6QIO.cjs.map +1 -0
- package/dist/{chunk-G4IFCTL5.cjs → chunk-S73Z3PBJ.cjs} +6 -6
- package/dist/{chunk-G4IFCTL5.cjs.map → chunk-S73Z3PBJ.cjs.map} +1 -1
- package/dist/{chunk-7THRV5KZ.cjs → chunk-SCUWP4II.cjs} +16 -9
- package/dist/chunk-SCUWP4II.cjs.map +1 -0
- package/dist/{chunk-3GKKHF36.js → chunk-SXNQRJQD.js} +5 -3
- package/dist/chunk-SXNQRJQD.js.map +1 -0
- package/dist/{chunk-NUA6TSRD.js → chunk-U3XOLEPX.js} +12 -5
- package/dist/chunk-U3XOLEPX.js.map +1 -0
- package/dist/{chunk-XRJQ5ZA7.js → chunk-US2U7ECW.js} +3 -3
- package/dist/{chunk-XRJQ5ZA7.js.map → chunk-US2U7ECW.js.map} +1 -1
- package/dist/{chunk-OYIDRI3A.cjs → chunk-WTSZBHIZ.cjs} +11 -11
- package/dist/{chunk-OYIDRI3A.cjs.map → chunk-WTSZBHIZ.cjs.map} +1 -1
- package/dist/{chunk-BCRRHJGV.cjs → chunk-YC6PJEPH.cjs} +23 -23
- package/dist/{chunk-BCRRHJGV.cjs.map → chunk-YC6PJEPH.cjs.map} +1 -1
- package/dist/evals/index.cjs +4 -4
- package/dist/evals/index.js +1 -1
- package/dist/evals/scoreTraces/index.cjs +3 -3
- package/dist/evals/scoreTraces/index.js +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.js +1 -1
- package/dist/llm/index.cjs +9 -9
- package/dist/llm/index.js +2 -2
- package/dist/llm/model/base.types.d.ts +2 -2
- package/dist/llm/model/base.types.d.ts.map +1 -1
- package/dist/llm/model/model.loop.d.ts +1 -1
- package/dist/llm/model/model.loop.d.ts.map +1 -1
- package/dist/llm/model/model.loop.types.d.ts +2 -2
- package/dist/llm/model/model.loop.types.d.ts.map +1 -1
- package/dist/llm/model/provider-types.generated.d.ts +57 -44
- package/dist/llm/model/shared.types.d.ts +7 -2
- package/dist/llm/model/shared.types.d.ts.map +1 -1
- package/dist/loop/index.cjs +2 -2
- package/dist/loop/index.js +1 -1
- package/dist/loop/test-utils/options.d.ts.map +1 -1
- package/dist/loop/test-utils/resultObject.d.ts.map +1 -1
- package/dist/loop/test-utils/streamObject.d.ts.map +1 -1
- package/dist/loop/test-utils/utils.d.ts.map +1 -1
- package/dist/loop/types.d.ts +27 -22
- package/dist/loop/types.d.ts.map +1 -1
- package/dist/loop/workflows/agentic-execution/index.d.ts +18 -0
- package/dist/loop/workflows/agentic-execution/index.d.ts.map +1 -1
- package/dist/loop/workflows/agentic-execution/llm-execution-step.d.ts +13 -1
- package/dist/loop/workflows/agentic-execution/llm-execution-step.d.ts.map +1 -1
- package/dist/loop/workflows/agentic-execution/llm-mapping-step.d.ts +6 -0
- package/dist/loop/workflows/agentic-execution/llm-mapping-step.d.ts.map +1 -1
- package/dist/loop/workflows/agentic-execution/tool-call-step.d.ts.map +1 -1
- package/dist/loop/workflows/agentic-loop/index.d.ts +18 -0
- package/dist/loop/workflows/agentic-loop/index.d.ts.map +1 -1
- package/dist/loop/workflows/schema.d.ts +18 -1
- package/dist/loop/workflows/schema.d.ts.map +1 -1
- package/dist/loop/workflows/stream.d.ts.map +1 -1
- package/dist/mastra/index.cjs +2 -2
- package/dist/mastra/index.d.ts.map +1 -1
- package/dist/mastra/index.js +1 -1
- package/dist/memory/index.cjs +7 -7
- package/dist/memory/index.js +1 -1
- package/dist/memory/memory.d.ts +3 -3
- package/dist/memory/memory.d.ts.map +1 -1
- package/dist/memory/types.d.ts +4 -4
- package/dist/processors/index.cjs +97 -17
- package/dist/processors/index.d.ts +159 -17
- package/dist/processors/index.d.ts.map +1 -1
- package/dist/processors/index.js +1 -1
- package/dist/processors/processors/prepare-step.d.ts +12 -0
- package/dist/processors/processors/prepare-step.d.ts.map +1 -0
- package/dist/processors/processors/structured-output.d.ts +4 -3
- package/dist/processors/processors/structured-output.d.ts.map +1 -1
- package/dist/processors/runner.d.ts +56 -13
- package/dist/processors/runner.d.ts.map +1 -1
- package/dist/processors/step-schema.d.ts +49731 -0
- package/dist/processors/step-schema.d.ts.map +1 -0
- package/dist/provider-registry-3TG2KUD2.cjs +40 -0
- package/dist/{provider-registry-A7FILT6Q.cjs.map → provider-registry-3TG2KUD2.cjs.map} +1 -1
- package/dist/provider-registry-F67Y6OF2.js +3 -0
- package/dist/{provider-registry-XM2YDI5X.js.map → provider-registry-F67Y6OF2.js.map} +1 -1
- package/dist/provider-registry.json +100 -88
- package/dist/relevance/index.cjs +2 -2
- package/dist/relevance/index.js +1 -1
- package/dist/server/types.d.ts +6 -0
- package/dist/server/types.d.ts.map +1 -1
- package/dist/storage/index.cjs +38 -38
- package/dist/storage/index.js +1 -1
- package/dist/storage/types.d.ts +3 -3
- package/dist/storage/types.d.ts.map +1 -1
- package/dist/stream/MastraAgentNetworkStream.d.ts +1 -1
- package/dist/stream/MastraAgentNetworkStream.d.ts.map +1 -1
- package/dist/stream/MastraWorkflowStream.d.ts +1 -1
- package/dist/stream/MastraWorkflowStream.d.ts.map +1 -1
- package/dist/stream/RunOutput.d.ts.map +1 -1
- package/dist/stream/aisdk/v4/transform.d.ts.map +1 -1
- package/dist/stream/aisdk/v5/execute.d.ts +2 -2
- package/dist/stream/aisdk/v5/execute.d.ts.map +1 -1
- package/dist/stream/aisdk/v5/output-helpers.d.ts +5 -1
- package/dist/stream/aisdk/v5/output-helpers.d.ts.map +1 -1
- package/dist/stream/aisdk/v5/output.d.ts +2 -4
- package/dist/stream/aisdk/v5/output.d.ts.map +1 -1
- package/dist/stream/aisdk/v5/transform.d.ts +2 -1
- package/dist/stream/aisdk/v5/transform.d.ts.map +1 -1
- package/dist/stream/base/output.d.ts +6 -11
- package/dist/stream/base/output.d.ts.map +1 -1
- package/dist/stream/index.cjs +12 -12
- package/dist/stream/index.d.ts +1 -1
- package/dist/stream/index.d.ts.map +1 -1
- package/dist/stream/index.js +2 -2
- package/dist/stream/types.d.ts +49 -7
- package/dist/stream/types.d.ts.map +1 -1
- package/dist/test-utils/llm-mock.cjs +4 -4
- package/dist/test-utils/llm-mock.js +1 -1
- package/dist/tools/tool-builder/builder.d.ts.map +1 -1
- package/dist/utils.cjs +22 -22
- package/dist/utils.d.ts +1 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +1 -1
- package/dist/workflows/default.d.ts +2 -1
- package/dist/workflows/default.d.ts.map +1 -1
- package/dist/workflows/evented/index.cjs +10 -10
- package/dist/workflows/evented/index.js +1 -1
- package/dist/workflows/handlers/control-flow.d.ts.map +1 -1
- package/dist/workflows/index.cjs +25 -21
- package/dist/workflows/index.js +1 -1
- package/dist/workflows/types.d.ts +35 -1
- package/dist/workflows/types.d.ts.map +1 -1
- package/dist/workflows/workflow.d.ts +14 -4
- package/dist/workflows/workflow.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/llm/model/provider-types.generated.d.ts +57 -44
- package/dist/chunk-267YOF47.js.map +0 -1
- package/dist/chunk-3GKKHF36.js.map +0 -1
- package/dist/chunk-6CYYFT4O.js.map +0 -1
- package/dist/chunk-6ONQWD6S.js.map +0 -1
- package/dist/chunk-7THRV5KZ.cjs.map +0 -1
- package/dist/chunk-NUA6TSRD.js.map +0 -1
- package/dist/chunk-P2D2VO2O.cjs.map +0 -1
- package/dist/chunk-QD3UWFAV.cjs.map +0 -1
- package/dist/chunk-SL7Q6IZF.cjs.map +0 -1
- package/dist/chunk-SSPUH2N7.cjs.map +0 -1
- package/dist/provider-registry-A7FILT6Q.cjs +0 -40
- package/dist/provider-registry-XM2YDI5X.js +0 -3
package/dist/memory/memory.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { EmbeddingModel, AssistantContent, UserContent, CoreMessage } from
|
|
|
3
3
|
import type { MastraDBMessage } from '../agent/message-list/index.js';
|
|
4
4
|
import { MastraBase } from '../base.js';
|
|
5
5
|
import type { Mastra } from '../mastra/index.js';
|
|
6
|
-
import type { InputProcessor, OutputProcessor } from '../processors/index.js';
|
|
6
|
+
import type { InputProcessor, OutputProcessor, InputProcessorOrWorkflow, OutputProcessorOrWorkflow } from '../processors/index.js';
|
|
7
7
|
import type { RequestContext } from '../request-context/index.js';
|
|
8
8
|
import type { MastraStorage, StorageListMessagesInput, StorageListThreadsByResourceIdInput, StorageListThreadsByResourceIdOutput } from '../storage/index.js';
|
|
9
9
|
import type { ToolAction } from '../tools/index.js';
|
|
@@ -245,14 +245,14 @@ export declare abstract class MastraMemory extends MastraBase {
|
|
|
245
245
|
* @param configuredProcessors - Processors already configured by the user (for deduplication)
|
|
246
246
|
* @returns Array of input processors configured for this memory instance
|
|
247
247
|
*/
|
|
248
|
-
getInputProcessors(configuredProcessors?:
|
|
248
|
+
getInputProcessors(configuredProcessors?: InputProcessorOrWorkflow[], context?: RequestContext): InputProcessor[];
|
|
249
249
|
/**
|
|
250
250
|
* Get output processors for this memory instance
|
|
251
251
|
* This allows Memory to be used as a ProcessorProvider in Agent's outputProcessors array.
|
|
252
252
|
* @param configuredProcessors - Processors already configured by the user (for deduplication)
|
|
253
253
|
* @returns Array of output processors configured for this memory instance
|
|
254
254
|
*/
|
|
255
|
-
getOutputProcessors(configuredProcessors?:
|
|
255
|
+
getOutputProcessors(configuredProcessors?: OutputProcessorOrWorkflow[], context?: RequestContext): OutputProcessor[];
|
|
256
256
|
abstract deleteMessages(messageIds: MessageDeleteInput): Promise<void>;
|
|
257
257
|
}
|
|
258
258
|
//# sourceMappingURL=memory.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../src/memory/memory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACtG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAGrC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../src/memory/memory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAA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AY,GACb,EAAE;QACD,QAAQ,EAAE,MAAM,CAAC;QACjB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,aAAa,EAAE,MAAM,CAAC;QACtB,YAAY,CAAC,EAAE,YAAY,CAAC;KAC7B,GAAG,OAAO,CAAC,IAAI,CAAC;IAEjB;;OAEG;IACH,QAAQ,CAAC,uCAAuC,CAAC,EAC/C,QAAQ,EACR,UAAU,EACV,aAAa,EACb,YAAY,EACZ,YAAY,GACb,EAAE;QACD,QAAQ,EAAE,MAAM,CAAC;QACjB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,aAAa,EAAE,MAAM,CAAC;QACtB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,YAAY,CAAC,EAAE,YAAY,CAAC;KAC7B,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAEjD;;;;;OAKG;IACH,kBAAkB,CAChB,oBAAoB,GAAE,wBAAwB,EAAO,EACrD,OAAO,CAAC,EAAE,cAAc,GACvB,cAAc,EAAE;IA4HnB;;;;;OAKG;IACH,mBAAmB,CACjB,oBAAoB,GAAE,yBAAyB,EAAO,EACtD,OAAO,CAAC,EAAE,cAAc,GACvB,eAAe,EAAE;IAwFpB,QAAQ,CAAC,cAAc,CAAC,UAAU,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;CACvE"}
|
package/dist/memory/types.d.ts
CHANGED
|
@@ -40,7 +40,7 @@ export type StorageThreadType = {
|
|
|
40
40
|
* Memory-specific context passed via RequestContext under the 'MastraMemory' key
|
|
41
41
|
* This provides processors with access to memory-related execution context
|
|
42
42
|
*/
|
|
43
|
-
export type
|
|
43
|
+
export type MemoryRequestContext = {
|
|
44
44
|
thread?: Partial<StorageThreadType> & {
|
|
45
45
|
id: string;
|
|
46
46
|
};
|
|
@@ -49,11 +49,11 @@ export type MemoryRuntimeContext = {
|
|
|
49
49
|
};
|
|
50
50
|
/**
|
|
51
51
|
* Parse and validate memory runtime context from RequestContext
|
|
52
|
-
* @param
|
|
53
|
-
* @returns The validated
|
|
52
|
+
* @param requestContext - The RequestContext to extract memory context from
|
|
53
|
+
* @returns The validated MemoryRequestContext or null if not available
|
|
54
54
|
* @throws Error if the context exists but is malformed
|
|
55
55
|
*/
|
|
56
|
-
export declare function
|
|
56
|
+
export declare function parseMemoryRequestContext(requestContext?: RequestContext): MemoryRequestContext | null;
|
|
57
57
|
export type MessageResponse<T extends 'raw' | 'core_message'> = {
|
|
58
58
|
raw: MastraMessageV1[];
|
|
59
59
|
core_message: CoreMessage[];
|
|
@@ -1,72 +1,152 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk52RSUALV_cjs = require('../chunk-52RSUALV.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
Object.defineProperty(exports, "BatchPartsProcessor", {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: function () { return
|
|
9
|
+
get: function () { return chunk52RSUALV_cjs.BatchPartsProcessor; }
|
|
10
|
+
});
|
|
11
|
+
Object.defineProperty(exports, "FilePartSchema", {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: function () { return chunk52RSUALV_cjs.FilePartSchema; }
|
|
14
|
+
});
|
|
15
|
+
Object.defineProperty(exports, "ImagePartSchema", {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: function () { return chunk52RSUALV_cjs.ImagePartSchema; }
|
|
10
18
|
});
|
|
11
19
|
Object.defineProperty(exports, "LanguageDetector", {
|
|
12
20
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
21
|
+
get: function () { return chunk52RSUALV_cjs.LanguageDetector; }
|
|
22
|
+
});
|
|
23
|
+
Object.defineProperty(exports, "MessageContentSchema", {
|
|
24
|
+
enumerable: true,
|
|
25
|
+
get: function () { return chunk52RSUALV_cjs.MessageContentSchema; }
|
|
14
26
|
});
|
|
15
27
|
Object.defineProperty(exports, "MessageHistory", {
|
|
16
28
|
enumerable: true,
|
|
17
|
-
get: function () { return
|
|
29
|
+
get: function () { return chunk52RSUALV_cjs.MessageHistory; }
|
|
30
|
+
});
|
|
31
|
+
Object.defineProperty(exports, "MessagePartSchema", {
|
|
32
|
+
enumerable: true,
|
|
33
|
+
get: function () { return chunk52RSUALV_cjs.MessagePartSchema; }
|
|
18
34
|
});
|
|
19
35
|
Object.defineProperty(exports, "ModerationProcessor", {
|
|
20
36
|
enumerable: true,
|
|
21
|
-
get: function () { return
|
|
37
|
+
get: function () { return chunk52RSUALV_cjs.ModerationProcessor; }
|
|
22
38
|
});
|
|
23
39
|
Object.defineProperty(exports, "PIIDetector", {
|
|
24
40
|
enumerable: true,
|
|
25
|
-
get: function () { return
|
|
41
|
+
get: function () { return chunk52RSUALV_cjs.PIIDetector; }
|
|
42
|
+
});
|
|
43
|
+
Object.defineProperty(exports, "ProcessorInputPhaseSchema", {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function () { return chunk52RSUALV_cjs.ProcessorInputPhaseSchema; }
|
|
46
|
+
});
|
|
47
|
+
Object.defineProperty(exports, "ProcessorInputStepPhaseSchema", {
|
|
48
|
+
enumerable: true,
|
|
49
|
+
get: function () { return chunk52RSUALV_cjs.ProcessorInputStepPhaseSchema; }
|
|
50
|
+
});
|
|
51
|
+
Object.defineProperty(exports, "ProcessorMessageContentSchema", {
|
|
52
|
+
enumerable: true,
|
|
53
|
+
get: function () { return chunk52RSUALV_cjs.ProcessorMessageContentSchema; }
|
|
54
|
+
});
|
|
55
|
+
Object.defineProperty(exports, "ProcessorMessageSchema", {
|
|
56
|
+
enumerable: true,
|
|
57
|
+
get: function () { return chunk52RSUALV_cjs.ProcessorMessageSchema; }
|
|
58
|
+
});
|
|
59
|
+
Object.defineProperty(exports, "ProcessorOutputResultPhaseSchema", {
|
|
60
|
+
enumerable: true,
|
|
61
|
+
get: function () { return chunk52RSUALV_cjs.ProcessorOutputResultPhaseSchema; }
|
|
62
|
+
});
|
|
63
|
+
Object.defineProperty(exports, "ProcessorOutputStepPhaseSchema", {
|
|
64
|
+
enumerable: true,
|
|
65
|
+
get: function () { return chunk52RSUALV_cjs.ProcessorOutputStepPhaseSchema; }
|
|
66
|
+
});
|
|
67
|
+
Object.defineProperty(exports, "ProcessorOutputStreamPhaseSchema", {
|
|
68
|
+
enumerable: true,
|
|
69
|
+
get: function () { return chunk52RSUALV_cjs.ProcessorOutputStreamPhaseSchema; }
|
|
26
70
|
});
|
|
27
71
|
Object.defineProperty(exports, "ProcessorRunner", {
|
|
28
72
|
enumerable: true,
|
|
29
|
-
get: function () { return
|
|
73
|
+
get: function () { return chunk52RSUALV_cjs.ProcessorRunner; }
|
|
30
74
|
});
|
|
31
75
|
Object.defineProperty(exports, "ProcessorState", {
|
|
32
76
|
enumerable: true,
|
|
33
|
-
get: function () { return
|
|
77
|
+
get: function () { return chunk52RSUALV_cjs.ProcessorState; }
|
|
78
|
+
});
|
|
79
|
+
Object.defineProperty(exports, "ProcessorStepInputSchema", {
|
|
80
|
+
enumerable: true,
|
|
81
|
+
get: function () { return chunk52RSUALV_cjs.ProcessorStepInputSchema; }
|
|
82
|
+
});
|
|
83
|
+
Object.defineProperty(exports, "ProcessorStepOutputSchema", {
|
|
84
|
+
enumerable: true,
|
|
85
|
+
get: function () { return chunk52RSUALV_cjs.ProcessorStepOutputSchema; }
|
|
86
|
+
});
|
|
87
|
+
Object.defineProperty(exports, "ProcessorStepSchema", {
|
|
88
|
+
enumerable: true,
|
|
89
|
+
get: function () { return chunk52RSUALV_cjs.ProcessorStepSchema; }
|
|
34
90
|
});
|
|
35
91
|
Object.defineProperty(exports, "PromptInjectionDetector", {
|
|
36
92
|
enumerable: true,
|
|
37
|
-
get: function () { return
|
|
93
|
+
get: function () { return chunk52RSUALV_cjs.PromptInjectionDetector; }
|
|
94
|
+
});
|
|
95
|
+
Object.defineProperty(exports, "ReasoningPartSchema", {
|
|
96
|
+
enumerable: true,
|
|
97
|
+
get: function () { return chunk52RSUALV_cjs.ReasoningPartSchema; }
|
|
38
98
|
});
|
|
39
99
|
Object.defineProperty(exports, "SemanticRecall", {
|
|
40
100
|
enumerable: true,
|
|
41
|
-
get: function () { return
|
|
101
|
+
get: function () { return chunk52RSUALV_cjs.SemanticRecall; }
|
|
102
|
+
});
|
|
103
|
+
Object.defineProperty(exports, "SourcePartSchema", {
|
|
104
|
+
enumerable: true,
|
|
105
|
+
get: function () { return chunk52RSUALV_cjs.SourcePartSchema; }
|
|
106
|
+
});
|
|
107
|
+
Object.defineProperty(exports, "StepStartPartSchema", {
|
|
108
|
+
enumerable: true,
|
|
109
|
+
get: function () { return chunk52RSUALV_cjs.StepStartPartSchema; }
|
|
42
110
|
});
|
|
43
111
|
Object.defineProperty(exports, "StructuredOutputProcessor", {
|
|
44
112
|
enumerable: true,
|
|
45
|
-
get: function () { return
|
|
113
|
+
get: function () { return chunk52RSUALV_cjs.StructuredOutputProcessor; }
|
|
46
114
|
});
|
|
47
115
|
Object.defineProperty(exports, "SystemPromptScrubber", {
|
|
48
116
|
enumerable: true,
|
|
49
|
-
get: function () { return
|
|
117
|
+
get: function () { return chunk52RSUALV_cjs.SystemPromptScrubber; }
|
|
118
|
+
});
|
|
119
|
+
Object.defineProperty(exports, "TextPartSchema", {
|
|
120
|
+
enumerable: true,
|
|
121
|
+
get: function () { return chunk52RSUALV_cjs.TextPartSchema; }
|
|
50
122
|
});
|
|
51
123
|
Object.defineProperty(exports, "TokenLimiter", {
|
|
52
124
|
enumerable: true,
|
|
53
|
-
get: function () { return
|
|
125
|
+
get: function () { return chunk52RSUALV_cjs.TokenLimiterProcessor; }
|
|
54
126
|
});
|
|
55
127
|
Object.defineProperty(exports, "TokenLimiterProcessor", {
|
|
56
128
|
enumerable: true,
|
|
57
|
-
get: function () { return
|
|
129
|
+
get: function () { return chunk52RSUALV_cjs.TokenLimiterProcessor; }
|
|
58
130
|
});
|
|
59
131
|
Object.defineProperty(exports, "ToolCallFilter", {
|
|
60
132
|
enumerable: true,
|
|
61
|
-
get: function () { return
|
|
133
|
+
get: function () { return chunk52RSUALV_cjs.ToolCallFilter; }
|
|
134
|
+
});
|
|
135
|
+
Object.defineProperty(exports, "ToolInvocationPartSchema", {
|
|
136
|
+
enumerable: true,
|
|
137
|
+
get: function () { return chunk52RSUALV_cjs.ToolInvocationPartSchema; }
|
|
62
138
|
});
|
|
63
139
|
Object.defineProperty(exports, "UnicodeNormalizer", {
|
|
64
140
|
enumerable: true,
|
|
65
|
-
get: function () { return
|
|
141
|
+
get: function () { return chunk52RSUALV_cjs.UnicodeNormalizer; }
|
|
66
142
|
});
|
|
67
143
|
Object.defineProperty(exports, "WorkingMemory", {
|
|
68
144
|
enumerable: true,
|
|
69
|
-
get: function () { return
|
|
145
|
+
get: function () { return chunk52RSUALV_cjs.WorkingMemory; }
|
|
146
|
+
});
|
|
147
|
+
Object.defineProperty(exports, "isProcessorWorkflow", {
|
|
148
|
+
enumerable: true,
|
|
149
|
+
get: function () { return chunk52RSUALV_cjs.isProcessorWorkflow; }
|
|
70
150
|
});
|
|
71
151
|
//# sourceMappingURL=index.cjs.map
|
|
72
152
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,23 +1,39 @@
|
|
|
1
|
+
import type { LanguageModelV2, SharedV2ProviderOptions } from '@ai-sdk/provider-v5';
|
|
1
2
|
import type { CoreMessage as CoreMessageV4 } from '../ai-sdk.types.d.ts';
|
|
3
|
+
import type { CallSettings, StepResult, ToolChoice } from 'ai-v5';
|
|
2
4
|
import type { MessageList, MastraDBMessage } from '../agent/message-list/index.js';
|
|
5
|
+
import type { TripWireOptions } from '../agent/trip-wire.js';
|
|
6
|
+
import type { ModelRouterModelId } from '../llm/model/index.js';
|
|
7
|
+
import type { MastraLanguageModelV2, OpenAICompatibleConfig } from '../llm/model/shared.types.js';
|
|
3
8
|
import type { TracingContext } from '../observability/index.js';
|
|
4
9
|
import type { RequestContext } from '../request-context/index.js';
|
|
5
|
-
import type { ChunkType } from '../stream/index.js';
|
|
10
|
+
import type { ChunkType, OutputSchema } from '../stream/index.js';
|
|
11
|
+
import type { Workflow } from '../workflows/index.js';
|
|
12
|
+
import type { StructuredOutputOptions } from './processors/index.js';
|
|
6
13
|
/**
|
|
7
14
|
* Base context shared by all processor methods
|
|
8
15
|
*/
|
|
9
|
-
export interface ProcessorContext {
|
|
10
|
-
/**
|
|
11
|
-
|
|
16
|
+
export interface ProcessorContext<TTripwireMetadata = unknown> {
|
|
17
|
+
/**
|
|
18
|
+
* Function to abort processing with an optional reason and options.
|
|
19
|
+
* @param reason - The reason for aborting
|
|
20
|
+
* @param options - Options including retry flag and metadata
|
|
21
|
+
*/
|
|
22
|
+
abort: (reason?: string, options?: TripWireOptions<TTripwireMetadata>) => never;
|
|
12
23
|
/** Optional tracing context for observability */
|
|
13
24
|
tracingContext?: TracingContext;
|
|
14
25
|
/** Optional runtime context with execution metadata */
|
|
15
26
|
requestContext?: RequestContext;
|
|
27
|
+
/**
|
|
28
|
+
* Number of times processors have triggered retry for this generation.
|
|
29
|
+
* Use this to implement retry limits within your processor.
|
|
30
|
+
*/
|
|
31
|
+
retryCount: number;
|
|
16
32
|
}
|
|
17
33
|
/**
|
|
18
34
|
* Context for message-based processor methods (processInput, processOutputResult, processInputStep)
|
|
19
35
|
*/
|
|
20
|
-
export interface ProcessorMessageContext extends ProcessorContext {
|
|
36
|
+
export interface ProcessorMessageContext<TTripwireMetadata = unknown> extends ProcessorContext<TTripwireMetadata> {
|
|
21
37
|
/** The current messages being processed */
|
|
22
38
|
messages: MastraDBMessage[];
|
|
23
39
|
/** MessageList instance for managing message sources */
|
|
@@ -43,28 +59,87 @@ export type ProcessInputResult = MessageList | MastraDBMessage[] | ProcessInputR
|
|
|
43
59
|
/**
|
|
44
60
|
* Arguments for processInput method
|
|
45
61
|
*/
|
|
46
|
-
export interface ProcessInputArgs extends ProcessorMessageContext {
|
|
62
|
+
export interface ProcessInputArgs<TTripwireMetadata = unknown> extends ProcessorMessageContext<TTripwireMetadata> {
|
|
47
63
|
/** All system messages (agent instructions, user-provided, memory) for read/modify access */
|
|
48
64
|
systemMessages: CoreMessageV4[];
|
|
49
65
|
}
|
|
50
66
|
/**
|
|
51
67
|
* Arguments for processOutputResult method
|
|
52
68
|
*/
|
|
53
|
-
export interface ProcessOutputResultArgs extends ProcessorMessageContext {
|
|
69
|
+
export interface ProcessOutputResultArgs<TTripwireMetadata = unknown> extends ProcessorMessageContext<TTripwireMetadata> {
|
|
54
70
|
}
|
|
55
71
|
/**
|
|
56
72
|
* Arguments for processInputStep method
|
|
73
|
+
*
|
|
74
|
+
* Note: structuredOutput.schema is typed as OutputSchema (not the specific OUTPUT type) because
|
|
75
|
+
* processors run in a chain and any previous processor may have modified structuredOutput.
|
|
76
|
+
* The actual schema type is only known at the generate()/stream() call site.
|
|
57
77
|
*/
|
|
58
|
-
export interface ProcessInputStepArgs extends ProcessorMessageContext {
|
|
78
|
+
export interface ProcessInputStepArgs<TTripwireMetadata = unknown> extends ProcessorMessageContext<TTripwireMetadata> {
|
|
59
79
|
/** The current step number (0-indexed) */
|
|
60
80
|
stepNumber: number;
|
|
81
|
+
steps: Array<StepResult<any>>;
|
|
61
82
|
/** All system messages (agent instructions, user-provided, memory) for read/modify access */
|
|
62
83
|
systemMessages: CoreMessageV4[];
|
|
84
|
+
/**
|
|
85
|
+
* Current model for this step.
|
|
86
|
+
* Can be a resolved MastraLanguageModelV2 or an unresolved config (string, OpenAI-compatible config).
|
|
87
|
+
*/
|
|
88
|
+
model: MastraLanguageModelV2;
|
|
89
|
+
/** Current tools available for this step */
|
|
90
|
+
tools?: Record<string, unknown>;
|
|
91
|
+
toolChoice?: ToolChoice<any>;
|
|
92
|
+
activeTools?: string[];
|
|
93
|
+
providerOptions?: SharedV2ProviderOptions;
|
|
94
|
+
modelSettings?: Omit<CallSettings, 'abortSignal'>;
|
|
95
|
+
/**
|
|
96
|
+
* Structured output configuration. The schema type is OutputSchema (not the specific OUTPUT)
|
|
97
|
+
* because processors can modify it, and the actual type is only known at runtime.
|
|
98
|
+
*/
|
|
99
|
+
structuredOutput?: StructuredOutputOptions<OutputSchema>;
|
|
100
|
+
/**
|
|
101
|
+
* Number of times processors have triggered retry for this generation.
|
|
102
|
+
* Use this to implement retry limits within your processor.
|
|
103
|
+
*/
|
|
104
|
+
retryCount: number;
|
|
63
105
|
}
|
|
106
|
+
export type RunProcessInputStepArgs = Omit<ProcessInputStepArgs, 'messages' | 'systemMessages' | 'abort'>;
|
|
107
|
+
/**
|
|
108
|
+
* Result from processInputStep method
|
|
109
|
+
*
|
|
110
|
+
* Note: structuredOutput.schema is typed as OutputSchema (not the specific OUTPUT type) because
|
|
111
|
+
* processors can modify it dynamically, and the actual type is only known at runtime.
|
|
112
|
+
*/
|
|
113
|
+
export type ProcessInputStepResult = {
|
|
114
|
+
model?: LanguageModelV2 | ModelRouterModelId | OpenAICompatibleConfig | MastraLanguageModelV2;
|
|
115
|
+
/** Replace tools for this step - accepts both AI SDK tools and Mastra createTool results */
|
|
116
|
+
tools?: Record<string, unknown>;
|
|
117
|
+
toolChoice?: ToolChoice<any>;
|
|
118
|
+
activeTools?: string[];
|
|
119
|
+
messages?: MastraDBMessage[];
|
|
120
|
+
messageList?: MessageList;
|
|
121
|
+
/** Replace all system messages with these */
|
|
122
|
+
systemMessages?: CoreMessageV4[];
|
|
123
|
+
providerOptions?: SharedV2ProviderOptions;
|
|
124
|
+
modelSettings?: Omit<CallSettings, 'abortSignal'>;
|
|
125
|
+
/**
|
|
126
|
+
* Structured output configuration. The schema type is OutputSchema (not the specific OUTPUT)
|
|
127
|
+
* because processors can modify it, and the actual type is only known at runtime.
|
|
128
|
+
*/
|
|
129
|
+
structuredOutput?: StructuredOutputOptions<OutputSchema>;
|
|
130
|
+
/**
|
|
131
|
+
* Number of times processors have triggered retry for this generation.
|
|
132
|
+
* Use this to implement retry limits within your processor.
|
|
133
|
+
*/
|
|
134
|
+
retryCount?: number;
|
|
135
|
+
};
|
|
136
|
+
export type RunProcessInputStepResult = Omit<ProcessInputStepResult, 'model'> & {
|
|
137
|
+
model?: MastraLanguageModelV2;
|
|
138
|
+
};
|
|
64
139
|
/**
|
|
65
140
|
* Arguments for processOutputStream method
|
|
66
141
|
*/
|
|
67
|
-
export interface ProcessOutputStreamArgs extends ProcessorContext {
|
|
142
|
+
export interface ProcessOutputStreamArgs<TTripwireMetadata = unknown> extends ProcessorContext<TTripwireMetadata> {
|
|
68
143
|
/** The current chunk being processed */
|
|
69
144
|
part: ChunkType;
|
|
70
145
|
/** All chunks seen so far */
|
|
@@ -74,7 +149,37 @@ export interface ProcessOutputStreamArgs extends ProcessorContext {
|
|
|
74
149
|
/** Optional MessageList instance for accessing conversation history */
|
|
75
150
|
messageList?: MessageList;
|
|
76
151
|
}
|
|
77
|
-
|
|
152
|
+
/**
|
|
153
|
+
* Tool call information for processOutputStep
|
|
154
|
+
*/
|
|
155
|
+
export interface ToolCallInfo {
|
|
156
|
+
toolName: string;
|
|
157
|
+
toolCallId: string;
|
|
158
|
+
args: unknown;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Arguments for processOutputStep method.
|
|
162
|
+
* Called after each LLM response in the agentic loop, before tool execution.
|
|
163
|
+
*/
|
|
164
|
+
export interface ProcessOutputStepArgs<TTripwireMetadata = unknown> extends ProcessorMessageContext<TTripwireMetadata> {
|
|
165
|
+
/** The current step number (0-indexed) */
|
|
166
|
+
stepNumber: number;
|
|
167
|
+
/** The finish reason from the LLM (stop, tool-use, length, etc.) */
|
|
168
|
+
finishReason?: string;
|
|
169
|
+
/** Tool calls made in this step (if any) */
|
|
170
|
+
toolCalls?: ToolCallInfo[];
|
|
171
|
+
/** Generated text from this step */
|
|
172
|
+
text?: string;
|
|
173
|
+
/** All system messages */
|
|
174
|
+
systemMessages: CoreMessageV4[];
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Processor interface for transforming messages and stream chunks.
|
|
178
|
+
*
|
|
179
|
+
* @template TId - The processor's unique identifier type
|
|
180
|
+
* @template TTripwireMetadata - The type of metadata passed when calling abort()
|
|
181
|
+
*/
|
|
182
|
+
export interface Processor<TId extends string = string, TTripwireMetadata = unknown> {
|
|
78
183
|
readonly id: TId;
|
|
79
184
|
readonly name?: string;
|
|
80
185
|
/**
|
|
@@ -85,13 +190,13 @@ export interface Processor<TId extends string = string> {
|
|
|
85
190
|
* - MastraDBMessage[]: Transformed messages array (for simple transformations)
|
|
86
191
|
* - { messages, systemMessages }: Object with both messages and modified system messages
|
|
87
192
|
*/
|
|
88
|
-
processInput?(args: ProcessInputArgs): Promise<ProcessInputResult> | ProcessInputResult;
|
|
193
|
+
processInput?(args: ProcessInputArgs<TTripwireMetadata>): Promise<ProcessInputResult> | ProcessInputResult;
|
|
89
194
|
/**
|
|
90
195
|
* Process output stream chunks with built-in state management
|
|
91
196
|
* This allows processors to accumulate chunks and make decisions based on larger context
|
|
92
197
|
* Return null or undefined to skip emitting the part
|
|
93
198
|
*/
|
|
94
|
-
processOutputStream?(args: ProcessOutputStreamArgs): Promise<ChunkType | null | undefined>;
|
|
199
|
+
processOutputStream?(args: ProcessOutputStreamArgs<TTripwireMetadata>): Promise<ChunkType | null | undefined>;
|
|
95
200
|
/**
|
|
96
201
|
* Process the complete output result after streaming/generate is finished
|
|
97
202
|
*
|
|
@@ -99,24 +204,61 @@ export interface Processor<TId extends string = string> {
|
|
|
99
204
|
* - MessageList: The same messageList instance passed in (indicates you've mutated it)
|
|
100
205
|
* - MastraDBMessage[]: Transformed messages array (for simple transformations)
|
|
101
206
|
*/
|
|
102
|
-
processOutputResult?(args: ProcessOutputResultArgs): ProcessorMessageResult;
|
|
207
|
+
processOutputResult?(args: ProcessOutputResultArgs<TTripwireMetadata>): ProcessorMessageResult;
|
|
103
208
|
/**
|
|
104
209
|
* Process input messages at each step of the agentic loop, before they are sent to the LLM.
|
|
105
210
|
* Unlike processInput which runs once at the start, this runs at every step (including tool call continuations).
|
|
106
211
|
*
|
|
107
212
|
* @returns Either:
|
|
213
|
+
* - ProcessInputStepResult object with model, toolChoice, messages, etc.
|
|
214
|
+
* - MessageList: The same messageList instance passed in (indicates you've mutated it)
|
|
215
|
+
* - MastraDBMessage[]: Transformed messages array (for simple transformations)
|
|
216
|
+
* - undefined/void: No changes
|
|
217
|
+
*/
|
|
218
|
+
processInputStep?(args: ProcessInputStepArgs<TTripwireMetadata>): Promise<ProcessInputStepResult | MessageList | MastraDBMessage[] | undefined | void> | ProcessInputStepResult | MessageList | MastraDBMessage[] | void | undefined;
|
|
219
|
+
/**
|
|
220
|
+
* Process output after each LLM response in the agentic loop, before tool execution.
|
|
221
|
+
* Unlike processOutputResult which runs once at the end, this runs at every step.
|
|
222
|
+
*
|
|
223
|
+
* This is the ideal place to implement guardrails that can trigger retries:
|
|
224
|
+
* - Validate tone, format, or content of LLM responses
|
|
225
|
+
* - Check for policy violations before tools are executed
|
|
226
|
+
* - Implement self-correction by calling abort({ retry: true })
|
|
227
|
+
*
|
|
228
|
+
* @returns Either:
|
|
108
229
|
* - MessageList: The same messageList instance passed in (indicates you've mutated it)
|
|
109
230
|
* - MastraDBMessage[]: Transformed messages array (for simple transformations)
|
|
110
231
|
*/
|
|
111
|
-
|
|
232
|
+
processOutputStep?(args: ProcessOutputStepArgs<TTripwireMetadata>): ProcessorMessageResult;
|
|
112
233
|
}
|
|
113
234
|
type WithRequired<T, K extends keyof T> = T & {
|
|
114
235
|
[P in K]-?: NonNullable<T[P]>;
|
|
115
236
|
};
|
|
116
|
-
export type InputProcessor = (WithRequired<Processor, 'id' | 'processInput'> & Processor) | (WithRequired<Processor, 'id' | 'processInputStep'> & Processor);
|
|
117
|
-
export type OutputProcessor = (WithRequired<Processor, 'id' | 'processOutputStream'> & Processor) | (WithRequired<Processor, 'id' | 'processOutputResult'> & Processor);
|
|
118
|
-
export type ProcessorTypes = InputProcessor | OutputProcessor
|
|
237
|
+
export type InputProcessor<TTripwireMetadata = unknown> = (WithRequired<Processor<string, TTripwireMetadata>, 'id' | 'processInput'> & Processor<string, TTripwireMetadata>) | (WithRequired<Processor<string, TTripwireMetadata>, 'id' | 'processInputStep'> & Processor<string, TTripwireMetadata>);
|
|
238
|
+
export type OutputProcessor<TTripwireMetadata = unknown> = (WithRequired<Processor<string, TTripwireMetadata>, 'id' | 'processOutputStream'> & Processor<string, TTripwireMetadata>) | (WithRequired<Processor<string, TTripwireMetadata>, 'id' | 'processOutputResult'> & Processor<string, TTripwireMetadata>) | (WithRequired<Processor<string, TTripwireMetadata>, 'id' | 'processOutputStep'> & Processor<string, TTripwireMetadata>);
|
|
239
|
+
export type ProcessorTypes<TTripwireMetadata = unknown> = InputProcessor<TTripwireMetadata> | OutputProcessor<TTripwireMetadata>;
|
|
240
|
+
/**
|
|
241
|
+
* A Workflow that can be used as a processor.
|
|
242
|
+
* The workflow must accept ProcessorStepInput and return ProcessorStepOutput.
|
|
243
|
+
*/
|
|
244
|
+
export type ProcessorWorkflow = Workflow<any, any, string, any, any, any>;
|
|
245
|
+
/**
|
|
246
|
+
* Input processor config: can be a Processor or a Workflow.
|
|
247
|
+
*/
|
|
248
|
+
export type InputProcessorOrWorkflow<TTripwireMetadata = unknown> = InputProcessor<TTripwireMetadata> | ProcessorWorkflow;
|
|
249
|
+
/**
|
|
250
|
+
* Output processor config: can be a Processor or a Workflow.
|
|
251
|
+
*/
|
|
252
|
+
export type OutputProcessorOrWorkflow<TTripwireMetadata = unknown> = OutputProcessor<TTripwireMetadata> | ProcessorWorkflow;
|
|
253
|
+
/**
|
|
254
|
+
* Type guard to check if an object is a Workflow that can be used as a processor.
|
|
255
|
+
* A ProcessorWorkflow must have 'id', 'inputSchema', 'outputSchema', and 'execute' properties.
|
|
256
|
+
*/
|
|
257
|
+
export declare function isProcessorWorkflow(obj: unknown): obj is ProcessorWorkflow;
|
|
119
258
|
export * from './processors/index.js';
|
|
120
259
|
export { ProcessorState, ProcessorRunner } from './runner.js';
|
|
121
260
|
export * from './memory/index.js';
|
|
261
|
+
export type { TripWireOptions } from '../agent/trip-wire.js';
|
|
262
|
+
export { ProcessorStepSchema, ProcessorStepInputSchema, ProcessorStepOutputSchema, ProcessorInputPhaseSchema, ProcessorInputStepPhaseSchema, ProcessorOutputStreamPhaseSchema, ProcessorOutputResultPhaseSchema, ProcessorOutputStepPhaseSchema, ProcessorMessageSchema, ProcessorMessageContentSchema, MessageContentSchema, MessagePartSchema, TextPartSchema, ImagePartSchema, FilePartSchema, ToolInvocationPartSchema, ReasoningPartSchema, SourcePartSchema, StepStartPartSchema, } from './step-schema.js';
|
|
263
|
+
export type { ProcessorStepData, ProcessorStepDataFlexible, ProcessorStepInput, ProcessorStepOutput, ProcessorMessage, MessageContent, MessagePart, } from './step-schema.js';
|
|
122
264
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/processors/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,IAAI,aAAa,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/processors/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AACpF,OAAO,KAAK,EAAE,WAAW,IAAI,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAClE,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC1E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,KAAK,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAC/F,OAAO,KAAK,EAAE,cAAc,E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;GAEG;AACH,MAAM,MAAM,wBAAwB,CAAC,iBAAiB,GAAG,OAAO,IAC5D,cAAc,CAAC,iBAAiB,CAAC,GACjC,iBAAiB,CAAC;AAEtB;;GAEG;AACH,MAAM,MAAM,yBAAyB,CAAC,iBAAiB,GAAG,OAAO,IAC7D,eAAe,CAAC,iBAAiB,CAAC,GAClC,iBAAiB,CAAC;AAEtB;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,iBAAiB,CAiB1E;AAED,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3D,cAAc,UAAU,CAAC;AACzB,YAAY,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EACL,mBAAmB,EACnB,wBAAwB,EACxB,yBAAyB,EAEzB,yBAAyB,EACzB,6BAA6B,EAC7B,gCAAgC,EAChC,gCAAgC,EAChC,8BAA8B,EAE9B,sBAAsB,EACtB,6BAA6B,EAC7B,oBAAoB,EAEpB,iBAAiB,EACjB,cAAc,EACd,eAAe,EACf,cAAc,EACd,wBAAwB,EACxB,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,eAAe,CAAC;AACvB,YAAY,EACV,iBAAiB,EACjB,yBAAyB,EACzB,kBAAkB,EAClB,mBAAmB,EAEnB,gBAAgB,EAChB,cAAc,EACd,WAAW,GACZ,MAAM,eAAe,CAAC"}
|
package/dist/processors/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { BatchPartsProcessor, LanguageDetector, MessageHistory, ModerationProcessor, PIIDetector, ProcessorRunner, ProcessorState, PromptInjectionDetector, SemanticRecall, StructuredOutputProcessor, SystemPromptScrubber, TokenLimiterProcessor as TokenLimiter, TokenLimiterProcessor, ToolCallFilter, UnicodeNormalizer, WorkingMemory } from '../chunk-
|
|
1
|
+
export { BatchPartsProcessor, FilePartSchema, ImagePartSchema, LanguageDetector, MessageContentSchema, MessageHistory, MessagePartSchema, ModerationProcessor, PIIDetector, ProcessorInputPhaseSchema, ProcessorInputStepPhaseSchema, ProcessorMessageContentSchema, ProcessorMessageSchema, ProcessorOutputResultPhaseSchema, ProcessorOutputStepPhaseSchema, ProcessorOutputStreamPhaseSchema, ProcessorRunner, ProcessorState, ProcessorStepInputSchema, ProcessorStepOutputSchema, ProcessorStepSchema, PromptInjectionDetector, ReasoningPartSchema, SemanticRecall, SourcePartSchema, StepStartPartSchema, StructuredOutputProcessor, SystemPromptScrubber, TextPartSchema, TokenLimiterProcessor as TokenLimiter, TokenLimiterProcessor, ToolCallFilter, ToolInvocationPartSchema, UnicodeNormalizer, WorkingMemory, isProcessorWorkflow } from '../chunk-2ULLRN4Y.js';
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { PrepareStepFunction } from '../../loop/types.js';
|
|
2
|
+
import type { ProcessInputStepArgs, ProcessInputStepResult, Processor } from '../index.js';
|
|
3
|
+
export declare class PrepareStepProcessor implements Processor<'prepare-step'> {
|
|
4
|
+
readonly id = "prepare-step";
|
|
5
|
+
readonly name = "Prepare Step Processor";
|
|
6
|
+
private prepareStep;
|
|
7
|
+
constructor(options: {
|
|
8
|
+
prepareStep: PrepareStepFunction;
|
|
9
|
+
});
|
|
10
|
+
processInputStep(args: ProcessInputStepArgs): Promise<ProcessInputStepResult | undefined | void>;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=prepare-step.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prepare-step.d.ts","sourceRoot":"","sources":["../../../src/processors/processors/prepare-step.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,KAAK,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAExF,qBAAa,oBAAqB,YAAW,SAAS,CAAC,cAAc,CAAC;IACpE,QAAQ,CAAC,EAAE,kBAAkB;IAC7B,QAAQ,CAAC,IAAI,4BAA4B;IAEzC,OAAO,CAAC,WAAW,CAAsB;gBAE7B,OAAO,EAAE;QAAE,WAAW,EAAE,mBAAmB,CAAA;KAAE;IAInD,gBAAgB,CAAC,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,sBAAsB,GAAG,SAAS,GAAG,IAAI,CAAC;CAGvG"}
|
|
@@ -31,11 +31,12 @@ export declare class StructuredOutputProcessor<OUTPUT extends OutputSchema> impl
|
|
|
31
31
|
processOutputStream(args: {
|
|
32
32
|
part: ChunkType;
|
|
33
33
|
streamParts: ChunkType[];
|
|
34
|
-
state: {
|
|
35
|
-
controller
|
|
34
|
+
state: Record<string, unknown> & {
|
|
35
|
+
controller?: TransformStreamDefaultController<ChunkType<OUTPUT>>;
|
|
36
36
|
};
|
|
37
|
-
abort: (reason?: string) => never;
|
|
37
|
+
abort: (reason?: string, options?: unknown) => never;
|
|
38
38
|
tracingContext?: TracingContext;
|
|
39
|
+
retryCount: number;
|
|
39
40
|
}): Promise<ChunkType | null | undefined>;
|
|
40
41
|
private processAndEmitStructuredOutput;
|
|
41
42
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"structured-output.d.ts","sourceRoot":"","sources":["../../../src/processors/processors/structured-output.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,iBAAiB,CAAC;AAExE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAGjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAG5D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C,Y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