@poe-platform/safe-js 0.1.426 → 0.1.428
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.
- package/dist/safe-js/chunks/{chunk-V3XJABDF.js → chunk-KHHM7HUO.js} +1343 -374
- package/dist/safe-js/chunks/chunk-KHHM7HUO.js.map +7 -0
- package/dist/safe-js/chunks/{chunk-MYKH5PM4.js → chunk-LXXUZNYA.js} +2 -2
- package/dist/safe-js/cli.js +2 -2
- package/dist/safe-js/core.js +1 -1
- package/dist/safe-js/index.js +2 -2
- package/dist/safe-js/interp/async-disposable-stack.d.ts +36 -0
- package/dist/safe-js/interp/async.d.ts +7 -3
- package/dist/safe-js/interp/exceptions.d.ts +4 -1
- package/dist/safe-js/interp/generator-expression-state.d.ts +15 -3
- package/dist/safe-js/interp/generator.d.ts +3 -3
- package/dist/safe-js/interp/iteration.d.ts +10 -1
- package/dist/safe-js/interp/jobs.d.ts +4 -0
- package/dist/safe-js/interp/resource-management.d.ts +26 -0
- package/dist/safe-js/interp/scope.d.ts +4 -0
- package/dist/safe-js/parse/parser.d.ts +1 -0
- package/dist/safe-js/snapshot/guest-heap.d.ts +46 -0
- package/package.json +2 -2
- package/dist/safe-js/chunks/chunk-V3XJABDF.js.map +0 -7
- /package/dist/safe-js/chunks/{chunk-MYKH5PM4.js.map → chunk-LXXUZNYA.js.map} +0 -0
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
validateMigrationSemantics,
|
|
28
28
|
validateSnapshotData,
|
|
29
29
|
validateSnapshotMigration
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-KHHM7HUO.js";
|
|
31
31
|
|
|
32
32
|
// packages/safe-js/src/migrate.ts
|
|
33
33
|
import { createHash } from "node:crypto";
|
|
@@ -8249,4 +8249,4 @@ export {
|
|
|
8249
8249
|
parseMcpConfig,
|
|
8250
8250
|
makeMcpModule
|
|
8251
8251
|
};
|
|
8252
|
-
//# sourceMappingURL=chunk-
|
|
8252
|
+
//# sourceMappingURL=chunk-LXXUZNYA.js.map
|
package/dist/safe-js/cli.js
CHANGED
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
resolveFsConfig,
|
|
23
23
|
splitFrontmatter,
|
|
24
24
|
withBrokenPipeGuard
|
|
25
|
-
} from "./chunks/chunk-
|
|
25
|
+
} from "./chunks/chunk-LXXUZNYA.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-
|
|
37
|
+
} from "./chunks/chunk-KHHM7HUO.js";
|
|
38
38
|
import "./chunks/chunk-4YIDX44G.js";
|
|
39
39
|
|
|
40
40
|
// packages/safe-js/src/cli.ts
|
package/dist/safe-js/core.js
CHANGED
package/dist/safe-js/index.js
CHANGED
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
runWithSpawnUsageAccumulator,
|
|
27
27
|
splitFrontmatter,
|
|
28
28
|
supportsSpawnMode
|
|
29
|
-
} from "./chunks/chunk-
|
|
29
|
+
} from "./chunks/chunk-LXXUZNYA.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-
|
|
53
|
+
} from "./chunks/chunk-KHHM7HUO.js";
|
|
54
54
|
import "./chunks/chunk-4YIDX44G.js";
|
|
55
55
|
|
|
56
56
|
// packages/safe-js/src/parse.ts
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { type Budget } from "./budget.js";
|
|
2
|
+
import { type SandboxCallContext, type SandboxClosure, type SandboxPromise, type SandboxValue } from "./values.js";
|
|
3
|
+
export type AsyncDisposableResource = {
|
|
4
|
+
method: SandboxClosure | undefined;
|
|
5
|
+
receiver: SandboxValue;
|
|
6
|
+
args: SandboxValue[];
|
|
7
|
+
syncFallback: boolean;
|
|
8
|
+
synchronous?: boolean;
|
|
9
|
+
};
|
|
10
|
+
export type AsyncDisposableStackState = {
|
|
11
|
+
disposed: boolean;
|
|
12
|
+
resources: AsyncDisposableResource[];
|
|
13
|
+
};
|
|
14
|
+
export type AsyncCleanupState = {
|
|
15
|
+
resources: AsyncDisposableResource[];
|
|
16
|
+
capability: {
|
|
17
|
+
promise: SandboxPromise;
|
|
18
|
+
resolve: SandboxClosure;
|
|
19
|
+
reject: SandboxClosure;
|
|
20
|
+
};
|
|
21
|
+
phase: "running" | "waiting" | "done";
|
|
22
|
+
failed: boolean;
|
|
23
|
+
failure: SandboxValue;
|
|
24
|
+
needsAwait: boolean;
|
|
25
|
+
hasAwaited: boolean;
|
|
26
|
+
generation: number;
|
|
27
|
+
};
|
|
28
|
+
export declare const asyncDisposableStackStates: WeakMap<object, AsyncDisposableStackState>;
|
|
29
|
+
export declare const asyncCleanupStates: WeakMap<object, AsyncCleanupState>;
|
|
30
|
+
export declare const asyncCleanupHandlers: WeakMap<SandboxClosure, {
|
|
31
|
+
cleanup: AsyncCleanupState;
|
|
32
|
+
action: "fulfilled" | "rejected";
|
|
33
|
+
generation: number;
|
|
34
|
+
}>;
|
|
35
|
+
export declare function createAsyncCleanupHandler(cleanup: AsyncCleanupState, action: "fulfilled" | "rejected", budget: Budget, context?: SandboxCallContext, generation?: number): SandboxClosure;
|
|
36
|
+
export declare function advanceAsyncCleanup(cleanup: AsyncCleanupState, budget: Budget, context?: SandboxCallContext): Promise<void>;
|
|
@@ -6,7 +6,7 @@ import type { EvaluationResult } from "./exceptions.js";
|
|
|
6
6
|
import type { InterpreterError, InterpreterSnapshot, LoopIterationSnapshot } from "./interpreter.js";
|
|
7
7
|
import { CompileScope } from "./regex/compile-guard.js";
|
|
8
8
|
import type { Scope } from "./scope.js";
|
|
9
|
-
import { type SandboxCallContext, type SandboxClosure, type SandboxObject, type SandboxValue } from "./values.js";
|
|
9
|
+
import { type SandboxCallContext, type SandboxClosure, type SandboxGenerator, type SandboxObject, type SandboxPromise, type SandboxValue } from "./values.js";
|
|
10
10
|
export type InterpreterYieldPoint = {
|
|
11
11
|
kind: "await" | "generator-yield" | "loop-iteration";
|
|
12
12
|
nodeId?: number;
|
|
@@ -53,6 +53,8 @@ export type AsyncEvaluationContext = {
|
|
|
53
53
|
};
|
|
54
54
|
generatorYield?: (value?: SandboxValue, yieldNodeId?: number) => Promise<GeneratorCompletion>;
|
|
55
55
|
asyncGenerator?: boolean;
|
|
56
|
+
asyncGeneratorFrame?: SandboxGenerator;
|
|
57
|
+
asyncFunction?: boolean;
|
|
56
58
|
captureGeneratorScope?: (scope: Scope, blocks?: ReadonlyMap<number, Scope>, completions?: ReadonlyMap<number, import("./exceptions.js").CompletionResult>, expressions?: ReadonlyMap<number, import("./generator-expression-state.js").GeneratorExpressionState>) => void;
|
|
57
59
|
generatorExpressionStates?: ReadonlyMap<number, import("./generator-expression-state.js").GeneratorExpressionState>;
|
|
58
60
|
restoredGeneratorExpressionStates?: ReadonlyMap<number, import("./generator-expression-state.js").GeneratorExpressionState>;
|
|
@@ -67,12 +69,14 @@ export type AsyncEvaluationContext = {
|
|
|
67
69
|
};
|
|
68
70
|
};
|
|
69
71
|
export type EvaluateAsyncNode = (node: ParseResult, context: AsyncEvaluationContext) => Promise<AsyncEvaluationResult>;
|
|
70
|
-
export declare function emitResumeBreakpoint(context: AsyncEvaluationContext, breakpoint: ResumeBreakpoint): void;
|
|
72
|
+
export declare function emitResumeBreakpoint(context: Pick<AsyncEvaluationContext, "onYield" | "snapshot" | "scope">, breakpoint: ResumeBreakpoint): void;
|
|
71
73
|
export declare function evaluateArrowFunctionExpression(node: ArrowFunctionExpression, context: AsyncEvaluationContext, evaluateNode: EvaluateAsyncNode): Promise<AsyncEvaluationResult>;
|
|
72
74
|
export declare function evaluateFunctionExpression(node: FunctionExpression, context: AsyncEvaluationContext, evaluateNode: EvaluateAsyncNode): Promise<AsyncEvaluationResult>;
|
|
73
75
|
export declare function createInterpretedClosure(node: ArrowFunctionExpression | FunctionDeclaration | FunctionExpression, context: AsyncEvaluationContext, evaluateNode: EvaluateAsyncNode, homeObject?: SandboxObject | SandboxClosure, initializeGeneratorPrototype?: boolean): SandboxClosure;
|
|
74
|
-
export declare function executeAsyncFunction(execute: (onSuspend: () => void) => Promise<SandboxValue>, budget: Budget, signal?: AbortSignal, callContext?: SandboxCallContext):
|
|
76
|
+
export declare function executeAsyncFunction(execute: (onSuspend: () => void) => Promise<SandboxValue>, budget: Budget, signal?: AbortSignal, callContext?: SandboxCallContext): SandboxPromise;
|
|
75
77
|
export declare function evaluateAwaitExpression(node: AwaitExpression, context: AsyncEvaluationContext, evaluateNode: EvaluateAsyncNode): Promise<AsyncEvaluationResult>;
|
|
78
|
+
export type AsyncSuspensionContext = Pick<AsyncEvaluationContext, "scope" | "captureGeneratorScope" | "generatorBlockScopes" | "finallyCompletions" | "generatorExpressionStates" | "generatorYield" | "generatorResume" | "asyncFunction" | "asyncGeneratorFrame" | "budget" | "onYield" | "snapshot" | "onSuspend" | "captureReplayState" | "signal">;
|
|
79
|
+
export declare function suspendAsyncFunctionValue(value: SandboxValue, node: ParseResult, context: AsyncSuspensionContext, replayState?: unknown, callContext?: SandboxCallContext, phase?: "await" | "yield" | "return" | "resume-return"): Promise<SandboxValue>;
|
|
76
80
|
export declare function executeClosure(node: ArrowFunctionExpression | FunctionDeclaration | FunctionExpression, args: readonly SandboxValue[], thisValue: SandboxValue, context: AsyncEvaluationContext, evaluateNode: EvaluateAsyncNode): Promise<SandboxValue>;
|
|
77
81
|
export declare function normalizeClosureResult(result: SandboxValue | Promise<SandboxValue> | PromiseLike<SandboxValue>, budget?: Budget): SandboxValue;
|
|
78
82
|
export {};
|
|
@@ -4,6 +4,7 @@ import { type Budget } from "./budget.js";
|
|
|
4
4
|
import type { Scope } from "./scope.js";
|
|
5
5
|
import type { InterpreterError } from "./interpreter.js";
|
|
6
6
|
import { type SandboxObject, type SandboxValue } from "./values.js";
|
|
7
|
+
import type { AsyncSuspensionContext } from "./async.js";
|
|
7
8
|
declare const capturedExceptionBrand: unique symbol;
|
|
8
9
|
export type { SandboxErrorName } from "../error/shape.js";
|
|
9
10
|
export type CompletionKind = "normal" | "return" | "throw" | "break" | "continue";
|
|
@@ -26,7 +27,9 @@ type CapturedException = {
|
|
|
26
27
|
readonly stackFrames: readonly string[];
|
|
27
28
|
readonly [capturedExceptionBrand]: true;
|
|
28
29
|
};
|
|
29
|
-
type ExceptionContext = {
|
|
30
|
+
type ExceptionContext = AsyncSuspensionContext & {
|
|
31
|
+
onSuspend?: () => void;
|
|
32
|
+
signal?: AbortSignal;
|
|
30
33
|
budget: Budget;
|
|
31
34
|
callStack: readonly string[];
|
|
32
35
|
scope: Scope;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { SandboxValue } from "./values.js";
|
|
2
2
|
import type { Scope } from "./scope.js";
|
|
3
|
-
import type {
|
|
3
|
+
import type { CompletionResult } from "./exceptions.js";
|
|
4
|
+
import type { SandboxIterator, IteratorSnapshot, IteratorAwaitState } from "./iteration.js";
|
|
4
5
|
export type GeneratorExpressionState<T = SandboxValue, S = Scope, I = SandboxIterator | IteratorSnapshot> = {
|
|
5
6
|
kind: "switch";
|
|
6
7
|
phase: "test" | "body";
|
|
@@ -14,6 +15,12 @@ export type GeneratorExpressionState<T = SandboxValue, S = Scope, I = SandboxIte
|
|
|
14
15
|
value: T;
|
|
15
16
|
current: T;
|
|
16
17
|
iterator: I;
|
|
18
|
+
phase?: "await" | "close";
|
|
19
|
+
awaitState?: IteratorAwaitState;
|
|
20
|
+
completion?: {
|
|
21
|
+
type: "normal" | "return" | "throw";
|
|
22
|
+
value: T;
|
|
23
|
+
};
|
|
17
24
|
} | {
|
|
18
25
|
kind: "declaration";
|
|
19
26
|
index: number;
|
|
@@ -49,7 +56,12 @@ export type GeneratorExpressionState<T = SandboxValue, S = Scope, I = SandboxIte
|
|
|
49
56
|
scope: S;
|
|
50
57
|
} | {
|
|
51
58
|
kind: "for-of-iterator";
|
|
52
|
-
phase: "left" | "body";
|
|
59
|
+
phase: "left" | "body" | "next" | "close";
|
|
60
|
+
awaitState?: IteratorAwaitState;
|
|
61
|
+
closeCompletion?: Omit<CompletionResult, "value" | "node" | "stackFrames"> & {
|
|
62
|
+
value: T;
|
|
63
|
+
stackFrames?: string[];
|
|
64
|
+
};
|
|
53
65
|
async: boolean;
|
|
54
66
|
value: T;
|
|
55
67
|
current: T;
|
|
@@ -65,7 +77,7 @@ export type GeneratorExpressionState<T = SandboxValue, S = Scope, I = SandboxIte
|
|
|
65
77
|
scope: S;
|
|
66
78
|
} | {
|
|
67
79
|
kind: "for";
|
|
68
|
-
phase: "init" | "test" | "body" | "update";
|
|
80
|
+
phase: "init" | "test" | "body" | "update" | "dispose";
|
|
69
81
|
loopScope: S;
|
|
70
82
|
activeScope: S;
|
|
71
83
|
} | {
|
|
@@ -3,9 +3,9 @@ export type GeneratorCompletion = {
|
|
|
3
3
|
value: unknown;
|
|
4
4
|
};
|
|
5
5
|
export type GeneratorChannel = {
|
|
6
|
-
next(value?: unknown): Promise<IteratorResult<unknown>>;
|
|
7
|
-
return(value?: unknown): Promise<IteratorResult<unknown>>;
|
|
8
|
-
throw(error?: unknown): Promise<IteratorResult<unknown>>;
|
|
6
|
+
next(value?: unknown, record?: boolean): Promise<IteratorResult<unknown>>;
|
|
7
|
+
return(value?: unknown, record?: boolean): Promise<IteratorResult<unknown>>;
|
|
8
|
+
throw(error?: unknown, record?: boolean): Promise<IteratorResult<unknown>>;
|
|
9
9
|
snapshot(): GeneratorChannelSnapshot;
|
|
10
10
|
};
|
|
11
11
|
export type GeneratorChannelSnapshot = {
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import { type SandboxGenerator, type SandboxCallContext, type SandboxValue } from "./values.js";
|
|
2
2
|
import { Budget } from "./budget.js";
|
|
3
|
+
export type IteratorAwaitState = {
|
|
4
|
+
kind: "result";
|
|
5
|
+
} | {
|
|
6
|
+
kind: "value";
|
|
7
|
+
done: boolean;
|
|
8
|
+
closeOnReject: boolean;
|
|
9
|
+
};
|
|
3
10
|
export type SandboxIterator = {
|
|
11
|
+
awaitValue?(value: SandboxValue, state: IteratorAwaitState): Promise<SandboxValue>;
|
|
12
|
+
resumeAwait?(state: IteratorAwaitState, value: () => Promise<SandboxValue>): Promise<IteratorResult<SandboxValue>>;
|
|
4
13
|
snapshot?(): IteratorSnapshot;
|
|
5
14
|
readonly asyncProtocol?: true;
|
|
6
15
|
readonly generator?: true;
|
|
@@ -38,6 +47,6 @@ export declare function readIteratorResult(iterator: SandboxIterator, result: It
|
|
|
38
47
|
value: SandboxValue;
|
|
39
48
|
}>;
|
|
40
49
|
export declare function getSandboxAsyncIterator(value: SandboxValue, budget: Budget, context?: SandboxCallContext, signal?: AbortSignal): SandboxIterator | undefined;
|
|
41
|
-
export declare function closeIterator(iterator: SandboxIterator, preserveThrow?: boolean): Promise<void>;
|
|
50
|
+
export declare function closeIterator(iterator: SandboxIterator, preserveThrow?: boolean, awaitResult?: <T>(pending: Promise<T>) => Promise<T>): Promise<void>;
|
|
42
51
|
export declare function getSandboxIterator(value: SandboxValue, budget?: Budget, context?: SandboxCallContext): SandboxIterator | undefined;
|
|
43
52
|
export declare function generatorIterator(generator: SandboxGenerator, budget?: Budget, context?: SandboxCallContext): SandboxIterator;
|
|
@@ -17,6 +17,10 @@ export declare class SandboxJobQueue {
|
|
|
17
17
|
private advance;
|
|
18
18
|
}
|
|
19
19
|
export declare function runPromiseJob<T>(task: () => T | Promise<T>): Promise<T>;
|
|
20
|
+
export declare function createResumableJobContext(): {
|
|
21
|
+
run<T>(task: () => T): T;
|
|
22
|
+
release(): void;
|
|
23
|
+
};
|
|
20
24
|
export declare function runAsyncPrefix<T>(task: () => Promise<T>): Promise<T>;
|
|
21
25
|
export declare function suspendJob<T>(pending: Promise<T>): Promise<T>;
|
|
22
26
|
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ParseResult } from "../parse.js";
|
|
2
|
+
import { type AsyncSuspensionContext } from "./async.js";
|
|
3
|
+
import { type AsyncCleanupState, type AsyncDisposableResource } from "./async-disposable-stack.js";
|
|
4
|
+
import { type Budget } from "./budget.js";
|
|
5
|
+
import { type CompletionResult, type EvaluationResult } from "./exceptions.js";
|
|
6
|
+
import type { Scope } from "./scope.js";
|
|
7
|
+
import { type SandboxCallContext, type SandboxValue } from "./values.js";
|
|
8
|
+
export type ResourceScopeState = {
|
|
9
|
+
resources: AsyncDisposableResource[];
|
|
10
|
+
cleanup?: AsyncCleanupState;
|
|
11
|
+
completion?: Omit<CompletionResult, "stackFrames"> & {
|
|
12
|
+
stackFrames?: string[];
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export declare function resourceSuspension(context: AsyncSuspensionContext, node: ParseResult): {
|
|
16
|
+
awaitResource?: (value: SandboxValue) => Promise<SandboxValue>;
|
|
17
|
+
resumeResource?: boolean;
|
|
18
|
+
};
|
|
19
|
+
export declare function assertResourceScopeState(value: unknown): asserts value is ResourceScopeState;
|
|
20
|
+
export declare function registerScopeResource(scope: Scope, value: SandboxValue, hint: "sync" | "async", budget: Budget, context?: SandboxCallContext): Promise<void>;
|
|
21
|
+
export declare function evaluateResourceScope<TError>(scope: Scope, budget: Budget, context: (SandboxCallContext & {
|
|
22
|
+
onSuspend?: () => void;
|
|
23
|
+
signal?: AbortSignal;
|
|
24
|
+
awaitResource?: (value: SandboxValue) => Promise<SandboxValue>;
|
|
25
|
+
resumeResource?: boolean;
|
|
26
|
+
}) | undefined, body: () => Promise<EvaluationResult<TError>>): Promise<EvaluationResult<TError>>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { VariableDeclarationKind } from "../parse.js";
|
|
2
2
|
import type { PrivateName } from "./private-state.js";
|
|
3
3
|
import type { InterpreterSnapshot, InterpreterValue } from "./interpreter.js";
|
|
4
|
+
import type { ResourceScopeState } from "./resource-management.js";
|
|
4
5
|
type ScopeLookupResult = {
|
|
5
6
|
found: true;
|
|
6
7
|
kind: VariableDeclarationKind;
|
|
@@ -13,6 +14,7 @@ type ScopeOptions = {
|
|
|
13
14
|
chargeData?: boolean;
|
|
14
15
|
};
|
|
15
16
|
export type ScopeFrame = {
|
|
17
|
+
resourceState?: ResourceScopeState;
|
|
16
18
|
privateNames?: Array<[string, PrivateName]>;
|
|
17
19
|
parent?: Scope;
|
|
18
20
|
importMeta?: InterpreterValue;
|
|
@@ -34,6 +36,7 @@ export declare class Scope {
|
|
|
34
36
|
private readonly parent?;
|
|
35
37
|
private importMeta?;
|
|
36
38
|
private readonly options;
|
|
39
|
+
resourceState?: ResourceScopeState;
|
|
37
40
|
privateNames?: Map<string, PrivateName>;
|
|
38
41
|
constructor(bindings?: Record<string, InterpreterValue>, parent?: Scope | undefined, importMeta?: InterpreterValue, options?: ScopeOptions, restoredBindings?: Record<string, InterpreterValue>);
|
|
39
42
|
child(bindings?: Record<string, InterpreterValue>, options?: ScopeOptions): Scope;
|
|
@@ -62,6 +65,7 @@ export declare class Scope {
|
|
|
62
65
|
hydrateFrame(frame: ScopeFrame): void;
|
|
63
66
|
copyInitializedBindingsFrom(source: Scope, names: readonly string[]): void;
|
|
64
67
|
private resolveScope;
|
|
68
|
+
private trackReplacement;
|
|
65
69
|
private requireInitializedBinding;
|
|
66
70
|
}
|
|
67
71
|
export {};
|
|
@@ -217,6 +217,7 @@ export type VariableDeclaration = BaseNode & {
|
|
|
217
217
|
type: "VariableDeclaration";
|
|
218
218
|
declarations: VariableDeclarator[];
|
|
219
219
|
kind: VariableDeclarationKind;
|
|
220
|
+
disposal?: "sync" | "async";
|
|
220
221
|
};
|
|
221
222
|
export type ReturnStatement = BaseNode & {
|
|
222
223
|
type: "ReturnStatement";
|
|
@@ -18,6 +18,7 @@ export type AsyncResourceData<T> = {
|
|
|
18
18
|
receiver: T;
|
|
19
19
|
args: T[];
|
|
20
20
|
syncFallback: boolean;
|
|
21
|
+
synchronous?: boolean;
|
|
21
22
|
};
|
|
22
23
|
export type GuestObjectState<T> = {
|
|
23
24
|
properties: PropertyDescriptorData<T>;
|
|
@@ -35,6 +36,45 @@ export type PrivateElementData<T> = {
|
|
|
35
36
|
set: T;
|
|
36
37
|
});
|
|
37
38
|
export type GuestHeapNode<T> = {
|
|
39
|
+
kind: "async-generator-driver";
|
|
40
|
+
generator: T;
|
|
41
|
+
requests: Array<{
|
|
42
|
+
method: "next" | "return" | "throw";
|
|
43
|
+
value: T;
|
|
44
|
+
capability: {
|
|
45
|
+
promise: T;
|
|
46
|
+
resolve: T;
|
|
47
|
+
reject: T;
|
|
48
|
+
};
|
|
49
|
+
}>;
|
|
50
|
+
phase: "idle" | "waiting";
|
|
51
|
+
suspension: "await" | "yield";
|
|
52
|
+
awaitKind: "body" | "return";
|
|
53
|
+
generation: number;
|
|
54
|
+
} | {
|
|
55
|
+
kind: "async-generator-handler";
|
|
56
|
+
driver: T;
|
|
57
|
+
owner: T;
|
|
58
|
+
action: "fulfilled" | "rejected";
|
|
59
|
+
generation: number;
|
|
60
|
+
state: GuestObjectState<T>;
|
|
61
|
+
} | {
|
|
62
|
+
kind: "async-function-driver";
|
|
63
|
+
generator: T;
|
|
64
|
+
capability: {
|
|
65
|
+
promise: T;
|
|
66
|
+
resolve: T;
|
|
67
|
+
reject: T;
|
|
68
|
+
};
|
|
69
|
+
phase: "waiting" | "done";
|
|
70
|
+
generation: number;
|
|
71
|
+
} | {
|
|
72
|
+
kind: "async-function-handler";
|
|
73
|
+
driver: T;
|
|
74
|
+
action: "fulfilled" | "rejected";
|
|
75
|
+
generation: number;
|
|
76
|
+
state: GuestObjectState<T>;
|
|
77
|
+
} | {
|
|
38
78
|
kind: "async-disposable-stack";
|
|
39
79
|
disposed: boolean;
|
|
40
80
|
resources: AsyncResourceData<T>[];
|
|
@@ -128,6 +168,7 @@ export type GuestHeapNode<T> = {
|
|
|
128
168
|
value: T;
|
|
129
169
|
reactions?: T[];
|
|
130
170
|
producers?: T[];
|
|
171
|
+
generatorOwner?: T;
|
|
131
172
|
state: GuestObjectState<T>;
|
|
132
173
|
} | {
|
|
133
174
|
kind: "promise-resolver";
|
|
@@ -140,6 +181,7 @@ export type GuestHeapNode<T> = {
|
|
|
140
181
|
thenable?: T;
|
|
141
182
|
reactions: T[];
|
|
142
183
|
producers?: T[];
|
|
184
|
+
generatorOwner?: T;
|
|
143
185
|
state: GuestObjectState<T>;
|
|
144
186
|
} | {
|
|
145
187
|
kind: "promise-adoption";
|
|
@@ -261,6 +303,9 @@ export type GuestHeapNode<T> = {
|
|
|
261
303
|
kind: "guest-generator";
|
|
262
304
|
state: "start" | "running" | "suspended" | "done";
|
|
263
305
|
astNodeId: number;
|
|
306
|
+
asyncFunction?: true;
|
|
307
|
+
driver?: T;
|
|
308
|
+
awaitPhase?: "await" | "yield" | "return" | "resume-return";
|
|
264
309
|
async: boolean;
|
|
265
310
|
scope: T;
|
|
266
311
|
closureScope: T;
|
|
@@ -310,6 +355,7 @@ export type GuestHeapNode<T> = {
|
|
|
310
355
|
importMeta: T;
|
|
311
356
|
functionBoundary: boolean;
|
|
312
357
|
chargeData: boolean;
|
|
358
|
+
resourceState?: T;
|
|
313
359
|
privateNames?: Array<[string, T]>;
|
|
314
360
|
bindings: Array<[string, number]>;
|
|
315
361
|
cells: Array<{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@poe-platform/safe-js",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.428",
|
|
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.
|
|
61
|
+
"@poe-platform/safe-fs": "0.1.428",
|
|
62
62
|
"@petamoriken/float16": "^3.9.3",
|
|
63
63
|
"yaml": "^2.8.2",
|
|
64
64
|
"jose": "^6.1.3",
|