@tangle-network/agent-app 0.60.270 → 0.60.271
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/chat-routes/index.js +2 -1
- package/dist/chat-routes/index.js.map +1 -1
- package/dist/{chunk-UJKWM4UY.js → chunk-DJIN3YUJ.js} +1 -59
- package/dist/chunk-DJIN3YUJ.js.map +1 -0
- package/dist/chunk-F4TUZYMX.js +63 -0
- package/dist/chunk-F4TUZYMX.js.map +1 -0
- package/dist/platform/billable-turn-admission.d.ts +83 -0
- package/dist/platform/index.d.ts +1 -0
- package/dist/platform/index.js +49 -0
- package/dist/platform/index.js.map +1 -1
- package/dist/public-consultation/index.d.ts +2 -2
- package/dist/sandbox/index.js +4 -2
- package/package.json +1 -1
- package/dist/chunk-UJKWM4UY.js.map +0 -1
|
@@ -222,63 +222,6 @@ function workersReuseStore() {
|
|
|
222
222
|
return createCacheReuseStore(() => storage.open(CACHE_NAME));
|
|
223
223
|
}
|
|
224
224
|
|
|
225
|
-
// src/sandbox/warm-cache.ts
|
|
226
|
-
var MAX_ENTRIES = 500;
|
|
227
|
-
function coloCache() {
|
|
228
|
-
return typeof caches === "undefined" ? void 0 : caches.default;
|
|
229
|
-
}
|
|
230
|
-
function createWarmCache(namespace, options = {}) {
|
|
231
|
-
const useIsolate = options.isolate ?? true;
|
|
232
|
-
const env = options.env;
|
|
233
|
-
const entries = /* @__PURE__ */ new Map();
|
|
234
|
-
const coloKey = (key) => {
|
|
235
|
-
const scope = (typeof env === "function" ? env() : env) ?? "production";
|
|
236
|
-
return new Request(`https://${namespace}/${encodeURIComponent(scope)}/${encodeURIComponent(key)}`);
|
|
237
|
-
};
|
|
238
|
-
const remember = (key, value, expiresAt) => {
|
|
239
|
-
entries.delete(key);
|
|
240
|
-
if (!useIsolate) return;
|
|
241
|
-
const now = Date.now();
|
|
242
|
-
for (const [k, entry] of entries) if (entry.expiresAt <= now) entries.delete(k);
|
|
243
|
-
if (entries.size >= MAX_ENTRIES) {
|
|
244
|
-
const oldest = entries.keys().next().value;
|
|
245
|
-
if (oldest !== void 0) entries.delete(oldest);
|
|
246
|
-
}
|
|
247
|
-
entries.set(key, { value, expiresAt });
|
|
248
|
-
};
|
|
249
|
-
return {
|
|
250
|
-
async read(key) {
|
|
251
|
-
const local = entries.get(key);
|
|
252
|
-
if (local && local.expiresAt > Date.now()) return { value: local.value, source: "isolate" };
|
|
253
|
-
const hit = await coloCache()?.match(coloKey(key)).catch(() => void 0);
|
|
254
|
-
if (!hit) return null;
|
|
255
|
-
const expiresAt = Number(hit.headers.get("x-expires-at"));
|
|
256
|
-
if (!(expiresAt > Date.now())) return null;
|
|
257
|
-
const value = await hit.json().catch(() => void 0);
|
|
258
|
-
if (typeof value !== "object" || value === null || !("v" in value)) return null;
|
|
259
|
-
const stored = value.v;
|
|
260
|
-
remember(key, stored, expiresAt);
|
|
261
|
-
return { value: stored, source: "colo" };
|
|
262
|
-
},
|
|
263
|
-
async write(key, value, ttlMs) {
|
|
264
|
-
const expiresAt = Date.now() + ttlMs;
|
|
265
|
-
remember(key, value, expiresAt);
|
|
266
|
-
await coloCache()?.put(coloKey(key), new Response(JSON.stringify({ v: value }), { headers: {
|
|
267
|
-
"cache-control": `max-age=${Math.max(1, Math.ceil(ttlMs / 1e3))}`,
|
|
268
|
-
"x-expires-at": String(expiresAt)
|
|
269
|
-
} })).catch(() => {
|
|
270
|
-
});
|
|
271
|
-
},
|
|
272
|
-
async forget(key) {
|
|
273
|
-
entries.delete(key);
|
|
274
|
-
await coloCache()?.delete(coloKey(key)).catch(() => false);
|
|
275
|
-
},
|
|
276
|
-
clearIsolate() {
|
|
277
|
-
entries.clear();
|
|
278
|
-
}
|
|
279
|
-
};
|
|
280
|
-
}
|
|
281
|
-
|
|
282
225
|
// src/sandbox/model.ts
|
|
283
226
|
function backendModelFields(model) {
|
|
284
227
|
return {
|
|
@@ -3618,7 +3561,6 @@ async function mintSandboxScopedToken(box, options) {
|
|
|
3618
3561
|
export {
|
|
3619
3562
|
traceSandboxPromptEvents,
|
|
3620
3563
|
createCacheReuseStore,
|
|
3621
|
-
createWarmCache,
|
|
3622
3564
|
backendModelFields,
|
|
3623
3565
|
resolveModelSelection,
|
|
3624
3566
|
resolveModel,
|
|
@@ -3720,4 +3662,4 @@ export {
|
|
|
3720
3662
|
deleteSecret,
|
|
3721
3663
|
mintSandboxScopedToken
|
|
3722
3664
|
};
|
|
3723
|
-
//# sourceMappingURL=chunk-
|
|
3665
|
+
//# sourceMappingURL=chunk-DJIN3YUJ.js.map
|