@poe-platform/safe-js 0.1.743 → 0.1.745

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.
Files changed (101) hide show
  1. package/README.md +4 -3
  2. package/dist/safe-js/chunks/{chunk-F6CV74HU.js → chunk-3NFTBEZR.js} +2 -3
  3. package/dist/safe-js/chunks/{chunk-LMS5SSTN.js → chunk-5WP5IRMP.js} +437 -388
  4. package/dist/safe-js/chunks/{chunk-47JWFV2B.js → chunk-6UP3B5TB.js} +7 -8
  5. package/dist/safe-js/chunks/{chunk-24Z6PSCN.js → chunk-6ZVFR4HR.js} +1 -2
  6. package/dist/safe-js/chunks/{chunk-J3CUCOMP.js → chunk-AB6ERQE5.js} +14798 -14210
  7. package/dist/safe-js/chunks/{chunk-4YIDX44G.js → chunk-CQ52GEHY.js} +0 -1
  8. package/dist/safe-js/chunks/chunk-DHGJSEFX.js +0 -0
  9. package/dist/safe-js/chunks/{chunk-GVKXZW53.js → chunk-DIG26TEI.js} +0 -1
  10. package/dist/safe-js/chunks/{chunk-JCVARKWT.js → chunk-DIMBVKHT.js} +6 -7
  11. package/dist/safe-js/chunks/{chunk-UQPYTZOZ.js → chunk-JCHJGIQA.js} +0 -1
  12. package/dist/safe-js/chunks/{chunk-IRYOK5BR.js → chunk-L265M6OS.js} +2 -3
  13. package/dist/safe-js/chunks/{chunk-3ITVV2R6.js → chunk-L3MIVH3T.js} +1 -2
  14. package/dist/safe-js/chunks/{chunk-AUVGHYM5.js → chunk-LRINZRJA.js} +2 -3
  15. package/dist/safe-js/chunks/{chunk-UIUJHTWG.js → chunk-MKY3MQUB.js} +3 -4
  16. package/dist/safe-js/chunks/{chunk-YDVEVDVT.js → chunk-MLJ4BKDX.js} +102 -20
  17. package/dist/safe-js/chunks/{chunk-YUQFFRUF.js → chunk-MMN3IESA.js} +1 -2
  18. package/dist/safe-js/chunks/{chunk-WEGFNME4.js → chunk-O3S3JVWS.js} +1 -2
  19. package/dist/safe-js/chunks/{chunk-2GVBG23M.js → chunk-ONWFPHUI.js} +0 -1
  20. package/dist/safe-js/chunks/chunk-OQYVEDRN.js +66 -0
  21. package/dist/safe-js/chunks/{chunk-EMH7CXQM.js → chunk-POEMWNHD.js} +1 -2
  22. package/dist/safe-js/chunks/{chunk-G6WTEIJJ.js → chunk-X3YCE3ZH.js} +1 -2
  23. package/dist/safe-js/chunks/{chunk-WWETRQCF.js → chunk-YYF5R6ML.js} +3 -4
  24. package/dist/safe-js/chunks/{cli-runtime-3SOHLG5M.js → cli-runtime-BGB24HNE.js} +19 -20
  25. package/dist/safe-js/chunks/{dump-CSLHITIE.js → dump-M7CMVXW7.js} +5 -6
  26. package/dist/safe-js/chunks/harness-4CPQ7WKS.js +10 -0
  27. package/dist/safe-js/chunks/mcp-7SNWIP5H.js +11 -0
  28. package/dist/safe-js/chunks/migration-file-CPBVNMLD.js +14 -0
  29. package/dist/safe-js/chunks/restore-FLH6OC5F.js +13 -0
  30. package/dist/safe-js/chunks/run-KFAD7GTT.js +19 -0
  31. package/dist/safe-js/chunks/runtime-modules-D6NO4KJW.js +10 -0
  32. package/dist/safe-js/chunks/source-files-BSDM22Y2.js +9 -0
  33. package/dist/safe-js/cli.js +5 -6
  34. package/dist/safe-js/core.d.ts +1 -1
  35. package/dist/safe-js/core.js +14 -15
  36. package/dist/safe-js/extensions.d.ts +17 -0
  37. package/dist/safe-js/index.d.ts +2 -2
  38. package/dist/safe-js/index.js +22 -23
  39. package/dist/safe-js/interp/arguments.d.ts +2 -0
  40. package/dist/safe-js/interp/collection-properties.d.ts +2 -0
  41. package/dist/safe-js/interp/data-copy.d.ts +2 -0
  42. package/dist/safe-js/interp/host-bridge.d.ts +5 -0
  43. package/dist/safe-js/interp/host-capabilities.d.ts +5 -0
  44. package/dist/safe-js/interp/internal-symbols.d.ts +1 -0
  45. package/dist/safe-js/interp/interpreter.d.ts +3 -1
  46. package/dist/safe-js/interp/regex/compile-guard.d.ts +6 -4
  47. package/dist/safe-js/interp/template-cache.d.ts +5 -0
  48. package/dist/safe-js/interp/values.d.ts +11 -0
  49. package/dist/safe-js/modules/fs.d.ts +4 -3
  50. package/dist/safe-js/modules/fs.js +8 -9
  51. package/dist/safe-js/platform/context.d.ts +14 -0
  52. package/dist/safe-js/platform/node.d.ts +16 -0
  53. package/dist/safe-js/platform/types.d.ts +18 -0
  54. package/dist/safe-js/platform/workerd.d.ts +21 -0
  55. package/dist/safe-js/restore.d.ts +1 -1
  56. package/dist/safe-js/snapshot/validation.d.ts +2 -1
  57. package/package.json +5 -5
  58. package/dist/safe-js/chunks/chunk-24Z6PSCN.js.map +0 -7
  59. package/dist/safe-js/chunks/chunk-2GVBG23M.js.map +0 -7
  60. package/dist/safe-js/chunks/chunk-3ITVV2R6.js.map +0 -7
  61. package/dist/safe-js/chunks/chunk-47JWFV2B.js.map +0 -7
  62. package/dist/safe-js/chunks/chunk-4YIDX44G.js.map +0 -7
  63. package/dist/safe-js/chunks/chunk-AUVGHYM5.js.map +0 -7
  64. package/dist/safe-js/chunks/chunk-EMH7CXQM.js.map +0 -7
  65. package/dist/safe-js/chunks/chunk-F6CV74HU.js.map +0 -7
  66. package/dist/safe-js/chunks/chunk-G6WTEIJJ.js.map +0 -7
  67. package/dist/safe-js/chunks/chunk-GVKXZW53.js.map +0 -7
  68. package/dist/safe-js/chunks/chunk-IRYOK5BR.js.map +0 -7
  69. package/dist/safe-js/chunks/chunk-J3CUCOMP.js.map +0 -7
  70. package/dist/safe-js/chunks/chunk-JCVARKWT.js.map +0 -7
  71. package/dist/safe-js/chunks/chunk-LMS5SSTN.js.map +0 -7
  72. package/dist/safe-js/chunks/chunk-U7ZNMTSQ.js +0 -1
  73. package/dist/safe-js/chunks/chunk-U7ZNMTSQ.js.map +0 -7
  74. package/dist/safe-js/chunks/chunk-UIUJHTWG.js.map +0 -7
  75. package/dist/safe-js/chunks/chunk-UQPYTZOZ.js.map +0 -7
  76. package/dist/safe-js/chunks/chunk-V72WS373.js +0 -128
  77. package/dist/safe-js/chunks/chunk-V72WS373.js.map +0 -7
  78. package/dist/safe-js/chunks/chunk-WEGFNME4.js.map +0 -7
  79. package/dist/safe-js/chunks/chunk-WWETRQCF.js.map +0 -7
  80. package/dist/safe-js/chunks/chunk-YDVEVDVT.js.map +0 -7
  81. package/dist/safe-js/chunks/chunk-YUQFFRUF.js.map +0 -7
  82. package/dist/safe-js/chunks/cli-runtime-3SOHLG5M.js.map +0 -7
  83. package/dist/safe-js/chunks/dump-CSLHITIE.js.map +0 -7
  84. package/dist/safe-js/chunks/harness-QKPVLVOT.js +0 -11
  85. package/dist/safe-js/chunks/harness-QKPVLVOT.js.map +0 -7
  86. package/dist/safe-js/chunks/mcp-A4YKQCIS.js +0 -12
  87. package/dist/safe-js/chunks/mcp-A4YKQCIS.js.map +0 -7
  88. package/dist/safe-js/chunks/migration-file-QCZTVXEU.js +0 -15
  89. package/dist/safe-js/chunks/migration-file-QCZTVXEU.js.map +0 -7
  90. package/dist/safe-js/chunks/restore-22OGYS6N.js +0 -14
  91. package/dist/safe-js/chunks/restore-22OGYS6N.js.map +0 -7
  92. package/dist/safe-js/chunks/run-EMFOFJ22.js +0 -20
  93. package/dist/safe-js/chunks/run-EMFOFJ22.js.map +0 -7
  94. package/dist/safe-js/chunks/runtime-modules-QCVDLUVF.js +0 -11
  95. package/dist/safe-js/chunks/runtime-modules-QCVDLUVF.js.map +0 -7
  96. package/dist/safe-js/chunks/source-files-L3SGK63Z.js +0 -10
  97. package/dist/safe-js/chunks/source-files-L3SGK63Z.js.map +0 -7
  98. package/dist/safe-js/cli.js.map +0 -7
  99. package/dist/safe-js/core.js.map +0 -7
  100. package/dist/safe-js/index.js.map +0 -7
  101. package/dist/safe-js/modules/fs.js.map +0 -7
@@ -4,11 +4,11 @@ import {
4
4
  dump,
5
5
  dumpCurrent,
6
6
  serializeRunSnapshot
7
- } from "./chunk-IRYOK5BR.js";
8
- import "./chunk-J3CUCOMP.js";
9
- import "./chunk-LMS5SSTN.js";
10
- import "./chunk-UQPYTZOZ.js";
11
- import "./chunk-4YIDX44G.js";
7
+ } from "./chunk-L265M6OS.js";
8
+ import "./chunk-AB6ERQE5.js";
9
+ import "./chunk-5WP5IRMP.js";
10
+ import "./chunk-JCHJGIQA.js";
11
+ import "./chunk-CQ52GEHY.js";
12
12
  export {
13
13
  attachDumpController,
14
14
  createDumpController,
@@ -16,4 +16,3 @@ export {
16
16
  dumpCurrent,
17
17
  serializeRunSnapshot
18
18
  };
19
- //# sourceMappingURL=dump-CSLHITIE.js.map
@@ -0,0 +1,10 @@
1
+ import {
2
+ makeHarnessModule
3
+ } from "./chunk-6ZVFR4HR.js";
4
+ import "./chunk-AB6ERQE5.js";
5
+ import "./chunk-5WP5IRMP.js";
6
+ import "./chunk-JCHJGIQA.js";
7
+ import "./chunk-CQ52GEHY.js";
8
+ export {
9
+ makeHarnessModule
10
+ };
@@ -0,0 +1,11 @@
1
+ import {
2
+ makeMcpModule
3
+ } from "./chunk-YYF5R6ML.js";
4
+ import "./chunk-L3MIVH3T.js";
5
+ import "./chunk-AB6ERQE5.js";
6
+ import "./chunk-5WP5IRMP.js";
7
+ import "./chunk-JCHJGIQA.js";
8
+ import "./chunk-CQ52GEHY.js";
9
+ export {
10
+ makeMcpModule
11
+ };
@@ -0,0 +1,14 @@
1
+ import {
2
+ migrateSnapshotFile
3
+ } from "./chunk-6UP3B5TB.js";
4
+ import "./chunk-DIG26TEI.js";
5
+ import "./chunk-ONWFPHUI.js";
6
+ import "./chunk-LRINZRJA.js";
7
+ import "./chunk-AB6ERQE5.js";
8
+ import "./chunk-5WP5IRMP.js";
9
+ import "./chunk-MMN3IESA.js";
10
+ import "./chunk-JCHJGIQA.js";
11
+ import "./chunk-CQ52GEHY.js";
12
+ export {
13
+ migrateSnapshotFile
14
+ };
@@ -0,0 +1,13 @@
1
+ import {
2
+ SnapshotMismatchError,
3
+ restore
4
+ } from "./chunk-OQYVEDRN.js";
5
+ import "./chunk-LRINZRJA.js";
6
+ import "./chunk-AB6ERQE5.js";
7
+ import "./chunk-5WP5IRMP.js";
8
+ import "./chunk-JCHJGIQA.js";
9
+ import "./chunk-CQ52GEHY.js";
10
+ export {
11
+ SnapshotMismatchError,
12
+ restore
13
+ };
@@ -0,0 +1,19 @@
1
+ import {
2
+ UnhandledRejectionError,
3
+ run
4
+ } from "./chunk-MLJ4BKDX.js";
5
+ import "./chunk-DHGJSEFX.js";
6
+ import "./chunk-DIG26TEI.js";
7
+ import "./chunk-ONWFPHUI.js";
8
+ import "./chunk-OQYVEDRN.js";
9
+ import "./chunk-LRINZRJA.js";
10
+ import "./chunk-L265M6OS.js";
11
+ import "./chunk-AB6ERQE5.js";
12
+ import "./chunk-5WP5IRMP.js";
13
+ import "./chunk-MMN3IESA.js";
14
+ import "./chunk-JCHJGIQA.js";
15
+ import "./chunk-CQ52GEHY.js";
16
+ export {
17
+ UnhandledRejectionError,
18
+ run
19
+ };
@@ -0,0 +1,10 @@
1
+ import {
2
+ createLintModulesFromRuntimeRegistry
3
+ } from "./chunk-O3S3JVWS.js";
4
+ import "./chunk-AB6ERQE5.js";
5
+ import "./chunk-5WP5IRMP.js";
6
+ import "./chunk-JCHJGIQA.js";
7
+ import "./chunk-CQ52GEHY.js";
8
+ export {
9
+ createLintModulesFromRuntimeRegistry
10
+ };
@@ -0,0 +1,9 @@
1
+ import {
2
+ createRootedSourceResolver
3
+ } from "./chunk-3NFTBEZR.js";
4
+ import "./chunk-MMN3IESA.js";
5
+ import "./chunk-JCHJGIQA.js";
6
+ import "./chunk-CQ52GEHY.js";
7
+ export {
8
+ createRootedSourceResolver
9
+ };
@@ -3,9 +3,9 @@ import {
3
3
  createBrokenPipeState,
4
4
  createSafeOutputStream,
5
5
  withBrokenPipeGuard
6
- } from "./chunks/chunk-G6WTEIJJ.js";
7
- import "./chunks/chunk-2GVBG23M.js";
8
- import "./chunks/chunk-4YIDX44G.js";
6
+ } from "./chunks/chunk-X3YCE3ZH.js";
7
+ import "./chunks/chunk-ONWFPHUI.js";
8
+ import "./chunks/chunk-CQ52GEHY.js";
9
9
 
10
10
  // packages/safe-js/src/cli.ts
11
11
  import { realpath } from "node:fs/promises";
@@ -13,7 +13,7 @@ import path from "node:path";
13
13
  import { fileURLToPath } from "node:url";
14
14
  async function runCli(argv, options = {}) {
15
15
  if (!argv.includes("--help") && !argv.includes("-h")) {
16
- const runtime = await import("./chunks/cli-runtime-3SOHLG5M.js");
16
+ const runtime = await import("./chunks/cli-runtime-BGB24HNE.js");
17
17
  return runtime.runCli(argv, options, createUsage());
18
18
  }
19
19
  const brokenPipe = createBrokenPipeState();
@@ -32,7 +32,7 @@ async function runCli(argv, options = {}) {
32
32
  stderr.write(`${error instanceof Error ? error.message : String(error)}
33
33
  `);
34
34
  if (brokenPipe.closed) return 0;
35
- const { exitCodeForError } = await import("./chunks/cli-runtime-3SOHLG5M.js");
35
+ const { exitCodeForError } = await import("./chunks/cli-runtime-BGB24HNE.js");
36
36
  return exitCodeForError(error);
37
37
  }
38
38
  }
@@ -92,4 +92,3 @@ if (await isDirectExecution(process.argv[1])) {
92
92
  export {
93
93
  runCli
94
94
  };
95
- //# sourceMappingURL=cli.js.map
@@ -4,7 +4,7 @@ export { run } from "./run.js";
4
4
  export type { RunPromise } from "./run.js";
5
5
  export type { ExecutionControl } from "./interp/jobs.js";
6
6
  export { createRealm, type SafeJSRealm, type RealmOptions, type RealmResult, type RealmLimits } from "./realm.js";
7
- export { defineExtension, type SafeJSExtension, type ExtensionDefinition, type ExtensionManifest, type ExtensionContext, type ExtensionExports, type CallbackOptions, type CallbackInvocation } from "./extensions.js";
7
+ export { defineExtension, type SafeJSExtension, type ExtensionDefinition, type ExtensionManifest, type ExtensionContext, type HostConstructorOptions, type ExtensionExports, type CallbackOptions, type CallbackInvocation } from "./extensions.js";
8
8
  export type { HostObject, HostObjectDefinition, HostObjectIndexedDefinition, HostObjectNamedDefinition, GuestReference } from "./interp/host-capabilities.js";
9
9
  export { createReplayableRandom, type ReplayableRandom } from "./random.js";
10
10
  export type { RunClock, RunClockSnapshot, RunRandom } from "./run.js";
@@ -1,30 +1,30 @@
1
1
  import {
2
2
  lint
3
- } from "./chunks/chunk-EMH7CXQM.js";
3
+ } from "./chunks/chunk-POEMWNHD.js";
4
4
  import {
5
5
  createRootedSourceResolver
6
- } from "./chunks/chunk-F6CV74HU.js";
6
+ } from "./chunks/chunk-3NFTBEZR.js";
7
7
  import {
8
8
  createRealm,
9
9
  createReplayableRandom,
10
10
  run
11
- } from "./chunks/chunk-YDVEVDVT.js";
12
- import "./chunks/chunk-U7ZNMTSQ.js";
13
- import "./chunks/chunk-GVKXZW53.js";
14
- import "./chunks/chunk-2GVBG23M.js";
15
- import "./chunks/chunk-V72WS373.js";
16
- import "./chunks/chunk-AUVGHYM5.js";
17
- import "./chunks/chunk-IRYOK5BR.js";
11
+ } from "./chunks/chunk-MLJ4BKDX.js";
12
+ import "./chunks/chunk-DHGJSEFX.js";
13
+ import "./chunks/chunk-DIG26TEI.js";
14
+ import "./chunks/chunk-ONWFPHUI.js";
15
+ import "./chunks/chunk-OQYVEDRN.js";
16
+ import "./chunks/chunk-LRINZRJA.js";
17
+ import "./chunks/chunk-L265M6OS.js";
18
18
  import {
19
19
  admitNativePromiseProperties,
20
20
  defineExtension
21
- } from "./chunks/chunk-J3CUCOMP.js";
21
+ } from "./chunks/chunk-AB6ERQE5.js";
22
22
  import {
23
23
  Budget
24
- } from "./chunks/chunk-LMS5SSTN.js";
25
- import "./chunks/chunk-YUQFFRUF.js";
26
- import "./chunks/chunk-UQPYTZOZ.js";
27
- import "./chunks/chunk-4YIDX44G.js";
24
+ } from "./chunks/chunk-5WP5IRMP.js";
25
+ import "./chunks/chunk-MMN3IESA.js";
26
+ import "./chunks/chunk-JCHJGIQA.js";
27
+ import "./chunks/chunk-CQ52GEHY.js";
28
28
  export {
29
29
  Budget,
30
30
  admitNativePromiseProperties,
@@ -35,4 +35,3 @@ export {
35
35
  lint,
36
36
  run
37
37
  };
38
- //# sourceMappingURL=core.js.map
@@ -23,11 +23,28 @@ export type ExtensionExports = {
23
23
  globals?: Record<string, CallerInjectedBinding>;
24
24
  modules?: ModuleRegistry;
25
25
  };
26
+ export type HostConstructorOptions = {
27
+ /** Another native constructor handle from this realm. */
28
+ parent?: GuestReference;
29
+ /** Native interface brand. Only live host objects reach this synchronous check.
30
+ * Also installs the interface name as its prototype's Symbol.toStringTag.
31
+ */
32
+ hasInstance?: (value: HostObject) => boolean;
33
+ /** Read-only enumerable numeric constants on the constructor and prototype. */
34
+ constants?: Readonly<Record<string, number>>;
35
+ };
26
36
  export type ExtensionContext = {
27
37
  readonly signal: AbortSignal;
28
38
  onCleanup(cleanup: () => void | Promise<void>): void;
29
39
  chargeWork(units?: number): void;
30
40
  createHostObject(definition: HostObjectDefinition): HostObject;
41
+ /** Link a live capability to an owned guest prototype reference (or null). */
42
+ setHostObjectPrototype(value: HostObject, prototype: unknown, assertActive?: () => void): void;
43
+ /** A realm-owned constructor that synchronously returns a live host object.
44
+ * Release the opaque handle with releaseGuestReference when no longer needed.
45
+ * Returned objects keep their existing identity and prototype, including with newTarget.
46
+ */
47
+ createHostConstructor(name: string, construct: (...args: readonly unknown[]) => HostObject, options?: HostConstructorOptions): GuestReference;
31
48
  /** Explicit realm-owned live fixed buffer; default host ingress still copies. */
32
49
  createArrayBufferReference(buffer: ArrayBuffer): GuestReference;
33
50
  startCallback(callback: unknown, options?: CallbackOptions): CallbackInvocation;
@@ -17,7 +17,7 @@ export { run } from "./run.js";
17
17
  export type { RunPromise } from "./run.js";
18
18
  export type { ExecutionControl } from "./interp/jobs.js";
19
19
  export { createRealm, type SafeJSRealm, type RealmOptions, type RealmResult, type RealmLimits } from "./realm.js";
20
- export { defineExtension, type SafeJSExtension, type ExtensionDefinition, type ExtensionManifest, type ExtensionContext, type ExtensionExports, type CallbackOptions, type CallbackInvocation } from "./extensions.js";
20
+ export { defineExtension, type SafeJSExtension, type ExtensionDefinition, type ExtensionManifest, type ExtensionContext, type HostConstructorOptions, type ExtensionExports, type CallbackOptions, type CallbackInvocation } from "./extensions.js";
21
21
  export type { HostObject, HostObjectDefinition, HostObjectIndexedDefinition, HostObjectNamedDefinition, GuestReference } from "./interp/host-capabilities.js";
22
22
  export { createReplayableRandom, type ReplayableRandom } from "./random.js";
23
23
  export type { RunClock, RunClockSnapshot, RunRandom } from "./run.js";
@@ -53,7 +53,7 @@ export { makeFailModule } from "./modules/fail.js";
53
53
  export { makeFsModule } from "./modules/fs.js";
54
54
  export { parseFsConfig, resolveFsConfig } from "./modules/fs-config.js";
55
55
  export type { FsConfig, ResolveFsConfigOptions } from "./modules/fs-config.js";
56
- export type { FsImplementation, FsModule, FsModuleOptions, SandboxDirent, SandboxStats } from "./modules/fs.js";
56
+ export type { FsImplementation, FsModule, FsModuleExports, FsModuleOptions, SandboxDirent, SandboxStats } from "./modules/fs.js";
57
57
  export { makeHarnessModule } from "./modules/harness.js";
58
58
  export { makeLogModule } from "./modules/log.js";
59
59
  export { makeMetricModule } from "./modules/metric.js";
@@ -2,16 +2,16 @@ import {
2
2
  inspectSnapshotMigration,
3
3
  migrateSnapshot,
4
4
  migrateSnapshotFile
5
- } from "./chunks/chunk-47JWFV2B.js";
5
+ } from "./chunks/chunk-6UP3B5TB.js";
6
6
  import {
7
7
  createLintModulesFromRuntimeRegistry
8
- } from "./chunks/chunk-WEGFNME4.js";
8
+ } from "./chunks/chunk-O3S3JVWS.js";
9
9
  import {
10
10
  makeHarnessModule
11
- } from "./chunks/chunk-24Z6PSCN.js";
11
+ } from "./chunks/chunk-6ZVFR4HR.js";
12
12
  import {
13
13
  makeMcpModule
14
- } from "./chunks/chunk-WWETRQCF.js";
14
+ } from "./chunks/chunk-YYF5R6ML.js";
15
15
  import {
16
16
  AgentSpawnError,
17
17
  EnvAccessError,
@@ -32,40 +32,40 @@ import {
32
32
  runWithSpawnUsageAccumulator,
33
33
  splitFrontmatter,
34
34
  supportsSpawnMode
35
- } from "./chunks/chunk-UIUJHTWG.js";
35
+ } from "./chunks/chunk-MKY3MQUB.js";
36
36
  import {
37
37
  parseMcpConfig
38
- } from "./chunks/chunk-3ITVV2R6.js";
38
+ } from "./chunks/chunk-L3MIVH3T.js";
39
39
  import {
40
40
  lint
41
- } from "./chunks/chunk-EMH7CXQM.js";
42
- import "./chunks/chunk-G6WTEIJJ.js";
41
+ } from "./chunks/chunk-POEMWNHD.js";
42
+ import "./chunks/chunk-X3YCE3ZH.js";
43
43
  import {
44
44
  makeFsModule
45
- } from "./chunks/chunk-JCVARKWT.js";
45
+ } from "./chunks/chunk-DIMBVKHT.js";
46
46
  import {
47
47
  createRootedSourceResolver
48
- } from "./chunks/chunk-F6CV74HU.js";
48
+ } from "./chunks/chunk-3NFTBEZR.js";
49
49
  import {
50
50
  FileSnapshotBackend,
51
51
  createRealm,
52
52
  createReplayableRandom,
53
53
  run
54
- } from "./chunks/chunk-YDVEVDVT.js";
55
- import "./chunks/chunk-U7ZNMTSQ.js";
54
+ } from "./chunks/chunk-MLJ4BKDX.js";
55
+ import "./chunks/chunk-DHGJSEFX.js";
56
56
  import {
57
57
  fsCodec
58
- } from "./chunks/chunk-GVKXZW53.js";
58
+ } from "./chunks/chunk-DIG26TEI.js";
59
59
  import {
60
60
  hasOwnErrorCode
61
- } from "./chunks/chunk-2GVBG23M.js";
61
+ } from "./chunks/chunk-ONWFPHUI.js";
62
62
  import {
63
63
  restore
64
- } from "./chunks/chunk-V72WS373.js";
65
- import "./chunks/chunk-AUVGHYM5.js";
64
+ } from "./chunks/chunk-OQYVEDRN.js";
65
+ import "./chunks/chunk-LRINZRJA.js";
66
66
  import {
67
67
  dump
68
- } from "./chunks/chunk-IRYOK5BR.js";
68
+ } from "./chunks/chunk-L265M6OS.js";
69
69
  import {
70
70
  HostCallResumabilityError,
71
71
  HostOperationResumePolicyError,
@@ -77,7 +77,7 @@ import {
77
77
  deepCopyToSandbox,
78
78
  defineExtension,
79
79
  registerPendingHostCallPolicy
80
- } from "./chunks/chunk-J3CUCOMP.js";
80
+ } from "./chunks/chunk-AB6ERQE5.js";
81
81
  import {
82
82
  Budget,
83
83
  SandboxError,
@@ -85,14 +85,14 @@ import {
85
85
  parse,
86
86
  parseModule,
87
87
  parseSourceModule
88
- } from "./chunks/chunk-LMS5SSTN.js";
88
+ } from "./chunks/chunk-5WP5IRMP.js";
89
89
  import {
90
90
  extname
91
- } from "./chunks/chunk-YUQFFRUF.js";
91
+ } from "./chunks/chunk-MMN3IESA.js";
92
92
  import {
93
93
  hostFs
94
- } from "./chunks/chunk-UQPYTZOZ.js";
95
- import "./chunks/chunk-4YIDX44G.js";
94
+ } from "./chunks/chunk-JCHJGIQA.js";
95
+ import "./chunks/chunk-CQ52GEHY.js";
96
96
 
97
97
  // packages/safe-js/src/parse.ts
98
98
  var parse2 = parse;
@@ -497,4 +497,3 @@ export {
497
497
  runWithSpawnUsageAccumulator,
498
498
  splitFrontmatter
499
499
  };
500
- //# sourceMappingURL=index.js.map
@@ -1,5 +1,6 @@
1
1
  import type { SandboxObject, SandboxValue } from "./values.js";
2
2
  import type { Scope } from "./scope.js";
3
+ import { type DataCopyOperation } from "./data-copy.js";
3
4
  export declare const sandboxArgumentsBrand: unique symbol;
4
5
  export type SandboxArguments = SandboxObject & {
5
6
  readonly [sandboxArgumentsBrand]: true;
@@ -16,3 +17,4 @@ export declare function createSandboxArguments(values: readonly SandboxValue[],
16
17
  export declare function isSandboxArguments(value: unknown): value is SandboxArguments;
17
18
  export declare function getSandboxArgumentEntries(value: SandboxObject): Array<[string, SandboxValue]>;
18
19
  export declare function copySandboxArgumentProperties(source: SandboxObject, target: object, copyValue: (value: SandboxValue, key: string | symbol) => unknown): void;
20
+ export declare function copySandboxArgumentPropertiesOperation<T>(source: SandboxObject, target: object, copyValue: (value: SandboxValue, key: string | symbol) => DataCopyOperation<T>): DataCopyOperation<T>;
@@ -1,4 +1,6 @@
1
1
  import type { SandboxMap, SandboxObject, SandboxSet } from "./values.js";
2
+ import { type DataCopyOperation } from "./data-copy.js";
2
3
  export declare const collectionGuestProperties: WeakMap<object, SandboxObject>;
3
4
  export declare function getCollectionProperties(value: SandboxMap | SandboxSet): SandboxObject;
4
5
  export declare function copyCollectionProperties(source: SandboxMap | SandboxSet | Map<unknown, unknown> | Set<unknown>, target: object, encode: (value: unknown, key: string | symbol) => unknown): void;
6
+ export declare function copyCollectionPropertiesOperation<T>(source: SandboxMap | SandboxSet | Map<unknown, unknown> | Set<unknown>, target: object, encode: (value: unknown, key: string | symbol) => DataCopyOperation<T>): DataCopyOperation<T>;
@@ -0,0 +1,2 @@
1
+ export type DataCopyOperation<T> = Generator<DataCopyOperation<T>, T, T>;
2
+ export declare function runDataCopy<T>(operation: DataCopyOperation<T>): T;
@@ -44,6 +44,11 @@ export declare function declareHostOperation<TFunction extends CallerInjectedFun
44
44
  }): TFunction;
45
45
  export declare function readHostOperationPolicy(operation: CallerInjectedFunction): PendingHostCallPolicyMode | undefined;
46
46
  export declare function wrapCallerInjectedBindings(bindings: Record<string, CallerInjectedBinding>, options: HostBridgeOptions): Record<string, SandboxValue>;
47
+ export declare function wrapHostConstructor(name: string, construct: CallerInjectedFunction, options: HostBridgeOptions, definition: {
48
+ parent?: SandboxValue;
49
+ hasInstance?: CallerInjectedFunction;
50
+ constants: Record<string, number>;
51
+ }): SandboxClosure;
47
52
  export declare function copyHostValueToSandbox(value: unknown, stackFrames: readonly string[], options: HostBridgeOptions & {
48
53
  errorData?: boolean;
49
54
  }, state: {
@@ -70,7 +70,12 @@ export declare function registerGuestCallback(callback: HostOperation, state: Gu
70
70
  export declare function readGuestCallback(callback: unknown, owner: object): SandboxClosure;
71
71
  export declare function revokeGuestCallback(callback: object, owner: object): void;
72
72
  export declare function revokeHostObject(value: HostObject, owner: object): void;
73
+ export declare function setHostObjectPrototype(value: HostObject, reference: unknown, owner: object, guard?: () => void): void;
74
+ export declare function getHostObjectPrototype(value: SandboxObject): SandboxObject | null | undefined;
75
+ export declare function hostObjectPrototypeRoot(value: HostObject | SandboxObject): SandboxObject | undefined;
76
+ export declare const noHostObjectMember: unique symbol;
73
77
  export declare function getHostObjectMember(value: SandboxObject, key: string | symbol): SandboxValue;
78
+ export declare function getHostObjectOwnMember(value: SandboxObject, key: string | symbol): SandboxValue;
74
79
  export declare function setHostObjectMember(value: SandboxObject, key: string | symbol, entry: SandboxValue): void;
75
80
  export declare function deleteHostObjectMember(value: SandboxObject, key: string | symbol): boolean;
76
81
  export declare function getHostObjectKeys(value: SandboxObject): string[];
@@ -0,0 +1 @@
1
+ export declare const internalSymbols: Set<symbol>;
@@ -74,7 +74,9 @@ export type InterpretOptions = {
74
74
  };
75
75
  snapshot?: InterpreterSnapshot;
76
76
  };
77
- type EvaluationContext = AsyncEvaluationContext;
77
+ type EvaluationContext = AsyncEvaluationContext & {
78
+ deferDataScans?: boolean;
79
+ };
78
80
  type EvaluationResult = AsyncEvaluationResult;
79
81
  export declare function interpret(node: ParseResult, options?: InterpretOptions): Promise<InterpreterResult>;
80
82
  export { Scope } from "./scope.js";
@@ -1,5 +1,9 @@
1
1
  import { type CompileOwner, type CompileTicket } from "../budget.js";
2
2
  import type { RegexPattern } from "./parse.js";
3
+ type CompiledData = Readonly<{
4
+ units: number;
5
+ ticket: CompileTicket | undefined;
6
+ }>;
3
7
  export declare class CompileScope {
4
8
  readonly owner?: CompileOwner | undefined;
5
9
  readonly parent?: CompileScope | undefined;
@@ -27,7 +31,5 @@ export declare class RegexCompileGuard {
27
31
  retainScratch(): void;
28
32
  close(): void;
29
33
  }
30
- export declare function regexCompiledData(pattern: RegexPattern): {
31
- units: number;
32
- ticket?: CompileTicket;
33
- };
34
+ export declare function regexCompiledData(pattern: RegexPattern): CompiledData;
35
+ export {};
@@ -0,0 +1,5 @@
1
+ import type { TemplateLiteral } from "../parse.js";
2
+ import type { Budget } from "./budget.js";
3
+ import type { SandboxArray } from "./values.js";
4
+ export declare const templateRealms: WeakMap<Budget, Map<TemplateLiteral, SandboxArray>>;
5
+ export declare function releaseTemplateObjects(budget: Budget): void;
@@ -136,6 +136,7 @@ export declare function createSandboxClosure(input: {
136
136
  properties?: SandboxObject | ((closure: SandboxClosure) => SandboxObject);
137
137
  retainedValues?: () => Iterable<SandboxValue>;
138
138
  }): SandboxClosure;
139
+ export declare function registerDeferredClosureProperties(closure: SandboxClosure, root: SandboxObject): void;
139
140
  export declare function registerDeferredClosureChargeIdentity(closure: SandboxClosure, identity: object): void;
140
141
  export declare function registerClosureCaptureCollector(closure: SandboxClosure, provider: () => Iterable<SandboxValue>, collect: (append: (value: SandboxValue) => void) => void): void;
141
142
  export declare function ownEnumerableSandboxEntries(value: SandboxValue, excludedKeys?: ReadonlySet<string>): Array<[string, SandboxValue]>;
@@ -185,9 +186,19 @@ export type StructuredCloneRequest = {
185
186
  };
186
187
  /** Serialization pauses for guest reads/coercion; ordinary data stays synchronous. */
187
188
  export declare function cloneStructuredGraph(value: SandboxValue, state: CopyState<SandboxValue>, budget: Budget, depth?: number): Generator<StructuredCloneRequest, SandboxValue, SandboxValue>;
189
+ export declare const defaultDataMeasurementOptions: Readonly<{
190
+ ignoreClosures: false;
191
+ ignoreClosureCaptures: false;
192
+ ignoreHostObjectPrototypes: false;
193
+ compileTickets: Set<CompileTicket> | undefined;
194
+ }>;
188
195
  export declare function measureSandboxData(values: Iterable<unknown>, options?: {
189
196
  ignoreClosures?: boolean;
190
197
  ignoreClosureCaptures?: boolean;
198
+ /** Host-result allocation only: linked prototypes are already realm-owned.
199
+ * Primary reconciliation must always traverse the complete mutable graph.
200
+ */
201
+ ignoreHostObjectPrototypes?: boolean;
191
202
  compileTickets?: Set<CompileTicket>;
192
203
  }): number;
193
204
  export declare function reconcileCompiledValues(budget: Budget, values: Iterable<unknown>, compilation?: CompileScope, parent?: CompileScope, escaping?: Iterable<unknown>): void;
@@ -82,8 +82,9 @@ export type FsModule = Pick<FsImplementation, FsPassthroughName> & {
82
82
  COPYFILE_EXCL: number;
83
83
  };
84
84
  };
85
- export declare function makeFsModule(options?: FsModuleOptions): FsModule & {
86
- default: FsModule;
87
- promises: FsModule;
85
+ export type FsModuleExports = FsModule & {
86
+ default: FsModuleExports;
87
+ promises: FsModuleExports;
88
88
  };
89
+ export declare function makeFsModule(options?: FsModuleOptions): FsModuleExports;
89
90
  export {};
@@ -1,16 +1,15 @@
1
1
  import {
2
2
  FS_OPTION_SURFACE,
3
3
  makeFsModule
4
- } from "../chunks/chunk-JCVARKWT.js";
5
- import "../chunks/chunk-GVKXZW53.js";
6
- import "../chunks/chunk-2GVBG23M.js";
7
- import "../chunks/chunk-J3CUCOMP.js";
8
- import "../chunks/chunk-LMS5SSTN.js";
9
- import "../chunks/chunk-YUQFFRUF.js";
10
- import "../chunks/chunk-UQPYTZOZ.js";
11
- import "../chunks/chunk-4YIDX44G.js";
4
+ } from "../chunks/chunk-DIMBVKHT.js";
5
+ import "../chunks/chunk-DIG26TEI.js";
6
+ import "../chunks/chunk-ONWFPHUI.js";
7
+ import "../chunks/chunk-AB6ERQE5.js";
8
+ import "../chunks/chunk-5WP5IRMP.js";
9
+ import "../chunks/chunk-MMN3IESA.js";
10
+ import "../chunks/chunk-JCHJGIQA.js";
11
+ import "../chunks/chunk-CQ52GEHY.js";
12
12
  export {
13
13
  FS_OPTION_SURFACE,
14
14
  makeFsModule
15
15
  };
16
- //# sourceMappingURL=fs.js.map
@@ -0,0 +1,14 @@
1
+ /** Stack-scoped context for hosts without native asynchronous context support.
2
+ * Continuations scheduled by SafeJS capture and restore these stacks explicitly.
3
+ */
4
+ export declare class StackContext<T> {
5
+ private static readonly stores;
6
+ private value?;
7
+ private generation;
8
+ constructor();
9
+ getStore(): T | undefined;
10
+ run<Result>(value: T, callback: () => Result): Result;
11
+ exit<Result>(callback: () => Result): Result;
12
+ disable(): void;
13
+ static snapshot(): <Result>(callback: () => Result) => Result;
14
+ }
@@ -0,0 +1,16 @@
1
+ import * as nodeUtil from "node:util";
2
+ import * as nativeFsPromises from "node:fs/promises";
3
+ import { AsyncLocalStorage } from "node:async_hooks";
4
+ import type { HostCallbackContext } from "../interp/host-callback-context.js";
5
+ export declare const cloneSharedBufferWrapper: (value: SharedArrayBuffer) => SharedArrayBuffer;
6
+ export declare function createHostCallbackContext(): HostCallbackContext;
7
+ export declare const accessDeniedSystemError: readonly [number, string];
8
+ export { AsyncLocalStorage };
9
+ export declare const types: typeof nodeUtil.types;
10
+ export { setImmediate as yieldToHost } from "node:timers/promises";
11
+ export { inspect } from "node:util";
12
+ export { formatWithOptions } from "node:util";
13
+ export { constants as fsConstants } from "node:fs";
14
+ export declare const hostFs: typeof nativeFsPromises;
15
+ export declare const hostCwd: () => string;
16
+ export declare const hostPlatform: NodeJS.Platform;
@@ -0,0 +1,18 @@
1
+ export declare function createTrackedProxy<T extends object>(target: T, handler: ProxyHandler<T>): T;
2
+ export declare const types: {
3
+ isProxy: (value: unknown) => boolean;
4
+ isBooleanObject: (value: unknown) => boolean;
5
+ isNumberObject: (value: unknown) => boolean;
6
+ isStringObject: (value: unknown) => boolean;
7
+ isBigIntObject: (value: unknown) => boolean;
8
+ isSymbolObject: (value: unknown) => boolean;
9
+ isDate: (value: unknown) => boolean;
10
+ isRegExp: (value: unknown) => boolean;
11
+ isArrayBuffer: (value: unknown) => boolean;
12
+ isDataView: (value: unknown) => boolean;
13
+ isMap: (value: unknown) => boolean;
14
+ isPromise(value: unknown): value is Promise<unknown>;
15
+ isAsyncFunction: (value: unknown) => boolean;
16
+ isGeneratorFunction: (value: unknown) => boolean;
17
+ isNativeError: (value: unknown) => value is Error;
18
+ };
@@ -0,0 +1,21 @@
1
+ import { StackContext } from "./context.js";
2
+ export declare const AsyncLocalStorage: typeof StackContext;
3
+ export { types } from "./types.js";
4
+ import type { HostCallbackContext } from "../interp/host-callback-context.js";
5
+ export declare const cloneSharedBufferWrapper: (value: SharedArrayBuffer) => SharedArrayBuffer;
6
+ export declare function createHostCallbackContext(): HostCallbackContext;
7
+ export declare const accessDeniedSystemError: readonly [number, string];
8
+ export declare const yieldToHost: () => Promise<void>;
9
+ export declare const hostCwd: () => string;
10
+ export declare const hostPlatform = "workerd";
11
+ export declare const fsConstants: {
12
+ F_OK: number;
13
+ R_OK: number;
14
+ W_OK: number;
15
+ X_OK: number;
16
+ COPYFILE_EXCL: number;
17
+ };
18
+ export declare const hostFs: import("@poe-platform/safe-fs/core").FsBridge;
19
+ export declare function inspect(value: unknown, _options?: {
20
+ depth?: number;
21
+ }): string;
@@ -1,4 +1,4 @@
1
- import type { CompileOwner } from "./interp/budget.js";
1
+ import { type CompileOwner } from "./interp/budget.js";
2
2
  import { type SnapshotMigration } from "./snapshot/migration.js";
3
3
  export type SafeJSSnapshot = {
4
4
  version?: number;
@@ -1,6 +1,6 @@
1
1
  import type { Budget, CompileOwner } from "../interp/budget.js";
2
2
  import { type DynamicSource } from "../parse/dynamic-source.js";
3
- import type { ParseResult } from "../parse/parser.js";
3
+ import { type ParseResult } from "../parse/parser.js";
4
4
  export type SnapshotValidationCode = "budgetExceeded" | "danglingReference" | "duplicateId" | "invalidCycle" | "invalidState" | "invalidType" | "invalidValue" | "unknownTag" | "unsupportedVersion";
5
5
  export declare class SnapshotValidationError extends Error {
6
6
  readonly code: SnapshotValidationCode;
@@ -10,6 +10,7 @@ export declare class SnapshotValidationError extends Error {
10
10
  export declare function validateSnapshotData(value: unknown): void;
11
11
  export declare function validateDumpEnvelope(snapshot: unknown, options?: {
12
12
  resume?: boolean;
13
+ source?: string;
13
14
  }): asserts snapshot is Record<string, unknown>;
14
15
  export declare function validateInterpreterSnapshot(snapshot: unknown, nodeById: ReadonlyMap<number, ParseResult>, budget: Budget, dynamicSources?: Map<number, DynamicSource>, owner?: CompileOwner): asserts snapshot is Record<string, unknown>;
15
16
  export declare function validateSnapshotSourceHash(snapshot: unknown): asserts snapshot is {