@mastra/editor 0.15.7-alpha.1 → 0.16.0-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/index.cjs +67 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +15 -0
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +67 -8
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
package/dist/index.d.cts
CHANGED
|
@@ -165,6 +165,14 @@ declare class EditorAgentNamespace extends CrudEditorNamespace<StorageCreateAgen
|
|
|
165
165
|
* Variants with no rules are treated as unconditional (always included).
|
|
166
166
|
*/
|
|
167
167
|
private accumulateObjectVariants;
|
|
168
|
+
/**
|
|
169
|
+
* Accumulate matching memory variants. Inline configs shallow-merge like
|
|
170
|
+
* other object fields, but a registered-memory reference replaces whatever
|
|
171
|
+
* has accumulated (and a later inline variant replaces a reference), so the
|
|
172
|
+
* result is never a hybrid of a reference and inline config.
|
|
173
|
+
*/
|
|
174
|
+
private accumulateMemoryVariants;
|
|
175
|
+
private resolveConditionalMemory;
|
|
168
176
|
private createAgentFromStoredConfig;
|
|
169
177
|
private resolveStoredInstructions;
|
|
170
178
|
/**
|
|
@@ -215,6 +223,13 @@ declare class EditorAgentNamespace extends CrudEditorNamespace<StorageCreateAgen
|
|
|
215
223
|
private resolveStoredWorkflows;
|
|
216
224
|
private resolveStoredAgents;
|
|
217
225
|
private resolveStoredMemory;
|
|
226
|
+
/**
|
|
227
|
+
* Look up a Memory instance registered on Mastra, by registry key first and
|
|
228
|
+
* then by the instance's own id. A missing reference is not fatal: the agent
|
|
229
|
+
* runs without memory and stored threads/messages are left untouched.
|
|
230
|
+
*/
|
|
231
|
+
private resolveRegisteredMemory;
|
|
232
|
+
private buildInlineMemory;
|
|
218
233
|
private resolveStoredScorers;
|
|
219
234
|
/**
|
|
220
235
|
* Clone a runtime Agent instance into storage, creating a new stored agent
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/namespaces/base.ts","../src/namespaces/agent.ts","../src/namespaces/mcp.ts","../src/namespaces/mcp-server.ts","../src/namespaces/prompt.ts","../src/namespaces/scorer.ts","../src/namespaces/workspace.ts","../src/namespaces/skill.ts","../src/namespaces/favorites.ts","../src/template-engine.ts","../src/rule-evaluator.ts","../src/instruction-builder.ts","../src/providers.ts","../src/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;UAYiB,eACf;EAAuB;GACvB;EAAuB;GACvB,YACA,aACA,qBACA;EAEA,OAAO,OAAO,eAAe;EAC7B,gBAAgB,YAAY,UAAU,iBAAiB,QAAQ;EAC/D,OAAO,OAAO,eAAe;EAC7B,OAAO,aAAa;EACpB,KAAK,OAAO,aAAa,QAAQ;EACjC,aAAa,OAAO,aAAa,QAAQ;;;;;;uBAOrB;YACE,QAAQ;EAA9B,YAAsB,QAAQ;gBAEhB,UAAU;gBAIV,UAAU;YAId;;;;;;;;;;;;;;;;;uBAsBU,oBACpB;EAAuB;GACvB;EAAuB;GACvB,YACA,aACA,qBACA,WACA,YAAY,mBACJ;YACE,QAAM,YAAA;;;;;qBAMG,qBAAqB,QACtC,eAAe,cAAc,cAAc,YAAY,aAAa,qBAAqB;;;;;;YAQ3E,QAAQ,UAAU,YAAY,QAAQ;;;;;YAQ5C,aAAa;EAIjB,OAAO,OAAO,eAAe,QAAQ;EAarC,QAAQ,YAAY,UAAU,iBAAiB,QAAQ;EAgCvD,OAAO,OAAO,eAAe,QAAQ;EAerC,OAAO,aAAa;EAQpB,KAAK,OAAO,aAAa,QAAQ;EAMjC,aAAa,OAAO,aAAa,QAAQ;;;;;EAU/C,WAAW;;;;
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/namespaces/base.ts","../src/namespaces/agent.ts","../src/namespaces/mcp.ts","../src/namespaces/mcp-server.ts","../src/namespaces/prompt.ts","../src/namespaces/scorer.ts","../src/namespaces/workspace.ts","../src/namespaces/skill.ts","../src/namespaces/favorites.ts","../src/template-engine.ts","../src/rule-evaluator.ts","../src/instruction-builder.ts","../src/providers.ts","../src/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;UAYiB,eACf;EAAuB;GACvB;EAAuB;GACvB,YACA,aACA,qBACA;EAEA,OAAO,OAAO,eAAe;EAC7B,gBAAgB,YAAY,UAAU,iBAAiB,QAAQ;EAC/D,OAAO,OAAO,eAAe;EAC7B,OAAO,aAAa;EACpB,KAAK,OAAO,aAAa,QAAQ;EACjC,aAAa,OAAO,aAAa,QAAQ;;;;;;uBAOrB;YACE,QAAQ;EAA9B,YAAsB,QAAQ;gBAEhB,UAAU;gBAIV,UAAU;YAId;;;;;;;;;;;;;;;;;uBAsBU,oBACpB;EAAuB;GACvB;EAAuB;GACvB,YACA,aACA,qBACA,WACA,YAAY,mBACJ;YACE,QAAM,YAAA;;;;;qBAMG,qBAAqB,QACtC,eAAe,cAAc,cAAc,YAAY,aAAa,qBAAqB;;;;;;YAQ3E,QAAQ,UAAU,YAAY,QAAQ;;;;;YAQ5C,aAAa;EAIjB,OAAO,OAAO,eAAe,QAAQ;EAarC,QAAQ,YAAY,UAAU,iBAAiB,QAAQ;EAgCvD,OAAO,OAAO,eAAe,QAAQ;EAerC,OAAO,aAAa;EAQpB,KAAK,OAAO,aAAa,QAAQ;EAMjC,aAAa,OAAO,aAAa,QAAQ;;;;;EAU/C,WAAW;;;;cCGA,6BAA6B,oBACxC,yBACA,yBACA,wBACA,yBACA,iCACA,0BACA;;UAGQ;YAEQ,qBAAqB,QACnC,eACE,yBACA,yBACA,wBACA,yBACA,iCACA;;;;YAiDY,QAAQ,aAAa,2BAA2B,QAAQ;EAIzD,OAAO,OAAO,0BAA0B,QAAQ;;;;;EA2DzD,OAAO,OAAO,0BAA0B,QAAQ;UA4B9C;UAUM;;;;;;;;;;UAwBA;YAqDK,aAAa;;;;;;EA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AAY;;;;;;WAO3B,aAAa,YAAY;;;;;;;WAQzB,cAAc,YAAY;;;;;;WAO1B,YAAY,YAAY;;;;;;WAOxB,cAAc,YAAY;WAEnB,OAAO;WACP,KAAK;WACL,WAAW;WACX,QAAQ;WACR,QAAQ;WACR,WAAW;WACX,OAAO;WACP,WAAW;EAE3B,YAAY,SAAS;;;;;EA4DrB,mBAAmB,QAAQ;;;;;;;;;;;;UAkEb;;;;;;;;UAoDA;;EA6Cd;;EAMM,0BAA0B,QAAQ;;;;;EAmBxC;;;;;EASM,kBAAkB,QAAQ;;;;;;;UA6ClB;;EAuBd;;EAKA,4BAA4B;;EAK5B,gBAAgB,aAAa;;;;;EAQ7B,uBAAuB,aAAa;;EASpC,oBAAoB,eAAe;;EAKnC,qBAAqB,aAAa;;EAKlC,yBAAyB,eAAe;;EAIxC,0BAA0B;;EAK1B,uBAAuB;;EAKvB,yBAAyB;;;;;;;;;;;EAcnB,iBAAiB,qBAAqB,iBAAiB,0BAA0B,QAAQ"}
|
package/dist/index.d.ts
CHANGED
|
@@ -165,6 +165,14 @@ declare class EditorAgentNamespace extends CrudEditorNamespace<StorageCreateAgen
|
|
|
165
165
|
* Variants with no rules are treated as unconditional (always included).
|
|
166
166
|
*/
|
|
167
167
|
private accumulateObjectVariants;
|
|
168
|
+
/**
|
|
169
|
+
* Accumulate matching memory variants. Inline configs shallow-merge like
|
|
170
|
+
* other object fields, but a registered-memory reference replaces whatever
|
|
171
|
+
* has accumulated (and a later inline variant replaces a reference), so the
|
|
172
|
+
* result is never a hybrid of a reference and inline config.
|
|
173
|
+
*/
|
|
174
|
+
private accumulateMemoryVariants;
|
|
175
|
+
private resolveConditionalMemory;
|
|
168
176
|
private createAgentFromStoredConfig;
|
|
169
177
|
private resolveStoredInstructions;
|
|
170
178
|
/**
|
|
@@ -215,6 +223,13 @@ declare class EditorAgentNamespace extends CrudEditorNamespace<StorageCreateAgen
|
|
|
215
223
|
private resolveStoredWorkflows;
|
|
216
224
|
private resolveStoredAgents;
|
|
217
225
|
private resolveStoredMemory;
|
|
226
|
+
/**
|
|
227
|
+
* Look up a Memory instance registered on Mastra, by registry key first and
|
|
228
|
+
* then by the instance's own id. A missing reference is not fatal: the agent
|
|
229
|
+
* runs without memory and stored threads/messages are left untouched.
|
|
230
|
+
*/
|
|
231
|
+
private resolveRegisteredMemory;
|
|
232
|
+
private buildInlineMemory;
|
|
218
233
|
private resolveStoredScorers;
|
|
219
234
|
/**
|
|
220
235
|
* Clone a runtime Agent instance into storage, creating a new stored agent
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/namespaces/base.ts","../src/namespaces/agent.ts","../src/namespaces/mcp.ts","../src/namespaces/mcp-server.ts","../src/namespaces/prompt.ts","../src/namespaces/scorer.ts","../src/namespaces/workspace.ts","../src/namespaces/skill.ts","../src/namespaces/favorites.ts","../src/template-engine.ts","../src/rule-evaluator.ts","../src/instruction-builder.ts","../src/providers.ts","../src/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;UAYiB,eACf;EAAuB;GACvB;EAAuB;GACvB,YACA,aACA,qBACA;EAEA,OAAO,OAAO,eAAe;EAC7B,gBAAgB,YAAY,UAAU,iBAAiB,QAAQ;EAC/D,OAAO,OAAO,eAAe;EAC7B,OAAO,aAAa;EACpB,KAAK,OAAO,aAAa,QAAQ;EACjC,aAAa,OAAO,aAAa,QAAQ;;;;;;uBAOrB;YACE,QAAQ;EAA9B,YAAsB,QAAQ;gBAEhB,UAAU;gBAIV,UAAU;YAId;;;;;;;;;;;;;;;;;uBAsBU,oBACpB;EAAuB;GACvB;EAAuB;GACvB,YACA,aACA,qBACA,WACA,YAAY,mBACJ;YACE,QAAM,YAAA;;;;;qBAMG,qBAAqB,QACtC,eAAe,cAAc,cAAc,YAAY,aAAa,qBAAqB;;;;;;YAQ3E,QAAQ,UAAU,YAAY,QAAQ;;;;;YAQ5C,aAAa;EAIjB,OAAO,OAAO,eAAe,QAAQ;EAarC,QAAQ,YAAY,UAAU,iBAAiB,QAAQ;EAgCvD,OAAO,OAAO,eAAe,QAAQ;EAerC,OAAO,aAAa;EAQpB,KAAK,OAAO,aAAa,QAAQ;EAMjC,aAAa,OAAO,aAAa,QAAQ;;;;;EAU/C,WAAW;;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/namespaces/base.ts","../src/namespaces/agent.ts","../src/namespaces/mcp.ts","../src/namespaces/mcp-server.ts","../src/namespaces/prompt.ts","../src/namespaces/scorer.ts","../src/namespaces/workspace.ts","../src/namespaces/skill.ts","../src/namespaces/favorites.ts","../src/template-engine.ts","../src/rule-evaluator.ts","../src/instruction-builder.ts","../src/providers.ts","../src/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;UAYiB,eACf;EAAuB;GACvB;EAAuB;GACvB,YACA,aACA,qBACA;EAEA,OAAO,OAAO,eAAe;EAC7B,gBAAgB,YAAY,UAAU,iBAAiB,QAAQ;EAC/D,OAAO,OAAO,eAAe;EAC7B,OAAO,aAAa;EACpB,KAAK,OAAO,aAAa,QAAQ;EACjC,aAAa,OAAO,aAAa,QAAQ;;;;;;uBAOrB;YACE,QAAQ;EAA9B,YAAsB,QAAQ;gBAEhB,UAAU;gBAIV,UAAU;YAId;;;;;;;;;;;;;;;;;uBAsBU,oBACpB;EAAuB;GACvB;EAAuB;GACvB,YACA,aACA,qBACA,WACA,YAAY,mBACJ;YACE,QAAM,YAAA;;;;;qBAMG,qBAAqB,QACtC,eAAe,cAAc,cAAc,YAAY,aAAa,qBAAqB;;;;;;YAQ3E,QAAQ,UAAU,YAAY,QAAQ;;;;;YAQ5C,aAAa;EAIjB,OAAO,OAAO,eAAe,QAAQ;EAarC,QAAQ,YAAY,UAAU,iBAAiB,QAAQ;EAgCvD,OAAO,OAAO,eAAe,QAAQ;EAerC,OAAO,aAAa;EAQpB,KAAK,OAAO,aAAa,QAAQ;EAMjC,aAAa,OAAO,aAAa,QAAQ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kB,WAAW,WAAW,SAAS;;;UChFhD;EACf,qBAAqB;;EAErB;;;;;;;;;;iBAWoB,yBACpB,QAAQ,yBACR,SAAS,yBACT,MAAM,yBACL;;;cC3BU,yBAAyB;EACpC;EACA;EACA;;cAyBW,sBAAsB;EACjC;EACA;EACA;EACA,MAAM;;;;cCmBK,wBAAwB;;EAEnC,WAAW;;EAEX,WAAW;UAEH;UACA;UACA;UACA;UACA;mBACS;UACT;UACA;mBACS;UACT;UACA;;;;;;WAOC,eAAe,YAAY;;;;;;WAO3B,aAAa,YAAY;;;;;;;WAQzB,cAAc,YAAY;;;;;;WAO1B,YAAY,YAAY;;;;;;WAOxB,cAAc,YAAY;WAEnB,OAAO;WACP,KAAK;WACL,WAAW;WACX,QAAQ;WACR,QAAQ;WACR,WAAW;WACX,OAAO;WACP,WAAW;EAE3B,YAAY,SAAS;;;;;EA4DrB,mBAAmB,QAAQ;;;;;;;;;;;;UAkEb;;;;;;;;UAoDA;;EA6Cd;;EAMM,0BAA0B,QAAQ;;;;;EAmBxC;;;;;EASM,kBAAkB,QAAQ;;;;;;;UA6ClB;;EAuBd;;EAKA,4BAA4B;;EAK5B,gBAAgB,aAAa;;;;;EAQ7B,uBAAuB,aAAa;;EASpC,oBAAoB,eAAe;;EAKnC,qBAAqB,aAAa;;EAKlC,yBAAyB,eAAe;;EAIxC,0BAA0B;;EAK1B,uBAAuB;;EAKvB,yBAAyB;;;;;;;;;;;EAcnB,iBAAiB,qBAAqB,iBAAiB,0BAA0B,QAAQ"}
|
package/dist/index.js
CHANGED
|
@@ -732,6 +732,13 @@ function getProvidedAgentRecordFields(input) {
|
|
|
732
732
|
if (status !== void 0) recordFields.status = status;
|
|
733
733
|
return Object.keys(recordFields).length > 1 ? recordFields : null;
|
|
734
734
|
}
|
|
735
|
+
function isMemoryIdRef(ref) {
|
|
736
|
+
return !!ref && "type" in ref && ref.type === "id";
|
|
737
|
+
}
|
|
738
|
+
/** Tagged inline refs and legacy untagged configs both resolve to the serialized config. */
|
|
739
|
+
function unwrapInlineMemory(ref) {
|
|
740
|
+
return "type" in ref && ref.type === "inline" ? ref.config : ref;
|
|
741
|
+
}
|
|
735
742
|
var EditorAgentNamespace = class extends CrudEditorNamespace {
|
|
736
743
|
constructor(..._args) {
|
|
737
744
|
super(..._args);
|
|
@@ -1073,6 +1080,41 @@ var EditorAgentNamespace = class extends CrudEditorNamespace {
|
|
|
1073
1080
|
} : { ...variant.value };
|
|
1074
1081
|
return result;
|
|
1075
1082
|
}
|
|
1083
|
+
/**
|
|
1084
|
+
* Accumulate matching memory variants. Inline configs shallow-merge like
|
|
1085
|
+
* other object fields, but a registered-memory reference replaces whatever
|
|
1086
|
+
* has accumulated (and a later inline variant replaces a reference), so the
|
|
1087
|
+
* result is never a hybrid of a reference and inline config.
|
|
1088
|
+
*/
|
|
1089
|
+
accumulateMemoryVariants(variants, context) {
|
|
1090
|
+
let result;
|
|
1091
|
+
for (const variant of variants) {
|
|
1092
|
+
if (variant.rules && !evaluateRuleGroup(variant.rules, context)) continue;
|
|
1093
|
+
if (isMemoryIdRef(variant.value)) {
|
|
1094
|
+
result = variant.value;
|
|
1095
|
+
continue;
|
|
1096
|
+
}
|
|
1097
|
+
const inline = unwrapInlineMemory(variant.value);
|
|
1098
|
+
result = result && !isMemoryIdRef(result) ? {
|
|
1099
|
+
...unwrapInlineMemory(result),
|
|
1100
|
+
...inline
|
|
1101
|
+
} : { ...inline };
|
|
1102
|
+
}
|
|
1103
|
+
return result;
|
|
1104
|
+
}
|
|
1105
|
+
resolveConditionalMemory(variants) {
|
|
1106
|
+
const registeredMemory = /* @__PURE__ */ new Map();
|
|
1107
|
+
const usableVariants = variants.filter((variant) => {
|
|
1108
|
+
if (!isMemoryIdRef(variant.value)) return true;
|
|
1109
|
+
const registered = this.resolveRegisteredMemory(variant.value.memoryId);
|
|
1110
|
+
if (registered) registeredMemory.set(variant.value.memoryId, registered);
|
|
1111
|
+
return Boolean(registered);
|
|
1112
|
+
});
|
|
1113
|
+
return ({ requestContext }) => {
|
|
1114
|
+
const resolved = this.accumulateMemoryVariants(usableVariants, requestContext.toJSON());
|
|
1115
|
+
return isMemoryIdRef(resolved) ? registeredMemory.get(resolved.memoryId) : this.resolveStoredMemory(resolved);
|
|
1116
|
+
};
|
|
1117
|
+
}
|
|
1076
1118
|
async createAgentFromStoredConfig(storedAgent) {
|
|
1077
1119
|
if (!this.mastra) throw new Error("MastraEditor is not registered with a Mastra instance");
|
|
1078
1120
|
this.logger?.debug(`[createAgentFromStoredConfig] Creating agent from stored config "${storedAgent.id}"`);
|
|
@@ -1137,11 +1179,7 @@ var EditorAgentNamespace = class extends CrudEditorNamespace {
|
|
|
1137
1179
|
const resolved = Array.isArray(variants[0]?.value) ? this.accumulateArrayVariants(variants, ctx) : this.accumulateObjectVariants(variants, ctx);
|
|
1138
1180
|
return this.resolveStoredAgents(resolved);
|
|
1139
1181
|
} : this.resolveStoredAgents(storedAgent.agents);
|
|
1140
|
-
const memory = hasConditionalMemory ? (
|
|
1141
|
-
const ctx = requestContext.toJSON();
|
|
1142
|
-
const resolved = this.accumulateObjectVariants(storedAgent.memory, ctx);
|
|
1143
|
-
return this.resolveStoredMemory(resolved);
|
|
1144
|
-
} : this.resolveStoredMemory(storedAgent.memory);
|
|
1182
|
+
const memory = hasConditionalMemory ? this.resolveConditionalMemory(storedAgent.memory) : this.resolveStoredMemory(storedAgent.memory);
|
|
1145
1183
|
const scorers = hasConditionalScorers ? async ({ requestContext }) => {
|
|
1146
1184
|
const ctx = requestContext.toJSON();
|
|
1147
1185
|
const resolved = this.accumulateObjectVariants(storedAgent.scorers, ctx);
|
|
@@ -1484,8 +1522,8 @@ var EditorAgentNamespace = class extends CrudEditorNamespace {
|
|
|
1484
1522
|
}
|
|
1485
1523
|
return resolvedAgents;
|
|
1486
1524
|
}
|
|
1487
|
-
resolveStoredMemory(
|
|
1488
|
-
if (!
|
|
1525
|
+
resolveStoredMemory(memoryRef) {
|
|
1526
|
+
if (!memoryRef) {
|
|
1489
1527
|
this.logger?.debug(`[resolveStoredMemory] No memory config provided`);
|
|
1490
1528
|
return;
|
|
1491
1529
|
}
|
|
@@ -1493,6 +1531,22 @@ var EditorAgentNamespace = class extends CrudEditorNamespace {
|
|
|
1493
1531
|
this.logger?.warn("MastraEditor not registered with Mastra instance. Cannot instantiate memory.");
|
|
1494
1532
|
return;
|
|
1495
1533
|
}
|
|
1534
|
+
if (isMemoryIdRef(memoryRef)) return this.resolveRegisteredMemory(memoryRef.memoryId);
|
|
1535
|
+
return this.buildInlineMemory(unwrapInlineMemory(memoryRef));
|
|
1536
|
+
}
|
|
1537
|
+
/**
|
|
1538
|
+
* Look up a Memory instance registered on Mastra, by registry key first and
|
|
1539
|
+
* then by the instance's own id. A missing reference is not fatal: the agent
|
|
1540
|
+
* runs without memory and stored threads/messages are left untouched.
|
|
1541
|
+
*/
|
|
1542
|
+
resolveRegisteredMemory(memoryId) {
|
|
1543
|
+
const registry = this.mastra?.listMemory() ?? {};
|
|
1544
|
+
const memory = registry[memoryId] ?? Object.values(registry).find((m) => m.id === memoryId);
|
|
1545
|
+
if (!memory) this.logger?.warn(`Memory "${memoryId}" referenced in stored agent but not registered in Mastra. The agent will run without memory.`);
|
|
1546
|
+
return memory;
|
|
1547
|
+
}
|
|
1548
|
+
buildInlineMemory(memoryConfig) {
|
|
1549
|
+
if (!this.mastra) return void 0;
|
|
1496
1550
|
try {
|
|
1497
1551
|
let vector;
|
|
1498
1552
|
if (memoryConfig.vector) {
|
|
@@ -1603,7 +1657,12 @@ var EditorAgentNamespace = class extends CrudEditorNamespace {
|
|
|
1603
1657
|
const workflowKeys = Object.keys(workflows || {});
|
|
1604
1658
|
const agentsResolved = await agent.listAgents({ requestContext });
|
|
1605
1659
|
const agentKeys = Object.keys(agentsResolved || {});
|
|
1606
|
-
const
|
|
1660
|
+
const memory = await agent.getMemory({ requestContext });
|
|
1661
|
+
const registeredMemoryKey = memory ? Object.entries(this.mastra?.listMemory() ?? {}).find(([, registered]) => registered === memory)?.[0] : void 0;
|
|
1662
|
+
const memoryConfig = registeredMemoryKey ? {
|
|
1663
|
+
type: "id",
|
|
1664
|
+
memoryId: registeredMemoryKey
|
|
1665
|
+
} : memory?.getConfig();
|
|
1607
1666
|
let storedScorers;
|
|
1608
1667
|
const resolvedScorers = await agent.listScorers({ requestContext });
|
|
1609
1668
|
if (resolvedScorers && Object.keys(resolvedScorers).length > 0) {
|