poe-code 4.0.69 → 4.0.70
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/index.js +33 -6
- package/dist/index.js.map +2 -2
- package/dist/metafile.json +1 -1
- package/package.json +1 -1
- package/packages/safejs/dist/random.js +4 -3
- package/packages/safejs/dist/run.d.ts +2 -1
- package/packages/safejs/dist/run.js +18 -2
- package/packages/safejs/dist/snapshot/dump-format.js +7 -0
- package/packages/safejs/dist/snapshot/dump.js +6 -1
- package/packages/safejs/dist/snapshot/replay-data.d.ts +2 -0
- package/packages/safejs/dist/snapshot/replay-data.js +4 -2
- package/packages/safejs/dist/snapshot/validation.js +7 -0
package/dist/index.js
CHANGED
|
@@ -136561,6 +136561,11 @@ var init_arguments2 = __esm({
|
|
|
136561
136561
|
|
|
136562
136562
|
// packages/safejs/src/snapshot/dump-format.ts
|
|
136563
136563
|
function serializeSafeJSSnapshot(snapshot2) {
|
|
136564
|
+
const replayError = Object.getOwnPropertyDescriptor(snapshot2, "replayError");
|
|
136565
|
+
if (replayError !== void 0) {
|
|
136566
|
+
const reason = "value" in replayError && typeof replayError.value === "string" ? replayError.value : "missing resume capability";
|
|
136567
|
+
throw new TypeError(`Snapshot is not replayable: ${reason}`);
|
|
136568
|
+
}
|
|
136564
136569
|
for (const [key3, value] of getEnumerableDataEntries(snapshot2)) {
|
|
136565
136570
|
if (key3 !== "version" && key3 !== "sourceHash" && key3 !== "heap") {
|
|
136566
136571
|
assertSnapshotGraphDepth(value, key3);
|
|
@@ -136777,6 +136782,12 @@ function validateDumpEnvelope(snapshot2) {
|
|
|
136777
136782
|
fail2("unsupportedVersion", "$.version", `expected ${DUMP_FORMAT_VERSION}`);
|
|
136778
136783
|
}
|
|
136779
136784
|
requireNonEmptyString5(root.sourceHash, "$.sourceHash", limits);
|
|
136785
|
+
const replayError = Object.getOwnPropertyDescriptor(root, "replayError");
|
|
136786
|
+
if (replayError !== void 0) {
|
|
136787
|
+
if (!("value" in replayError)) fail2("invalidType", "$.replayError", "must be a data property");
|
|
136788
|
+
const reason = requireNonEmptyString5(replayError.value, "$.replayError", limits);
|
|
136789
|
+
fail2("invalidState", "$.replayError", `snapshot is not replayable: ${reason}`);
|
|
136790
|
+
}
|
|
136780
136791
|
const state = {
|
|
136781
136792
|
allowFunctions: true,
|
|
136782
136793
|
allowUndefined: true,
|
|
@@ -138229,7 +138240,7 @@ function createReplayableRandom(options = {}) {
|
|
|
138229
138240
|
let initialState = options.seed;
|
|
138230
138241
|
if (saved !== void 0) {
|
|
138231
138242
|
const hasLoopState = typeof snapshot2?.loopIterations === "object" && snapshot2.loopIterations !== null && Object.keys(snapshot2.loopIterations).length > 0;
|
|
138232
|
-
const replaysFromStart = Array.isArray(snapshot2?.pendingAwaits) && snapshot2.pendingAwaits.length > 0 &&
|
|
138243
|
+
const replaysFromStart = snapshot2?.replay !== void 0 || Array.isArray(snapshot2?.pendingAwaits) && snapshot2.pendingAwaits.length > 0 && !hasLoopState;
|
|
138233
138244
|
initialState = replaysFromStart ? saved.initialState ?? saved.seed : saved.resumeState ?? saved.state;
|
|
138234
138245
|
}
|
|
138235
138246
|
const generator = createSeededRandom(initialState ?? randomInt(4294967296));
|
|
@@ -138492,11 +138503,11 @@ function encodeReplayData(value, options = {}) {
|
|
|
138492
138503
|
if (isSandboxClosure(entry)) {
|
|
138493
138504
|
capabilityId = options.identifyCapability?.(entry, path189);
|
|
138494
138505
|
if (typeof capabilityId !== "string" || capabilityId.length === 0)
|
|
138495
|
-
throw new
|
|
138506
|
+
throw new MissingReplayCapabilityError("A callable needs an explicit resume capability.");
|
|
138496
138507
|
if (!options.captureCapabilityProperties) return { tag: "capability", id: capabilityId };
|
|
138497
138508
|
}
|
|
138498
138509
|
if (typeof entry !== "object" || isSandboxPromise(entry) || isSandboxGenerator(entry)) {
|
|
138499
|
-
throw new
|
|
138510
|
+
throw new MissingReplayCapabilityError(
|
|
138500
138511
|
"A host result containing a callable or live execution state needs an explicit resume capability."
|
|
138501
138512
|
);
|
|
138502
138513
|
}
|
|
@@ -138719,6 +138730,7 @@ function own(value, key3) {
|
|
|
138719
138730
|
if (!Object.hasOwn(value, key3)) throw new TypeError(`Missing replay data field '${key3}'.`);
|
|
138720
138731
|
return value[key3];
|
|
138721
138732
|
}
|
|
138733
|
+
var MissingReplayCapabilityError;
|
|
138722
138734
|
var init_replay_data = __esm({
|
|
138723
138735
|
"packages/safejs/src/snapshot/replay-data.ts"() {
|
|
138724
138736
|
"use strict";
|
|
@@ -138726,6 +138738,8 @@ var init_replay_data = __esm({
|
|
|
138726
138738
|
init_values();
|
|
138727
138739
|
init_arguments2();
|
|
138728
138740
|
init_validation();
|
|
138741
|
+
MissingReplayCapabilityError = class extends TypeError {
|
|
138742
|
+
};
|
|
138729
138743
|
}
|
|
138730
138744
|
});
|
|
138731
138745
|
|
|
@@ -147654,17 +147668,29 @@ function run(source, options = {}) {
|
|
|
147654
147668
|
scope: executionScope,
|
|
147655
147669
|
snapshot: interpreterSnapshot
|
|
147656
147670
|
});
|
|
147671
|
+
await throwIfReturnedPromiseRejected(result2);
|
|
147672
|
+
await throwIfUnhandledPromiseRejected(promiseTracker);
|
|
147657
147673
|
await activeSnapshotScheduler.finish();
|
|
147674
|
+
let replay;
|
|
147675
|
+
let replayError;
|
|
147676
|
+
try {
|
|
147677
|
+
replay = hostCalls.snapshotReplay();
|
|
147678
|
+
} catch (error3) {
|
|
147679
|
+
if (!(error3 instanceof MissingReplayCapabilityError)) throw error3;
|
|
147680
|
+
replayError = error3.message;
|
|
147681
|
+
}
|
|
147658
147682
|
const snapshot2 = createRunSnapshot({
|
|
147659
147683
|
bindings: executionScope.snapshot().bindings,
|
|
147660
147684
|
clock: options.clock,
|
|
147661
147685
|
hostCalls: hostCalls.snapshot(),
|
|
147686
|
+
replay,
|
|
147687
|
+
initialInputs: initialInputs.snapshot,
|
|
147688
|
+
promiseReplay: promiseReplay.snapshot(),
|
|
147662
147689
|
random,
|
|
147663
147690
|
sourceHash
|
|
147664
147691
|
});
|
|
147692
|
+
if (replayError !== void 0) snapshot2.replayError = replayError;
|
|
147665
147693
|
dumpController.finalize(snapshot2);
|
|
147666
|
-
await throwIfReturnedPromiseRejected(result2);
|
|
147667
|
-
await throwIfUnhandledPromiseRejected(promiseTracker);
|
|
147668
147694
|
return {
|
|
147669
147695
|
...result2,
|
|
147670
147696
|
snapshot: snapshot2
|
|
@@ -147899,6 +147925,7 @@ var init_run7 = __esm({
|
|
|
147899
147925
|
init_scheduler();
|
|
147900
147926
|
init_serialize();
|
|
147901
147927
|
init_replay_inputs();
|
|
147928
|
+
init_replay_data();
|
|
147902
147929
|
UnhandledRejectionError = class extends Error {
|
|
147903
147930
|
reason;
|
|
147904
147931
|
constructor(reason, span) {
|
|
@@ -153849,7 +153876,7 @@ var init_package2 = __esm({
|
|
|
153849
153876
|
"package.json"() {
|
|
153850
153877
|
package_default2 = {
|
|
153851
153878
|
name: "poe-code",
|
|
153852
|
-
version: "4.0.
|
|
153879
|
+
version: "4.0.70",
|
|
153853
153880
|
description: "CLI tool to configure Poe API for developer workflows.",
|
|
153854
153881
|
license: "MIT",
|
|
153855
153882
|
type: "module",
|