poe-code 11.0.10 → 11.0.12

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-BESE73VB.js";
30
+ } from "./chunk-5BWI6HAZ.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-DF7PY5YX.js.map
8058
+ //# sourceMappingURL=chunk-WV23C6SS.js.map
@@ -20,7 +20,7 @@ import {
20
20
  parseMcpConfig,
21
21
  splitFrontmatter,
22
22
  withBrokenPipeGuard
23
- } from "./chunks/chunk-DF7PY5YX.js";
23
+ } from "./chunks/chunk-WV23C6SS.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-BESE73VB.js";
35
+ } from "./chunks/chunk-5BWI6HAZ.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-BESE73VB.js";
6
+ } from "./chunks/chunk-5BWI6HAZ.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-DF7PY5YX.js";
30
+ } from "./chunks/chunk-WV23C6SS.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-BESE73VB.js";
52
+ } from "./chunks/chunk-5BWI6HAZ.js";
53
53
  import "./chunks/chunk-4YIDX44G.js";
54
54
 
55
55
  // packages/safejs/src/runner/run-harness.ts
@@ -30,7 +30,16 @@ export function createObjectArrayGlobals(options) {
30
30
  }),
31
31
  fromEntries: createSandboxClosure({
32
32
  sandbox: true,
33
- call: ([value]) => allocateProducedSandboxValue(Object.setPrototypeOf(Reflect.apply(Object.fromEntries, Object, [value]), null), options.budget),
33
+ call: ([value]) => {
34
+ const iterator = getSandboxIterator(value);
35
+ if (iterator === undefined) {
36
+ throw new TypeError("Object.fromEntries requires an iterable.");
37
+ }
38
+ if (!iterator.generator) {
39
+ return allocateProducedSandboxValue(Object.setPrototypeOf(Reflect.apply(Object.fromEntries, Object, [{ [Symbol.iterator]: () => iterator }]), null), options.budget);
40
+ }
41
+ return objectFromSandboxEntries(iterator, options.budget);
42
+ },
34
43
  name: "fromEntries"
35
44
  }),
36
45
  freeze: createSandboxClosure({
@@ -151,6 +160,41 @@ export function createObjectArrayGlobals(options) {
151
160
  })
152
161
  };
153
162
  }
163
+ async function objectFromSandboxEntries(iterator, budget) {
164
+ const object = Object.create(null);
165
+ try {
166
+ while (true) {
167
+ const result = await iterator.next();
168
+ if ((typeof result !== "object" && typeof result !== "function") || result === null) {
169
+ throw new TypeError("Iterator result must be an object.");
170
+ }
171
+ if (result.done)
172
+ break;
173
+ const entry = result.value;
174
+ if ((typeof entry !== "object" && typeof entry !== "function") || entry === null) {
175
+ throw new TypeError("Object.fromEntries requires entry objects.");
176
+ }
177
+ const key = entry[0];
178
+ const value = entry[1];
179
+ Object.defineProperty(object, key, {
180
+ configurable: true,
181
+ enumerable: true,
182
+ value,
183
+ writable: true
184
+ });
185
+ }
186
+ }
187
+ catch (error) {
188
+ try {
189
+ await iterator.return?.();
190
+ }
191
+ catch {
192
+ throw error;
193
+ }
194
+ throw error;
195
+ }
196
+ return allocateProducedSandboxValue(object, budget);
197
+ }
154
198
  function assignSandboxValues(target, sources) {
155
199
  if (target === null || target === undefined) {
156
200
  throw new TypeError("Object.assign(target, ...sources) requires a non-null target.");
@@ -35,12 +35,12 @@ function bindImportDeclaration(declaration, registry, wrappedModules, bindings,
35
35
  throw createModuleImportError(createUnknownModuleMessage(moduleName, [...registry.keys()]), declaration.source.span);
36
36
  }
37
37
  const wrappedExports = wrappedModules.get(moduleName) ??
38
- wrapCancelableBindings(wrapCallerInjectedBindings(Object.fromEntries(moduleExports), {
38
+ createBindingRecord(wrapCancelableBindings(wrapCallerInjectedBindings(Object.fromEntries(moduleExports), {
39
39
  budget: options.budget,
40
40
  hostCalls: options.hostCalls,
41
41
  moduleId: moduleName,
42
42
  signal: options.signal
43
- }), options.signal);
43
+ }), options.signal));
44
44
  wrappedModules.set(moduleName, wrappedExports);
45
45
  for (const specifier of declaration.specifiers) {
46
46
  const localName = specifier.local.name;
@@ -57,7 +57,7 @@ function bindImportDeclaration(declaration, registry, wrappedModules, bindings,
57
57
  }
58
58
  function resolveImportSpecifier(moduleName, specifier, wrappedExports) {
59
59
  if (specifier.type === "ImportNamespaceSpecifier") {
60
- return createBindingRecord(wrappedExports);
60
+ return wrappedExports;
61
61
  }
62
62
  const exportName = specifier.type === "ImportDefaultSpecifier" ? "default" : specifier.imported.name;
63
63
  const exportedValue = wrappedExports[exportName];