@poe-platform/safe-js 0.1.401 → 0.1.402

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.
@@ -22,7 +22,7 @@ import {
22
22
  resolveFsConfig,
23
23
  splitFrontmatter,
24
24
  withBrokenPipeGuard
25
- } from "./chunks/chunk-YFCLIG72.js";
25
+ } from "./chunks/chunk-3DXEWN6Z.js";
26
26
  import {
27
27
  Budget,
28
28
  SandboxError,
@@ -34,7 +34,7 @@ import {
34
34
  replaceErrorStack,
35
35
  restore,
36
36
  run
37
- } from "./chunks/chunk-HDEGJ4AI.js";
37
+ } from "./chunks/chunk-5RNME7ZM.js";
38
38
  import "./chunks/chunk-4YIDX44G.js";
39
39
 
40
40
  // packages/safe-js/src/cli.ts
@@ -5,7 +5,7 @@ import {
5
5
  defineExtension,
6
6
  lint,
7
7
  run
8
- } from "./chunks/chunk-HDEGJ4AI.js";
8
+ } from "./chunks/chunk-5RNME7ZM.js";
9
9
  import "./chunks/chunk-4YIDX44G.js";
10
10
  export {
11
11
  Budget,
@@ -26,7 +26,7 @@ import {
26
26
  runWithSpawnUsageAccumulator,
27
27
  splitFrontmatter,
28
28
  supportsSpawnMode
29
- } from "./chunks/chunk-YFCLIG72.js";
29
+ } from "./chunks/chunk-3DXEWN6Z.js";
30
30
  import {
31
31
  Budget,
32
32
  FileSnapshotBackend,
@@ -50,7 +50,7 @@ import {
50
50
  registerPendingHostCallPolicy,
51
51
  restore,
52
52
  run
53
- } from "./chunks/chunk-HDEGJ4AI.js";
53
+ } from "./chunks/chunk-5RNME7ZM.js";
54
54
  import "./chunks/chunk-4YIDX44G.js";
55
55
 
56
56
  // packages/safe-js/src/parse.ts
@@ -0,0 +1,67 @@
1
+ import type { SandboxClosure, SandboxObject, SandboxPromise, SandboxValue } from "./values.js";
2
+ export type PromiseAggregateState = {
3
+ method: "all" | "allSettled" | "race" | "any";
4
+ capability: {
5
+ promise: SandboxValue;
6
+ resolve: SandboxClosure;
7
+ reject: SandboxClosure;
8
+ };
9
+ values: SandboxValue[];
10
+ remaining: number;
11
+ size: number;
12
+ iteration: "active" | "complete" | "abrupt";
13
+ };
14
+ export type PromiseAggregateEntry = {
15
+ aggregate: PromiseAggregateState;
16
+ index: number;
17
+ called: boolean;
18
+ };
19
+ export declare const promiseAggregateHandlers: WeakMap<SandboxClosure, {
20
+ entry: PromiseAggregateEntry;
21
+ action: "fulfilled" | "rejected";
22
+ }>;
23
+ export declare const promiseAggregateStates: WeakMap<object, PromiseAggregateState>;
24
+ export declare const promiseAggregateEntries: WeakMap<object, PromiseAggregateEntry>;
25
+ export type PromiseAdoptionBridge = {
26
+ source: SandboxPromise;
27
+ owner: SandboxPromise | undefined;
28
+ settled: boolean;
29
+ promise: Promise<SandboxValue>;
30
+ resolve: SandboxClosure;
31
+ reject: SandboxClosure;
32
+ rejectNative: (reason: unknown) => void;
33
+ };
34
+ export declare const promiseAdoptions: WeakMap<SandboxPromise, SandboxObject>;
35
+ export declare const promiseAdoptionBridges: WeakMap<object, PromiseAdoptionBridge>;
36
+ export declare const promiseAdoptionResolvers: WeakMap<SandboxClosure, {
37
+ bridge: SandboxObject;
38
+ action: "fulfilled" | "rejected";
39
+ }>;
40
+ export type PromiseContinuation = {
41
+ kind: "capability";
42
+ state: {
43
+ promise: SandboxPromise;
44
+ settled: boolean;
45
+ };
46
+ resolution?: {
47
+ status: "fulfilled" | "rejected";
48
+ value: SandboxValue;
49
+ };
50
+ } | {
51
+ kind: "reaction";
52
+ phase: "waiting" | "running";
53
+ source: SandboxPromise;
54
+ onFulfilled: SandboxValue;
55
+ onRejected: SandboxValue;
56
+ aggregate?: SandboxPromise;
57
+ capability?: {
58
+ promise: SandboxPromise;
59
+ resolve: SandboxClosure;
60
+ reject: SandboxClosure;
61
+ };
62
+ };
63
+ export declare const promiseContinuations: WeakMap<SandboxPromise, PromiseContinuation>;
64
+ export declare const promiseReactionResults: WeakMap<SandboxPromise, Set<SandboxPromise>>;
65
+ export declare const promiseProducers: WeakMap<SandboxPromise, Set<SandboxPromise>>;
66
+ export declare function linkPromiseAggregateProducer(producer: SandboxPromise, aggregate: SandboxPromise): void;
67
+ export declare function trackPromiseContinuation(promise: SandboxPromise, continuation: PromiseContinuation): void;
@@ -2,6 +2,7 @@ import { type SandboxErrorName } from "../error/shape.js";
2
2
  import { type CollectionIterationMethod } from "../interp/collection-iterator.js";
3
3
  import { type IteratorHelperState } from "../interp/iterator-helper.js";
4
4
  import { type ScopeFrame } from "../interp/scope.js";
5
+ import { type PromiseAggregateState } from "../interp/promise-continuations.js";
5
6
  import { type PropertyDescriptorData } from "./property-descriptors.js";
6
7
  import { type PrivateName, type PrivateElement } from "../interp/private-state.js";
7
8
  import type { CompletionResult } from "../interp/exceptions.js";
@@ -28,6 +29,28 @@ export type PrivateElementData<T> = {
28
29
  set: T;
29
30
  });
30
31
  export type GuestHeapNode<T> = {
32
+ kind: "promise-aggregate";
33
+ method: PromiseAggregateState["method"];
34
+ capability: {
35
+ promise: T;
36
+ resolve: T;
37
+ reject: T;
38
+ };
39
+ values: T;
40
+ remaining: number;
41
+ size: number;
42
+ iteration: "complete" | "abrupt";
43
+ } | {
44
+ kind: "aggregate-entry";
45
+ aggregate: T;
46
+ index: number;
47
+ called: boolean;
48
+ } | {
49
+ kind: "aggregate-handler";
50
+ entry: T;
51
+ action: "fulfilled" | "rejected";
52
+ state: GuestObjectState<T>;
53
+ } | {
31
54
  kind: "guest-regex";
32
55
  source: string;
33
56
  flags: string;
@@ -65,6 +88,7 @@ export type GuestHeapNode<T> = {
65
88
  onRejected: T;
66
89
  reactions: T[];
67
90
  producers?: T[];
91
+ aggregate?: T;
68
92
  capability?: {
69
93
  promise: T;
70
94
  resolve: T;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@poe-platform/safe-js",
3
- "version": "0.1.401",
3
+ "version": "0.1.402",
4
4
  "description": "Budgeted JavaScript interpreter with explicit host capabilities and resumable execution",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -58,7 +58,7 @@
58
58
  "access": "public"
59
59
  },
60
60
  "dependencies": {
61
- "@poe-platform/safe-fs": "0.1.401",
61
+ "@poe-platform/safe-fs": "0.1.402",
62
62
  "@petamoriken/float16": "^3.9.3",
63
63
  "yaml": "^2.8.2",
64
64
  "jose": "^6.1.3",