@easynet/agent-memory 1.0.52 → 1.0.53

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/README.md CHANGED
@@ -2,54 +2,40 @@
2
2
 
3
3
  ## Introduction
4
4
 
5
- `@easynet/agent-memory` adds memory storage and recall for agents. It supports common scopes such as `thread`, `cross_thread`, and `knowledge`, and registers the memory client into the default `AgentContext`.
5
+ `@easynet/agent-memory` provides the memory layer for agents. It manages `thread`, `cross_thread`, and `knowledge` memory and registers the memory client into the default `AgentContext`.
6
6
 
7
- ## API Reference
7
+ ## Exposed SDK
8
8
 
9
- | API | What it does | Minimal usage |
9
+ | Export | Type | Purpose |
10
10
  | --- | --- | --- |
11
- | `createAgentMemory` | Create a memory client and register it into `AgentContext`. | `const memory = await createAgentMemory({ configPath: "./memory.yaml" })` |
11
+ | `createAgentMemory` | function | Creates the memory client and registers it into the default `AgentContext`. |
12
+ | `CreateAgentMemoryOptions` | type | Options for loading memory configuration and initializing memory. |
12
13
 
13
14
  ## Usage
14
15
 
15
- Create `config/memory.yaml`:
16
-
17
- ```yaml
18
- providers:
19
- - id: default
20
- type: in_memory
21
-
22
- defaultProvider: default
23
-
24
- memoryTypes:
25
- thread: { providerId: default, allowWrite: true, maxItems: 20 }
26
- cross_thread: { providerId: default, allowWrite: true, maxItems: 20 }
27
- knowledge: { providerId: default, allowWrite: true, maxItems: 20 }
16
+ ```bash
17
+ npm i @easynet/agent-memory
28
18
  ```
29
19
 
30
- Initialize and use memory:
31
-
32
20
  ```ts
33
21
  import { createAgentMemory } from "@easynet/agent-memory";
34
22
 
35
- const memory = await createAgentMemory({
36
- configPath: "./config/memory.yaml",
37
- });
38
-
39
- await memory.memorize("user:alice", "cross_thread", "Prefers concise English answers.");
23
+ const memory = await createAgentMemory("./config/memory.yaml");
40
24
 
25
+ await memory.memorize("user:demo", "cross_thread", "User prefers concise answers.");
41
26
  const result = await memory.recall({
42
- namespace: "user:alice",
43
- query: "language preference",
27
+ namespace: "user:demo",
28
+ query: "user preference",
29
+ types: ["cross_thread"],
44
30
  topK: 5,
45
31
  });
46
32
 
47
33
  console.log(result.injectedText);
48
34
  ```
49
35
 
50
- ### YAML config
36
+ ## Configuration
51
37
 
52
- Example `config/memory.yaml`:
38
+ The default config file is `config/memory.yaml`.
53
39
 
54
40
  ```yaml
55
41
  apiVersion: easynet.world/v1
@@ -63,12 +49,6 @@ spec:
63
49
  type: in_memory
64
50
  allowWrite: true
65
51
  maxItems: 20
66
- sessionCompaction:
67
- enabled: true
68
- maxTokens: 3000
69
- keepRecentTurns: 12
70
- summaryKey: __session_summary__
71
- checkEveryTurns: 3
72
52
 
73
53
  cross_thread:
74
54
  store:
@@ -81,26 +61,13 @@ spec:
81
61
  type: in_memory
82
62
  allowWrite: true
83
63
  maxItems: 20
84
-
85
- observability:
86
- trace: false
87
-
88
- privacy:
89
- forbiddenMetadataKeys:
90
- - password
91
- - api_key
92
- - secret
93
- - token
94
64
  ```
95
65
 
96
- Explanation:
97
-
98
- - `spec.memory.thread`: short-term conversational memory.
99
- - `spec.memory.cross_thread`: long-term user or session memory across conversations.
100
- - `spec.memory.knowledge`: knowledge storage for reusable facts and documents.
101
- - `store.type`: backend type, such as `in_memory`.
102
- - `allowWrite`: whether this memory scope can accept writes.
103
- - `maxItems`: maximum number of recalled items kept per scope.
104
- - `sessionCompaction`: optional summarization of long thread history.
105
- - `observability.trace`: enable recall tracing for debugging.
106
- - `privacy.forbiddenMetadataKeys`: metadata keys that should be stripped before storage.
66
+ Key fields:
67
+
68
+ - `spec.memory.thread`: current conversation memory
69
+ - `spec.memory.cross_thread`: long-term memory across conversations
70
+ - `spec.memory.knowledge`: document and knowledge memory
71
+ - `store.type`: storage backend
72
+ - `allowWrite`: whether writes are allowed
73
+ - `maxItems`: recall limit
@@ -9,8 +9,8 @@ export interface CreateAgentMemoryOptions extends CreateMemoryOptions {
9
9
  *
10
10
  * @example
11
11
  * ```ts
12
- * await createAgentMemory({ configPath: "config/memory.yaml" });
12
+ * await createAgentMemory("config/memory.yaml");
13
13
  * ```
14
14
  */
15
- export declare function createAgentMemory(options?: CreateAgentMemoryOptions): Promise<AgentMemoryClient>;
15
+ export declare function createAgentMemory(configPathOrOptions?: string | CreateAgentMemoryOptions): Promise<AgentMemoryClient>;
16
16
  //# sourceMappingURL=register-memory.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"register-memory.d.ts","sourceRoot":"","sources":["../../src/register-memory.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACvB,MAAM,0BAA0B,CAAC;AAElC,MAAM,WAAW,wBAAyB,SAAQ,mBAAmB;CAAG;AAExE;;;;;;;;;;GAUG;AACH,wBAAsB,iBAAiB,CAAC,OAAO,CAAC,EAAE,wBAAwB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAItG"}
1
+ {"version":3,"file":"register-memory.d.ts","sourceRoot":"","sources":["../../src/register-memory.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACvB,MAAM,0BAA0B,CAAC;AAElC,MAAM,WAAW,wBAAyB,SAAQ,mBAAmB;CAAG;AAExE;;;;;;;;;;GAUG;AACH,wBAAsB,iBAAiB,CACrC,mBAAmB,CAAC,EAAE,MAAM,GAAG,wBAAwB,GACtD,OAAO,CAAC,iBAAiB,CAAC,CAI5B"}
@@ -8,11 +8,11 @@ import { createAgentMemory as createAgentMemoryInstance, } from "./create-agent-
8
8
  *
9
9
  * @example
10
10
  * ```ts
11
- * await createAgentMemory({ configPath: "config/memory.yaml" });
11
+ * await createAgentMemory("config/memory.yaml");
12
12
  * ```
13
13
  */
14
- export async function createAgentMemory(options) {
15
- const memory = await createAgentMemoryInstance(options ?? {});
14
+ export async function createAgentMemory(configPathOrOptions) {
15
+ const memory = await createAgentMemoryInstance(configPathOrOptions ?? {});
16
16
  getDefaultAgentContext().set(AgentContextTokens.Memory, memory);
17
17
  return memory;
18
18
  }
@@ -1 +1 @@
1
- {"version":3,"file":"register-memory.js","sourceRoot":"","sources":["../../src/register-memory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAC3F,OAAO,EACL,iBAAiB,IAAI,yBAAyB,GAG/C,MAAM,0BAA0B,CAAC;AAIlC;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,OAAkC;IACxE,MAAM,MAAM,GAAG,MAAM,yBAAyB,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC;IAC9D,sBAAsB,EAAE,CAAC,GAAG,CAAC,kBAAkB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChE,OAAO,MAAM,CAAC;AAChB,CAAC"}
1
+ {"version":3,"file":"register-memory.js","sourceRoot":"","sources":["../../src/register-memory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAC3F,OAAO,EACL,iBAAiB,IAAI,yBAAyB,GAG/C,MAAM,0BAA0B,CAAC;AAIlC;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,mBAAuD;IAEvD,MAAM,MAAM,GAAG,MAAM,yBAAyB,CAAC,mBAAmB,IAAI,EAAE,CAAC,CAAC;IAC1E,sBAAsB,EAAE,CAAC,GAAG,CAAC,kBAAkB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChE,OAAO,MAAM,CAAC;AAChB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@easynet/agent-memory",
3
- "version": "1.0.52",
3
+ "version": "1.0.53",
4
4
  "description": "Unified memory layer for LangChain / LangGraph / DeepAgents",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",