mindcache 2.0.0 → 2.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/dist/cloud/index.d.mts +2 -2
- package/dist/cloud/index.d.ts +2 -2
- package/dist/cloud/index.js +500 -50
- package/dist/cloud/index.js.map +1 -1
- package/dist/cloud/index.mjs +500 -50
- package/dist/cloud/index.mjs.map +1 -1
- package/dist/{index-CFJtj3DL.d.mts → index-XM7bmK7C.d.mts} +105 -13
- package/dist/{index-CFJtj3DL.d.ts → index-XM7bmK7C.d.ts} +105 -13
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +500 -50
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +500 -50
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -1,20 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Access level for MindCache operations
|
|
3
|
+
* - 'user': Can only manage content tags (default)
|
|
4
|
+
* - 'system': Can manage both content tags and system tags
|
|
5
|
+
*/
|
|
6
|
+
type AccessLevel = 'user' | 'system';
|
|
7
|
+
/**
|
|
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)
|
|
11
|
+
* - 'protected': Cannot be deleted (replaces hardcoded)
|
|
12
|
+
* - 'template': Process value through template injection
|
|
13
|
+
*/
|
|
14
|
+
type SystemTag = 'prompt' | 'readonly' | 'protected' | 'template';
|
|
1
15
|
/**
|
|
2
16
|
* Attributes that can be set on a MindCache key
|
|
3
17
|
*/
|
|
4
18
|
interface KeyAttributes {
|
|
5
|
-
/** If true, the key cannot be modified by AI tools */
|
|
6
|
-
readonly: boolean;
|
|
7
|
-
/** If true, the key is included in system prompts */
|
|
8
|
-
visible: boolean;
|
|
9
|
-
/** If true, the key is a system key that cannot be deleted */
|
|
10
|
-
hardcoded: boolean;
|
|
11
|
-
/** If true, the value will be processed through template injection */
|
|
12
|
-
template: boolean;
|
|
13
19
|
/** The type of value stored */
|
|
14
20
|
type: 'text' | 'image' | 'file' | 'json';
|
|
15
21
|
/** MIME type for files/images */
|
|
16
22
|
contentType?: string;
|
|
17
|
-
/**
|
|
23
|
+
/** User-defined tags for organizing keys */
|
|
24
|
+
contentTags: string[];
|
|
25
|
+
/** System tags that control key behavior (requires system access) */
|
|
26
|
+
systemTags: SystemTag[];
|
|
27
|
+
/** Z-index for ordering keys (lower values appear first) */
|
|
28
|
+
zIndex: number;
|
|
29
|
+
/** @deprecated Use systemTags.includes('readonly') instead */
|
|
30
|
+
readonly: boolean;
|
|
31
|
+
/** @deprecated Use systemTags.includes('prompt') instead */
|
|
32
|
+
visible: boolean;
|
|
33
|
+
/** @deprecated Use systemTags.includes('protected') instead */
|
|
34
|
+
hardcoded: boolean;
|
|
35
|
+
/** @deprecated Use systemTags.includes('template') instead */
|
|
36
|
+
template: boolean;
|
|
37
|
+
/** @deprecated Use contentTags instead */
|
|
18
38
|
tags?: string[];
|
|
19
39
|
}
|
|
20
40
|
/**
|
|
@@ -31,9 +51,15 @@ type STM = {
|
|
|
31
51
|
[key: string]: STMEntry;
|
|
32
52
|
};
|
|
33
53
|
/**
|
|
34
|
-
*
|
|
54
|
+
* Listener callback for key-specific subscriptions
|
|
55
|
+
* Receives the new value when the key changes
|
|
35
56
|
*/
|
|
36
|
-
type Listener = () => void;
|
|
57
|
+
type Listener = (value: unknown) => void;
|
|
58
|
+
/**
|
|
59
|
+
* Global listener callback for all changes
|
|
60
|
+
* Called when any key changes (no parameters - use getAll() to get current state)
|
|
61
|
+
*/
|
|
62
|
+
type GlobalListener = () => void;
|
|
37
63
|
/**
|
|
38
64
|
* Default attributes for new keys
|
|
39
65
|
*/
|
|
@@ -60,6 +86,8 @@ interface MindCacheCloudOptions {
|
|
|
60
86
|
interface MindCacheOptions {
|
|
61
87
|
/** Cloud sync configuration. If omitted, runs in local-only mode. */
|
|
62
88
|
cloud?: MindCacheCloudOptions;
|
|
89
|
+
/** Access level for tag operations. 'system' allows managing system tags. */
|
|
90
|
+
accessLevel?: AccessLevel;
|
|
63
91
|
}
|
|
64
92
|
type ConnectionState$1 = 'disconnected' | 'connecting' | 'connected' | 'error';
|
|
65
93
|
declare class MindCache {
|
|
@@ -71,7 +99,16 @@ declare class MindCache {
|
|
|
71
99
|
private _connectionState;
|
|
72
100
|
private _isLoaded;
|
|
73
101
|
private _cloudConfig;
|
|
102
|
+
private _accessLevel;
|
|
74
103
|
constructor(options?: MindCacheOptions);
|
|
104
|
+
/**
|
|
105
|
+
* Get the current access level
|
|
106
|
+
*/
|
|
107
|
+
get accessLevel(): AccessLevel;
|
|
108
|
+
/**
|
|
109
|
+
* Check if this instance has system-level access
|
|
110
|
+
*/
|
|
111
|
+
get hasSystemAccess(): boolean;
|
|
75
112
|
private _initCloud;
|
|
76
113
|
/**
|
|
77
114
|
* Get the current cloud connection state
|
|
@@ -111,6 +148,10 @@ declare class MindCache {
|
|
|
111
148
|
has(key: string): boolean;
|
|
112
149
|
delete(key: string): boolean;
|
|
113
150
|
clear(): void;
|
|
151
|
+
/**
|
|
152
|
+
* Get keys sorted by zIndex (ascending), then by key name
|
|
153
|
+
*/
|
|
154
|
+
private getSortedKeys;
|
|
114
155
|
keys(): string[];
|
|
115
156
|
values(): any[];
|
|
116
157
|
entries(): [string, any][];
|
|
@@ -119,8 +160,8 @@ declare class MindCache {
|
|
|
119
160
|
update(newValues: Record<string, any>): void;
|
|
120
161
|
subscribe(key: string, listener: Listener): void;
|
|
121
162
|
unsubscribe(key: string, listener: Listener): void;
|
|
122
|
-
subscribeToAll(listener:
|
|
123
|
-
unsubscribeFromAll(listener:
|
|
163
|
+
subscribeToAll(listener: GlobalListener): void;
|
|
164
|
+
unsubscribeFromAll(listener: GlobalListener): void;
|
|
124
165
|
private notifyGlobalListeners;
|
|
125
166
|
injectSTM(template: string, _processingStack?: Set<string>): string;
|
|
126
167
|
getSTM(): string;
|
|
@@ -149,12 +190,63 @@ declare class MindCache {
|
|
|
149
190
|
key: string;
|
|
150
191
|
value: any;
|
|
151
192
|
} | null;
|
|
193
|
+
/**
|
|
194
|
+
* Add a content tag to a key (user-level organization)
|
|
195
|
+
*/
|
|
152
196
|
addTag(key: string, tag: string): boolean;
|
|
197
|
+
/**
|
|
198
|
+
* Remove a content tag from a key
|
|
199
|
+
*/
|
|
153
200
|
removeTag(key: string, tag: string): boolean;
|
|
201
|
+
/**
|
|
202
|
+
* Get all content tags for a key
|
|
203
|
+
*/
|
|
154
204
|
getTags(key: string): string[];
|
|
205
|
+
/**
|
|
206
|
+
* Get all unique content tags across all keys
|
|
207
|
+
*/
|
|
155
208
|
getAllTags(): string[];
|
|
209
|
+
/**
|
|
210
|
+
* Check if a key has a specific content tag
|
|
211
|
+
*/
|
|
156
212
|
hasTag(key: string, tag: string): boolean;
|
|
213
|
+
/**
|
|
214
|
+
* Get all keys with a specific content tag as formatted string
|
|
215
|
+
*/
|
|
157
216
|
getTagged(tag: string): string;
|
|
217
|
+
/**
|
|
218
|
+
* Get all keys with a specific content tag
|
|
219
|
+
*/
|
|
220
|
+
getKeysByTag(tag: string): string[];
|
|
221
|
+
/**
|
|
222
|
+
* Add a system tag to a key (requires system access)
|
|
223
|
+
* System tags: 'prompt', 'readonly', 'protected', 'template'
|
|
224
|
+
*/
|
|
225
|
+
systemAddTag(key: string, tag: SystemTag): boolean;
|
|
226
|
+
/**
|
|
227
|
+
* Remove a system tag from a key (requires system access)
|
|
228
|
+
*/
|
|
229
|
+
systemRemoveTag(key: string, tag: SystemTag): boolean;
|
|
230
|
+
/**
|
|
231
|
+
* Get all system tags for a key (requires system access)
|
|
232
|
+
*/
|
|
233
|
+
systemGetTags(key: string): SystemTag[];
|
|
234
|
+
/**
|
|
235
|
+
* Check if a key has a specific system tag (requires system access)
|
|
236
|
+
*/
|
|
237
|
+
systemHasTag(key: string, tag: SystemTag): boolean;
|
|
238
|
+
/**
|
|
239
|
+
* Set all system tags for a key at once (requires system access)
|
|
240
|
+
*/
|
|
241
|
+
systemSetTags(key: string, tags: SystemTag[]): boolean;
|
|
242
|
+
/**
|
|
243
|
+
* Get all keys with a specific system tag (requires system access)
|
|
244
|
+
*/
|
|
245
|
+
systemGetKeysByTag(tag: SystemTag): string[];
|
|
246
|
+
/**
|
|
247
|
+
* Helper to sync legacy boolean attributes from system tags
|
|
248
|
+
*/
|
|
249
|
+
private syncLegacyFromSystemTags;
|
|
158
250
|
toMarkdown(): string;
|
|
159
251
|
fromMarkdown(markdown: string): void;
|
|
160
252
|
}
|
|
@@ -1,20 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Access level for MindCache operations
|
|
3
|
+
* - 'user': Can only manage content tags (default)
|
|
4
|
+
* - 'system': Can manage both content tags and system tags
|
|
5
|
+
*/
|
|
6
|
+
type AccessLevel = 'user' | 'system';
|
|
7
|
+
/**
|
|
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)
|
|
11
|
+
* - 'protected': Cannot be deleted (replaces hardcoded)
|
|
12
|
+
* - 'template': Process value through template injection
|
|
13
|
+
*/
|
|
14
|
+
type SystemTag = 'prompt' | 'readonly' | 'protected' | 'template';
|
|
1
15
|
/**
|
|
2
16
|
* Attributes that can be set on a MindCache key
|
|
3
17
|
*/
|
|
4
18
|
interface KeyAttributes {
|
|
5
|
-
/** If true, the key cannot be modified by AI tools */
|
|
6
|
-
readonly: boolean;
|
|
7
|
-
/** If true, the key is included in system prompts */
|
|
8
|
-
visible: boolean;
|
|
9
|
-
/** If true, the key is a system key that cannot be deleted */
|
|
10
|
-
hardcoded: boolean;
|
|
11
|
-
/** If true, the value will be processed through template injection */
|
|
12
|
-
template: boolean;
|
|
13
19
|
/** The type of value stored */
|
|
14
20
|
type: 'text' | 'image' | 'file' | 'json';
|
|
15
21
|
/** MIME type for files/images */
|
|
16
22
|
contentType?: string;
|
|
17
|
-
/**
|
|
23
|
+
/** User-defined tags for organizing keys */
|
|
24
|
+
contentTags: string[];
|
|
25
|
+
/** System tags that control key behavior (requires system access) */
|
|
26
|
+
systemTags: SystemTag[];
|
|
27
|
+
/** Z-index for ordering keys (lower values appear first) */
|
|
28
|
+
zIndex: number;
|
|
29
|
+
/** @deprecated Use systemTags.includes('readonly') instead */
|
|
30
|
+
readonly: boolean;
|
|
31
|
+
/** @deprecated Use systemTags.includes('prompt') instead */
|
|
32
|
+
visible: boolean;
|
|
33
|
+
/** @deprecated Use systemTags.includes('protected') instead */
|
|
34
|
+
hardcoded: boolean;
|
|
35
|
+
/** @deprecated Use systemTags.includes('template') instead */
|
|
36
|
+
template: boolean;
|
|
37
|
+
/** @deprecated Use contentTags instead */
|
|
18
38
|
tags?: string[];
|
|
19
39
|
}
|
|
20
40
|
/**
|
|
@@ -31,9 +51,15 @@ type STM = {
|
|
|
31
51
|
[key: string]: STMEntry;
|
|
32
52
|
};
|
|
33
53
|
/**
|
|
34
|
-
*
|
|
54
|
+
* Listener callback for key-specific subscriptions
|
|
55
|
+
* Receives the new value when the key changes
|
|
35
56
|
*/
|
|
36
|
-
type Listener = () => void;
|
|
57
|
+
type Listener = (value: unknown) => void;
|
|
58
|
+
/**
|
|
59
|
+
* Global listener callback for all changes
|
|
60
|
+
* Called when any key changes (no parameters - use getAll() to get current state)
|
|
61
|
+
*/
|
|
62
|
+
type GlobalListener = () => void;
|
|
37
63
|
/**
|
|
38
64
|
* Default attributes for new keys
|
|
39
65
|
*/
|
|
@@ -60,6 +86,8 @@ interface MindCacheCloudOptions {
|
|
|
60
86
|
interface MindCacheOptions {
|
|
61
87
|
/** Cloud sync configuration. If omitted, runs in local-only mode. */
|
|
62
88
|
cloud?: MindCacheCloudOptions;
|
|
89
|
+
/** Access level for tag operations. 'system' allows managing system tags. */
|
|
90
|
+
accessLevel?: AccessLevel;
|
|
63
91
|
}
|
|
64
92
|
type ConnectionState$1 = 'disconnected' | 'connecting' | 'connected' | 'error';
|
|
65
93
|
declare class MindCache {
|
|
@@ -71,7 +99,16 @@ declare class MindCache {
|
|
|
71
99
|
private _connectionState;
|
|
72
100
|
private _isLoaded;
|
|
73
101
|
private _cloudConfig;
|
|
102
|
+
private _accessLevel;
|
|
74
103
|
constructor(options?: MindCacheOptions);
|
|
104
|
+
/**
|
|
105
|
+
* Get the current access level
|
|
106
|
+
*/
|
|
107
|
+
get accessLevel(): AccessLevel;
|
|
108
|
+
/**
|
|
109
|
+
* Check if this instance has system-level access
|
|
110
|
+
*/
|
|
111
|
+
get hasSystemAccess(): boolean;
|
|
75
112
|
private _initCloud;
|
|
76
113
|
/**
|
|
77
114
|
* Get the current cloud connection state
|
|
@@ -111,6 +148,10 @@ declare class MindCache {
|
|
|
111
148
|
has(key: string): boolean;
|
|
112
149
|
delete(key: string): boolean;
|
|
113
150
|
clear(): void;
|
|
151
|
+
/**
|
|
152
|
+
* Get keys sorted by zIndex (ascending), then by key name
|
|
153
|
+
*/
|
|
154
|
+
private getSortedKeys;
|
|
114
155
|
keys(): string[];
|
|
115
156
|
values(): any[];
|
|
116
157
|
entries(): [string, any][];
|
|
@@ -119,8 +160,8 @@ declare class MindCache {
|
|
|
119
160
|
update(newValues: Record<string, any>): void;
|
|
120
161
|
subscribe(key: string, listener: Listener): void;
|
|
121
162
|
unsubscribe(key: string, listener: Listener): void;
|
|
122
|
-
subscribeToAll(listener:
|
|
123
|
-
unsubscribeFromAll(listener:
|
|
163
|
+
subscribeToAll(listener: GlobalListener): void;
|
|
164
|
+
unsubscribeFromAll(listener: GlobalListener): void;
|
|
124
165
|
private notifyGlobalListeners;
|
|
125
166
|
injectSTM(template: string, _processingStack?: Set<string>): string;
|
|
126
167
|
getSTM(): string;
|
|
@@ -149,12 +190,63 @@ declare class MindCache {
|
|
|
149
190
|
key: string;
|
|
150
191
|
value: any;
|
|
151
192
|
} | null;
|
|
193
|
+
/**
|
|
194
|
+
* Add a content tag to a key (user-level organization)
|
|
195
|
+
*/
|
|
152
196
|
addTag(key: string, tag: string): boolean;
|
|
197
|
+
/**
|
|
198
|
+
* Remove a content tag from a key
|
|
199
|
+
*/
|
|
153
200
|
removeTag(key: string, tag: string): boolean;
|
|
201
|
+
/**
|
|
202
|
+
* Get all content tags for a key
|
|
203
|
+
*/
|
|
154
204
|
getTags(key: string): string[];
|
|
205
|
+
/**
|
|
206
|
+
* Get all unique content tags across all keys
|
|
207
|
+
*/
|
|
155
208
|
getAllTags(): string[];
|
|
209
|
+
/**
|
|
210
|
+
* Check if a key has a specific content tag
|
|
211
|
+
*/
|
|
156
212
|
hasTag(key: string, tag: string): boolean;
|
|
213
|
+
/**
|
|
214
|
+
* Get all keys with a specific content tag as formatted string
|
|
215
|
+
*/
|
|
157
216
|
getTagged(tag: string): string;
|
|
217
|
+
/**
|
|
218
|
+
* Get all keys with a specific content tag
|
|
219
|
+
*/
|
|
220
|
+
getKeysByTag(tag: string): string[];
|
|
221
|
+
/**
|
|
222
|
+
* Add a system tag to a key (requires system access)
|
|
223
|
+
* System tags: 'prompt', 'readonly', 'protected', 'template'
|
|
224
|
+
*/
|
|
225
|
+
systemAddTag(key: string, tag: SystemTag): boolean;
|
|
226
|
+
/**
|
|
227
|
+
* Remove a system tag from a key (requires system access)
|
|
228
|
+
*/
|
|
229
|
+
systemRemoveTag(key: string, tag: SystemTag): boolean;
|
|
230
|
+
/**
|
|
231
|
+
* Get all system tags for a key (requires system access)
|
|
232
|
+
*/
|
|
233
|
+
systemGetTags(key: string): SystemTag[];
|
|
234
|
+
/**
|
|
235
|
+
* Check if a key has a specific system tag (requires system access)
|
|
236
|
+
*/
|
|
237
|
+
systemHasTag(key: string, tag: SystemTag): boolean;
|
|
238
|
+
/**
|
|
239
|
+
* Set all system tags for a key at once (requires system access)
|
|
240
|
+
*/
|
|
241
|
+
systemSetTags(key: string, tags: SystemTag[]): boolean;
|
|
242
|
+
/**
|
|
243
|
+
* Get all keys with a specific system tag (requires system access)
|
|
244
|
+
*/
|
|
245
|
+
systemGetKeysByTag(tag: SystemTag): string[];
|
|
246
|
+
/**
|
|
247
|
+
* Helper to sync legacy boolean attributes from system tags
|
|
248
|
+
*/
|
|
249
|
+
private syncLegacyFromSystemTags;
|
|
158
250
|
toMarkdown(): string;
|
|
159
251
|
fromMarkdown(markdown: string): void;
|
|
160
252
|
}
|
package/dist/index.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { a as CloudAdapter, c as CloudAdapterEvents, C as CloudConfig, b as ConnectionState, i as DEFAULT_KEY_ATTRIBUTES, K as KeyAttributes, L as Listener, M as MindCache, h as MindCacheCloudOptions, g as MindCacheOptions, e as STM, f as STMEntry, m as mindcache } from './index-
|
|
1
|
+
export { a as CloudAdapter, c as CloudAdapterEvents, C as CloudConfig, b as ConnectionState, i as DEFAULT_KEY_ATTRIBUTES, K as KeyAttributes, L as Listener, M as MindCache, h as MindCacheCloudOptions, g as MindCacheOptions, e as STM, f as STMEntry, m as mindcache } from './index-XM7bmK7C.mjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { a as CloudAdapter, c as CloudAdapterEvents, C as CloudConfig, b as ConnectionState, i as DEFAULT_KEY_ATTRIBUTES, K as KeyAttributes, L as Listener, M as MindCache, h as MindCacheCloudOptions, g as MindCacheOptions, e as STM, f as STMEntry, m as mindcache } from './index-
|
|
1
|
+
export { a as CloudAdapter, c as CloudAdapterEvents, C as CloudConfig, b as ConnectionState, i as DEFAULT_KEY_ATTRIBUTES, K as KeyAttributes, L as Listener, M as MindCache, h as MindCacheCloudOptions, g as MindCacheOptions, e as STM, f as STMEntry, m as mindcache } from './index-XM7bmK7C.js';
|