mindcache 2.3.0 → 2.4.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.
@@ -6,12 +6,17 @@
6
6
  type AccessLevel = 'user' | 'system';
7
7
  /**
8
8
  * Known system tags that control key behavior
9
- * - 'prompt': Include in system prompt (replaces visible)
10
- * - 'readonly': Cannot be modified by AI tools (replaces readonly)
9
+ * - 'SystemPrompt': Include in system prompt
10
+ * - 'LLMRead': LLM can read this key (visible to LLMs)
11
+ * - 'LLMWrite': LLM can write to this key via tools
11
12
  * - 'protected': Cannot be deleted (replaces hardcoded)
12
- * - 'template': Process value through template injection
13
+ * - 'ApplyTemplate': Process value through template injection
14
+ *
15
+ * @deprecated 'prompt' - Use 'SystemPrompt' instead
16
+ * @deprecated 'readonly' - Use absence of 'LLMWrite' instead (if LLMWrite not present, readonly=true)
17
+ * @deprecated 'template' - Use 'ApplyTemplate' instead
13
18
  */
14
- type SystemTag = 'prompt' | 'readonly' | 'protected' | 'template';
19
+ type SystemTag = 'SystemPrompt' | 'LLMRead' | 'LLMWrite' | 'protected' | 'ApplyTemplate' | 'prompt' | 'readonly' | 'template';
15
20
  /**
16
21
  * Attributes that can be set on a MindCache key
17
22
  */
@@ -26,13 +31,13 @@ interface KeyAttributes {
26
31
  systemTags: SystemTag[];
27
32
  /** Z-index for ordering keys (lower values appear first) */
28
33
  zIndex: number;
29
- /** @deprecated Use systemTags.includes('readonly') instead */
34
+ /** @deprecated Use !systemTags.includes('LLMWrite') instead */
30
35
  readonly: boolean;
31
- /** @deprecated Use systemTags.includes('prompt') instead */
36
+ /** @deprecated Use systemTags.includes('SystemPrompt') instead */
32
37
  visible: boolean;
33
38
  /** @deprecated Use systemTags.includes('protected') instead */
34
39
  hardcoded: boolean;
35
- /** @deprecated Use systemTags.includes('template') instead */
40
+ /** @deprecated Use systemTags.includes('ApplyTemplate') instead */
36
41
  template: boolean;
37
42
  /** @deprecated Use contentTags instead */
38
43
  tags?: string[];
@@ -80,12 +85,24 @@ interface MindCacheCloudOptions {
80
85
  /** WebSocket base URL (defaults to production) */
81
86
  baseUrl?: string;
82
87
  }
88
+ interface MindCacheIndexedDBOptions {
89
+ /** Database name (defaults to 'mindcache_db') */
90
+ dbName?: string;
91
+ /** Store name (defaults to 'mindcache_store') */
92
+ storeName?: string;
93
+ /** Storage key (defaults to 'mindcache_data') */
94
+ key?: string;
95
+ /** Debounce time in ms for saving (defaults to 1000) */
96
+ debounceMs?: number;
97
+ }
83
98
  /**
84
99
  * Constructor options for MindCache
85
100
  */
86
101
  interface MindCacheOptions {
87
102
  /** Cloud sync configuration. If omitted, runs in local-only mode. */
88
103
  cloud?: MindCacheCloudOptions;
104
+ /** IndexedDB configuration */
105
+ indexedDB?: MindCacheIndexedDBOptions;
89
106
  /** Access level for tag operations. 'system' allows managing system tags. */
90
107
  accessLevel?: AccessLevel;
91
108
  }
@@ -95,6 +112,24 @@ declare class MindCache {
95
112
  private listeners;
96
113
  private globalListeners;
97
114
  private _isRemoteUpdate;
115
+ /**
116
+ * Normalize system tags: migrate old tags to new ones
117
+ * - 'prompt' → 'SystemPrompt'
118
+ * - 'readonly' → remove 'LLMWrite' (or add if not readonly)
119
+ */
120
+ private normalizeSystemTags;
121
+ /**
122
+ * Check if key should be visible in system prompt
123
+ */
124
+ private hasSystemPrompt;
125
+ /**
126
+ * Check if key can be read by LLM (has LLMRead or SystemPrompt)
127
+ */
128
+ private hasLLMRead;
129
+ /**
130
+ * Check if key can be written by LLM (has LLMWrite and not readonly)
131
+ */
132
+ private hasLLMWrite;
98
133
  private _cloudAdapter;
99
134
  private _connectionState;
100
135
  private _isLoaded;
@@ -111,6 +146,8 @@ declare class MindCache {
111
146
  */
112
147
  get hasSystemAccess(): boolean;
113
148
  private _initCloud;
149
+ private _initIndexedDB;
150
+ protected _getIndexedDBAdapterClass(): Promise<any>;
114
151
  /**
115
152
  * Get the current cloud connection state
116
153
  */
@@ -395,4 +432,4 @@ declare class CloudAdapter {
395
432
  private syncLocalChanges;
396
433
  }
397
434
 
398
- export { type CloudConfig as C, type DeleteOperation as D, 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 STM as e, type STMEntry as f, type MindCacheOptions as g, type MindCacheCloudOptions as h, DEFAULT_KEY_ATTRIBUTES as i, mindcache as m };
435
+ export { CloudAdapter as C, DEFAULT_KEY_ATTRIBUTES as D, type KeyAttributes as K, type Listener as L, MindCache as M, type Operation as O, type STM as S, type MindCacheOptions as a, type STMEntry as b, type MindCacheCloudOptions as c, type MindCacheIndexedDBOptions as d, type CloudConfig as e, type ConnectionState as f, type CloudAdapterEvents as g, type SetOperation as h, type DeleteOperation as i, type ClearOperation as j, mindcache as m };
@@ -6,12 +6,17 @@
6
6
  type AccessLevel = 'user' | 'system';
7
7
  /**
8
8
  * Known system tags that control key behavior
9
- * - 'prompt': Include in system prompt (replaces visible)
10
- * - 'readonly': Cannot be modified by AI tools (replaces readonly)
9
+ * - 'SystemPrompt': Include in system prompt
10
+ * - 'LLMRead': LLM can read this key (visible to LLMs)
11
+ * - 'LLMWrite': LLM can write to this key via tools
11
12
  * - 'protected': Cannot be deleted (replaces hardcoded)
12
- * - 'template': Process value through template injection
13
+ * - 'ApplyTemplate': Process value through template injection
14
+ *
15
+ * @deprecated 'prompt' - Use 'SystemPrompt' instead
16
+ * @deprecated 'readonly' - Use absence of 'LLMWrite' instead (if LLMWrite not present, readonly=true)
17
+ * @deprecated 'template' - Use 'ApplyTemplate' instead
13
18
  */
14
- type SystemTag = 'prompt' | 'readonly' | 'protected' | 'template';
19
+ type SystemTag = 'SystemPrompt' | 'LLMRead' | 'LLMWrite' | 'protected' | 'ApplyTemplate' | 'prompt' | 'readonly' | 'template';
15
20
  /**
16
21
  * Attributes that can be set on a MindCache key
17
22
  */
@@ -26,13 +31,13 @@ interface KeyAttributes {
26
31
  systemTags: SystemTag[];
27
32
  /** Z-index for ordering keys (lower values appear first) */
28
33
  zIndex: number;
29
- /** @deprecated Use systemTags.includes('readonly') instead */
34
+ /** @deprecated Use !systemTags.includes('LLMWrite') instead */
30
35
  readonly: boolean;
31
- /** @deprecated Use systemTags.includes('prompt') instead */
36
+ /** @deprecated Use systemTags.includes('SystemPrompt') instead */
32
37
  visible: boolean;
33
38
  /** @deprecated Use systemTags.includes('protected') instead */
34
39
  hardcoded: boolean;
35
- /** @deprecated Use systemTags.includes('template') instead */
40
+ /** @deprecated Use systemTags.includes('ApplyTemplate') instead */
36
41
  template: boolean;
37
42
  /** @deprecated Use contentTags instead */
38
43
  tags?: string[];
@@ -80,12 +85,24 @@ interface MindCacheCloudOptions {
80
85
  /** WebSocket base URL (defaults to production) */
81
86
  baseUrl?: string;
82
87
  }
88
+ interface MindCacheIndexedDBOptions {
89
+ /** Database name (defaults to 'mindcache_db') */
90
+ dbName?: string;
91
+ /** Store name (defaults to 'mindcache_store') */
92
+ storeName?: string;
93
+ /** Storage key (defaults to 'mindcache_data') */
94
+ key?: string;
95
+ /** Debounce time in ms for saving (defaults to 1000) */
96
+ debounceMs?: number;
97
+ }
83
98
  /**
84
99
  * Constructor options for MindCache
85
100
  */
86
101
  interface MindCacheOptions {
87
102
  /** Cloud sync configuration. If omitted, runs in local-only mode. */
88
103
  cloud?: MindCacheCloudOptions;
104
+ /** IndexedDB configuration */
105
+ indexedDB?: MindCacheIndexedDBOptions;
89
106
  /** Access level for tag operations. 'system' allows managing system tags. */
90
107
  accessLevel?: AccessLevel;
91
108
  }
@@ -95,6 +112,24 @@ declare class MindCache {
95
112
  private listeners;
96
113
  private globalListeners;
97
114
  private _isRemoteUpdate;
115
+ /**
116
+ * Normalize system tags: migrate old tags to new ones
117
+ * - 'prompt' → 'SystemPrompt'
118
+ * - 'readonly' → remove 'LLMWrite' (or add if not readonly)
119
+ */
120
+ private normalizeSystemTags;
121
+ /**
122
+ * Check if key should be visible in system prompt
123
+ */
124
+ private hasSystemPrompt;
125
+ /**
126
+ * Check if key can be read by LLM (has LLMRead or SystemPrompt)
127
+ */
128
+ private hasLLMRead;
129
+ /**
130
+ * Check if key can be written by LLM (has LLMWrite and not readonly)
131
+ */
132
+ private hasLLMWrite;
98
133
  private _cloudAdapter;
99
134
  private _connectionState;
100
135
  private _isLoaded;
@@ -111,6 +146,8 @@ declare class MindCache {
111
146
  */
112
147
  get hasSystemAccess(): boolean;
113
148
  private _initCloud;
149
+ private _initIndexedDB;
150
+ protected _getIndexedDBAdapterClass(): Promise<any>;
114
151
  /**
115
152
  * Get the current cloud connection state
116
153
  */
@@ -395,4 +432,4 @@ declare class CloudAdapter {
395
432
  private syncLocalChanges;
396
433
  }
397
434
 
398
- export { type CloudConfig as C, type DeleteOperation as D, 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 STM as e, type STMEntry as f, type MindCacheOptions as g, type MindCacheCloudOptions as h, DEFAULT_KEY_ATTRIBUTES as i, mindcache as m };
435
+ export { CloudAdapter as C, DEFAULT_KEY_ATTRIBUTES as D, type KeyAttributes as K, type Listener as L, MindCache as M, type Operation as O, type STM as S, type MindCacheOptions as a, type STMEntry as b, type MindCacheCloudOptions as c, type MindCacheIndexedDBOptions as d, type CloudConfig as e, type ConnectionState as f, type CloudAdapterEvents as g, type SetOperation as h, type DeleteOperation as i, type ClearOperation as j, mindcache as m };
@@ -1,5 +1,5 @@
1
- import { M as MindCache, C as CloudConfig, a as CloudAdapter } from '../index-DXb0fL3e.mjs';
2
- export { d as ClearOperation, c as CloudAdapterEvents, b as ConnectionState, D as DeleteOperation, O as Operation, S as SetOperation } from '../index-DXb0fL3e.mjs';
1
+ import { M as MindCache, e as CloudConfig, C as CloudAdapter } from '../CloudAdapter-B04-OWx3.mjs';
2
+ export { j as ClearOperation, g as CloudAdapterEvents, f as ConnectionState, i as DeleteOperation, O as Operation, h as SetOperation } from '../CloudAdapter-B04-OWx3.mjs';
3
3
 
4
4
  /**
5
5
  * Connect a MindCache instance to the cloud for real-time sync.
@@ -1,5 +1,5 @@
1
- import { M as MindCache, C as CloudConfig, a as CloudAdapter } from '../index-DXb0fL3e.js';
2
- export { d as ClearOperation, c as CloudAdapterEvents, b as ConnectionState, D as DeleteOperation, O as Operation, S as SetOperation } from '../index-DXb0fL3e.js';
1
+ import { M as MindCache, e as CloudConfig, C as CloudAdapter } from '../CloudAdapter-B04-OWx3.js';
2
+ export { j as ClearOperation, g as CloudAdapterEvents, f as ConnectionState, i as DeleteOperation, O as Operation, h as SetOperation } from '../CloudAdapter-B04-OWx3.js';
3
3
 
4
4
  /**
5
5
  * Connect a MindCache instance to the cloud for real-time sync.