@kenkaiiii/gg-core 5.97.0 → 5.97.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/{chunk-2ZTKYSSY.js → chunk-OVIBOKD4.js} +13 -1
- package/dist/chunk-OVIBOKD4.js.map +1 -0
- package/dist/index.cjs +12 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/model-registry.cjs.map +1 -1
- package/dist/model-registry.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-2ZTKYSSY.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1233,6 +1233,7 @@ var import_node_path4 = __toESM(require("path"), 1);
|
|
|
1233
1233
|
var import_node_crypto3 = require("crypto");
|
|
1234
1234
|
var import_gg_ai2 = require("@kenkaiiii/gg-ai");
|
|
1235
1235
|
var MAX_BYTES = 10 * 1024 * 1024;
|
|
1236
|
+
var ROTATED_GENERATIONS = 3;
|
|
1236
1237
|
var MIN_HEADROOM_BYTES = 64 * 1024;
|
|
1237
1238
|
var fd = null;
|
|
1238
1239
|
var logPath = null;
|
|
@@ -1249,6 +1250,17 @@ function rotateIfNeeded(filePath, force = false) {
|
|
|
1249
1250
|
const st = import_node_fs3.default.statSync(filePath);
|
|
1250
1251
|
if (!force && st.size <= MAX_BYTES - MIN_HEADROOM_BYTES) return;
|
|
1251
1252
|
const rotated = `${filePath}.1`;
|
|
1253
|
+
for (let generation = ROTATED_GENERATIONS - 1; generation >= 1; generation--) {
|
|
1254
|
+
const older = `${filePath}.${generation + 1}`;
|
|
1255
|
+
try {
|
|
1256
|
+
import_node_fs3.default.unlinkSync(older);
|
|
1257
|
+
} catch {
|
|
1258
|
+
}
|
|
1259
|
+
try {
|
|
1260
|
+
import_node_fs3.default.renameSync(`${filePath}.${generation}`, older);
|
|
1261
|
+
} catch {
|
|
1262
|
+
}
|
|
1263
|
+
}
|
|
1252
1264
|
try {
|
|
1253
1265
|
import_node_fs3.default.unlinkSync(rotated);
|
|
1254
1266
|
} catch {
|