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 CHANGED
@@ -136635,7 +136635,7 @@ var init_dump_format = __esm({
136635
136635
  init_arguments2();
136636
136636
  init_arrays();
136637
136637
  DUMP_FORMAT_VERSION = 1;
136638
- EXECUTION_SEMANTICS = "jobs-v6";
136638
+ EXECUTION_SEMANTICS = "jobs-v7";
136639
136639
  SKIP_VALUE = /* @__PURE__ */ Symbol("SafeJS.skip-dump-value");
136640
136640
  }
136641
136641
  });
@@ -140216,11 +140216,14 @@ function copyToSandbox(value, state, path191 = "<root>", cloneSandboxCollections
140216
140216
  return copy;
140217
140217
  }
140218
140218
  if (isHostPromise(value)) {
140219
+ const existing = state.seen.get(value);
140220
+ if (existing !== void 0) return existing;
140219
140221
  const promise = Promise.resolve(value).then(
140220
140222
  (resolved) => copyToSandbox(resolved, { seen: /* @__PURE__ */ new WeakMap() }),
140221
140223
  (reason) => Promise.reject(copyToSandbox(reason, { seen: /* @__PURE__ */ new WeakMap() }))
140222
140224
  );
140223
140225
  const sandboxPromise = createSandboxPromise(promise);
140226
+ state.seen.set(value, sandboxPromise);
140224
140227
  const span = getBoundOtelSpan(value);
140225
140228
  if (span !== void 0) {
140226
140229
  bindOtelSpan(promise, span);
@@ -140703,9 +140706,11 @@ var init_random = __esm({
140703
140706
 
140704
140707
  // packages/safejs/src/snapshot/migration.ts
140705
140708
  function validateMigrationSemantics(value) {
140706
- if (!["jobs-v1", "jobs-v2", "jobs-v3", "jobs-v4", "jobs-v5", "jobs-v6"].includes(value))
140709
+ if (!["jobs-v1", "jobs-v2", "jobs-v3", "jobs-v4", "jobs-v5", "jobs-v6", "jobs-v7"].includes(
140710
+ value
140711
+ ))
140707
140712
  throw new TypeError(
140708
- "Migration requires a supported execution-semantics marker (jobs-v1 through jobs-v6)."
140713
+ "Migration requires a supported execution-semantics marker (jobs-v1 through jobs-v7)."
140709
140714
  );
140710
140715
  }
140711
140716
  function validateMigrationJournal(sourceHash, replay, hostCalls = []) {
@@ -140797,7 +140802,7 @@ function restore2(snapshot2, options) {
140797
140802
  assertSnapshotInactive(snapshot2);
140798
140803
  validateDumpEnvelope(snapshot2);
140799
140804
  validateSnapshotMigration(snapshot2.migration, snapshot2.sourceHash);
140800
- if (snapshot2.executionSemantics !== EXECUTION_SEMANTICS && (snapshot2.executionSemantics !== void 0 || snapshot2.promiseReplay !== void 0 || snapshot2.replay !== void 0 || snapshot2.initialInputs !== void 0)) {
140805
+ if (snapshot2.executionSemantics !== EXECUTION_SEMANTICS && snapshot2.executionSemantics !== "jobs-v6" && (snapshot2.executionSemantics !== void 0 || snapshot2.promiseReplay !== void 0 || snapshot2.replay !== void 0 || snapshot2.initialInputs !== void 0)) {
140801
140806
  throw new SnapshotValidationError(
140802
140807
  "unsupportedVersion",
140803
140808
  "$.executionSemantics",
@@ -142021,6 +142026,8 @@ function copyHostValueToSandbox(value, stackFrames, options, state, path191) {
142021
142026
  );
142022
142027
  }
142023
142028
  if (!options.errorData && isPromiseLike5(value)) {
142029
+ const existing = state.seen.get(value);
142030
+ if (existing !== void 0) return existing;
142024
142031
  const promise = wrapHostPromiseWithSignal(Promise.resolve(value), options.signal).then(
142025
142032
  (resolved) => {
142026
142033
  try {
@@ -142048,6 +142055,7 @@ function copyHostValueToSandbox(value, stackFrames, options, state, path191) {
142048
142055
  }
142049
142056
  );
142050
142057
  const sandboxPromise = createSandboxPromise(promise);
142058
+ state.seen.set(value, sandboxPromise);
142051
142059
  const span = getBoundOtelSpan(value);
142052
142060
  if (span !== void 0) {
142053
142061
  bindOtelSpan(promise, span);
@@ -148238,6 +148246,8 @@ function run(source, options = {}) {
148238
148246
  options.signal?.addEventListener("abort", captureCancellationSnapshot, { once: true });
148239
148247
  try {
148240
148248
  const restoredSnapshot = options.snapshot === void 0 ? void 0 : restore2(options.snapshot, { source });
148249
+ const executionSemantics = restoredSnapshot?.executionSemantics === "jobs-v6" ? "jobs-v6" : EXECUTION_SEMANTICS;
148250
+ const convertInitialInput = (convert) => executionSemantics === "jobs-v6" ? convert() : promiseReplayContext.exit(convert);
148241
148251
  if (restoredSnapshot !== void 0) {
148242
148252
  leaveSnapshotRun = enterSnapshotRun(restoredSnapshot);
148243
148253
  }
@@ -148263,13 +148273,15 @@ function run(source, options = {}) {
148263
148273
  ...restoredSnapshot,
148264
148274
  resumeNodeId: restoredSnapshot.pendingAwaits?.[0]?.nodeId
148265
148275
  } : void 0;
148266
- const callerBindings = options.bindings === void 0 ? {} : wrapCallerInjectedBindings(options.bindings, {
148267
- budget,
148268
- hostCalls,
148269
- moduleId: "<bindings>",
148270
- signal: options.signal,
148271
- lifecycle
148272
- });
148276
+ const callerBindings = convertInitialInput(
148277
+ () => options.bindings === void 0 ? {} : wrapCallerInjectedBindings(options.bindings, {
148278
+ budget,
148279
+ hostCalls,
148280
+ moduleId: "<bindings>",
148281
+ signal: options.signal,
148282
+ lifecycle
148283
+ })
148284
+ );
148273
148285
  const builtinBindings = {
148274
148286
  ...createConsoleJsonGlobals({
148275
148287
  budget,
@@ -148294,7 +148306,9 @@ function run(source, options = {}) {
148294
148306
  }),
148295
148307
  ...createRegexGlobals()
148296
148308
  };
148297
- const importMeta = deepCopyToSandbox(options.importMeta ?? {});
148309
+ const importMeta = convertInitialInput(
148310
+ () => deepCopyToSandbox(options.importMeta ?? {})
148311
+ );
148298
148312
  if (restoredSnapshot?.migration !== void 0) {
148299
148313
  if (Object.hasOwn(importMeta, "migration"))
148300
148314
  throw new TypeError("import.meta.migration is reserved for migrated checkpoint state.");
@@ -148308,13 +148322,17 @@ function run(source, options = {}) {
148308
148322
  const initialInputs = prepareReplayInputs(
148309
148323
  {
148310
148324
  bindings: callerBindings,
148311
- imports: resolveModuleImports(module, options.modules, {
148312
- budget,
148313
- hostCalls,
148314
- signal: options.signal,
148315
- allowMissing: restoredSnapshot?.initialInputs !== void 0
148316
- }),
148317
- entryPointArgs: options.entryPointArgs === void 0 ? void 0 : deepCopyToSandbox([...options.entryPointArgs]),
148325
+ imports: convertInitialInput(
148326
+ () => resolveModuleImports(module, options.modules, {
148327
+ budget,
148328
+ hostCalls,
148329
+ signal: options.signal,
148330
+ allowMissing: restoredSnapshot?.initialInputs !== void 0
148331
+ })
148332
+ ),
148333
+ entryPointArgs: convertInitialInput(
148334
+ () => options.entryPointArgs === void 0 ? void 0 : deepCopyToSandbox([...options.entryPointArgs])
148335
+ ),
148318
148336
  importMeta
148319
148337
  },
148320
148338
  restoredSnapshot?.initialInputs,
@@ -148380,6 +148398,7 @@ function run(source, options = {}) {
148380
148398
  });
148381
148399
  snapshotScheduler = activeSnapshotScheduler;
148382
148400
  createFailureSnapshot = () => createRunSnapshot({
148401
+ executionSemantics,
148383
148402
  migration: restoredSnapshot?.migration,
148384
148403
  bindings: executionScope.snapshot().bindings,
148385
148404
  clock: options.clock,
@@ -148406,6 +148425,7 @@ function run(source, options = {}) {
148406
148425
  }
148407
148426
  const interpreterSnapshot2 = yieldPoint.snapshot();
148408
148427
  snapshot3 = createRunSnapshot({
148428
+ executionSemantics,
148409
148429
  migration: restoredSnapshot?.migration,
148410
148430
  bindings: interpreterSnapshot2.bindings,
148411
148431
  clock: options.clock,
@@ -148448,6 +148468,7 @@ function run(source, options = {}) {
148448
148468
  }
148449
148469
  const interpreterSnapshot2 = yieldPoint.snapshot();
148450
148470
  snapshot3 = createRunSnapshot({
148471
+ executionSemantics,
148451
148472
  migration: restoredSnapshot?.migration,
148452
148473
  bindings: interpreterSnapshot2.bindings,
148453
148474
  clock: options.clock,
@@ -148482,6 +148503,7 @@ function run(source, options = {}) {
148482
148503
  replayError = error3.message;
148483
148504
  }
148484
148505
  const snapshot2 = createRunSnapshot({
148506
+ executionSemantics,
148485
148507
  migration: restoredSnapshot?.migration,
148486
148508
  bindings: executionScope.snapshot().bindings,
148487
148509
  clock: options.clock,
@@ -148651,7 +148673,7 @@ function createExecutableNode(module) {
148651
148673
  function createRunSnapshot(input) {
148652
148674
  return {
148653
148675
  version: DUMP_FORMAT_VERSION,
148654
- executionSemantics: EXECUTION_SEMANTICS,
148676
+ executionSemantics: input.executionSemantics,
148655
148677
  sourceHash: input.sourceHash,
148656
148678
  ...input.migration === void 0 ? {} : { migration: structuredClone(input.migration) },
148657
148679
  bindings: input.bindings,
@@ -155759,7 +155781,7 @@ var init_package2 = __esm({
155759
155781
  "package.json"() {
155760
155782
  package_default2 = {
155761
155783
  name: "poe-code",
155762
- version: "11.0.24",
155784
+ version: "11.0.26",
155763
155785
  description: "CLI tool to configure Poe API for developer workflows.",
155764
155786
  license: "MIT",
155765
155787
  type: "module",