poe-code 11.0.24 → 11.0.26
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 +43 -21
- package/dist/index.js.map +2 -2
- package/dist/metafile.json +1 -1
- package/package.json +1 -1
- package/packages/safejs/dist/chunks/{chunk-CGS4H4L3.js → chunk-4TA6S7L6.js} +43 -21
- package/packages/safejs/dist/chunks/{chunk-CGS4H4L3.js.map → chunk-4TA6S7L6.js.map} +2 -2
- package/packages/safejs/dist/chunks/{chunk-I5FH3SKL.js → chunk-YVBVZ7MR.js} +2 -2
- package/packages/safejs/dist/cli.js +2 -2
- package/packages/safejs/dist/core.js +1 -1
- package/packages/safejs/dist/index.js +2 -2
- package/packages/safejs/dist/interp/host-bridge.js +4 -0
- package/packages/safejs/dist/interp/values.js +4 -0
- package/packages/safejs/dist/restore.js +1 -0
- package/packages/safejs/dist/run.js +14 -8
- package/packages/safejs/dist/snapshot/dump-format.d.ts +1 -1
- package/packages/safejs/dist/snapshot/dump-format.js +1 -1
- package/packages/safejs/dist/snapshot/migration.js +2 -2
- /package/packages/safejs/dist/chunks/{chunk-I5FH3SKL.js.map → chunk-YVBVZ7MR.js.map} +0 -0
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
validateMigrationSemantics,
|
|
28
28
|
validateSnapshotData,
|
|
29
29
|
validateSnapshotMigration
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-4TA6S7L6.js";
|
|
31
31
|
|
|
32
32
|
// packages/safejs/src/migrate.ts
|
|
33
33
|
import { createHash } from "node:crypto";
|
|
@@ -8055,4 +8055,4 @@ export {
|
|
|
8055
8055
|
parseMcpConfig,
|
|
8056
8056
|
makeMcpModule
|
|
8057
8057
|
};
|
|
8058
|
-
//# sourceMappingURL=chunk-
|
|
8058
|
+
//# sourceMappingURL=chunk-YVBVZ7MR.js.map
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
parseMcpConfig,
|
|
21
21
|
splitFrontmatter,
|
|
22
22
|
withBrokenPipeGuard
|
|
23
|
-
} from "./chunks/chunk-
|
|
23
|
+
} from "./chunks/chunk-YVBVZ7MR.js";
|
|
24
24
|
import {
|
|
25
25
|
Budget,
|
|
26
26
|
SandboxError,
|
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
replaceErrorStack,
|
|
33
33
|
restore,
|
|
34
34
|
run
|
|
35
|
-
} from "./chunks/chunk-
|
|
35
|
+
} from "./chunks/chunk-4TA6S7L6.js";
|
|
36
36
|
import "./chunks/chunk-4YIDX44G.js";
|
|
37
37
|
|
|
38
38
|
// packages/safejs/src/cli.ts
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
runWithSpawnUsageAccumulator,
|
|
28
28
|
splitFrontmatter,
|
|
29
29
|
supportsSpawnMode
|
|
30
|
-
} from "./chunks/chunk-
|
|
30
|
+
} from "./chunks/chunk-YVBVZ7MR.js";
|
|
31
31
|
import {
|
|
32
32
|
Budget,
|
|
33
33
|
FileSnapshotBackend,
|
|
@@ -49,7 +49,7 @@ import {
|
|
|
49
49
|
registerPendingHostCallPolicy,
|
|
50
50
|
restore,
|
|
51
51
|
run
|
|
52
|
-
} from "./chunks/chunk-
|
|
52
|
+
} from "./chunks/chunk-4TA6S7L6.js";
|
|
53
53
|
import "./chunks/chunk-4YIDX44G.js";
|
|
54
54
|
|
|
55
55
|
// packages/safejs/src/runner/run-harness.ts
|
|
@@ -571,6 +571,9 @@ function copyHostValueToSandbox(value, stackFrames, options, state, path) {
|
|
|
571
571
|
}, state);
|
|
572
572
|
}
|
|
573
573
|
if (!options.errorData && isPromiseLike(value)) {
|
|
574
|
+
const existing = state.seen.get(value);
|
|
575
|
+
if (existing !== undefined)
|
|
576
|
+
return existing;
|
|
574
577
|
const promise = wrapHostPromiseWithSignal(Promise.resolve(value), options.signal).then((resolved) => {
|
|
575
578
|
try {
|
|
576
579
|
return copyHostValueToSandbox(resolved, stackFrames, options, {
|
|
@@ -590,6 +593,7 @@ function copyHostValueToSandbox(value, stackFrames, options, state, path) {
|
|
|
590
593
|
return Promise.reject(createHostErrorValue(reason, stackFrames, budget));
|
|
591
594
|
});
|
|
592
595
|
const sandboxPromise = createSandboxPromise(promise);
|
|
596
|
+
state.seen.set(value, sandboxPromise);
|
|
593
597
|
const span = getBoundOtelSpan(value);
|
|
594
598
|
if (span !== undefined) {
|
|
595
599
|
bindOtelSpan(promise, span);
|
|
@@ -302,8 +302,12 @@ function copyToSandbox(value, state, path = "<root>", cloneSandboxCollections =
|
|
|
302
302
|
return copy;
|
|
303
303
|
}
|
|
304
304
|
if (isHostPromise(value)) {
|
|
305
|
+
const existing = state.seen.get(value);
|
|
306
|
+
if (existing !== undefined)
|
|
307
|
+
return existing;
|
|
305
308
|
const promise = Promise.resolve(value).then((resolved) => copyToSandbox(resolved, { seen: new WeakMap() }), (reason) => Promise.reject(copyToSandbox(reason, { seen: new WeakMap() })));
|
|
306
309
|
const sandboxPromise = createSandboxPromise(promise);
|
|
310
|
+
state.seen.set(value, sandboxPromise);
|
|
307
311
|
const span = getBoundOtelSpan(value);
|
|
308
312
|
if (span !== undefined) {
|
|
309
313
|
bindOtelSpan(promise, span);
|
|
@@ -20,6 +20,7 @@ export function restore(snapshot, options) {
|
|
|
20
20
|
validateDumpEnvelope(snapshot);
|
|
21
21
|
validateSnapshotMigration(snapshot.migration, snapshot.sourceHash);
|
|
22
22
|
if (snapshot.executionSemantics !== EXECUTION_SEMANTICS &&
|
|
23
|
+
snapshot.executionSemantics !== "jobs-v6" &&
|
|
23
24
|
(snapshot.executionSemantics !== undefined ||
|
|
24
25
|
snapshot.promiseReplay !== undefined ||
|
|
25
26
|
snapshot.replay !== undefined ||
|
|
@@ -71,6 +71,8 @@ export function run(source, options = {}) {
|
|
|
71
71
|
options.signal?.addEventListener("abort", captureCancellationSnapshot, { once: true });
|
|
72
72
|
try {
|
|
73
73
|
const restoredSnapshot = options.snapshot === undefined ? undefined : restore(options.snapshot, { source });
|
|
74
|
+
const executionSemantics = restoredSnapshot?.executionSemantics === "jobs-v6" ? "jobs-v6" : EXECUTION_SEMANTICS;
|
|
75
|
+
const convertInitialInput = (convert) => executionSemantics === "jobs-v6" ? convert() : promiseReplayContext.exit(convert);
|
|
74
76
|
if (restoredSnapshot !== undefined) {
|
|
75
77
|
leaveSnapshotRun = enterSnapshotRun(restoredSnapshot);
|
|
76
78
|
}
|
|
@@ -93,7 +95,7 @@ export function run(source, options = {}) {
|
|
|
93
95
|
resumeNodeId: restoredSnapshot.pendingAwaits?.[0]?.nodeId
|
|
94
96
|
}
|
|
95
97
|
: undefined;
|
|
96
|
-
const callerBindings = options.bindings === undefined
|
|
98
|
+
const callerBindings = convertInitialInput(() => options.bindings === undefined
|
|
97
99
|
? {}
|
|
98
100
|
: wrapCallerInjectedBindings(options.bindings, {
|
|
99
101
|
budget,
|
|
@@ -101,7 +103,7 @@ export function run(source, options = {}) {
|
|
|
101
103
|
moduleId: "<bindings>",
|
|
102
104
|
signal: options.signal,
|
|
103
105
|
lifecycle
|
|
104
|
-
});
|
|
106
|
+
}));
|
|
105
107
|
const builtinBindings = {
|
|
106
108
|
...createConsoleJsonGlobals({
|
|
107
109
|
budget,
|
|
@@ -126,7 +128,7 @@ export function run(source, options = {}) {
|
|
|
126
128
|
}),
|
|
127
129
|
...createRegexGlobals()
|
|
128
130
|
};
|
|
129
|
-
const importMeta = deepCopyToSandbox(options.importMeta ?? {});
|
|
131
|
+
const importMeta = convertInitialInput(() => deepCopyToSandbox(options.importMeta ?? {}));
|
|
130
132
|
if (restoredSnapshot?.migration !== undefined) {
|
|
131
133
|
if (Object.hasOwn(importMeta, "migration"))
|
|
132
134
|
throw new TypeError("import.meta.migration is reserved for migrated checkpoint state.");
|
|
@@ -139,15 +141,15 @@ export function run(source, options = {}) {
|
|
|
139
141
|
}
|
|
140
142
|
const initialInputs = prepareReplayInputs({
|
|
141
143
|
bindings: callerBindings,
|
|
142
|
-
imports: resolveModuleImports(module, options.modules, {
|
|
144
|
+
imports: convertInitialInput(() => resolveModuleImports(module, options.modules, {
|
|
143
145
|
budget,
|
|
144
146
|
hostCalls,
|
|
145
147
|
signal: options.signal,
|
|
146
148
|
allowMissing: restoredSnapshot?.initialInputs !== undefined
|
|
147
|
-
}),
|
|
148
|
-
entryPointArgs: options.entryPointArgs === undefined
|
|
149
|
+
})),
|
|
150
|
+
entryPointArgs: convertInitialInput(() => options.entryPointArgs === undefined
|
|
149
151
|
? undefined
|
|
150
|
-
: deepCopyToSandbox([...options.entryPointArgs]),
|
|
152
|
+
: deepCopyToSandbox([...options.entryPointArgs])),
|
|
151
153
|
importMeta
|
|
152
154
|
}, restoredSnapshot?.initialInputs, (promise, id) => {
|
|
153
155
|
if (promise !== undefined)
|
|
@@ -188,6 +190,7 @@ export function run(source, options = {}) {
|
|
|
188
190
|
});
|
|
189
191
|
snapshotScheduler = activeSnapshotScheduler;
|
|
190
192
|
createFailureSnapshot = () => createRunSnapshot({
|
|
193
|
+
executionSemantics,
|
|
191
194
|
migration: restoredSnapshot?.migration,
|
|
192
195
|
bindings: executionScope.snapshot().bindings,
|
|
193
196
|
clock: options.clock,
|
|
@@ -214,6 +217,7 @@ export function run(source, options = {}) {
|
|
|
214
217
|
}
|
|
215
218
|
const interpreterSnapshot = yieldPoint.snapshot();
|
|
216
219
|
snapshot = createRunSnapshot({
|
|
220
|
+
executionSemantics,
|
|
217
221
|
migration: restoredSnapshot?.migration,
|
|
218
222
|
bindings: interpreterSnapshot.bindings,
|
|
219
223
|
clock: options.clock,
|
|
@@ -258,6 +262,7 @@ export function run(source, options = {}) {
|
|
|
258
262
|
}
|
|
259
263
|
const interpreterSnapshot = yieldPoint.snapshot();
|
|
260
264
|
snapshot = createRunSnapshot({
|
|
265
|
+
executionSemantics,
|
|
261
266
|
migration: restoredSnapshot?.migration,
|
|
262
267
|
bindings: interpreterSnapshot.bindings,
|
|
263
268
|
clock: options.clock,
|
|
@@ -296,6 +301,7 @@ export function run(source, options = {}) {
|
|
|
296
301
|
replayError = error.message;
|
|
297
302
|
}
|
|
298
303
|
const snapshot = createRunSnapshot({
|
|
304
|
+
executionSemantics,
|
|
299
305
|
migration: restoredSnapshot?.migration,
|
|
300
306
|
bindings: executionScope.snapshot().bindings,
|
|
301
307
|
clock: options.clock,
|
|
@@ -459,7 +465,7 @@ function createExecutableNode(module) {
|
|
|
459
465
|
function createRunSnapshot(input) {
|
|
460
466
|
return {
|
|
461
467
|
version: DUMP_FORMAT_VERSION,
|
|
462
|
-
executionSemantics:
|
|
468
|
+
executionSemantics: input.executionSemantics,
|
|
463
469
|
sourceHash: input.sourceHash,
|
|
464
470
|
...(input.migration === undefined ? {} : { migration: structuredClone(input.migration) }),
|
|
465
471
|
bindings: input.bindings,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export const DUMP_FORMAT_VERSION = 1;
|
|
2
|
-
export const EXECUTION_SEMANTICS = "jobs-
|
|
2
|
+
export const EXECUTION_SEMANTICS = "jobs-v7";
|
|
3
3
|
import { assertSnapshotGraphDepth } from "../graph-depth.js";
|
|
4
4
|
import { sandboxErrorTypes } from "../error/shape.js";
|
|
5
5
|
import { getSandboxArgumentEntries, isSandboxArguments } from "../interp/arguments.js";
|
|
@@ -2,8 +2,8 @@ import { HostCallJournal } from "../interp/host-call.js";
|
|
|
2
2
|
import { decodeReplayData } from "./replay-data.js";
|
|
3
3
|
import { validateSnapshotData } from "./validation.js";
|
|
4
4
|
export function validateMigrationSemantics(value) {
|
|
5
|
-
if (!["jobs-v1", "jobs-v2", "jobs-v3", "jobs-v4", "jobs-v5", "jobs-v6"].includes(value))
|
|
6
|
-
throw new TypeError("Migration requires a supported execution-semantics marker (jobs-v1 through jobs-
|
|
5
|
+
if (!["jobs-v1", "jobs-v2", "jobs-v3", "jobs-v4", "jobs-v5", "jobs-v6", "jobs-v7"].includes(value))
|
|
6
|
+
throw new TypeError("Migration requires a supported execution-semantics marker (jobs-v1 through jobs-v7).");
|
|
7
7
|
}
|
|
8
8
|
export function validateMigrationJournal(sourceHash, replay, hostCalls = []) {
|
|
9
9
|
if (replay === undefined)
|
|
File without changes
|