@mastra/core 0.15.3-alpha.4 → 0.15.3-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +3188 -0
- package/dist/agent/index.cjs +8 -8
- package/dist/agent/index.js +1 -1
- package/dist/agent/input-processor/index.cjs +6 -6
- package/dist/agent/input-processor/index.js +1 -1
- package/dist/{chunk-P2IJ74UW.js → chunk-23NO6AMW.js} +69 -6
- package/dist/chunk-23NO6AMW.js.map +1 -0
- package/dist/{chunk-YAWYQH3N.js → chunk-2L6PFHHU.js} +3 -3
- package/dist/{chunk-YAWYQH3N.js.map → chunk-2L6PFHHU.js.map} +1 -1
- package/dist/{chunk-YVIYEC6R.js → chunk-A5NC3XK2.js} +3 -3
- package/dist/{chunk-YVIYEC6R.js.map → chunk-A5NC3XK2.js.map} +1 -1
- package/dist/{chunk-DZADAEAF.cjs → chunk-E264YNL3.cjs} +4 -4
- package/dist/{chunk-DZADAEAF.cjs.map → chunk-E264YNL3.cjs.map} +1 -1
- package/dist/{chunk-KUNWELBC.cjs → chunk-JQKPRJCJ.cjs} +69 -6
- package/dist/chunk-JQKPRJCJ.cjs.map +1 -0
- package/dist/{chunk-W5CF7DLB.cjs → chunk-MVEPSGWQ.cjs} +8 -8
- package/dist/chunk-MVEPSGWQ.cjs.map +1 -0
- package/dist/{chunk-FQRDHVZC.cjs → chunk-OBKBA6CO.cjs} +4 -4
- package/dist/{chunk-FQRDHVZC.cjs.map → chunk-OBKBA6CO.cjs.map} +1 -1
- package/dist/{chunk-OFPVAPUH.js → chunk-PQ3VP6NG.js} +4 -4
- package/dist/chunk-PQ3VP6NG.js.map +1 -0
- package/dist/index.cjs +17 -17
- package/dist/index.js +4 -4
- package/dist/loop/index.cjs +2 -2
- package/dist/loop/index.js +1 -1
- package/dist/mastra/index.cjs +2 -2
- package/dist/mastra/index.js +1 -1
- package/dist/network/index.cjs +2 -2
- package/dist/network/index.js +1 -1
- package/dist/network/vNext/index.cjs +12 -12
- package/dist/network/vNext/index.js +1 -1
- package/dist/processors/index.cjs +8 -8
- package/dist/processors/index.js +2 -2
- 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 +1 -1
- package/dist/storage/domains/workflows/inmemory.d.ts +1 -1
- package/dist/storage/domains/workflows/inmemory.d.ts.map +1 -1
- package/dist/storage/index.cjs +10 -11
- package/dist/storage/index.cjs.map +1 -1
- package/dist/storage/index.js +10 -11
- package/dist/storage/index.js.map +1 -1
- package/dist/stream/index.cjs +3 -3
- package/dist/stream/index.js +1 -1
- package/dist/workflows/evented/index.cjs +10 -10
- package/dist/workflows/evented/index.js +1 -1
- package/dist/workflows/index.cjs +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/dist/workflows/workflow.d.ts +8 -3
- package/dist/workflows/workflow.d.ts.map +1 -1
- package/package.json +14 -4
- package/dist/chunk-KUNWELBC.cjs.map +0 -1
- package/dist/chunk-OFPVAPUH.js.map +0 -1
- package/dist/chunk-P2IJ74UW.js.map +0 -1
- package/dist/chunk-W5CF7DLB.cjs.map +0 -1
package/dist/agent/index.cjs
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkJQKPRJCJ_cjs = require('../chunk-JQKPRJCJ.cjs');
|
|
4
4
|
var chunk5CJDO3UO_cjs = require('../chunk-5CJDO3UO.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
Object.defineProperty(exports, "Agent", {
|
|
9
9
|
enumerable: true,
|
|
10
|
-
get: function () { return
|
|
10
|
+
get: function () { return chunkJQKPRJCJ_cjs.Agent; }
|
|
11
11
|
});
|
|
12
12
|
Object.defineProperty(exports, "LanguageDetectorInputProcessor", {
|
|
13
13
|
enumerable: true,
|
|
14
|
-
get: function () { return
|
|
14
|
+
get: function () { return chunkJQKPRJCJ_cjs.LanguageDetectorInputProcessor; }
|
|
15
15
|
});
|
|
16
16
|
Object.defineProperty(exports, "ModerationInputProcessor", {
|
|
17
17
|
enumerable: true,
|
|
18
|
-
get: function () { return
|
|
18
|
+
get: function () { return chunkJQKPRJCJ_cjs.ModerationInputProcessor; }
|
|
19
19
|
});
|
|
20
20
|
Object.defineProperty(exports, "PIIDetectorInputProcessor", {
|
|
21
21
|
enumerable: true,
|
|
22
|
-
get: function () { return
|
|
22
|
+
get: function () { return chunkJQKPRJCJ_cjs.PIIDetectorInputProcessor; }
|
|
23
23
|
});
|
|
24
24
|
Object.defineProperty(exports, "PromptInjectionDetectorInputProcessor", {
|
|
25
25
|
enumerable: true,
|
|
26
|
-
get: function () { return
|
|
26
|
+
get: function () { return chunkJQKPRJCJ_cjs.PromptInjectionDetectorInputProcessor; }
|
|
27
27
|
});
|
|
28
28
|
Object.defineProperty(exports, "TripWire", {
|
|
29
29
|
enumerable: true,
|
|
30
|
-
get: function () { return
|
|
30
|
+
get: function () { return chunkJQKPRJCJ_cjs.TripWire; }
|
|
31
31
|
});
|
|
32
32
|
Object.defineProperty(exports, "UnicodeNormalizerInputProcessor", {
|
|
33
33
|
enumerable: true,
|
|
34
|
-
get: function () { return
|
|
34
|
+
get: function () { return chunkJQKPRJCJ_cjs.UnicodeNormalizerInputProcessor; }
|
|
35
35
|
});
|
|
36
36
|
Object.defineProperty(exports, "MessageList", {
|
|
37
37
|
enumerable: true,
|
package/dist/agent/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { Agent, LanguageDetectorInputProcessor, ModerationInputProcessor, PIIDetectorInputProcessor, PromptInjectionDetectorInputProcessor, TripWire, UnicodeNormalizerInputProcessor } from '../chunk-
|
|
1
|
+
export { Agent, LanguageDetectorInputProcessor, ModerationInputProcessor, PIIDetectorInputProcessor, PromptInjectionDetectorInputProcessor, TripWire, UnicodeNormalizerInputProcessor } from '../chunk-23NO6AMW.js';
|
|
2
2
|
export { MessageList, convertMessages } from '../chunk-F4SQXAXR.js';
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkJQKPRJCJ_cjs = require('../../chunk-JQKPRJCJ.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
Object.defineProperty(exports, "LanguageDetectorInputProcessor", {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: function () { return
|
|
9
|
+
get: function () { return chunkJQKPRJCJ_cjs.LanguageDetectorInputProcessor; }
|
|
10
10
|
});
|
|
11
11
|
Object.defineProperty(exports, "ModerationInputProcessor", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunkJQKPRJCJ_cjs.ModerationInputProcessor; }
|
|
14
14
|
});
|
|
15
15
|
Object.defineProperty(exports, "PIIDetectorInputProcessor", {
|
|
16
16
|
enumerable: true,
|
|
17
|
-
get: function () { return
|
|
17
|
+
get: function () { return chunkJQKPRJCJ_cjs.PIIDetectorInputProcessor; }
|
|
18
18
|
});
|
|
19
19
|
Object.defineProperty(exports, "PromptInjectionDetectorInputProcessor", {
|
|
20
20
|
enumerable: true,
|
|
21
|
-
get: function () { return
|
|
21
|
+
get: function () { return chunkJQKPRJCJ_cjs.PromptInjectionDetectorInputProcessor; }
|
|
22
22
|
});
|
|
23
23
|
Object.defineProperty(exports, "UnicodeNormalizerInputProcessor", {
|
|
24
24
|
enumerable: true,
|
|
25
|
-
get: function () { return
|
|
25
|
+
get: function () { return chunkJQKPRJCJ_cjs.UnicodeNormalizerInputProcessor; }
|
|
26
26
|
});
|
|
27
27
|
//# sourceMappingURL=index.cjs.map
|
|
28
28
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { LanguageDetectorInputProcessor, ModerationInputProcessor, PIIDetectorInputProcessor, PromptInjectionDetectorInputProcessor, UnicodeNormalizerInputProcessor } from '../../chunk-
|
|
1
|
+
export { LanguageDetectorInputProcessor, ModerationInputProcessor, PIIDetectorInputProcessor, PromptInjectionDetectorInputProcessor, UnicodeNormalizerInputProcessor } from '../../chunk-23NO6AMW.js';
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
|
@@ -14964,7 +14964,7 @@ var Workflow = class extends MastraBase {
|
|
|
14964
14964
|
cleanup: () => this.#runs.delete(runIdToUse)
|
|
14965
14965
|
});
|
|
14966
14966
|
this.#runs.set(runIdToUse, run);
|
|
14967
|
-
const workflowSnapshotInStorage = await this.getWorkflowRunExecutionResult(runIdToUse);
|
|
14967
|
+
const workflowSnapshotInStorage = await this.getWorkflowRunExecutionResult(runIdToUse, false);
|
|
14968
14968
|
if (!workflowSnapshotInStorage) {
|
|
14969
14969
|
await this.mastra?.getStorage()?.persistWorkflowSnapshot({
|
|
14970
14970
|
workflowName: this.id,
|
|
@@ -15011,6 +15011,7 @@ var Workflow = class extends MastraBase {
|
|
|
15011
15011
|
return scorers;
|
|
15012
15012
|
}
|
|
15013
15013
|
async execute({
|
|
15014
|
+
runId,
|
|
15014
15015
|
inputData,
|
|
15015
15016
|
resumeData,
|
|
15016
15017
|
suspend,
|
|
@@ -15027,7 +15028,9 @@ var Workflow = class extends MastraBase {
|
|
|
15027
15028
|
const isResume = !!(resume?.steps && resume.steps.length > 0);
|
|
15028
15029
|
const run = isResume ? await this.createRunAsync({
|
|
15029
15030
|
runId: resume.runId
|
|
15030
|
-
}) : await this.createRunAsync(
|
|
15031
|
+
}) : await this.createRunAsync({
|
|
15032
|
+
runId
|
|
15033
|
+
});
|
|
15031
15034
|
const nestedAbortCb = () => {
|
|
15032
15035
|
abort();
|
|
15033
15036
|
};
|
|
@@ -15118,7 +15121,63 @@ var Workflow = class extends MastraBase {
|
|
|
15118
15121
|
workflowName: this.id
|
|
15119
15122
|
} : null);
|
|
15120
15123
|
}
|
|
15121
|
-
async
|
|
15124
|
+
async getWorkflowRunSteps({
|
|
15125
|
+
runId,
|
|
15126
|
+
workflowId
|
|
15127
|
+
}) {
|
|
15128
|
+
const storage = this.#mastra?.getStorage();
|
|
15129
|
+
if (!storage) {
|
|
15130
|
+
this.logger.debug("Cannot get workflow run steps. Mastra storage is not initialized");
|
|
15131
|
+
return {};
|
|
15132
|
+
}
|
|
15133
|
+
const run = await storage.getWorkflowRunById({
|
|
15134
|
+
runId,
|
|
15135
|
+
workflowName: workflowId
|
|
15136
|
+
});
|
|
15137
|
+
let snapshot = run?.snapshot;
|
|
15138
|
+
if (!snapshot) {
|
|
15139
|
+
return {};
|
|
15140
|
+
}
|
|
15141
|
+
if (typeof snapshot === "string") {
|
|
15142
|
+
try {
|
|
15143
|
+
snapshot = JSON.parse(snapshot);
|
|
15144
|
+
} catch (e) {
|
|
15145
|
+
this.logger.debug("Cannot get workflow run execution result. Snapshot is not a valid JSON string", e);
|
|
15146
|
+
return {};
|
|
15147
|
+
}
|
|
15148
|
+
}
|
|
15149
|
+
const {
|
|
15150
|
+
serializedStepGraph,
|
|
15151
|
+
context
|
|
15152
|
+
} = snapshot;
|
|
15153
|
+
const {
|
|
15154
|
+
input,
|
|
15155
|
+
...steps
|
|
15156
|
+
} = context;
|
|
15157
|
+
let finalSteps = {};
|
|
15158
|
+
for (const step of Object.keys(steps)) {
|
|
15159
|
+
const stepGraph = serializedStepGraph.find(stepGraph2 => stepGraph2?.step?.id === step);
|
|
15160
|
+
finalSteps[step] = steps[step];
|
|
15161
|
+
if (stepGraph && stepGraph?.step?.component === "WORKFLOW") {
|
|
15162
|
+
const nestedSteps = await this.getWorkflowRunSteps({
|
|
15163
|
+
runId,
|
|
15164
|
+
workflowId: step
|
|
15165
|
+
});
|
|
15166
|
+
if (nestedSteps) {
|
|
15167
|
+
const updatedNestedSteps = Object.entries(nestedSteps).reduce((acc, [key, value]) => {
|
|
15168
|
+
acc[`${step}.${key}`] = value;
|
|
15169
|
+
return acc;
|
|
15170
|
+
}, {});
|
|
15171
|
+
finalSteps = {
|
|
15172
|
+
...finalSteps,
|
|
15173
|
+
...updatedNestedSteps
|
|
15174
|
+
};
|
|
15175
|
+
}
|
|
15176
|
+
}
|
|
15177
|
+
}
|
|
15178
|
+
return finalSteps;
|
|
15179
|
+
}
|
|
15180
|
+
async getWorkflowRunExecutionResult(runId, withNestedWorkflows = true) {
|
|
15122
15181
|
const storage = this.#mastra?.getStorage();
|
|
15123
15182
|
if (!storage) {
|
|
15124
15183
|
this.logger.debug("Cannot get workflow run execution result. Mastra storage is not initialized");
|
|
@@ -15140,12 +15199,16 @@ var Workflow = class extends MastraBase {
|
|
|
15140
15199
|
return null;
|
|
15141
15200
|
}
|
|
15142
15201
|
}
|
|
15202
|
+
const fullSteps = withNestedWorkflows ? await this.getWorkflowRunSteps({
|
|
15203
|
+
runId,
|
|
15204
|
+
workflowId: this.id
|
|
15205
|
+
}) : snapshot.context;
|
|
15143
15206
|
return {
|
|
15144
15207
|
status: snapshot.status,
|
|
15145
15208
|
result: snapshot.result,
|
|
15146
15209
|
error: snapshot.error,
|
|
15147
15210
|
payload: snapshot.context?.input,
|
|
15148
|
-
steps:
|
|
15211
|
+
steps: fullSteps
|
|
15149
15212
|
};
|
|
15150
15213
|
}
|
|
15151
15214
|
};
|
|
@@ -15652,5 +15715,5 @@ function deepMergeWorkflowState(a, b) {
|
|
|
15652
15715
|
}
|
|
15653
15716
|
|
|
15654
15717
|
export { AISDKV5OutputStream, Agent, DefaultExecutionEngine, ExecutionEngine, LanguageDetector, LanguageDetectorInputProcessor, LegacyStep, LegacyWorkflow, MastraModelOutput, ModerationInputProcessor, ModerationProcessor, PIIDetector, PIIDetectorInputProcessor, PromptInjectionDetector, PromptInjectionDetectorInputProcessor, Run, StructuredOutputProcessor, TripWire, UnicodeNormalizer, UnicodeNormalizerInputProcessor, WhenConditionReturnValue, Workflow, agentToStep, cloneStep, cloneWorkflow, createStep, createWorkflow, getActivePathsAndStatus, getResultActivePaths, getStepResult, getSuspendedPaths, isAgent, isConditionalKey, isErrorEvent, isFinalState, isLimboState, isTransitionEvent, isVariableReference, isWorkflow, loop, mapVariable, mergeChildValue, recursivelyCheckForFinalState, resolveVariables, updateStepInHierarchy, workflowToStep };
|
|
15655
|
-
//# sourceMappingURL=chunk-
|
|
15656
|
-
//# sourceMappingURL=chunk-
|
|
15718
|
+
//# sourceMappingURL=chunk-23NO6AMW.js.map
|
|
15719
|
+
//# sourceMappingURL=chunk-23NO6AMW.js.map
|