dotmem 0.1.8 → 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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dotmem",
3
3
  "codeName": "dotmem",
4
- "version": "0.1.8",
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/**/*",
@@ -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
- export interface MemoryFacade {
8
+ interface MemoryFacade {
10
9
  init(): Promise<void>
11
- discover(situation: string, options?: import('./memory').DiscoveryOptions): Promise<import('./memory').DiscoveryResult>
12
- context(options?: ContextQueryOptions): Promise<import('./memory').AcquiredContext>
13
- project(discovery: import('./memory').DiscoveryResult, options?: import('./memory').ProjectionOptions): import('./memory').ContextProjection
14
- acquire(opts: import('./memory').AcquireOptions): Promise<void>
15
- acquireStaged(opts: import('./memory').AcquireOptions): Promise<void>
16
- remember<T>(key: string, value: T, opts?: import('./memory').RememberOptions<T>): Promise<void>
17
- recall<T = any>(query: string | number, opts?: import('./memory').RecallOptions): Promise<T | null>
18
- update(key: string, value: any, opts?: Partial<import('./memory').RememberOptions>): Promise<void>
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: import('./memory').PatchOperation[]): Promise<void>
21
- stats(): Promise<import('./memory').MemoryStats>
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: import('./policy').MemoryPolicyAPI
30
- brain: import('./policy').MemoryBrainAPI
31
- configure(config: import('./memory').SyncConfig): void
32
- configureSync(config: import('./memory').SyncConfig): void
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<import('./memory').MemoryEntry | null>
36
- _loadAll(): Promise<import('./memory').MemoryEntry[]>
37
- _save(entry: import('./memory').MemoryEntry): Promise<void>
34
+ _getEntry(key: string): Promise<MemoryEntry | null>
35
+ _loadAll(): Promise<MemoryEntry[]>
36
+ _save(entry: MemoryEntry): Promise<void>
38
37
  }
39
-
40
- export interface LlmCacheAPI {
41
- llm<T>(opts: import('./llm-cache').LlmCacheOptions<T>): Promise<import('./llm-cache').LlmCacheResult<T>>
42
- llmStats(): import('./llm-cache').LlmCacheStats
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?: import('./memory').MemoryType | import('./memory').MemoryType[]
47
+ types?: MemoryType | MemoryType[]
52
48
  minConfidence?: number
53
49
  maxEntries?: number
54
- scopes?: import('./memory').MemoryScope[]
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: import('./memory').MemoryType
61
+ type: MemoryType
68
62
  operation: string
69
63
  hlc?: string
70
64
  createdAt: number
71
65
  payload?: unknown
72
66
  }
73
-
74
- export interface MemoryProfile {
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?: import('./memory').MemoryType
93
+ type?: MemoryType
104
94
  version?: number
105
95
  updatedAt?: number
106
96
  previousId?: string | null
107
- patches?: import('./memory').PatchOperation[]
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
- export interface UserIdentity {
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
- export interface DotMemStorageLocationError extends Error {
152
+ interface DotMemStorageLocationError extends Error {
170
153
  readonly storageRoot: string
171
154
  readonly source: string
172
155
  }
@@ -179,29 +162,44 @@ 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
- export interface MemInspection {
190
- status: 'inspected'
191
- version: number
192
- entries: unknown[]
170
+ interface MemInspection {
171
+ status: 'valid' | 'invalid' | 'checksum_mismatch' | 'unsupported' | 'corrupt'
172
+ representation: 'json-v1' | 'json-v2' | 'package-v1' | 'unknown'
173
+ message: string
174
+ packageVersion?: number
175
+ memoryVersion?: number
176
+ contentId?: string
177
+ parts: Array<{ path: string; bytes: number; protected: boolean }>
178
+ knowledge?: unknown
179
+ unknownSemantics?: { mapEntries: number; vocabularyEntries: number; extensionParts: string[] }
180
+ integrity?: { status: 'valid'; algorithm: 'sha256'; contentId: string }
181
+ authenticity?: {
182
+ status: 'unsigned' | 'valid' | 'invalid' | 'unsupported'
183
+ trust: 'not_evaluated'
184
+ signatures: Array<{
185
+ status: 'valid' | 'invalid' | 'unsupported'
186
+ algorithm?: string
187
+ keyId?: string
188
+ contentId?: string
189
+ message: string
190
+ }>
191
+ }
193
192
  }
194
- export interface MemInspectionStatus {
193
+ interface MemInspectionStatus {
195
194
  valid: boolean
196
195
  errors?: string[]
197
196
  }
198
-
199
197
  // ── Profile ──────────────────────────────────────────────────────────────
200
- export interface DotMemProfileDocument {
198
+ interface DotMemProfileDocument {
201
199
  readonly name: string
202
200
  readonly content: string
203
201
  }
204
- export interface DotMemProfile {
202
+ interface DotMemProfile {
205
203
  readonly format: 'dotmem.profile'
206
204
  readonly version: 1
207
205
  readonly id: string
@@ -215,11 +213,9 @@ export interface DotMemProfile {
215
213
  }
216
214
  export declare const JO_PROFILE: Readonly<DotMemProfile>
217
215
  export declare const BUILD_PROFILE: Readonly<DotMemProfile>
218
-
219
216
  // ── Mutation engine extras ──────────────────────────────────────────────
220
217
  export declare function currentTimestamp(): string
221
218
  export declare function activeTransactionId(): string | null
222
-
223
219
  // --- Foundation values from Memorio (ambient globals) ---declare const state: any
224
220
  export declare const store: any
225
221
  export declare const session: any
@@ -292,5 +288,4 @@ export declare function createContext(name?: string, opts?: { encryptionKey?: an
292
288
  export declare function listContexts(): unknown[]
293
289
  export declare function deleteContext(id: string): void
294
290
  export declare function isolate(name?: string, opts?: { encryptionKey?: any }): void
295
-
296
291
  export default dotmem