mindcache 3.4.2 → 3.4.4
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 +22 -0
- package/dist/{CloudAdapter-D2xxVv4E.d.mts → CloudAdapter-DOvDQswy.d.mts} +72 -23
- package/dist/{CloudAdapter-D2xxVv4E.d.ts → CloudAdapter-DOvDQswy.d.ts} +72 -23
- package/dist/cloud/index.d.mts +2 -2
- package/dist/cloud/index.d.ts +2 -2
- package/dist/cloud/index.js +1205 -794
- package/dist/cloud/index.js.map +1 -1
- package/dist/cloud/index.mjs +1205 -794
- package/dist/cloud/index.mjs.map +1 -1
- package/dist/index.d.mts +4 -31
- package/dist/index.d.ts +4 -31
- package/dist/index.js +1205 -796
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1205 -796
- package/dist/index.mjs.map +1 -1
- package/dist/server.d.mts +33 -0
- package/dist/server.d.ts +33 -0
- package/dist/server.js +2654 -0
- package/dist/server.js.map +1 -0
- package/dist/server.mjs +2624 -0
- package/dist/server.mjs.map +1 -0
- package/docs/mindcache-api.md +148 -0
- package/package.json +8 -2
package/README.md
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# MindCache
|
|
2
|
+
|
|
3
|
+
A TypeScript library for managing short-term memory in AI agents through an LLM-friendly key-value repository.
|
|
4
|
+
|
|
5
|
+
## Documentation
|
|
6
|
+
|
|
7
|
+
* **[API Reference](./docs/mindcache-api.md)**: Detailed method signatures and type definitions. Optimized for AI agents (like Cursor, Claude, etc.) to understand the library's capabilities.
|
|
8
|
+
* **[Full Documentation](https://mindcache.dev/llms-full.md)**: Comprehensive guide with examples and deep dives.
|
|
9
|
+
|
|
10
|
+
## Quick Start
|
|
11
|
+
|
|
12
|
+
```typescript
|
|
13
|
+
import { mindcache } from 'mindcache';
|
|
14
|
+
|
|
15
|
+
// Store values
|
|
16
|
+
mindcache.set_value('userName', 'Alice');
|
|
17
|
+
|
|
18
|
+
// Generate tools for Vercel AI SDK
|
|
19
|
+
const tools = mindcache.get_aisdk_tools();
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
See the [root README](../../README.md) for more details.
|
|
@@ -3,18 +3,30 @@ import * as Y from 'yjs';
|
|
|
3
3
|
/**
|
|
4
4
|
* Access level for MindCache operations
|
|
5
5
|
* - 'user': Can only manage content tags (default)
|
|
6
|
-
* - '
|
|
6
|
+
* - 'admin': Can manage both content tags and system tags
|
|
7
7
|
*/
|
|
8
|
-
type AccessLevel = 'user' | '
|
|
8
|
+
type AccessLevel = 'user' | 'admin';
|
|
9
|
+
/**
|
|
10
|
+
* Context rules for filtering keys by contentTags.
|
|
11
|
+
* When context is set, only keys matching ALL specified tags are visible.
|
|
12
|
+
* Context is client-local and not persisted.
|
|
13
|
+
*/
|
|
14
|
+
interface ContextRules {
|
|
15
|
+
/** Tags that a key must have (AND logic - all tags must match) */
|
|
16
|
+
tags: string[];
|
|
17
|
+
/** Default contentTags added to keys created via create_key() in this context */
|
|
18
|
+
defaultContentTags?: string[];
|
|
19
|
+
/** Default systemTags added to keys created via create_key() in this context */
|
|
20
|
+
defaultSystemTags?: SystemTag[];
|
|
21
|
+
}
|
|
9
22
|
/**
|
|
10
23
|
* Known system tags that control key behavior
|
|
11
24
|
* - 'SystemPrompt': Include in system prompt (visible to LLM context)
|
|
12
25
|
* - 'LLMRead': LLM can read this key via tools
|
|
13
26
|
* - 'LLMWrite': LLM can write to this key via tools
|
|
14
|
-
* - 'protected': Cannot be deleted
|
|
15
27
|
* - 'ApplyTemplate': Process value through template injection
|
|
16
28
|
*/
|
|
17
|
-
type SystemTag = 'SystemPrompt' | 'LLMRead' | 'LLMWrite' | '
|
|
29
|
+
type SystemTag = 'SystemPrompt' | 'LLMRead' | 'LLMWrite' | 'ApplyTemplate';
|
|
18
30
|
/**
|
|
19
31
|
* Type of value stored in a MindCache key
|
|
20
32
|
*/
|
|
@@ -91,8 +103,6 @@ declare const SystemTagHelpers: {
|
|
|
91
103
|
isLLMReadable: (attrs: KeyAttributes) => boolean;
|
|
92
104
|
/** Check if key is included in system prompt */
|
|
93
105
|
isInSystemPrompt: (attrs: KeyAttributes) => boolean;
|
|
94
|
-
/** Check if key is protected from deletion */
|
|
95
|
-
isProtected: (attrs: KeyAttributes) => boolean;
|
|
96
106
|
/** Check if key uses template injection */
|
|
97
107
|
hasTemplateInjection: (attrs: KeyAttributes) => boolean;
|
|
98
108
|
};
|
|
@@ -134,22 +144,27 @@ interface MindCacheOptions {
|
|
|
134
144
|
indexedDB?: MindCacheIndexedDBOptions;
|
|
135
145
|
/** History tracking options (enabled in IndexedDB and Cloud modes) */
|
|
136
146
|
history?: HistoryOptions;
|
|
137
|
-
/** Access level for tag operations. '
|
|
147
|
+
/** Access level for tag operations. 'admin' allows managing system tags. */
|
|
138
148
|
accessLevel?: AccessLevel;
|
|
149
|
+
/** Optional existing Y.Doc instance (for server-side hydration) */
|
|
150
|
+
doc?: Y.Doc;
|
|
151
|
+
/** Context filtering rules. When set, only keys matching the rules are visible. */
|
|
152
|
+
context?: ContextRules;
|
|
139
153
|
}
|
|
140
154
|
type ConnectionState$1 = 'disconnected' | 'connecting' | 'connected' | 'error';
|
|
141
155
|
declare class MindCache {
|
|
142
156
|
doc: Y.Doc;
|
|
143
|
-
|
|
157
|
+
rootMap: Y.Map<Y.Map<any>>;
|
|
144
158
|
private listeners;
|
|
145
159
|
private globalListeners;
|
|
146
160
|
readonly version = "3.3.2";
|
|
147
|
-
|
|
161
|
+
normalizeSystemTags(tags: SystemTag[]): SystemTag[];
|
|
148
162
|
private _cloudAdapter;
|
|
149
163
|
private _connectionState;
|
|
150
164
|
private _isLoaded;
|
|
151
165
|
private _cloudConfig;
|
|
152
166
|
private _accessLevel;
|
|
167
|
+
private _contextRules;
|
|
153
168
|
private _initPromise;
|
|
154
169
|
private _idbProvider;
|
|
155
170
|
private _undoManagers;
|
|
@@ -204,6 +219,36 @@ declare class MindCache {
|
|
|
204
219
|
restoreToVersion(_versionId: string): boolean;
|
|
205
220
|
get accessLevel(): AccessLevel;
|
|
206
221
|
get hasSystemAccess(): boolean;
|
|
222
|
+
/**
|
|
223
|
+
* Check if context filtering is currently active.
|
|
224
|
+
*/
|
|
225
|
+
get hasContext(): boolean;
|
|
226
|
+
/**
|
|
227
|
+
* Get current context rules, or null if no context is set.
|
|
228
|
+
*/
|
|
229
|
+
get_context(): ContextRules | null;
|
|
230
|
+
/**
|
|
231
|
+
* Set context filtering rules.
|
|
232
|
+
* When context is set, only keys with ALL specified tags are visible.
|
|
233
|
+
*
|
|
234
|
+
* @param rules - Context rules, or array of tags (shorthand for { tags: [...] })
|
|
235
|
+
*/
|
|
236
|
+
set_context(rules: ContextRules | string[]): void;
|
|
237
|
+
/**
|
|
238
|
+
* Clear context filtering. All keys become visible again.
|
|
239
|
+
*/
|
|
240
|
+
reset_context(): void;
|
|
241
|
+
/**
|
|
242
|
+
* Check if a key matches the current context rules.
|
|
243
|
+
* Returns true if no context is set.
|
|
244
|
+
*/
|
|
245
|
+
keyMatchesContext(key: string): boolean;
|
|
246
|
+
/**
|
|
247
|
+
* Create a new key with optional default tags from context.
|
|
248
|
+
*
|
|
249
|
+
* @throws Error if key already exists
|
|
250
|
+
*/
|
|
251
|
+
create_key(key: string, value: any, attributes?: Partial<KeyAttributes>): void;
|
|
207
252
|
private _initCloud;
|
|
208
253
|
private _initYIndexedDB;
|
|
209
254
|
private _initIndexedDB;
|
|
@@ -243,8 +288,9 @@ declare class MindCache {
|
|
|
243
288
|
/**
|
|
244
289
|
* Update only the attributes of a key without modifying the value.
|
|
245
290
|
* Useful for updating tags, permissions etc. on document type keys.
|
|
291
|
+
* @returns true if attributes were updated, false if key doesn't exist or is protected
|
|
246
292
|
*/
|
|
247
|
-
set_attributes(key: string, attributes: Partial<KeyAttributes>):
|
|
293
|
+
set_attributes(key: string, attributes: Partial<KeyAttributes>): boolean;
|
|
248
294
|
set_value(key: string, value: any, attributes?: Partial<KeyAttributes>): void;
|
|
249
295
|
/**
|
|
250
296
|
* LLM-safe method to write a value to a key.
|
|
@@ -281,15 +327,15 @@ declare class MindCache {
|
|
|
281
327
|
*/
|
|
282
328
|
size(): number;
|
|
283
329
|
/**
|
|
284
|
-
* Get all keys in MindCache
|
|
330
|
+
* Get all keys in MindCache.
|
|
285
331
|
*/
|
|
286
332
|
keys(): string[];
|
|
287
333
|
/**
|
|
288
|
-
* Get all values in MindCache
|
|
334
|
+
* Get all values in MindCache.
|
|
289
335
|
*/
|
|
290
336
|
values(): any[];
|
|
291
337
|
/**
|
|
292
|
-
* Get all key-value entries
|
|
338
|
+
* Get all key-value entries.
|
|
293
339
|
*/
|
|
294
340
|
entries(): Array<[string, any]>;
|
|
295
341
|
/**
|
|
@@ -304,7 +350,6 @@ declare class MindCache {
|
|
|
304
350
|
getSTM(): string;
|
|
305
351
|
/**
|
|
306
352
|
* Get the STM as an object with values directly (no attributes).
|
|
307
|
-
* Includes system keys ($date, $time).
|
|
308
353
|
* @deprecated Use getAll() for full STM format
|
|
309
354
|
*/
|
|
310
355
|
getSTMObject(): Record<string, any>;
|
|
@@ -340,7 +385,7 @@ declare class MindCache {
|
|
|
340
385
|
getKeysByTag(tag: string): string[];
|
|
341
386
|
/**
|
|
342
387
|
* Add a system tag to a key (requires system access).
|
|
343
|
-
* System tags: 'SystemPrompt', 'LLMRead', 'LLMWrite', '
|
|
388
|
+
* System tags: 'SystemPrompt', 'LLMRead', 'LLMWrite', 'ApplyTemplate'
|
|
344
389
|
*/
|
|
345
390
|
systemAddTag(key: string, tag: SystemTag): boolean;
|
|
346
391
|
/**
|
|
@@ -365,8 +410,9 @@ declare class MindCache {
|
|
|
365
410
|
systemGetKeysByTag(tag: SystemTag): string[];
|
|
366
411
|
/**
|
|
367
412
|
* Helper to get sorted keys (by zIndex).
|
|
413
|
+
* Respects context filtering when set.
|
|
368
414
|
*/
|
|
369
|
-
|
|
415
|
+
getSortedKeys(): string[];
|
|
370
416
|
/**
|
|
371
417
|
* Serialize to JSON string.
|
|
372
418
|
*/
|
|
@@ -381,8 +427,10 @@ declare class MindCache {
|
|
|
381
427
|
toMarkdown(): string;
|
|
382
428
|
/**
|
|
383
429
|
* Import from Markdown format.
|
|
430
|
+
* @param markdown The markdown string to import
|
|
431
|
+
* @param merge If false (default), clears existing data before importing. If true, merges with existing data.
|
|
384
432
|
*/
|
|
385
|
-
fromMarkdown(markdown: string): void;
|
|
433
|
+
fromMarkdown(markdown: string, merge?: boolean): void;
|
|
386
434
|
/**
|
|
387
435
|
* Set base64 binary data.
|
|
388
436
|
*/
|
|
@@ -424,17 +472,17 @@ declare class MindCache {
|
|
|
424
472
|
*/
|
|
425
473
|
delete_text(key: string, index: number, length: number): void;
|
|
426
474
|
/**
|
|
427
|
-
* Replace all text in a document key
|
|
475
|
+
* Replace all text in a document key.
|
|
428
476
|
* Uses diff-based updates when changes are < diffThreshold (default 80%).
|
|
429
477
|
* This preserves concurrent edits and provides better undo granularity.
|
|
430
478
|
*/
|
|
431
|
-
|
|
479
|
+
_replaceDocumentText(key: string, newText: string, diffThreshold?: number): void;
|
|
432
480
|
subscribe(key: string, listener: Listener): () => void;
|
|
433
481
|
subscribeToAll(listener: GlobalListener): () => void;
|
|
434
482
|
unsubscribeFromAll(listener: GlobalListener): void;
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
483
|
+
notifyGlobalListeners(): void;
|
|
484
|
+
sanitizeKeyForTool(key: string): string;
|
|
485
|
+
findKeyFromSanitizedTool(sanitizedKey: string): string | undefined;
|
|
438
486
|
/**
|
|
439
487
|
* Generate Vercel AI SDK compatible tools for writable keys.
|
|
440
488
|
* For document type keys, generates additional tools: append_, insert_, edit_
|
|
@@ -528,6 +576,7 @@ declare class CloudAdapter {
|
|
|
528
576
|
private token;
|
|
529
577
|
private handleOnline;
|
|
530
578
|
private handleOffline;
|
|
579
|
+
private _synced;
|
|
531
580
|
constructor(config: CloudConfig);
|
|
532
581
|
/** Browser network status - instantly updated via navigator.onLine */
|
|
533
582
|
get isOnline(): boolean;
|
|
@@ -549,4 +598,4 @@ declare class CloudAdapter {
|
|
|
549
598
|
private scheduleReconnect;
|
|
550
599
|
}
|
|
551
600
|
|
|
552
|
-
export { type AccessLevel as A,
|
|
601
|
+
export { type AccessLevel as A, type CloudConfig as C, type DeleteOperation as D, type GlobalListener as G, type HistoryEntry as H, type KeyAttributes as K, type Listener as L, MindCache as M, type Operation as O, type SetOperation as S, CloudAdapter as a, type ConnectionState as b, type CloudAdapterEvents as c, type ClearOperation as d, type MindCacheOptions as e, type KeyType as f, type SystemTag as g, type ContextRules as h, type STM as i, type STMEntry as j, type HistoryOptions as k, type MindCacheCloudOptions as l, type MindCacheIndexedDBOptions as m, DEFAULT_KEY_ATTRIBUTES as n, SystemTagHelpers as o };
|
|
@@ -3,18 +3,30 @@ import * as Y from 'yjs';
|
|
|
3
3
|
/**
|
|
4
4
|
* Access level for MindCache operations
|
|
5
5
|
* - 'user': Can only manage content tags (default)
|
|
6
|
-
* - '
|
|
6
|
+
* - 'admin': Can manage both content tags and system tags
|
|
7
7
|
*/
|
|
8
|
-
type AccessLevel = 'user' | '
|
|
8
|
+
type AccessLevel = 'user' | 'admin';
|
|
9
|
+
/**
|
|
10
|
+
* Context rules for filtering keys by contentTags.
|
|
11
|
+
* When context is set, only keys matching ALL specified tags are visible.
|
|
12
|
+
* Context is client-local and not persisted.
|
|
13
|
+
*/
|
|
14
|
+
interface ContextRules {
|
|
15
|
+
/** Tags that a key must have (AND logic - all tags must match) */
|
|
16
|
+
tags: string[];
|
|
17
|
+
/** Default contentTags added to keys created via create_key() in this context */
|
|
18
|
+
defaultContentTags?: string[];
|
|
19
|
+
/** Default systemTags added to keys created via create_key() in this context */
|
|
20
|
+
defaultSystemTags?: SystemTag[];
|
|
21
|
+
}
|
|
9
22
|
/**
|
|
10
23
|
* Known system tags that control key behavior
|
|
11
24
|
* - 'SystemPrompt': Include in system prompt (visible to LLM context)
|
|
12
25
|
* - 'LLMRead': LLM can read this key via tools
|
|
13
26
|
* - 'LLMWrite': LLM can write to this key via tools
|
|
14
|
-
* - 'protected': Cannot be deleted
|
|
15
27
|
* - 'ApplyTemplate': Process value through template injection
|
|
16
28
|
*/
|
|
17
|
-
type SystemTag = 'SystemPrompt' | 'LLMRead' | 'LLMWrite' | '
|
|
29
|
+
type SystemTag = 'SystemPrompt' | 'LLMRead' | 'LLMWrite' | 'ApplyTemplate';
|
|
18
30
|
/**
|
|
19
31
|
* Type of value stored in a MindCache key
|
|
20
32
|
*/
|
|
@@ -91,8 +103,6 @@ declare const SystemTagHelpers: {
|
|
|
91
103
|
isLLMReadable: (attrs: KeyAttributes) => boolean;
|
|
92
104
|
/** Check if key is included in system prompt */
|
|
93
105
|
isInSystemPrompt: (attrs: KeyAttributes) => boolean;
|
|
94
|
-
/** Check if key is protected from deletion */
|
|
95
|
-
isProtected: (attrs: KeyAttributes) => boolean;
|
|
96
106
|
/** Check if key uses template injection */
|
|
97
107
|
hasTemplateInjection: (attrs: KeyAttributes) => boolean;
|
|
98
108
|
};
|
|
@@ -134,22 +144,27 @@ interface MindCacheOptions {
|
|
|
134
144
|
indexedDB?: MindCacheIndexedDBOptions;
|
|
135
145
|
/** History tracking options (enabled in IndexedDB and Cloud modes) */
|
|
136
146
|
history?: HistoryOptions;
|
|
137
|
-
/** Access level for tag operations. '
|
|
147
|
+
/** Access level for tag operations. 'admin' allows managing system tags. */
|
|
138
148
|
accessLevel?: AccessLevel;
|
|
149
|
+
/** Optional existing Y.Doc instance (for server-side hydration) */
|
|
150
|
+
doc?: Y.Doc;
|
|
151
|
+
/** Context filtering rules. When set, only keys matching the rules are visible. */
|
|
152
|
+
context?: ContextRules;
|
|
139
153
|
}
|
|
140
154
|
type ConnectionState$1 = 'disconnected' | 'connecting' | 'connected' | 'error';
|
|
141
155
|
declare class MindCache {
|
|
142
156
|
doc: Y.Doc;
|
|
143
|
-
|
|
157
|
+
rootMap: Y.Map<Y.Map<any>>;
|
|
144
158
|
private listeners;
|
|
145
159
|
private globalListeners;
|
|
146
160
|
readonly version = "3.3.2";
|
|
147
|
-
|
|
161
|
+
normalizeSystemTags(tags: SystemTag[]): SystemTag[];
|
|
148
162
|
private _cloudAdapter;
|
|
149
163
|
private _connectionState;
|
|
150
164
|
private _isLoaded;
|
|
151
165
|
private _cloudConfig;
|
|
152
166
|
private _accessLevel;
|
|
167
|
+
private _contextRules;
|
|
153
168
|
private _initPromise;
|
|
154
169
|
private _idbProvider;
|
|
155
170
|
private _undoManagers;
|
|
@@ -204,6 +219,36 @@ declare class MindCache {
|
|
|
204
219
|
restoreToVersion(_versionId: string): boolean;
|
|
205
220
|
get accessLevel(): AccessLevel;
|
|
206
221
|
get hasSystemAccess(): boolean;
|
|
222
|
+
/**
|
|
223
|
+
* Check if context filtering is currently active.
|
|
224
|
+
*/
|
|
225
|
+
get hasContext(): boolean;
|
|
226
|
+
/**
|
|
227
|
+
* Get current context rules, or null if no context is set.
|
|
228
|
+
*/
|
|
229
|
+
get_context(): ContextRules | null;
|
|
230
|
+
/**
|
|
231
|
+
* Set context filtering rules.
|
|
232
|
+
* When context is set, only keys with ALL specified tags are visible.
|
|
233
|
+
*
|
|
234
|
+
* @param rules - Context rules, or array of tags (shorthand for { tags: [...] })
|
|
235
|
+
*/
|
|
236
|
+
set_context(rules: ContextRules | string[]): void;
|
|
237
|
+
/**
|
|
238
|
+
* Clear context filtering. All keys become visible again.
|
|
239
|
+
*/
|
|
240
|
+
reset_context(): void;
|
|
241
|
+
/**
|
|
242
|
+
* Check if a key matches the current context rules.
|
|
243
|
+
* Returns true if no context is set.
|
|
244
|
+
*/
|
|
245
|
+
keyMatchesContext(key: string): boolean;
|
|
246
|
+
/**
|
|
247
|
+
* Create a new key with optional default tags from context.
|
|
248
|
+
*
|
|
249
|
+
* @throws Error if key already exists
|
|
250
|
+
*/
|
|
251
|
+
create_key(key: string, value: any, attributes?: Partial<KeyAttributes>): void;
|
|
207
252
|
private _initCloud;
|
|
208
253
|
private _initYIndexedDB;
|
|
209
254
|
private _initIndexedDB;
|
|
@@ -243,8 +288,9 @@ declare class MindCache {
|
|
|
243
288
|
/**
|
|
244
289
|
* Update only the attributes of a key without modifying the value.
|
|
245
290
|
* Useful for updating tags, permissions etc. on document type keys.
|
|
291
|
+
* @returns true if attributes were updated, false if key doesn't exist or is protected
|
|
246
292
|
*/
|
|
247
|
-
set_attributes(key: string, attributes: Partial<KeyAttributes>):
|
|
293
|
+
set_attributes(key: string, attributes: Partial<KeyAttributes>): boolean;
|
|
248
294
|
set_value(key: string, value: any, attributes?: Partial<KeyAttributes>): void;
|
|
249
295
|
/**
|
|
250
296
|
* LLM-safe method to write a value to a key.
|
|
@@ -281,15 +327,15 @@ declare class MindCache {
|
|
|
281
327
|
*/
|
|
282
328
|
size(): number;
|
|
283
329
|
/**
|
|
284
|
-
* Get all keys in MindCache
|
|
330
|
+
* Get all keys in MindCache.
|
|
285
331
|
*/
|
|
286
332
|
keys(): string[];
|
|
287
333
|
/**
|
|
288
|
-
* Get all values in MindCache
|
|
334
|
+
* Get all values in MindCache.
|
|
289
335
|
*/
|
|
290
336
|
values(): any[];
|
|
291
337
|
/**
|
|
292
|
-
* Get all key-value entries
|
|
338
|
+
* Get all key-value entries.
|
|
293
339
|
*/
|
|
294
340
|
entries(): Array<[string, any]>;
|
|
295
341
|
/**
|
|
@@ -304,7 +350,6 @@ declare class MindCache {
|
|
|
304
350
|
getSTM(): string;
|
|
305
351
|
/**
|
|
306
352
|
* Get the STM as an object with values directly (no attributes).
|
|
307
|
-
* Includes system keys ($date, $time).
|
|
308
353
|
* @deprecated Use getAll() for full STM format
|
|
309
354
|
*/
|
|
310
355
|
getSTMObject(): Record<string, any>;
|
|
@@ -340,7 +385,7 @@ declare class MindCache {
|
|
|
340
385
|
getKeysByTag(tag: string): string[];
|
|
341
386
|
/**
|
|
342
387
|
* Add a system tag to a key (requires system access).
|
|
343
|
-
* System tags: 'SystemPrompt', 'LLMRead', 'LLMWrite', '
|
|
388
|
+
* System tags: 'SystemPrompt', 'LLMRead', 'LLMWrite', 'ApplyTemplate'
|
|
344
389
|
*/
|
|
345
390
|
systemAddTag(key: string, tag: SystemTag): boolean;
|
|
346
391
|
/**
|
|
@@ -365,8 +410,9 @@ declare class MindCache {
|
|
|
365
410
|
systemGetKeysByTag(tag: SystemTag): string[];
|
|
366
411
|
/**
|
|
367
412
|
* Helper to get sorted keys (by zIndex).
|
|
413
|
+
* Respects context filtering when set.
|
|
368
414
|
*/
|
|
369
|
-
|
|
415
|
+
getSortedKeys(): string[];
|
|
370
416
|
/**
|
|
371
417
|
* Serialize to JSON string.
|
|
372
418
|
*/
|
|
@@ -381,8 +427,10 @@ declare class MindCache {
|
|
|
381
427
|
toMarkdown(): string;
|
|
382
428
|
/**
|
|
383
429
|
* Import from Markdown format.
|
|
430
|
+
* @param markdown The markdown string to import
|
|
431
|
+
* @param merge If false (default), clears existing data before importing. If true, merges with existing data.
|
|
384
432
|
*/
|
|
385
|
-
fromMarkdown(markdown: string): void;
|
|
433
|
+
fromMarkdown(markdown: string, merge?: boolean): void;
|
|
386
434
|
/**
|
|
387
435
|
* Set base64 binary data.
|
|
388
436
|
*/
|
|
@@ -424,17 +472,17 @@ declare class MindCache {
|
|
|
424
472
|
*/
|
|
425
473
|
delete_text(key: string, index: number, length: number): void;
|
|
426
474
|
/**
|
|
427
|
-
* Replace all text in a document key
|
|
475
|
+
* Replace all text in a document key.
|
|
428
476
|
* Uses diff-based updates when changes are < diffThreshold (default 80%).
|
|
429
477
|
* This preserves concurrent edits and provides better undo granularity.
|
|
430
478
|
*/
|
|
431
|
-
|
|
479
|
+
_replaceDocumentText(key: string, newText: string, diffThreshold?: number): void;
|
|
432
480
|
subscribe(key: string, listener: Listener): () => void;
|
|
433
481
|
subscribeToAll(listener: GlobalListener): () => void;
|
|
434
482
|
unsubscribeFromAll(listener: GlobalListener): void;
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
483
|
+
notifyGlobalListeners(): void;
|
|
484
|
+
sanitizeKeyForTool(key: string): string;
|
|
485
|
+
findKeyFromSanitizedTool(sanitizedKey: string): string | undefined;
|
|
438
486
|
/**
|
|
439
487
|
* Generate Vercel AI SDK compatible tools for writable keys.
|
|
440
488
|
* For document type keys, generates additional tools: append_, insert_, edit_
|
|
@@ -528,6 +576,7 @@ declare class CloudAdapter {
|
|
|
528
576
|
private token;
|
|
529
577
|
private handleOnline;
|
|
530
578
|
private handleOffline;
|
|
579
|
+
private _synced;
|
|
531
580
|
constructor(config: CloudConfig);
|
|
532
581
|
/** Browser network status - instantly updated via navigator.onLine */
|
|
533
582
|
get isOnline(): boolean;
|
|
@@ -549,4 +598,4 @@ declare class CloudAdapter {
|
|
|
549
598
|
private scheduleReconnect;
|
|
550
599
|
}
|
|
551
600
|
|
|
552
|
-
export { type AccessLevel as A,
|
|
601
|
+
export { type AccessLevel as A, type CloudConfig as C, type DeleteOperation as D, type GlobalListener as G, type HistoryEntry as H, type KeyAttributes as K, type Listener as L, MindCache as M, type Operation as O, type SetOperation as S, CloudAdapter as a, type ConnectionState as b, type CloudAdapterEvents as c, type ClearOperation as d, type MindCacheOptions as e, type KeyType as f, type SystemTag as g, type ContextRules as h, type STM as i, type STMEntry as j, type HistoryOptions as k, type MindCacheCloudOptions as l, type MindCacheIndexedDBOptions as m, DEFAULT_KEY_ATTRIBUTES as n, SystemTagHelpers as o };
|
package/dist/cloud/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { M as MindCache,
|
|
2
|
-
export {
|
|
1
|
+
import { M as MindCache, C as CloudConfig, a as CloudAdapter } from '../CloudAdapter-DOvDQswy.mjs';
|
|
2
|
+
export { d as ClearOperation, c as CloudAdapterEvents, b as ConnectionState, D as DeleteOperation, O as Operation, S as SetOperation } from '../CloudAdapter-DOvDQswy.mjs';
|
|
3
3
|
import 'yjs';
|
|
4
4
|
|
|
5
5
|
/**
|
package/dist/cloud/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { M as MindCache,
|
|
2
|
-
export {
|
|
1
|
+
import { M as MindCache, C as CloudConfig, a as CloudAdapter } from '../CloudAdapter-DOvDQswy.js';
|
|
2
|
+
export { d as ClearOperation, c as CloudAdapterEvents, b as ConnectionState, D as DeleteOperation, O as Operation, S as SetOperation } from '../CloudAdapter-DOvDQswy.js';
|
|
3
3
|
import 'yjs';
|
|
4
4
|
|
|
5
5
|
/**
|