modality-kit 0.10.0 → 0.10.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.
package/dist/index.js
CHANGED
|
@@ -5886,6 +5886,41 @@ class WebSocketClient {
|
|
|
5886
5886
|
}
|
|
5887
5887
|
}
|
|
5888
5888
|
}
|
|
5889
|
+
// src/lruCache.ts
|
|
5890
|
+
class LruCache {
|
|
5891
|
+
values = new Map;
|
|
5892
|
+
max;
|
|
5893
|
+
constructor(max = 100) {
|
|
5894
|
+
this.max = max;
|
|
5895
|
+
}
|
|
5896
|
+
has(key) {
|
|
5897
|
+
return this.values.has(key);
|
|
5898
|
+
}
|
|
5899
|
+
get(key) {
|
|
5900
|
+
const value = this.values.get(key);
|
|
5901
|
+
if (value) {
|
|
5902
|
+
this.values.delete(key);
|
|
5903
|
+
this.values.set(key, value);
|
|
5904
|
+
}
|
|
5905
|
+
return value;
|
|
5906
|
+
}
|
|
5907
|
+
set(key, value) {
|
|
5908
|
+
if (this.values.size >= this.max) {
|
|
5909
|
+
const itemsToEvictCount = Math.max(1, Math.floor(this.max * 0.25));
|
|
5910
|
+
const keys = this.values.keys();
|
|
5911
|
+
let count = 0;
|
|
5912
|
+
while (count < itemsToEvictCount) {
|
|
5913
|
+
const next = keys.next();
|
|
5914
|
+
if (next.done) {
|
|
5915
|
+
break;
|
|
5916
|
+
}
|
|
5917
|
+
this.values.delete(next.value);
|
|
5918
|
+
count++;
|
|
5919
|
+
}
|
|
5920
|
+
}
|
|
5921
|
+
this.values.set(key, value);
|
|
5922
|
+
}
|
|
5923
|
+
}
|
|
5889
5924
|
export {
|
|
5890
5925
|
withErrorHandling,
|
|
5891
5926
|
setupAITools,
|
|
@@ -5898,6 +5933,7 @@ export {
|
|
|
5898
5933
|
compressWithLanguageDetection as compressText,
|
|
5899
5934
|
WebSocketClient,
|
|
5900
5935
|
exports_schemas_symbol as SymbolTypes,
|
|
5936
|
+
LruCache,
|
|
5901
5937
|
JSONRPCUtils,
|
|
5902
5938
|
JSONRPCManager,
|
|
5903
5939
|
JSONRPCErrorCode,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -15,3 +15,4 @@ export type { JSONRPCMessage, JSONRPCRequest, JSONRPCNotification, JSONRPCRespon
|
|
|
15
15
|
export { JSONRPCManager } from "./jsonrpc-manager";
|
|
16
16
|
export type { JSONRPCManagerEvents, JSONRPCManagerConfig, } from "./jsonrpc-manager";
|
|
17
17
|
export { WebSocketClient } from "./websocket-client";
|
|
18
|
+
export { LruCache } from "./lruCache";
|
package/package.json
CHANGED