poe-code 10.0.3 → 11.0.0
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/cli/commands/harness.js +27 -1
- package/dist/cli/commands/harness.js.map +1 -1
- package/dist/index.js +1125 -888
- package/dist/index.js.map +4 -4
- package/dist/metafile.json +1 -1
- package/package.json +1 -1
- package/packages/agent-harness/dist/loader/run.js +4 -1
- package/packages/safejs/dist/chunks/{chunk-MRH5YDMR.js → chunk-ARFGEQTM.js} +213 -51
- package/packages/safejs/dist/chunks/chunk-ARFGEQTM.js.map +7 -0
- package/packages/safejs/dist/chunks/{chunk-A2XBEN3H.js → chunk-DKXGPEOM.js} +182 -133
- package/packages/safejs/dist/chunks/{chunk-A2XBEN3H.js.map → chunk-DKXGPEOM.js.map} +3 -3
- package/packages/safejs/dist/cli.js +51 -2
- package/packages/safejs/dist/cli.js.map +2 -2
- package/packages/safejs/dist/core.js +1 -1
- package/packages/safejs/dist/index.d.ts +3 -0
- package/packages/safejs/dist/index.js +8 -2
- package/packages/safejs/dist/index.js.map +1 -1
- package/packages/safejs/dist/interp/interpreter.js +73 -127
- package/packages/safejs/dist/interp/scope.js +3 -3
- package/packages/safejs/dist/migrate.d.ts +33 -0
- package/packages/safejs/dist/migrate.js +70 -0
- package/packages/safejs/dist/migration-file.d.ts +55 -0
- package/packages/safejs/dist/migration-file.js +79 -0
- package/packages/safejs/dist/restore.d.ts +2 -0
- package/packages/safejs/dist/restore.js +2 -0
- package/packages/safejs/dist/run.js +18 -2
- 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.d.ts +34 -0
- package/packages/safejs/dist/snapshot/migration.js +92 -0
- package/packages/safejs/dist/snapshot/validation.js +0 -4
- package/packages/safejs/dist/chunks/chunk-MRH5YDMR.js.map +0 -7
|
@@ -16919,7 +16919,7 @@ function serializeArguments(value, serializeValue) {
|
|
|
16919
16919
|
|
|
16920
16920
|
// packages/safejs/src/snapshot/dump-format.ts
|
|
16921
16921
|
var DUMP_FORMAT_VERSION = 1;
|
|
16922
|
-
var EXECUTION_SEMANTICS = "jobs-
|
|
16922
|
+
var EXECUTION_SEMANTICS = "jobs-v6";
|
|
16923
16923
|
var SKIP_VALUE = /* @__PURE__ */ Symbol("SafeJS.skip-dump-value");
|
|
16924
16924
|
function serializeSafeJSSnapshot(snapshot) {
|
|
16925
16925
|
const replayError = Object.getOwnPropertyDescriptor(snapshot, "replayError");
|
|
@@ -17413,9 +17413,6 @@ function validateGenericValue(value, path, depth, state) {
|
|
|
17413
17413
|
if (typeof value === "string") {
|
|
17414
17414
|
requireString(value, path, state.limits);
|
|
17415
17415
|
state.dataSize += value.length;
|
|
17416
|
-
} else if (typeof value === "number") {
|
|
17417
|
-
if (Number.isInteger(value) && !Number.isSafeInteger(value))
|
|
17418
|
-
fail("invalidValue", path, "integer must be safe");
|
|
17419
17416
|
} else if (Array.isArray(value)) {
|
|
17420
17417
|
if (value.length > state.limits.maxEntries) fail("budgetExceeded", path, "array is too large");
|
|
17421
17418
|
if (state.dataPropertiesOnly) {
|
|
@@ -21213,6 +21210,89 @@ function shouldIncludeTemplateRaw(record2, key, includeTemplateRaw) {
|
|
|
21213
21210
|
return false;
|
|
21214
21211
|
}
|
|
21215
21212
|
|
|
21213
|
+
// packages/safejs/src/snapshot/migration.ts
|
|
21214
|
+
function validateMigrationSemantics(value) {
|
|
21215
|
+
if (!["jobs-v1", "jobs-v2", "jobs-v3", "jobs-v4", "jobs-v5", "jobs-v6"].includes(value))
|
|
21216
|
+
throw new TypeError(
|
|
21217
|
+
"Migration requires a supported execution-semantics marker (jobs-v1 through jobs-v6)."
|
|
21218
|
+
);
|
|
21219
|
+
}
|
|
21220
|
+
function validateMigrationJournal(sourceHash, replay, hostCalls = []) {
|
|
21221
|
+
if (replay === void 0)
|
|
21222
|
+
throw new TypeError("Migration requires a complete host replay journal.");
|
|
21223
|
+
if (!Array.isArray(hostCalls)) throw new TypeError("Invalid migration hostCalls.");
|
|
21224
|
+
const journal = new HostCallJournal(sourceHash, hostCalls, void 0, replay);
|
|
21225
|
+
try {
|
|
21226
|
+
const restored = journal.snapshotReplay();
|
|
21227
|
+
for (const call of restored.calls) {
|
|
21228
|
+
if (["created", "running"].includes(call.lifecycle) && call.outcome !== void 0)
|
|
21229
|
+
throw new TypeError("Unresolved migration calls cannot contain a recorded outcome.");
|
|
21230
|
+
for (const callback of call.callbacks ?? []) {
|
|
21231
|
+
if (!call.functions?.includes(callback.id))
|
|
21232
|
+
throw new TypeError("Migration callback has no registered source function.");
|
|
21233
|
+
}
|
|
21234
|
+
}
|
|
21235
|
+
return restored;
|
|
21236
|
+
} finally {
|
|
21237
|
+
journal.dispose();
|
|
21238
|
+
}
|
|
21239
|
+
}
|
|
21240
|
+
function validateMigrationReconciliation(value, checkpointDigest, calls) {
|
|
21241
|
+
validateSnapshotData(value);
|
|
21242
|
+
const receipt = value;
|
|
21243
|
+
if (receipt === null || typeof receipt !== "object" || receipt.checkpointDigest !== checkpointDigest || !isCheckpointDigest(receipt.checkpointDigest))
|
|
21244
|
+
throw new TypeError("Migration reconciliation must identify this exact checkpoint digest.");
|
|
21245
|
+
if (receipt.quiescent !== true)
|
|
21246
|
+
throw new TypeError(
|
|
21247
|
+
"Migration requires explicit host confirmation that execution, operations, and callbacks are quiescent."
|
|
21248
|
+
);
|
|
21249
|
+
if (!Array.isArray(receipt.calls))
|
|
21250
|
+
throw new TypeError("Migration reconciliation calls must be an array.");
|
|
21251
|
+
const pending = new Map(
|
|
21252
|
+
calls.filter((call) => !["settled", "consumed"].includes(call.lifecycle)).map((call) => [call.id, call])
|
|
21253
|
+
);
|
|
21254
|
+
for (const resolution of receipt.calls) {
|
|
21255
|
+
if (resolution === null || typeof resolution !== "object" || !pending.has(resolution.callId))
|
|
21256
|
+
throw new TypeError("Migration contains an unknown or duplicate call resolution.");
|
|
21257
|
+
if (!["not-performed", "fulfilled", "rejected"].includes(resolution.disposition) || resolution.disposition === "fulfilled" && !Object.hasOwn(resolution, "value") || resolution.disposition === "rejected" && !Object.hasOwn(resolution, "reason"))
|
|
21258
|
+
throw new TypeError(
|
|
21259
|
+
"Migration call resolution requires a reconciled outcome or confirmed non-performance."
|
|
21260
|
+
);
|
|
21261
|
+
pending.delete(resolution.callId);
|
|
21262
|
+
}
|
|
21263
|
+
if (pending.size > 0)
|
|
21264
|
+
throw new TypeError(
|
|
21265
|
+
`Migration requires external reconciliation for: ${[...pending.keys()].join(", ")}`
|
|
21266
|
+
);
|
|
21267
|
+
}
|
|
21268
|
+
function validateSnapshotMigration(value, sourceHash) {
|
|
21269
|
+
if (value === void 0) return void 0;
|
|
21270
|
+
validateSnapshotData(value);
|
|
21271
|
+
const migration = value;
|
|
21272
|
+
if (migration === null || typeof migration !== "object" || migration.version !== 1 || !Array.isArray(migration.history) || migration.history.length === 0)
|
|
21273
|
+
throw new TypeError("Invalid snapshot migration history.");
|
|
21274
|
+
decodeReplayData(migration.state);
|
|
21275
|
+
let previousTarget;
|
|
21276
|
+
for (const entry of migration.history) {
|
|
21277
|
+
if (entry === null || typeof entry !== "object" || typeof entry.sourceHash !== "string" || entry.sourceHash.length === 0 || typeof entry.targetSourceHash !== "string" || entry.targetSourceHash.length === 0 || previousTarget !== void 0 && previousTarget !== entry.sourceHash)
|
|
21278
|
+
throw new TypeError("Invalid snapshot migration ancestry.");
|
|
21279
|
+
validateMigrationSemantics(entry.executionSemantics);
|
|
21280
|
+
const replay = validateMigrationJournal(entry.sourceHash, entry.replay);
|
|
21281
|
+
validateMigrationReconciliation(
|
|
21282
|
+
entry.reconciliation,
|
|
21283
|
+
entry.reconciliation?.checkpointDigest,
|
|
21284
|
+
replay.calls
|
|
21285
|
+
);
|
|
21286
|
+
previousTarget = entry.targetSourceHash;
|
|
21287
|
+
}
|
|
21288
|
+
if (previousTarget !== sourceHash)
|
|
21289
|
+
throw new TypeError("Migration ancestry does not match the target source.");
|
|
21290
|
+
return migration;
|
|
21291
|
+
}
|
|
21292
|
+
function isCheckpointDigest(value) {
|
|
21293
|
+
return typeof value === "string" && value.length === 64 && [...value].every((character) => "0123456789abcdef".includes(character));
|
|
21294
|
+
}
|
|
21295
|
+
|
|
21216
21296
|
// packages/safejs/src/restore.ts
|
|
21217
21297
|
var SnapshotMismatchError = class extends Error {
|
|
21218
21298
|
actualHash;
|
|
@@ -21230,6 +21310,7 @@ var SnapshotMismatchError = class extends Error {
|
|
|
21230
21310
|
function restore(snapshot, options) {
|
|
21231
21311
|
assertSnapshotInactive(snapshot);
|
|
21232
21312
|
validateDumpEnvelope(snapshot);
|
|
21313
|
+
validateSnapshotMigration(snapshot.migration, snapshot.sourceHash);
|
|
21233
21314
|
if (snapshot.executionSemantics !== EXECUTION_SEMANTICS && (snapshot.executionSemantics !== void 0 || snapshot.promiseReplay !== void 0 || snapshot.replay !== void 0 || snapshot.initialInputs !== void 0)) {
|
|
21234
21315
|
throw new SnapshotValidationError(
|
|
21235
21316
|
"unsupportedVersion",
|
|
@@ -25339,15 +25420,15 @@ var Scope = class _Scope {
|
|
|
25339
25420
|
throw new ReferenceError(`Cannot assign to undeclared binding '${name}'.`);
|
|
25340
25421
|
}
|
|
25341
25422
|
const binding = scope.#bindings.get(name);
|
|
25342
|
-
if (binding?.kind === "const") {
|
|
25343
|
-
throw new TypeError(`Cannot assign to const binding '${name}'.`);
|
|
25344
|
-
}
|
|
25345
25423
|
if (binding === void 0) {
|
|
25346
25424
|
throw new ReferenceError(`Cannot assign to undeclared binding '${name}'.`);
|
|
25347
25425
|
}
|
|
25348
25426
|
if (binding.value === uninitialized) {
|
|
25349
25427
|
throw new ReferenceError(`Cannot access '${name}' before initialization.`);
|
|
25350
25428
|
}
|
|
25429
|
+
if (binding.kind === "const") {
|
|
25430
|
+
throw new TypeError(`Cannot assign to const binding '${name}'.`);
|
|
25431
|
+
}
|
|
25351
25432
|
scope.#bindings.set(name, {
|
|
25352
25433
|
kind: binding.kind,
|
|
25353
25434
|
value
|
|
@@ -25867,39 +25948,37 @@ async function evaluateAssignmentExpression(node, context) {
|
|
|
25867
25948
|
)
|
|
25868
25949
|
};
|
|
25869
25950
|
}
|
|
25870
|
-
const binding = context.scope.lookup(node.left.name);
|
|
25871
|
-
if (
|
|
25951
|
+
const binding = node.operator === "=" ? void 0 : context.scope.lookup(node.left.name);
|
|
25952
|
+
if (binding?.found === false) {
|
|
25872
25953
|
throw new ReferenceError(`Cannot assign to undeclared binding '${node.left.name}'.`);
|
|
25873
25954
|
}
|
|
25874
|
-
|
|
25875
|
-
|
|
25876
|
-
}
|
|
25877
|
-
if (node.operator === "&&=" && !isTruthy(binding.value)) {
|
|
25955
|
+
const current = binding?.value;
|
|
25956
|
+
if (node.operator === "&&=" && !isTruthy(current)) {
|
|
25878
25957
|
return {
|
|
25879
25958
|
kind: "normal",
|
|
25880
25959
|
hasValue: true,
|
|
25881
|
-
value:
|
|
25960
|
+
value: current
|
|
25882
25961
|
};
|
|
25883
25962
|
}
|
|
25884
|
-
if (node.operator === "||=" && isTruthy(
|
|
25963
|
+
if (node.operator === "||=" && isTruthy(current)) {
|
|
25885
25964
|
return {
|
|
25886
25965
|
kind: "normal",
|
|
25887
25966
|
hasValue: true,
|
|
25888
|
-
value:
|
|
25967
|
+
value: current
|
|
25889
25968
|
};
|
|
25890
25969
|
}
|
|
25891
|
-
if (node.operator === "??=" &&
|
|
25970
|
+
if (node.operator === "??=" && current !== null && current !== void 0) {
|
|
25892
25971
|
return {
|
|
25893
25972
|
kind: "normal",
|
|
25894
25973
|
hasValue: true,
|
|
25895
|
-
value:
|
|
25974
|
+
value: current
|
|
25896
25975
|
};
|
|
25897
25976
|
}
|
|
25898
25977
|
const right = await evaluateNode(node.right, context);
|
|
25899
25978
|
if (right.kind !== "normal") {
|
|
25900
25979
|
return right;
|
|
25901
25980
|
}
|
|
25902
|
-
const value = node.operator === "=" || node.operator === "&&=" || node.operator === "||=" || node.operator === "??=" ? right.value : applyCompoundAssignmentOperator(node.operator,
|
|
25981
|
+
const value = node.operator === "=" || node.operator === "&&=" || node.operator === "||=" || node.operator === "??=" ? right.value : await applyCompoundAssignmentOperator(node.operator, current, right.value, context);
|
|
25903
25982
|
context.scope.assign(node.left.name, value);
|
|
25904
25983
|
return {
|
|
25905
25984
|
kind: "normal",
|
|
@@ -25921,45 +26000,33 @@ async function evaluateMemberAssignmentExpression(node, context) {
|
|
|
25921
26000
|
if (member.kind === "nullish") {
|
|
25922
26001
|
throw new TypeError("Cannot assign properties of null or undefined.");
|
|
25923
26002
|
}
|
|
25924
|
-
|
|
25925
|
-
|
|
25926
|
-
throw new TypeError("RegExp properties only support direct assignment.");
|
|
25927
|
-
}
|
|
25928
|
-
const right2 = await evaluateNode(node.right, context);
|
|
25929
|
-
if (right2.kind !== "normal") return right2;
|
|
25930
|
-
setRegexMember(member.object, member.property, right2.value);
|
|
25931
|
-
return { kind: "normal", hasValue: true, value: right2.value };
|
|
25932
|
-
}
|
|
25933
|
-
if (!isIndexableSandboxValue(member.object)) {
|
|
25934
|
-
throw new TypeError("Assignment expressions require a sandbox object property.");
|
|
25935
|
-
}
|
|
25936
|
-
if (node.operator === "&&=" && !isTruthy(getMemberValue(member.object, member.property, context))) {
|
|
26003
|
+
const current = node.operator === "=" ? void 0 : getPropertyValue(member.object, member.property, context);
|
|
26004
|
+
if (node.operator === "&&=" && !isTruthy(current)) {
|
|
25937
26005
|
return {
|
|
25938
26006
|
kind: "normal",
|
|
25939
26007
|
hasValue: true,
|
|
25940
|
-
value:
|
|
26008
|
+
value: current
|
|
25941
26009
|
};
|
|
25942
26010
|
}
|
|
25943
|
-
if (node.operator === "||=" && isTruthy(
|
|
26011
|
+
if (node.operator === "||=" && isTruthy(current)) {
|
|
25944
26012
|
return {
|
|
25945
26013
|
kind: "normal",
|
|
25946
26014
|
hasValue: true,
|
|
25947
|
-
value:
|
|
26015
|
+
value: current
|
|
25948
26016
|
};
|
|
25949
26017
|
}
|
|
25950
|
-
if (node.operator === "??=" &&
|
|
26018
|
+
if (node.operator === "??=" && current !== null && current !== void 0) {
|
|
25951
26019
|
return {
|
|
25952
26020
|
kind: "normal",
|
|
25953
26021
|
hasValue: true,
|
|
25954
|
-
value:
|
|
26022
|
+
value: current
|
|
25955
26023
|
};
|
|
25956
26024
|
}
|
|
25957
26025
|
const right = await evaluateNode(node.right, context);
|
|
25958
26026
|
if (right.kind !== "normal") {
|
|
25959
26027
|
return right;
|
|
25960
26028
|
}
|
|
25961
|
-
const
|
|
25962
|
-
const value = node.operator === "=" || node.operator === "&&=" || node.operator === "||=" || node.operator === "??=" ? right.value : applyCompoundAssignmentOperator(node.operator, current, right.value, context);
|
|
26029
|
+
const value = node.operator === "=" || node.operator === "&&=" || node.operator === "||=" || node.operator === "??=" ? right.value : await applyCompoundAssignmentOperator(node.operator, current, right.value, context);
|
|
25963
26030
|
setSandboxProperty(member.object, member.property, value);
|
|
25964
26031
|
return {
|
|
25965
26032
|
kind: "normal",
|
|
@@ -26926,10 +26993,7 @@ async function evaluateIdentifierUpdateExpression(node, context) {
|
|
|
26926
26993
|
)
|
|
26927
26994
|
};
|
|
26928
26995
|
}
|
|
26929
|
-
|
|
26930
|
-
throw new TypeError(`Cannot assign to const '${node.argument.name}'`);
|
|
26931
|
-
}
|
|
26932
|
-
const current = Number(binding.value);
|
|
26996
|
+
const current = toNumber(await toNumericPrimitive(binding.value, context));
|
|
26933
26997
|
const next = node.operator === "++" ? current + 1 : current - 1;
|
|
26934
26998
|
context.scope.assign(node.argument.name, next);
|
|
26935
26999
|
return {
|
|
@@ -26952,10 +27016,9 @@ async function evaluateMemberUpdateExpression(node, context) {
|
|
|
26952
27016
|
if (member.kind === "nullish") {
|
|
26953
27017
|
throw new TypeError("Cannot update properties of null or undefined.");
|
|
26954
27018
|
}
|
|
26955
|
-
|
|
26956
|
-
|
|
26957
|
-
|
|
26958
|
-
const current = Number(getMemberValue(member.object, member.property, context));
|
|
27019
|
+
const current = toNumber(
|
|
27020
|
+
await toNumericPrimitive(getPropertyValue(member.object, member.property, context), context)
|
|
27021
|
+
);
|
|
26959
27022
|
const next = node.operator === "++" ? current + 1 : current - 1;
|
|
26960
27023
|
setSandboxProperty(member.object, member.property, next);
|
|
26961
27024
|
return {
|
|
@@ -26966,94 +27029,33 @@ async function evaluateMemberUpdateExpression(node, context) {
|
|
|
26966
27029
|
}
|
|
26967
27030
|
async function evaluateMemberExpression(node, context) {
|
|
26968
27031
|
const member = await evaluateMemberAccess(node, context);
|
|
26969
|
-
if (member.kind === "error")
|
|
26970
|
-
|
|
26971
|
-
}
|
|
26972
|
-
if (member.kind === "completion") {
|
|
26973
|
-
return member.result;
|
|
26974
|
-
}
|
|
27032
|
+
if (member.kind === "error") return member;
|
|
27033
|
+
if (member.kind === "completion") return member.result;
|
|
26975
27034
|
if (member.kind === "nullish") {
|
|
26976
|
-
if (node.optional) {
|
|
26977
|
-
return {
|
|
26978
|
-
kind: "normal",
|
|
26979
|
-
hasValue: true,
|
|
26980
|
-
value: void 0
|
|
26981
|
-
};
|
|
26982
|
-
}
|
|
27035
|
+
if (node.optional) return { kind: "normal", hasValue: true, value: void 0 };
|
|
26983
27036
|
throw new TypeError("Cannot read properties of null or undefined.");
|
|
26984
27037
|
}
|
|
26985
|
-
if (typeof member.object === "string") {
|
|
26986
|
-
return {
|
|
26987
|
-
kind: "normal",
|
|
26988
|
-
hasValue: true,
|
|
26989
|
-
value: getStringMember(member.object, member.property, context.budget)
|
|
26990
|
-
};
|
|
26991
|
-
}
|
|
26992
|
-
if (typeof member.object === "number") {
|
|
26993
|
-
return {
|
|
26994
|
-
kind: "normal",
|
|
26995
|
-
hasValue: true,
|
|
26996
|
-
value: getNumberMember(member.object, member.property, context.budget)
|
|
26997
|
-
};
|
|
26998
|
-
}
|
|
26999
|
-
if (Array.isArray(member.object)) {
|
|
27000
|
-
return {
|
|
27001
|
-
kind: "normal",
|
|
27002
|
-
hasValue: true,
|
|
27003
|
-
value: getArrayMemberValue(member.object, member.property, context)
|
|
27004
|
-
};
|
|
27005
|
-
}
|
|
27006
|
-
if (isSandboxMap(member.object)) {
|
|
27007
|
-
return {
|
|
27008
|
-
kind: "normal",
|
|
27009
|
-
hasValue: true,
|
|
27010
|
-
value: getMapMember(member.object, member.property, createMapMethodOptions(context))
|
|
27011
|
-
};
|
|
27012
|
-
}
|
|
27013
|
-
if (isSandboxSet(member.object)) {
|
|
27014
|
-
return {
|
|
27015
|
-
kind: "normal",
|
|
27016
|
-
hasValue: true,
|
|
27017
|
-
value: getSetMember(member.object, member.property, createSetMethodOptions(context))
|
|
27018
|
-
};
|
|
27019
|
-
}
|
|
27020
|
-
if (isSandboxGenerator(member.object)) {
|
|
27021
|
-
return {
|
|
27022
|
-
kind: "normal",
|
|
27023
|
-
hasValue: true,
|
|
27024
|
-
value: getGeneratorMember(member.object, member.property, context.budget)
|
|
27025
|
-
};
|
|
27026
|
-
}
|
|
27027
|
-
if (isSandboxClosure(member.object)) {
|
|
27028
|
-
return {
|
|
27029
|
-
kind: "normal",
|
|
27030
|
-
hasValue: true,
|
|
27031
|
-
value: getClosureMemberValue(member.object, member.property, context)
|
|
27032
|
-
};
|
|
27033
|
-
}
|
|
27034
|
-
if (isSandboxPromise(member.object)) {
|
|
27035
|
-
return {
|
|
27036
|
-
kind: "normal",
|
|
27037
|
-
hasValue: true,
|
|
27038
|
-
value: getPromiseMember(member.property, context.budget)
|
|
27039
|
-
};
|
|
27040
|
-
}
|
|
27041
|
-
if (isSandboxRegex(member.object)) {
|
|
27042
|
-
return {
|
|
27043
|
-
kind: "normal",
|
|
27044
|
-
hasValue: true,
|
|
27045
|
-
value: getRegexMember(member.object, member.property)
|
|
27046
|
-
};
|
|
27047
|
-
}
|
|
27048
|
-
if (!isIndexableSandboxValue(member.object)) {
|
|
27049
|
-
throw new TypeError("Attempted to read a property from a non-object value.");
|
|
27050
|
-
}
|
|
27051
27038
|
return {
|
|
27052
27039
|
kind: "normal",
|
|
27053
27040
|
hasValue: true,
|
|
27054
|
-
value:
|
|
27041
|
+
value: getPropertyValue(member.object, member.property, context)
|
|
27055
27042
|
};
|
|
27056
27043
|
}
|
|
27044
|
+
function getPropertyValue(target, property, context) {
|
|
27045
|
+
if (typeof target === "string") return getStringMember(target, property, context.budget);
|
|
27046
|
+
if (typeof target === "number") return getNumberMember(target, property, context.budget);
|
|
27047
|
+
if (typeof target === "boolean") return void 0;
|
|
27048
|
+
if (isSandboxMap(target)) return getMapMember(target, property, createMapMethodOptions(context));
|
|
27049
|
+
if (isSandboxSet(target)) return getSetMember(target, property, createSetMethodOptions(context));
|
|
27050
|
+
if (isSandboxGenerator(target)) return getGeneratorMember(target, property, context.budget);
|
|
27051
|
+
if (isSandboxClosure(target)) return getClosureMemberValue(target, property, context);
|
|
27052
|
+
if (isSandboxPromise(target)) return getPromiseMember(property, context.budget);
|
|
27053
|
+
if (isSandboxRegex(target)) return getRegexMember(target, property);
|
|
27054
|
+
if (!isIndexableSandboxValue(target)) {
|
|
27055
|
+
throw new TypeError("Attempted to read a property from a non-object value.");
|
|
27056
|
+
}
|
|
27057
|
+
return getMemberValue(target, property, context);
|
|
27058
|
+
}
|
|
27057
27059
|
async function evaluateCallExpression(node, context) {
|
|
27058
27060
|
if (node.callee.type === "MemberExpression") {
|
|
27059
27061
|
context.budget.visitNode();
|
|
@@ -27529,7 +27531,9 @@ function applyBinaryOperator(node, left, right, context) {
|
|
|
27529
27531
|
throw createError("UNSUPPORTED_NODE", node, "Binary operator 'in' is not supported.");
|
|
27530
27532
|
}
|
|
27531
27533
|
}
|
|
27532
|
-
function applyCompoundAssignmentOperator(operator, left, right, context) {
|
|
27534
|
+
async function applyCompoundAssignmentOperator(operator, left, right, context) {
|
|
27535
|
+
left = await toNumericPrimitive(left, context);
|
|
27536
|
+
right = await toNumericPrimitive(right, context);
|
|
27533
27537
|
switch (operator) {
|
|
27534
27538
|
case "+=":
|
|
27535
27539
|
return applyAdditionOperator(left, right, context);
|
|
@@ -27656,6 +27660,9 @@ async function toNumericPrimitive(value, context) {
|
|
|
27656
27660
|
if (isIndexableSandboxValue(value)) {
|
|
27657
27661
|
for (const methodName of ["valueOf", "toString"]) {
|
|
27658
27662
|
const method = getMemberValue(value, methodName, context);
|
|
27663
|
+
if (methodName === "toString" && method === void 0 && !Object.hasOwn(value, methodName)) {
|
|
27664
|
+
return toString(value);
|
|
27665
|
+
}
|
|
27659
27666
|
if (!isSandboxClosure(method)) {
|
|
27660
27667
|
continue;
|
|
27661
27668
|
}
|
|
@@ -27671,6 +27678,7 @@ async function toNumericPrimitive(value, context) {
|
|
|
27671
27678
|
return result;
|
|
27672
27679
|
}
|
|
27673
27680
|
}
|
|
27681
|
+
throw new TypeError("Cannot convert object to primitive value.");
|
|
27674
27682
|
}
|
|
27675
27683
|
return toString(value);
|
|
27676
27684
|
}
|
|
@@ -27725,17 +27733,30 @@ function getArrayMemberValue(target, property, context) {
|
|
|
27725
27733
|
return getArrayMember(target, property, createArrayMethodOptions(context));
|
|
27726
27734
|
}
|
|
27727
27735
|
function setSandboxProperty(target, property, value) {
|
|
27736
|
+
if (isSandboxRegex(target)) {
|
|
27737
|
+
setRegexMember(target, property, value);
|
|
27738
|
+
return;
|
|
27739
|
+
}
|
|
27740
|
+
if (!isIndexableSandboxValue(target)) {
|
|
27741
|
+
throw new TypeError("Assignment expressions require a sandbox object property.");
|
|
27742
|
+
}
|
|
27743
|
+
const key = String(property);
|
|
27728
27744
|
if (Array.isArray(target)) {
|
|
27729
27745
|
assertCollectionMutable(target);
|
|
27730
|
-
const key = String(property);
|
|
27731
27746
|
if (key === "length" || isArrayIndexKey3(key)) {
|
|
27732
27747
|
target[key] = value;
|
|
27733
27748
|
return;
|
|
27734
27749
|
}
|
|
27750
|
+
}
|
|
27751
|
+
const descriptor = Object.getOwnPropertyDescriptor(target, key);
|
|
27752
|
+
if (descriptor !== void 0) {
|
|
27753
|
+
if (descriptor.writable !== true) {
|
|
27754
|
+
throw new TypeError(`Cannot assign to read only property '${key}'.`);
|
|
27755
|
+
}
|
|
27756
|
+
Object.defineProperty(target, key, { value });
|
|
27757
|
+
} else {
|
|
27735
27758
|
defineSandboxProperty(target, key, value);
|
|
27736
|
-
return;
|
|
27737
27759
|
}
|
|
27738
|
-
defineSandboxProperty(target, String(property), value);
|
|
27739
27760
|
}
|
|
27740
27761
|
function deleteSandboxProperty(target, property) {
|
|
27741
27762
|
if (Array.isArray(target)) {
|
|
@@ -28386,6 +28407,17 @@ function run(source, options = {}) {
|
|
|
28386
28407
|
}),
|
|
28387
28408
|
...createRegexGlobals()
|
|
28388
28409
|
};
|
|
28410
|
+
const importMeta = deepCopyToSandbox(options.importMeta ?? {});
|
|
28411
|
+
if (restoredSnapshot?.migration !== void 0) {
|
|
28412
|
+
if (Object.hasOwn(importMeta, "migration"))
|
|
28413
|
+
throw new TypeError("import.meta.migration is reserved for migrated checkpoint state.");
|
|
28414
|
+
Object.defineProperty(importMeta, "migration", {
|
|
28415
|
+
value: decodeReplayData(restoredSnapshot.migration.state),
|
|
28416
|
+
enumerable: true,
|
|
28417
|
+
configurable: true,
|
|
28418
|
+
writable: true
|
|
28419
|
+
});
|
|
28420
|
+
}
|
|
28389
28421
|
const initialInputs = prepareReplayInputs(
|
|
28390
28422
|
{
|
|
28391
28423
|
bindings: callerBindings,
|
|
@@ -28396,7 +28428,7 @@ function run(source, options = {}) {
|
|
|
28396
28428
|
allowMissing: restoredSnapshot?.initialInputs !== void 0
|
|
28397
28429
|
}),
|
|
28398
28430
|
entryPointArgs: options.entryPointArgs === void 0 ? void 0 : deepCopyToSandbox([...options.entryPointArgs]),
|
|
28399
|
-
importMeta
|
|
28431
|
+
importMeta
|
|
28400
28432
|
},
|
|
28401
28433
|
restoredSnapshot?.initialInputs,
|
|
28402
28434
|
(promise, id) => {
|
|
@@ -28461,6 +28493,7 @@ function run(source, options = {}) {
|
|
|
28461
28493
|
});
|
|
28462
28494
|
snapshotScheduler = activeSnapshotScheduler;
|
|
28463
28495
|
createFailureSnapshot = () => createRunSnapshot({
|
|
28496
|
+
migration: restoredSnapshot?.migration,
|
|
28464
28497
|
bindings: executionScope.snapshot().bindings,
|
|
28465
28498
|
clock: options.clock,
|
|
28466
28499
|
hostCalls: hostCalls.snapshot(),
|
|
@@ -28486,6 +28519,7 @@ function run(source, options = {}) {
|
|
|
28486
28519
|
}
|
|
28487
28520
|
const interpreterSnapshot2 = yieldPoint.snapshot();
|
|
28488
28521
|
snapshot2 = createRunSnapshot({
|
|
28522
|
+
migration: restoredSnapshot?.migration,
|
|
28489
28523
|
bindings: interpreterSnapshot2.bindings,
|
|
28490
28524
|
clock: options.clock,
|
|
28491
28525
|
hostCalls: hostCalls.snapshot(),
|
|
@@ -28527,6 +28561,7 @@ function run(source, options = {}) {
|
|
|
28527
28561
|
}
|
|
28528
28562
|
const interpreterSnapshot2 = yieldPoint.snapshot();
|
|
28529
28563
|
snapshot2 = createRunSnapshot({
|
|
28564
|
+
migration: restoredSnapshot?.migration,
|
|
28530
28565
|
bindings: interpreterSnapshot2.bindings,
|
|
28531
28566
|
clock: options.clock,
|
|
28532
28567
|
hostCalls: hostCalls.snapshot(),
|
|
@@ -28560,6 +28595,7 @@ function run(source, options = {}) {
|
|
|
28560
28595
|
replayError = error.message;
|
|
28561
28596
|
}
|
|
28562
28597
|
const snapshot = createRunSnapshot({
|
|
28598
|
+
migration: restoredSnapshot?.migration,
|
|
28563
28599
|
bindings: executionScope.snapshot().bindings,
|
|
28564
28600
|
clock: options.clock,
|
|
28565
28601
|
hostCalls: hostCalls.snapshot(),
|
|
@@ -28729,6 +28765,7 @@ function createRunSnapshot(input) {
|
|
|
28729
28765
|
version: DUMP_FORMAT_VERSION,
|
|
28730
28766
|
executionSemantics: EXECUTION_SEMANTICS,
|
|
28731
28767
|
sourceHash: input.sourceHash,
|
|
28768
|
+
...input.migration === void 0 ? {} : { migration: structuredClone(input.migration) },
|
|
28732
28769
|
bindings: input.bindings,
|
|
28733
28770
|
clock: input.clock?.snapshot(),
|
|
28734
28771
|
...input.hostCalls === void 0 || input.hostCalls.length === 0 ? {} : { hostCalls: input.hostCalls },
|
|
@@ -28798,6 +28835,7 @@ export {
|
|
|
28798
28835
|
parse,
|
|
28799
28836
|
parseModule,
|
|
28800
28837
|
lint,
|
|
28838
|
+
hashSource,
|
|
28801
28839
|
runResources,
|
|
28802
28840
|
noopOtelSink,
|
|
28803
28841
|
bindOtelSpan,
|
|
@@ -28809,15 +28847,26 @@ export {
|
|
|
28809
28847
|
safeEndSpan,
|
|
28810
28848
|
SandboxError,
|
|
28811
28849
|
Budget,
|
|
28850
|
+
DUMP_FORMAT_VERSION,
|
|
28851
|
+
EXECUTION_SEMANTICS,
|
|
28852
|
+
serializeSafeJSSnapshot,
|
|
28812
28853
|
SnapshotValidationError,
|
|
28854
|
+
validateSnapshotData,
|
|
28855
|
+
validateDumpEnvelope,
|
|
28856
|
+
encodeReplayData,
|
|
28813
28857
|
HostOperationResumePolicyError,
|
|
28814
28858
|
registerPendingHostCallPolicy,
|
|
28815
28859
|
HostCallResumabilityError,
|
|
28860
|
+
assertSnapshotInactive,
|
|
28816
28861
|
isSandboxClosure,
|
|
28817
28862
|
deepCopyToSandbox,
|
|
28818
28863
|
deepCopyFromSandbox,
|
|
28819
28864
|
createSeededRandom,
|
|
28820
28865
|
createReplayableRandom,
|
|
28866
|
+
validateMigrationSemantics,
|
|
28867
|
+
validateMigrationJournal,
|
|
28868
|
+
validateMigrationReconciliation,
|
|
28869
|
+
validateSnapshotMigration,
|
|
28821
28870
|
restore,
|
|
28822
28871
|
declareHostOperation,
|
|
28823
28872
|
dump,
|
|
@@ -28827,4 +28876,4 @@ export {
|
|
|
28827
28876
|
FileSnapshotBackend,
|
|
28828
28877
|
run
|
|
28829
28878
|
};
|
|
28830
|
-
//# sourceMappingURL=chunk-
|
|
28879
|
+
//# sourceMappingURL=chunk-DKXGPEOM.js.map
|