@poe-platform/safe-js 0.1.213 → 0.1.215

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-LQN7F4MV.js";
25
+ } from "./chunks/chunk-VJZDZJ6B.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-X6T66CDS.js";
37
+ } from "./chunks/chunk-XEABTBIE.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-X6T66CDS.js";
8
+ } from "./chunks/chunk-XEABTBIE.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-LQN7F4MV.js";
29
+ } from "./chunks/chunk-VJZDZJ6B.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-X6T66CDS.js";
53
+ } from "./chunks/chunk-XEABTBIE.js";
54
54
  import "./chunks/chunk-4YIDX44G.js";
55
55
 
56
56
  // packages/safe-js/src/parse.ts
@@ -53,7 +53,15 @@ export type AsyncEvaluationContext = {
53
53
  };
54
54
  generatorYield?: (value?: SandboxValue, yieldNodeId?: number) => Promise<GeneratorCompletion>;
55
55
  asyncGenerator?: boolean;
56
+ 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
+ generatorExpressionStates?: ReadonlyMap<number, import("./generator-expression-state.js").GeneratorExpressionState>;
58
+ restoredGeneratorExpressionStates?: ReadonlyMap<number, import("./generator-expression-state.js").GeneratorExpressionState>;
59
+ finallyCompletions?: ReadonlyMap<number, import("./exceptions.js").CompletionResult>;
60
+ restoredFinallyCompletions?: ReadonlyMap<number, import("./exceptions.js").CompletionResult>;
61
+ generatorBlockScopes?: ReadonlyMap<number, Scope>;
62
+ restoredGeneratorBlockScopes?: ReadonlyMap<number, Scope>;
56
63
  generatorResume?: {
64
+ completed?: boolean;
57
65
  sent: GeneratorCompletion[];
58
66
  yieldNodeId: number;
59
67
  };
@@ -30,6 +30,15 @@ type ExceptionContext = {
30
30
  budget: Budget;
31
31
  callStack: readonly string[];
32
32
  scope: Scope;
33
+ generatorYield?: unknown;
34
+ generatorResume?: {
35
+ yieldNodeId: number;
36
+ completed?: boolean;
37
+ };
38
+ generatorBlockScopes?: ReadonlyMap<number, Scope>;
39
+ restoredGeneratorBlockScopes?: ReadonlyMap<number, Scope>;
40
+ finallyCompletions?: ReadonlyMap<number, CompletionResult>;
41
+ restoredFinallyCompletions?: ReadonlyMap<number, CompletionResult>;
33
42
  toPropertyKey?: (value: SandboxValue) => string | symbol | Promise<string | symbol>;
34
43
  getProperty?: (value: SandboxValue, key: PropertyKey) => SandboxValue | Promise<SandboxValue>;
35
44
  };
@@ -0,0 +1,9 @@
1
+ import type { SandboxValue } from "./values.js";
2
+ export type GeneratorExpressionState<T = SandboxValue> = {
3
+ kind: "binary";
4
+ left: T;
5
+ } | {
6
+ kind: "array";
7
+ values: T;
8
+ index: number;
9
+ };
@@ -70,6 +70,6 @@ type EvaluationContext = AsyncEvaluationContext;
70
70
  type EvaluationResult = AsyncEvaluationResult;
71
71
  export declare function interpret(node: ParseResult, options?: InterpretOptions): Promise<InterpreterResult>;
72
72
  export { Scope } from "./scope.js";
73
- declare function evaluateNode(node: ParseResult, context: EvaluationContext): Promise<EvaluationResult>;
73
+ export declare function evaluateNode(node: ParseResult, context: EvaluationContext): Promise<EvaluationResult>;
74
74
  export declare function createPatternContext(context: AsyncEvaluationContext, scope?: Scope, evaluate?: typeof evaluateNode): PatternContext;
75
75
  export declare function setSandboxProperty(target: SandboxValue, property: PropertyKey, value: SandboxValue, budget: Budget, checkInherited?: boolean, context?: SandboxCallContext): void | Promise<void>;
@@ -11,10 +11,26 @@ type ScopeOptions = {
11
11
  functionBoundary?: boolean;
12
12
  chargeData?: boolean;
13
13
  };
14
+ export type ScopeFrame = {
15
+ parent?: Scope;
16
+ importMeta?: InterpreterValue;
17
+ functionBoundary: boolean;
18
+ chargeData: boolean;
19
+ bindings: Array<[string, number]>;
20
+ cells: Array<{
21
+ kind: VariableDeclarationKind;
22
+ } & ({
23
+ initialized: false;
24
+ } | {
25
+ initialized: true;
26
+ value: InterpreterValue;
27
+ })>;
28
+ restoredBindings?: Array<[string, InterpreterValue]>;
29
+ };
14
30
  export declare class Scope {
15
31
  #private;
16
32
  private readonly parent?;
17
- private readonly importMeta?;
33
+ private importMeta?;
18
34
  private readonly options;
19
35
  constructor(bindings?: Record<string, InterpreterValue>, parent?: Scope | undefined, importMeta?: InterpreterValue, options?: ScopeOptions, restoredBindings?: Record<string, InterpreterValue>);
20
36
  child(bindings?: Record<string, InterpreterValue>, options?: ScopeOptions): Scope;
@@ -37,6 +53,8 @@ export declare class Scope {
37
53
  assign(name: string, value: InterpreterValue): void;
38
54
  lookup(name: string): ScopeLookupResult;
39
55
  snapshot(): InterpreterSnapshot;
56
+ captureFrame(): ScopeFrame;
57
+ hydrateFrame(frame: ScopeFrame): void;
40
58
  copyInitializedBindingsFrom(source: Scope, names: readonly string[]): void;
41
59
  private resolveScope;
42
60
  private requireInitializedBinding;
@@ -1,4 +1,4 @@
1
- export declare const DUMP_FORMAT_VERSION = 1;
1
+ export declare const DUMP_FORMAT_VERSION = 2;
2
2
  export declare const EXECUTION_SEMANTICS = "jobs-v8";
3
3
  export type DumpableSnapshot = {
4
4
  sourceHash: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@poe-platform/safe-js",
3
- "version": "0.1.213",
3
+ "version": "0.1.215",
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.213",
61
+ "@poe-platform/safe-fs": "0.1.215",
62
62
  "yaml": "^2.8.2",
63
63
  "jose": "^6.1.3",
64
64
  "@types/node": "^25.2.2"