@poe-platform/safe-js 0.1.354 → 0.1.356

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-CJ7PNS2V.js";
30
+ } from "./chunk-GMJXANAZ.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-FVRRXM5H.js.map
8252
+ //# sourceMappingURL=chunk-KH3MEEMO.js.map
@@ -22,7 +22,7 @@ import {
22
22
  resolveFsConfig,
23
23
  splitFrontmatter,
24
24
  withBrokenPipeGuard
25
- } from "./chunks/chunk-FVRRXM5H.js";
25
+ } from "./chunks/chunk-KH3MEEMO.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-CJ7PNS2V.js";
37
+ } from "./chunks/chunk-GMJXANAZ.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-CJ7PNS2V.js";
8
+ } from "./chunks/chunk-GMJXANAZ.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-FVRRXM5H.js";
29
+ } from "./chunks/chunk-KH3MEEMO.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-CJ7PNS2V.js";
53
+ } from "./chunks/chunk-GMJXANAZ.js";
54
54
  import "./chunks/chunk-4YIDX44G.js";
55
55
 
56
56
  // packages/safe-js/src/parse.ts
@@ -0,0 +1,30 @@
1
+ import type { Budget } from "./budget.js";
2
+ export declare const numericTypedArrayConstructors: {
3
+ Float32Array: Float32ArrayConstructor;
4
+ Uint8Array: Uint8ArrayConstructor;
5
+ };
6
+ export type NumericTypedArrayConstructor = typeof numericTypedArrayConstructors[keyof typeof numericTypedArrayConstructors];
7
+ export type NumericTypedArray = InstanceType<NumericTypedArrayConstructor>;
8
+ export declare const typedArrayViewLayouts: WeakMap<NumericTypedArray, {
9
+ byteOffset: number;
10
+ length?: number;
11
+ }>;
12
+ export declare function restoreTypedArrayView(buffer: ArrayBuffer, byteOffset: number, length?: number, budget?: Budget, Native?: NumericTypedArrayConstructor): NumericTypedArray;
13
+ export declare function isNumericTypedArray(value: unknown): value is NumericTypedArray;
14
+ export declare function typedArrayStorage(value: NumericTypedArray, requireInBounds?: boolean): {
15
+ buffer: ArrayBuffer;
16
+ byteOffset: number;
17
+ length: number;
18
+ byteLength: number;
19
+ Native: NumericTypedArrayConstructor;
20
+ elementSize: number;
21
+ };
22
+ export declare function typedArrayProperties(value: NumericTypedArray): Array<[PropertyKey, PropertyDescriptor]>;
23
+ export declare function typedArrayDataProperties(value: NumericTypedArray): Array<[string, PropertyDescriptor]>;
24
+ export declare function isTypedArrayIndex(key: string): boolean;
25
+ export declare function typedArrayNumber(value: unknown): number;
26
+ export declare function checkTypedArrayAllocation(length: number, budget: Budget, elementSize?: number): void;
27
+ export declare function copyTypedArrayStorage<TValue>(value: NumericTypedArray, state: {
28
+ seen: WeakMap<object, TValue>;
29
+ float32Buffers?: WeakMap<ArrayBuffer, ArrayBuffer>;
30
+ }): NumericTypedArray;
@@ -5,6 +5,7 @@ import { type SandboxCollectionIterator } from "./collection-iterator.js";
5
5
  import { type SandboxRegExpIterator } from "./regexp-iterator.js";
6
6
  import type { Budget, CompileTicket } from "./budget.js";
7
7
  import { CompileScope } from "./regex/compile-guard.js";
8
+ import { type NumericTypedArray } from "./typed-array.js";
8
9
  import type { GeneratorChannel } from "./generator.js";
9
10
  import { type RegexPattern } from "./regex/parse.js";
10
11
  import type { FunctionSource } from "../parse/function-source.js";
@@ -17,7 +18,7 @@ declare const sandboxRegexBrand: unique symbol;
17
18
  declare const sandboxRegexPattern: unique symbol;
18
19
  declare const sandboxRetainedValues: unique symbol;
19
20
  export type SandboxPrimitive = string | number | bigint | boolean | symbol | null | undefined;
20
- export type SandboxValue = SandboxPrimitive | Date | Float32Array | ArrayBuffer | SandboxObject | SandboxArray | SandboxClosure | SandboxGenerator | SandboxCollectionIterator | SandboxRegExpIterator | SandboxMap | SandboxSet | SandboxPromise | SandboxRegex;
21
+ export type SandboxValue = SandboxPrimitive | Date | NumericTypedArray | ArrayBuffer | SandboxObject | SandboxArray | SandboxClosure | SandboxGenerator | SandboxCollectionIterator | SandboxRegExpIterator | SandboxMap | SandboxSet | SandboxPromise | SandboxRegex;
21
22
  export type SandboxObject = {
22
23
  [key: string]: SandboxValue;
23
24
  [key: symbol]: SandboxValue;
@@ -3,7 +3,7 @@ import { type RegexPropertyData } from "./regexp-properties.js";
3
3
  import { type SerializedSymbol, type SerializedSymbolProperty } from "./symbols.js";
4
4
  import { type CollectionIterationMethod } from "../interp/collection-iterator.js";
5
5
  import { CompileScope } from "../interp/regex/compile-guard.js";
6
- import { type Float32Data } from "./float32array.js";
6
+ import { type TypedArrayData } from "./typed-array.js";
7
7
  import { type ArrayBufferData } from "./array-buffer.js";
8
8
  import { type SandboxErrorName } from "../error/shape.js";
9
9
  import { type SandboxClosure, type SandboxPromise, type SandboxValue } from "../interp/values.js";
@@ -67,7 +67,7 @@ type DataNode = {
67
67
  symbolProperties?: Array<SerializedSymbolProperty<Atom>>;
68
68
  extensible?: boolean;
69
69
  nullPrototype?: true;
70
- } | (Float32Data<Atom> & {
70
+ } | (TypedArrayData<Atom> & {
71
71
  properties: Properties;
72
72
  extensible: boolean;
73
73
  }) | (ArrayBufferData<Atom> & {
@@ -0,0 +1,29 @@
1
+ import { numericTypedArrayConstructors, type NumericTypedArray } from "../interp/typed-array.js";
2
+ import type { GuestObjectState } from "./guest-heap.js";
3
+ import type { Budget } from "../interp/budget.js";
4
+ export declare function captureTypedArrayState<T>(value: NumericTypedArray, encode: (value: unknown) => T): GuestObjectState<T>;
5
+ export declare function restoreTypedArrayProperties<T>(value: NumericTypedArray, state: GuestObjectState<T>, decode: (value: T) => unknown): void;
6
+ type TypedArrayIdentity = {
7
+ kind: "float32array";
8
+ } | {
9
+ kind: "typedarray";
10
+ arrayType: keyof typeof numericTypedArrayConstructors;
11
+ };
12
+ export type TypedArrayData<TReference> = TypedArrayIdentity & {
13
+ byteOffset: number;
14
+ length: number;
15
+ lengthTracking?: true;
16
+ } & ({
17
+ bytes: number[];
18
+ } | {
19
+ buffer: TReference;
20
+ });
21
+ export declare function encodeTypedArrayLayout(value: NumericTypedArray): TypedArrayIdentity & {
22
+ byteOffset: number;
23
+ length: number;
24
+ lengthTracking?: true;
25
+ };
26
+ export declare function encodeTypedArrayStorage<TReference>(value: NumericTypedArray, id: number, buffers: WeakMap<ArrayBuffer, number>, reference: (id: number) => TReference): TypedArrayData<TReference>;
27
+ export declare function validateTypedArrayStorage(value: Record<string, unknown>): void;
28
+ export declare function decodeTypedArrayStorage(value: Record<string, unknown>, resolve: (reference: unknown) => unknown, budget?: Budget): NumericTypedArray;
29
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@poe-platform/safe-js",
3
- "version": "0.1.354",
3
+ "version": "0.1.356",
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.354",
61
+ "@poe-platform/safe-fs": "0.1.356",
62
62
  "yaml": "^2.8.2",
63
63
  "jose": "^6.1.3",
64
64
  "@types/node": "^25.2.2"