@mastra/core 0.9.2-alpha.0 → 0.9.2-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent/index.cjs +2 -2
- package/dist/agent/index.d.cts +1 -1
- package/dist/agent/index.d.ts +1 -1
- package/dist/agent/index.js +1 -1
- package/dist/{base-DI6ChaUK.d.cts → base-BZxFAZ3-.d.cts} +27 -3
- package/dist/{base-bWFiU8RL.d.ts → base-uXj2cuRo.d.ts} +27 -3
- package/dist/{chunk-H2UWWO4L.js → chunk-6YY6MN2Z.js} +9 -5
- package/dist/{chunk-MAWT75XY.cjs → chunk-B7N24G5E.cjs} +2 -2
- package/dist/{chunk-7JRVDC7F.cjs → chunk-D2Y3ET63.cjs} +0 -91
- package/dist/{chunk-ZWALP7T2.cjs → chunk-EIMOKGTI.cjs} +2 -2
- package/dist/{chunk-SHDPMWGJ.js → chunk-IBKW4TJU.js} +1 -1
- package/dist/{chunk-33XQ5DGU.cjs → chunk-OPUU4S32.cjs} +5 -5
- package/dist/{chunk-YEA2KXXJ.js → chunk-QV4ZJLWA.js} +1 -1
- package/dist/{chunk-VI3IQINW.cjs → chunk-RSPHEENE.cjs} +45 -7
- package/dist/{chunk-FA7FWCKH.js → chunk-VQ7AM4ZV.js} +1 -1
- package/dist/{chunk-7PRLYMXV.cjs → chunk-VXUCE4GF.cjs} +20 -16
- package/dist/{chunk-INXNZ5VE.js → chunk-Z3OKCJ62.js} +41 -3
- package/dist/{chunk-KYULILA6.js → chunk-Z4MZ3ZUM.js} +1 -1
- package/dist/{chunk-JSUPD5IG.js → chunk-ZCJJ6XOH.js} +1 -90
- package/dist/{chunk-CFWUR4PX.cjs → chunk-ZVBLRU4W.cjs} +5 -5
- package/dist/eval/index.d.cts +1 -1
- package/dist/eval/index.d.ts +1 -1
- package/dist/index.cjs +50 -58
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +9 -9
- package/dist/integration/index.cjs +3 -3
- package/dist/integration/index.d.cts +1 -1
- package/dist/integration/index.d.ts +1 -1
- package/dist/integration/index.js +1 -1
- package/dist/llm/index.d.cts +1 -1
- package/dist/llm/index.d.ts +1 -1
- package/dist/mastra/index.cjs +2 -2
- package/dist/mastra/index.d.cts +1 -1
- package/dist/mastra/index.d.ts +1 -1
- package/dist/mastra/index.js +1 -1
- package/dist/memory/index.cjs +4 -4
- package/dist/memory/index.d.cts +1 -1
- package/dist/memory/index.d.ts +1 -1
- package/dist/memory/index.js +1 -1
- package/dist/network/index.cjs +4 -4
- package/dist/network/index.d.cts +1 -1
- package/dist/network/index.d.ts +1 -1
- package/dist/network/index.js +2 -2
- package/dist/relevance/index.cjs +4 -4
- package/dist/relevance/index.d.cts +1 -1
- package/dist/relevance/index.d.ts +1 -1
- package/dist/relevance/index.js +1 -1
- package/dist/server/index.d.cts +1 -1
- package/dist/server/index.d.ts +1 -1
- package/dist/storage/index.d.cts +1 -1
- package/dist/storage/index.d.ts +1 -1
- package/dist/storage/libsql/index.cjs +15 -1
- package/dist/storage/libsql/index.d.cts +4 -2
- package/dist/storage/libsql/index.d.ts +4 -2
- package/dist/storage/libsql/index.js +15 -1
- package/dist/telemetry/index.d.cts +1 -1
- package/dist/telemetry/index.d.ts +1 -1
- package/dist/tools/index.cjs +4 -4
- package/dist/tools/index.d.cts +1 -1
- package/dist/tools/index.d.ts +1 -1
- package/dist/tools/index.js +1 -1
- package/dist/utils.cjs +12 -20
- package/dist/utils.d.cts +3 -5
- package/dist/utils.d.ts +3 -5
- package/dist/utils.js +1 -1
- package/dist/voice/index.d.cts +1 -1
- package/dist/voice/index.d.ts +1 -1
- package/dist/workflows/index.cjs +22 -22
- package/dist/workflows/index.d.cts +2 -2
- package/dist/workflows/index.d.ts +2 -2
- package/dist/workflows/index.js +1 -1
- package/dist/workflows/vNext/index.cjs +6 -6
- package/dist/workflows/vNext/index.d.cts +2 -2
- package/dist/workflows/vNext/index.d.ts +2 -2
- package/dist/workflows/vNext/index.js +4 -4
- package/package.json +1 -1
- /package/dist/{chunk-7ZR64JAJ.js → chunk-2IXADNQJ.js} +0 -0
- /package/dist/{chunk-ZKRQS3N5.cjs → chunk-AVAHVCWY.cjs} +0 -0
package/dist/agent/index.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkVXUCE4GF_cjs = require('../chunk-VXUCE4GF.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
Object.defineProperty(exports, "Agent", {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: function () { return
|
|
9
|
+
get: function () { return chunkVXUCE4GF_cjs.Agent; }
|
|
10
10
|
});
|
package/dist/agent/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { Message as AiMessageType } from 'ai';
|
|
2
2
|
import 'json-schema';
|
|
3
3
|
import 'zod';
|
|
4
|
-
export { D as Agent, F as AgentConfig, bd as AgentGenerateOptions, be as AgentStreamOptions, bc as DynamicArgument, b0 as MastraLanguageModel, b1 as ToolsInput, bb as ToolsetsInput } from '../base-
|
|
4
|
+
export { D as Agent, F as AgentConfig, bd as AgentGenerateOptions, be as AgentStreamOptions, bc as DynamicArgument, b0 as MastraLanguageModel, b1 as ToolsInput, bb as ToolsetsInput } from '../base-BZxFAZ3-.cjs';
|
|
5
5
|
import '../base-BihKcqDY.cjs';
|
|
6
6
|
import '../types-BtMyV38I.cjs';
|
|
7
7
|
import '../runtime-context/index.cjs';
|
package/dist/agent/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { Message as AiMessageType } from 'ai';
|
|
2
2
|
import 'json-schema';
|
|
3
3
|
import 'zod';
|
|
4
|
-
export { D as Agent, F as AgentConfig, bd as AgentGenerateOptions, be as AgentStreamOptions, bc as DynamicArgument, b0 as MastraLanguageModel, b1 as ToolsInput, bb as ToolsetsInput } from '../base-
|
|
4
|
+
export { D as Agent, F as AgentConfig, bd as AgentGenerateOptions, be as AgentStreamOptions, bc as DynamicArgument, b0 as MastraLanguageModel, b1 as ToolsInput, bb as ToolsetsInput } from '../base-uXj2cuRo.js';
|
|
5
5
|
import '../base-DT2poiVK.js';
|
|
6
6
|
import '../types-BtMyV38I.js';
|
|
7
7
|
import '../runtime-context/index.js';
|
package/dist/agent/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { Agent } from '../chunk-
|
|
1
|
+
export { Agent } from '../chunk-6YY6MN2Z.js';
|
|
@@ -1097,7 +1097,13 @@ declare class Workflow<TSteps extends Step<string, any, any>[] = Step<string, an
|
|
|
1097
1097
|
* @returns this instance for method chaining
|
|
1098
1098
|
*/
|
|
1099
1099
|
commit(): this;
|
|
1100
|
-
getWorkflowRuns(
|
|
1100
|
+
getWorkflowRuns(args?: {
|
|
1101
|
+
fromDate?: Date;
|
|
1102
|
+
toDate?: Date;
|
|
1103
|
+
limit?: number;
|
|
1104
|
+
offset?: number;
|
|
1105
|
+
resourceId?: string;
|
|
1106
|
+
}): Promise<WorkflowRuns>;
|
|
1101
1107
|
getExecutionSpan(runId: string): Span | undefined;
|
|
1102
1108
|
getState(runId: string): Promise<WorkflowRunState | null>;
|
|
1103
1109
|
resume({ runId, stepId, context: resumeContext, runtimeContext, }: {
|
|
@@ -1517,7 +1523,13 @@ declare class NewWorkflow<TSteps extends NewStep<string, any, any, any, any>[] =
|
|
|
1517
1523
|
emitter: EventEmitter$1;
|
|
1518
1524
|
mastra: Mastra;
|
|
1519
1525
|
}): Promise<z.infer<TOutput>>;
|
|
1520
|
-
getWorkflowRuns(
|
|
1526
|
+
getWorkflowRuns(args?: {
|
|
1527
|
+
fromDate?: Date;
|
|
1528
|
+
toDate?: Date;
|
|
1529
|
+
limit?: number;
|
|
1530
|
+
offset?: number;
|
|
1531
|
+
resourceId?: string;
|
|
1532
|
+
}): Promise<WorkflowRuns>;
|
|
1521
1533
|
getWorkflowRun(runId: string): Promise<WorkflowRun | Run<TSteps, TInput, TOutput> | undefined>;
|
|
1522
1534
|
}
|
|
1523
1535
|
/**
|
|
@@ -1615,6 +1627,11 @@ declare const memoryDefaultOptions: {
|
|
|
1615
1627
|
threads: {
|
|
1616
1628
|
generateTitle: true;
|
|
1617
1629
|
};
|
|
1630
|
+
workingMemory: {
|
|
1631
|
+
use: "text-stream";
|
|
1632
|
+
enabled: false;
|
|
1633
|
+
template: string;
|
|
1634
|
+
};
|
|
1618
1635
|
};
|
|
1619
1636
|
/**
|
|
1620
1637
|
* Abstract Memory class that defines the interface for storing and retrieving
|
|
@@ -2602,7 +2619,12 @@ type MemoryConfig = {
|
|
|
2602
2619
|
workingMemory?: {
|
|
2603
2620
|
enabled: boolean;
|
|
2604
2621
|
template?: string;
|
|
2605
|
-
use
|
|
2622
|
+
use: 'tool-call';
|
|
2623
|
+
} | {
|
|
2624
|
+
enabled: boolean;
|
|
2625
|
+
template?: string;
|
|
2626
|
+
/** @deprecated the 'text-stream' working memory option (which is the current default) will be full removed in favor of the 'tool-call' option in a future breaking change. */
|
|
2627
|
+
use?: 'text-stream';
|
|
2606
2628
|
};
|
|
2607
2629
|
threads?: {
|
|
2608
2630
|
generateTitle?: boolean;
|
|
@@ -2682,6 +2704,8 @@ declare abstract class MastraStorage extends MastraBase {
|
|
|
2682
2704
|
perPage: number;
|
|
2683
2705
|
attributes?: Record<string, string>;
|
|
2684
2706
|
filters?: Record<string, any>;
|
|
2707
|
+
fromDate?: Date;
|
|
2708
|
+
toDate?: Date;
|
|
2685
2709
|
}): Promise<any[]>;
|
|
2686
2710
|
init(): Promise<void>;
|
|
2687
2711
|
persistWorkflowSnapshot({ workflowName, runId, snapshot, }: {
|
|
@@ -1097,7 +1097,13 @@ declare class Workflow<TSteps extends Step<string, any, any>[] = Step<string, an
|
|
|
1097
1097
|
* @returns this instance for method chaining
|
|
1098
1098
|
*/
|
|
1099
1099
|
commit(): this;
|
|
1100
|
-
getWorkflowRuns(
|
|
1100
|
+
getWorkflowRuns(args?: {
|
|
1101
|
+
fromDate?: Date;
|
|
1102
|
+
toDate?: Date;
|
|
1103
|
+
limit?: number;
|
|
1104
|
+
offset?: number;
|
|
1105
|
+
resourceId?: string;
|
|
1106
|
+
}): Promise<WorkflowRuns>;
|
|
1101
1107
|
getExecutionSpan(runId: string): Span | undefined;
|
|
1102
1108
|
getState(runId: string): Promise<WorkflowRunState | null>;
|
|
1103
1109
|
resume({ runId, stepId, context: resumeContext, runtimeContext, }: {
|
|
@@ -1517,7 +1523,13 @@ declare class NewWorkflow<TSteps extends NewStep<string, any, any, any, any>[] =
|
|
|
1517
1523
|
emitter: EventEmitter$1;
|
|
1518
1524
|
mastra: Mastra;
|
|
1519
1525
|
}): Promise<z.infer<TOutput>>;
|
|
1520
|
-
getWorkflowRuns(
|
|
1526
|
+
getWorkflowRuns(args?: {
|
|
1527
|
+
fromDate?: Date;
|
|
1528
|
+
toDate?: Date;
|
|
1529
|
+
limit?: number;
|
|
1530
|
+
offset?: number;
|
|
1531
|
+
resourceId?: string;
|
|
1532
|
+
}): Promise<WorkflowRuns>;
|
|
1521
1533
|
getWorkflowRun(runId: string): Promise<WorkflowRun | Run<TSteps, TInput, TOutput> | undefined>;
|
|
1522
1534
|
}
|
|
1523
1535
|
/**
|
|
@@ -1615,6 +1627,11 @@ declare const memoryDefaultOptions: {
|
|
|
1615
1627
|
threads: {
|
|
1616
1628
|
generateTitle: true;
|
|
1617
1629
|
};
|
|
1630
|
+
workingMemory: {
|
|
1631
|
+
use: "text-stream";
|
|
1632
|
+
enabled: false;
|
|
1633
|
+
template: string;
|
|
1634
|
+
};
|
|
1618
1635
|
};
|
|
1619
1636
|
/**
|
|
1620
1637
|
* Abstract Memory class that defines the interface for storing and retrieving
|
|
@@ -2602,7 +2619,12 @@ type MemoryConfig = {
|
|
|
2602
2619
|
workingMemory?: {
|
|
2603
2620
|
enabled: boolean;
|
|
2604
2621
|
template?: string;
|
|
2605
|
-
use
|
|
2622
|
+
use: 'tool-call';
|
|
2623
|
+
} | {
|
|
2624
|
+
enabled: boolean;
|
|
2625
|
+
template?: string;
|
|
2626
|
+
/** @deprecated the 'text-stream' working memory option (which is the current default) will be full removed in favor of the 'tool-call' option in a future breaking change. */
|
|
2627
|
+
use?: 'text-stream';
|
|
2606
2628
|
};
|
|
2607
2629
|
threads?: {
|
|
2608
2630
|
generateTitle?: boolean;
|
|
@@ -2682,6 +2704,8 @@ declare abstract class MastraStorage extends MastraBase {
|
|
|
2682
2704
|
perPage: number;
|
|
2683
2705
|
attributes?: Record<string, string>;
|
|
2684
2706
|
filters?: Record<string, any>;
|
|
2707
|
+
fromDate?: Date;
|
|
2708
|
+
toDate?: Date;
|
|
2685
2709
|
}): Promise<any[]>;
|
|
2686
2710
|
init(): Promise<void>;
|
|
2687
2711
|
persistWorkflowSnapshot({ workflowName, runId, snapshot, }: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DefaultVoice } from './chunk-Q6Z2YS6I.js';
|
|
2
|
-
import { MastraLLM } from './chunk-
|
|
2
|
+
import { MastraLLM } from './chunk-QV4ZJLWA.js';
|
|
3
3
|
import { InstrumentClass } from './chunk-KWYJUFY3.js';
|
|
4
|
-
import { ensureToolProperties, ensureAllMessagesAreCoreMessages, createMastraProxy, makeCoreTool } from './chunk-
|
|
4
|
+
import { ensureToolProperties, ensureAllMessagesAreCoreMessages, createMastraProxy, makeCoreTool } from './chunk-ZCJJ6XOH.js';
|
|
5
5
|
import { MastraBase } from './chunk-CLJQYXNM.js';
|
|
6
6
|
import { RegisteredLogger } from './chunk-2BVZNKLX.js';
|
|
7
7
|
import { RuntimeContext } from './chunk-SGGPJWRQ.js';
|
|
@@ -61,7 +61,7 @@ function resoolveMaybePromise(value, cb) {
|
|
|
61
61
|
var _Agent_decorators, _init, _a;
|
|
62
62
|
_Agent_decorators = [InstrumentClass({
|
|
63
63
|
prefix: "agent",
|
|
64
|
-
excludeMethods: ["hasOwnMemory", "getMemory", "__primitive", "__setTools", "__setLogger", "__setTelemetry", "log"]
|
|
64
|
+
excludeMethods: ["hasOwnMemory", "getMemory", "__primitive", "__registerMastra", "__registerPrimitives", "__setTools", "__setLogger", "__setTelemetry", "log", "getModel", "getInstructions", "getTools", "getLLM"]
|
|
65
65
|
})];
|
|
66
66
|
var Agent = class extends (_a = MastraBase) {
|
|
67
67
|
id;
|
|
@@ -504,6 +504,9 @@ var Agent = class extends (_a = MastraBase) {
|
|
|
504
504
|
});
|
|
505
505
|
return messagesBySanitizedContent.filter(message => {
|
|
506
506
|
if (typeof message.content === `string`) {
|
|
507
|
+
if (message.role === "assistant") {
|
|
508
|
+
return true;
|
|
509
|
+
}
|
|
507
510
|
return message.content !== "";
|
|
508
511
|
}
|
|
509
512
|
if (Array.isArray(message.content)) {
|
|
@@ -3981,7 +3984,7 @@ var Workflow = class extends MastraBase {
|
|
|
3981
3984
|
}));
|
|
3982
3985
|
}
|
|
3983
3986
|
}
|
|
3984
|
-
async getWorkflowRuns() {
|
|
3987
|
+
async getWorkflowRuns(args) {
|
|
3985
3988
|
const storage = this.#mastra?.getStorage();
|
|
3986
3989
|
if (!storage) {
|
|
3987
3990
|
this.logger.debug("Cannot get workflow runs. Mastra engine is not initialized");
|
|
@@ -3991,7 +3994,8 @@ var Workflow = class extends MastraBase {
|
|
|
3991
3994
|
};
|
|
3992
3995
|
}
|
|
3993
3996
|
return storage.getWorkflowRuns({
|
|
3994
|
-
workflowName: this.name
|
|
3997
|
+
workflowName: this.name,
|
|
3998
|
+
...(args ?? {})
|
|
3995
3999
|
});
|
|
3996
4000
|
}
|
|
3997
4001
|
getExecutionSpan(runId) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkD2Y3ET63_cjs = require('./chunk-D2Y3ET63.cjs');
|
|
4
4
|
var zod = require('zod');
|
|
5
5
|
|
|
6
6
|
// src/integration/integration.ts
|
|
@@ -68,7 +68,7 @@ var OpenAPIToolset = class {
|
|
|
68
68
|
const tools = Object.keys(clientMethods).reduce((acc, key) => {
|
|
69
69
|
const comment = documentations[key]?.comment;
|
|
70
70
|
const fallbackComment = `Execute ${key}`;
|
|
71
|
-
const tool =
|
|
71
|
+
const tool = chunkD2Y3ET63_cjs.createTool({
|
|
72
72
|
id: key,
|
|
73
73
|
inputSchema: schemas[key] || zod.z.object({}),
|
|
74
74
|
description: comment || fallbackComment,
|
|
@@ -31,95 +31,6 @@ function createTool(opts) {
|
|
|
31
31
|
return new Tool(opts);
|
|
32
32
|
}
|
|
33
33
|
var delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
34
|
-
function jsonSchemaPropertiesToTSTypes(value) {
|
|
35
|
-
if (!value?.type) {
|
|
36
|
-
return zod.z.object({});
|
|
37
|
-
}
|
|
38
|
-
if (Array.isArray(value.type)) {
|
|
39
|
-
const types = value.type.map((type) => {
|
|
40
|
-
return jsonSchemaPropertiesToTSTypes({ ...value, type });
|
|
41
|
-
});
|
|
42
|
-
return zod.z.union(types).describe((value.description || "") + (value.examples ? `
|
|
43
|
-
Examples: ${value.examples.join(", ")}` : ""));
|
|
44
|
-
}
|
|
45
|
-
let zodType;
|
|
46
|
-
switch (value.type) {
|
|
47
|
-
case "string":
|
|
48
|
-
zodType = zod.z.string().describe((value.description || "") + (value.examples ? `
|
|
49
|
-
Examples: ${value.examples.join(", ")}` : ""));
|
|
50
|
-
break;
|
|
51
|
-
case "number":
|
|
52
|
-
zodType = zod.z.number().describe((value.description || "") + (value.examples ? `
|
|
53
|
-
Examples: ${value.examples.join(", ")}` : ""));
|
|
54
|
-
break;
|
|
55
|
-
case "integer":
|
|
56
|
-
zodType = zod.z.number().int().describe((value.description || "") + (value.examples ? `
|
|
57
|
-
Examples: ${value.examples.join(", ")}` : ""));
|
|
58
|
-
break;
|
|
59
|
-
case "boolean":
|
|
60
|
-
zodType = zod.z.boolean().describe((value.description || "") + (value.examples ? `
|
|
61
|
-
Examples: ${value.examples.join(", ")}` : ""));
|
|
62
|
-
break;
|
|
63
|
-
case "array":
|
|
64
|
-
if (!value.items || !value.items?.type) {
|
|
65
|
-
value.items = value.items ? { ...value.items, type: "string" } : { type: "string" };
|
|
66
|
-
}
|
|
67
|
-
zodType = zod.z.array(jsonSchemaPropertiesToTSTypes(value.items)).describe((value.description || "") + (value.examples ? `
|
|
68
|
-
Examples: ${value.examples.join(", ")}` : ""));
|
|
69
|
-
break;
|
|
70
|
-
case "object":
|
|
71
|
-
zodType = jsonSchemaToModel(value).describe(
|
|
72
|
-
(value.description || "") + (value.examples ? `
|
|
73
|
-
Examples: ${value.examples.join(", ")}` : "")
|
|
74
|
-
);
|
|
75
|
-
break;
|
|
76
|
-
case "null":
|
|
77
|
-
zodType = zod.z.null().describe(value.description || "");
|
|
78
|
-
break;
|
|
79
|
-
default:
|
|
80
|
-
throw new Error(`Unsupported JSON schema type: ${value.type}`);
|
|
81
|
-
}
|
|
82
|
-
return zodType;
|
|
83
|
-
}
|
|
84
|
-
function jsonSchemaToModel(jsonSchema) {
|
|
85
|
-
const properties = jsonSchema.properties;
|
|
86
|
-
const requiredFields = jsonSchema.required || [];
|
|
87
|
-
if (!properties) {
|
|
88
|
-
return zod.z.object({});
|
|
89
|
-
}
|
|
90
|
-
const zodSchema = {};
|
|
91
|
-
for (const [key, _] of Object.entries(properties)) {
|
|
92
|
-
const value = _;
|
|
93
|
-
let zodType;
|
|
94
|
-
if (value.anyOf) {
|
|
95
|
-
const anyOfTypes = value.anyOf.map((schema) => jsonSchemaPropertiesToTSTypes(schema));
|
|
96
|
-
zodType = zod.z.union(anyOfTypes).describe((value.description || "") + (value.examples ? `
|
|
97
|
-
Examples: ${value.examples.join(", ")}` : ""));
|
|
98
|
-
} else if (value.allOf) {
|
|
99
|
-
const allOfTypes = value.allOf.map((schema) => jsonSchemaPropertiesToTSTypes(schema));
|
|
100
|
-
zodType = zod.z.intersection(
|
|
101
|
-
allOfTypes[0],
|
|
102
|
-
allOfTypes.slice(1).reduce((acc, schema) => acc.and(schema), allOfTypes[0])
|
|
103
|
-
).describe((value.description || "") + (value.examples ? `
|
|
104
|
-
Examples: ${value.examples.join(", ")}` : ""));
|
|
105
|
-
} else {
|
|
106
|
-
if (!value.type) {
|
|
107
|
-
value.type = "string";
|
|
108
|
-
}
|
|
109
|
-
zodType = jsonSchemaPropertiesToTSTypes(value);
|
|
110
|
-
}
|
|
111
|
-
if (value.description) {
|
|
112
|
-
zodType = zodType.describe(value.description);
|
|
113
|
-
}
|
|
114
|
-
const isTypeRequired = value.type === "null";
|
|
115
|
-
if (requiredFields.includes(key) || isTypeRequired) {
|
|
116
|
-
zodSchema[key] = zodType;
|
|
117
|
-
} else {
|
|
118
|
-
zodSchema[key] = zodType.nullable().optional();
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
return zod.z.object(zodSchema);
|
|
122
|
-
}
|
|
123
34
|
function deepMerge(target, source) {
|
|
124
35
|
const output = { ...target };
|
|
125
36
|
if (!source) return output;
|
|
@@ -446,8 +357,6 @@ exports.ensureAllMessagesAreCoreMessages = ensureAllMessagesAreCoreMessages;
|
|
|
446
357
|
exports.ensureToolProperties = ensureToolProperties;
|
|
447
358
|
exports.isVercelTool = isVercelTool;
|
|
448
359
|
exports.isZodType = isZodType;
|
|
449
|
-
exports.jsonSchemaPropertiesToTSTypes = jsonSchemaPropertiesToTSTypes;
|
|
450
|
-
exports.jsonSchemaToModel = jsonSchemaToModel;
|
|
451
360
|
exports.makeCoreTool = makeCoreTool;
|
|
452
361
|
exports.maskStreamTags = maskStreamTags;
|
|
453
362
|
exports.resolveSerializedZodOutput = resolveSerializedZodOutput;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkVXUCE4GF_cjs = require('./chunk-VXUCE4GF.cjs');
|
|
4
4
|
var cohereAi = require('cohere-ai');
|
|
5
5
|
|
|
6
6
|
var CohereRelevanceScorer = class {
|
|
@@ -38,7 +38,7 @@ Relevance score (0-1):`;
|
|
|
38
38
|
var MastraAgentRelevanceScorer = class {
|
|
39
39
|
agent;
|
|
40
40
|
constructor(name, model) {
|
|
41
|
-
this.agent = new
|
|
41
|
+
this.agent = new chunkVXUCE4GF_cjs.Agent({
|
|
42
42
|
name: `Relevance Scorer ${name}`,
|
|
43
43
|
instructions: `You are a specialized agent for evaluating the relevance of text to queries.
|
|
44
44
|
Your task is to rate how well a text passage answers a given query.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkAVAHVCWY_cjs = require('./chunk-AVAHVCWY.cjs');
|
|
4
4
|
var chunkMYHX5XVW_cjs = require('./chunk-MYHX5XVW.cjs');
|
|
5
5
|
var chunkO7IW545H_cjs = require('./chunk-O7IW545H.cjs');
|
|
6
6
|
var chunkRWTSGWWL_cjs = require('./chunk-RWTSGWWL.cjs');
|
|
@@ -67,13 +67,13 @@ exports.Mastra = class Mastra {
|
|
|
67
67
|
this.#logger = logger;
|
|
68
68
|
let storage = config?.storage;
|
|
69
69
|
if (!storage) {
|
|
70
|
-
storage = new
|
|
70
|
+
storage = new chunkAVAHVCWY_cjs.DefaultProxyStorage({
|
|
71
71
|
config: {
|
|
72
72
|
url: process.env.MASTRA_DEFAULT_STORAGE_URL || `:memory:`
|
|
73
73
|
}
|
|
74
74
|
});
|
|
75
75
|
}
|
|
76
|
-
storage =
|
|
76
|
+
storage = chunkAVAHVCWY_cjs.augmentWithInit(storage);
|
|
77
77
|
this.#telemetry = chunkMYHX5XVW_cjs.Telemetry.init(config?.telemetry);
|
|
78
78
|
if (this.#telemetry) {
|
|
79
79
|
this.#storage = this.#telemetry.traceClass(storage, {
|
|
@@ -285,7 +285,7 @@ This is a warning for now, but will throw an error in the future
|
|
|
285
285
|
return this.#vnext_workflows;
|
|
286
286
|
}
|
|
287
287
|
setStorage(storage) {
|
|
288
|
-
if (storage instanceof
|
|
288
|
+
if (storage instanceof chunkAVAHVCWY_cjs.DefaultProxyStorage) {
|
|
289
289
|
this.#logger.warn(`Importing "DefaultStorage" from '@mastra/core/storage/libsql' is deprecated.
|
|
290
290
|
|
|
291
291
|
Instead of:
|
|
@@ -295,7 +295,7 @@ Do:
|
|
|
295
295
|
import { LibSQLStore } from '@mastra/libsql';
|
|
296
296
|
`);
|
|
297
297
|
}
|
|
298
|
-
this.#storage =
|
|
298
|
+
this.#storage = chunkAVAHVCWY_cjs.augmentWithInit(storage);
|
|
299
299
|
}
|
|
300
300
|
setLogger({
|
|
301
301
|
logger
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { delay } from './chunk-
|
|
1
|
+
import { delay } from './chunk-ZCJJ6XOH.js';
|
|
2
2
|
import { MastraBase } from './chunk-CLJQYXNM.js';
|
|
3
3
|
import { RegisteredLogger } from './chunk-2BVZNKLX.js';
|
|
4
4
|
import { jsonSchema, generateText, Output, generateObject, streamText, streamObject } from 'ai';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunkT3UZONPQ_cjs = require('./chunk-T3UZONPQ.cjs');
|
|
4
|
-
var
|
|
5
|
-
var
|
|
4
|
+
var chunkAVAHVCWY_cjs = require('./chunk-AVAHVCWY.cjs');
|
|
5
|
+
var chunkD2Y3ET63_cjs = require('./chunk-D2Y3ET63.cjs');
|
|
6
6
|
var chunkD63P5O4Q_cjs = require('./chunk-D63P5O4Q.cjs');
|
|
7
7
|
var fs = require('fs');
|
|
8
8
|
var path = require('path');
|
|
@@ -134,6 +134,23 @@ var memoryDefaultOptions = {
|
|
|
134
134
|
},
|
|
135
135
|
threads: {
|
|
136
136
|
generateTitle: true
|
|
137
|
+
},
|
|
138
|
+
workingMemory: {
|
|
139
|
+
use: "text-stream",
|
|
140
|
+
// will be deprecated, use 'tool-call' instead
|
|
141
|
+
enabled: false,
|
|
142
|
+
template: `
|
|
143
|
+
# User Information
|
|
144
|
+
- **First Name**:
|
|
145
|
+
- **Last Name**:
|
|
146
|
+
- **Location**:
|
|
147
|
+
- **Occupation**:
|
|
148
|
+
- **Interests**:
|
|
149
|
+
- **Goals**:
|
|
150
|
+
- **Events**:
|
|
151
|
+
- **Facts**:
|
|
152
|
+
- **Projects**:
|
|
153
|
+
`
|
|
137
154
|
}
|
|
138
155
|
};
|
|
139
156
|
var newMemoryDefaultOptions = {
|
|
@@ -141,7 +158,10 @@ var newMemoryDefaultOptions = {
|
|
|
141
158
|
semanticRecall: false,
|
|
142
159
|
threads: {
|
|
143
160
|
generateTitle: false
|
|
144
|
-
}
|
|
161
|
+
},
|
|
162
|
+
workingMemory: {
|
|
163
|
+
// new
|
|
164
|
+
use: "tool-call"}
|
|
145
165
|
};
|
|
146
166
|
var MastraMemory = class extends chunkD63P5O4Q_cjs.MastraBase {
|
|
147
167
|
MAX_CONTEXT_TOKENS;
|
|
@@ -159,13 +179,13 @@ var MastraMemory = class extends chunkD63P5O4Q_cjs.MastraBase {
|
|
|
159
179
|
if (config.storage) {
|
|
160
180
|
this.storage = config.storage;
|
|
161
181
|
} else {
|
|
162
|
-
this.storage = new
|
|
182
|
+
this.storage = new chunkAVAHVCWY_cjs.DefaultProxyStorage({
|
|
163
183
|
config: {
|
|
164
184
|
url: "file:memory.db"
|
|
165
185
|
}
|
|
166
186
|
});
|
|
167
187
|
}
|
|
168
|
-
this.storage =
|
|
188
|
+
this.storage = chunkAVAHVCWY_cjs.augmentWithInit(this.storage);
|
|
169
189
|
const semanticRecallIsEnabled = this.threadConfig.semanticRecall !== false;
|
|
170
190
|
if (config.vector && semanticRecallIsEnabled) {
|
|
171
191
|
this.vector = config.vector;
|
|
@@ -265,6 +285,21 @@ ${this.deprecationWarnings.map((w, i) => `${this.deprecationWarnings.length > 1
|
|
|
265
285
|
from: memoryDefaultOptions.threads,
|
|
266
286
|
to: newMemoryDefaultOptions.threads
|
|
267
287
|
});
|
|
288
|
+
if (`workingMemory` in options && // special handling for working memory since it's disabled by default and users should only care about the change if they're using
|
|
289
|
+
options.workingMemory?.enabled === true && options.workingMemory?.use !== `tool-call`) {
|
|
290
|
+
fromToPairs.push({
|
|
291
|
+
key: "workingMemory",
|
|
292
|
+
from: {
|
|
293
|
+
use: memoryDefaultOptions.workingMemory.use
|
|
294
|
+
},
|
|
295
|
+
to: {
|
|
296
|
+
use: newMemoryDefaultOptions.workingMemory.use
|
|
297
|
+
},
|
|
298
|
+
message: `
|
|
299
|
+
Also, the text-stream output mode (which is the current default) will be fully removed in an upcoming breaking change. Please update your code to use the newer "use: 'tool-call'" setting instead.
|
|
300
|
+
`
|
|
301
|
+
});
|
|
302
|
+
}
|
|
268
303
|
if (fromToPairs.length > 0) {
|
|
269
304
|
const currentDefaults = `{
|
|
270
305
|
options: {
|
|
@@ -278,6 +313,7 @@ ${this.deprecationWarnings.map((w, i) => `${this.deprecationWarnings.length > 1
|
|
|
278
313
|
`)}
|
|
279
314
|
}
|
|
280
315
|
}`;
|
|
316
|
+
const messages = fromToPairs.filter((ft) => ft.message);
|
|
281
317
|
this.deprecationWarnings.push(`
|
|
282
318
|
Your Mastra memory instance has the
|
|
283
319
|
following implicit default options:
|
|
@@ -293,12 +329,14 @@ To keep your defaults as they are, add
|
|
|
293
329
|
them directly into your Memory configuration,
|
|
294
330
|
otherwise please add the new settings to
|
|
295
331
|
your memory config to prepare for the change.
|
|
332
|
+
${messages.length ? messages.map((ft) => ft.message).join(`
|
|
333
|
+
`) : ``}
|
|
296
334
|
--> This breaking change will be released on May 20th <--
|
|
297
335
|
`);
|
|
298
336
|
}
|
|
299
337
|
}
|
|
300
338
|
setStorage(storage) {
|
|
301
|
-
if (storage instanceof
|
|
339
|
+
if (storage instanceof chunkAVAHVCWY_cjs.DefaultProxyStorage) {
|
|
302
340
|
this.deprecationWarnings.push(`Importing "DefaultStorage" from '@mastra/core/storage/libsql' is deprecated.
|
|
303
341
|
|
|
304
342
|
Instead of:
|
|
@@ -347,7 +385,7 @@ Do:
|
|
|
347
385
|
return { indexName };
|
|
348
386
|
}
|
|
349
387
|
getMergedThreadConfig(config) {
|
|
350
|
-
return
|
|
388
|
+
return chunkD2Y3ET63_cjs.deepMerge(this.threadConfig, config || {});
|
|
351
389
|
}
|
|
352
390
|
/**
|
|
353
391
|
* Apply all configured message processors to a list of messages.
|