@poe-platform/safe-js 0.1.69 → 0.1.71

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.
@@ -27,7 +27,7 @@ import {
27
27
  validateMigrationSemantics,
28
28
  validateSnapshotData,
29
29
  validateSnapshotMigration
30
- } from "./chunk-NQN7UBAH.js";
30
+ } from "./chunk-CSC4EXIV.js";
31
31
 
32
32
  // packages/safe-js/src/migrate.ts
33
33
  import { createHash } from "node:crypto";
@@ -8245,4 +8245,4 @@ export {
8245
8245
  parseMcpConfig,
8246
8246
  makeMcpModule
8247
8247
  };
8248
- //# sourceMappingURL=chunk-ORSTBFGI.js.map
8248
+ //# sourceMappingURL=chunk-BL5U2VOU.js.map
@@ -202,9 +202,13 @@ var Budget = class {
202
202
  dataSize: normalizeLimit("dataSize", options.dataSize)
203
203
  });
204
204
  }
205
- visitNode() {
206
- this.stepsUsed += 1;
207
- this.checkSampledDeadline();
205
+ visitNode(units = 1) {
206
+ if (!Number.isSafeInteger(units) || units < 0) {
207
+ throw new Error("units must be a non-negative safe integer.");
208
+ }
209
+ if (units === 0) return;
210
+ this.stepsUsed += units;
211
+ this.checkSampledDeadline(units);
208
212
  if (this.allChecksSuspended === 0 && this.limits.maxSteps !== void 0 && this.stepsUsed > this.limits.maxSteps) {
209
213
  throw new SandboxError({
210
214
  budget: "steps",
@@ -444,15 +448,15 @@ var Budget = class {
444
448
  });
445
449
  }
446
450
  }
447
- checkSampledDeadline() {
451
+ checkSampledDeadline(units) {
448
452
  if (this.allChecksSuspended > 0 || this.deadlineChecksSuspended > 0 || this.deadline === void 0) {
449
453
  return;
450
454
  }
451
- this.visitsUntilDeadlineCheck -= 1;
455
+ this.visitsUntilDeadlineCheck -= units;
452
456
  if (this.visitsUntilDeadlineCheck > 0) {
453
457
  return;
454
458
  }
455
- this.visitsUntilDeadlineCheck = DEADLINE_CHECK_INTERVAL;
459
+ this.visitsUntilDeadlineCheck = DEADLINE_CHECK_INTERVAL - -this.visitsUntilDeadlineCheck % DEADLINE_CHECK_INTERVAL;
456
460
  this.checkDeadline();
457
461
  }
458
462
  enterDepth() {
@@ -24676,6 +24680,7 @@ function callStringMethod(value, methodName, args, budget, callClosure = async (
24676
24680
  ];
24677
24681
  })
24678
24682
  );
24683
+ budget.visitNode(value.length + comparison.length);
24679
24684
  return Reflect.apply(String.prototype.localeCompare, value, [
24680
24685
  comparison,
24681
24686
  locales,
@@ -32767,4 +32772,4 @@ export {
32767
32772
  FileSnapshotBackend,
32768
32773
  run
32769
32774
  };
32770
- //# sourceMappingURL=chunk-NQN7UBAH.js.map
32775
+ //# sourceMappingURL=chunk-CSC4EXIV.js.map