mindcache 1.0.1 → 2.0.0-alpha.1

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.
@@ -0,0 +1,1314 @@
1
+ 'use strict';
2
+
3
+ var zod = require('zod');
4
+
5
+ var __defProp = Object.defineProperty;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __esm = (fn, res) => function __init() {
8
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
9
+ };
10
+ var __export = (target, all) => {
11
+ for (var name in all)
12
+ __defProp(target, name, { get: all[name], enumerable: true });
13
+ };
14
+
15
+ // src/cloud/CloudAdapter.ts
16
+ var CloudAdapter_exports = {};
17
+ __export(CloudAdapter_exports, {
18
+ CloudAdapter: () => exports.CloudAdapter
19
+ });
20
+ var DEFAULT_BASE_URL, RECONNECT_DELAY, MAX_RECONNECT_DELAY; exports.CloudAdapter = void 0;
21
+ var init_CloudAdapter = __esm({
22
+ "src/cloud/CloudAdapter.ts"() {
23
+ DEFAULT_BASE_URL = "wss://api.mindcache.io";
24
+ RECONNECT_DELAY = 1e3;
25
+ MAX_RECONNECT_DELAY = 3e4;
26
+ exports.CloudAdapter = class {
27
+ constructor(config) {
28
+ this.config = config;
29
+ this.config.baseUrl = config.baseUrl || DEFAULT_BASE_URL;
30
+ }
31
+ ws = null;
32
+ queue = [];
33
+ mindcache = null;
34
+ unsubscribe = null;
35
+ reconnectAttempts = 0;
36
+ reconnectTimeout = null;
37
+ _state = "disconnected";
38
+ listeners = {};
39
+ token = null;
40
+ /**
41
+ * Set auth token (short-lived, from /api/ws-token)
42
+ * Call this before connect() or use setTokenProvider for auto-refresh
43
+ */
44
+ setToken(token) {
45
+ this.token = token;
46
+ }
47
+ /**
48
+ * Set a function that returns a fresh token
49
+ * Used for automatic token refresh on reconnect
50
+ */
51
+ setTokenProvider(provider) {
52
+ this.config.tokenProvider = provider;
53
+ }
54
+ /**
55
+ * Get current connection state
56
+ */
57
+ get state() {
58
+ return this._state;
59
+ }
60
+ /**
61
+ * Attach to a MindCache instance and start syncing
62
+ */
63
+ attach(mc) {
64
+ if (this.mindcache) {
65
+ this.detach();
66
+ }
67
+ this.mindcache = mc;
68
+ const listener = () => {
69
+ if (mc.isRemoteUpdate()) {
70
+ console.log("\u2601\uFE0F CloudAdapter: Skipping remote update");
71
+ return;
72
+ }
73
+ console.log("\u2601\uFE0F CloudAdapter: Local change detected, syncing...");
74
+ this.syncLocalChanges();
75
+ };
76
+ mc.subscribeToAll(listener);
77
+ this.unsubscribe = () => mc.unsubscribeFromAll(listener);
78
+ console.log("\u2601\uFE0F CloudAdapter: Attached to MindCache instance");
79
+ }
80
+ /**
81
+ * Detach from the MindCache instance
82
+ */
83
+ detach() {
84
+ if (this.unsubscribe) {
85
+ this.unsubscribe();
86
+ this.unsubscribe = null;
87
+ }
88
+ this.mindcache = null;
89
+ }
90
+ /**
91
+ * Connect to the cloud service
92
+ */
93
+ async connect() {
94
+ if (this._state === "connecting" || this._state === "connected") {
95
+ return;
96
+ }
97
+ this._state = "connecting";
98
+ try {
99
+ if (this.config.tokenProvider && !this.token) {
100
+ this.token = await this.config.tokenProvider();
101
+ }
102
+ let url = `${this.config.baseUrl}/sync/${this.config.instanceId}`;
103
+ if (this.token) {
104
+ url += `?token=${encodeURIComponent(this.token)}`;
105
+ this.token = null;
106
+ }
107
+ this.ws = new WebSocket(url);
108
+ this.setupWebSocket();
109
+ } catch (error) {
110
+ this._state = "error";
111
+ this.emit("error", error);
112
+ this.scheduleReconnect();
113
+ }
114
+ }
115
+ /**
116
+ * Disconnect from the cloud service
117
+ */
118
+ disconnect() {
119
+ if (this.reconnectTimeout) {
120
+ clearTimeout(this.reconnectTimeout);
121
+ this.reconnectTimeout = null;
122
+ }
123
+ if (this.ws) {
124
+ this.ws.close();
125
+ this.ws = null;
126
+ }
127
+ this._state = "disconnected";
128
+ this.emit("disconnected");
129
+ }
130
+ /**
131
+ * Push an operation to the cloud
132
+ */
133
+ push(op) {
134
+ if (this.ws?.readyState === WebSocket.OPEN) {
135
+ this.ws.send(JSON.stringify(op));
136
+ } else {
137
+ this.queue.push(op);
138
+ }
139
+ }
140
+ /**
141
+ * Add event listener
142
+ */
143
+ on(event, listener) {
144
+ if (!this.listeners[event]) {
145
+ this.listeners[event] = [];
146
+ }
147
+ this.listeners[event].push(listener);
148
+ }
149
+ /**
150
+ * Remove event listener
151
+ */
152
+ off(event, listener) {
153
+ if (this.listeners[event]) {
154
+ this.listeners[event] = this.listeners[event].filter((l) => l !== listener);
155
+ }
156
+ }
157
+ emit(event, ...args) {
158
+ if (this.listeners[event]) {
159
+ this.listeners[event].forEach((listener) => listener(...args));
160
+ }
161
+ }
162
+ setupWebSocket() {
163
+ if (!this.ws) {
164
+ return;
165
+ }
166
+ this.ws.onopen = () => {
167
+ if (this.config.apiKey) {
168
+ this.ws.send(JSON.stringify({
169
+ type: "auth",
170
+ apiKey: this.config.apiKey
171
+ }));
172
+ }
173
+ };
174
+ this.ws.onmessage = (event) => {
175
+ try {
176
+ const msg = JSON.parse(event.data);
177
+ this.handleMessage(msg);
178
+ } catch (error) {
179
+ console.error("MindCache Cloud: Failed to parse message:", error);
180
+ }
181
+ };
182
+ this.ws.onclose = () => {
183
+ this._state = "disconnected";
184
+ this.emit("disconnected");
185
+ this.scheduleReconnect();
186
+ };
187
+ this.ws.onerror = (error) => {
188
+ this._state = "error";
189
+ this.emit("error", new Error("WebSocket error"));
190
+ console.error("MindCache Cloud: WebSocket error:", error);
191
+ };
192
+ }
193
+ handleMessage(msg) {
194
+ switch (msg.type) {
195
+ case "auth_success":
196
+ this._state = "connected";
197
+ this.reconnectAttempts = 0;
198
+ this.emit("connected");
199
+ this.flushQueue();
200
+ break;
201
+ case "auth_error":
202
+ this._state = "error";
203
+ this.emit("error", new Error(msg.error));
204
+ this.disconnect();
205
+ break;
206
+ case "sync":
207
+ if (this.mindcache && msg.data) {
208
+ Object.entries(msg.data).forEach(([key, entry]) => {
209
+ const { value, attributes } = entry;
210
+ this.mindcache._setFromRemote(key, value, attributes);
211
+ });
212
+ this.emit("synced");
213
+ }
214
+ break;
215
+ case "set":
216
+ if (this.mindcache) {
217
+ this.mindcache._setFromRemote(msg.key, msg.value, msg.attributes);
218
+ }
219
+ break;
220
+ case "key_updated":
221
+ if (this.mindcache) {
222
+ this.mindcache._setFromRemote(msg.key, msg.value, msg.attributes);
223
+ }
224
+ break;
225
+ case "delete":
226
+ if (this.mindcache) {
227
+ this.mindcache._deleteFromRemote(msg.key);
228
+ }
229
+ break;
230
+ case "key_deleted":
231
+ if (this.mindcache) {
232
+ this.mindcache._deleteFromRemote(msg.key);
233
+ }
234
+ break;
235
+ case "clear":
236
+ if (this.mindcache) {
237
+ this.mindcache._clearFromRemote();
238
+ }
239
+ break;
240
+ case "cleared":
241
+ if (this.mindcache) {
242
+ this.mindcache._clearFromRemote();
243
+ }
244
+ break;
245
+ case "error":
246
+ this.emit("error", new Error(msg.error));
247
+ break;
248
+ }
249
+ }
250
+ flushQueue() {
251
+ while (this.queue.length > 0 && this.ws?.readyState === WebSocket.OPEN) {
252
+ const op = this.queue.shift();
253
+ this.ws.send(JSON.stringify(op));
254
+ }
255
+ }
256
+ scheduleReconnect() {
257
+ if (this.reconnectTimeout) {
258
+ return;
259
+ }
260
+ const delay = Math.min(
261
+ RECONNECT_DELAY * Math.pow(2, this.reconnectAttempts),
262
+ MAX_RECONNECT_DELAY
263
+ );
264
+ this.reconnectTimeout = setTimeout(async () => {
265
+ this.reconnectTimeout = null;
266
+ this.reconnectAttempts++;
267
+ if (this.config.tokenProvider) {
268
+ try {
269
+ this.token = await this.config.tokenProvider();
270
+ } catch (error) {
271
+ console.error("MindCache Cloud: Failed to get token for reconnect:", error);
272
+ this.emit("error", error);
273
+ return;
274
+ }
275
+ }
276
+ this.connect();
277
+ }, delay);
278
+ }
279
+ syncLocalChanges() {
280
+ if (!this.mindcache) {
281
+ return;
282
+ }
283
+ const entries = this.mindcache.serialize();
284
+ console.log("\u2601\uFE0F CloudAdapter: Syncing local changes:", Object.keys(entries));
285
+ Object.entries(entries).forEach(([key, entry]) => {
286
+ console.log("\u2601\uFE0F CloudAdapter: Pushing key:", key, "=", entry.value);
287
+ this.push({
288
+ type: "set",
289
+ key,
290
+ value: entry.value,
291
+ attributes: entry.attributes,
292
+ timestamp: Date.now()
293
+ });
294
+ });
295
+ }
296
+ };
297
+ }
298
+ });
299
+
300
+ // src/core/types.ts
301
+ var DEFAULT_KEY_ATTRIBUTES = {
302
+ readonly: false,
303
+ visible: true,
304
+ hardcoded: false,
305
+ template: false,
306
+ type: "text",
307
+ tags: []
308
+ };
309
+
310
+ // src/core/MindCache.ts
311
+ var MindCache = class {
312
+ stm = {};
313
+ listeners = {};
314
+ globalListeners = [];
315
+ // Internal flag to prevent sync loops when receiving remote updates
316
+ _isRemoteUpdate = false;
317
+ // Cloud sync state
318
+ _cloudAdapter = null;
319
+ _connectionState = "disconnected";
320
+ _isLoaded = true;
321
+ // Default true for local mode
322
+ _cloudConfig = null;
323
+ constructor(options) {
324
+ if (options?.cloud) {
325
+ this._cloudConfig = options.cloud;
326
+ this._isLoaded = false;
327
+ this._connectionState = "disconnected";
328
+ this._initCloud();
329
+ }
330
+ }
331
+ async _initCloud() {
332
+ if (!this._cloudConfig) {
333
+ return;
334
+ }
335
+ try {
336
+ const { CloudAdapter: CloudAdapter2 } = await Promise.resolve().then(() => (init_CloudAdapter(), CloudAdapter_exports));
337
+ const configUrl = this._cloudConfig.baseUrl || "https://api.mindcache.io";
338
+ const baseUrl = configUrl.replace("https://", "wss://").replace("http://", "ws://");
339
+ const adapter = new CloudAdapter2({
340
+ instanceId: this._cloudConfig.instanceId,
341
+ projectId: this._cloudConfig.projectId || "default",
342
+ baseUrl,
343
+ apiKey: this._cloudConfig.apiKey
344
+ });
345
+ if (this._cloudConfig.tokenEndpoint) {
346
+ const tokenEndpoint = this._cloudConfig.tokenEndpoint;
347
+ const instanceId = this._cloudConfig.instanceId;
348
+ const resolveUrl = (endpoint) => {
349
+ if (endpoint.startsWith("http://") || endpoint.startsWith("https://")) {
350
+ return endpoint;
351
+ }
352
+ if (typeof window !== "undefined" && window.location?.origin) {
353
+ return `${window.location.origin}${endpoint.startsWith("/") ? "" : "/"}${endpoint}`;
354
+ }
355
+ return endpoint;
356
+ };
357
+ adapter.setTokenProvider(async () => {
358
+ const baseUrl2 = resolveUrl(tokenEndpoint);
359
+ const url = baseUrl2.includes("?") ? `${baseUrl2}&instanceId=${instanceId}` : `${baseUrl2}?instanceId=${instanceId}`;
360
+ const response = await fetch(url);
361
+ if (!response.ok) {
362
+ const error = await response.json().catch(() => ({ error: "Failed to get token" }));
363
+ throw new Error(error.error || "Failed to get token");
364
+ }
365
+ const data = await response.json();
366
+ return data.token;
367
+ });
368
+ }
369
+ adapter.on("connected", () => {
370
+ this._connectionState = "connected";
371
+ this.notifyGlobalListeners();
372
+ });
373
+ adapter.on("disconnected", () => {
374
+ this._connectionState = "disconnected";
375
+ this.notifyGlobalListeners();
376
+ });
377
+ adapter.on("error", () => {
378
+ this._connectionState = "error";
379
+ this.notifyGlobalListeners();
380
+ });
381
+ adapter.on("synced", () => {
382
+ this._isLoaded = true;
383
+ this.notifyGlobalListeners();
384
+ });
385
+ adapter.attach(this);
386
+ this._cloudAdapter = adapter;
387
+ this._connectionState = "connecting";
388
+ adapter.connect();
389
+ } catch (error) {
390
+ console.error("MindCache: Failed to initialize cloud connection:", error);
391
+ this._connectionState = "error";
392
+ this._isLoaded = true;
393
+ }
394
+ }
395
+ /**
396
+ * Get the current cloud connection state
397
+ */
398
+ get connectionState() {
399
+ return this._connectionState;
400
+ }
401
+ /**
402
+ * Check if data is loaded (true for local, true after sync for cloud)
403
+ */
404
+ get isLoaded() {
405
+ return this._isLoaded;
406
+ }
407
+ /**
408
+ * Check if this instance is connected to cloud
409
+ */
410
+ get isCloud() {
411
+ return this._cloudConfig !== null;
412
+ }
413
+ /**
414
+ * Disconnect from cloud (if connected)
415
+ */
416
+ disconnect() {
417
+ if (this._cloudAdapter) {
418
+ this._cloudAdapter.disconnect();
419
+ this._cloudAdapter.detach();
420
+ this._cloudAdapter = null;
421
+ this._connectionState = "disconnected";
422
+ }
423
+ }
424
+ // Helper method to encode file to base64
425
+ encodeFileToBase64(file) {
426
+ return new Promise((resolve, reject) => {
427
+ if (typeof FileReader !== "undefined") {
428
+ const reader = new FileReader();
429
+ reader.onload = () => {
430
+ const result = reader.result;
431
+ const base64Data = result.split(",")[1];
432
+ resolve(base64Data);
433
+ };
434
+ reader.onerror = reject;
435
+ reader.readAsDataURL(file);
436
+ } else {
437
+ reject(new Error("FileReader not available in Node.js environment. Use set_base64() method instead."));
438
+ }
439
+ });
440
+ }
441
+ // Helper method to create data URL from base64 and content type
442
+ createDataUrl(base64Data, contentType) {
443
+ return `data:${contentType};base64,${base64Data}`;
444
+ }
445
+ // Helper method to validate content type for different STM types
446
+ validateContentType(type, contentType) {
447
+ if (type === "text" || type === "json") {
448
+ return true;
449
+ }
450
+ if (!contentType) {
451
+ return false;
452
+ }
453
+ if (type === "image") {
454
+ return contentType.startsWith("image/");
455
+ }
456
+ if (type === "file") {
457
+ return true;
458
+ }
459
+ return false;
460
+ }
461
+ /** @deprecated Use get_value instead */
462
+ get(key) {
463
+ return this.get_value(key);
464
+ }
465
+ // Get a value from the STM with template processing if enabled
466
+ get_value(key, _processingStack) {
467
+ if (key === "$date") {
468
+ const today = /* @__PURE__ */ new Date();
469
+ return today.toISOString().split("T")[0];
470
+ }
471
+ if (key === "$time") {
472
+ const now = /* @__PURE__ */ new Date();
473
+ return now.toTimeString().split(" ")[0];
474
+ }
475
+ const entry = this.stm[key];
476
+ if (!entry) {
477
+ return void 0;
478
+ }
479
+ if (entry.attributes.template) {
480
+ const processingStack = _processingStack || /* @__PURE__ */ new Set();
481
+ if (processingStack.has(key)) {
482
+ return entry.value;
483
+ }
484
+ processingStack.add(key);
485
+ const result = this.injectSTM(entry.value, processingStack);
486
+ processingStack.delete(key);
487
+ return result;
488
+ }
489
+ return entry.value;
490
+ }
491
+ // Get attributes for a key
492
+ get_attributes(key) {
493
+ if (key === "$date" || key === "$time") {
494
+ return {
495
+ readonly: true,
496
+ visible: true,
497
+ hardcoded: true,
498
+ template: false,
499
+ type: "text",
500
+ tags: []
501
+ };
502
+ }
503
+ const entry = this.stm[key];
504
+ return entry ? entry.attributes : void 0;
505
+ }
506
+ // Set a value in the STM with default attributes
507
+ set_value(key, value, attributes) {
508
+ if (key === "$date" || key === "$time") {
509
+ return;
510
+ }
511
+ const existingEntry = this.stm[key];
512
+ const baseAttributes = existingEntry ? existingEntry.attributes : { ...DEFAULT_KEY_ATTRIBUTES };
513
+ const finalAttributes = attributes ? { ...baseAttributes, ...attributes } : baseAttributes;
514
+ if (finalAttributes.hardcoded) {
515
+ finalAttributes.readonly = true;
516
+ finalAttributes.template = false;
517
+ }
518
+ this.stm[key] = {
519
+ value,
520
+ attributes: finalAttributes
521
+ };
522
+ if (this.listeners[key]) {
523
+ this.listeners[key].forEach((listener) => listener());
524
+ }
525
+ this.notifyGlobalListeners();
526
+ }
527
+ // Internal method for setting values from remote (cloud sync)
528
+ // This doesn't trigger the global listener to prevent sync loops
529
+ _setFromRemote(key, value, attributes) {
530
+ if (key === "$date" || key === "$time") {
531
+ return;
532
+ }
533
+ this._isRemoteUpdate = true;
534
+ this.stm[key] = {
535
+ value,
536
+ attributes
537
+ };
538
+ if (this.listeners[key]) {
539
+ this.listeners[key].forEach((listener) => listener());
540
+ }
541
+ this.notifyGlobalListeners();
542
+ this._isRemoteUpdate = false;
543
+ }
544
+ // Check if current update is from remote
545
+ isRemoteUpdate() {
546
+ return this._isRemoteUpdate;
547
+ }
548
+ // Internal method for deleting from remote (cloud sync)
549
+ _deleteFromRemote(key) {
550
+ if (key === "$date" || key === "$time") {
551
+ return;
552
+ }
553
+ this._isRemoteUpdate = true;
554
+ if (key in this.stm) {
555
+ delete this.stm[key];
556
+ if (this.listeners[key]) {
557
+ this.listeners[key].forEach((listener) => listener());
558
+ }
559
+ this.notifyGlobalListeners();
560
+ }
561
+ this._isRemoteUpdate = false;
562
+ }
563
+ // Internal method for clearing from remote (cloud sync)
564
+ _clearFromRemote() {
565
+ this._isRemoteUpdate = true;
566
+ this.stm = {};
567
+ this.notifyGlobalListeners();
568
+ this._isRemoteUpdate = false;
569
+ }
570
+ // Set attributes for an existing key
571
+ set_attributes(key, attributes) {
572
+ if (key === "$date" || key === "$time") {
573
+ return false;
574
+ }
575
+ const entry = this.stm[key];
576
+ if (!entry) {
577
+ return false;
578
+ }
579
+ const { hardcoded: _hardcoded, ...allowedAttributes } = attributes;
580
+ entry.attributes = { ...entry.attributes, ...allowedAttributes };
581
+ if (entry.attributes.hardcoded) {
582
+ entry.attributes.readonly = true;
583
+ entry.attributes.template = false;
584
+ }
585
+ this.notifyGlobalListeners();
586
+ return true;
587
+ }
588
+ set(key, value) {
589
+ this.set_value(key, value);
590
+ }
591
+ async set_file(key, file, attributes) {
592
+ const base64Data = await this.encodeFileToBase64(file);
593
+ const contentType = file.type;
594
+ const fileAttributes = {
595
+ type: contentType.startsWith("image/") ? "image" : "file",
596
+ contentType,
597
+ ...attributes
598
+ };
599
+ this.set_value(key, base64Data, fileAttributes);
600
+ }
601
+ set_base64(key, base64Data, contentType, type = "file", attributes) {
602
+ if (!this.validateContentType(type, contentType)) {
603
+ throw new Error(`Invalid content type ${contentType} for type ${type}`);
604
+ }
605
+ const fileAttributes = {
606
+ type,
607
+ contentType,
608
+ ...attributes
609
+ };
610
+ this.set_value(key, base64Data, fileAttributes);
611
+ }
612
+ add_image(key, base64Data, contentType = "image/jpeg", attributes) {
613
+ if (!contentType.startsWith("image/")) {
614
+ throw new Error(`Invalid image content type: ${contentType}. Must start with 'image/'`);
615
+ }
616
+ this.set_base64(key, base64Data, contentType, "image", attributes);
617
+ this.set_attributes(key, {
618
+ type: "image",
619
+ contentType
620
+ });
621
+ }
622
+ get_data_url(key) {
623
+ const entry = this.stm[key];
624
+ if (!entry || entry.attributes.type !== "image" && entry.attributes.type !== "file") {
625
+ return void 0;
626
+ }
627
+ if (!entry.attributes.contentType) {
628
+ return void 0;
629
+ }
630
+ return this.createDataUrl(entry.value, entry.attributes.contentType);
631
+ }
632
+ get_base64(key) {
633
+ const entry = this.stm[key];
634
+ if (!entry || entry.attributes.type !== "image" && entry.attributes.type !== "file") {
635
+ return void 0;
636
+ }
637
+ return entry.value;
638
+ }
639
+ has(key) {
640
+ if (key === "$date" || key === "$time") {
641
+ return true;
642
+ }
643
+ return key in this.stm;
644
+ }
645
+ delete(key) {
646
+ if (key === "$date" || key === "$time") {
647
+ return false;
648
+ }
649
+ if (!(key in this.stm)) {
650
+ return false;
651
+ }
652
+ const deleted = delete this.stm[key];
653
+ if (deleted) {
654
+ this.notifyGlobalListeners();
655
+ if (this.listeners[key]) {
656
+ this.listeners[key].forEach((listener) => listener());
657
+ }
658
+ }
659
+ return deleted;
660
+ }
661
+ clear() {
662
+ this.stm = {};
663
+ this.notifyGlobalListeners();
664
+ }
665
+ keys() {
666
+ return [...Object.keys(this.stm), "$date", "$time"];
667
+ }
668
+ values() {
669
+ const now = /* @__PURE__ */ new Date();
670
+ const stmValues = Object.values(this.stm).map((entry) => entry.value);
671
+ return [
672
+ ...stmValues,
673
+ now.toISOString().split("T")[0],
674
+ now.toTimeString().split(" ")[0]
675
+ ];
676
+ }
677
+ entries() {
678
+ const now = /* @__PURE__ */ new Date();
679
+ const stmEntries = Object.entries(this.stm).map(
680
+ ([key, entry]) => [key, entry.value]
681
+ );
682
+ return [
683
+ ...stmEntries,
684
+ ["$date", now.toISOString().split("T")[0]],
685
+ ["$time", now.toTimeString().split(" ")[0]]
686
+ ];
687
+ }
688
+ size() {
689
+ return Object.keys(this.stm).length + 2;
690
+ }
691
+ getAll() {
692
+ const now = /* @__PURE__ */ new Date();
693
+ const result = {};
694
+ Object.entries(this.stm).forEach(([key, entry]) => {
695
+ result[key] = entry.value;
696
+ });
697
+ result["$date"] = now.toISOString().split("T")[0];
698
+ result["$time"] = now.toTimeString().split(" ")[0];
699
+ return result;
700
+ }
701
+ update(newValues) {
702
+ Object.entries(newValues).forEach(([key, value]) => {
703
+ if (key !== "$date" && key !== "$time") {
704
+ this.stm[key] = {
705
+ value,
706
+ attributes: { ...DEFAULT_KEY_ATTRIBUTES }
707
+ };
708
+ if (this.listeners[key]) {
709
+ this.listeners[key].forEach((listener) => listener());
710
+ }
711
+ }
712
+ });
713
+ this.notifyGlobalListeners();
714
+ }
715
+ subscribe(key, listener) {
716
+ if (!this.listeners[key]) {
717
+ this.listeners[key] = [];
718
+ }
719
+ this.listeners[key].push(listener);
720
+ }
721
+ unsubscribe(key, listener) {
722
+ if (this.listeners[key]) {
723
+ this.listeners[key] = this.listeners[key].filter((l) => l !== listener);
724
+ }
725
+ }
726
+ subscribeToAll(listener) {
727
+ this.globalListeners.push(listener);
728
+ }
729
+ unsubscribeFromAll(listener) {
730
+ this.globalListeners = this.globalListeners.filter((l) => l !== listener);
731
+ }
732
+ notifyGlobalListeners() {
733
+ this.globalListeners.forEach((listener) => listener());
734
+ }
735
+ injectSTM(template, _processingStack) {
736
+ if (template === null || template === void 0) {
737
+ return String(template);
738
+ }
739
+ const templateStr = String(template);
740
+ const keys = templateStr.match(/\{\{([$\w]+)\}\}/g);
741
+ if (!keys) {
742
+ return templateStr;
743
+ }
744
+ const cleanKeys = keys.map((key) => key.replace(/[{}]/g, ""));
745
+ const inputValues = cleanKeys.reduce((acc, key) => {
746
+ if (key === "$date" || key === "$time") {
747
+ return {
748
+ ...acc,
749
+ [key]: this.get_value(key, _processingStack)
750
+ };
751
+ }
752
+ const attributes = this.get_attributes(key);
753
+ if (_processingStack || attributes && attributes.visible) {
754
+ if (attributes && (attributes.type === "image" || attributes.type === "file")) {
755
+ return acc;
756
+ }
757
+ return {
758
+ ...acc,
759
+ [key]: this.get_value(key, _processingStack)
760
+ };
761
+ }
762
+ return acc;
763
+ }, {});
764
+ return templateStr.replace(/\{\{([$\w]+)\}\}/g, (match, key) => {
765
+ if (inputValues[key] !== void 0) {
766
+ return inputValues[key];
767
+ }
768
+ const attributes = this.get_attributes(key);
769
+ if (attributes && (attributes.type === "image" || attributes.type === "file")) {
770
+ return match;
771
+ }
772
+ return "";
773
+ });
774
+ }
775
+ getSTM() {
776
+ const now = /* @__PURE__ */ new Date();
777
+ const entries = [];
778
+ Object.entries(this.stm).forEach(([key, entry]) => {
779
+ if (entry.attributes.visible) {
780
+ entries.push([key, this.get_value(key)]);
781
+ }
782
+ });
783
+ entries.push(["$date", now.toISOString().split("T")[0]]);
784
+ entries.push(["$time", now.toTimeString().split(" ")[0]]);
785
+ return entries.map(([key, value]) => `${key}: ${value}`).join(", ");
786
+ }
787
+ getSTMObject() {
788
+ return this.getAll();
789
+ }
790
+ getSTMForAPI() {
791
+ const now = /* @__PURE__ */ new Date();
792
+ const apiData = [];
793
+ Object.entries(this.stm).forEach(([key, entry]) => {
794
+ if (entry.attributes.visible) {
795
+ const processedValue = entry.attributes.template ? this.get_value(key) : entry.value;
796
+ apiData.push({
797
+ key,
798
+ value: processedValue,
799
+ type: entry.attributes.type,
800
+ contentType: entry.attributes.contentType
801
+ });
802
+ }
803
+ });
804
+ apiData.push({
805
+ key: "$date",
806
+ value: now.toISOString().split("T")[0],
807
+ type: "text"
808
+ });
809
+ apiData.push({
810
+ key: "$time",
811
+ value: now.toTimeString().split(" ")[0],
812
+ type: "text"
813
+ });
814
+ return apiData;
815
+ }
816
+ getVisibleImages() {
817
+ const imageParts = [];
818
+ Object.entries(this.stm).forEach(([key, entry]) => {
819
+ if (entry.attributes.visible && entry.attributes.type === "image" && entry.attributes.contentType) {
820
+ const dataUrl = this.createDataUrl(entry.value, entry.attributes.contentType);
821
+ imageParts.push({
822
+ type: "file",
823
+ mediaType: entry.attributes.contentType,
824
+ url: dataUrl,
825
+ filename: key
826
+ });
827
+ }
828
+ });
829
+ return imageParts;
830
+ }
831
+ toJSON() {
832
+ return JSON.stringify(this.serialize());
833
+ }
834
+ fromJSON(jsonString) {
835
+ try {
836
+ const data = JSON.parse(jsonString);
837
+ this.deserialize(data);
838
+ } catch (error) {
839
+ console.error("MindCache: Failed to deserialize JSON:", error);
840
+ }
841
+ }
842
+ serialize() {
843
+ const result = {};
844
+ Object.entries(this.stm).forEach(([key, entry]) => {
845
+ if (!entry.attributes.hardcoded) {
846
+ result[key] = {
847
+ value: entry.value,
848
+ attributes: { ...entry.attributes }
849
+ };
850
+ }
851
+ });
852
+ return result;
853
+ }
854
+ deserialize(data) {
855
+ if (typeof data === "object" && data !== null) {
856
+ this.clear();
857
+ Object.entries(data).forEach(([key, entry]) => {
858
+ if (entry && typeof entry === "object" && "value" in entry && "attributes" in entry) {
859
+ this.stm[key] = {
860
+ value: entry.value,
861
+ attributes: {
862
+ ...entry.attributes,
863
+ tags: entry.attributes.tags || []
864
+ }
865
+ };
866
+ }
867
+ });
868
+ this.notifyGlobalListeners();
869
+ }
870
+ }
871
+ get_system_prompt() {
872
+ const now = /* @__PURE__ */ new Date();
873
+ const promptLines = [];
874
+ Object.entries(this.stm).forEach(([key, entry]) => {
875
+ if (entry.attributes.visible) {
876
+ if (entry.attributes.type === "image") {
877
+ promptLines.push(`image ${key} available`);
878
+ return;
879
+ }
880
+ if (entry.attributes.type === "file") {
881
+ if (entry.attributes.readonly) {
882
+ promptLines.push(`${key}: [${entry.attributes.type.toUpperCase()}] - ${entry.attributes.contentType || "unknown format"}`);
883
+ } else {
884
+ const sanitizedKey = key.replace(/[^a-zA-Z0-9_-]/g, "_");
885
+ promptLines.push(`${key}: [${entry.attributes.type.toUpperCase()}] - ${entry.attributes.contentType || "unknown format"}. You can update this ${entry.attributes.type} using the write_${sanitizedKey} tool.`);
886
+ }
887
+ return;
888
+ }
889
+ const value = this.get_value(key);
890
+ const formattedValue = typeof value === "object" && value !== null ? JSON.stringify(value) : String(value);
891
+ if (entry.attributes.readonly) {
892
+ promptLines.push(`${key}: ${formattedValue}`);
893
+ } else {
894
+ const sanitizedKey = key.replace(/[^a-zA-Z0-9_-]/g, "_");
895
+ const toolInstruction = `You can rewrite "${key}" by using the write_${sanitizedKey} tool. This tool DOES NOT append \u2014 start your response with the old value (${formattedValue})`;
896
+ promptLines.push(`${key}: ${formattedValue}. ${toolInstruction}`);
897
+ }
898
+ }
899
+ });
900
+ promptLines.push(`$date: ${now.toISOString().split("T")[0]}`);
901
+ promptLines.push(`$time: ${now.toTimeString().split(" ")[0]}`);
902
+ return promptLines.join("\n");
903
+ }
904
+ findKeyFromToolName(toolName) {
905
+ if (!toolName.startsWith("write_")) {
906
+ return void 0;
907
+ }
908
+ const sanitizedKey = toolName.replace("write_", "");
909
+ const allKeys = Object.keys(this.stm);
910
+ return allKeys.find(
911
+ (k) => k.replace(/[^a-zA-Z0-9_-]/g, "_") === sanitizedKey
912
+ );
913
+ }
914
+ get_aisdk_tools() {
915
+ const tools = {};
916
+ const writableKeys = Object.entries(this.stm).filter(([, entry]) => !entry.attributes.readonly).map(([key]) => key);
917
+ writableKeys.forEach((key) => {
918
+ const sanitizedKey = key.replace(/[^a-zA-Z0-9_-]/g, "_");
919
+ const toolName = `write_${sanitizedKey}`;
920
+ const entry = this.stm[key];
921
+ const keyType = entry?.attributes.type || "text";
922
+ let inputSchema;
923
+ let description = `Write a value to the STM key: ${key}`;
924
+ if (keyType === "image" || keyType === "file") {
925
+ description += " (expects base64 encoded data)";
926
+ inputSchema = zod.z.object({
927
+ value: zod.z.string().describe(`Base64 encoded data for ${key}`),
928
+ contentType: zod.z.string().optional().describe(`MIME type for the ${keyType}`)
929
+ });
930
+ } else if (keyType === "json") {
931
+ description += " (expects JSON string)";
932
+ inputSchema = zod.z.object({
933
+ value: zod.z.string().describe(`JSON string value for ${key}`)
934
+ });
935
+ } else {
936
+ inputSchema = zod.z.object({
937
+ value: zod.z.string().describe(`The text value to write to ${key}`)
938
+ });
939
+ }
940
+ tools[toolName] = {
941
+ description,
942
+ inputSchema,
943
+ execute: async (input) => {
944
+ if (keyType === "image" || keyType === "file") {
945
+ if (input.contentType) {
946
+ this.set_base64(key, input.value, input.contentType, keyType);
947
+ } else {
948
+ const existingContentType = entry?.attributes.contentType;
949
+ if (existingContentType) {
950
+ this.set_base64(key, input.value, existingContentType, keyType);
951
+ } else {
952
+ throw new Error(`Content type required for ${keyType} data`);
953
+ }
954
+ }
955
+ } else {
956
+ this.set_value(key, input.value);
957
+ }
958
+ let resultMessage;
959
+ if (keyType === "image") {
960
+ resultMessage = `Successfully saved image to ${key}`;
961
+ } else if (keyType === "file") {
962
+ resultMessage = `Successfully saved file to ${key}`;
963
+ } else if (keyType === "json") {
964
+ resultMessage = `Successfully saved JSON data to ${key}`;
965
+ } else {
966
+ resultMessage = `Successfully wrote "${input.value}" to ${key}`;
967
+ }
968
+ return {
969
+ result: resultMessage,
970
+ key,
971
+ value: input.value,
972
+ type: keyType,
973
+ contentType: input.contentType,
974
+ sanitizedKey
975
+ };
976
+ }
977
+ };
978
+ });
979
+ if (writableKeys.length === 0) {
980
+ return {};
981
+ }
982
+ return tools;
983
+ }
984
+ executeToolCall(toolName, value) {
985
+ const originalKey = this.findKeyFromToolName(toolName);
986
+ if (!originalKey) {
987
+ return null;
988
+ }
989
+ const entry = this.stm[originalKey];
990
+ if (entry && entry.attributes.readonly) {
991
+ return null;
992
+ }
993
+ this.set_value(originalKey, value);
994
+ return {
995
+ result: `Successfully wrote "${value}" to ${originalKey}`,
996
+ key: originalKey,
997
+ value
998
+ };
999
+ }
1000
+ addTag(key, tag) {
1001
+ if (key === "$date" || key === "$time") {
1002
+ return false;
1003
+ }
1004
+ const entry = this.stm[key];
1005
+ if (!entry) {
1006
+ return false;
1007
+ }
1008
+ if (!entry.attributes.tags) {
1009
+ entry.attributes.tags = [];
1010
+ }
1011
+ if (!entry.attributes.tags.includes(tag)) {
1012
+ entry.attributes.tags.push(tag);
1013
+ this.notifyGlobalListeners();
1014
+ return true;
1015
+ }
1016
+ return false;
1017
+ }
1018
+ removeTag(key, tag) {
1019
+ if (key === "$date" || key === "$time") {
1020
+ return false;
1021
+ }
1022
+ const entry = this.stm[key];
1023
+ if (!entry || !entry.attributes.tags) {
1024
+ return false;
1025
+ }
1026
+ const tagIndex = entry.attributes.tags.indexOf(tag);
1027
+ if (tagIndex > -1) {
1028
+ entry.attributes.tags.splice(tagIndex, 1);
1029
+ this.notifyGlobalListeners();
1030
+ return true;
1031
+ }
1032
+ return false;
1033
+ }
1034
+ getTags(key) {
1035
+ if (key === "$date" || key === "$time") {
1036
+ return [];
1037
+ }
1038
+ const entry = this.stm[key];
1039
+ return entry?.attributes.tags || [];
1040
+ }
1041
+ getAllTags() {
1042
+ const allTags = /* @__PURE__ */ new Set();
1043
+ Object.values(this.stm).forEach((entry) => {
1044
+ if (entry.attributes.tags) {
1045
+ entry.attributes.tags.forEach((tag) => allTags.add(tag));
1046
+ }
1047
+ });
1048
+ return Array.from(allTags);
1049
+ }
1050
+ hasTag(key, tag) {
1051
+ if (key === "$date" || key === "$time") {
1052
+ return false;
1053
+ }
1054
+ const entry = this.stm[key];
1055
+ return entry?.attributes.tags?.includes(tag) || false;
1056
+ }
1057
+ getTagged(tag) {
1058
+ const entries = [];
1059
+ Object.entries(this.stm).forEach(([key, entry]) => {
1060
+ if (entry.attributes.tags?.includes(tag)) {
1061
+ entries.push([key, this.get_value(key)]);
1062
+ }
1063
+ });
1064
+ return entries.map(([key, value]) => `${key}: ${value}`).join(", ");
1065
+ }
1066
+ toMarkdown() {
1067
+ const now = /* @__PURE__ */ new Date();
1068
+ const lines = [];
1069
+ const appendixEntries = [];
1070
+ let appendixCounter = 0;
1071
+ lines.push("# MindCache STM Export");
1072
+ lines.push("");
1073
+ lines.push(`Export Date: ${now.toISOString().split("T")[0]}`);
1074
+ lines.push("");
1075
+ lines.push("---");
1076
+ lines.push("");
1077
+ lines.push("## STM Entries");
1078
+ lines.push("");
1079
+ Object.entries(this.stm).forEach(([key, entry]) => {
1080
+ if (entry.attributes.hardcoded) {
1081
+ return;
1082
+ }
1083
+ lines.push(`### ${key}`);
1084
+ const entryType = entry.attributes.type && entry.attributes.type !== "undefined" ? entry.attributes.type : "text";
1085
+ lines.push(`- **Type**: \`${entryType}\``);
1086
+ lines.push(`- **Readonly**: \`${entry.attributes.readonly}\``);
1087
+ lines.push(`- **Visible**: \`${entry.attributes.visible}\``);
1088
+ lines.push(`- **Template**: \`${entry.attributes.template}\``);
1089
+ if (entry.attributes.tags && entry.attributes.tags.length > 0) {
1090
+ lines.push(`- **Tags**: \`${entry.attributes.tags.join("`, `")}\``);
1091
+ }
1092
+ if (entry.attributes.contentType) {
1093
+ lines.push(`- **Content Type**: \`${entry.attributes.contentType}\``);
1094
+ }
1095
+ if (entryType === "image" || entryType === "file") {
1096
+ const label = String.fromCharCode(65 + appendixCounter);
1097
+ appendixCounter++;
1098
+ lines.push(`- **Value**: [See Appendix ${label}]`);
1099
+ appendixEntries.push({
1100
+ key,
1101
+ type: entryType,
1102
+ contentType: entry.attributes.contentType || "application/octet-stream",
1103
+ base64: entry.value,
1104
+ label
1105
+ });
1106
+ } else if (entryType === "json") {
1107
+ lines.push("- **Value**:");
1108
+ lines.push("```json");
1109
+ try {
1110
+ const jsonValue = typeof entry.value === "string" ? entry.value : JSON.stringify(entry.value, null, 2);
1111
+ lines.push(jsonValue);
1112
+ } catch {
1113
+ lines.push(String(entry.value));
1114
+ }
1115
+ lines.push("```");
1116
+ } else {
1117
+ const valueStr = String(entry.value);
1118
+ lines.push("- **Value**:");
1119
+ lines.push("```");
1120
+ lines.push(valueStr);
1121
+ lines.push("```");
1122
+ }
1123
+ lines.push("");
1124
+ lines.push("---");
1125
+ lines.push("");
1126
+ });
1127
+ if (appendixEntries.length > 0) {
1128
+ lines.push("## Appendix: Binary Data");
1129
+ lines.push("");
1130
+ appendixEntries.forEach(({ key, contentType, base64, label }) => {
1131
+ lines.push(`### Appendix ${label}: ${key}`);
1132
+ lines.push(`**Type**: ${contentType}`);
1133
+ lines.push("");
1134
+ lines.push("```");
1135
+ lines.push(base64);
1136
+ lines.push("```");
1137
+ lines.push("");
1138
+ lines.push("---");
1139
+ lines.push("");
1140
+ });
1141
+ }
1142
+ lines.push("*End of MindCache Export*");
1143
+ return lines.join("\n");
1144
+ }
1145
+ fromMarkdown(markdown) {
1146
+ const lines = markdown.split("\n");
1147
+ let currentSection = "header";
1148
+ let currentKey = null;
1149
+ let currentEntry = null;
1150
+ let inCodeBlock = false;
1151
+ let codeBlockContent = [];
1152
+ let codeBlockType = null;
1153
+ const appendixData = {};
1154
+ let currentAppendixKey = null;
1155
+ const pendingEntries = {};
1156
+ this.clear();
1157
+ for (let i = 0; i < lines.length; i++) {
1158
+ const line = lines[i];
1159
+ const trimmed = line.trim();
1160
+ if (trimmed === "## STM Entries") {
1161
+ currentSection = "entries";
1162
+ continue;
1163
+ }
1164
+ if (trimmed === "## Appendix: Binary Data") {
1165
+ currentSection = "appendix";
1166
+ continue;
1167
+ }
1168
+ if (trimmed === "```" || trimmed === "```json") {
1169
+ if (!inCodeBlock) {
1170
+ inCodeBlock = true;
1171
+ codeBlockContent = [];
1172
+ codeBlockType = currentSection === "appendix" ? "base64" : trimmed === "```json" ? "json" : "value";
1173
+ } else {
1174
+ inCodeBlock = false;
1175
+ const content = codeBlockContent.join("\n");
1176
+ if (currentSection === "appendix" && currentAppendixKey) {
1177
+ appendixData[currentAppendixKey].base64 = content;
1178
+ } else if (currentEntry && codeBlockType === "json") {
1179
+ currentEntry.value = content;
1180
+ } else if (currentEntry && codeBlockType === "value") {
1181
+ currentEntry.value = content;
1182
+ }
1183
+ codeBlockContent = [];
1184
+ codeBlockType = null;
1185
+ }
1186
+ continue;
1187
+ }
1188
+ if (inCodeBlock) {
1189
+ codeBlockContent.push(line);
1190
+ continue;
1191
+ }
1192
+ if (currentSection === "entries") {
1193
+ if (trimmed.startsWith("### ")) {
1194
+ if (currentKey && currentEntry && currentEntry.attributes) {
1195
+ pendingEntries[currentKey] = currentEntry;
1196
+ }
1197
+ currentKey = trimmed.substring(4);
1198
+ currentEntry = {
1199
+ value: void 0,
1200
+ attributes: {
1201
+ readonly: false,
1202
+ visible: true,
1203
+ hardcoded: false,
1204
+ template: false,
1205
+ type: "text",
1206
+ tags: []
1207
+ }
1208
+ };
1209
+ } else if (trimmed.startsWith("- **Type**: `")) {
1210
+ const type = trimmed.match(/`([^`]+)`/)?.[1];
1211
+ if (currentEntry && type && type !== "undefined") {
1212
+ currentEntry.attributes.type = type;
1213
+ }
1214
+ } else if (trimmed.startsWith("- **Readonly**: `")) {
1215
+ const value = trimmed.match(/`([^`]+)`/)?.[1] === "true";
1216
+ if (currentEntry) {
1217
+ currentEntry.attributes.readonly = value;
1218
+ }
1219
+ } else if (trimmed.startsWith("- **Visible**: `")) {
1220
+ const value = trimmed.match(/`([^`]+)`/)?.[1] === "true";
1221
+ if (currentEntry) {
1222
+ currentEntry.attributes.visible = value;
1223
+ }
1224
+ } else if (trimmed.startsWith("- **Template**: `")) {
1225
+ const value = trimmed.match(/`([^`]+)`/)?.[1] === "true";
1226
+ if (currentEntry) {
1227
+ currentEntry.attributes.template = value;
1228
+ }
1229
+ } else if (trimmed.startsWith("- **Tags**: `")) {
1230
+ const tagsStr = trimmed.substring(13, trimmed.length - 1);
1231
+ if (currentEntry) {
1232
+ currentEntry.attributes.tags = tagsStr.split("`, `");
1233
+ }
1234
+ } else if (trimmed.startsWith("- **Content Type**: `")) {
1235
+ const contentType = trimmed.match(/`([^`]+)`/)?.[1];
1236
+ if (currentEntry && contentType) {
1237
+ currentEntry.attributes.contentType = contentType;
1238
+ }
1239
+ } else if (trimmed.startsWith("- **Value**: `")) {
1240
+ const value = trimmed.substring(14, trimmed.length - 1);
1241
+ if (currentEntry) {
1242
+ currentEntry.value = value;
1243
+ }
1244
+ } else if (trimmed.startsWith("- **Value**: [See Appendix ")) {
1245
+ const labelMatch = trimmed.match(/Appendix ([A-Z])\]/);
1246
+ if (currentEntry && labelMatch && currentKey) {
1247
+ currentEntry.appendixLabel = labelMatch[1];
1248
+ currentEntry.value = "";
1249
+ }
1250
+ }
1251
+ }
1252
+ if (currentSection === "appendix") {
1253
+ if (trimmed.startsWith("### Appendix ")) {
1254
+ const match = trimmed.match(/### Appendix ([A-Z]): (.+)/);
1255
+ if (match) {
1256
+ const label = match[1];
1257
+ const key = match[2];
1258
+ currentAppendixKey = `${label}:${key}`;
1259
+ appendixData[currentAppendixKey] = { contentType: "", base64: "" };
1260
+ }
1261
+ } else if (trimmed.startsWith("**Type**: ")) {
1262
+ const contentType = trimmed.substring(10);
1263
+ if (currentAppendixKey) {
1264
+ appendixData[currentAppendixKey].contentType = contentType;
1265
+ }
1266
+ }
1267
+ }
1268
+ }
1269
+ if (currentKey && currentEntry && currentEntry.attributes) {
1270
+ pendingEntries[currentKey] = currentEntry;
1271
+ }
1272
+ Object.entries(pendingEntries).forEach(([key, entry]) => {
1273
+ const appendixLabel = entry.appendixLabel;
1274
+ if (appendixLabel) {
1275
+ const appendixKey = `${appendixLabel}:${key}`;
1276
+ const appendixInfo = appendixData[appendixKey];
1277
+ if (appendixInfo && appendixInfo.base64) {
1278
+ entry.value = appendixInfo.base64;
1279
+ if (!entry.attributes.contentType && appendixInfo.contentType) {
1280
+ entry.attributes.contentType = appendixInfo.contentType;
1281
+ }
1282
+ }
1283
+ }
1284
+ if (entry.value !== void 0 && entry.attributes) {
1285
+ this.stm[key] = {
1286
+ value: entry.value,
1287
+ attributes: entry.attributes
1288
+ };
1289
+ }
1290
+ });
1291
+ this.notifyGlobalListeners();
1292
+ }
1293
+ };
1294
+ new MindCache();
1295
+
1296
+ // src/cloud/index.ts
1297
+ init_CloudAdapter();
1298
+ init_CloudAdapter();
1299
+ function connectCloud(mc, config) {
1300
+ const adapter = new exports.CloudAdapter(config);
1301
+ adapter.attach(mc);
1302
+ adapter.connect();
1303
+ return adapter;
1304
+ }
1305
+ function createCloudMindCache(config) {
1306
+ const mc = new MindCache();
1307
+ const adapter = connectCloud(mc, config);
1308
+ return Object.assign(mc, { adapter });
1309
+ }
1310
+
1311
+ exports.connectCloud = connectCloud;
1312
+ exports.createCloudMindCache = createCloudMindCache;
1313
+ //# sourceMappingURL=index.js.map
1314
+ //# sourceMappingURL=index.js.map