poe-code 11.0.15 → 11.0.17

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.
@@ -20,7 +20,7 @@ import {
20
20
  parseMcpConfig,
21
21
  splitFrontmatter,
22
22
  withBrokenPipeGuard
23
- } from "./chunks/chunk-RMMJ2USI.js";
23
+ } from "./chunks/chunk-COHIMIAF.js";
24
24
  import {
25
25
  Budget,
26
26
  SandboxError,
@@ -32,7 +32,7 @@ import {
32
32
  replaceErrorStack,
33
33
  restore,
34
34
  run
35
- } from "./chunks/chunk-CMWFNRW4.js";
35
+ } from "./chunks/chunk-D4DDI3HH.js";
36
36
  import "./chunks/chunk-4YIDX44G.js";
37
37
 
38
38
  // packages/safejs/src/cli.ts
@@ -3,7 +3,7 @@ import {
3
3
  createReplayableRandom,
4
4
  lint,
5
5
  run
6
- } from "./chunks/chunk-CMWFNRW4.js";
6
+ } from "./chunks/chunk-D4DDI3HH.js";
7
7
  import "./chunks/chunk-4YIDX44G.js";
8
8
  export {
9
9
  Budget,
@@ -27,7 +27,7 @@ import {
27
27
  runWithSpawnUsageAccumulator,
28
28
  splitFrontmatter,
29
29
  supportsSpawnMode
30
- } from "./chunks/chunk-RMMJ2USI.js";
30
+ } from "./chunks/chunk-COHIMIAF.js";
31
31
  import {
32
32
  Budget,
33
33
  FileSnapshotBackend,
@@ -49,7 +49,7 @@ import {
49
49
  registerPendingHostCallPolicy,
50
50
  restore,
51
51
  run
52
- } from "./chunks/chunk-CMWFNRW4.js";
52
+ } from "./chunks/chunk-D4DDI3HH.js";
53
53
  import "./chunks/chunk-4YIDX44G.js";
54
54
 
55
55
  // packages/safejs/src/runner/run-harness.ts
@@ -1,5 +1,6 @@
1
1
  import { createSandboxClosure, isSandboxClosure, isSandboxMap, isSandboxPromise, isSandboxSet } from "../values.js";
2
2
  import { assertCollectionMutable, enterCollectionCallback } from "../running-state.js";
3
+ const activeArrayCallbacks = new WeakMap();
3
4
  const arrayMethodNames = new Set([
4
5
  "map",
5
6
  "filter",
@@ -73,12 +74,21 @@ export async function callArrayMethod(value, methodName, args, options, stack =
73
74
  assertCollectionMutable(value);
74
75
  }
75
76
  if (isCallbackArrayMethod(methodName)) {
76
- const leaveCallback = enterCollectionCallback(value);
77
+ let callbackState = activeArrayCallbacks.get(value);
78
+ if (callbackState === undefined) {
79
+ callbackState = { depth: 0, leave: enterCollectionCallback(value) };
80
+ activeArrayCallbacks.set(value, callbackState);
81
+ }
82
+ callbackState.depth += 1;
77
83
  try {
78
84
  return await callArrayMethodUnlocked(value, methodName, args, options, stack);
79
85
  }
80
86
  finally {
81
- leaveCallback();
87
+ callbackState.depth -= 1;
88
+ if (callbackState.depth === 0) {
89
+ activeArrayCallbacks.delete(value);
90
+ callbackState.leave();
91
+ }
82
92
  }
83
93
  }
84
94
  return callArrayMethodUnlocked(value, methodName, args, options, stack);
@@ -200,8 +200,11 @@ export function measureSandboxData(values, options = {}) {
200
200
  usage += 1;
201
201
  if (Array.isArray(value)) {
202
202
  usage += value.length;
203
- for (const entry of value)
204
- visit(entry);
203
+ for (let index = 0; index < value.length; index += 1) {
204
+ const descriptor = Object.getOwnPropertyDescriptor(value, index);
205
+ if (descriptor !== undefined && "value" in descriptor)
206
+ visit(descriptor.value);
207
+ }
205
208
  return;
206
209
  }
207
210
  if (isSandboxMap(value)) {
@@ -243,7 +246,9 @@ export function measureSandboxData(values, options = {}) {
243
246
  }
244
247
  const entries = isSandboxArguments(value)
245
248
  ? getSandboxArgumentEntries(value)
246
- : Object.entries(value);
249
+ : Object.entries(Object.getOwnPropertyDescriptors(value))
250
+ .filter(([, descriptor]) => descriptor.enumerable)
251
+ .map(([key, descriptor]) => [key, "value" in descriptor ? descriptor.value : undefined]);
247
252
  usage += entries.length;
248
253
  for (const [key, entry] of entries) {
249
254
  usage += key.length;