poe-code 11.0.21 → 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.21",
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();
@@ -25362,7 +25368,8 @@ function callSplit(value, args, budget) {
25362
25368
  let endedWithZeroWidthMatch = false;
25363
25369
  for (const match of collectRegexMatches(splitter, value, true)) {
25364
25370
  endedWithZeroWidthMatch = match.text.length === 0 && match.index === value.length;
25365
- if (match.text.length === 0 && match.index === 0) continue;
25371
+ if (match.text.length === 0 && (match.index === copiedThrough || match.index === value.length))
25372
+ continue;
25366
25373
  if (result2.length >= limit2) break;
25367
25374
  result2.push(budget.allocateString(value.slice(copiedThrough, match.index)));
25368
25375
  for (const capture of match.captures) {
@@ -25371,7 +25378,7 @@ function callSplit(value, args, budget) {
25371
25378
  }
25372
25379
  copiedThrough = match.index + match.text.length;
25373
25380
  }
25374
- if (result2.length < limit2 && !endedWithZeroWidthMatch)
25381
+ if (result2.length < limit2 && (value.length > 0 || !endedWithZeroWidthMatch))
25375
25382
  result2.push(budget.allocateString(value.slice(copiedThrough)));
25376
25383
  budget.allocateArrayLength(result2.length);
25377
25384
  return result2;
@@ -28574,7 +28581,10 @@ var UnhandledRejectionError = class extends Error {
28574
28581
  };
28575
28582
  var DEFAULT_MAX_CALL_DEPTH = 1e3;
28576
28583
  function run(source, options = {}) {
28577
- const lifecycle = { hostCallbackDepth: 0 };
28584
+ const lifecycle = {
28585
+ hostCallbackDepth: 0,
28586
+ hostCallbackContext: new AsyncLocalStorage6()
28587
+ };
28578
28588
  const dumpController = createDumpController(lifecycle);
28579
28589
  const promiseTracker = createSandboxPromiseRejectionTracker();
28580
28590
  let completedSnapshot;
@@ -28880,6 +28890,7 @@ function run(source, options = {}) {
28880
28890
  dumpController.fail(error);
28881
28891
  throw error;
28882
28892
  } finally {
28893
+ lifecycle.hostCallbackContext.disable();
28883
28894
  options.signal?.removeEventListener("abort", captureCancellationSnapshot);
28884
28895
  leaveInputReplay?.();
28885
28896
  leaveHostReplay?.();
@@ -29124,4 +29135,4 @@ export {
29124
29135
  FileSnapshotBackend,
29125
29136
  run
29126
29137
  };
29127
- //# sourceMappingURL=chunk-KWRLKWB3.js.map
29138
+ //# sourceMappingURL=chunk-3627FMJF.js.map