@poe-platform/safe-js 0.1.801 → 0.1.803
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-XV5OYKND.js → chunk-6NCYOKZQ.js} +1 -1
- package/dist/safe-js/chunks/{chunk-XOMGWE37.js → chunk-D36FRVNN.js} +2 -2
- package/dist/safe-js/chunks/{chunk-HFRBLE6Y.js → chunk-FUXGXSZC.js} +19 -7
- package/dist/safe-js/chunks/{chunk-F6Y734YA.js → chunk-J565YTXP.js} +2 -2
- package/dist/safe-js/chunks/{chunk-7THYP46K.js → chunk-LVTYTUF5.js} +1 -1
- package/dist/safe-js/chunks/{chunk-CK3YK2EC.js → chunk-SN4G557J.js} +1 -1
- package/dist/safe-js/chunks/{chunk-IB6WAQAE.js → chunk-UQYM4GXB.js} +1 -1
- package/dist/safe-js/chunks/{chunk-YCFOANSU.js → chunk-WEPHHJMR.js} +1 -1
- package/dist/safe-js/chunks/{chunk-PMOXSLM5.js → chunk-WRGATIKL.js} +1 -1
- package/dist/safe-js/chunks/{chunk-QRWRR6IA.js → chunk-ZAOSXSKI.js} +1 -1
- package/dist/safe-js/chunks/{chunk-5RLD4TVI.js → chunk-ZXDUALDQ.js} +3 -0
- package/dist/safe-js/chunks/{cli-runtime-L4IABN2W.js → cli-runtime-QIA3QMTP.js} +7 -7
- package/dist/safe-js/chunks/{dump-KUPBSXSL.js → dump-TGI6PZKL.js} +2 -2
- package/dist/safe-js/chunks/{harness-3DDUS3RY.js → harness-EE3ISLJP.js} +2 -2
- package/dist/safe-js/chunks/{mcp-5TMFK3UE.js → mcp-F5MMOZNP.js} +2 -2
- package/dist/safe-js/chunks/{migration-file-4CYSJ6LO.js → migration-file-W3HZOGXV.js} +3 -3
- package/dist/safe-js/chunks/{restore-GDHBT5ZD.js → restore-MMM4A46M.js} +3 -3
- package/dist/safe-js/chunks/{run-M6N5KCPF.js → run-TKX3IFNH.js} +5 -5
- package/dist/safe-js/chunks/{runtime-modules-MGSXY4BN.js → runtime-modules-HWTUIY5J.js} +2 -2
- package/dist/safe-js/cli.js +2 -2
- package/dist/safe-js/core.js +8 -8
- package/dist/safe-js/index.js +11 -11
- package/dist/safe-js/interp/host-call.d.ts +1 -0
- package/dist/safe-js/modules/fs.js +2 -2
- package/dist/safe-js/portable/chunks/{chunk-2FNMGWDK.js → chunk-BIHLWVUU.js} +3 -0
- package/dist/safe-js/portable/core.js +16 -4
- package/dist/safe-js/portable/modules/fs.js +1 -1
- package/dist/safe-js/workerd.js +18 -3
- package/package.json +2 -2
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
hashParsedAst,
|
|
3
3
|
hashSource,
|
|
4
4
|
validateSnapshotMigration
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-WRGATIKL.js";
|
|
6
6
|
import {
|
|
7
7
|
SnapshotValidationError,
|
|
8
8
|
assertSnapshotInactive,
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
validateDumpEnvelope,
|
|
12
12
|
validateGuestHeapSource,
|
|
13
13
|
validateRuntimeSnapshotDescriptors
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-ZXDUALDQ.js";
|
|
15
15
|
import {
|
|
16
16
|
SandboxError,
|
|
17
17
|
parseExecutableModule,
|
|
@@ -7,15 +7,15 @@ import {
|
|
|
7
7
|
} from "./chunk-ONWFPHUI.js";
|
|
8
8
|
import {
|
|
9
9
|
restore
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-D36FRVNN.js";
|
|
11
11
|
import {
|
|
12
12
|
hashParsedAst,
|
|
13
13
|
hashSource
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-WRGATIKL.js";
|
|
15
15
|
import {
|
|
16
16
|
attachDumpController,
|
|
17
17
|
createDumpController
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-6NCYOKZQ.js";
|
|
19
19
|
import {
|
|
20
20
|
DUMP_FORMAT_VERSION,
|
|
21
21
|
EXECUTION_SEMANTICS,
|
|
@@ -107,7 +107,7 @@ import {
|
|
|
107
107
|
wrapCallerInjectedBindings,
|
|
108
108
|
wrapCancelableBindings,
|
|
109
109
|
wrapHostConstructor
|
|
110
|
-
} from "./chunk-
|
|
110
|
+
} from "./chunk-ZXDUALDQ.js";
|
|
111
111
|
import {
|
|
112
112
|
Budget,
|
|
113
113
|
CompileScope,
|
|
@@ -2102,7 +2102,7 @@ var UnsnapshotableValueError = class extends Error {
|
|
|
2102
2102
|
};
|
|
2103
2103
|
|
|
2104
2104
|
// packages/safe-js/src/snapshot/replay-inputs.ts
|
|
2105
|
-
function prepareReplayInputs(current, saved, preparePromise, onCapabilityRestored, compilation, onInputSymbols) {
|
|
2105
|
+
function prepareReplayInputs(current, saved, preparePromise, onCapabilityRestored, compilation, onInputSymbols, restoredPromiseOrder = []) {
|
|
2106
2106
|
const identities = /* @__PURE__ */ new WeakMap();
|
|
2107
2107
|
const capabilities = /* @__PURE__ */ new Map();
|
|
2108
2108
|
const promises = /* @__PURE__ */ new Map();
|
|
@@ -2197,6 +2197,8 @@ function prepareReplayInputs(current, saved, preparePromise, onCapabilityRestore
|
|
|
2197
2197
|
return isSandboxClosure(value) ? value : void 0;
|
|
2198
2198
|
};
|
|
2199
2199
|
const memo = { nodes: context.nodes, values: /* @__PURE__ */ new Map() };
|
|
2200
|
+
const restoredRootPromises = /* @__PURE__ */ new Set();
|
|
2201
|
+
const restoredNamespacePromises = /* @__PURE__ */ new Map();
|
|
2200
2202
|
if (saved !== void 0) validateSnapshotData(saved);
|
|
2201
2203
|
const snapshot = saved === void 0 ? encodeReplayData(current, {
|
|
2202
2204
|
context,
|
|
@@ -2214,6 +2216,7 @@ function prepareReplayInputs(current, saved, preparePromise, onCapabilityRestore
|
|
|
2214
2216
|
resolveCapability,
|
|
2215
2217
|
resolvePromise: (id) => {
|
|
2216
2218
|
readCapability(id);
|
|
2219
|
+
restoredRootPromises.add(id);
|
|
2217
2220
|
return createSandboxPromise(Promise.resolve(void 0), { trackReplay: false });
|
|
2218
2221
|
}
|
|
2219
2222
|
}, validationScope);
|
|
@@ -2222,7 +2225,8 @@ function prepareReplayInputs(current, saved, preparePromise, onCapabilityRestore
|
|
|
2222
2225
|
if (snapshot.namespaceRoots === null || typeof snapshot.namespaceRoots !== "object" || Array.isArray(snapshot.namespaceRoots))
|
|
2223
2226
|
throw new TypeError("Invalid replay namespace roots.");
|
|
2224
2227
|
const validationCapability = createSandboxClosure({ call: () => void 0 });
|
|
2225
|
-
for (const root of Object.
|
|
2228
|
+
for (const [name, root] of Object.entries(snapshot.namespaceRoots)) {
|
|
2229
|
+
const ids = /* @__PURE__ */ new Set();
|
|
2226
2230
|
const namespace = decodeReplayData({ root, nodes: snapshot.nodes }, {
|
|
2227
2231
|
resolveCapability: (id) => {
|
|
2228
2232
|
readCapability(id);
|
|
@@ -2230,10 +2234,12 @@ function prepareReplayInputs(current, saved, preparePromise, onCapabilityRestore
|
|
|
2230
2234
|
},
|
|
2231
2235
|
resolvePromise: (id) => {
|
|
2232
2236
|
readCapability(id);
|
|
2237
|
+
ids.add(id);
|
|
2233
2238
|
return createSandboxPromise(Promise.resolve(void 0), { trackReplay: false });
|
|
2234
2239
|
}
|
|
2235
2240
|
}, validationScope);
|
|
2236
2241
|
if (!isSandboxModuleNamespace(namespace)) throw new TypeError("Invalid replay module namespace.");
|
|
2242
|
+
restoredNamespacePromises.set(name, ids);
|
|
2237
2243
|
}
|
|
2238
2244
|
}
|
|
2239
2245
|
} finally {
|
|
@@ -2256,6 +2262,7 @@ function prepareReplayInputs(current, saved, preparePromise, onCapabilityRestore
|
|
|
2256
2262
|
promises.set(id, preparePromise(isSandboxPromise(value) ? value : void 0, id));
|
|
2257
2263
|
return promises.get(id);
|
|
2258
2264
|
};
|
|
2265
|
+
for (const id of restoredPromiseOrder) if (restoredRootPromises.has(id)) resolvePromise(id);
|
|
2259
2266
|
if (inputPromises.size > 0) {
|
|
2260
2267
|
memo.values.clear();
|
|
2261
2268
|
for (const [id, symbol] of inputSymbols) memo.values.set(id, symbol);
|
|
@@ -2286,6 +2293,10 @@ function prepareReplayInputs(current, saved, preparePromise, onCapabilityRestore
|
|
|
2286
2293
|
captureNamespace,
|
|
2287
2294
|
prepareNamespace: (namespace, name) => {
|
|
2288
2295
|
captureNamespace(namespace, name);
|
|
2296
|
+
const ids = restoredNamespacePromises.get(name);
|
|
2297
|
+
if (ids !== void 0) {
|
|
2298
|
+
for (const id of restoredPromiseOrder) if (ids.has(id)) resolvePromise(id);
|
|
2299
|
+
}
|
|
2289
2300
|
return decodeReplayData(
|
|
2290
2301
|
{ root: snapshot.namespaceRoots[name], nodes: snapshot.nodes },
|
|
2291
2302
|
{ memo, resolveCapability, resolvePromise, onCapabilityRestored },
|
|
@@ -2492,7 +2503,8 @@ function run(source, options = {}) {
|
|
|
2492
2503
|
prepareInputPromise,
|
|
2493
2504
|
hostCalls.rebindHostCapability.bind(hostCalls),
|
|
2494
2505
|
compilation,
|
|
2495
|
-
hostCalls.registerInputSymbols.bind(hostCalls)
|
|
2506
|
+
hostCalls.registerInputSymbols.bind(hostCalls),
|
|
2507
|
+
hostCalls.inputPromiseOrder()
|
|
2496
2508
|
);
|
|
2497
2509
|
leaveInputReplay = () => {
|
|
2498
2510
|
budget.setRetainedDataUsage(initialInputs, 0);
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
validateMigrationReconciliation,
|
|
11
11
|
validateMigrationSemantics,
|
|
12
12
|
validateSnapshotMigration
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-WRGATIKL.js";
|
|
14
14
|
import {
|
|
15
15
|
DUMP_FORMAT_VERSION,
|
|
16
16
|
EXECUTION_SEMANTICS,
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
serializeSafeJSSnapshot,
|
|
21
21
|
validateDumpEnvelope,
|
|
22
22
|
validateSnapshotData
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-ZXDUALDQ.js";
|
|
24
24
|
import {
|
|
25
25
|
parseModule
|
|
26
26
|
} from "./chunk-A3LXCGMJ.js";
|
|
@@ -45183,6 +45183,9 @@ var HostCallJournal = class {
|
|
|
45183
45183
|
...outcome === void 0 ? {} : { outcome: copyOutcome(outcome) }
|
|
45184
45184
|
}));
|
|
45185
45185
|
}
|
|
45186
|
+
inputPromiseOrder() {
|
|
45187
|
+
return this.records.filter((record4) => record4.moduleId === "<inputs>").map((record4) => record4.operation);
|
|
45188
|
+
}
|
|
45186
45189
|
dispose() {
|
|
45187
45190
|
this.disposed = true;
|
|
45188
45191
|
for (const cancel of this.pendingReconciliations) cancel();
|
|
@@ -72,7 +72,7 @@ async function runCli(argv, options, usage) {
|
|
|
72
72
|
async () => {
|
|
73
73
|
try {
|
|
74
74
|
if (argv[0] === "migrate") {
|
|
75
|
-
const { migrateSnapshotFile } = await import("./migration-file-
|
|
75
|
+
const { migrateSnapshotFile } = await import("./migration-file-W3HZOGXV.js");
|
|
76
76
|
const result = await migrateSnapshotFile({
|
|
77
77
|
...parseMigrationArgs(argv.slice(1)),
|
|
78
78
|
cwd: options.cwd ?? readCurrentWorkingDirectory(),
|
|
@@ -291,12 +291,12 @@ async function assertHarnessFile(input) {
|
|
|
291
291
|
}
|
|
292
292
|
async function runScriptFile(filepath, parsed, options) {
|
|
293
293
|
const [{ run }, { restore }, { dump, dumpCurrent }, { createLintModulesFromRuntimeRegistry }, { makeFsModule }, { makeMcpModule }] = await Promise.all([
|
|
294
|
-
import("./run-
|
|
295
|
-
import("./restore-
|
|
296
|
-
import("./dump-
|
|
297
|
-
import("./runtime-modules-
|
|
294
|
+
import("./run-TKX3IFNH.js"),
|
|
295
|
+
import("./restore-MMM4A46M.js"),
|
|
296
|
+
import("./dump-TGI6PZKL.js"),
|
|
297
|
+
import("./runtime-modules-HWTUIY5J.js"),
|
|
298
298
|
import("../modules/fs.js"),
|
|
299
|
-
import("./mcp-
|
|
299
|
+
import("./mcp-F5MMOZNP.js")
|
|
300
300
|
]);
|
|
301
301
|
const loaded = loadExecutableSource(filepath, await options.readFile(filepath, "utf8"));
|
|
302
302
|
const meta = {
|
|
@@ -534,7 +534,7 @@ async function createRuntime(frontmatter, meta, options) {
|
|
|
534
534
|
};
|
|
535
535
|
}
|
|
536
536
|
const [{ makeHarnessModule }, { makeFsModule }] = await Promise.all([
|
|
537
|
-
import("./harness-
|
|
537
|
+
import("./harness-EE3ISLJP.js"),
|
|
538
538
|
import("../modules/fs.js")
|
|
539
539
|
]);
|
|
540
540
|
const state = {
|
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
dump,
|
|
5
5
|
dumpCurrent,
|
|
6
6
|
serializeRunSnapshot
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-6NCYOKZQ.js";
|
|
8
|
+
import "./chunk-ZXDUALDQ.js";
|
|
9
9
|
import "./chunk-A3LXCGMJ.js";
|
|
10
10
|
import "./chunk-JCHJGIQA.js";
|
|
11
11
|
import "./chunk-CQ52GEHY.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
makeMcpModule
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-UQYM4GXB.js";
|
|
4
4
|
import "./chunk-6H5VC5W5.js";
|
|
5
|
-
import "./chunk-
|
|
5
|
+
import "./chunk-ZXDUALDQ.js";
|
|
6
6
|
import "./chunk-A3LXCGMJ.js";
|
|
7
7
|
import "./chunk-JCHJGIQA.js";
|
|
8
8
|
import "./chunk-CQ52GEHY.js";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
migrateSnapshotFile
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-J565YTXP.js";
|
|
4
4
|
import "./chunk-DIG26TEI.js";
|
|
5
5
|
import "./chunk-ONWFPHUI.js";
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-WRGATIKL.js";
|
|
7
|
+
import "./chunk-ZXDUALDQ.js";
|
|
8
8
|
import "./chunk-A3LXCGMJ.js";
|
|
9
9
|
import "./chunk-MMN3IESA.js";
|
|
10
10
|
import "./chunk-JCHJGIQA.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SnapshotMismatchError,
|
|
3
3
|
restore
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-D36FRVNN.js";
|
|
5
|
+
import "./chunk-WRGATIKL.js";
|
|
6
|
+
import "./chunk-ZXDUALDQ.js";
|
|
7
7
|
import "./chunk-A3LXCGMJ.js";
|
|
8
8
|
import "./chunk-JCHJGIQA.js";
|
|
9
9
|
import "./chunk-CQ52GEHY.js";
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
UnhandledRejectionError,
|
|
3
3
|
run
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-FUXGXSZC.js";
|
|
5
5
|
import "./chunk-DHGJSEFX.js";
|
|
6
6
|
import "./chunk-DIG26TEI.js";
|
|
7
7
|
import "./chunk-ONWFPHUI.js";
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-D36FRVNN.js";
|
|
9
|
+
import "./chunk-WRGATIKL.js";
|
|
10
|
+
import "./chunk-6NCYOKZQ.js";
|
|
11
|
+
import "./chunk-ZXDUALDQ.js";
|
|
12
12
|
import "./chunk-A3LXCGMJ.js";
|
|
13
13
|
import "./chunk-MMN3IESA.js";
|
|
14
14
|
import "./chunk-JCHJGIQA.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createLintModulesFromRuntimeRegistry
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-LVTYTUF5.js";
|
|
4
|
+
import "./chunk-ZXDUALDQ.js";
|
|
5
5
|
import "./chunk-A3LXCGMJ.js";
|
|
6
6
|
import "./chunk-JCHJGIQA.js";
|
|
7
7
|
import "./chunk-CQ52GEHY.js";
|
package/dist/safe-js/cli.js
CHANGED
|
@@ -13,7 +13,7 @@ import path from "node:path";
|
|
|
13
13
|
import { fileURLToPath } from "node:url";
|
|
14
14
|
async function runCli(argv, options = {}) {
|
|
15
15
|
if (!argv.includes("--help") && !argv.includes("-h")) {
|
|
16
|
-
const runtime = await import("./chunks/cli-runtime-
|
|
16
|
+
const runtime = await import("./chunks/cli-runtime-QIA3QMTP.js");
|
|
17
17
|
return runtime.runCli(argv, options, createUsage());
|
|
18
18
|
}
|
|
19
19
|
const brokenPipe = createBrokenPipeState();
|
|
@@ -32,7 +32,7 @@ async function runCli(argv, options = {}) {
|
|
|
32
32
|
stderr.write(`${error instanceof Error ? error.message : String(error)}
|
|
33
33
|
`);
|
|
34
34
|
if (brokenPipe.closed) return 0;
|
|
35
|
-
const { exitCodeForError } = await import("./chunks/cli-runtime-
|
|
35
|
+
const { exitCodeForError } = await import("./chunks/cli-runtime-QIA3QMTP.js");
|
|
36
36
|
return exitCodeForError(error);
|
|
37
37
|
}
|
|
38
38
|
}
|
package/dist/safe-js/core.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
makeTimeModule
|
|
3
|
-
} from "./chunks/chunk-
|
|
3
|
+
} from "./chunks/chunk-ZAOSXSKI.js";
|
|
4
4
|
import {
|
|
5
5
|
makeHarnessModule
|
|
6
|
-
} from "./chunks/chunk-
|
|
6
|
+
} from "./chunks/chunk-SN4G557J.js";
|
|
7
7
|
import {
|
|
8
8
|
EnvAccessError,
|
|
9
9
|
HarnessFailure,
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
import {
|
|
17
17
|
FS_OPTION_SURFACE,
|
|
18
18
|
makeFsModule
|
|
19
|
-
} from "./chunks/chunk-
|
|
19
|
+
} from "./chunks/chunk-WEPHHJMR.js";
|
|
20
20
|
import {
|
|
21
21
|
createRootedSourceResolver
|
|
22
22
|
} from "./chunks/chunk-3NFTBEZR.js";
|
|
@@ -24,17 +24,17 @@ import {
|
|
|
24
24
|
createRealm,
|
|
25
25
|
createReplayableRandom,
|
|
26
26
|
run
|
|
27
|
-
} from "./chunks/chunk-
|
|
27
|
+
} from "./chunks/chunk-FUXGXSZC.js";
|
|
28
28
|
import "./chunks/chunk-DHGJSEFX.js";
|
|
29
29
|
import "./chunks/chunk-DIG26TEI.js";
|
|
30
30
|
import "./chunks/chunk-ONWFPHUI.js";
|
|
31
|
-
import "./chunks/chunk-
|
|
32
|
-
import "./chunks/chunk-
|
|
33
|
-
import "./chunks/chunk-
|
|
31
|
+
import "./chunks/chunk-D36FRVNN.js";
|
|
32
|
+
import "./chunks/chunk-WRGATIKL.js";
|
|
33
|
+
import "./chunks/chunk-6NCYOKZQ.js";
|
|
34
34
|
import {
|
|
35
35
|
admitNativePromiseProperties,
|
|
36
36
|
defineExtension
|
|
37
|
-
} from "./chunks/chunk-
|
|
37
|
+
} from "./chunks/chunk-ZXDUALDQ.js";
|
|
38
38
|
import {
|
|
39
39
|
Budget
|
|
40
40
|
} from "./chunks/chunk-A3LXCGMJ.js";
|
package/dist/safe-js/index.js
CHANGED
|
@@ -2,13 +2,13 @@ import {
|
|
|
2
2
|
inspectSnapshotMigration,
|
|
3
3
|
migrateSnapshot,
|
|
4
4
|
migrateSnapshotFile
|
|
5
|
-
} from "./chunks/chunk-
|
|
5
|
+
} from "./chunks/chunk-J565YTXP.js";
|
|
6
6
|
import {
|
|
7
7
|
createLintModulesFromRuntimeRegistry
|
|
8
|
-
} from "./chunks/chunk-
|
|
8
|
+
} from "./chunks/chunk-LVTYTUF5.js";
|
|
9
9
|
import {
|
|
10
10
|
makeMcpModule
|
|
11
|
-
} from "./chunks/chunk-
|
|
11
|
+
} from "./chunks/chunk-UQYM4GXB.js";
|
|
12
12
|
import {
|
|
13
13
|
AgentSpawnError,
|
|
14
14
|
SPAWN_MODES,
|
|
@@ -30,10 +30,10 @@ import {
|
|
|
30
30
|
} from "./chunks/chunk-6H5VC5W5.js";
|
|
31
31
|
import {
|
|
32
32
|
makeTimeModule
|
|
33
|
-
} from "./chunks/chunk-
|
|
33
|
+
} from "./chunks/chunk-ZAOSXSKI.js";
|
|
34
34
|
import {
|
|
35
35
|
makeHarnessModule
|
|
36
|
-
} from "./chunks/chunk-
|
|
36
|
+
} from "./chunks/chunk-SN4G557J.js";
|
|
37
37
|
import {
|
|
38
38
|
EnvAccessError,
|
|
39
39
|
lint,
|
|
@@ -45,7 +45,7 @@ import {
|
|
|
45
45
|
import "./chunks/chunk-X3YCE3ZH.js";
|
|
46
46
|
import {
|
|
47
47
|
makeFsModule
|
|
48
|
-
} from "./chunks/chunk-
|
|
48
|
+
} from "./chunks/chunk-WEPHHJMR.js";
|
|
49
49
|
import {
|
|
50
50
|
createRootedSourceResolver
|
|
51
51
|
} from "./chunks/chunk-3NFTBEZR.js";
|
|
@@ -54,7 +54,7 @@ import {
|
|
|
54
54
|
createRealm,
|
|
55
55
|
createReplayableRandom,
|
|
56
56
|
run
|
|
57
|
-
} from "./chunks/chunk-
|
|
57
|
+
} from "./chunks/chunk-FUXGXSZC.js";
|
|
58
58
|
import "./chunks/chunk-DHGJSEFX.js";
|
|
59
59
|
import {
|
|
60
60
|
fsCodec
|
|
@@ -64,11 +64,11 @@ import {
|
|
|
64
64
|
} from "./chunks/chunk-ONWFPHUI.js";
|
|
65
65
|
import {
|
|
66
66
|
restore
|
|
67
|
-
} from "./chunks/chunk-
|
|
68
|
-
import "./chunks/chunk-
|
|
67
|
+
} from "./chunks/chunk-D36FRVNN.js";
|
|
68
|
+
import "./chunks/chunk-WRGATIKL.js";
|
|
69
69
|
import {
|
|
70
70
|
dump
|
|
71
|
-
} from "./chunks/chunk-
|
|
71
|
+
} from "./chunks/chunk-6NCYOKZQ.js";
|
|
72
72
|
import {
|
|
73
73
|
HostCallResumabilityError,
|
|
74
74
|
HostOperationResumePolicyError,
|
|
@@ -79,7 +79,7 @@ import {
|
|
|
79
79
|
deepCopyToSandbox,
|
|
80
80
|
defineExtension,
|
|
81
81
|
registerPendingHostCallPolicy
|
|
82
|
-
} from "./chunks/chunk-
|
|
82
|
+
} from "./chunks/chunk-ZXDUALDQ.js";
|
|
83
83
|
import {
|
|
84
84
|
Budget,
|
|
85
85
|
SandboxError,
|
|
@@ -155,6 +155,7 @@ export declare class HostCallJournal {
|
|
|
155
155
|
reconcile(record: HostCallRecord, context?: HostCallResumeContext): Promise<HostCallOutcome>;
|
|
156
156
|
private awaitReconciliation;
|
|
157
157
|
snapshot(): HostCallRecord[];
|
|
158
|
+
inputPromiseOrder(): string[];
|
|
158
159
|
dispose(): void;
|
|
159
160
|
registerCallbackFunction(record: HostCallRecord, id: number, closure: SandboxClosure, native: object): void;
|
|
160
161
|
registerHostCapability(path: string, closure: SandboxClosure, native: object): void;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
FS_OPTION_SURFACE,
|
|
3
3
|
makeFsModule
|
|
4
|
-
} from "../chunks/chunk-
|
|
4
|
+
} from "../chunks/chunk-WEPHHJMR.js";
|
|
5
5
|
import "../chunks/chunk-DIG26TEI.js";
|
|
6
6
|
import "../chunks/chunk-ONWFPHUI.js";
|
|
7
|
-
import "../chunks/chunk-
|
|
7
|
+
import "../chunks/chunk-ZXDUALDQ.js";
|
|
8
8
|
import "../chunks/chunk-A3LXCGMJ.js";
|
|
9
9
|
import "../chunks/chunk-MMN3IESA.js";
|
|
10
10
|
import "../chunks/chunk-JCHJGIQA.js";
|
|
@@ -51275,6 +51275,9 @@ var HostCallJournal = class {
|
|
|
51275
51275
|
...outcome === void 0 ? {} : { outcome: copyOutcome(outcome) }
|
|
51276
51276
|
}));
|
|
51277
51277
|
}
|
|
51278
|
+
inputPromiseOrder() {
|
|
51279
|
+
return this.records.filter((record5) => record5.moduleId === "<inputs>").map((record5) => record5.operation);
|
|
51280
|
+
}
|
|
51278
51281
|
dispose() {
|
|
51279
51282
|
this.disposed = true;
|
|
51280
51283
|
for (const cancel of this.pendingReconciliations) cancel();
|
|
@@ -119,7 +119,7 @@ import {
|
|
|
119
119
|
wrapCallerInjectedBindings,
|
|
120
120
|
wrapCancelableBindings,
|
|
121
121
|
wrapHostConstructor
|
|
122
|
-
} from "./chunks/chunk-
|
|
122
|
+
} from "./chunks/chunk-BIHLWVUU.js";
|
|
123
123
|
import {
|
|
124
124
|
createRootedSourceResolver
|
|
125
125
|
} from "./chunks/chunk-XCTU25SU.js";
|
|
@@ -13659,7 +13659,7 @@ var UnsnapshotableValueError = class extends Error {
|
|
|
13659
13659
|
};
|
|
13660
13660
|
|
|
13661
13661
|
// packages/safe-js/src/snapshot/replay-inputs.ts
|
|
13662
|
-
function prepareReplayInputs(current, saved, preparePromise, onCapabilityRestored, compilation, onInputSymbols) {
|
|
13662
|
+
function prepareReplayInputs(current, saved, preparePromise, onCapabilityRestored, compilation, onInputSymbols, restoredPromiseOrder = []) {
|
|
13663
13663
|
const identities = /* @__PURE__ */ new WeakMap();
|
|
13664
13664
|
const capabilities = /* @__PURE__ */ new Map();
|
|
13665
13665
|
const promises = /* @__PURE__ */ new Map();
|
|
@@ -13754,6 +13754,8 @@ function prepareReplayInputs(current, saved, preparePromise, onCapabilityRestore
|
|
|
13754
13754
|
return isSandboxClosure(value) ? value : void 0;
|
|
13755
13755
|
};
|
|
13756
13756
|
const memo = { nodes: context.nodes, values: /* @__PURE__ */ new Map() };
|
|
13757
|
+
const restoredRootPromises = /* @__PURE__ */ new Set();
|
|
13758
|
+
const restoredNamespacePromises = /* @__PURE__ */ new Map();
|
|
13757
13759
|
if (saved !== void 0) validateSnapshotData(saved);
|
|
13758
13760
|
const snapshot = saved === void 0 ? encodeReplayData(current, {
|
|
13759
13761
|
context,
|
|
@@ -13771,6 +13773,7 @@ function prepareReplayInputs(current, saved, preparePromise, onCapabilityRestore
|
|
|
13771
13773
|
resolveCapability,
|
|
13772
13774
|
resolvePromise: (id) => {
|
|
13773
13775
|
readCapability(id);
|
|
13776
|
+
restoredRootPromises.add(id);
|
|
13774
13777
|
return createSandboxPromise(Promise.resolve(void 0), { trackReplay: false });
|
|
13775
13778
|
}
|
|
13776
13779
|
}, validationScope);
|
|
@@ -13779,7 +13782,8 @@ function prepareReplayInputs(current, saved, preparePromise, onCapabilityRestore
|
|
|
13779
13782
|
if (snapshot.namespaceRoots === null || typeof snapshot.namespaceRoots !== "object" || Array.isArray(snapshot.namespaceRoots))
|
|
13780
13783
|
throw new TypeError("Invalid replay namespace roots.");
|
|
13781
13784
|
const validationCapability = createSandboxClosure({ call: () => void 0 });
|
|
13782
|
-
for (const root of Object.
|
|
13785
|
+
for (const [name, root] of Object.entries(snapshot.namespaceRoots)) {
|
|
13786
|
+
const ids = /* @__PURE__ */ new Set();
|
|
13783
13787
|
const namespace = decodeReplayData({ root, nodes: snapshot.nodes }, {
|
|
13784
13788
|
resolveCapability: (id) => {
|
|
13785
13789
|
readCapability(id);
|
|
@@ -13787,10 +13791,12 @@ function prepareReplayInputs(current, saved, preparePromise, onCapabilityRestore
|
|
|
13787
13791
|
},
|
|
13788
13792
|
resolvePromise: (id) => {
|
|
13789
13793
|
readCapability(id);
|
|
13794
|
+
ids.add(id);
|
|
13790
13795
|
return createSandboxPromise(Promise.resolve(void 0), { trackReplay: false });
|
|
13791
13796
|
}
|
|
13792
13797
|
}, validationScope);
|
|
13793
13798
|
if (!isSandboxModuleNamespace(namespace)) throw new TypeError("Invalid replay module namespace.");
|
|
13799
|
+
restoredNamespacePromises.set(name, ids);
|
|
13794
13800
|
}
|
|
13795
13801
|
}
|
|
13796
13802
|
} finally {
|
|
@@ -13813,6 +13819,7 @@ function prepareReplayInputs(current, saved, preparePromise, onCapabilityRestore
|
|
|
13813
13819
|
promises.set(id, preparePromise(isSandboxPromise(value) ? value : void 0, id));
|
|
13814
13820
|
return promises.get(id);
|
|
13815
13821
|
};
|
|
13822
|
+
for (const id of restoredPromiseOrder) if (restoredRootPromises.has(id)) resolvePromise(id);
|
|
13816
13823
|
if (inputPromises.size > 0) {
|
|
13817
13824
|
memo.values.clear();
|
|
13818
13825
|
for (const [id, symbol] of inputSymbols) memo.values.set(id, symbol);
|
|
@@ -13843,6 +13850,10 @@ function prepareReplayInputs(current, saved, preparePromise, onCapabilityRestore
|
|
|
13843
13850
|
captureNamespace,
|
|
13844
13851
|
prepareNamespace: (namespace, name) => {
|
|
13845
13852
|
captureNamespace(namespace, name);
|
|
13853
|
+
const ids = restoredNamespacePromises.get(name);
|
|
13854
|
+
if (ids !== void 0) {
|
|
13855
|
+
for (const id of restoredPromiseOrder) if (ids.has(id)) resolvePromise(id);
|
|
13856
|
+
}
|
|
13846
13857
|
return decodeReplayData(
|
|
13847
13858
|
{ root: snapshot.namespaceRoots[name], nodes: snapshot.nodes },
|
|
13848
13859
|
{ memo, resolveCapability, resolvePromise, onCapabilityRestored },
|
|
@@ -14049,7 +14060,8 @@ function run(source, options = {}) {
|
|
|
14049
14060
|
prepareInputPromise,
|
|
14050
14061
|
hostCalls.rebindHostCapability.bind(hostCalls),
|
|
14051
14062
|
compilation,
|
|
14052
|
-
hostCalls.registerInputSymbols.bind(hostCalls)
|
|
14063
|
+
hostCalls.registerInputSymbols.bind(hostCalls),
|
|
14064
|
+
hostCalls.inputPromiseOrder()
|
|
14053
14065
|
);
|
|
14054
14066
|
leaveInputReplay = () => {
|
|
14055
14067
|
budget.setRetainedDataUsage(initialInputs, 0);
|
package/dist/safe-js/workerd.js
CHANGED
|
@@ -66252,6 +66252,9 @@ var HostCallJournal = class {
|
|
|
66252
66252
|
...outcome === void 0 ? {} : { outcome: copyOutcome(outcome) }
|
|
66253
66253
|
}));
|
|
66254
66254
|
}
|
|
66255
|
+
inputPromiseOrder() {
|
|
66256
|
+
return this.records.filter((record5) => record5.moduleId === "<inputs>").map((record5) => record5.operation);
|
|
66257
|
+
}
|
|
66255
66258
|
dispose() {
|
|
66256
66259
|
this.disposed = true;
|
|
66257
66260
|
for (const cancel of this.pendingReconciliations) cancel();
|
|
@@ -72531,7 +72534,7 @@ var UnsnapshotableValueError = class extends Error {
|
|
|
72531
72534
|
};
|
|
72532
72535
|
|
|
72533
72536
|
// packages/safe-js/src/snapshot/replay-inputs.ts
|
|
72534
|
-
function prepareReplayInputs(current, saved, preparePromise, onCapabilityRestored, compilation, onInputSymbols) {
|
|
72537
|
+
function prepareReplayInputs(current, saved, preparePromise, onCapabilityRestored, compilation, onInputSymbols, restoredPromiseOrder = []) {
|
|
72535
72538
|
const identities2 = /* @__PURE__ */ new WeakMap();
|
|
72536
72539
|
const capabilities = /* @__PURE__ */ new Map();
|
|
72537
72540
|
const promises = /* @__PURE__ */ new Map();
|
|
@@ -72626,6 +72629,8 @@ function prepareReplayInputs(current, saved, preparePromise, onCapabilityRestore
|
|
|
72626
72629
|
return isSandboxClosure(value) ? value : void 0;
|
|
72627
72630
|
};
|
|
72628
72631
|
const memo = { nodes: context.nodes, values: /* @__PURE__ */ new Map() };
|
|
72632
|
+
const restoredRootPromises = /* @__PURE__ */ new Set();
|
|
72633
|
+
const restoredNamespacePromises = /* @__PURE__ */ new Map();
|
|
72629
72634
|
if (saved !== void 0) validateSnapshotData(saved);
|
|
72630
72635
|
const snapshot = saved === void 0 ? encodeReplayData(current, {
|
|
72631
72636
|
context,
|
|
@@ -72643,6 +72648,7 @@ function prepareReplayInputs(current, saved, preparePromise, onCapabilityRestore
|
|
|
72643
72648
|
resolveCapability,
|
|
72644
72649
|
resolvePromise: (id) => {
|
|
72645
72650
|
readCapability(id);
|
|
72651
|
+
restoredRootPromises.add(id);
|
|
72646
72652
|
return createSandboxPromise(Promise.resolve(void 0), { trackReplay: false });
|
|
72647
72653
|
}
|
|
72648
72654
|
}, validationScope);
|
|
@@ -72651,7 +72657,8 @@ function prepareReplayInputs(current, saved, preparePromise, onCapabilityRestore
|
|
|
72651
72657
|
if (snapshot.namespaceRoots === null || typeof snapshot.namespaceRoots !== "object" || Array.isArray(snapshot.namespaceRoots))
|
|
72652
72658
|
throw new TypeError("Invalid replay namespace roots.");
|
|
72653
72659
|
const validationCapability = createSandboxClosure({ call: () => void 0 });
|
|
72654
|
-
for (const root of Object.
|
|
72660
|
+
for (const [name, root] of Object.entries(snapshot.namespaceRoots)) {
|
|
72661
|
+
const ids = /* @__PURE__ */ new Set();
|
|
72655
72662
|
const namespace = decodeReplayData({ root, nodes: snapshot.nodes }, {
|
|
72656
72663
|
resolveCapability: (id) => {
|
|
72657
72664
|
readCapability(id);
|
|
@@ -72659,10 +72666,12 @@ function prepareReplayInputs(current, saved, preparePromise, onCapabilityRestore
|
|
|
72659
72666
|
},
|
|
72660
72667
|
resolvePromise: (id) => {
|
|
72661
72668
|
readCapability(id);
|
|
72669
|
+
ids.add(id);
|
|
72662
72670
|
return createSandboxPromise(Promise.resolve(void 0), { trackReplay: false });
|
|
72663
72671
|
}
|
|
72664
72672
|
}, validationScope);
|
|
72665
72673
|
if (!isSandboxModuleNamespace(namespace)) throw new TypeError("Invalid replay module namespace.");
|
|
72674
|
+
restoredNamespacePromises.set(name, ids);
|
|
72666
72675
|
}
|
|
72667
72676
|
}
|
|
72668
72677
|
} finally {
|
|
@@ -72685,6 +72694,7 @@ function prepareReplayInputs(current, saved, preparePromise, onCapabilityRestore
|
|
|
72685
72694
|
promises.set(id, preparePromise(isSandboxPromise(value) ? value : void 0, id));
|
|
72686
72695
|
return promises.get(id);
|
|
72687
72696
|
};
|
|
72697
|
+
for (const id of restoredPromiseOrder) if (restoredRootPromises.has(id)) resolvePromise(id);
|
|
72688
72698
|
if (inputPromises.size > 0) {
|
|
72689
72699
|
memo.values.clear();
|
|
72690
72700
|
for (const [id, symbol] of inputSymbols) memo.values.set(id, symbol);
|
|
@@ -72715,6 +72725,10 @@ function prepareReplayInputs(current, saved, preparePromise, onCapabilityRestore
|
|
|
72715
72725
|
captureNamespace,
|
|
72716
72726
|
prepareNamespace: (namespace, name) => {
|
|
72717
72727
|
captureNamespace(namespace, name);
|
|
72728
|
+
const ids = restoredNamespacePromises.get(name);
|
|
72729
|
+
if (ids !== void 0) {
|
|
72730
|
+
for (const id of restoredPromiseOrder) if (ids.has(id)) resolvePromise(id);
|
|
72731
|
+
}
|
|
72718
72732
|
return decodeReplayData(
|
|
72719
72733
|
{ root: snapshot.namespaceRoots[name], nodes: snapshot.nodes },
|
|
72720
72734
|
{ memo, resolveCapability, resolvePromise, onCapabilityRestored },
|
|
@@ -72921,7 +72935,8 @@ function run(source, options = {}) {
|
|
|
72921
72935
|
prepareInputPromise,
|
|
72922
72936
|
hostCalls.rebindHostCapability.bind(hostCalls),
|
|
72923
72937
|
compilation,
|
|
72924
|
-
hostCalls.registerInputSymbols.bind(hostCalls)
|
|
72938
|
+
hostCalls.registerInputSymbols.bind(hostCalls),
|
|
72939
|
+
hostCalls.inputPromiseOrder()
|
|
72925
72940
|
);
|
|
72926
72941
|
leaveInputReplay = () => {
|
|
72927
72942
|
budget.setRetainedDataUsage(initialInputs, 0);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@poe-platform/safe-js",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.803",
|
|
4
4
|
"description": "Budgeted JavaScript interpreter with explicit host capabilities and resumable execution",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"access": "public"
|
|
83
83
|
},
|
|
84
84
|
"dependencies": {
|
|
85
|
-
"@poe-platform/safe-fs": "0.1.
|
|
85
|
+
"@poe-platform/safe-fs": "0.1.803",
|
|
86
86
|
"@petamoriken/float16": "^3.9.3",
|
|
87
87
|
"@noble/hashes": "2.4.0",
|
|
88
88
|
"@formatjs/intl-localematcher": "0.8.13",
|