poe-code 11.0.28 → 11.0.30

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-3OFXSTL2.js";
23
+ } from "./chunks/chunk-44GTB3XV.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-FAAW5HF7.js";
35
+ } from "./chunks/chunk-XPDK2VVP.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-FAAW5HF7.js";
6
+ } from "./chunks/chunk-XPDK2VVP.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-3OFXSTL2.js";
30
+ } from "./chunks/chunk-44GTB3XV.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-FAAW5HF7.js";
52
+ } from "./chunks/chunk-XPDK2VVP.js";
53
53
  import "./chunks/chunk-4YIDX44G.js";
54
54
 
55
55
  // packages/safejs/src/runner/run-harness.ts
@@ -4,7 +4,7 @@ import { SandboxError } from "./budget.js";
4
4
  import { createSubsetErrorValue } from "./exceptions.js";
5
5
  import { bindOtelSpan, getBoundOtelSpan } from "../observability/otel.js";
6
6
  import { digestHostCallArguments, HostCallResumabilityError, UnresolvedReplayCapabilityError } from "./host-call.js";
7
- import { createSandboxClosure, createSandboxMap, createSandboxPromise, createSandboxSet, deepCopyFromSandbox, deepCopyToSandbox, isSandboxClosure, isSandboxPromise, measureSandboxData } from "./values.js";
7
+ import { createSandboxClosure, createSandboxMap, createSandboxPromise, createSandboxSet, deepCopyFromSandbox, deepCopyToSandbox, defineOwnDataProperty, isArrayIndexKey, isSandboxClosure, isSandboxPromise, measureSandboxData } from "./values.js";
8
8
  import { enterRunningState } from "./running-state.js";
9
9
  import { promiseReplayContext } from "./promise-replay.js";
10
10
  import { hostErrorData, sandboxErrorTypes } from "../error/shape.js";
@@ -632,14 +632,15 @@ function copyHostValueToSandbox(value, stackFrames, options, state, path) {
632
632
  const copy = new Array(value.length);
633
633
  state.seen.set(value, copy);
634
634
  budget.allocateArrayLength(value.length);
635
- for (let index = 0; index < value.length; index++) {
636
- const descriptor = Object.getOwnPropertyDescriptor(value, String(index));
637
- if (descriptor === undefined)
635
+ for (const [key, descriptor] of Object.entries(Object.getOwnPropertyDescriptors(value))) {
636
+ const indexed = isArrayIndexKey(key);
637
+ if (key === "length" || (!descriptor.enumerable && !indexed))
638
638
  continue;
639
+ const entryPath = indexed ? `${path}[${key}]` : joinPath(path, key);
639
640
  if (!("value" in descriptor)) {
640
- throw new TypeError(`Unsupported sandbox value at ${path}[${index}]: accessor property`);
641
+ throw new TypeError(`Unsupported sandbox value at ${entryPath}: accessor property`);
641
642
  }
642
- copy[index] = copyHostValueToSandbox(descriptor.value, stackFrames, { ...options, capabilityPath: [...(options.capabilityPath ?? []), String(index)] }, state, `${path}[${index}]`);
643
+ defineOwnDataProperty(copy, indexed ? key : budget.allocateString(key), copyHostValueToSandbox(descriptor.value, stackFrames, { ...options, capabilityPath: [...(options.capabilityPath ?? []), key] }, state, entryPath));
643
644
  }
644
645
  return copy;
645
646
  }
@@ -1,5 +1,5 @@
1
1
  import { createHash, randomUUID } from "node:crypto";
2
- import { cloneSandboxValue, createSandboxClosure, measureSandboxData } from "./values.js";
2
+ import { cloneSandboxValue, createSandboxClosure, defineOwnDataProperty, isArrayIndexKey, measureSandboxData } from "./values.js";
3
3
  import { decodeReplayData, encodeReplayData } from "../snapshot/replay-data.js";
4
4
  import { validateSnapshotData } from "../snapshot/validation.js";
5
5
  import { pendingHostCallResumeIdentityMatches } from "../snapshot/policy.js";
@@ -530,8 +530,18 @@ function normalize(value, seen) {
530
530
  throw new TypeError("Host call arguments cannot contain cycles.");
531
531
  seen.add(value);
532
532
  try {
533
- if (Array.isArray(value))
534
- return value.map((entry) => normalize(entry, seen));
533
+ if (Array.isArray(value)) {
534
+ const normalized = new Array(value.length);
535
+ for (const [key, descriptor] of Object.entries(Object.getOwnPropertyDescriptors(value))) {
536
+ if (!isArrayIndexKey(key))
537
+ continue;
538
+ if (!("value" in descriptor)) {
539
+ throw new TypeError("Host call arguments cannot contain accessor properties.");
540
+ }
541
+ defineOwnDataProperty(normalized, key, normalize(descriptor.value, seen));
542
+ }
543
+ return normalized;
544
+ }
535
545
  return Object.fromEntries(Object.keys(value)
536
546
  .sort()
537
547
  .map((key) => [key, normalize(value[key], seen)]));
@@ -126,3 +126,5 @@ export declare function measureSandboxData(values: Iterable<unknown>, options?:
126
126
  }): number;
127
127
  export declare function deepCopyFromSandbox(value: SandboxPromise, options?: CopyFromSandboxOptions): Promise<unknown>;
128
128
  export declare function deepCopyFromSandbox(value: SandboxValue, options?: CopyFromSandboxOptions): unknown;
129
+ export declare function defineOwnDataProperty(target: object, key: string, value: unknown): void;
130
+ export declare function isArrayIndexKey(value: string): boolean;
@@ -548,7 +548,7 @@ function isPlainArray(value) {
548
548
  function createPlainObject(useNullPrototype) {
549
549
  return (useNullPrototype ? Object.create(null) : {});
550
550
  }
551
- function defineOwnDataProperty(target, key, value) {
551
+ export function defineOwnDataProperty(target, key, value) {
552
552
  Object.defineProperty(target, key, {
553
553
  enumerable: true,
554
554
  configurable: true,
@@ -590,7 +590,7 @@ function getEnumerableArrayEntries(value, path) {
590
590
  }
591
591
  return entries;
592
592
  }
593
- function isArrayIndexKey(value) {
593
+ export function isArrayIndexKey(value) {
594
594
  if (value === "") {
595
595
  return false;
596
596
  }