poe-code 11.0.27 → 11.0.29

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-EW4KQ32H.js";
23
+ } from "./chunks/chunk-DB2DNWCX.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-LSVSAZHI.js";
35
+ } from "./chunks/chunk-HC3QSP5N.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-LSVSAZHI.js";
6
+ } from "./chunks/chunk-HC3QSP5N.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-EW4KQ32H.js";
30
+ } from "./chunks/chunk-DB2DNWCX.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-LSVSAZHI.js";
52
+ } from "./chunks/chunk-HC3QSP5N.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 { createSandboxClosure, deepCopyToSandbox, measureSandboxData } from "./values.js";
2
+ import { cloneSandboxValue, createSandboxClosure, 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";
@@ -365,8 +365,8 @@ export class HostCallJournal {
365
365
  }
366
366
  function copyOutcome(outcome) {
367
367
  return outcome.status === "fulfilled"
368
- ? { status: "fulfilled", value: deepCopyToSandbox(outcome.value) }
369
- : { status: "rejected", reason: deepCopyToSandbox(outcome.reason) };
368
+ ? { status: "fulfilled", value: cloneSandboxValue(outcome.value) }
369
+ : { status: "rejected", reason: cloneSandboxValue(outcome.reason) };
370
370
  }
371
371
  function restoreReplayCalls(input, encodedOutcomes, callbackSizes, requiredHostCapabilities = new Set()) {
372
372
  validateSnapshotData(input);
@@ -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
  }