poe-code 11.0.17 → 11.0.18

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
@@ -138317,9 +138317,10 @@ async function evaluateTryStatement(node, context, evaluateNode3) {
138317
138317
  }
138318
138318
  return finalizerResult;
138319
138319
  }
138320
- function createCapturedException(reason, stackFrames) {
138320
+ function createCapturedException(reason, stackFrames, sandbox = false) {
138321
138321
  return {
138322
138322
  reason,
138323
+ sandbox,
138323
138324
  stackFrames,
138324
138325
  [capturedExceptionBrand]: true
138325
138326
  };
@@ -138327,7 +138328,7 @@ function createCapturedException(reason, stackFrames) {
138327
138328
  function isCapturedException(value) {
138328
138329
  return typeof value === "object" && value !== null && capturedExceptionBrand in value;
138329
138330
  }
138330
- function coerceThrownValue(reason, budget, stackFrames, span) {
138331
+ function coerceThrownValue(reason, budget, stackFrames, span, sandbox = false) {
138331
138332
  if (isSubsetErrorValue(reason)) {
138332
138333
  attachErrorSpan(reason, readErrorSpan(reason) ?? span);
138333
138334
  return reason;
@@ -138339,6 +138340,9 @@ function coerceThrownValue(reason, budget, stackFrames, span) {
138339
138340
  span
138340
138341
  });
138341
138342
  }
138343
+ if (sandbox) {
138344
+ return reason;
138345
+ }
138342
138346
  if (isErrorLikeValue(reason)) {
138343
138347
  return createSubsetErrorValue(reason.name || "Error", reason.message, stackFrames, budget, {
138344
138348
  chargeBudget: false,
@@ -144996,7 +145000,7 @@ async function evaluateNode2(node, context) {
144996
145000
  error: error3
144997
145001
  };
144998
145002
  }
144999
- const exception = isCapturedException(error3) ? coerceThrownValue(error3.reason, context.budget, error3.stackFrames, node.span) : coerceThrownValue(error3, context.budget, context.callStack, node.span);
145003
+ const exception = isCapturedException(error3) ? coerceThrownValue(error3.reason, context.budget, error3.stackFrames, node.span, error3.sandbox) : coerceThrownValue(error3, context.budget, context.callStack, node.span, true);
145000
145004
  return {
145001
145005
  kind: "throw",
145002
145006
  hasValue: true,
@@ -146691,7 +146695,7 @@ async function evaluateStringMethodCall(node, target, methodName, context) {
146691
146695
  if (isFatalSandboxError(error3)) {
146692
146696
  throw error3;
146693
146697
  }
146694
- throw captureException(error3, [...context.callStack, formatStackFrame(node, methodName)]);
146698
+ throw captureException(error3, [...context.callStack, formatStackFrame(node, methodName)], true);
146695
146699
  } finally {
146696
146700
  leaveCall();
146697
146701
  }
@@ -146718,7 +146722,7 @@ async function evaluateArrayMethodCall(node, target, methodName, context) {
146718
146722
  if (isFatalSandboxError(error3)) {
146719
146723
  throw error3;
146720
146724
  }
146721
- throw captureException(error3, [...context.callStack, formatStackFrame(node, methodName)]);
146725
+ throw captureException(error3, [...context.callStack, formatStackFrame(node, methodName)], true);
146722
146726
  } finally {
146723
146727
  leaveCall();
146724
146728
  }
@@ -146745,7 +146749,7 @@ async function evaluateMapMethodCall(node, target, methodName, context) {
146745
146749
  if (isFatalSandboxError(error3)) {
146746
146750
  throw error3;
146747
146751
  }
146748
- throw captureException(error3, [...context.callStack, formatStackFrame(node, methodName)]);
146752
+ throw captureException(error3, [...context.callStack, formatStackFrame(node, methodName)], true);
146749
146753
  } finally {
146750
146754
  leaveCall();
146751
146755
  }
@@ -146772,7 +146776,7 @@ async function evaluateSetMethodCall(node, target, methodName, context) {
146772
146776
  if (isFatalSandboxError(error3)) {
146773
146777
  throw error3;
146774
146778
  }
146775
- throw captureException(error3, [...context.callStack, formatStackFrame(node, methodName)]);
146779
+ throw captureException(error3, [...context.callStack, formatStackFrame(node, methodName)], true);
146776
146780
  } finally {
146777
146781
  leaveCall();
146778
146782
  }
@@ -147150,7 +147154,7 @@ async function evaluateNumberMethodCall(node, target, methodName, context) {
147150
147154
  if (isFatalSandboxError(error3)) {
147151
147155
  throw error3;
147152
147156
  }
147153
- throw captureException(error3, [...context.callStack, formatStackFrame(node, methodName)]);
147157
+ throw captureException(error3, [...context.callStack, formatStackFrame(node, methodName)], true);
147154
147158
  }
147155
147159
  }
147156
147160
  function createArrayMethodOptions(context) {
@@ -147192,12 +147196,15 @@ async function invokeSandboxClosure(callee, args, context, stack, span, thisValu
147192
147196
  if (isSandboxPromise(result) && result.synchronousPrefix !== void 0) {
147193
147197
  await result.synchronousPrefix;
147194
147198
  }
147195
- return !construct && callee.async === true ? normalizeClosureResult(wrapHostResult(result, stack), context.budget) : await wrapHostResult(result, stack);
147199
+ return !construct && callee.async === true ? normalizeClosureResult(
147200
+ wrapHostResult(result, stack, callee.sandbox === true),
147201
+ context.budget
147202
+ ) : await wrapHostResult(result, stack, callee.sandbox === true);
147196
147203
  } catch (error3) {
147197
147204
  if (isFatalSandboxError(error3)) {
147198
147205
  throw error3;
147199
147206
  }
147200
- throw captureException(error3, stack);
147207
+ throw captureException(error3, stack, callee.sandbox === true);
147201
147208
  } finally {
147202
147209
  leaveCall();
147203
147210
  }
@@ -147322,19 +147329,19 @@ function isInterpreterError(value) {
147322
147329
  function hasOwnProperty15(value, name) {
147323
147330
  return Object.prototype.hasOwnProperty.call(value, name);
147324
147331
  }
147325
- function wrapHostResult(result, stack) {
147332
+ function wrapHostResult(result, stack, sandbox) {
147326
147333
  if (!isPromiseLikeResult(result)) {
147327
147334
  return result;
147328
147335
  }
147329
147336
  return Promise.resolve(result).then(
147330
147337
  (value) => value,
147331
147338
  (reason) => Promise.reject(
147332
- isInterpreterError(reason) || reason instanceof SandboxError || isCapturedException(reason) ? reason : createCapturedException(reason, stack)
147339
+ isInterpreterError(reason) || reason instanceof SandboxError || isCapturedException(reason) ? reason : createCapturedException(reason, stack, sandbox)
147333
147340
  )
147334
147341
  );
147335
147342
  }
147336
- function captureException(error3, stack) {
147337
- return isCapturedException(error3) ? error3 : createCapturedException(error3, stack);
147343
+ function captureException(error3, stack, sandbox) {
147344
+ return isCapturedException(error3) ? error3 : createCapturedException(error3, stack, sandbox);
147338
147345
  }
147339
147346
  function isFatalSandboxError(error3) {
147340
147347
  return error3 instanceof SandboxError && (error3.code === "budgetExceeded" || error3.code === "reentry");
@@ -155642,7 +155649,7 @@ var init_package2 = __esm({
155642
155649
  "package.json"() {
155643
155650
  package_default2 = {
155644
155651
  name: "poe-code",
155645
- version: "11.0.17",
155652
+ version: "11.0.18",
155646
155653
  description: "CLI tool to configure Poe API for developer workflows.",
155647
155654
  license: "MIT",
155648
155655
  type: "module",