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/dist/index.js CHANGED
@@ -141613,7 +141613,7 @@ function invokeHostCallback(invoke2, options) {
141613
141613
  }
141614
141614
  lifecycle.hostCallbackDepth += 1;
141615
141615
  try {
141616
- const result = invoke2();
141616
+ const result = lifecycle.hostCallbackContext.run(true, invoke2);
141617
141617
  if (isPromiseLike5(result)) {
141618
141618
  return Promise.resolve(result).finally(() => {
141619
141619
  lifecycle.hostCallbackDepth -= 1;
@@ -147663,8 +147663,8 @@ function createDumpController(lifecycle) {
147663
147663
  }
147664
147664
  settlePendingSnapshot(createSnapshot());
147665
147665
  },
147666
- requestCurrentSnapshot() {
147667
- assertDumpAllowed();
147666
+ requestCurrentSnapshot(options = {}) {
147667
+ assertDumpAllowed(options);
147668
147668
  if (failed !== void 0) {
147669
147669
  return Promise.reject(failed.error);
147670
147670
  }
@@ -147675,10 +147675,10 @@ function createDumpController(lifecycle) {
147675
147675
  return Promise.reject(error3);
147676
147676
  }
147677
147677
  }
147678
- return this.requestSnapshot();
147678
+ return this.requestSnapshot(options);
147679
147679
  },
147680
147680
  requestSnapshot(options = {}) {
147681
- assertDumpAllowed();
147681
+ assertDumpAllowed(options);
147682
147682
  if (failed !== void 0) {
147683
147683
  if ((options.onFailure === "checkpoint" || options.onFailure === void 0 && isDataBudgetError(failed.error)) && finalSnapshot !== void 0) {
147684
147684
  try {
@@ -147700,6 +147700,9 @@ function createDumpController(lifecycle) {
147700
147700
  return Promise.reject(error3);
147701
147701
  }
147702
147702
  }
147703
+ if (options.mode === "replay" && (latestSnapshot !== void 0 || latestSnapshotFactory !== void 0)) {
147704
+ return this.requestCurrentSnapshot(options);
147705
+ }
147703
147706
  if (pendingRequest !== void 0) {
147704
147707
  return pendingRequest.promise;
147705
147708
  }
@@ -147717,8 +147720,8 @@ function createDumpController(lifecycle) {
147717
147720
  return promise;
147718
147721
  }
147719
147722
  };
147720
- function assertDumpAllowed() {
147721
- if ((lifecycle?.hostCallbackDepth ?? 0) > 0) {
147723
+ function assertDumpAllowed(options) {
147724
+ if ((lifecycle?.hostCallbackDepth ?? 0) > 0 && (options.mode !== "replay" || lifecycle?.hostCallbackContext.getStore() === true)) {
147722
147725
  throw new SandboxError("reentry");
147723
147726
  }
147724
147727
  }
@@ -148163,8 +148166,12 @@ var init_replay_inputs = __esm({
148163
148166
  });
148164
148167
 
148165
148168
  // packages/safejs/src/run.ts
148169
+ import { AsyncLocalStorage as AsyncLocalStorage8 } from "node:async_hooks";
148166
148170
  function run(source, options = {}) {
148167
- const lifecycle = { hostCallbackDepth: 0 };
148171
+ const lifecycle = {
148172
+ hostCallbackDepth: 0,
148173
+ hostCallbackContext: new AsyncLocalStorage8()
148174
+ };
148168
148175
  const dumpController = createDumpController(lifecycle);
148169
148176
  const promiseTracker = createSandboxPromiseRejectionTracker();
148170
148177
  let completedSnapshot;
@@ -148470,6 +148477,7 @@ function run(source, options = {}) {
148470
148477
  dumpController.fail(error3);
148471
148478
  throw error3;
148472
148479
  } finally {
148480
+ lifecycle.hostCallbackContext.disable();
148473
148481
  options.signal?.removeEventListener("abort", captureCancellationSnapshot);
148474
148482
  leaveInputReplay?.();
148475
148483
  leaveHostReplay?.();
@@ -149037,7 +149045,7 @@ var init_find_exported = __esm({
149037
149045
  });
149038
149046
 
149039
149047
  // packages/safejs/src/modules/agent.ts
149040
- import { AsyncLocalStorage as AsyncLocalStorage8 } from "node:async_hooks";
149048
+ import { AsyncLocalStorage as AsyncLocalStorage9 } from "node:async_hooks";
149041
149049
  function createSpawnUsageAccumulator() {
149042
149050
  let inputTokens = 0;
149043
149051
  let outputTokens = 0;
@@ -149940,7 +149948,7 @@ var init_agent3 = __esm({
149940
149948
  hostErrorData.set(this, { result });
149941
149949
  }
149942
149950
  };
149943
- activeUsageAccumulator = new AsyncLocalStorage8();
149951
+ activeUsageAccumulator = new AsyncLocalStorage9();
149944
149952
  oneAttemptRetryOptions = {
149945
149953
  maxAttempts: 1,
149946
149954
  backoffMs: 0,
@@ -155709,7 +155717,7 @@ var init_package2 = __esm({
155709
155717
  "package.json"() {
155710
155718
  package_default2 = {
155711
155719
  name: "poe-code",
155712
- version: "11.0.22",
155720
+ version: "11.0.23",
155713
155721
  description: "CLI tool to configure Poe API for developer workflows.",
155714
155722
  license: "MIT",
155715
155723
  type: "module",