poe-code 11.0.7 → 11.0.9

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.
@@ -27,7 +27,7 @@ import {
27
27
  validateMigrationSemantics,
28
28
  validateSnapshotData,
29
29
  validateSnapshotMigration
30
- } from "./chunk-OPNWSDXC.js";
30
+ } from "./chunk-2GHBBE5J.js";
31
31
 
32
32
  // packages/safejs/src/migrate.ts
33
33
  import { createHash } from "node:crypto";
@@ -8055,4 +8055,4 @@ export {
8055
8055
  parseMcpConfig,
8056
8056
  makeMcpModule
8057
8057
  };
8058
- //# sourceMappingURL=chunk-M3VDOFN5.js.map
8058
+ //# sourceMappingURL=chunk-APPD5CFI.js.map
@@ -20,7 +20,7 @@ import {
20
20
  parseMcpConfig,
21
21
  splitFrontmatter,
22
22
  withBrokenPipeGuard
23
- } from "./chunks/chunk-M3VDOFN5.js";
23
+ } from "./chunks/chunk-APPD5CFI.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-OPNWSDXC.js";
35
+ } from "./chunks/chunk-2GHBBE5J.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-OPNWSDXC.js";
6
+ } from "./chunks/chunk-2GHBBE5J.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-M3VDOFN5.js";
30
+ } from "./chunks/chunk-APPD5CFI.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-OPNWSDXC.js";
52
+ } from "./chunks/chunk-2GHBBE5J.js";
53
53
  import "./chunks/chunk-4YIDX44G.js";
54
54
 
55
55
  // packages/safejs/src/runner/run-harness.ts
@@ -10,12 +10,12 @@ export function createObjectArrayGlobals(options) {
10
10
  }),
11
11
  values: createSandboxClosure({
12
12
  sandbox: true,
13
- call: ([value]) => budgetSandboxValue(getOwnEnumerableValues(value), options.budget),
13
+ call: ([value]) => allocateProducedSandboxValue(getOwnEnumerableValues(value), options.budget),
14
14
  name: "values"
15
15
  }),
16
16
  entries: createSandboxClosure({
17
17
  sandbox: true,
18
- call: ([value]) => budgetSandboxValue(getOwnEnumerableEntries(value), options.budget),
18
+ call: ([value]) => allocateProducedSandboxValue(getOwnEnumerableEntries(value), options.budget),
19
19
  name: "entries"
20
20
  }),
21
21
  hasOwn: createSandboxClosure({
@@ -30,7 +30,7 @@ export function createObjectArrayGlobals(options) {
30
30
  }),
31
31
  fromEntries: createSandboxClosure({
32
32
  sandbox: true,
33
- call: ([value]) => budgetSandboxValue(Reflect.apply(Object.fromEntries, Object, [value]), options.budget),
33
+ call: ([value]) => allocateProducedSandboxValue(Object.setPrototypeOf(Reflect.apply(Object.fromEntries, Object, [value]), null), options.budget),
34
34
  name: "fromEntries"
35
35
  }),
36
36
  freeze: createSandboxClosure({
@@ -1758,7 +1758,9 @@ async function evaluateMemberCallExpression(node, context) {
1758
1758
  if (typeof member.object === "number" && isNumberMethodName(member.property)) {
1759
1759
  return evaluateNumberMethodCall(node, member.object, member.property, context);
1760
1760
  }
1761
- if (Array.isArray(member.object) && isArrayMethodName(member.property)) {
1761
+ if (Array.isArray(member.object) &&
1762
+ isArrayMethodName(member.property) &&
1763
+ !Object.hasOwn(member.object, member.property)) {
1762
1764
  return evaluateArrayMethodCall(node, member.object, member.property, context);
1763
1765
  }
1764
1766
  if (isSandboxMap(member.object) && isMapMethodName(member.property)) {
@@ -1773,7 +1775,7 @@ async function evaluateMemberCallExpression(node, context) {
1773
1775
  if (typeof member.object === "number") {
1774
1776
  return evaluatePrimitiveMemberCall(node, "Number", member.property, getNumberMember(member.object, member.property, context.budget), context);
1775
1777
  }
1776
- if (Array.isArray(member.object)) {
1778
+ if (Array.isArray(member.object) && !Object.hasOwn(member.object, member.property)) {
1777
1779
  return evaluatePrimitiveMemberCall(node, "Array", member.property, getArrayMemberValue(member.object, member.property, context), context);
1778
1780
  }
1779
1781
  if (isSandboxMap(member.object)) {
@@ -2200,7 +2202,7 @@ function getMemberValue(target, property, context) {
2200
2202
  return Object.hasOwn(target, String(property)) ? target[String(property)] : undefined;
2201
2203
  }
2202
2204
  function getArrayMemberValue(target, property, context) {
2203
- if (property === "raw") {
2205
+ if (property === "raw" && taggedTemplateRawArrays.has(target)) {
2204
2206
  return taggedTemplateRawArrays.get(target);
2205
2207
  }
2206
2208
  return getArrayMember(target, property, createArrayMethodOptions(context));
@@ -2242,23 +2244,20 @@ function getClosureMemberValue(target, property, context) {
2242
2244
  return getFunctionMember(target, property, createFunctionMethodOptions(context));
2243
2245
  }
2244
2246
  async function evaluateResolvedCallExpression(node, callee, context, thisValue = undefined) {
2245
- if (callee === null || callee === undefined) {
2246
- if (node.optional) {
2247
- return {
2248
- kind: "normal",
2249
- hasValue: true,
2250
- value: undefined
2251
- };
2252
- }
2253
- throw new TypeError("Attempted to call a non-function value.");
2254
- }
2255
- if (!isSandboxClosure(callee)) {
2256
- throw new TypeError("Attempted to call a non-function value.");
2247
+ if ((callee === null || callee === undefined) && node.optional) {
2248
+ return {
2249
+ kind: "normal",
2250
+ hasValue: true,
2251
+ value: undefined
2252
+ };
2257
2253
  }
2258
2254
  const args = await evaluateCallArguments(node.arguments, context);
2259
2255
  if (!args.ok) {
2260
2256
  return args.result;
2261
2257
  }
2258
+ if (!isSandboxClosure(callee)) {
2259
+ throw new TypeError("Attempted to call a non-function value.");
2260
+ }
2262
2261
  return {
2263
2262
  kind: "normal",
2264
2263
  hasValue: true,
@@ -43,6 +43,9 @@ export function getArrayMember(value, property, options) {
43
43
  if (property === "length") {
44
44
  return value.length;
45
45
  }
46
+ if (Object.hasOwn(value, property)) {
47
+ return value[String(property)];
48
+ }
46
49
  if (isArrayMethodName(property)) {
47
50
  return createSandboxClosure({
48
51
  sandbox: true,