@poe-platform/safe-js 0.1.17 → 0.1.19

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-Z3D76J4U.js";
30
+ } from "./chunk-B7H4ZL65.js";
31
31
 
32
32
  // packages/safe-js/src/migrate.ts
33
33
  import { createHash } from "node:crypto";
@@ -8245,4 +8245,4 @@ export {
8245
8245
  parseMcpConfig,
8246
8246
  makeMcpModule
8247
8247
  };
8248
- //# sourceMappingURL=chunk-ZYYMVUYU.js.map
8248
+ //# sourceMappingURL=chunk-GMDOPMVZ.js.map
@@ -22,7 +22,7 @@ import {
22
22
  resolveFsConfig,
23
23
  splitFrontmatter,
24
24
  withBrokenPipeGuard
25
- } from "./chunks/chunk-ZYYMVUYU.js";
25
+ } from "./chunks/chunk-GMDOPMVZ.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-Z3D76J4U.js";
37
+ } from "./chunks/chunk-B7H4ZL65.js";
38
38
  import "./chunks/chunk-4YIDX44G.js";
39
39
 
40
40
  // packages/safe-js/src/cli.ts
@@ -3,7 +3,7 @@ import {
3
3
  createReplayableRandom,
4
4
  lint,
5
5
  run
6
- } from "./chunks/chunk-Z3D76J4U.js";
6
+ } from "./chunks/chunk-B7H4ZL65.js";
7
7
  import "./chunks/chunk-4YIDX44G.js";
8
8
  export {
9
9
  Budget,
@@ -26,7 +26,7 @@ import {
26
26
  runWithSpawnUsageAccumulator,
27
27
  splitFrontmatter,
28
28
  supportsSpawnMode
29
- } from "./chunks/chunk-ZYYMVUYU.js";
29
+ } from "./chunks/chunk-GMDOPMVZ.js";
30
30
  import {
31
31
  Budget,
32
32
  FileSnapshotBackend,
@@ -48,7 +48,7 @@ import {
48
48
  registerPendingHostCallPolicy,
49
49
  restore,
50
50
  run
51
- } from "./chunks/chunk-Z3D76J4U.js";
51
+ } from "./chunks/chunk-B7H4ZL65.js";
52
52
  import "./chunks/chunk-4YIDX44G.js";
53
53
 
54
54
  // packages/safe-js/src/parse.ts
@@ -1,8 +1,9 @@
1
1
  import type { ParseResult, SourceSpan } from "../parse.js";
2
- import { type InterpreterYieldPoint } from "./async.js";
2
+ import { type AsyncEvaluationContext, type AsyncEvaluationResult, type InterpreterYieldPoint } from "./async.js";
3
3
  import type { GeneratorCompletion } from "./generator.js";
4
4
  import { Budget, type CompileOwner } from "./budget.js";
5
5
  import { CompileScope } from "./regex/compile-guard.js";
6
+ import { type PatternContext } from "./patterns.js";
6
7
  import { type SandboxValue } from "./values.js";
7
8
  import { Scope } from "./scope.js";
8
9
  export type InterpreterValue = SandboxValue;
@@ -59,5 +60,10 @@ export type InterpretOptions = {
59
60
  };
60
61
  snapshot?: InterpreterSnapshot;
61
62
  };
63
+ type EvaluationContext = AsyncEvaluationContext;
64
+ type EvaluationResult = AsyncEvaluationResult;
62
65
  export declare function interpret(node: ParseResult, options?: InterpretOptions): Promise<InterpreterResult>;
63
66
  export { Scope } from "./scope.js";
67
+ declare function evaluateNode(node: ParseResult, context: EvaluationContext): Promise<EvaluationResult>;
68
+ export declare function createPatternContext(context: AsyncEvaluationContext, scope?: Scope, evaluate?: typeof evaluateNode): PatternContext;
69
+ export declare function setSandboxProperty(target: SandboxValue, property: string | number, value: SandboxValue, budget: Budget): void;
@@ -0,0 +1,24 @@
1
+ import type { AssignmentPattern, MemberExpression, ParseResult, RestElement, VariableDeclarationKind, VariableDeclarator } from "../parse.js";
2
+ import type { AsyncEvaluationResult } from "./async.js";
3
+ import type { Scope } from "./scope.js";
4
+ import { type SandboxValue } from "./values.js";
5
+ type Pattern = VariableDeclarator["id"] | AssignmentPattern | MemberExpression | RestElement;
6
+ export type PatternTarget = {
7
+ kind: VariableDeclarationKind;
8
+ initialize?: true;
9
+ } | {
10
+ assign: true;
11
+ };
12
+ export type PatternContext = {
13
+ evaluate(node: ParseResult): Promise<AsyncEvaluationResult>;
14
+ getProperty(value: SandboxValue, key: string | number): SandboxValue;
15
+ setProperty(target: SandboxValue, key: string | number, value: SandboxValue): void;
16
+ };
17
+ export type BindPatternResult = {
18
+ ok: true;
19
+ } | {
20
+ ok: false;
21
+ result: AsyncEvaluationResult;
22
+ };
23
+ export declare function bindPattern(pattern: Pattern, value: SandboxValue, target: PatternTarget, scope: Scope, context: PatternContext): Promise<BindPatternResult>;
24
+ export {};
@@ -89,6 +89,7 @@ type CopyFromSandboxOptions = {
89
89
  compilation?: CompileScope;
90
90
  };
91
91
  export declare function createSandboxClosure(input: {
92
+ guest?: boolean;
92
93
  async?: boolean;
93
94
  sandbox?: boolean;
94
95
  boundTarget?: SandboxClosure;
@@ -100,6 +101,7 @@ export declare function createSandboxClosure(input: {
100
101
  properties?: SandboxObject | ((closure: SandboxClosure) => SandboxObject);
101
102
  retainedValues?: () => Iterable<SandboxValue>;
102
103
  }): SandboxClosure;
104
+ export declare function ownEnumerableSandboxEntries(value: SandboxValue): Array<[string, SandboxValue]>;
103
105
  export declare function createSandboxPromise(promise: Promise<SandboxValue>, metadata?: {
104
106
  trackReplay?: boolean;
105
107
  synchronousPrefix?: Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@poe-platform/safe-js",
3
- "version": "0.1.17",
3
+ "version": "0.1.19",
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.17",
61
+ "@poe-platform/safe-fs": "0.1.19",
62
62
  "yaml": "^2.8.2",
63
63
  "jose": "^6.1.3",
64
64
  "@types/node": "^25.2.2"