poe-code 11.0.26 → 11.0.27

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
@@ -141499,6 +141499,7 @@ function wrapCallerInjectedFunction(name, value, options, state) {
141499
141499
  entries: /* @__PURE__ */ new Map(),
141500
141500
  hostFunctions: /* @__PURE__ */ new Map(),
141501
141501
  sourceFunctions: /* @__PURE__ */ new Map(),
141502
+ proofFunctions: /* @__PURE__ */ new WeakMap(),
141502
141503
  active: /* @__PURE__ */ new Set(),
141503
141504
  seen: /* @__PURE__ */ new WeakMap(),
141504
141505
  restored: []
@@ -141677,6 +141678,7 @@ function executeHostCall(record2, restored, invoke2, stackFrames, options, span,
141677
141678
  );
141678
141679
  }
141679
141680
  if (restored && record2.policy === "read-side-effect" && record2.lifecycle !== "created") {
141681
+ let active = true;
141680
141682
  const context = callbacks === void 0 ? void 0 : {
141681
141683
  callbacks: new Map(callbacks.hostFunctions),
141682
141684
  replayed: callbacks.restored.map((invocation) => ({
@@ -141685,9 +141687,23 @@ function executeHostCall(record2, restored, invoke2, stackFrames, options, span,
141685
141687
  })),
141686
141688
  async waitForCallbacks() {
141687
141689
  while (callbacks.active.size > 0) await Promise.allSettled([...callbacks.active]);
141690
+ },
141691
+ toSandboxValue(value) {
141692
+ if (!active) throw new TypeError("Host call resume context is no longer active.");
141693
+ if (options.signal?.aborted) throw readAbortReason2(options.signal);
141694
+ return copyHostValueToSandbox(
141695
+ value,
141696
+ stackFrames,
141697
+ { ...options, proofFunctions: callbacks.proofFunctions },
141698
+ { seen: /* @__PURE__ */ new WeakMap() },
141699
+ "<root>"
141700
+ );
141688
141701
  }
141689
141702
  };
141690
- return createHostCallPromise(record2, hostCalls.reconcile(record2, context), hostCalls);
141703
+ const outcome2 = hostCalls.reconcile(record2, context).finally(() => {
141704
+ active = false;
141705
+ });
141706
+ return createHostCallPromise(record2, outcome2, hostCalls);
141691
141707
  }
141692
141708
  if (restored && callbacks !== void 0) callbacks.nextReissuedInvocation = 0;
141693
141709
  hostCalls.start(record2);
@@ -141927,6 +141943,7 @@ function wrapSandboxClosureForHost(closure, stackFrames, budget, callbacks) {
141927
141943
  callbacks?.entries.set(id, invoke2);
141928
141944
  callbacks?.hostFunctions.set(id, wrapped);
141929
141945
  callbacks?.sourceFunctions.set(id, closure);
141946
+ callbacks?.proofFunctions.set(wrapped, closure);
141930
141947
  if (callbacks?.record !== void 0)
141931
141948
  callbacks.journal?.registerCallbackFunction(callbacks.record, id, closure, wrapped);
141932
141949
  return wrapped;
@@ -142005,9 +142022,17 @@ function copyHostValueToSandbox(value, stackFrames, options, state, path191) {
142005
142022
  throw new TypeError("Host error data must not contain functions or promises.");
142006
142023
  }
142007
142024
  if (isSandboxClosure(value) || isSandboxPromise(value)) {
142025
+ if (options.proofFunctions !== void 0)
142026
+ throw new TypeError(`Unsupported proof value at ${path191}: sandbox capability`);
142008
142027
  return deepCopyToSandbox(value);
142009
142028
  }
142010
142029
  if (typeof value === "function") {
142030
+ if (options.proofFunctions !== void 0) {
142031
+ const sourceClosure2 = options.proofFunctions.get(value);
142032
+ if (sourceClosure2 === void 0)
142033
+ throw new TypeError(`Unsupported proof value at ${path191}: function`);
142034
+ return sourceClosure2;
142035
+ }
142011
142036
  const sourceClosure = options.hostCalls?.nativeClosures.get(value);
142012
142037
  if (sourceClosure !== void 0) return sourceClosure;
142013
142038
  const callable = value;
@@ -142026,6 +142051,8 @@ function copyHostValueToSandbox(value, stackFrames, options, state, path191) {
142026
142051
  );
142027
142052
  }
142028
142053
  if (!options.errorData && isPromiseLike5(value)) {
142054
+ if (options.proofFunctions !== void 0)
142055
+ throw new TypeError(`Unsupported proof value at ${path191}: promise`);
142029
142056
  const existing = state.seen.get(value);
142030
142057
  if (existing !== void 0) return existing;
142031
142058
  const promise = wrapHostPromiseWithSignal(Promise.resolve(value), options.signal).then(
@@ -155781,7 +155808,7 @@ var init_package2 = __esm({
155781
155808
  "package.json"() {
155782
155809
  package_default2 = {
155783
155810
  name: "poe-code",
155784
- version: "11.0.26",
155811
+ version: "11.0.27",
155785
155812
  description: "CLI tool to configure Poe API for developer workflows.",
155786
155813
  license: "MIT",
155787
155814
  type: "module",