@poe-platform/safe-js 0.1.722 → 0.1.723

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.
Files changed (48) hide show
  1. package/README.md +1 -1
  2. package/dist/safe-js/chunks/{chunk-S2GFVXSI.js → chunk-5MT2LF3W.js} +2 -2
  3. package/dist/safe-js/chunks/{chunk-QL2ALAE6.js → chunk-7FCMZUZJ.js} +3 -3
  4. package/dist/safe-js/chunks/{chunk-55RIIUGG.js → chunk-7TL6Z6LT.js} +37 -3
  5. package/dist/safe-js/chunks/chunk-7TL6Z6LT.js.map +7 -0
  6. package/dist/safe-js/chunks/{chunk-D3GC5QPZ.js → chunk-BRBOVGNC.js} +1 -1
  7. package/dist/safe-js/chunks/{chunk-D3GC5QPZ.js.map → chunk-BRBOVGNC.js.map} +2 -2
  8. package/dist/safe-js/chunks/{chunk-FA5CQO6V.js → chunk-HY3Q377V.js} +2 -2
  9. package/dist/safe-js/chunks/{chunk-BNIEPGDU.js → chunk-IZ52PAOD.js} +27 -4
  10. package/dist/safe-js/chunks/{chunk-BNIEPGDU.js.map → chunk-IZ52PAOD.js.map} +2 -2
  11. package/dist/safe-js/chunks/{chunk-7SBQ7WTV.js → chunk-KHJDAEET.js} +3 -3
  12. package/dist/safe-js/chunks/{chunk-EH5A2EQI.js → chunk-M6HUSN7X.js} +5 -5
  13. package/dist/safe-js/chunks/{chunk-GCOLKRMY.js → chunk-QMZG576E.js} +3 -3
  14. package/dist/safe-js/chunks/{chunk-XHSOM5CG.js → chunk-SWQHZKYM.js} +2 -2
  15. package/dist/safe-js/chunks/{chunk-K3ZRBAG5.js → chunk-Y5ZXQHL6.js} +2 -2
  16. package/dist/safe-js/chunks/{cli-runtime-6QPGM3TX.js → cli-runtime-EPXCJ5AG.js} +11 -11
  17. package/dist/safe-js/chunks/{dump-TU6SYRFD.js → dump-TWVEBH5W.js} +3 -3
  18. package/dist/safe-js/chunks/{fs-HTZT32MQ.js → fs-DSNHTHBT.js} +3 -3
  19. package/dist/safe-js/chunks/{harness-RYAMI444.js → harness-RLA643GD.js} +3 -3
  20. package/dist/safe-js/chunks/mcp-IEY7HXXT.js +11 -0
  21. package/dist/safe-js/chunks/{migration-file-K7UH5ZG6.js → migration-file-QMI45CSP.js} +4 -4
  22. package/dist/safe-js/chunks/{restore-7LRP4BM3.js → restore-R5PLLBST.js} +4 -4
  23. package/dist/safe-js/chunks/{run-6SETM7SV.js → run-QATVEFVQ.js} +6 -6
  24. package/dist/safe-js/chunks/{runtime-modules-MCQS2SHQ.js → runtime-modules-5D7KDFMZ.js} +3 -3
  25. package/dist/safe-js/cli.js +2 -2
  26. package/dist/safe-js/core.js +5 -5
  27. package/dist/safe-js/index.js +11 -11
  28. package/dist/safe-js/interp/host-bridge.d.ts +1 -0
  29. package/package.json +2 -2
  30. package/dist/safe-js/chunks/chunk-55RIIUGG.js.map +0 -7
  31. package/dist/safe-js/chunks/mcp-DO2IRFGQ.js +0 -11
  32. /package/dist/safe-js/chunks/{chunk-S2GFVXSI.js.map → chunk-5MT2LF3W.js.map} +0 -0
  33. /package/dist/safe-js/chunks/{chunk-QL2ALAE6.js.map → chunk-7FCMZUZJ.js.map} +0 -0
  34. /package/dist/safe-js/chunks/{chunk-FA5CQO6V.js.map → chunk-HY3Q377V.js.map} +0 -0
  35. /package/dist/safe-js/chunks/{chunk-7SBQ7WTV.js.map → chunk-KHJDAEET.js.map} +0 -0
  36. /package/dist/safe-js/chunks/{chunk-EH5A2EQI.js.map → chunk-M6HUSN7X.js.map} +0 -0
  37. /package/dist/safe-js/chunks/{chunk-GCOLKRMY.js.map → chunk-QMZG576E.js.map} +0 -0
  38. /package/dist/safe-js/chunks/{chunk-XHSOM5CG.js.map → chunk-SWQHZKYM.js.map} +0 -0
  39. /package/dist/safe-js/chunks/{chunk-K3ZRBAG5.js.map → chunk-Y5ZXQHL6.js.map} +0 -0
  40. /package/dist/safe-js/chunks/{cli-runtime-6QPGM3TX.js.map → cli-runtime-EPXCJ5AG.js.map} +0 -0
  41. /package/dist/safe-js/chunks/{dump-TU6SYRFD.js.map → dump-TWVEBH5W.js.map} +0 -0
  42. /package/dist/safe-js/chunks/{fs-HTZT32MQ.js.map → fs-DSNHTHBT.js.map} +0 -0
  43. /package/dist/safe-js/chunks/{harness-RYAMI444.js.map → harness-RLA643GD.js.map} +0 -0
  44. /package/dist/safe-js/chunks/{mcp-DO2IRFGQ.js.map → mcp-IEY7HXXT.js.map} +0 -0
  45. /package/dist/safe-js/chunks/{migration-file-K7UH5ZG6.js.map → migration-file-QMI45CSP.js.map} +0 -0
  46. /package/dist/safe-js/chunks/{restore-7LRP4BM3.js.map → restore-R5PLLBST.js.map} +0 -0
  47. /package/dist/safe-js/chunks/{run-6SETM7SV.js.map → run-QATVEFVQ.js.map} +0 -0
  48. /package/dist/safe-js/chunks/{runtime-modules-MCQS2SHQ.js.map → runtime-modules-5D7KDFMZ.js.map} +0 -0
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  isSandboxClosure
3
- } from "./chunk-BNIEPGDU.js";
3
+ } from "./chunk-IZ52PAOD.js";
4
4
 
5
5
  // packages/safe-js/src/lint/runtime-modules.ts
6
6
  var AsyncFunction = (async () => void 0).constructor;
@@ -34,4 +34,4 @@ function isAsyncRuntimeExport(value) {
34
34
  export {
35
35
  createLintModulesFromRuntimeRegistry
36
36
  };
37
- //# sourceMappingURL=chunk-FA5CQO6V.js.map
37
+ //# sourceMappingURL=chunk-HY3Q377V.js.map
@@ -18433,6 +18433,22 @@ function splitNormalized(value, separator, limit, budget, parent) {
18433
18433
  operation.release();
18434
18434
  }
18435
18435
  }
18436
+ const arrayLimit = budget.limits.arrayLength;
18437
+ if (arrayLimit !== void 0) {
18438
+ let count = 1;
18439
+ if (separator === "") {
18440
+ count = Math.min(value.length, limit);
18441
+ } else if (separator !== void 0) {
18442
+ let offset = 0;
18443
+ while (count < limit && count <= arrayLimit) {
18444
+ const index = value.indexOf(separator, offset);
18445
+ if (index === -1) break;
18446
+ count++;
18447
+ offset = index + separator.length;
18448
+ }
18449
+ }
18450
+ budget.allocateArrayLength(count);
18451
+ }
18436
18452
  const result = value.split(separator, limit);
18437
18453
  budget.allocateArrayLength(result.length);
18438
18454
  for (const part of result) budget.allocateString(part);
@@ -21819,6 +21835,10 @@ var hostErrorMetadata = {
21819
21835
  syscall: "string"
21820
21836
  };
21821
21837
  var awaitedHostOperations = /* @__PURE__ */ new WeakSet();
21838
+ var budgetedHostOperations = /* @__PURE__ */ new WeakMap();
21839
+ function declareBudgetedHostOperation(operation, invoke) {
21840
+ budgetedHostOperations.set(operation, invoke);
21841
+ }
21822
21842
  var hostOperationPolicies = /* @__PURE__ */ new WeakMap();
21823
21843
  var hostOperationReplayHandlers = /* @__PURE__ */ new WeakMap();
21824
21844
  function declareHostOperation(operation, policy, options = {}) {
@@ -21898,6 +21918,8 @@ function wrapCallerInjectedFunction(name, value, options, state) {
21898
21918
  });
21899
21919
  const captured = options.realm?.captureArguments(callable, args, copyArguments);
21900
21920
  const hostArgs = captured?.args ?? copyArguments(args);
21921
+ const budgetedOperation = budgetedHostOperations.get(callable);
21922
+ const callOperation = () => budgetedOperation === void 0 ? Reflect.apply(callable, void 0, hostArgs) : budgetedOperation(hostArgs, options.budget);
21901
21923
  const hostCalls = options.hostCalls;
21902
21924
  const operation = options.operation ?? bindingName;
21903
21925
  const moduleId = options.moduleId ?? "<bindings>";
@@ -21906,13 +21928,13 @@ function wrapCallerInjectedFunction(name, value, options, state) {
21906
21928
  let result2;
21907
21929
  if (options.realm !== void 0) {
21908
21930
  try {
21909
- result2 = options.realm.invoke(callable, () => Reflect.apply(callable, void 0, hostArgs));
21931
+ result2 = options.realm.invoke(callable, callOperation);
21910
21932
  } catch (error) {
21911
21933
  captured.rollback();
21912
21934
  throw error;
21913
21935
  }
21914
21936
  } else {
21915
- result2 = invokeHostCallback(() => Reflect.apply(callable, void 0, hostArgs), options);
21937
+ result2 = invokeHostCallback(callOperation, options);
21916
21938
  }
21917
21939
  if (awaitResult) {
21918
21940
  return wrapHostPromiseWithSignal(Promise.resolve(result2), options.signal).then((value2) => copyHostResultToSandbox(value2, stackFrames, options), (error) => {
@@ -22000,7 +22022,7 @@ function wrapCallerInjectedFunction(name, value, options, state) {
22000
22022
  const result = executeHostCall(
22001
22023
  issued.record,
22002
22024
  issued.restored,
22003
- () => invokeHostCallback(() => Reflect.apply(callable, void 0, hostArgs), options),
22025
+ () => invokeHostCallback(callOperation, options),
22004
22026
  stackFrames,
22005
22027
  options,
22006
22028
  context?.span,
@@ -48811,6 +48833,7 @@ export {
48811
48833
  createReplayEncodingContext,
48812
48834
  encodeReplayData,
48813
48835
  decodeReplayData,
48836
+ declareBudgetedHostOperation,
48814
48837
  declareHostOperation,
48815
48838
  wrapCallerInjectedBindings,
48816
48839
  copyHostValueToSandbox,
@@ -48920,4 +48943,4 @@ authorization of the copyright holder.
48920
48943
  SPDX-License-Identifier: Unicode-3.0
48921
48944
 
48922
48945
  */
48923
- //# sourceMappingURL=chunk-BNIEPGDU.js.map
48946
+ //# sourceMappingURL=chunk-IZ52PAOD.js.map