@kenkaiiii/gg-ai 5.64.1 → 5.64.2

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
@@ -4123,7 +4123,7 @@ function isMediaObject(value) {
4123
4123
  function redactValue(value, options = {}) {
4124
4124
  const maxDepth = options.maxDepth ?? 20;
4125
4125
  const maxEntries = options.maxEntries ?? 1e4;
4126
- const seen = /* @__PURE__ */ new WeakSet();
4126
+ const ancestors = /* @__PURE__ */ new WeakSet();
4127
4127
  let entries = 0;
4128
4128
  const visit = (current, depth, sensitive = false) => {
4129
4129
  if (typeof current === "string") {
@@ -4137,8 +4137,15 @@ function redactValue(value, options = {}) {
4137
4137
  if (isBinary(current)) return current;
4138
4138
  if (current instanceof Date) return new Date(current.getTime());
4139
4139
  if (depth >= maxDepth) return TRUNCATED;
4140
- if (seen.has(current)) return CIRCULAR;
4141
- seen.add(current);
4140
+ if (ancestors.has(current)) return CIRCULAR;
4141
+ ancestors.add(current);
4142
+ try {
4143
+ return cloneObject(current, depth);
4144
+ } finally {
4145
+ ancestors.delete(current);
4146
+ }
4147
+ };
4148
+ const cloneObject = (current, depth) => {
4142
4149
  if (current instanceof Error) {
4143
4150
  const error = {
4144
4151
  name: current.name,