@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.
@@ -1042,6 +1042,7 @@ import path3 from "path";
1042
1042
  import { randomBytes } from "crypto";
1043
1043
  import { environmentSecrets, redactText, redactValue } from "@kenkaiiii/gg-ai";
1044
1044
  var MAX_BYTES = 10 * 1024 * 1024;
1045
+ var ROTATED_GENERATIONS = 3;
1045
1046
  var MIN_HEADROOM_BYTES = 64 * 1024;
1046
1047
  var fd = null;
1047
1048
  var logPath = null;
@@ -1058,6 +1059,17 @@ function rotateIfNeeded(filePath, force = false) {
1058
1059
  const st = fs5.statSync(filePath);
1059
1060
  if (!force && st.size <= MAX_BYTES - MIN_HEADROOM_BYTES) return;
1060
1061
  const rotated = `${filePath}.1`;
1062
+ for (let generation = ROTATED_GENERATIONS - 1; generation >= 1; generation--) {
1063
+ const older = `${filePath}.${generation + 1}`;
1064
+ try {
1065
+ fs5.unlinkSync(older);
1066
+ } catch {
1067
+ }
1068
+ try {
1069
+ fs5.renameSync(`${filePath}.${generation}`, older);
1070
+ } catch {
1071
+ }
1072
+ }
1061
1073
  try {
1062
1074
  fs5.unlinkSync(rotated);
1063
1075
  } catch {
@@ -3063,4 +3075,4 @@ export {
3063
3075
  getDefaultThinkingLevel,
3064
3076
  getSummaryModel
3065
3077
  };
3066
- //# sourceMappingURL=chunk-2ZTKYSSY.js.map
3078
+ //# sourceMappingURL=chunk-OVIBOKD4.js.map