poe-code 11.0.22 → 11.0.23

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "poe-code",
3
- "version": "11.0.22",
3
+ "version": "11.0.23",
4
4
  "description": "CLI tool to configure Poe API for developer workflows.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -22177,7 +22177,7 @@ function invokeHostCallback(invoke, options) {
22177
22177
  }
22178
22178
  lifecycle.hostCallbackDepth += 1;
22179
22179
  try {
22180
- const result = invoke();
22180
+ const result = lifecycle.hostCallbackContext.run(true, invoke);
22181
22181
  if (isPromiseLike3(result)) {
22182
22182
  return Promise.resolve(result).finally(() => {
22183
22183
  lifecycle.hostCallbackDepth -= 1;
@@ -22877,8 +22877,8 @@ function createDumpController(lifecycle) {
22877
22877
  }
22878
22878
  settlePendingSnapshot(createSnapshot());
22879
22879
  },
22880
- requestCurrentSnapshot() {
22881
- assertDumpAllowed();
22880
+ requestCurrentSnapshot(options = {}) {
22881
+ assertDumpAllowed(options);
22882
22882
  if (failed !== void 0) {
22883
22883
  return Promise.reject(failed.error);
22884
22884
  }
@@ -22889,10 +22889,10 @@ function createDumpController(lifecycle) {
22889
22889
  return Promise.reject(error);
22890
22890
  }
22891
22891
  }
22892
- return this.requestSnapshot();
22892
+ return this.requestSnapshot(options);
22893
22893
  },
22894
22894
  requestSnapshot(options = {}) {
22895
- assertDumpAllowed();
22895
+ assertDumpAllowed(options);
22896
22896
  if (failed !== void 0) {
22897
22897
  if ((options.onFailure === "checkpoint" || options.onFailure === void 0 && isDataBudgetError(failed.error)) && finalSnapshot !== void 0) {
22898
22898
  try {
@@ -22914,6 +22914,9 @@ function createDumpController(lifecycle) {
22914
22914
  return Promise.reject(error);
22915
22915
  }
22916
22916
  }
22917
+ if (options.mode === "replay" && (latestSnapshot !== void 0 || latestSnapshotFactory !== void 0)) {
22918
+ return this.requestCurrentSnapshot(options);
22919
+ }
22917
22920
  if (pendingRequest !== void 0) {
22918
22921
  return pendingRequest.promise;
22919
22922
  }
@@ -22931,8 +22934,8 @@ function createDumpController(lifecycle) {
22931
22934
  return promise;
22932
22935
  }
22933
22936
  };
22934
- function assertDumpAllowed() {
22935
- if ((lifecycle?.hostCallbackDepth ?? 0) > 0) {
22937
+ function assertDumpAllowed(options) {
22938
+ if ((lifecycle?.hostCallbackDepth ?? 0) > 0 && (options.mode !== "replay" || lifecycle?.hostCallbackContext.getStore() === true)) {
22936
22939
  throw new SandboxError("reentry");
22937
22940
  }
22938
22941
  }
@@ -23170,6 +23173,9 @@ function isLockedFileError(error) {
23170
23173
  return code !== void 0 && LOCKED_FILE_ERROR_CODES.has(code);
23171
23174
  }
23172
23175
 
23176
+ // packages/safejs/src/run.ts
23177
+ import { AsyncLocalStorage as AsyncLocalStorage6 } from "node:async_hooks";
23178
+
23173
23179
  // packages/safejs/src/interp/resources.ts
23174
23180
  import { AsyncLocalStorage as AsyncLocalStorage5 } from "node:async_hooks";
23175
23181
  var runResources = new AsyncLocalStorage5();
@@ -28575,7 +28581,10 @@ var UnhandledRejectionError = class extends Error {
28575
28581
  };
28576
28582
  var DEFAULT_MAX_CALL_DEPTH = 1e3;
28577
28583
  function run(source, options = {}) {
28578
- const lifecycle = { hostCallbackDepth: 0 };
28584
+ const lifecycle = {
28585
+ hostCallbackDepth: 0,
28586
+ hostCallbackContext: new AsyncLocalStorage6()
28587
+ };
28579
28588
  const dumpController = createDumpController(lifecycle);
28580
28589
  const promiseTracker = createSandboxPromiseRejectionTracker();
28581
28590
  let completedSnapshot;
@@ -28881,6 +28890,7 @@ function run(source, options = {}) {
28881
28890
  dumpController.fail(error);
28882
28891
  throw error;
28883
28892
  } finally {
28893
+ lifecycle.hostCallbackContext.disable();
28884
28894
  options.signal?.removeEventListener("abort", captureCancellationSnapshot);
28885
28895
  leaveInputReplay?.();
28886
28896
  leaveHostReplay?.();
@@ -29125,4 +29135,4 @@ export {
29125
29135
  FileSnapshotBackend,
29126
29136
  run
29127
29137
  };
29128
- //# sourceMappingURL=chunk-IB5DSFBQ.js.map
29138
+ //# sourceMappingURL=chunk-3627FMJF.js.map