@devxiyang/agent-memo 0.0.2 → 0.0.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/README.md +169 -32
- package/dist/plugins/memory/index.d.ts +10 -2
- package/dist/plugins/memory/index.d.ts.map +1 -1
- package/dist/plugins/memory/index.js +32 -0
- package/dist/plugins/memory/index.js.map +1 -1
- package/dist/plugins/memory/types.d.ts +15 -0
- package/dist/plugins/memory/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/core/memo/memo.d.ts +0 -1
- package/dist/core/memo/memo.d.ts.map +0 -1
- package/dist/core/memo/memo.js +0 -3
- package/dist/core/memo/memo.js.map +0 -1
package/README.md
CHANGED
|
@@ -8,26 +8,44 @@ Agent memory SDK based on a filesystem paradigm. Organizes memories, resources a
|
|
|
8
8
|
|
|
9
9
|
## Concepts
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
### Why a filesystem paradigm?
|
|
12
|
+
|
|
13
|
+
AI agents need persistent memory that is inspectable, portable, and tool-friendly. A local filesystem satisfies all three: you can open any file in your editor, grep across memories, back them up with git, and pass paths directly to external tools (PDF parsers, image processors, embedding pipelines). The SDK adds structure on top — a URI scheme, tiered summaries, relations, and search — without hiding the files from you.
|
|
14
|
+
|
|
15
|
+
### URI scheme
|
|
16
|
+
|
|
17
|
+
`memo://` URIs map 1:1 to physical paths:
|
|
12
18
|
|
|
13
19
|
```
|
|
14
|
-
{workspace}/user/
|
|
15
|
-
|
|
16
|
-
├── .overview.md # L1 ~1-2k tokens, navigational overview
|
|
17
|
-
├── .relations.json # links to other nodes
|
|
18
|
-
├── .meta.json # arbitrary structured metadata
|
|
19
|
-
└── coding.md # L2 actual content
|
|
20
|
+
memo://user/preferences/coding.md → {workspace}/user/preferences/coding.md
|
|
21
|
+
memo://resources/api-docs.md → {workspace}/resources/api-docs.md
|
|
20
22
|
```
|
|
21
23
|
|
|
22
|
-
|
|
24
|
+
### Directory meta files
|
|
23
25
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
Every directory can carry up to four meta files. Their content is always written by the **caller** (your agent or LLM) — the SDK only stores and retrieves them.
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
{workspace}/user/preferences/
|
|
30
|
+
├── .abstract.md # L0: one-sentence summary, ~100 tokens
|
|
31
|
+
├── .overview.md # L1: navigational overview, ~1-2k tokens
|
|
32
|
+
├── .relations.json # typed links to other nodes
|
|
33
|
+
├── .meta.json # arbitrary structured metadata (used internally by plugins)
|
|
34
|
+
├── coding.md # L2: actual content file
|
|
35
|
+
└── communication.md
|
|
36
|
+
```
|
|
29
37
|
|
|
30
|
-
|
|
38
|
+
### Tiered context loading
|
|
39
|
+
|
|
40
|
+
Loading everything into every LLM call is wasteful. The tier system lets you control context budget:
|
|
41
|
+
|
|
42
|
+
| Tier | Source | Typical use |
|
|
43
|
+
|------|--------|-------------|
|
|
44
|
+
| 0 | `.abstract.md` | Always-on system prompt — "what the agent knows exists" |
|
|
45
|
+
| 1 | `.overview.md` | On-demand navigation — drill into a relevant area |
|
|
46
|
+
| 2 | Full file content | Final retrieval — read the actual memory or document |
|
|
47
|
+
|
|
48
|
+
A typical agent loop: load tier-0 summaries at startup → search to find relevant nodes → load tier-2 content for those nodes only.
|
|
31
49
|
|
|
32
50
|
## Installation
|
|
33
51
|
|
|
@@ -46,39 +64,130 @@ yarn add @devxiyang/agent-memo
|
|
|
46
64
|
|
|
47
65
|
## Quick Start
|
|
48
66
|
|
|
67
|
+
The example below shows a **coding assistant** that remembers user preferences, caches reference documentation, and assembles focused context for each LLM call.
|
|
68
|
+
|
|
69
|
+
### 1. Initialize
|
|
70
|
+
|
|
49
71
|
```typescript
|
|
50
|
-
import { FileMemo
|
|
72
|
+
import { FileMemo } from '@devxiyang/agent-memo'
|
|
73
|
+
import { AgentMemory } from '@devxiyang/agent-memo/memory'
|
|
74
|
+
import { AgentResource, UrlFetcher, LocalFetcher } from '@devxiyang/agent-memo/resource'
|
|
51
75
|
|
|
76
|
+
// FileMemo is the filesystem backend.
|
|
77
|
+
// The onWritten hook fires after every file write — use it to keep
|
|
78
|
+
// directory summaries up to date so tier-0 context stays accurate.
|
|
52
79
|
await using memo = new FileMemo({
|
|
53
|
-
workspace: '
|
|
80
|
+
workspace: './agent-workspace',
|
|
54
81
|
hooks: {
|
|
55
82
|
onWritten: async (uri, parentDirs) => {
|
|
56
|
-
// Called after any file write or update (SDK or external tool)
|
|
57
|
-
// Regenerate .abstract.md for affected directories
|
|
58
83
|
for (const dir of parentDirs) {
|
|
59
|
-
const
|
|
60
|
-
await
|
|
84
|
+
const nodes = await memo.ls(dir)
|
|
85
|
+
const summary = await llm.summarize(nodes) // your LLM call
|
|
86
|
+
await memo.writeMeta(dir, { abstract: summary })
|
|
61
87
|
}
|
|
62
88
|
},
|
|
63
89
|
onError: (err, event) => console.error(`[memo:${event}]`, err),
|
|
64
90
|
},
|
|
65
91
|
})
|
|
66
92
|
|
|
67
|
-
|
|
68
|
-
|
|
93
|
+
const memory = new AgentMemory(memo)
|
|
94
|
+
const resource = new AgentResource(memo, [new UrlFetcher(), new LocalFetcher()])
|
|
95
|
+
```
|
|
69
96
|
|
|
70
|
-
|
|
71
|
-
const nodes = await memo.ls('memo://user/memories/')
|
|
97
|
+
### 2. Store user preferences
|
|
72
98
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
99
|
+
```typescript
|
|
100
|
+
// First conversation — learn about the user
|
|
101
|
+
await memory.remember('memo://user/preferences/coding.md',
|
|
102
|
+
'Prefers TypeScript with strict mode. Avoids classes, favors functional style. ' +
|
|
103
|
+
'Uses pnpm and Vitest for testing.',
|
|
104
|
+
{ source: 'onboarding' },
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
await memory.remember('memo://user/preferences/communication.md',
|
|
108
|
+
'Prefers concise answers. Dislikes excessive bullet points. ' +
|
|
109
|
+
'Wants code examples for every non-trivial suggestion.',
|
|
110
|
+
{ source: 'onboarding' },
|
|
111
|
+
)
|
|
112
|
+
|
|
113
|
+
// Later — update as you learn more (createdAt is preserved automatically)
|
|
114
|
+
await memory.remember('memo://user/preferences/coding.md',
|
|
115
|
+
'Prefers TypeScript with strict mode. Avoids classes, favors functional style. ' +
|
|
116
|
+
'Uses pnpm and Vitest. Recently adopted Zod for runtime validation.',
|
|
117
|
+
{ source: 'conversation-18' },
|
|
118
|
+
)
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### 3. Cache reference documentation
|
|
122
|
+
|
|
123
|
+
```typescript
|
|
124
|
+
// Fetch and cache external docs with a TTL
|
|
125
|
+
await resource.fetch(
|
|
126
|
+
'https://zod.dev/README.md',
|
|
127
|
+
'memo://resources/zod-docs.md',
|
|
128
|
+
{ ttl: '7d' },
|
|
129
|
+
)
|
|
130
|
+
|
|
131
|
+
// Cache a local design doc
|
|
132
|
+
await resource.fetch(
|
|
133
|
+
'./docs/architecture.md',
|
|
134
|
+
'memo://resources/architecture.md',
|
|
135
|
+
)
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### 4. Assemble context for an LLM call
|
|
139
|
+
|
|
140
|
+
```typescript
|
|
141
|
+
// --- System prompt (always cheap) ---
|
|
142
|
+
// Tier-0 loads .abstract.md for each directory — one-sentence summaries only.
|
|
143
|
+
// This tells the agent what it knows without burning context budget.
|
|
144
|
+
const systemContext = await memo.context(
|
|
145
|
+
['memo://user/preferences/', 'memo://resources/'],
|
|
146
|
+
0,
|
|
147
|
+
)
|
|
148
|
+
|
|
149
|
+
// --- Targeted retrieval (on demand) ---
|
|
150
|
+
// The user asks about Zod. Search memories for anything relevant.
|
|
151
|
+
const hits = await memory.search('zod validation', {
|
|
152
|
+
scope: ['memo://user/preferences/'],
|
|
153
|
+
limit: 5,
|
|
77
154
|
})
|
|
78
155
|
|
|
79
|
-
//
|
|
80
|
-
const
|
|
81
|
-
const
|
|
156
|
+
// Load full content for matched memories + the cached Zod docs
|
|
157
|
+
const detailUris = hits.map(h => h.uri)
|
|
158
|
+
const detailContext = await memo.context(detailUris, 2)
|
|
159
|
+
|
|
160
|
+
const zodEntry = await resource.read('memo://resources/zod-docs.md')
|
|
161
|
+
|
|
162
|
+
// Build the final prompt
|
|
163
|
+
const prompt = `
|
|
164
|
+
${systemContext}
|
|
165
|
+
|
|
166
|
+
--- Relevant memories ---
|
|
167
|
+
${detailContext}
|
|
168
|
+
|
|
169
|
+
--- Zod reference ---
|
|
170
|
+
${zodEntry?.content ?? '(not cached)'}
|
|
171
|
+
|
|
172
|
+
User: How should I validate an API response with Zod given my preferences?
|
|
173
|
+
`.trim()
|
|
174
|
+
|
|
175
|
+
const reply = await llm.chat(prompt)
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### 5. Soft-delete and hard-delete
|
|
179
|
+
|
|
180
|
+
```typescript
|
|
181
|
+
// Soft-delete: sets forgottenAt in frontmatter, file kept on disk
|
|
182
|
+
// recall() and search() skip it by default
|
|
183
|
+
await memory.forget('memo://user/preferences/communication.md')
|
|
184
|
+
|
|
185
|
+
// Hard-delete: removes the file entirely
|
|
186
|
+
await memory.purge('memo://user/preferences/communication.md')
|
|
187
|
+
|
|
188
|
+
// Expired or re-fetched resources
|
|
189
|
+
await resource.refresh('memo://resources/zod-docs.md') // re-fetch from original URL
|
|
190
|
+
await resource.delete('memo://resources/architecture.md') // remove file + metadata
|
|
82
191
|
```
|
|
83
192
|
|
|
84
193
|
## Binary Files
|
|
@@ -141,6 +250,15 @@ search(query, options?): Promise<SearchResult[]>
|
|
|
141
250
|
context(uris, tier: 0 | 1 | 2): Promise<string>
|
|
142
251
|
```
|
|
143
252
|
|
|
253
|
+
### `BinaryMemo` interface
|
|
254
|
+
|
|
255
|
+
For binary file I/O. `FileMemo` implements this; plugins that handle binary resources depend on it.
|
|
256
|
+
|
|
257
|
+
```typescript
|
|
258
|
+
readBinary(uri): Promise<Uint8Array | null>
|
|
259
|
+
writeBinary(uri, content: Uint8Array): Promise<void>
|
|
260
|
+
```
|
|
261
|
+
|
|
144
262
|
### `FilesystemAccess` interface
|
|
145
263
|
|
|
146
264
|
Implemented by local filesystem backends. Consumed by plugins that need direct path access.
|
|
@@ -257,6 +375,23 @@ const entry = await memory.recall('memo://agent/preferences/coding.md')
|
|
|
257
375
|
// frontmatter: { createdAt, source, confidence }
|
|
258
376
|
// }
|
|
259
377
|
|
|
378
|
+
// List direct children of a directory
|
|
379
|
+
// Defaults to workspace root (memo://) if no URI provided
|
|
380
|
+
// For files: reads frontmatter.summary, does NOT read body
|
|
381
|
+
// For directories: reads .abstract.md if present
|
|
382
|
+
// Excludes forgotten memories by default
|
|
383
|
+
const items = await memory.list('memo://agent/')
|
|
384
|
+
// [
|
|
385
|
+
// { uri, name, isDir: false, summary: 'TypeScript strict mode', forgottenAt?: string },
|
|
386
|
+
// { uri, name, isDir: true, abstract: 'Coding preferences' },
|
|
387
|
+
// ]
|
|
388
|
+
|
|
389
|
+
// With a summary stored at remember() time, list() is enough to navigate
|
|
390
|
+
// without reading every file's full content
|
|
391
|
+
await memory.remember('memo://agent/preferences/coding.md', fullContent, {
|
|
392
|
+
summary: 'TypeScript strict mode, functional style, pnpm + Vitest',
|
|
393
|
+
})
|
|
394
|
+
|
|
260
395
|
// Full-text search across memories
|
|
261
396
|
const hits = await memory.search('TypeScript', {
|
|
262
397
|
scope: ['memo://agent/preferences/'], // restrict to subtree (optional)
|
|
@@ -398,7 +533,9 @@ const resource = new AgentResource(memo, [new S3Fetcher(), new UrlFetcher()])
|
|
|
398
533
|
await resource.fetch('s3://my-bucket/model.bin', 'memo://models/model.bin')
|
|
399
534
|
```
|
|
400
535
|
|
|
401
|
-
Each plugin
|
|
536
|
+
Each plugin depends on interfaces, not the concrete `FileMemo` class:
|
|
537
|
+
- `AgentMemory` requires `Memo & FilesystemAccess`
|
|
538
|
+
- `AgentResource` requires `Memo & BinaryMemo & FilesystemAccess`
|
|
402
539
|
|
|
403
540
|
## Filesystem Structure
|
|
404
541
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Memo, FilesystemAccess, MemoUri } from '../../core/memo/types.js';
|
|
2
|
-
import type { RememberOptions, MemorySearchOptions, MemoryFrontmatter, MemoryEntry } from './types.js';
|
|
3
|
-
export type { RememberOptions, MemorySearchOptions, MemoryFrontmatter, MemoryEntry };
|
|
2
|
+
import type { RememberOptions, MemorySearchOptions, MemoryListOptions, MemoryListItem, MemoryFrontmatter, MemoryEntry } from './types.js';
|
|
3
|
+
export type { RememberOptions, MemorySearchOptions, MemoryListOptions, MemoryListItem, MemoryFrontmatter, MemoryEntry };
|
|
4
4
|
export declare class AgentMemory {
|
|
5
5
|
private readonly memo;
|
|
6
6
|
constructor(memo: Memo & FilesystemAccess);
|
|
@@ -30,6 +30,14 @@ export declare class AgentMemory {
|
|
|
30
30
|
* No metadata cleanup needed — everything is in the file.
|
|
31
31
|
*/
|
|
32
32
|
purge(uri: MemoUri): Promise<void>;
|
|
33
|
+
/**
|
|
34
|
+
* List direct children of a directory.
|
|
35
|
+
* Defaults to the workspace root (memo://) if no URI is provided.
|
|
36
|
+
* For files: reads frontmatter to surface summary and forgottenAt (no body read).
|
|
37
|
+
* For directories: includes abstract from .abstract.md if present.
|
|
38
|
+
* Excludes forgotten memories by default.
|
|
39
|
+
*/
|
|
40
|
+
list(uri?: MemoUri, options?: MemoryListOptions): Promise<MemoryListItem[]>;
|
|
33
41
|
/**
|
|
34
42
|
* Full-text search with frontmatter filtering.
|
|
35
43
|
* Excludes forgotten memories by default.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/memory/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAA;AAC/E,OAAO,KAAK,EACV,eAAe,EACf,mBAAmB,EACnB,iBAAiB,EACjB,WAAW,EACZ,MAAM,YAAY,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C,WAAW,EAAE,CAAC;CAyBvF"}
|
|
@@ -76,6 +76,38 @@ export class AgentMemory {
|
|
|
76
76
|
async purge(uri) {
|
|
77
77
|
await this.memo.delete(uri);
|
|
78
78
|
}
|
|
79
|
+
/**
|
|
80
|
+
* List direct children of a directory.
|
|
81
|
+
* Defaults to the workspace root (memo://) if no URI is provided.
|
|
82
|
+
* For files: reads frontmatter to surface summary and forgottenAt (no body read).
|
|
83
|
+
* For directories: includes abstract from .abstract.md if present.
|
|
84
|
+
* Excludes forgotten memories by default.
|
|
85
|
+
*/
|
|
86
|
+
async list(uri = 'memo://', options = {}) {
|
|
87
|
+
const { includeForgotten = false } = options;
|
|
88
|
+
const nodes = await this.memo.ls(uri);
|
|
89
|
+
const items = [];
|
|
90
|
+
for (const node of nodes) {
|
|
91
|
+
if (node.isDir) {
|
|
92
|
+
items.push({ uri: node.uri, name: node.name, isDir: true, abstract: node.abstract });
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
const raw = await this.memo.read(node.uri);
|
|
96
|
+
if (raw === null)
|
|
97
|
+
continue;
|
|
98
|
+
const { frontmatter } = parse(raw);
|
|
99
|
+
if (!includeForgotten && frontmatter.forgottenAt)
|
|
100
|
+
continue;
|
|
101
|
+
items.push({
|
|
102
|
+
uri: node.uri,
|
|
103
|
+
name: node.name,
|
|
104
|
+
isDir: false,
|
|
105
|
+
summary: frontmatter.summary,
|
|
106
|
+
forgottenAt: frontmatter.forgottenAt,
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
return items;
|
|
110
|
+
}
|
|
79
111
|
/**
|
|
80
112
|
* Full-text search with frontmatter filtering.
|
|
81
113
|
* Excludes forgotten memories by default.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/plugins/memory/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../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,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAA;QAC3D,MAAM,OAAO,GAAkB,EAAE,CAAA;QAEjC,KAAK,MAAM,MAAM,IAAI,GAAG,EAAE,CAAC;YACzB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;YAC7C,IAAI,IAAI,KAAK,IAAI;gBAAE,SAAQ;YAE3B,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC,CAAA;YAE5C,IAAI,gBAAgB,IAAI,WAAW,CAAC,WAAW;gBAAE,SAAQ;YACzD,IAAI,MAAM,KAAK,SAAS,IAAI,WAAW,CAAC,MAAM,KAAK,MAAM;gBAAE,SAAQ;YAEnE,OAAO,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC,CAAA;QACzD,CAAC;QAED,OAAO,OAAO,CAAA;IAChB,CAAC;CACF"}
|
|
@@ -13,6 +13,21 @@ export type MemoryEntry = {
|
|
|
13
13
|
content: string;
|
|
14
14
|
frontmatter: MemoryFrontmatter;
|
|
15
15
|
};
|
|
16
|
+
export type MemoryListItem = {
|
|
17
|
+
uri: MemoUri;
|
|
18
|
+
name: string;
|
|
19
|
+
isDir: boolean;
|
|
20
|
+
/** Directories: content of .abstract.md (if present). */
|
|
21
|
+
abstract?: string;
|
|
22
|
+
/** Files: frontmatter.summary field (if set by caller). */
|
|
23
|
+
summary?: string;
|
|
24
|
+
/** Files: set if this memory has been forgotten. */
|
|
25
|
+
forgottenAt?: string;
|
|
26
|
+
};
|
|
27
|
+
export type MemoryListOptions = {
|
|
28
|
+
/** Include forgotten memories. Default: false. */
|
|
29
|
+
includeForgotten?: boolean;
|
|
30
|
+
};
|
|
16
31
|
export type RememberOptions = {
|
|
17
32
|
source?: string;
|
|
18
33
|
/** Any custom frontmatter fields. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/plugins/memory/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAA;AAIvD,8CAA8C;AAC9C,MAAM,MAAM,oBAAoB,GAAG;IACjC,SAAS,EAAK,MAAM,CAAA;IACpB,MAAM,CAAC,EAAO,MAAM,CAAA;IACpB,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,CAAA;AAED,sEAAsE;AACtE,MAAM,MAAM,iBAAiB,GAAG,oBAAoB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;AAI9E,MAAM,MAAM,WAAW,GAAG;IACxB,GAAG,EAAU,OAAO,CAAA;IACpB,wCAAwC;IACxC,OAAO,EAAM,MAAM,CAAA;IACnB,WAAW,EAAE,iBAAiB,CAAA;CAC/B,CAAA;AAID,MAAM,MAAM,eAAe,GAAG;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,qCAAqC;IACrC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,KAAK,CAAC,EAAa,OAAO,EAAE,CAAA;IAC5B,KAAK,CAAC,EAAa,MAAM,CAAA;IACzB,gEAAgE;IAChE,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,0CAA0C;IAC1C,MAAM,CAAC,EAAY,MAAM,CAAA;CAC1B,CAAA"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/plugins/memory/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAA;AAIvD,8CAA8C;AAC9C,MAAM,MAAM,oBAAoB,GAAG;IACjC,SAAS,EAAK,MAAM,CAAA;IACpB,MAAM,CAAC,EAAO,MAAM,CAAA;I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":["../../../src/core/memo/memo.ts"],"names":[],"mappings":""}
|
package/dist/core/memo/memo.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"memo.js","sourceRoot":"","sources":["../../../src/core/memo/memo.ts"],"names":[],"mappings":";AAAA,2CAA2C"}
|