dotmem 0.1.9 → 0.2.0
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/DOTMEM-SHORT-API.md +318 -0
- package/DOTMEM-SHORT-COMPONENTS.md +129 -0
- package/agent.cjs +1 -226
- package/agent.js +1 -223
- package/bin/cli.cjs +1 -34
- package/bin/cli.js +1 -27
- package/bin/mcp.cjs +1 -21
- package/bin/mcp.js +1 -15
- package/built-in-context.json +6 -6
- package/cli.cjs +258 -19645
- package/cli.js +257 -19575
- package/context/templates/AI.md +1 -1
- package/env.cjs +1 -6
- package/env.js +1 -4
- package/global.cjs +49 -11469
- package/global.d.ts +0 -1
- package/global.js +49 -11437
- package/index.cjs +91 -15354
- package/index.d.ts +2 -0
- package/index.js +91 -15251
- package/mcp.cjs +117 -14587
- package/mcp.js +117 -14551
- package/package.json +3 -2
- package/types/exports.d.ts +43 -66
- package/types/global-types.d.ts +3652 -0
- package/types/llm-cache.d.ts +6 -6
- package/types/logic.d.ts +60 -79
- package/types/memory.d.ts +48 -92
- package/types/policy.d.ts +290 -290
- package/types/profile.d.ts +2 -2
- package/types/agent.d.ts +0 -87
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dotmem",
|
|
3
3
|
"codeName": "dotmem",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.2.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"description": "The AI memory layer for agents and apps: acquired experience, discovery, context projection, continuity, and logic engine. Built on Memorio's state+store foundation.",
|
|
@@ -55,7 +55,8 @@
|
|
|
55
55
|
"jo"
|
|
56
56
|
],
|
|
57
57
|
"engines": {
|
|
58
|
-
"node": ">=20.0.0"
|
|
58
|
+
"node": ">=20.0.0",
|
|
59
|
+
"bun": ">=1.0.0"
|
|
59
60
|
},
|
|
60
61
|
"files": [
|
|
61
62
|
"types/**/*",
|
package/types/exports.d.ts
CHANGED
|
@@ -4,21 +4,20 @@ export * from './logic'
|
|
|
4
4
|
export * from './policy'
|
|
5
5
|
export * from './profile'
|
|
6
6
|
export * from './llm-cache'
|
|
7
|
-
|
|
8
7
|
// ── Memory facade type ───────────────────────────────────────────────────
|
|
9
|
-
|
|
8
|
+
interface MemoryFacade {
|
|
10
9
|
init(): Promise<void>
|
|
11
|
-
discover(situation: string, options?:
|
|
12
|
-
context(options?: ContextQueryOptions): Promise<
|
|
13
|
-
project(discovery:
|
|
14
|
-
acquire(opts:
|
|
15
|
-
acquireStaged(opts:
|
|
16
|
-
remember<T>(key: string, value: T, opts?:
|
|
17
|
-
recall<T = any>(query: string | number, opts?:
|
|
18
|
-
update(key: string, value: any, opts?: Partial<
|
|
10
|
+
discover(situation: string, options?: DiscoveryOptions): Promise<DiscoveryResult>
|
|
11
|
+
context(options?: ContextQueryOptions): Promise<AcquiredContext>
|
|
12
|
+
project(discovery: DiscoveryResult, options?: ProjectionOptions): ContextProjection
|
|
13
|
+
acquire(opts: AcquireOptions): Promise<void>
|
|
14
|
+
acquireStaged(opts: AcquireOptions): Promise<void>
|
|
15
|
+
remember<T>(key: string, value: T, opts?: RememberOptions<T>): Promise<void>
|
|
16
|
+
recall<T = any>(query: string | number, opts?: RecallOptions): Promise<T | null>
|
|
17
|
+
update(key: string, value: any, opts?: Partial<RememberOptions>): Promise<void>
|
|
19
18
|
forget(key: string): Promise<void>
|
|
20
|
-
patch(key: string, patches:
|
|
21
|
-
stats(): Promise<
|
|
19
|
+
patch(key: string, patches: PatchOperation[]): Promise<void>
|
|
20
|
+
stats(): Promise<MemoryStats>
|
|
22
21
|
forgetExpired(): Promise<number>
|
|
23
22
|
clear(): Promise<void>
|
|
24
23
|
fingerprint(): Promise<string>
|
|
@@ -26,63 +25,55 @@ export interface MemoryFacade {
|
|
|
26
25
|
profile: MemoryProfile
|
|
27
26
|
note: MemoryNotes
|
|
28
27
|
seed: MemorySeed
|
|
29
|
-
policy:
|
|
30
|
-
brain:
|
|
31
|
-
configure(config:
|
|
32
|
-
configureSync(config:
|
|
28
|
+
policy: MemoryPolicyAPI
|
|
29
|
+
brain: MemoryBrainAPI
|
|
30
|
+
configure(config: SyncConfig): void
|
|
31
|
+
configureSync(config: SyncConfig): void
|
|
33
32
|
resetBrainPathCache(): void
|
|
34
33
|
resetPolicyStoreCache(): void
|
|
35
|
-
_getEntry(key: string): Promise<
|
|
36
|
-
_loadAll(): Promise<
|
|
37
|
-
_save(entry:
|
|
34
|
+
_getEntry(key: string): Promise<MemoryEntry | null>
|
|
35
|
+
_loadAll(): Promise<MemoryEntry[]>
|
|
36
|
+
_save(entry: MemoryEntry): Promise<void>
|
|
38
37
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
llmPurge(selector: import('./llm-cache').LlmCachePurgeSelector): number
|
|
38
|
+
interface LlmCacheAPI {
|
|
39
|
+
llm<T>(opts: LlmCacheOptions<T>): Promise<LlmCacheResult<T>>
|
|
40
|
+
llmStats(): LlmCacheStats
|
|
41
|
+
llmPurge(selector: LlmCachePurgeSelector): number
|
|
44
42
|
[key: string]: any
|
|
45
43
|
}
|
|
46
|
-
|
|
47
44
|
type Situation = string
|
|
48
|
-
|
|
49
|
-
export interface ContextQueryOptions {
|
|
45
|
+
interface ContextQueryOptions {
|
|
50
46
|
tags?: string | string[]
|
|
51
|
-
types?:
|
|
47
|
+
types?: MemoryType | MemoryType[]
|
|
52
48
|
minConfidence?: number
|
|
53
49
|
maxEntries?: number
|
|
54
|
-
scopes?:
|
|
50
|
+
scopes?: MemoryScope[]
|
|
55
51
|
project?: boolean
|
|
56
52
|
}
|
|
57
|
-
|
|
58
|
-
export interface MemoryJournal {
|
|
53
|
+
interface MemoryJournal {
|
|
59
54
|
read: (opts?: { limit?: number }) => Promise<JournalEntry[]>
|
|
60
55
|
write: (entry: JournalEntry | JournalEntry[]) => Promise<void>
|
|
61
56
|
clear: () => Promise<void>
|
|
62
57
|
}
|
|
63
|
-
|
|
64
|
-
export interface JournalEntry {
|
|
58
|
+
interface JournalEntry {
|
|
65
59
|
id: string
|
|
66
60
|
key: string
|
|
67
|
-
type:
|
|
61
|
+
type: MemoryType
|
|
68
62
|
operation: string
|
|
69
63
|
hlc?: string
|
|
70
64
|
createdAt: number
|
|
71
65
|
payload?: unknown
|
|
72
66
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
get(id: string): import('./profile').DotMemProfile
|
|
67
|
+
interface MemoryProfile {
|
|
68
|
+
get(id: string): DotMemProfile
|
|
76
69
|
}
|
|
77
|
-
|
|
78
|
-
export interface MemoryNotes {
|
|
70
|
+
interface MemoryNotes {
|
|
79
71
|
add(text: string, opts?: { id?: string; tags?: string[] }): Promise<void>
|
|
80
72
|
get(id: string): Promise<NoteContent | null>
|
|
81
73
|
list(): Promise<NoteEntry[]>
|
|
82
74
|
forget(id: string): Promise<void>
|
|
83
75
|
}
|
|
84
|
-
|
|
85
|
-
export interface NoteContent {
|
|
76
|
+
interface NoteContent {
|
|
86
77
|
id: string
|
|
87
78
|
title: string
|
|
88
79
|
content: string
|
|
@@ -90,8 +81,7 @@ export interface NoteContent {
|
|
|
90
81
|
createdAt: number
|
|
91
82
|
sha256: string
|
|
92
83
|
}
|
|
93
|
-
|
|
94
|
-
export interface NoteEntry {
|
|
84
|
+
interface NoteEntry {
|
|
95
85
|
id: string
|
|
96
86
|
title: string
|
|
97
87
|
size: number
|
|
@@ -100,11 +90,11 @@ export interface NoteEntry {
|
|
|
100
90
|
tag?: string
|
|
101
91
|
acquiredAt?: string
|
|
102
92
|
scope?: string
|
|
103
|
-
type?:
|
|
93
|
+
type?: MemoryType
|
|
104
94
|
version?: number
|
|
105
95
|
updatedAt?: number
|
|
106
96
|
previousId?: string | null
|
|
107
|
-
patches?:
|
|
97
|
+
patches?: PatchOperation[]
|
|
108
98
|
hlc?: string
|
|
109
99
|
key?: string
|
|
110
100
|
value?: unknown
|
|
@@ -116,14 +106,12 @@ export interface NoteEntry {
|
|
|
116
106
|
source?: string
|
|
117
107
|
ttl?: number | null
|
|
118
108
|
}
|
|
119
|
-
|
|
120
|
-
export interface MemorySeed {
|
|
109
|
+
interface MemorySeed {
|
|
121
110
|
id: string
|
|
122
111
|
title: string
|
|
123
112
|
content: string
|
|
124
113
|
origin: string
|
|
125
114
|
}
|
|
126
|
-
|
|
127
115
|
// --- Foundation types from Memorio are runtime-only and intentionally not
|
|
128
116
|
// re-exported through Dotmem's declaration surface: Memorio 5.5.3's published
|
|
129
117
|
// type entry is incomplete, and exposing those aliases would force consumers
|
|
@@ -133,10 +121,8 @@ export interface MemorySeed {
|
|
|
133
121
|
export declare const memory: MemoryFacade
|
|
134
122
|
export declare const continuity: any
|
|
135
123
|
export declare const security: any
|
|
136
|
-
|
|
137
124
|
// --- Dotmem-specific encryption envelope ---
|
|
138
|
-
|
|
139
|
-
export interface EncryptedEnvelope {
|
|
125
|
+
interface DotMemEncryptedEnvelope {
|
|
140
126
|
id?: string
|
|
141
127
|
iv: string
|
|
142
128
|
data: string
|
|
@@ -144,9 +130,8 @@ export interface EncryptedEnvelope {
|
|
|
144
130
|
algorithm?: string
|
|
145
131
|
keyId?: string
|
|
146
132
|
}
|
|
147
|
-
|
|
148
133
|
// --- User identity surface ---
|
|
149
|
-
|
|
134
|
+
interface UserIdentity {
|
|
150
135
|
id: string
|
|
151
136
|
name?: string
|
|
152
137
|
email?: string
|
|
@@ -154,7 +139,6 @@ export interface UserIdentity {
|
|
|
154
139
|
export declare function resolveUserIdentity(): UserIdentity | null
|
|
155
140
|
export declare function setUserIdentity(id: string, identity: UserIdentity): void
|
|
156
141
|
export declare function clearUserIdentity(): void
|
|
157
|
-
|
|
158
142
|
// ── User paths surface ───────────────────────────────────────────────────
|
|
159
143
|
export declare function resolveUserDotMemPath(): string
|
|
160
144
|
export declare function resolveUserProjectMemoryPath(projectId?: string): string
|
|
@@ -164,9 +148,8 @@ export declare function resolveUserContractPath(): string
|
|
|
164
148
|
export declare function resolveUserAgentMemoryPath(): string
|
|
165
149
|
export declare function resolveUserReadmePath(): string
|
|
166
150
|
export declare function resolveUserExperiencePath(): string
|
|
167
|
-
|
|
168
151
|
// ── Storage location surface ─────────────────────────────────────────────
|
|
169
|
-
|
|
152
|
+
interface DotMemStorageLocationError extends Error {
|
|
170
153
|
readonly storageRoot: string
|
|
171
154
|
readonly source: string
|
|
172
155
|
}
|
|
@@ -179,14 +162,12 @@ export declare function describeDotMemStorage(): unknown
|
|
|
179
162
|
export declare function readDotMemStorageLocator(): unknown
|
|
180
163
|
export declare function relocateDotMemStorage(target: string): unknown
|
|
181
164
|
export declare function restoreDefaultDotMemStorage(): unknown
|
|
182
|
-
|
|
183
165
|
// ── Project identity surface ─────────────────────────────────────────────
|
|
184
166
|
export declare function resolveProjectIdentity(id?: string): Promise<string>
|
|
185
|
-
|
|
186
167
|
// ── Mem package inspection ──────────────────────────────────────────────
|
|
187
168
|
export declare function inspectMem(mem: unknown, opts?: Record<string, unknown>): unknown
|
|
188
169
|
export declare function signMemPackage(mem: unknown, key: unknown): unknown
|
|
189
|
-
|
|
170
|
+
interface MemInspection {
|
|
190
171
|
status: 'valid' | 'invalid' | 'checksum_mismatch' | 'unsupported' | 'corrupt'
|
|
191
172
|
representation: 'json-v1' | 'json-v2' | 'package-v1' | 'unknown'
|
|
192
173
|
message: string
|
|
@@ -209,17 +190,16 @@ export interface MemInspection {
|
|
|
209
190
|
}>
|
|
210
191
|
}
|
|
211
192
|
}
|
|
212
|
-
|
|
193
|
+
interface MemInspectionStatus {
|
|
213
194
|
valid: boolean
|
|
214
195
|
errors?: string[]
|
|
215
196
|
}
|
|
216
|
-
|
|
217
197
|
// ── Profile ──────────────────────────────────────────────────────────────
|
|
218
|
-
|
|
198
|
+
interface DotMemProfileDocument {
|
|
219
199
|
readonly name: string
|
|
220
200
|
readonly content: string
|
|
221
201
|
}
|
|
222
|
-
|
|
202
|
+
interface DotMemProfile {
|
|
223
203
|
readonly format: 'dotmem.profile'
|
|
224
204
|
readonly version: 1
|
|
225
205
|
readonly id: string
|
|
@@ -233,11 +213,9 @@ export interface DotMemProfile {
|
|
|
233
213
|
}
|
|
234
214
|
export declare const JO_PROFILE: Readonly<DotMemProfile>
|
|
235
215
|
export declare const BUILD_PROFILE: Readonly<DotMemProfile>
|
|
236
|
-
|
|
237
216
|
// ── Mutation engine extras ──────────────────────────────────────────────
|
|
238
217
|
export declare function currentTimestamp(): string
|
|
239
218
|
export declare function activeTransactionId(): string | null
|
|
240
|
-
|
|
241
219
|
// --- Foundation values from Memorio (ambient globals) ---declare const state: any
|
|
242
220
|
export declare const store: any
|
|
243
221
|
export declare const session: any
|
|
@@ -310,5 +288,4 @@ export declare function createContext(name?: string, opts?: { encryptionKey?: an
|
|
|
310
288
|
export declare function listContexts(): unknown[]
|
|
311
289
|
export declare function deleteContext(id: string): void
|
|
312
290
|
export declare function isolate(name?: string, opts?: { encryptionKey?: any }): void
|
|
313
|
-
|
|
314
291
|
export default dotmem
|