MCPcopy Create free account
hub / github.com/ForestHubAI/edge-agents / addMemory

Function addMemory

ts/workflow-builder/src/utils/memoryOperations.ts:17–28  ·  view source on GitHub ↗
(type: MemoryType)

Source from the content-addressed store, hash-verified

15
16/** Create a new memory primitive of the given type in the editor store. Returns the new instance. */
17export function addMemory(type: MemoryType): Memory {
18 const id = generateId();
19 const existing = Object.values(useEditorStore.getState().memory).map((m) => m.label);
20 const instance: Memory = {
21 id,
22 label: uniqueName(LABEL_PREFIX[type], existing),
23 type,
24 arguments: seedDefaultArguments(MemoryRegistry.getByType(type)?.parameters ?? []),
25 };
26 useEditorStore.getState().setMemory((mem) => ({ ...mem, [id]: instance }));
27 return instance;
28}
29
30/**
31 * Apply a partial patch to a memory primitive. Top-level `label` and the

Callers 1

addFunction · 0.90

Calls 4

generateIdFunction · 0.90
uniqueNameFunction · 0.90
seedDefaultArgumentsFunction · 0.90
getByTypeMethod · 0.45

Tested by

no test coverage detected