@poe-platform/safe-js 0.1.95 → 0.1.97
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/safe-js/chunks/{chunk-ADIFHHXM.js → chunk-INBDLJSN.js} +2 -2
- package/dist/safe-js/chunks/{chunk-T3NC5O24.js → chunk-XC53RECY.js} +54 -27
- package/dist/safe-js/chunks/chunk-XC53RECY.js.map +7 -0
- package/dist/safe-js/cli.js +2 -2
- package/dist/safe-js/core.js +1 -1
- package/dist/safe-js/index.js +2 -2
- package/dist/safe-js/interp/budget.d.ts +1 -0
- package/dist/safe-js/interp/exceptions.d.ts +3 -0
- package/package.json +2 -2
- package/dist/safe-js/chunks/chunk-T3NC5O24.js.map +0 -7
- /package/dist/safe-js/chunks/{chunk-ADIFHHXM.js.map → chunk-INBDLJSN.js.map} +0 -0
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
validateMigrationSemantics,
|
|
28
28
|
validateSnapshotData,
|
|
29
29
|
validateSnapshotMigration
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-XC53RECY.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-
|
|
8248
|
+
//# sourceMappingURL=chunk-INBDLJSN.js.map
|
|
@@ -172,6 +172,9 @@ var SandboxError = class extends Error {
|
|
|
172
172
|
this.limit = input.limit;
|
|
173
173
|
}
|
|
174
174
|
};
|
|
175
|
+
function isFatalSandboxError(error) {
|
|
176
|
+
return error instanceof SandboxError && (error.code === "budgetExceeded" || error.code === "reentry");
|
|
177
|
+
}
|
|
175
178
|
var Budget = class {
|
|
176
179
|
deadline;
|
|
177
180
|
limits;
|
|
@@ -8646,7 +8649,19 @@ async function evaluateTryStatement(node, context, evaluateNode2) {
|
|
|
8646
8649
|
value: void 0
|
|
8647
8650
|
};
|
|
8648
8651
|
}
|
|
8649
|
-
|
|
8652
|
+
let tryOrCatchResult = tryResult;
|
|
8653
|
+
let catchFailure;
|
|
8654
|
+
if (fatalBudgetError === void 0 && tryResult.kind === "throw" && node.handler !== void 0) {
|
|
8655
|
+
try {
|
|
8656
|
+
tryOrCatchResult = await evaluateCatchClause(node.handler, tryResult.value, context, evaluateNode2);
|
|
8657
|
+
} catch (error) {
|
|
8658
|
+
if (isFatalSandboxError(error) || isInterpreterError(error) || error instanceof HostCallResumabilityError) {
|
|
8659
|
+
throw error;
|
|
8660
|
+
}
|
|
8661
|
+
catchFailure = createThrowCompletion(error, context.budget, context.callStack, node.span);
|
|
8662
|
+
tryOrCatchResult = catchFailure;
|
|
8663
|
+
}
|
|
8664
|
+
}
|
|
8650
8665
|
if (node.finalizer === void 0 || tryOrCatchResult.kind === "error") {
|
|
8651
8666
|
return tryOrCatchResult;
|
|
8652
8667
|
}
|
|
@@ -8654,14 +8669,38 @@ async function evaluateTryStatement(node, context, evaluateNode2) {
|
|
|
8654
8669
|
context,
|
|
8655
8670
|
() => evaluateBlockCompletion(node.finalizer, context, evaluateNode2)
|
|
8656
8671
|
) : evaluateBlockCompletion(node.finalizer, context, evaluateNode2);
|
|
8657
|
-
|
|
8658
|
-
|
|
8659
|
-
|
|
8672
|
+
if (catchFailure !== void 0) {
|
|
8673
|
+
const value = catchFailure.value;
|
|
8674
|
+
context.budget.setRetainedValues(catchFailure, () => [value]);
|
|
8660
8675
|
}
|
|
8661
|
-
|
|
8662
|
-
|
|
8676
|
+
try {
|
|
8677
|
+
const finalizerResult = await (fatalBudgetError === void 0 ? evaluateFinalizer() : withFatalPromiseCleanup(evaluateFinalizer));
|
|
8678
|
+
if (fatalBudgetError !== void 0) {
|
|
8679
|
+
throw fatalBudgetError;
|
|
8680
|
+
}
|
|
8681
|
+
if (finalizerResult.kind === "normal") {
|
|
8682
|
+
return tryOrCatchResult;
|
|
8683
|
+
}
|
|
8684
|
+
return finalizerResult;
|
|
8685
|
+
} finally {
|
|
8686
|
+
if (catchFailure !== void 0) context.budget.setRetainedValues(catchFailure, void 0);
|
|
8663
8687
|
}
|
|
8664
|
-
|
|
8688
|
+
}
|
|
8689
|
+
function createThrowCompletion(error, budget, stackFrames, span) {
|
|
8690
|
+
const value = isCapturedException(error) ? coerceThrownValue(error.reason, budget, error.stackFrames, span, error.sandbox) : coerceThrownValue(error, budget, stackFrames, span, true);
|
|
8691
|
+
return {
|
|
8692
|
+
kind: "throw",
|
|
8693
|
+
hasValue: true,
|
|
8694
|
+
span: readErrorSpan(value) ?? span,
|
|
8695
|
+
stackFrames: isCapturedException(error) ? error.stackFrames : stackFrames,
|
|
8696
|
+
value
|
|
8697
|
+
};
|
|
8698
|
+
}
|
|
8699
|
+
function isInterpreterError(value) {
|
|
8700
|
+
return typeof value === "object" && value !== null && hasOwnProperty2(value, "code") && hasOwnProperty2(value, "message") && hasOwnProperty2(value, "nodeType") && hasOwnProperty2(value, "span") && (value.code === "UNBOUND_IDENTIFIER" || value.code === "UNSUPPORTED_NODE");
|
|
8701
|
+
}
|
|
8702
|
+
function hasOwnProperty2(value, name) {
|
|
8703
|
+
return Object.prototype.hasOwnProperty.call(value, name);
|
|
8665
8704
|
}
|
|
8666
8705
|
function createCapturedException(reason, stackFrames, sandbox = false) {
|
|
8667
8706
|
return {
|
|
@@ -24350,13 +24389,16 @@ function getFunctionMember(target, property, options) {
|
|
|
24350
24389
|
return createSandboxClosure({
|
|
24351
24390
|
sandbox: true,
|
|
24352
24391
|
name: `Function#${property}`,
|
|
24353
|
-
call: (args, context) => callFunctionMethod(
|
|
24392
|
+
call: (args, context) => callFunctionMethod(context?.thisValue, property, args, options, context?.stack ?? [])
|
|
24354
24393
|
});
|
|
24355
24394
|
}
|
|
24356
24395
|
function isFunctionMethodName(property) {
|
|
24357
24396
|
return typeof property === "string" && functionMethodNames.has(property);
|
|
24358
24397
|
}
|
|
24359
24398
|
function callFunctionMethod(target, methodName, args, options, stack) {
|
|
24399
|
+
if (!isSandboxClosure(target)) {
|
|
24400
|
+
throw new TypeError(`Function#${methodName} requires a callable receiver.`);
|
|
24401
|
+
}
|
|
24360
24402
|
const thisValue = args[0];
|
|
24361
24403
|
if (methodName === "bind") {
|
|
24362
24404
|
const boundArgs = args.slice(1);
|
|
@@ -26070,22 +26112,16 @@ async function evaluateNode(node, context) {
|
|
|
26070
26112
|
error
|
|
26071
26113
|
};
|
|
26072
26114
|
}
|
|
26073
|
-
const
|
|
26115
|
+
const completion = createThrowCompletion(error, context.budget, context.callStack, node.span);
|
|
26074
26116
|
reconcileDataBudget(
|
|
26075
26117
|
context.budget,
|
|
26076
26118
|
context.stats,
|
|
26077
26119
|
context.scope,
|
|
26078
|
-
|
|
26120
|
+
completion.value,
|
|
26079
26121
|
compilation,
|
|
26080
26122
|
context.compilation
|
|
26081
26123
|
);
|
|
26082
|
-
return
|
|
26083
|
-
kind: "throw",
|
|
26084
|
-
hasValue: true,
|
|
26085
|
-
span: readErrorSpan(exception) ?? node.span,
|
|
26086
|
-
stackFrames: isCapturedException(error) ? error.stackFrames : context.callStack,
|
|
26087
|
-
value: exception
|
|
26088
|
-
};
|
|
26124
|
+
return completion;
|
|
26089
26125
|
} finally {
|
|
26090
26126
|
compilation.dispose();
|
|
26091
26127
|
}
|
|
@@ -28562,12 +28598,6 @@ function defineSandboxProperty(target, key, value) {
|
|
|
28562
28598
|
writable: true
|
|
28563
28599
|
});
|
|
28564
28600
|
}
|
|
28565
|
-
function isInterpreterError(value) {
|
|
28566
|
-
return typeof value === "object" && value !== null && hasOwnProperty2(value, "code") && hasOwnProperty2(value, "message") && hasOwnProperty2(value, "nodeType") && hasOwnProperty2(value, "span") && (value.code === "UNBOUND_IDENTIFIER" || value.code === "UNSUPPORTED_NODE");
|
|
28567
|
-
}
|
|
28568
|
-
function hasOwnProperty2(value, name) {
|
|
28569
|
-
return Object.prototype.hasOwnProperty.call(value, name);
|
|
28570
|
-
}
|
|
28571
28601
|
function wrapHostResult(result, stack, sandbox) {
|
|
28572
28602
|
if (!isPromiseLikeResult(result)) {
|
|
28573
28603
|
return result;
|
|
@@ -28582,9 +28612,6 @@ function wrapHostResult(result, stack, sandbox) {
|
|
|
28582
28612
|
function captureException(error, stack, sandbox) {
|
|
28583
28613
|
return isCapturedException(error) ? error : createCapturedException(error, stack, sandbox);
|
|
28584
28614
|
}
|
|
28585
|
-
function isFatalSandboxError(error) {
|
|
28586
|
-
return error instanceof SandboxError && (error.code === "budgetExceeded" || error.code === "reentry");
|
|
28587
|
-
}
|
|
28588
28615
|
function isPromiseLikeResult(value) {
|
|
28589
28616
|
return typeof value === "object" && value !== null && "then" in value;
|
|
28590
28617
|
}
|
|
@@ -32917,4 +32944,4 @@ export {
|
|
|
32917
32944
|
FileSnapshotBackend,
|
|
32918
32945
|
run
|
|
32919
32946
|
};
|
|
32920
|
-
//# sourceMappingURL=chunk-
|
|
32947
|
+
//# sourceMappingURL=chunk-XC53RECY.js.map
|