@poe-platform/safe-js 0.1.276 → 0.1.277
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-P44IU3A7.js → chunk-F6E3VH3T.js} +2 -2
- package/dist/safe-js/chunks/{chunk-5MDRQKN6.js → chunk-VDDR5KKE.js} +25 -24
- package/dist/safe-js/chunks/{chunk-5MDRQKN6.js.map → chunk-VDDR5KKE.js.map} +2 -2
- 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/async.d.ts +2 -2
- package/dist/safe-js/interp/interpreter.d.ts +1 -0
- package/dist/safe-js/interp/iteration.d.ts +1 -1
- package/package.json +2 -2
- /package/dist/safe-js/chunks/{chunk-P44IU3A7.js.map → chunk-F6E3VH3T.js.map} +0 -0
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
validateMigrationSemantics,
|
|
28
28
|
validateSnapshotData,
|
|
29
29
|
validateSnapshotMigration
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-VDDR5KKE.js";
|
|
31
31
|
|
|
32
32
|
// packages/safe-js/src/migrate.ts
|
|
33
33
|
import { createHash } from "node:crypto";
|
|
@@ -8249,4 +8249,4 @@ export {
|
|
|
8249
8249
|
parseMcpConfig,
|
|
8250
8250
|
makeMcpModule
|
|
8251
8251
|
};
|
|
8252
|
-
//# sourceMappingURL=chunk-
|
|
8252
|
+
//# sourceMappingURL=chunk-F6E3VH3T.js.map
|
|
@@ -11241,7 +11241,7 @@ function mapIteratorSnapshot(snapshot, map) {
|
|
|
11241
11241
|
async function restoreSandboxIterator(snapshot, budget, context, signal) {
|
|
11242
11242
|
if (snapshot.kind === "unsupported") throw new TypeError("Host-owned iterator cannot be restored.");
|
|
11243
11243
|
if (snapshot.kind === "guest") return guestIterator(snapshot.value, snapshot.next, snapshot.async, budget, context, signal);
|
|
11244
|
-
if (snapshot.kind === "async-from-sync") return asyncFromSyncIterator(await restoreSandboxIterator(snapshot.inner, budget, context, signal), budget, signal);
|
|
11244
|
+
if (snapshot.kind === "async-from-sync") return asyncFromSyncIterator(await restoreSandboxIterator(snapshot.inner, budget, context, signal), budget, signal, context);
|
|
11245
11245
|
if (Array.isArray(snapshot.value)) return arrayIterator(snapshot.value, context, budget, snapshot.index);
|
|
11246
11246
|
const iterator = isSandboxGenerator(snapshot.value) && snapshot.value.async ? getSandboxAsyncIterator(snapshot.value, budget, context, signal) : getSandboxIterator(snapshot.value, budget, context);
|
|
11247
11247
|
if (iterator === void 0) throw new TypeError("Invalid builtin iterator snapshot.");
|
|
@@ -11257,7 +11257,7 @@ async function acquireSandboxIterator(value, budget, context, asyncProtocol = fa
|
|
|
11257
11257
|
if (isSandboxGenerator(value) && value.async)
|
|
11258
11258
|
return getSandboxAsyncIterator(value, budget, context, signal);
|
|
11259
11259
|
const iterator2 = await acquireSandboxIterator(value, budget, context);
|
|
11260
|
-
return iterator2 === void 0 ? void 0 : asyncFromSyncIterator(iterator2, budget, signal);
|
|
11260
|
+
return iterator2 === void 0 ? void 0 : asyncFromSyncIterator(iterator2, budget, signal, context);
|
|
11261
11261
|
}
|
|
11262
11262
|
const factory = await context.getProperty(value, key);
|
|
11263
11263
|
if (!asyncProtocol && (isSandboxMap(value) || isSandboxSet(value)) && typeof factory === "object" && factory !== null && getIntrinsicIdentity(factory) === JSON.stringify(isSandboxMap(value) ? ["Map", "prototype", "entries"] : ["Set", "prototype", "values"])) {
|
|
@@ -11266,7 +11266,7 @@ async function acquireSandboxIterator(value, budget, context, asyncProtocol = fa
|
|
|
11266
11266
|
if (factory === null || factory === void 0) {
|
|
11267
11267
|
if (!asyncProtocol) return void 0;
|
|
11268
11268
|
const iterator2 = await acquireSandboxIterator(value, budget, context);
|
|
11269
|
-
return iterator2 === void 0 ? void 0 : asyncFromSyncIterator(iterator2, budget, signal);
|
|
11269
|
+
return iterator2 === void 0 ? void 0 : asyncFromSyncIterator(iterator2, budget, signal, context);
|
|
11270
11270
|
}
|
|
11271
11271
|
if (!isSandboxClosure(factory)) {
|
|
11272
11272
|
if (typeof factory !== "function") throw new TypeError("Iterator method must be callable.");
|
|
@@ -11286,7 +11286,7 @@ function guestIterator(iterator, next, asyncProtocol, budget, context, signal) {
|
|
|
11286
11286
|
const invoke = async (operation, args) => {
|
|
11287
11287
|
if (!isSandboxClosure(operation)) throw new TypeError("Iterator operation must be callable.");
|
|
11288
11288
|
const returned = await invokeBuiltinClosure(operation, args, budget, context, iterator);
|
|
11289
|
-
const result = asyncProtocol ? await awaitSandboxValue(returned, signal, budget) : returned;
|
|
11289
|
+
const result = asyncProtocol ? await awaitSandboxValue(returned, signal, budget, context) : returned;
|
|
11290
11290
|
if (typeof result !== "object" && typeof result !== "function" || result === null)
|
|
11291
11291
|
throw new TypeError("Iterator result must be an object.");
|
|
11292
11292
|
return result;
|
|
@@ -11311,7 +11311,7 @@ async function readIteratorResult(iterator, result, property) {
|
|
|
11311
11311
|
}
|
|
11312
11312
|
function getSandboxAsyncIterator(value, budget, context, signal) {
|
|
11313
11313
|
if (isSandboxGenerator(value) && value.async) {
|
|
11314
|
-
return { ...generatorIterator(value, budget), asyncProtocol: true };
|
|
11314
|
+
return { ...generatorIterator(value, budget, context), asyncProtocol: true };
|
|
11315
11315
|
}
|
|
11316
11316
|
if (value !== null && (typeof value === "object" || typeof value === "function") && !isGuestHostObject(value)) {
|
|
11317
11317
|
const method = value[Symbol.asyncIterator];
|
|
@@ -11320,7 +11320,7 @@ function getSandboxAsyncIterator(value, budget, context, signal) {
|
|
|
11320
11320
|
}
|
|
11321
11321
|
}
|
|
11322
11322
|
const iterator = getSandboxIterator(value, budget, context);
|
|
11323
|
-
return iterator === void 0 ? void 0 : asyncFromSyncIterator(iterator, budget, signal);
|
|
11323
|
+
return iterator === void 0 ? void 0 : asyncFromSyncIterator(iterator, budget, signal, context);
|
|
11324
11324
|
}
|
|
11325
11325
|
function nativeAsyncIterator(value, method, signal) {
|
|
11326
11326
|
if (typeof method !== "function") throw new TypeError("Async iterator method must be callable.");
|
|
@@ -11362,7 +11362,7 @@ function nativeAsyncIterator(value, method, signal) {
|
|
|
11362
11362
|
}
|
|
11363
11363
|
};
|
|
11364
11364
|
}
|
|
11365
|
-
function asyncFromSyncIterator(iterator, budget, signal) {
|
|
11365
|
+
function asyncFromSyncIterator(iterator, budget, signal, context) {
|
|
11366
11366
|
const invoke = async (method, args) => {
|
|
11367
11367
|
const operation = iterator.getOperation === void 0 ? iterator[method] : await iterator.getOperation(method);
|
|
11368
11368
|
if (operation === void 0) {
|
|
@@ -11380,7 +11380,7 @@ function asyncFromSyncIterator(iterator, budget, signal) {
|
|
|
11380
11380
|
const done = Boolean((await readIteratorResult(iterator, result, "done")).value);
|
|
11381
11381
|
const resultValue = (await readIteratorResult(iterator, result, "value")).value;
|
|
11382
11382
|
try {
|
|
11383
|
-
return { done, value: await awaitSandboxValue(resultValue, signal, budget) };
|
|
11383
|
+
return { done, value: await awaitSandboxValue(resultValue, signal, budget, context) };
|
|
11384
11384
|
} catch (error) {
|
|
11385
11385
|
if (isFatalSandboxError(error) || error instanceof HostCallResumabilityError) throw error;
|
|
11386
11386
|
if (!done && method !== "return") await closeIterator(iterator, true);
|
|
@@ -11538,7 +11538,7 @@ function collectionIterator(collection, value) {
|
|
|
11538
11538
|
return adapter;
|
|
11539
11539
|
}
|
|
11540
11540
|
var asyncGeneratorRequests = /* @__PURE__ */ new WeakMap();
|
|
11541
|
-
function generatorIterator(generator, budget) {
|
|
11541
|
+
function generatorIterator(generator, budget, context) {
|
|
11542
11542
|
const invoke = async (method, value) => {
|
|
11543
11543
|
const leaveRunning = enterRunningState(generator);
|
|
11544
11544
|
const initialState = generator.state;
|
|
@@ -11546,7 +11546,7 @@ function generatorIterator(generator, budget) {
|
|
|
11546
11546
|
try {
|
|
11547
11547
|
if (generator.async && method === "return" && (initialState === "start" || initialState === "done")) {
|
|
11548
11548
|
if (initialState === "start") await generator.channel.return();
|
|
11549
|
-
value = await awaitSandboxValue(value, void 0, budget);
|
|
11549
|
+
value = await awaitSandboxValue(value, void 0, budget, context);
|
|
11550
11550
|
}
|
|
11551
11551
|
const result = await generator.channel[method](value);
|
|
11552
11552
|
generator.state = result.done ? "done" : "suspended";
|
|
@@ -12617,7 +12617,7 @@ function registerCancelablePromises(value, signal) {
|
|
|
12617
12617
|
}
|
|
12618
12618
|
}
|
|
12619
12619
|
}
|
|
12620
|
-
function awaitSandboxValue(value, signal, budget) {
|
|
12620
|
+
function awaitSandboxValue(value, signal, budget, context) {
|
|
12621
12621
|
let resolved;
|
|
12622
12622
|
if (isSandboxPromise(value)) {
|
|
12623
12623
|
observeSandboxPromise(value);
|
|
@@ -12640,7 +12640,7 @@ function awaitSandboxValue(value, signal, budget) {
|
|
|
12640
12640
|
);
|
|
12641
12641
|
});
|
|
12642
12642
|
} else {
|
|
12643
|
-
resolved = resolveSandboxValue(value, { budget });
|
|
12643
|
+
resolved = resolveSandboxValue(value, { budget, context });
|
|
12644
12644
|
}
|
|
12645
12645
|
const pending = isSandboxPromise(value) && (value.synchronousPrefix !== void 0 || signal !== void 0 && cancelableOutcomes.get(value)?.has(signal)) ? resolved : awaitWithSignal(resolved, signal);
|
|
12646
12646
|
return isSandboxPromise(value) ? pending : interruptOnFatalPromiseRejection(pending);
|
|
@@ -15879,8 +15879,8 @@ function getGeneratorMember(target, property, budget) {
|
|
|
15879
15879
|
return createSandboxClosure({
|
|
15880
15880
|
sandbox: true,
|
|
15881
15881
|
name: property,
|
|
15882
|
-
call: ([value]) => {
|
|
15883
|
-
const iterator = generatorIterator(target, budget);
|
|
15882
|
+
call: ([value], context) => {
|
|
15883
|
+
const iterator = generatorIterator(target, budget, context);
|
|
15884
15884
|
const result = Promise.resolve(iterator[property](value)).then((result2) => allocateProducedSandboxValue(
|
|
15885
15885
|
{ value: result2.value, done: result2.done === true },
|
|
15886
15886
|
budget
|
|
@@ -17891,7 +17891,7 @@ async function evaluateReturnStatement(node, context) {
|
|
|
17891
17891
|
return {
|
|
17892
17892
|
kind: "return",
|
|
17893
17893
|
hasValue: argument.hasValue,
|
|
17894
|
-
value: context.asyncGenerator ? await suspendJob(awaitSandboxValue(argument.value, context.signal, context.budget)) : argument.value
|
|
17894
|
+
value: context.asyncGenerator ? await suspendJob(awaitSandboxValue(argument.value, context.signal, context.budget, createCoercionContext(context))) : argument.value
|
|
17895
17895
|
};
|
|
17896
17896
|
}
|
|
17897
17897
|
async function evaluateYieldExpression(node, context) {
|
|
@@ -17915,7 +17915,7 @@ async function evaluateYieldExpression(node, context) {
|
|
|
17915
17915
|
return generatorCompletionResult(completion);
|
|
17916
17916
|
}
|
|
17917
17917
|
async function yieldGeneratorValue(value, node, context) {
|
|
17918
|
-
if (context.asyncGenerator && !node.delegate) value = await suspendJob(awaitSandboxValue(value, context.signal, context.budget));
|
|
17918
|
+
if (context.asyncGenerator && !node.delegate) value = await suspendJob(awaitSandboxValue(value, context.signal, context.budget, createCoercionContext(context)));
|
|
17919
17919
|
context.captureGeneratorScope?.(context.scope, context.generatorBlockScopes, context.finallyCompletions, context.generatorExpressionStates);
|
|
17920
17920
|
const completionPromise = context.generatorYield(allocateProducedSandboxValue(value, context.budget), node.nodeId);
|
|
17921
17921
|
emitResumeBreakpoint(context, {
|
|
@@ -17926,7 +17926,7 @@ async function yieldGeneratorValue(value, node, context) {
|
|
|
17926
17926
|
const completion = await (context.asyncGenerator ? suspendJob(completionPromise) : completionPromise);
|
|
17927
17927
|
if (context.asyncGenerator && completion.type === "return") {
|
|
17928
17928
|
try {
|
|
17929
|
-
return { type: "return", value: await suspendJob(awaitSandboxValue(completion.value, context.signal, context.budget)) };
|
|
17929
|
+
return { type: "return", value: await suspendJob(awaitSandboxValue(completion.value, context.signal, context.budget, createCoercionContext(context))) };
|
|
17930
17930
|
} catch (error) {
|
|
17931
17931
|
return { type: "throw", value: error };
|
|
17932
17932
|
}
|
|
@@ -18807,7 +18807,7 @@ function createCoercionContext(context) {
|
|
|
18807
18807
|
compilation: context.compilation,
|
|
18808
18808
|
getProperty: (value, property) => getPropertyValue(value, property, context),
|
|
18809
18809
|
reconcileData: (value) => reconcileDataBudget(context.budget, context.stats, context.scope, value, context.compilation, context.compilation?.parent),
|
|
18810
|
-
invokeClosure: (closure, args, thisValue, construct) => invokeSandboxClosure(closure, args, context, context.callStack, void 0, thisValue, construct)
|
|
18810
|
+
invokeClosure: (closure, args, thisValue, construct, newTarget) => invokeSandboxClosure(closure, args, context, context.callStack, void 0, thisValue, construct, newTarget)
|
|
18811
18811
|
};
|
|
18812
18812
|
}
|
|
18813
18813
|
function hasSandboxProperty(value, key, context) {
|
|
@@ -20860,14 +20860,15 @@ function createInterpretedClosure(node, context, evaluateNode2, homeObject) {
|
|
|
20860
20860
|
evaluateNode2
|
|
20861
20861
|
),
|
|
20862
20862
|
context.budget,
|
|
20863
|
-
context.signal
|
|
20863
|
+
context.signal,
|
|
20864
|
+
callContext
|
|
20864
20865
|
);
|
|
20865
20866
|
}
|
|
20866
20867
|
});
|
|
20867
20868
|
registerClosureOrigin(closure, node, context);
|
|
20868
20869
|
return closure;
|
|
20869
20870
|
}
|
|
20870
|
-
function executeAsyncFunction(execute, budget, signal) {
|
|
20871
|
+
function executeAsyncFunction(execute, budget, signal, callContext) {
|
|
20871
20872
|
let completePrefix;
|
|
20872
20873
|
const synchronousPrefix = new Promise((resolve) => {
|
|
20873
20874
|
completePrefix = resolve;
|
|
@@ -20878,7 +20879,7 @@ function executeAsyncFunction(execute, budget, signal) {
|
|
|
20878
20879
|
const value = await execute(completePrefix);
|
|
20879
20880
|
resolve(
|
|
20880
20881
|
requiresPromiseResolution(value, budget) ? awaitSandboxValue(
|
|
20881
|
-
createSandboxPromise(resolveSandboxValue(value, { budget }), {
|
|
20882
|
+
createSandboxPromise(resolveSandboxValue(value, { budget, context: callContext }), {
|
|
20882
20883
|
trackReplay: false
|
|
20883
20884
|
}),
|
|
20884
20885
|
signal,
|
|
@@ -20946,7 +20947,7 @@ function createGeneratorClosure(node, context, evaluateNode2) {
|
|
|
20946
20947
|
throw result.value;
|
|
20947
20948
|
}
|
|
20948
20949
|
const value = result.hasValue ? result.value : void 0;
|
|
20949
|
-
return node.async ? awaitSandboxValue(value, context.signal, context.budget) : value;
|
|
20950
|
+
return node.async ? awaitSandboxValue(value, context.signal, context.budget, createCoercionContext(context)) : value;
|
|
20950
20951
|
};
|
|
20951
20952
|
return node.async ? runAsyncPrefix(execute) : execute();
|
|
20952
20953
|
});
|
|
@@ -20980,7 +20981,7 @@ async function evaluateAwaitExpression(node, context, evaluateNode2) {
|
|
|
20980
20981
|
return {
|
|
20981
20982
|
kind: "normal",
|
|
20982
20983
|
hasValue: true,
|
|
20983
|
-
value: await suspendJob(awaitSandboxValue(argument.value, context.signal, context.budget))
|
|
20984
|
+
value: await suspendJob(awaitSandboxValue(argument.value, context.signal, context.budget, createCoercionContext(context)))
|
|
20984
20985
|
};
|
|
20985
20986
|
} finally {
|
|
20986
20987
|
leaveAwait();
|
|
@@ -40248,4 +40249,4 @@ export {
|
|
|
40248
40249
|
FileSnapshotBackend,
|
|
40249
40250
|
run
|
|
40250
40251
|
};
|
|
40251
|
-
//# sourceMappingURL=chunk-
|
|
40252
|
+
//# sourceMappingURL=chunk-VDDR5KKE.js.map
|