@poe-platform/safe-js 0.1.111 → 0.1.113

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-VNXVV3WI.js";
25
+ } from "./chunks/chunk-7Z6HCXET.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-7AIY5C3F.js";
37
+ } from "./chunks/chunk-DVWTNFTV.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-7AIY5C3F.js";
8
+ } from "./chunks/chunk-DVWTNFTV.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-VNXVV3WI.js";
29
+ } from "./chunks/chunk-7Z6HCXET.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-7AIY5C3F.js";
53
+ } from "./chunks/chunk-DVWTNFTV.js";
54
54
  import "./chunks/chunk-4YIDX44G.js";
55
55
 
56
56
  // packages/safe-js/src/parse.ts
@@ -0,0 +1,5 @@
1
+ import type { SandboxMap, SandboxSet } from "./values.js";
2
+ export declare const sandboxMapBrand: unique symbol;
3
+ export declare const sandboxSetBrand: unique symbol;
4
+ export declare function isSandboxMap(value: unknown): value is SandboxMap;
5
+ export declare function isSandboxSet(value: unknown): value is SandboxSet;
@@ -0,0 +1,27 @@
1
+ import type { Budget } from "./budget.js";
2
+ import type { SandboxMap, SandboxSet, SandboxValue } from "./values.js";
3
+ declare const collectionIteratorBrand: unique symbol;
4
+ export type SandboxCollectionIterator = {
5
+ readonly [collectionIteratorBrand]: true;
6
+ };
7
+ export type CollectionIterationMethod = "keys" | "values" | "entries";
8
+ export type CollectionIteratorSnapshot = {
9
+ collection: SandboxMap | SandboxSet | undefined;
10
+ collectionKind: "map" | "set";
11
+ method: CollectionIterationMethod;
12
+ index: number;
13
+ exhausted: boolean;
14
+ };
15
+ type IteratorState = Omit<CollectionIteratorSnapshot, "index"> & {
16
+ iterator: Iterator<SandboxValue> | undefined;
17
+ };
18
+ export declare function isSandboxCollectionIterator(value: unknown): value is SandboxCollectionIterator;
19
+ export declare function createSandboxCollectionIterator(collection: SandboxMap | SandboxSet, method: CollectionIterationMethod): SandboxCollectionIterator;
20
+ export declare function restoreSandboxCollectionIterator(snapshot: CollectionIteratorSnapshot, target?: SandboxCollectionIterator): SandboxCollectionIterator;
21
+ export declare function collectionIteratorState(value: SandboxCollectionIterator): Readonly<IteratorState>;
22
+ export declare function snapshotCollectionIterator(value: SandboxCollectionIterator): CollectionIteratorSnapshot;
23
+ export declare function nextCollectionIterator(value: SandboxCollectionIterator, budget?: Budget): {
24
+ value: SandboxValue;
25
+ done: boolean;
26
+ };
27
+ export {};
@@ -1,4 +1,5 @@
1
1
  import { type SandboxValue } from "./values.js";
2
+ import type { Budget } from "./budget.js";
2
3
  export type SandboxIterator = {
3
4
  readonly generator?: true;
4
5
  snapshotIndex?(): number;
@@ -6,4 +7,4 @@ export type SandboxIterator = {
6
7
  return?(value?: SandboxValue): IteratorResult<SandboxValue> | Promise<IteratorResult<SandboxValue>>;
7
8
  throw?(error?: SandboxValue): IteratorResult<SandboxValue> | Promise<IteratorResult<SandboxValue>>;
8
9
  };
9
- export declare function getSandboxIterator(value: SandboxValue): SandboxIterator | undefined;
10
+ export declare function getSandboxIterator(value: SandboxValue, budget?: Budget): SandboxIterator | undefined;
@@ -1,6 +1,7 @@
1
1
  import type { AssignmentPattern, MemberExpression, ParseResult, RestElement, VariableDeclarationKind, VariableDeclarator } from "../parse.js";
2
2
  import type { AsyncEvaluationResult } from "./async.js";
3
3
  import type { Scope } from "./scope.js";
4
+ import type { Budget } from "./budget.js";
4
5
  import { type SandboxValue } from "./values.js";
5
6
  type Pattern = VariableDeclarator["id"] | AssignmentPattern | MemberExpression | RestElement;
6
7
  export type PatternTarget = {
@@ -10,6 +11,7 @@ export type PatternTarget = {
10
11
  assign: true;
11
12
  };
12
13
  export type PatternContext = {
14
+ budget?: Budget;
13
15
  evaluate(node: ParseResult): Promise<AsyncEvaluationResult>;
14
16
  toPropertyKey(value: SandboxValue): Promise<string>;
15
17
  getProperty(value: SandboxValue, key: string | number): SandboxValue;
@@ -1,18 +1,19 @@
1
+ import { sandboxMapBrand, sandboxSetBrand } from "./collection-brands.js";
2
+ import { type SandboxCollectionIterator } from "./collection-iterator.js";
1
3
  import type { Budget, CompileTicket } from "./budget.js";
2
4
  import { CompileScope } from "./regex/compile-guard.js";
3
5
  import type { GeneratorChannel } from "./generator.js";
4
6
  import { type RegexPattern } from "./regex/parse.js";
5
7
  export { createSandboxArguments, isSandboxArguments } from "./arguments.js";
8
+ export { isSandboxMap, isSandboxSet } from "./collection-brands.js";
6
9
  declare const sandboxClosureBrand: unique symbol;
7
10
  declare const sandboxGeneratorBrand: unique symbol;
8
- declare const sandboxMapBrand: unique symbol;
9
11
  declare const sandboxPromiseBrand: unique symbol;
10
12
  declare const sandboxRegexBrand: unique symbol;
11
13
  declare const sandboxRegexPattern: unique symbol;
12
- declare const sandboxSetBrand: unique symbol;
13
14
  declare const sandboxRetainedValues: unique symbol;
14
15
  export type SandboxPrimitive = string | number | boolean | null | undefined;
15
- export type SandboxValue = SandboxPrimitive | Date | Float32Array | SandboxObject | SandboxArray | SandboxClosure | SandboxGenerator | SandboxMap | SandboxSet | SandboxPromise | SandboxRegex;
16
+ export type SandboxValue = SandboxPrimitive | Date | Float32Array | SandboxObject | SandboxArray | SandboxClosure | SandboxGenerator | SandboxCollectionIterator | SandboxMap | SandboxSet | SandboxPromise | SandboxRegex;
16
17
  export type SandboxObject = {
17
18
  [key: string]: SandboxValue;
18
19
  };
@@ -123,9 +124,7 @@ export declare function createSandboxSet(values?: Iterable<SandboxValue>): Sandb
123
124
  export declare function createSandboxRegex(source: string, flags?: string, lastIndex?: number, compilation?: CompileScope): SandboxRegex;
124
125
  export declare function getSandboxRegexPattern(regex: SandboxRegex): RegexPattern;
125
126
  export declare function isSandboxClosure(value: unknown): value is SandboxClosure;
126
- export declare function isSandboxMap(value: unknown): value is SandboxMap;
127
127
  export declare function isSandboxPromise(value: unknown): value is SandboxPromise;
128
- export declare function isSandboxSet(value: unknown): value is SandboxSet;
129
128
  export declare function isSandboxGenerator(value: unknown): value is SandboxGenerator;
130
129
  export declare function isSandboxRegex(value: unknown): value is SandboxRegex;
131
130
  export declare function deepCopyToSandbox(value: unknown): SandboxValue;
@@ -1,3 +1,4 @@
1
+ import { type CollectionIterationMethod } from "../interp/collection-iterator.js";
1
2
  import { CompileScope } from "../interp/regex/compile-guard.js";
2
3
  import { type Float32Data } from "./float32array.js";
3
4
  import { type SandboxErrorName } from "../error/shape.js";
@@ -25,6 +26,15 @@ type Properties = Record<string, {
25
26
  writable: boolean;
26
27
  }>;
27
28
  type DataNode = {
29
+ kind: "collection-iterator";
30
+ collectionKind: "map" | "set";
31
+ method: CollectionIterationMethod;
32
+ collection: Atom;
33
+ index: number;
34
+ exhausted: boolean;
35
+ properties: Properties;
36
+ extensible: boolean;
37
+ } | {
28
38
  kind: "date";
29
39
  time: number | null;
30
40
  } | (Float32Data<Atom> & {
@@ -217,6 +217,7 @@ export interface ServerOptions {
217
217
  maxStdioOutputBytes?: number;
218
218
  /** Per-stdio-connection messages awaiting handler/output settlement; defaults to 128. */
219
219
  maxPendingStdioMessages?: number;
220
+ maxStdioLineBytes?: number;
220
221
  validateToolArguments?: boolean;
221
222
  supportNotifications?: boolean;
222
223
  supportResourceSubscriptions?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@poe-platform/safe-js",
3
- "version": "0.1.111",
3
+ "version": "0.1.113",
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.111",
61
+ "@poe-platform/safe-fs": "0.1.113",
62
62
  "yaml": "^2.8.2",
63
63
  "jose": "^6.1.3",
64
64
  "@types/node": "^25.2.2"