@mastra/editor 0.15.0 → 0.15.1-alpha.4
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/composio.cjs +1 -6
- package/dist/composio.cjs.map +1 -1
- package/dist/composio.d.cts.map +1 -1
- package/dist/composio.d.ts.map +1 -1
- package/dist/composio.js +1 -6
- package/dist/composio.js.map +1 -1
- package/dist/index.cjs +90 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -0
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +90 -11
- package/dist/index.js.map +1 -1
- package/package.json +10 -10
package/dist/index.d.cts
CHANGED
|
@@ -91,6 +91,8 @@ declare abstract class CrudEditorNamespace<TCreateInput extends {
|
|
|
91
91
|
//#endregion
|
|
92
92
|
//#region src/namespaces/agent.d.ts
|
|
93
93
|
declare class EditorAgentNamespace extends CrudEditorNamespace<StorageCreateAgentInput, StorageUpdateAgentInput, StorageListAgentsInput, StorageListAgentsOutput, StorageListAgentsResolvedOutput, StorageResolvedAgentType, Agent> {
|
|
94
|
+
/** IDs of stored agents this namespace registered with Mastra. */
|
|
95
|
+
private _registeredStoredAgentIds;
|
|
94
96
|
protected getStorageAdapter(): Promise<StorageAdapter<StorageCreateAgentInput, StorageUpdateAgentInput, StorageListAgentsInput, StorageListAgentsOutput, StorageListAgentsResolvedOutput, StorageResolvedAgentType>>;
|
|
95
97
|
/**
|
|
96
98
|
* Hydrate a stored agent config into a runtime Agent instance.
|
|
@@ -115,6 +117,12 @@ declare class EditorAgentNamespace extends CrudEditorNamespace<StorageCreateAgen
|
|
|
115
117
|
*/
|
|
116
118
|
private ensureStoredWorkspace;
|
|
117
119
|
protected onCacheEvict(id: string): void;
|
|
120
|
+
/**
|
|
121
|
+
* Clear cached agents. Extends the base clear-all to also evict stored agents
|
|
122
|
+
* that were registered with Mastra via version-specific requests, which skip
|
|
123
|
+
* the value cache and would otherwise survive a no-ID clearCache().
|
|
124
|
+
*/
|
|
125
|
+
clearCache(id?: string): void;
|
|
118
126
|
/**
|
|
119
127
|
* Evict all cached agents that reference a given skill ID.
|
|
120
128
|
* Called by EditorSkillNamespace after a skill is published so that
|
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;;;;cCPA,6BAA6B,oBACxC,yBACA,yBACA,wBACA,yBACA,iCACA,0BACA;;UAGQ;YAEQ,qBAAqB,QACnC,eACE,yBACA,yBACA,wBACA,yBACA,iCACA;;;;YAiDY,QAA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;;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.d.ts
CHANGED
|
@@ -91,6 +91,8 @@ declare abstract class CrudEditorNamespace<TCreateInput extends {
|
|
|
91
91
|
//#endregion
|
|
92
92
|
//#region src/namespaces/agent.d.ts
|
|
93
93
|
declare class EditorAgentNamespace extends CrudEditorNamespace<StorageCreateAgentInput, StorageUpdateAgentInput, StorageListAgentsInput, StorageListAgentsOutput, StorageListAgentsResolvedOutput, StorageResolvedAgentType, Agent> {
|
|
94
|
+
/** IDs of stored agents this namespace registered with Mastra. */
|
|
95
|
+
private _registeredStoredAgentIds;
|
|
94
96
|
protected getStorageAdapter(): Promise<StorageAdapter<StorageCreateAgentInput, StorageUpdateAgentInput, StorageListAgentsInput, StorageListAgentsOutput, StorageListAgentsResolvedOutput, StorageResolvedAgentType>>;
|
|
95
97
|
/**
|
|
96
98
|
* Hydrate a stored agent config into a runtime Agent instance.
|
|
@@ -115,6 +117,12 @@ declare class EditorAgentNamespace extends CrudEditorNamespace<StorageCreateAgen
|
|
|
115
117
|
*/
|
|
116
118
|
private ensureStoredWorkspace;
|
|
117
119
|
protected onCacheEvict(id: string): void;
|
|
120
|
+
/**
|
|
121
|
+
* Clear cached agents. Extends the base clear-all to also evict stored agents
|
|
122
|
+
* that were registered with Mastra via version-specific requests, which skip
|
|
123
|
+
* the value cache and would otherwise survive a no-ID clearCache().
|
|
124
|
+
*/
|
|
125
|
+
clearCache(id?: string): void;
|
|
118
126
|
/**
|
|
119
127
|
* Evict all cached agents that reference a given skill ID.
|
|
120
128
|
* Called by EditorSkillNamespace after a skill is published so that
|
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;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CdA,eAAe,kBAAkB,SAAS;;;;;;;;;;iBC8C1C,kBAAkB,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
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { BUILT_IN_PROCESSOR_PROVIDERS, PhaseFilteredProcessor } from "@mastra/core/processor-provider";
|
|
2
2
|
import { FilesystemStore, MastraCompositeStore, SourceAgentsSourceControl, createGitHubSourceControlProviderFromEnv } from "@mastra/core/storage";
|
|
3
3
|
import { UnknownToolProviderError, resolveStoredToolProviders } from "@mastra/core/tool-provider";
|
|
4
|
-
import { createHash } from "crypto";
|
|
5
4
|
import { Memory } from "@mastra/memory";
|
|
6
5
|
import { Agent } from "@mastra/core/agent";
|
|
7
6
|
import { CompositeFilesystem, CompositeVersionedSkillSource, LocalFilesystem, LocalSandbox, Workspace, publishSkillFromSource } from "@mastra/core/workspace";
|
|
@@ -10,6 +9,7 @@ import { RequestContext } from "@mastra/core/request-context";
|
|
|
10
9
|
import { ProcessorStepSchema } from "@mastra/core/processors";
|
|
11
10
|
import { createStep, createWorkflow } from "@mastra/core/workflows";
|
|
12
11
|
import { deepEqual } from "@mastra/core/utils";
|
|
12
|
+
import { createHash } from "crypto";
|
|
13
13
|
import { createScorer } from "@mastra/core/evals";
|
|
14
14
|
//#region src/namespaces/base.ts
|
|
15
15
|
/**
|
|
@@ -298,6 +298,25 @@ async function resolveInstructionBlocks(blocks, context, deps) {
|
|
|
298
298
|
//#region src/processor-graph-hydrator.ts
|
|
299
299
|
const PASSTHROUGH_STEP_PREFIX = "passthrough-";
|
|
300
300
|
/**
|
|
301
|
+
* Override a hydrated workflow step's ID so it derives from the unique
|
|
302
|
+
* `ProcessorGraphStep.id` of the graph node (`processor:<graphStepId>`) rather
|
|
303
|
+
* than from the resolved processor's stable `id`. Without this, two distinct
|
|
304
|
+
* graph nodes whose provider returns processors with the same `id` collapse to a
|
|
305
|
+
* single workflow step (steps are keyed by `step.id`), overwriting configured
|
|
306
|
+
* nodes and making parallel/branch outputs ambiguous.
|
|
307
|
+
*
|
|
308
|
+
* Uses a shallow spread (not core's `cloneStep`) so that every property is
|
|
309
|
+
* preserved — notably `providesSkillDiscovery` and the bound
|
|
310
|
+
* `getLoadedToolsForRequestContext`, which `cloneStep` drops — and so the
|
|
311
|
+
* provider-created processor is never mutated.
|
|
312
|
+
*/
|
|
313
|
+
function withGraphStepId(step, graphStepId) {
|
|
314
|
+
return {
|
|
315
|
+
...step,
|
|
316
|
+
id: `processor:${graphStepId}`
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
301
320
|
* Resolve a single ProcessorGraphStep into a PhaseFilteredProcessor instance.
|
|
302
321
|
*/
|
|
303
322
|
function resolveStep(step, ctx) {
|
|
@@ -381,7 +400,7 @@ function buildWorkflow(entries, workflowId, ctx) {
|
|
|
381
400
|
for (const entry of entries) if (entry.type === "step") {
|
|
382
401
|
const processor = resolveStep(entry.step, ctx);
|
|
383
402
|
if (!processor) continue;
|
|
384
|
-
const step = createStep(processor);
|
|
403
|
+
const step = withGraphStepId(createStep(processor), entry.step.id);
|
|
385
404
|
workflow = workflow.then(step);
|
|
386
405
|
hasSteps = true;
|
|
387
406
|
} else if (entry.type === "parallel") {
|
|
@@ -389,7 +408,7 @@ function buildWorkflow(entries, workflowId, ctx) {
|
|
|
389
408
|
if (branchEntries.length === 1 && branchEntries[0].type === "step") {
|
|
390
409
|
const proc = resolveStep(branchEntries[0].step, ctx);
|
|
391
410
|
if (!proc) return void 0;
|
|
392
|
-
return createStep(proc);
|
|
411
|
+
return withGraphStepId(createStep(proc), branchEntries[0].step.id);
|
|
393
412
|
}
|
|
394
413
|
return buildWorkflow(branchEntries, `${workflowId}-parallel-branch-${branchIdx}`, ctx);
|
|
395
414
|
}).filter((s) => Boolean(s));
|
|
@@ -400,23 +419,30 @@ function buildWorkflow(entries, workflowId, ctx) {
|
|
|
400
419
|
}
|
|
401
420
|
} else if (entry.type === "conditional") {
|
|
402
421
|
const branchTuples = [];
|
|
422
|
+
const explicitRuleGroups = [];
|
|
423
|
+
let hasUserDefault = false;
|
|
424
|
+
const anyExplicitMatch = (inputData) => explicitRuleGroups.some((rules) => evaluateRuleGroup(rules, inputData));
|
|
403
425
|
for (const [i, condition] of entry.conditions.entries()) {
|
|
404
426
|
let branchStep;
|
|
405
427
|
if (condition.steps.length === 1 && condition.steps[0].type === "step") {
|
|
406
428
|
const proc = resolveStep(condition.steps[0].step, ctx);
|
|
407
429
|
if (!proc) continue;
|
|
408
|
-
branchStep = createStep(proc);
|
|
430
|
+
branchStep = withGraphStepId(createStep(proc), condition.steps[0].step.id);
|
|
409
431
|
} else {
|
|
410
432
|
branchStep = buildWorkflow(condition.steps, `${workflowId}-cond-branch-${i}`, ctx);
|
|
411
433
|
if (!branchStep) continue;
|
|
412
434
|
}
|
|
413
435
|
if (condition.rules) {
|
|
414
436
|
const rules = condition.rules;
|
|
437
|
+
explicitRuleGroups.push(rules);
|
|
415
438
|
const conditionFn = async ({ inputData }) => {
|
|
416
439
|
return evaluateRuleGroup(rules, inputData);
|
|
417
440
|
};
|
|
418
441
|
branchTuples.push([conditionFn, branchStep]);
|
|
419
|
-
} else
|
|
442
|
+
} else {
|
|
443
|
+
hasUserDefault = true;
|
|
444
|
+
branchTuples.push([async ({ inputData }) => !anyExplicitMatch(inputData), branchStep]);
|
|
445
|
+
}
|
|
420
446
|
}
|
|
421
447
|
if (branchTuples.length > 0) {
|
|
422
448
|
const passthroughStep = createStep({
|
|
@@ -425,7 +451,7 @@ function buildWorkflow(entries, workflowId, ctx) {
|
|
|
425
451
|
outputSchema: ProcessorStepSchema,
|
|
426
452
|
execute: async ({ inputData }) => inputData
|
|
427
453
|
});
|
|
428
|
-
branchTuples.push([async () =>
|
|
454
|
+
branchTuples.push([async ({ inputData }) => !anyExplicitMatch(inputData) && !hasUserDefault, passthroughStep]);
|
|
429
455
|
workflow = workflow.branch(branchTuples);
|
|
430
456
|
workflow = workflow.map(mergeBranchOutputs);
|
|
431
457
|
hasSteps = true;
|
|
@@ -587,6 +613,42 @@ async function createVersionFromSnapshotUpdate({ store, parentId, parentIdField,
|
|
|
587
613
|
throw lastError;
|
|
588
614
|
}
|
|
589
615
|
//#endregion
|
|
616
|
+
//#region src/namespaces/workspace-identity.ts
|
|
617
|
+
/**
|
|
618
|
+
* `JSON.stringify` with deterministic key ordering at every level.
|
|
619
|
+
*
|
|
620
|
+
* Object key order is preserved by `JSON.stringify`, so semantically identical
|
|
621
|
+
* configs whose keys were inserted in a different order (e.g. after an agent
|
|
622
|
+
* update, an import, or a storage backend that normalizes key order) would
|
|
623
|
+
* otherwise serialize differently. Sorting keys recursively makes the output
|
|
624
|
+
* canonical. Array order and scalar values are left untouched, so they remain
|
|
625
|
+
* significant.
|
|
626
|
+
*/
|
|
627
|
+
function stableStringify(value) {
|
|
628
|
+
return JSON.stringify(value, (_key, val) => {
|
|
629
|
+
if (val && typeof val === "object" && !Array.isArray(val)) {
|
|
630
|
+
const sorted = Object.create(null);
|
|
631
|
+
for (const k of Object.keys(val).sort()) sorted[k] = val[k];
|
|
632
|
+
return sorted;
|
|
633
|
+
}
|
|
634
|
+
return val;
|
|
635
|
+
});
|
|
636
|
+
}
|
|
637
|
+
/**
|
|
638
|
+
* Derive a deterministic identity for an inline workspace config.
|
|
639
|
+
*
|
|
640
|
+
* The ID is content-addressed via a canonical (key-order-independent) hash so
|
|
641
|
+
* that equivalent configs resolve to the same stored workspace instead of
|
|
642
|
+
* creating duplicates. Array order and value differences remain significant.
|
|
643
|
+
*/
|
|
644
|
+
function computeInlineWorkspaceIdentity(config) {
|
|
645
|
+
const configHash = createHash("sha256").update(stableStringify(config)).digest("hex").slice(0, 12);
|
|
646
|
+
return {
|
|
647
|
+
workspaceId: `inline-${configHash}`,
|
|
648
|
+
configHash
|
|
649
|
+
};
|
|
650
|
+
}
|
|
651
|
+
//#endregion
|
|
590
652
|
//#region src/namespaces/agent.ts
|
|
591
653
|
const AGENT_SNAPSHOT_CONFIG_FIELDS = [
|
|
592
654
|
"name",
|
|
@@ -681,6 +743,10 @@ function getProvidedAgentRecordFields(input) {
|
|
|
681
743
|
return Object.keys(recordFields).length > 1 ? recordFields : null;
|
|
682
744
|
}
|
|
683
745
|
var EditorAgentNamespace = class extends CrudEditorNamespace {
|
|
746
|
+
constructor(..._args) {
|
|
747
|
+
super(..._args);
|
|
748
|
+
this._registeredStoredAgentIds = /* @__PURE__ */ new Set();
|
|
749
|
+
}
|
|
684
750
|
async getStorageAdapter() {
|
|
685
751
|
const storage = this.mastra?.getStorage();
|
|
686
752
|
if (!storage) throw new Error("Storage is not configured");
|
|
@@ -816,8 +882,7 @@ var EditorAgentNamespace = class extends CrudEditorNamespace {
|
|
|
816
882
|
});
|
|
817
883
|
this.logger?.debug(`[ensureStoredWorkspace] Persisted runtime workspace '${workspaceRef.workspaceId}' to DB`);
|
|
818
884
|
} else if (workspaceRef.type === "inline") {
|
|
819
|
-
const configHash =
|
|
820
|
-
const workspaceId = `inline-${configHash}`;
|
|
885
|
+
const { workspaceId, configHash } = computeInlineWorkspaceIdentity(workspaceRef.config);
|
|
821
886
|
if (await workspaceNs.getById(workspaceId)) return;
|
|
822
887
|
await workspaceNs.create({
|
|
823
888
|
id: workspaceId,
|
|
@@ -834,11 +899,22 @@ var EditorAgentNamespace = class extends CrudEditorNamespace {
|
|
|
834
899
|
}
|
|
835
900
|
}
|
|
836
901
|
onCacheEvict(id) {
|
|
902
|
+
this._registeredStoredAgentIds.delete(id);
|
|
837
903
|
try {
|
|
838
904
|
if ((this.mastra?.getAgentById(id))?.source === "stored") this.mastra?.removeAgent(id);
|
|
839
905
|
} catch {}
|
|
840
906
|
}
|
|
841
907
|
/**
|
|
908
|
+
* Clear cached agents. Extends the base clear-all to also evict stored agents
|
|
909
|
+
* that were registered with Mastra via version-specific requests, which skip
|
|
910
|
+
* the value cache and would otherwise survive a no-ID clearCache().
|
|
911
|
+
*/
|
|
912
|
+
clearCache(id) {
|
|
913
|
+
super.clearCache(id);
|
|
914
|
+
if (id) return;
|
|
915
|
+
for (const registeredId of Array.from(this._registeredStoredAgentIds)) this.onCacheEvict(registeredId);
|
|
916
|
+
}
|
|
917
|
+
/**
|
|
842
918
|
* Evict all cached agents that reference a given skill ID.
|
|
843
919
|
* Called by EditorSkillNamespace after a skill is published so that
|
|
844
920
|
* subsequent agent.getById() calls re-hydrate with the updated skill version.
|
|
@@ -1177,7 +1253,10 @@ var EditorAgentNamespace = class extends CrudEditorNamespace {
|
|
|
1177
1253
|
...skillsFormat && { skillsFormat },
|
|
1178
1254
|
...durable !== void 0 && { durable }
|
|
1179
1255
|
});
|
|
1180
|
-
if (!this.getCodeDefinedAgent(storedAgent.id))
|
|
1256
|
+
if (!this.getCodeDefinedAgent(storedAgent.id)) {
|
|
1257
|
+
this.mastra?.addAgent(agent, storedAgent.id, { source: "stored" });
|
|
1258
|
+
this._registeredStoredAgentIds.add(storedAgent.id);
|
|
1259
|
+
}
|
|
1181
1260
|
this.logger?.debug(`[createAgentFromStoredConfig] Successfully created agent "${storedAgent.id}"`);
|
|
1182
1261
|
return agent;
|
|
1183
1262
|
}
|
|
@@ -1612,8 +1691,8 @@ var EditorAgentNamespace = class extends CrudEditorNamespace {
|
|
|
1612
1691
|
return;
|
|
1613
1692
|
}
|
|
1614
1693
|
if (workspaceRef.type === "inline") {
|
|
1615
|
-
const
|
|
1616
|
-
return workspaceNs.hydrateSnapshotToWorkspace(
|
|
1694
|
+
const { workspaceId } = computeInlineWorkspaceIdentity(workspaceRef.config);
|
|
1695
|
+
return workspaceNs.hydrateSnapshotToWorkspace(workspaceId, workspaceRef.config, hydrateOptions);
|
|
1617
1696
|
}
|
|
1618
1697
|
if (workspaceRef.type === "provider") return workspaceNs.resolveWorkspaceProvider(workspaceRef.provider, workspaceRef.config);
|
|
1619
1698
|
}
|