@poe-platform/safe-js 0.1.720 → 0.1.721
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/README.md +15 -2
- package/dist/safe-js/chunks/{chunk-APKV5Y6T.js → chunk-4CX3HYRY.js} +2 -2
- package/dist/safe-js/chunks/{chunk-NJM2Q74Z.js → chunk-A4L72WXV.js} +4 -4
- package/dist/safe-js/chunks/{chunk-B2SQLK4O.js → chunk-B4M6QVUV.js} +2 -2
- package/dist/safe-js/chunks/{chunk-A7CADQAD.js → chunk-BEXRQET4.js} +3 -3
- package/dist/safe-js/chunks/{chunk-OP3H3ZDN.js → chunk-BHYBD6SY.js} +2 -2
- package/dist/safe-js/chunks/{chunk-KP6I45ET.js → chunk-DNA7BMBY.js} +192 -38
- package/dist/safe-js/chunks/{chunk-KP6I45ET.js.map → chunk-DNA7BMBY.js.map} +3 -3
- package/dist/safe-js/chunks/{chunk-U6KZ2DQ2.js → chunk-GMPZBMPA.js} +3 -3
- package/dist/safe-js/chunks/{chunk-IDQ67DY2.js → chunk-ILYJBA2D.js} +24 -3
- package/dist/safe-js/chunks/chunk-ILYJBA2D.js.map +7 -0
- package/dist/safe-js/chunks/{chunk-NEJ44T4Y.js → chunk-IS7YUCOF.js} +2 -2
- package/dist/safe-js/chunks/{chunk-BGJXQN4A.js → chunk-JNLY7IMV.js} +4 -4
- package/dist/safe-js/chunks/{chunk-RML35GIF.js → chunk-LPBTSTDG.js} +3 -3
- package/dist/safe-js/chunks/{chunk-KK5NCR5R.js → chunk-Q7B6JIMI.js} +110 -46
- package/dist/safe-js/chunks/chunk-Q7B6JIMI.js.map +7 -0
- package/dist/safe-js/chunks/{chunk-XMA6FOJU.js → chunk-Y4LNCDCP.js} +2 -2
- package/dist/safe-js/chunks/{cli-runtime-PO6DQDHP.js → cli-runtime-YK2WE33M.js} +13 -13
- package/dist/safe-js/chunks/{dump-TRGFSCJ7.js → dump-ATWBOZWV.js} +4 -4
- package/dist/safe-js/chunks/{fs-4T5MZW5J.js → fs-D72Y52I5.js} +4 -4
- package/dist/safe-js/chunks/harness-LUYCGWHZ.js +10 -0
- package/dist/safe-js/chunks/mcp-IWKZB2R2.js +11 -0
- package/dist/safe-js/chunks/migration-file-IXO5MLP4.js +12 -0
- package/dist/safe-js/chunks/restore-SI7HOC6C.js +13 -0
- package/dist/safe-js/chunks/run-SHI2PYR6.js +17 -0
- package/dist/safe-js/chunks/runtime-modules-OO72HTVF.js +10 -0
- package/dist/safe-js/cli.js +2 -2
- package/dist/safe-js/core.js +7 -7
- package/dist/safe-js/extensions.d.ts +3 -1
- package/dist/safe-js/index.js +13 -13
- package/dist/safe-js/interp/budget.d.ts +3 -0
- package/dist/safe-js/interp/scope.d.ts +4 -1
- package/dist/safe-js/interp/typed-array.d.ts +3 -0
- package/dist/safe-js/parse/dynamic-source.d.ts +1 -1
- package/dist/safe-js/parse/parser.d.ts +1 -1
- package/dist/safe-js/realm.d.ts +1 -0
- package/dist/safe-js/snapshot/guest-heap.d.ts +1 -0
- package/dist/toolcraft-design/prompts/primitives/note.d.ts +1 -1
- package/package.json +2 -2
- package/dist/safe-js/chunks/chunk-IDQ67DY2.js.map +0 -7
- package/dist/safe-js/chunks/chunk-KK5NCR5R.js.map +0 -7
- package/dist/safe-js/chunks/harness-DLEQ2Z3O.js +0 -10
- package/dist/safe-js/chunks/mcp-TNVEFJ6K.js +0 -11
- package/dist/safe-js/chunks/migration-file-IDIUFLKY.js +0 -12
- package/dist/safe-js/chunks/restore-P27AUZR2.js +0 -13
- package/dist/safe-js/chunks/run-KGAEHYMV.js +0 -17
- package/dist/safe-js/chunks/runtime-modules-KICK45EE.js +0 -10
- /package/dist/safe-js/chunks/{chunk-APKV5Y6T.js.map → chunk-4CX3HYRY.js.map} +0 -0
- /package/dist/safe-js/chunks/{chunk-NJM2Q74Z.js.map → chunk-A4L72WXV.js.map} +0 -0
- /package/dist/safe-js/chunks/{chunk-B2SQLK4O.js.map → chunk-B4M6QVUV.js.map} +0 -0
- /package/dist/safe-js/chunks/{chunk-A7CADQAD.js.map → chunk-BEXRQET4.js.map} +0 -0
- /package/dist/safe-js/chunks/{chunk-OP3H3ZDN.js.map → chunk-BHYBD6SY.js.map} +0 -0
- /package/dist/safe-js/chunks/{chunk-U6KZ2DQ2.js.map → chunk-GMPZBMPA.js.map} +0 -0
- /package/dist/safe-js/chunks/{chunk-NEJ44T4Y.js.map → chunk-IS7YUCOF.js.map} +0 -0
- /package/dist/safe-js/chunks/{chunk-BGJXQN4A.js.map → chunk-JNLY7IMV.js.map} +0 -0
- /package/dist/safe-js/chunks/{chunk-RML35GIF.js.map → chunk-LPBTSTDG.js.map} +0 -0
- /package/dist/safe-js/chunks/{chunk-XMA6FOJU.js.map → chunk-Y4LNCDCP.js.map} +0 -0
- /package/dist/safe-js/chunks/{cli-runtime-PO6DQDHP.js.map → cli-runtime-YK2WE33M.js.map} +0 -0
- /package/dist/safe-js/chunks/{dump-TRGFSCJ7.js.map → dump-ATWBOZWV.js.map} +0 -0
- /package/dist/safe-js/chunks/{fs-4T5MZW5J.js.map → fs-D72Y52I5.js.map} +0 -0
- /package/dist/safe-js/chunks/{harness-DLEQ2Z3O.js.map → harness-LUYCGWHZ.js.map} +0 -0
- /package/dist/safe-js/chunks/{mcp-TNVEFJ6K.js.map → mcp-IWKZB2R2.js.map} +0 -0
- /package/dist/safe-js/chunks/{migration-file-IDIUFLKY.js.map → migration-file-IXO5MLP4.js.map} +0 -0
- /package/dist/safe-js/chunks/{restore-P27AUZR2.js.map → restore-SI7HOC6C.js.map} +0 -0
- /package/dist/safe-js/chunks/{run-KGAEHYMV.js.map → run-SHI2PYR6.js.map} +0 -0
- /package/dist/safe-js/chunks/{runtime-modules-KICK45EE.js.map → runtime-modules-OO72HTVF.js.map} +0 -0
|
@@ -2,14 +2,14 @@ import {
|
|
|
2
2
|
HostCallJournal,
|
|
3
3
|
decodeReplayData,
|
|
4
4
|
validateSnapshotData
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-DNA7BMBY.js";
|
|
6
6
|
import {
|
|
7
7
|
CompileScope,
|
|
8
8
|
SandboxError,
|
|
9
9
|
functionSources,
|
|
10
10
|
parse,
|
|
11
11
|
parseModule
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-ILYJBA2D.js";
|
|
13
13
|
|
|
14
14
|
// packages/safe-js/src/parse/hash.ts
|
|
15
15
|
var FNV_OFFSET_BASIS = 2166136261;
|
|
@@ -219,4 +219,4 @@ export {
|
|
|
219
219
|
validateMigrationReconciliation,
|
|
220
220
|
validateSnapshotMigration
|
|
221
221
|
};
|
|
222
|
-
//# sourceMappingURL=chunk-
|
|
222
|
+
//# sourceMappingURL=chunk-GMPZBMPA.js.map
|
|
@@ -228,6 +228,8 @@ var BudgetAccounting = class {
|
|
|
228
228
|
};
|
|
229
229
|
var Budget = class _Budget {
|
|
230
230
|
accounting;
|
|
231
|
+
realmView = false;
|
|
232
|
+
realmLease = false;
|
|
231
233
|
constructor(options = {}) {
|
|
232
234
|
this.accounting = new BudgetAccounting(options);
|
|
233
235
|
}
|
|
@@ -270,10 +272,29 @@ var Budget = class _Budget {
|
|
|
270
272
|
forkRealm() {
|
|
271
273
|
const view = new _Budget();
|
|
272
274
|
view.accounting = this.accounting;
|
|
275
|
+
view.realmView = true;
|
|
273
276
|
const views = this.accounting.realmViews ??= /* @__PURE__ */ new Set([new WeakRef(this)]);
|
|
274
277
|
views.add(new WeakRef(view));
|
|
275
278
|
return view;
|
|
276
279
|
}
|
|
280
|
+
acquireRealmOwner() {
|
|
281
|
+
if (this.realmLease) throw new SandboxError("reentry");
|
|
282
|
+
const lease = this.acquireCompileOwner(
|
|
283
|
+
!this.realmView,
|
|
284
|
+
this.realmView ? this.accounting.activeCompileOwner : void 0
|
|
285
|
+
);
|
|
286
|
+
this.realmLease = true;
|
|
287
|
+
let released = false;
|
|
288
|
+
return {
|
|
289
|
+
owner: lease.owner,
|
|
290
|
+
release: () => {
|
|
291
|
+
if (released) return;
|
|
292
|
+
released = true;
|
|
293
|
+
this.realmLease = false;
|
|
294
|
+
lease.release();
|
|
295
|
+
}
|
|
296
|
+
};
|
|
297
|
+
}
|
|
277
298
|
visitNode(units = 1) {
|
|
278
299
|
if (!Number.isSafeInteger(units) || units < 0) {
|
|
279
300
|
throw new Error("units must be a non-negative safe integer.");
|
|
@@ -3286,7 +3307,7 @@ function parseExecutableModule(source, filename = "<input>", owner) {
|
|
|
3286
3307
|
compilation.dispose();
|
|
3287
3308
|
}
|
|
3288
3309
|
}
|
|
3289
|
-
function parseEvalScript(source, context = {}, owner) {
|
|
3310
|
+
function parseEvalScript(source, context = {}, owner, filename = "<eval>") {
|
|
3290
3311
|
const compilation = new CompileScope(owner);
|
|
3291
3312
|
try {
|
|
3292
3313
|
const limit = owner?.budget.limits.stringLength;
|
|
@@ -3319,7 +3340,7 @@ function parseEvalScript(source, context = {}, owner) {
|
|
|
3319
3340
|
return { node, strict: grammar.strict };
|
|
3320
3341
|
} catch (error) {
|
|
3321
3342
|
if (error instanceof SandboxError) throw error;
|
|
3322
|
-
throw createSyntaxDiagnostic(source,
|
|
3343
|
+
throw createSyntaxDiagnostic(source, filename, error);
|
|
3323
3344
|
} finally {
|
|
3324
3345
|
compilation.dispose();
|
|
3325
3346
|
}
|
|
@@ -7615,4 +7636,4 @@ export {
|
|
|
7615
7636
|
Float16Array2 as Float16Array,
|
|
7616
7637
|
numericTypedArrayConstructors
|
|
7617
7638
|
};
|
|
7618
|
-
//# sourceMappingURL=chunk-
|
|
7639
|
+
//# sourceMappingURL=chunk-ILYJBA2D.js.map
|