@poe-platform/safe-js 0.1.728 → 0.1.729

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 (46) hide show
  1. package/README.md +1 -1
  2. package/dist/safe-js/chunks/{chunk-GZT57PW4.js → chunk-2S4YRXI6.js} +2 -2
  3. package/dist/safe-js/chunks/{chunk-EBNKJYZV.js → chunk-EA7AHM2X.js} +2 -2
  4. package/dist/safe-js/chunks/{chunk-EZEB4AIH.js → chunk-EN724VH3.js} +3 -3
  5. package/dist/safe-js/chunks/{chunk-4QDOJTAL.js → chunk-LRSWTDIV.js} +6 -5
  6. package/dist/safe-js/chunks/chunk-LRSWTDIV.js.map +7 -0
  7. package/dist/safe-js/chunks/{chunk-IZX26NC7.js → chunk-MRULOD5J.js} +2 -2
  8. package/dist/safe-js/chunks/{chunk-VW2VLHK2.js → chunk-MVLDRXWS.js} +2 -2
  9. package/dist/safe-js/chunks/{chunk-ZSIY6K54.js → chunk-S5YDMMM3.js} +64 -58
  10. package/dist/safe-js/chunks/{chunk-ZSIY6K54.js.map → chunk-S5YDMMM3.js.map} +3 -3
  11. package/dist/safe-js/chunks/{chunk-ZTKMQHXB.js → chunk-VIMROAQA.js} +2 -2
  12. package/dist/safe-js/chunks/{chunk-TFLQJ5NE.js → chunk-W3IY6FKO.js} +2 -2
  13. package/dist/safe-js/chunks/{chunk-RXESEKV6.js → chunk-XX57YCGZ.js} +6 -7
  14. package/dist/safe-js/chunks/chunk-XX57YCGZ.js.map +7 -0
  15. package/dist/safe-js/chunks/{cli-runtime-OZPDDD6M.js → cli-runtime-6VVBO2SS.js} +10 -10
  16. package/dist/safe-js/chunks/{dump-3TMEMH6D.js → dump-UNYK24YS.js} +3 -3
  17. package/dist/safe-js/chunks/{fs-YSBEA2WW.js → fs-AOV77RQC.js} +3 -3
  18. package/dist/safe-js/chunks/{harness-YC3FLN5N.js → harness-ZIEO7NAV.js} +3 -3
  19. package/dist/safe-js/chunks/{mcp-3GOG43VR.js → mcp-WBM7ZOAN.js} +3 -3
  20. package/dist/safe-js/chunks/{migration-file-IFKOIPNA.js → migration-file-3SWGNDS2.js} +4 -4
  21. package/dist/safe-js/chunks/{restore-ZOAQTM7X.js → restore-FCTWPLU3.js} +4 -4
  22. package/dist/safe-js/chunks/{run-XH62V323.js → run-ESJHEXCE.js} +6 -6
  23. package/dist/safe-js/chunks/{runtime-modules-BUR3QGOJ.js → runtime-modules-7V6BWCRK.js} +3 -3
  24. package/dist/safe-js/cli.js +2 -2
  25. package/dist/safe-js/core.js +5 -5
  26. package/dist/safe-js/index.js +11 -12
  27. package/dist/safe-js/index.js.map +2 -2
  28. package/package.json +3 -2
  29. package/dist/safe-js/chunks/chunk-4QDOJTAL.js.map +0 -7
  30. package/dist/safe-js/chunks/chunk-RXESEKV6.js.map +0 -7
  31. /package/dist/safe-js/chunks/{chunk-GZT57PW4.js.map → chunk-2S4YRXI6.js.map} +0 -0
  32. /package/dist/safe-js/chunks/{chunk-EBNKJYZV.js.map → chunk-EA7AHM2X.js.map} +0 -0
  33. /package/dist/safe-js/chunks/{chunk-EZEB4AIH.js.map → chunk-EN724VH3.js.map} +0 -0
  34. /package/dist/safe-js/chunks/{chunk-IZX26NC7.js.map → chunk-MRULOD5J.js.map} +0 -0
  35. /package/dist/safe-js/chunks/{chunk-VW2VLHK2.js.map → chunk-MVLDRXWS.js.map} +0 -0
  36. /package/dist/safe-js/chunks/{chunk-ZTKMQHXB.js.map → chunk-VIMROAQA.js.map} +0 -0
  37. /package/dist/safe-js/chunks/{chunk-TFLQJ5NE.js.map → chunk-W3IY6FKO.js.map} +0 -0
  38. /package/dist/safe-js/chunks/{cli-runtime-OZPDDD6M.js.map → cli-runtime-6VVBO2SS.js.map} +0 -0
  39. /package/dist/safe-js/chunks/{dump-3TMEMH6D.js.map → dump-UNYK24YS.js.map} +0 -0
  40. /package/dist/safe-js/chunks/{fs-YSBEA2WW.js.map → fs-AOV77RQC.js.map} +0 -0
  41. /package/dist/safe-js/chunks/{harness-YC3FLN5N.js.map → harness-ZIEO7NAV.js.map} +0 -0
  42. /package/dist/safe-js/chunks/{mcp-3GOG43VR.js.map → mcp-WBM7ZOAN.js.map} +0 -0
  43. /package/dist/safe-js/chunks/{migration-file-IFKOIPNA.js.map → migration-file-3SWGNDS2.js.map} +0 -0
  44. /package/dist/safe-js/chunks/{restore-ZOAQTM7X.js.map → restore-FCTWPLU3.js.map} +0 -0
  45. /package/dist/safe-js/chunks/{run-XH62V323.js.map → run-ESJHEXCE.js.map} +0 -0
  46. /package/dist/safe-js/chunks/{runtime-modules-BUR3QGOJ.js.map → runtime-modules-7V6BWCRK.js.map} +0 -0
@@ -55,7 +55,7 @@ async function runCli(argv, options, usage) {
55
55
  async () => {
56
56
  try {
57
57
  if (argv[0] === "migrate") {
58
- const { migrateSnapshotFile } = await import("./migration-file-IFKOIPNA.js");
58
+ const { migrateSnapshotFile } = await import("./migration-file-3SWGNDS2.js");
59
59
  const result = await migrateSnapshotFile({
60
60
  ...parseMigrationArgs(argv.slice(1)),
61
61
  cwd: options.cwd ?? readCurrentWorkingDirectory()
@@ -272,12 +272,12 @@ async function assertHarnessFile(input) {
272
272
  }
273
273
  async function runScriptFile(filepath, parsed, options) {
274
274
  const [{ run }, { restore }, { dump, dumpCurrent }, { createLintModulesFromRuntimeRegistry }, { makeFsModule }, { makeMcpModule }] = await Promise.all([
275
- import("./run-XH62V323.js"),
276
- import("./restore-ZOAQTM7X.js"),
277
- import("./dump-3TMEMH6D.js"),
278
- import("./runtime-modules-BUR3QGOJ.js"),
279
- import("./fs-YSBEA2WW.js"),
280
- import("./mcp-3GOG43VR.js")
275
+ import("./run-ESJHEXCE.js"),
276
+ import("./restore-FCTWPLU3.js"),
277
+ import("./dump-UNYK24YS.js"),
278
+ import("./runtime-modules-7V6BWCRK.js"),
279
+ import("./fs-AOV77RQC.js"),
280
+ import("./mcp-WBM7ZOAN.js")
281
281
  ]);
282
282
  const loaded = loadExecutableSource(filepath, await options.readFile(filepath, "utf8"));
283
283
  const meta = {
@@ -513,8 +513,8 @@ async function createRuntime(frontmatter, meta, options) {
513
513
  };
514
514
  }
515
515
  const [{ makeHarnessModule }, { makeFsModule }] = await Promise.all([
516
- import("./harness-YC3FLN5N.js"),
517
- import("./fs-YSBEA2WW.js")
516
+ import("./harness-ZIEO7NAV.js"),
517
+ import("./fs-AOV77RQC.js")
518
518
  ]);
519
519
  const state = {
520
520
  metricCalls: /* @__PURE__ */ new Map(),
@@ -704,4 +704,4 @@ export {
704
704
  exitCodeForError,
705
705
  runCli
706
706
  };
707
- //# sourceMappingURL=cli-runtime-OZPDDD6M.js.map
707
+ //# sourceMappingURL=cli-runtime-6VVBO2SS.js.map
@@ -4,8 +4,8 @@ import {
4
4
  dump,
5
5
  dumpCurrent,
6
6
  serializeRunSnapshot
7
- } from "./chunk-VW2VLHK2.js";
8
- import "./chunk-ZSIY6K54.js";
7
+ } from "./chunk-MVLDRXWS.js";
8
+ import "./chunk-S5YDMMM3.js";
9
9
  import "./chunk-Y5EZYHU6.js";
10
10
  import "./chunk-4YIDX44G.js";
11
11
  export {
@@ -15,4 +15,4 @@ export {
15
15
  dumpCurrent,
16
16
  serializeRunSnapshot
17
17
  };
18
- //# sourceMappingURL=dump-3TMEMH6D.js.map
18
+ //# sourceMappingURL=dump-UNYK24YS.js.map
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  FS_OPTION_SURFACE,
3
3
  makeFsModule
4
- } from "./chunk-IZX26NC7.js";
4
+ } from "./chunk-MRULOD5J.js";
5
5
  import "./chunk-SJZWSPWD.js";
6
- import "./chunk-ZSIY6K54.js";
6
+ import "./chunk-S5YDMMM3.js";
7
7
  import "./chunk-Y5EZYHU6.js";
8
8
  import "./chunk-4YIDX44G.js";
9
9
  export {
10
10
  FS_OPTION_SURFACE,
11
11
  makeFsModule
12
12
  };
13
- //# sourceMappingURL=fs-YSBEA2WW.js.map
13
+ //# sourceMappingURL=fs-AOV77RQC.js.map
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  makeHarnessModule
3
- } from "./chunk-TFLQJ5NE.js";
4
- import "./chunk-ZSIY6K54.js";
3
+ } from "./chunk-W3IY6FKO.js";
4
+ import "./chunk-S5YDMMM3.js";
5
5
  import "./chunk-Y5EZYHU6.js";
6
6
  import "./chunk-4YIDX44G.js";
7
7
  export {
8
8
  makeHarnessModule
9
9
  };
10
- //# sourceMappingURL=harness-YC3FLN5N.js.map
10
+ //# sourceMappingURL=harness-ZIEO7NAV.js.map
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  makeMcpModule
3
- } from "./chunk-GZT57PW4.js";
3
+ } from "./chunk-2S4YRXI6.js";
4
4
  import "./chunk-BRBOVGNC.js";
5
- import "./chunk-ZSIY6K54.js";
5
+ import "./chunk-S5YDMMM3.js";
6
6
  import "./chunk-Y5EZYHU6.js";
7
7
  import "./chunk-4YIDX44G.js";
8
8
  export {
9
9
  makeMcpModule
10
10
  };
11
- //# sourceMappingURL=mcp-3GOG43VR.js.map
11
+ //# sourceMappingURL=mcp-WBM7ZOAN.js.map
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  migrateSnapshotFile
3
- } from "./chunk-4QDOJTAL.js";
3
+ } from "./chunk-LRSWTDIV.js";
4
4
  import "./chunk-SJZWSPWD.js";
5
- import "./chunk-EBNKJYZV.js";
6
- import "./chunk-ZSIY6K54.js";
5
+ import "./chunk-EA7AHM2X.js";
6
+ import "./chunk-S5YDMMM3.js";
7
7
  import "./chunk-Y5EZYHU6.js";
8
8
  import "./chunk-4YIDX44G.js";
9
9
  export {
10
10
  migrateSnapshotFile
11
11
  };
12
- //# sourceMappingURL=migration-file-IFKOIPNA.js.map
12
+ //# sourceMappingURL=migration-file-3SWGNDS2.js.map
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  SnapshotMismatchError,
3
3
  restore
4
- } from "./chunk-EZEB4AIH.js";
5
- import "./chunk-EBNKJYZV.js";
6
- import "./chunk-ZSIY6K54.js";
4
+ } from "./chunk-EN724VH3.js";
5
+ import "./chunk-EA7AHM2X.js";
6
+ import "./chunk-S5YDMMM3.js";
7
7
  import "./chunk-Y5EZYHU6.js";
8
8
  import "./chunk-4YIDX44G.js";
9
9
  export {
10
10
  SnapshotMismatchError,
11
11
  restore
12
12
  };
13
- //# sourceMappingURL=restore-ZOAQTM7X.js.map
13
+ //# sourceMappingURL=restore-FCTWPLU3.js.map
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  UnhandledRejectionError,
3
3
  run
4
- } from "./chunk-RXESEKV6.js";
4
+ } from "./chunk-XX57YCGZ.js";
5
5
  import "./chunk-U7ZNMTSQ.js";
6
- import "./chunk-EZEB4AIH.js";
7
- import "./chunk-VW2VLHK2.js";
6
+ import "./chunk-EN724VH3.js";
7
+ import "./chunk-MVLDRXWS.js";
8
8
  import "./chunk-SJZWSPWD.js";
9
- import "./chunk-EBNKJYZV.js";
10
- import "./chunk-ZSIY6K54.js";
9
+ import "./chunk-EA7AHM2X.js";
10
+ import "./chunk-S5YDMMM3.js";
11
11
  import "./chunk-Y5EZYHU6.js";
12
12
  import "./chunk-4YIDX44G.js";
13
13
  export {
14
14
  UnhandledRejectionError,
15
15
  run
16
16
  };
17
- //# sourceMappingURL=run-XH62V323.js.map
17
+ //# sourceMappingURL=run-ESJHEXCE.js.map
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  createLintModulesFromRuntimeRegistry
3
- } from "./chunk-ZTKMQHXB.js";
4
- import "./chunk-ZSIY6K54.js";
3
+ } from "./chunk-VIMROAQA.js";
4
+ import "./chunk-S5YDMMM3.js";
5
5
  import "./chunk-Y5EZYHU6.js";
6
6
  import "./chunk-4YIDX44G.js";
7
7
  export {
8
8
  createLintModulesFromRuntimeRegistry
9
9
  };
10
- //# sourceMappingURL=runtime-modules-BUR3QGOJ.js.map
10
+ //# sourceMappingURL=runtime-modules-7V6BWCRK.js.map
@@ -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-OZPDDD6M.js");
16
+ const runtime = await import("./chunks/cli-runtime-6VVBO2SS.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-OZPDDD6M.js");
35
+ const { exitCodeForError } = await import("./chunks/cli-runtime-6VVBO2SS.js");
36
36
  return exitCodeForError(error);
37
37
  }
38
38
  }
@@ -5,16 +5,16 @@ import {
5
5
  createRealm,
6
6
  createReplayableRandom,
7
7
  run
8
- } from "./chunks/chunk-RXESEKV6.js";
8
+ } from "./chunks/chunk-XX57YCGZ.js";
9
9
  import "./chunks/chunk-U7ZNMTSQ.js";
10
- import "./chunks/chunk-EZEB4AIH.js";
11
- import "./chunks/chunk-VW2VLHK2.js";
10
+ import "./chunks/chunk-EN724VH3.js";
11
+ import "./chunks/chunk-MVLDRXWS.js";
12
12
  import "./chunks/chunk-SJZWSPWD.js";
13
- import "./chunks/chunk-EBNKJYZV.js";
13
+ import "./chunks/chunk-EA7AHM2X.js";
14
14
  import {
15
15
  admitNativePromiseProperties,
16
16
  defineExtension
17
- } from "./chunks/chunk-ZSIY6K54.js";
17
+ } from "./chunks/chunk-S5YDMMM3.js";
18
18
  import {
19
19
  Budget
20
20
  } from "./chunks/chunk-Y5EZYHU6.js";
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  createLintModulesFromRuntimeRegistry
3
- } from "./chunks/chunk-ZTKMQHXB.js";
3
+ } from "./chunks/chunk-VIMROAQA.js";
4
4
  import {
5
5
  makeFsModule
6
- } from "./chunks/chunk-IZX26NC7.js";
6
+ } from "./chunks/chunk-MRULOD5J.js";
7
7
  import {
8
8
  makeHarnessModule
9
- } from "./chunks/chunk-TFLQJ5NE.js";
9
+ } from "./chunks/chunk-W3IY6FKO.js";
10
10
  import {
11
11
  makeMcpModule
12
- } from "./chunks/chunk-GZT57PW4.js";
12
+ } from "./chunks/chunk-2S4YRXI6.js";
13
13
  import {
14
14
  AgentSpawnError,
15
15
  EnvAccessError,
@@ -46,23 +46,23 @@ import {
46
46
  createRealm,
47
47
  createReplayableRandom,
48
48
  run
49
- } from "./chunks/chunk-RXESEKV6.js";
49
+ } from "./chunks/chunk-XX57YCGZ.js";
50
50
  import "./chunks/chunk-U7ZNMTSQ.js";
51
51
  import {
52
52
  restore
53
- } from "./chunks/chunk-EZEB4AIH.js";
53
+ } from "./chunks/chunk-EN724VH3.js";
54
54
  import {
55
55
  dump
56
- } from "./chunks/chunk-VW2VLHK2.js";
56
+ } from "./chunks/chunk-MVLDRXWS.js";
57
57
  import {
58
58
  inspectSnapshotMigration,
59
59
  migrateSnapshot,
60
60
  migrateSnapshotFile
61
- } from "./chunks/chunk-4QDOJTAL.js";
61
+ } from "./chunks/chunk-LRSWTDIV.js";
62
62
  import {
63
63
  hasOwnErrorCode
64
64
  } from "./chunks/chunk-SJZWSPWD.js";
65
- import "./chunks/chunk-EBNKJYZV.js";
65
+ import "./chunks/chunk-EA7AHM2X.js";
66
66
  import {
67
67
  HostCallResumabilityError,
68
68
  HostOperationResumePolicyError,
@@ -74,7 +74,7 @@ import {
74
74
  deepCopyToSandbox,
75
75
  defineExtension,
76
76
  registerPendingHostCallPolicy
77
- } from "./chunks/chunk-ZSIY6K54.js";
77
+ } from "./chunks/chunk-S5YDMMM3.js";
78
78
  import {
79
79
  Budget,
80
80
  SandboxError,
@@ -362,7 +362,6 @@ function findExportedConstInitializer(module, name) {
362
362
  }
363
363
 
364
364
  // packages/safe-js/src/modules/time.ts
365
- import { webcrypto as crypto } from "node:crypto";
366
365
  function makeTimeModule(options = {}) {
367
366
  const hasDeterministicRandom = options.random !== void 0 || options.seed !== void 0;
368
367
  const random = options.random ?? (options.seed === void 0 ? () => Math.random() : createSeededRandom(options.seed).next);
@@ -401,7 +400,7 @@ function makeTimeModule(options = {}) {
401
400
  random,
402
401
  now,
403
402
  sleep,
404
- uuid: hasDeterministicRandom ? () => createRandomUuid(random) : () => crypto.randomUUID()
403
+ uuid: hasDeterministicRandom ? () => createRandomUuid(random) : () => globalThis.crypto.randomUUID()
405
404
  };
406
405
  }
407
406
  function createRandomUuid(random) {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/parse.ts", "../src/runner/run-harness.ts", "../src/loader/find-exported.ts", "../src/modules/time.ts", "../src/index.ts"],
4
- "sourcesContent": ["import { parse as parseInternal, type ParseResult as ParsedNode } from \"./parse/parser.js\";\n\nexport { DisallowedSyntaxError } from \"./parse/parser.js\";\nexport const parse: (source: string, filename?: string) => ParsedNode = parseInternal;\nexport type {\n ArrayPattern,\n ArrayExpression,\n ArrowFunctionExpression,\n AssignmentExpression,\n AssignmentPattern,\n AssignmentProperty,\n AwaitExpression,\n BinaryExpression,\n BigIntLiteral,\n BlockStatement,\n BooleanLiteral,\n BreakStatement,\n CallExpression,\n CatchClause,\n ClassBody,\n ClassDeclaration,\n ClassElement,\n ClassExpression,\n ClassNode,\n ConditionalExpression,\n ContinueStatement,\n DoWhileStatement,\n EmptyStatement,\n Expression,\n ExpressionStatement,\n ExportDefaultDeclaration,\n ExportNamedDeclaration,\n ImportDeclaration,\n ImportExpression,\n ImportDefaultSpecifier,\n ImportNamespaceSpecifier,\n ImportSpecifier,\n ForInStatement,\n ForOfStatement,\n ForStatement,\n FunctionDeclaration,\n FunctionExpression,\n Identifier,\n IfStatement,\n LogicalExpression,\n MemberExpression,\n MetaProperty,\n NewExpression,\n NewTargetExpression,\n NullLiteral,\n NumericLiteral,\n ObjectExpression,\n ObjectPattern,\n ParseResult,\n PatternTarget,\n Property,\n RegexLiteral,\n RestElement,\n ReturnStatement,\n SequenceExpression,\n SourceSpan,\n SpreadElement,\n Statement,\n StringLiteral,\n SuperExpression,\n SwitchCase,\n SwitchStatement,\n TaggedTemplateExpression,\n TemplateElement,\n TemplateLiteral,\n ThisExpression,\n ThrowStatement,\n TryStatement,\n UnaryExpression,\n UndefinedLiteral,\n UpdateExpression,\n UpdateTarget,\n VariableDeclaration,\n VariableDeclarationKind,\n VariableDeclarator,\n WhileStatement,\n WithStatement\n} from \"./parse/parser.js\";\n", "import { readFile, stat } from \"node:fs/promises\";\nimport { extname } from \"node:path\";\n\nimport { supportsSpawnMode } from \"@poe-code/agent-spawn/configs\";\nimport { SPAWN_MODES, type SpawnMode } from \"@poe-code/agent-spawn/types\";\nimport { hasOwnErrorCode } from \"../error-codes.js\";\nimport { countLineBreaks, extractBlock, maskSource } from \"../loader/extract-block.js\";\nimport { splitFrontmatter } from \"../loader/frontmatter.js\";\nimport { lint, type Diagnostic } from \"../lint.js\";\nimport { createLintModulesFromRuntimeRegistry } from \"../lint/runtime-modules.js\";\nimport type { ModuleExports, ModuleRegistry } from \"../modules/registry.js\";\nimport type { OtelSink } from \"../observability/otel.js\";\nimport { parseModule } from \"../parse/parser.js\";\nimport { run, type RunOptions, type RunResult } from \"../run.js\";\nimport type { SnapshotBackend } from \"../snapshot/backend.js\";\n\ntype HarnessMeta = {\n filepath: string;\n kind: unknown;\n version: unknown;\n};\n\nexport type RunHarnessOptions = {\n budget?: RunOptions[\"budget\"];\n modulesFor: (frontmatter: Record<string, unknown>, meta: HarnessMeta) => ModuleRegistry;\n otelSink?: OtelSink;\n signal?: AbortSignal;\n snapshotBackend?: SnapshotBackend;\n snapshotIntervalMs?: number;\n snapshotPath?: string;\n};\n\nexport type RunHarnessExecutionErrorResult = {\n aborted?: true;\n error: unknown;\n ok: false;\n};\n\nexport type RunHarnessResult = RunResult | RunHarnessExecutionErrorResult;\n\nfunction getOwnEntry(record: Record<string, unknown>, key: string): unknown {\n return Object.prototype.hasOwnProperty.call(record, key) ? record[key] : undefined;\n}\n\nfunction createHarnessMeta(filepath: string, frontmatter: Record<string, unknown>): HarnessMeta {\n return {\n filepath,\n kind: getOwnEntry(frontmatter, \"kind\"),\n version: getOwnEntry(frontmatter, \"version\")\n };\n}\n\nfunction assertFrontmatterAgentModes(frontmatter: Record<string, unknown>): void {\n const agents = getOwnEntry(frontmatter, \"agents\");\n if (typeof agents !== \"object\" || agents === null || Array.isArray(agents)) {\n return;\n }\n\n for (const [name, definition] of Object.entries(agents)) {\n if (typeof definition !== \"object\" || definition === null || Array.isArray(definition)) {\n continue;\n }\n\n const record = definition as Record<string, unknown>;\n const agent = getOwnEntry(record, \"agent\");\n const mode = getOwnEntry(record, \"mode\");\n if (typeof agent !== \"string\" || typeof mode !== \"string\") {\n continue;\n }\n\n // Malformed mode strings are reported by the agent module's own validation.\n if (!SPAWN_MODES.includes(mode as SpawnMode)) {\n continue;\n }\n\n if (!supportsSpawnMode(agent, mode as SpawnMode)) {\n throw new Error(`Harness agent \"${name}\": agent \"${agent}\" does not support mode \"${mode}\".`);\n }\n }\n}\n\nexport class LintError extends Error {\n readonly diagnostics: readonly Diagnostic[];\n\n constructor(diagnostics: readonly Diagnostic[]) {\n super(formatLintErrorMessage(diagnostics));\n this.name = \"LintError\";\n this.diagnostics = diagnostics;\n }\n}\n\nexport async function runHarness(\n filepath: string,\n options: RunHarnessOptions\n): Promise<RunHarnessResult> {\n const rawSource = await readHarnessFile(filepath);\n const { executableSource, frontmatter, isRawScript } = loadExecutableSource(filepath, rawSource);\n assertFrontmatterAgentModes(frontmatter);\n const meta = createHarnessMeta(filepath, frontmatter);\n const modules = excludeHarnessModule(options.modulesFor(frontmatter, meta), isRawScript);\n const diagnostics = lint(executableSource, {\n filename: filepath,\n modules: createLintModulesFromRuntimeRegistry(modules)\n });\n const lintErrors = diagnostics.filter((diagnostic) => diagnostic.severity === \"error\");\n\n if (lintErrors.length > 0) {\n throw new LintError(lintErrors);\n }\n\n return runHarnessSource(executableSource, {\n budget: options.budget,\n entryPointArgs: hasDefaultExport(executableSource, filepath) ? [] : undefined,\n filename: filepath,\n modules,\n otelSink: options.otelSink,\n signal: options.signal,\n snapshotBackend: options.snapshotBackend,\n snapshotIntervalMs: options.snapshotIntervalMs,\n snapshotPath: options.snapshotPath\n });\n}\n\nexport async function runHarnessPair(\n filepath: string,\n options: RunHarnessOptions\n): Promise<RunHarnessResult> {\n const pair = resolveHarnessPair(filepath);\n const [rawMarkdown, rawScript] = await Promise.all([\n readHarnessFile(pair.markdownPath),\n readHarnessFile(pair.scriptPath)\n ]);\n const { frontmatter, body } = splitFrontmatter(stripByteOrderMark(rawMarkdown));\n assertFrontmatterAgentModes(frontmatter);\n const executableSource = stripByteOrderMark(rawScript);\n const meta = createHarnessMeta(pair.markdownPath, frontmatter);\n const modules = options.modulesFor(frontmatter, meta);\n const diagnostics = lint(executableSource, {\n allowedExportNames: [\"schema\"],\n defaultExport: {\n parameters: [\"frontmatter\"],\n required: true\n },\n filename: pair.scriptPath,\n frontmatterFields: Object.keys(frontmatter),\n modules: createLintModulesFromRuntimeRegistry(modules)\n });\n const lintErrors = diagnostics.filter((diagnostic) => diagnostic.severity === \"error\");\n\n if (lintErrors.length > 0) {\n throw new LintError(lintErrors);\n }\n\n return runHarnessSource(executableSource, {\n budget: options.budget,\n entryPointArgs: [frontmatter],\n filename: pair.scriptPath,\n importMeta: {\n body,\n filepath: pair.markdownPath,\n kind: meta.kind,\n version: meta.version\n },\n modules,\n otelSink: options.otelSink,\n signal: options.signal,\n snapshotBackend: options.snapshotBackend,\n snapshotIntervalMs: options.snapshotIntervalMs,\n snapshotPath: options.snapshotPath\n });\n}\n\nasync function readHarnessFile(filepath: string): Promise<string> {\n try {\n const stats = await stat(filepath);\n if (!stats.isFile()) {\n throw new Error(`Harness path must point to a file: ${filepath}`);\n }\n\n return await readFile(filepath, \"utf8\");\n } catch (error) {\n if (hasOwnErrorCode(error, \"ENOENT\") || hasOwnErrorCode(error, \"ENOTDIR\")) {\n throw new Error(`Harness file not found: ${filepath}`);\n }\n\n throw error;\n }\n}\n\nfunction loadExecutableSource(\n filepath: string,\n source: string\n): {\n executableSource: string;\n frontmatter: Record<string, unknown>;\n isRawScript: boolean;\n} {\n if (isRawScriptPath(filepath)) {\n const executableSource = stripByteOrderMark(source);\n if (executableSource.length === 0) {\n throw new Error(`No code block found in empty harness file: ${filepath}`);\n }\n\n return {\n executableSource,\n frontmatter: {},\n isRawScript: true\n };\n }\n\n const { frontmatter, body } = splitFrontmatter(source);\n if (source.length === 0 || body.trim().length === 0) {\n throw new Error(`No code block found in empty harness file: ${filepath}`);\n }\n\n const bodyStartOffset = source.length - body.length;\n const { source: executableBlock, startOffset } = extractBlock(\n body,\n countLineBreaks(source, 0, bodyStartOffset) + 1\n );\n return {\n executableSource:\n maskSource(source.slice(0, bodyStartOffset + startOffset)) + stripHashbang(executableBlock),\n frontmatter,\n isRawScript: false\n };\n}\n\nfunction resolveHarnessPair(filepath: string): { markdownPath: string; scriptPath: string } {\n const extension = extname(filepath);\n const basename = extension.length === 0 ? filepath : filepath.slice(0, -extension.length);\n\n if (isRawScriptExtension(extension)) {\n return {\n markdownPath: `${basename}.md`,\n scriptPath: filepath\n };\n }\n\n return {\n markdownPath: filepath,\n scriptPath: `${basename}.ajs`\n };\n}\n\nfunction isRawScriptPath(filepath: string): boolean {\n return isRawScriptExtension(extname(filepath));\n}\n\nfunction isRawScriptExtension(extension: string): boolean {\n return extension === \".safejs\" || extension === \".ajs\";\n}\n\nasync function runHarnessSource(\n executableSource: string,\n options: Parameters<typeof run>[1]\n): Promise<RunHarnessResult> {\n try {\n return await run(executableSource, options);\n } catch (error) {\n if (isSetupError(error)) {\n throw error;\n }\n\n return {\n ...(isAbortError(error) ? { aborted: true as const } : {}),\n error,\n ok: false\n };\n }\n}\n\nfunction isSetupError(error: unknown): boolean {\n return error instanceof Error && error.name === \"ParseError\";\n}\n\nfunction isAbortError(error: unknown): boolean {\n if (error instanceof Error) {\n return error.name === \"AbortError\";\n }\n\n return (\n typeof error === \"object\" &&\n error !== null &&\n Object.prototype.hasOwnProperty.call(error, \"name\") &&\n (error as { name?: unknown }).name === \"AbortError\"\n );\n}\n\nfunction hasDefaultExport(source: string, filename: string): boolean {\n return parseModule(source, filename).body.some(\n (statement) => statement.type === \"ExportDefaultDeclaration\"\n );\n}\n\nfunction excludeHarnessModule(modules: ModuleRegistry, isRawScript: boolean): ModuleRegistry {\n if (!isRawScript) {\n return modules;\n }\n\n if (modules instanceof Map) {\n const rawModules = new Map(modules);\n rawModules.delete(\"harness\");\n return rawModules;\n }\n\n const rawModules: Record<string, ModuleExports> = {};\n\n for (const [moduleName, moduleExports] of Object.entries(modules)) {\n if (moduleName !== \"harness\") {\n rawModules[moduleName] = moduleExports;\n }\n }\n\n return rawModules;\n}\n\nfunction stripByteOrderMark(source: string): string {\n return source.startsWith(\"\\uFEFF\") ? source.slice(1) : source;\n}\n\nfunction stripHashbang(source: string): string {\n if (!source.startsWith(\"#!\")) {\n return source;\n }\n\n let end = 2;\n while (end < source.length && source[end] !== \"\\n\" && source[end] !== \"\\r\") end += 1;\n return `${\" \".repeat(end)}${source.slice(end)}`;\n}\n\nfunction formatLintErrorMessage(diagnostics: readonly Diagnostic[]): string {\n if (diagnostics.length === 0) {\n return \"Script lint failed.\";\n }\n\n return diagnostics\n .map(\n (diagnostic) =>\n `${diagnostic.filename}:${diagnostic.line}:${diagnostic.column} ${diagnostic.code} ${diagnostic.message}`\n )\n .join(\"\\n\");\n}\n", "import type { ClassDeclaration, Expression, FunctionDeclaration, Module } from \"../parse/parser.js\";\n\nexport function findExportedConstInitializer(module: Module, name: string): Expression | ClassDeclaration | FunctionDeclaration | undefined {\n for (const statement of module.body) {\n if (statement.type === \"ExportDefaultDeclaration\") {\n if (name === \"default\") {\n return statement.declaration;\n }\n\n continue;\n }\n\n if (statement.type !== \"ExportNamedDeclaration\") {\n continue;\n }\n\n const declaration = statement.declaration;\n if (declaration.kind !== \"const\") {\n throw new Error(`Exported '${name}' must be declared with const.`);\n }\n\n if (declaration.declarations.length !== 1) {\n throw new Error(\"Exported const declarations must contain exactly one declarator.\");\n }\n\n const declarator = declaration.declarations[0]!;\n if (declarator.id.type !== \"Identifier\") {\n throw new Error(\"Destructured exported const bindings are not supported.\");\n }\n\n if (declarator.id.name !== name) {\n continue;\n }\n\n if (declarator.init === undefined) {\n throw new Error(`Exported const '${name}' must have an initializer.`);\n }\n\n return declarator.init;\n }\n\n return undefined;\n}\n", "import { webcrypto as crypto } from \"node:crypto\";\n\nimport { createSeededRandom } from \"../interp/globals/math.js\";\n\nexport type TimeModuleOptions = {\n now?: () => number;\n random?: () => number;\n seed?: number;\n signal?: AbortSignal;\n};\n\nexport function makeTimeModule(options: TimeModuleOptions = {}): {\n random: () => number;\n now: () => number;\n sleep: (ms: number) => Promise<void>;\n uuid: () => string;\n} {\n const hasDeterministicRandom = options.random !== undefined || options.seed !== undefined;\n const random =\n options.random ??\n (options.seed === undefined ? () => Math.random() : createSeededRandom(options.seed).next);\n const now = options.now ?? (() => Date.now());\n const signal = options.signal;\n\n async function sleep(ms: number): Promise<void> {\n assertSleepDelay(ms);\n\n return await new Promise<void>((resolve, reject) => {\n if (signal?.aborted === true) {\n reject(createSleepAbortError());\n return;\n }\n\n const start = performance.now();\n let timeout = setTimeout(resolveSleep, ms);\n\n function cleanup(): void {\n clearTimeout(timeout);\n signal?.removeEventListener(\"abort\", rejectSleep);\n }\n\n function resolveSleep(): void {\n const remainingMs = ms - (performance.now() - start);\n if (remainingMs > 0) {\n timeout = setTimeout(resolveSleep, remainingMs);\n return;\n }\n\n cleanup();\n resolve();\n }\n\n function rejectSleep(): void {\n cleanup();\n reject(createSleepAbortError());\n }\n\n signal?.addEventListener(\"abort\", rejectSleep, { once: true });\n });\n }\n\n return {\n random,\n now,\n sleep,\n uuid: hasDeterministicRandom ? () => createRandomUuid(random) : () => crypto.randomUUID()\n };\n}\n\nfunction createRandomUuid(random: () => number): string {\n const bytes = Array.from({ length: 16 }, () => Math.floor(readRandomUnit(random()) * 256));\n bytes[6] = (bytes[6] & 0x0f) | 0x40;\n bytes[8] = (bytes[8] & 0x3f) | 0x80;\n const hex = bytes.map((byte) => byte.toString(16).padStart(2, \"0\")).join(\"\");\n\n return [\n hex.slice(0, 8),\n hex.slice(8, 12),\n hex.slice(12, 16),\n hex.slice(16, 20),\n hex.slice(20)\n ].join(\"-\");\n}\n\nfunction readRandomUnit(value: number): number {\n if (Number.isFinite(value) && value >= 0 && value < 1) {\n return value;\n }\n\n throw new RangeError(\"time.uuid() random source must return a number in [0, 1).\");\n}\n\nfunction assertSleepDelay(ms: number): void {\n if (Number.isFinite(ms) && ms >= 0) {\n return;\n }\n\n throw new RangeError(\"time.sleep(ms) requires a non-negative finite millisecond delay.\");\n}\n\nfunction createSleepAbortError(): Error {\n return new Error(\"time.sleep aborted.\");\n}\n", "export { admitNativePromiseProperties } from \"./interp/native-promise-properties.js\";\nimport { parseModule as parseModuleInternal, parseSourceModule as parseSourceModuleInternal, type Module, type ParsedSourceModule } from \"./parse/parser.js\";\nimport { restore as restoreInternal, type SafeJSSnapshot, type RestoreOptions } from \"./restore.js\";\nimport {\n deepCopyFromSandbox as copyFromSandboxInternal,\n type SandboxPromise,\n type SandboxValue\n} from \"./interp/values.js\";\n\nexport { parse } from \"./parse.js\";\nexport const parseModule: (source: string, filename?: string) => Module = parseModuleInternal;\nexport const parseSourceModule: (source: string, filename?: string) => ParsedSourceModule = parseSourceModuleInternal;\nexport type { ParsedSourceModule, SourceImport, SourceExport } from \"./parse/module-syntax.js\";\nexport const restore: <TSnapshot extends SafeJSSnapshot>(\n snapshot: TSnapshot,\n options: RestoreOptions\n) => TSnapshot = restoreInternal;\ntype PublicCopyOptions = Omit<\n NonNullable<Parameters<typeof copyFromSandboxInternal>[1]>,\n \"compilation\" | \"unwrapHostObject\"\n>;\nexport const deepCopyFromSandbox: {\n (value: SandboxPromise, options?: PublicCopyOptions): Promise<unknown>;\n (value: SandboxValue, options?: PublicCopyOptions): unknown;\n} = copyFromSandboxInternal;\nexport { lint, type Diagnostic, type Fix, type LintFixResult, type LintOptions } from \"./lint.js\";\nexport { run } from \"./run.js\";\nexport type { RunPromise } from \"./run.js\";\nexport type { ExecutionControl } from \"./interp/jobs.js\";\nexport { createRealm, type SafeJSRealm, type RealmOptions, type RealmResult, type RealmLimits } from \"./realm.js\";\nexport { defineExtension, type SafeJSExtension, type ExtensionDefinition, type ExtensionManifest, type ExtensionContext, type ExtensionExports, type CallbackOptions, type CallbackInvocation } from \"./extensions.js\";\nexport type { HostObject, HostObjectDefinition, HostObjectIndexedDefinition, HostObjectNamedDefinition, GuestReference } from \"./interp/host-capabilities.js\";\nexport { createReplayableRandom, type ReplayableRandom } from \"./random.js\";\nexport type { RunClock, RunClockSnapshot, RunRandom } from \"./run.js\";\nexport { noopOtelSink } from \"./observability/otel.js\";\nexport type { OtelSink, OtelSpan } from \"./observability/otel.js\";\nexport { FileSnapshotBackend } from \"./snapshot/backend.js\";\nexport type { Snapshot, SnapshotBackend } from \"./snapshot/backend.js\";\nexport { declareHostOperation } from \"./interp/host-bridge.js\";\nexport { HostCallResumabilityError } from \"./interp/host-call.js\";\nexport type {\n HostCallLifecycle,\n HostCallOutcome,\n HostCallRecord,\n HostCallResumeContext,\n HostCallResumeProof,\n HostCallResumeProvider,\n HostCallResumeRequest\n} from \"./interp/host-call.js\";\nexport {\n HostOperationResumePolicyError,\n registerPendingHostCallPolicy\n} from \"./snapshot/policy.js\";\nexport type {\n PendingHostCallPolicyMode,\n PendingHostCallPolicyRegistration\n} from \"./snapshot/policy.js\";\nexport { dump, type DumpOptions } from \"./dump.js\";\nexport { inspectSnapshotMigration, migrateSnapshot } from \"./migrate.js\";\nexport { migrateSnapshotFile, type SnapshotMigrationFileOptions } from \"./migration-file.js\";\nexport type {\n SnapshotMigration,\n SnapshotMigrationOptions,\n SnapshotMigrationReconciliation,\n SnapshotMigrationResolution\n} from \"./migrate.js\";\nexport { SnapshotValidationError } from \"./snapshot/validation.js\";\nexport type { SnapshotValidationCode } from \"./snapshot/validation.js\";\nexport { Budget, SandboxError } from \"./interp/budget.js\";\nexport type { BudgetName, BudgetOptions } from \"./interp/budget.js\";\nexport { formatInterpreterError, type InterpreterDiagnostic } from \"./error/format.js\";\nexport { deepCopyToSandbox } from \"./interp/values.js\";\nexport { runHarness, runHarnessPair } from \"./runner/run-harness.js\";\nexport { extractBlock } from \"./loader/extract-block.js\";\nexport { findExportedConstInitializer } from \"./loader/find-exported.js\";\nexport { splitFrontmatter } from \"./loader/frontmatter.js\";\nexport type { ExportDefaultDeclaration, ExportNamedDeclaration, MetaProperty } from \"./parse.js\";\nexport {\n AgentSpawnError,\n createSpawnUsageAccumulator,\n makeAgentModule,\n runWithSpawnUsageAccumulator\n} from \"./modules/agent.js\";\nexport type {\n AgentModuleDefinition,\n AgentModuleOptions,\n AgentModuleParallelCall,\n AgentModuleRetryOptions,\n AgentModuleSpawnOptions,\n AgentSpawnEvent,\n SpawnAgent,\n SpawnAgentInput,\n SpawnAgentResult,\n SpawnUsageAccumulator,\n SpawnUsageTotal\n} from \"./modules/agent.js\";\nexport { EnvAccessError, makeEnvModule, parseEnvConfig } from \"./modules/env.js\";\nexport type { EnvModule, EnvModuleOptions } from \"./modules/env.js\";\nexport { makeFailModule } from \"./modules/fail.js\";\nexport { makeFsModule } from \"./modules/fs.js\";\nexport { parseFsConfig, resolveFsConfig } from \"./modules/fs-config.js\";\nexport type { FsConfig, ResolveFsConfigOptions } from \"./modules/fs-config.js\";\nexport type {\n FsImplementation,\n FsModule,\n FsModuleOptions,\n SandboxDirent,\n SandboxStats\n} from \"./modules/fs.js\";\nexport { makeHarnessModule } from \"./modules/harness.js\";\nexport { makeLogModule } from \"./modules/log.js\";\nexport { makeMetricModule } from \"./modules/metric.js\";\nexport { makeMcpModule } from \"./modules/mcp.js\";\nexport { parseMcpConfig } from \"./modules/mcp-transport.js\";\nexport type { McpModuleOptions, McpServerConfig } from \"./modules/mcp-transport.js\";\nexport type { ManagedMcpClient, ManagedMcpModule, McpNamedServerHandle } from \"./modules/mcp.js\";\nexport { makeTimeModule } from \"./modules/time.js\";\n\nexport type {SourceResolver, SourceModule} from \"./modules/source-graph.js\";\nexport {createRootedSourceResolver} from \"./modules/source-files.js\";\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGO,IAAMA,SAA2D;;;ACHxE,SAAS,UAAU,YAAY;AAC/B,SAAS,eAAe;AAuCxB,SAAS,YAAY,QAAiC,KAAsB;AAC1E,SAAO,OAAO,UAAU,eAAe,KAAK,QAAQ,GAAG,IAAI,OAAO,GAAG,IAAI;AAC3E;AAEA,SAAS,kBAAkB,UAAkB,aAAmD;AAC9F,SAAO;AAAA,IACL;AAAA,IACA,MAAM,YAAY,aAAa,MAAM;AAAA,IACrC,SAAS,YAAY,aAAa,SAAS;AAAA,EAC7C;AACF;AAEA,SAAS,4BAA4B,aAA4C;AAC/E,QAAM,SAAS,YAAY,aAAa,QAAQ;AAChD,MAAI,OAAO,WAAW,YAAY,WAAW,QAAQ,MAAM,QAAQ,MAAM,GAAG;AAC1E;AAAA,EACF;AAEA,aAAW,CAAC,MAAM,UAAU,KAAK,OAAO,QAAQ,MAAM,GAAG;AACvD,QAAI,OAAO,eAAe,YAAY,eAAe,QAAQ,MAAM,QAAQ,UAAU,GAAG;AACtF;AAAA,IACF;AAEA,UAAM,SAAS;AACf,UAAM,QAAQ,YAAY,QAAQ,OAAO;AACzC,UAAM,OAAO,YAAY,QAAQ,MAAM;AACvC,QAAI,OAAO,UAAU,YAAY,OAAO,SAAS,UAAU;AACzD;AAAA,IACF;AAGA,QAAI,CAAC,YAAY,SAAS,IAAiB,GAAG;AAC5C;AAAA,IACF;AAEA,QAAI,CAAC,kBAAkB,OAAO,IAAiB,GAAG;AAChD,YAAM,IAAI,MAAM,kBAAkB,IAAI,aAAa,KAAK,4BAA4B,IAAI,IAAI;AAAA,IAC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AACzF,QAAM,CAAC,IAAK,MAAM,CAAC,IAAI,KAAQ;AAC/B,QAAM,CAAC,IAAK,MAAM,CAAC,IAAI,KAAQ;AAC/B,QAAM,MAAM,MAAM,IAAI,CAAC,SAAS,KAAK,SAAS,EAAE,EAAE,SAAS,GAAG,GAAG,CAAC,EAAE,KAAK,EAAE;AAE3E,SAAO;AAAA,IACL,IAAI,MAAM,GAAG,CAAC;AAAA,IACd,IAAI,MAAM,GAAG,EAAE;AAAA,IACf,IAAI,MAAM,IAAI,EAAE;AAAA,IAChB,IAAI,MAAM,IAAI,EAAE;AAAA,IAChB,IAAI,MAAM,EAAE;AAAA,EACd,EAAE,KAAK,GAAG;AACZ;AAEA,SAAS,eAAe,OAAuB;AAC7C,MAAI,OAAO,SAAS,KAAK,KAAK,SAAS,KAAK,QAAQ,GAAG;AACrD,WAAO;AAAA,EACT;AAEA,QAAM,IAAI,WAAW,2DAA2D;AAClF;AAEA,SAAS,iBAAiB,IAAkB;AAC1C,MAAI,OAAO,SAAS,EAAE,KAAK,MAAM,GAAG;AAClC;AAAA,EACF;AAEA,QAAM,IAAI,WAAW,kEAAkE;AACzF;AAEA,SAAS,wBAA+B;AACtC,SAAO,IAAI,MAAM,qBAAqB;AACxC;;;AC5FO,IAAMC,eAA6D;AACnE,IAAMC,qBAA+E;AAErF,IAAMC,WAGI;AAKV,IAAMC,uBAGT;",
4
+ "sourcesContent": ["import { parse as parseInternal, type ParseResult as ParsedNode } from \"./parse/parser.js\";\n\nexport { DisallowedSyntaxError } from \"./parse/parser.js\";\nexport const parse: (source: string, filename?: string) => ParsedNode = parseInternal;\nexport type {\n ArrayPattern,\n ArrayExpression,\n ArrowFunctionExpression,\n AssignmentExpression,\n AssignmentPattern,\n AssignmentProperty,\n AwaitExpression,\n BinaryExpression,\n BigIntLiteral,\n BlockStatement,\n BooleanLiteral,\n BreakStatement,\n CallExpression,\n CatchClause,\n ClassBody,\n ClassDeclaration,\n ClassElement,\n ClassExpression,\n ClassNode,\n ConditionalExpression,\n ContinueStatement,\n DoWhileStatement,\n EmptyStatement,\n Expression,\n ExpressionStatement,\n ExportDefaultDeclaration,\n ExportNamedDeclaration,\n ImportDeclaration,\n ImportExpression,\n ImportDefaultSpecifier,\n ImportNamespaceSpecifier,\n ImportSpecifier,\n ForInStatement,\n ForOfStatement,\n ForStatement,\n FunctionDeclaration,\n FunctionExpression,\n Identifier,\n IfStatement,\n LogicalExpression,\n MemberExpression,\n MetaProperty,\n NewExpression,\n NewTargetExpression,\n NullLiteral,\n NumericLiteral,\n ObjectExpression,\n ObjectPattern,\n ParseResult,\n PatternTarget,\n Property,\n RegexLiteral,\n RestElement,\n ReturnStatement,\n SequenceExpression,\n SourceSpan,\n SpreadElement,\n Statement,\n StringLiteral,\n SuperExpression,\n SwitchCase,\n SwitchStatement,\n TaggedTemplateExpression,\n TemplateElement,\n TemplateLiteral,\n ThisExpression,\n ThrowStatement,\n TryStatement,\n UnaryExpression,\n UndefinedLiteral,\n UpdateExpression,\n UpdateTarget,\n VariableDeclaration,\n VariableDeclarationKind,\n VariableDeclarator,\n WhileStatement,\n WithStatement\n} from \"./parse/parser.js\";\n", "import { readFile, stat } from \"node:fs/promises\";\nimport { extname } from \"node:path\";\n\nimport { supportsSpawnMode } from \"@poe-code/agent-spawn/configs\";\nimport { SPAWN_MODES, type SpawnMode } from \"@poe-code/agent-spawn/types\";\nimport { hasOwnErrorCode } from \"../error-codes.js\";\nimport { countLineBreaks, extractBlock, maskSource } from \"../loader/extract-block.js\";\nimport { splitFrontmatter } from \"../loader/frontmatter.js\";\nimport { lint, type Diagnostic } from \"../lint.js\";\nimport { createLintModulesFromRuntimeRegistry } from \"../lint/runtime-modules.js\";\nimport type { ModuleExports, ModuleRegistry } from \"../modules/registry.js\";\nimport type { OtelSink } from \"../observability/otel.js\";\nimport { parseModule } from \"../parse/parser.js\";\nimport { run, type RunOptions, type RunResult } from \"../run.js\";\nimport type { SnapshotBackend } from \"../snapshot/backend.js\";\n\ntype HarnessMeta = {\n filepath: string;\n kind: unknown;\n version: unknown;\n};\n\nexport type RunHarnessOptions = {\n budget?: RunOptions[\"budget\"];\n modulesFor: (frontmatter: Record<string, unknown>, meta: HarnessMeta) => ModuleRegistry;\n otelSink?: OtelSink;\n signal?: AbortSignal;\n snapshotBackend?: SnapshotBackend;\n snapshotIntervalMs?: number;\n snapshotPath?: string;\n};\n\nexport type RunHarnessExecutionErrorResult = {\n aborted?: true;\n error: unknown;\n ok: false;\n};\n\nexport type RunHarnessResult = RunResult | RunHarnessExecutionErrorResult;\n\nfunction getOwnEntry(record: Record<string, unknown>, key: string): unknown {\n return Object.prototype.hasOwnProperty.call(record, key) ? record[key] : undefined;\n}\n\nfunction createHarnessMeta(filepath: string, frontmatter: Record<string, unknown>): HarnessMeta {\n return {\n filepath,\n kind: getOwnEntry(frontmatter, \"kind\"),\n version: getOwnEntry(frontmatter, \"version\")\n };\n}\n\nfunction assertFrontmatterAgentModes(frontmatter: Record<string, unknown>): void {\n const agents = getOwnEntry(frontmatter, \"agents\");\n if (typeof agents !== \"object\" || agents === null || Array.isArray(agents)) {\n return;\n }\n\n for (const [name, definition] of Object.entries(agents)) {\n if (typeof definition !== \"object\" || definition === null || Array.isArray(definition)) {\n continue;\n }\n\n const record = definition as Record<string, unknown>;\n const agent = getOwnEntry(record, \"agent\");\n const mode = getOwnEntry(record, \"mode\");\n if (typeof agent !== \"string\" || typeof mode !== \"string\") {\n continue;\n }\n\n // Malformed mode strings are reported by the agent module's own validation.\n if (!SPAWN_MODES.includes(mode as SpawnMode)) {\n continue;\n }\n\n if (!supportsSpawnMode(agent, mode as SpawnMode)) {\n throw new Error(`Harness agent \"${name}\": agent \"${agent}\" does not support mode \"${mode}\".`);\n }\n }\n}\n\nexport class LintError extends Error {\n readonly diagnostics: readonly Diagnostic[];\n\n constructor(diagnostics: readonly Diagnostic[]) {\n super(formatLintErrorMessage(diagnostics));\n this.name = \"LintError\";\n this.diagnostics = diagnostics;\n }\n}\n\nexport async function runHarness(\n filepath: string,\n options: RunHarnessOptions\n): Promise<RunHarnessResult> {\n const rawSource = await readHarnessFile(filepath);\n const { executableSource, frontmatter, isRawScript } = loadExecutableSource(filepath, rawSource);\n assertFrontmatterAgentModes(frontmatter);\n const meta = createHarnessMeta(filepath, frontmatter);\n const modules = excludeHarnessModule(options.modulesFor(frontmatter, meta), isRawScript);\n const diagnostics = lint(executableSource, {\n filename: filepath,\n modules: createLintModulesFromRuntimeRegistry(modules)\n });\n const lintErrors = diagnostics.filter((diagnostic) => diagnostic.severity === \"error\");\n\n if (lintErrors.length > 0) {\n throw new LintError(lintErrors);\n }\n\n return runHarnessSource(executableSource, {\n budget: options.budget,\n entryPointArgs: hasDefaultExport(executableSource, filepath) ? [] : undefined,\n filename: filepath,\n modules,\n otelSink: options.otelSink,\n signal: options.signal,\n snapshotBackend: options.snapshotBackend,\n snapshotIntervalMs: options.snapshotIntervalMs,\n snapshotPath: options.snapshotPath\n });\n}\n\nexport async function runHarnessPair(\n filepath: string,\n options: RunHarnessOptions\n): Promise<RunHarnessResult> {\n const pair = resolveHarnessPair(filepath);\n const [rawMarkdown, rawScript] = await Promise.all([\n readHarnessFile(pair.markdownPath),\n readHarnessFile(pair.scriptPath)\n ]);\n const { frontmatter, body } = splitFrontmatter(stripByteOrderMark(rawMarkdown));\n assertFrontmatterAgentModes(frontmatter);\n const executableSource = stripByteOrderMark(rawScript);\n const meta = createHarnessMeta(pair.markdownPath, frontmatter);\n const modules = options.modulesFor(frontmatter, meta);\n const diagnostics = lint(executableSource, {\n allowedExportNames: [\"schema\"],\n defaultExport: {\n parameters: [\"frontmatter\"],\n required: true\n },\n filename: pair.scriptPath,\n frontmatterFields: Object.keys(frontmatter),\n modules: createLintModulesFromRuntimeRegistry(modules)\n });\n const lintErrors = diagnostics.filter((diagnostic) => diagnostic.severity === \"error\");\n\n if (lintErrors.length > 0) {\n throw new LintError(lintErrors);\n }\n\n return runHarnessSource(executableSource, {\n budget: options.budget,\n entryPointArgs: [frontmatter],\n filename: pair.scriptPath,\n importMeta: {\n body,\n filepath: pair.markdownPath,\n kind: meta.kind,\n version: meta.version\n },\n modules,\n otelSink: options.otelSink,\n signal: options.signal,\n snapshotBackend: options.snapshotBackend,\n snapshotIntervalMs: options.snapshotIntervalMs,\n snapshotPath: options.snapshotPath\n });\n}\n\nasync function readHarnessFile(filepath: string): Promise<string> {\n try {\n const stats = await stat(filepath);\n if (!stats.isFile()) {\n throw new Error(`Harness path must point to a file: ${filepath}`);\n }\n\n return await readFile(filepath, \"utf8\");\n } catch (error) {\n if (hasOwnErrorCode(error, \"ENOENT\") || hasOwnErrorCode(error, \"ENOTDIR\")) {\n throw new Error(`Harness file not found: ${filepath}`);\n }\n\n throw error;\n }\n}\n\nfunction loadExecutableSource(\n filepath: string,\n source: string\n): {\n executableSource: string;\n frontmatter: Record<string, unknown>;\n isRawScript: boolean;\n} {\n if (isRawScriptPath(filepath)) {\n const executableSource = stripByteOrderMark(source);\n if (executableSource.length === 0) {\n throw new Error(`No code block found in empty harness file: ${filepath}`);\n }\n\n return {\n executableSource,\n frontmatter: {},\n isRawScript: true\n };\n }\n\n const { frontmatter, body } = splitFrontmatter(source);\n if (source.length === 0 || body.trim().length === 0) {\n throw new Error(`No code block found in empty harness file: ${filepath}`);\n }\n\n const bodyStartOffset = source.length - body.length;\n const { source: executableBlock, startOffset } = extractBlock(\n body,\n countLineBreaks(source, 0, bodyStartOffset) + 1\n );\n return {\n executableSource:\n maskSource(source.slice(0, bodyStartOffset + startOffset)) + stripHashbang(executableBlock),\n frontmatter,\n isRawScript: false\n };\n}\n\nfunction resolveHarnessPair(filepath: string): { markdownPath: string; scriptPath: string } {\n const extension = extname(filepath);\n const basename = extension.length === 0 ? filepath : filepath.slice(0, -extension.length);\n\n if (isRawScriptExtension(extension)) {\n return {\n markdownPath: `${basename}.md`,\n scriptPath: filepath\n };\n }\n\n return {\n markdownPath: filepath,\n scriptPath: `${basename}.ajs`\n };\n}\n\nfunction isRawScriptPath(filepath: string): boolean {\n return isRawScriptExtension(extname(filepath));\n}\n\nfunction isRawScriptExtension(extension: string): boolean {\n return extension === \".safejs\" || extension === \".ajs\";\n}\n\nasync function runHarnessSource(\n executableSource: string,\n options: Parameters<typeof run>[1]\n): Promise<RunHarnessResult> {\n try {\n return await run(executableSource, options);\n } catch (error) {\n if (isSetupError(error)) {\n throw error;\n }\n\n return {\n ...(isAbortError(error) ? { aborted: true as const } : {}),\n error,\n ok: false\n };\n }\n}\n\nfunction isSetupError(error: unknown): boolean {\n return error instanceof Error && error.name === \"ParseError\";\n}\n\nfunction isAbortError(error: unknown): boolean {\n if (error instanceof Error) {\n return error.name === \"AbortError\";\n }\n\n return (\n typeof error === \"object\" &&\n error !== null &&\n Object.prototype.hasOwnProperty.call(error, \"name\") &&\n (error as { name?: unknown }).name === \"AbortError\"\n );\n}\n\nfunction hasDefaultExport(source: string, filename: string): boolean {\n return parseModule(source, filename).body.some(\n (statement) => statement.type === \"ExportDefaultDeclaration\"\n );\n}\n\nfunction excludeHarnessModule(modules: ModuleRegistry, isRawScript: boolean): ModuleRegistry {\n if (!isRawScript) {\n return modules;\n }\n\n if (modules instanceof Map) {\n const rawModules = new Map(modules);\n rawModules.delete(\"harness\");\n return rawModules;\n }\n\n const rawModules: Record<string, ModuleExports> = {};\n\n for (const [moduleName, moduleExports] of Object.entries(modules)) {\n if (moduleName !== \"harness\") {\n rawModules[moduleName] = moduleExports;\n }\n }\n\n return rawModules;\n}\n\nfunction stripByteOrderMark(source: string): string {\n return source.startsWith(\"\\uFEFF\") ? source.slice(1) : source;\n}\n\nfunction stripHashbang(source: string): string {\n if (!source.startsWith(\"#!\")) {\n return source;\n }\n\n let end = 2;\n while (end < source.length && source[end] !== \"\\n\" && source[end] !== \"\\r\") end += 1;\n return `${\" \".repeat(end)}${source.slice(end)}`;\n}\n\nfunction formatLintErrorMessage(diagnostics: readonly Diagnostic[]): string {\n if (diagnostics.length === 0) {\n return \"Script lint failed.\";\n }\n\n return diagnostics\n .map(\n (diagnostic) =>\n `${diagnostic.filename}:${diagnostic.line}:${diagnostic.column} ${diagnostic.code} ${diagnostic.message}`\n )\n .join(\"\\n\");\n}\n", "import type { ClassDeclaration, Expression, FunctionDeclaration, Module } from \"../parse/parser.js\";\n\nexport function findExportedConstInitializer(module: Module, name: string): Expression | ClassDeclaration | FunctionDeclaration | undefined {\n for (const statement of module.body) {\n if (statement.type === \"ExportDefaultDeclaration\") {\n if (name === \"default\") {\n return statement.declaration;\n }\n\n continue;\n }\n\n if (statement.type !== \"ExportNamedDeclaration\") {\n continue;\n }\n\n const declaration = statement.declaration;\n if (declaration.kind !== \"const\") {\n throw new Error(`Exported '${name}' must be declared with const.`);\n }\n\n if (declaration.declarations.length !== 1) {\n throw new Error(\"Exported const declarations must contain exactly one declarator.\");\n }\n\n const declarator = declaration.declarations[0]!;\n if (declarator.id.type !== \"Identifier\") {\n throw new Error(\"Destructured exported const bindings are not supported.\");\n }\n\n if (declarator.id.name !== name) {\n continue;\n }\n\n if (declarator.init === undefined) {\n throw new Error(`Exported const '${name}' must have an initializer.`);\n }\n\n return declarator.init;\n }\n\n return undefined;\n}\n", "import { createSeededRandom } from \"../interp/globals/math.js\";\n\nexport type TimeModuleOptions = {\n now?: () => number;\n random?: () => number;\n seed?: number;\n signal?: AbortSignal;\n};\n\nexport function makeTimeModule(options: TimeModuleOptions = {}): {\n random: () => number;\n now: () => number;\n sleep: (ms: number) => Promise<void>;\n uuid: () => string;\n} {\n const hasDeterministicRandom = options.random !== undefined || options.seed !== undefined;\n const random =\n options.random ??\n (options.seed === undefined ? () => Math.random() : createSeededRandom(options.seed).next);\n const now = options.now ?? (() => Date.now());\n const signal = options.signal;\n\n async function sleep(ms: number): Promise<void> {\n assertSleepDelay(ms);\n\n return await new Promise<void>((resolve, reject) => {\n if (signal?.aborted === true) {\n reject(createSleepAbortError());\n return;\n }\n\n const start = performance.now();\n let timeout = setTimeout(resolveSleep, ms);\n\n function cleanup(): void {\n clearTimeout(timeout);\n signal?.removeEventListener(\"abort\", rejectSleep);\n }\n\n function resolveSleep(): void {\n const remainingMs = ms - (performance.now() - start);\n if (remainingMs > 0) {\n timeout = setTimeout(resolveSleep, remainingMs);\n return;\n }\n\n cleanup();\n resolve();\n }\n\n function rejectSleep(): void {\n cleanup();\n reject(createSleepAbortError());\n }\n\n signal?.addEventListener(\"abort\", rejectSleep, { once: true });\n });\n }\n\n return {\n random,\n now,\n sleep,\n uuid: hasDeterministicRandom ? () => createRandomUuid(random) : () => globalThis.crypto.randomUUID()\n };\n}\n\nfunction createRandomUuid(random: () => number): string {\n const bytes = Array.from({ length: 16 }, () => Math.floor(readRandomUnit(random()) * 256));\n bytes[6] = (bytes[6] & 0x0f) | 0x40;\n bytes[8] = (bytes[8] & 0x3f) | 0x80;\n const hex = bytes.map((byte) => byte.toString(16).padStart(2, \"0\")).join(\"\");\n\n return [\n hex.slice(0, 8),\n hex.slice(8, 12),\n hex.slice(12, 16),\n hex.slice(16, 20),\n hex.slice(20)\n ].join(\"-\");\n}\n\nfunction readRandomUnit(value: number): number {\n if (Number.isFinite(value) && value >= 0 && value < 1) {\n return value;\n }\n\n throw new RangeError(\"time.uuid() random source must return a number in [0, 1).\");\n}\n\nfunction assertSleepDelay(ms: number): void {\n if (Number.isFinite(ms) && ms >= 0) {\n return;\n }\n\n throw new RangeError(\"time.sleep(ms) requires a non-negative finite millisecond delay.\");\n}\n\nfunction createSleepAbortError(): Error {\n return new Error(\"time.sleep aborted.\");\n}\n", "export { admitNativePromiseProperties } from \"./interp/native-promise-properties.js\";\nimport { parseModule as parseModuleInternal, parseSourceModule as parseSourceModuleInternal, type Module, type ParsedSourceModule } from \"./parse/parser.js\";\nimport { restore as restoreInternal, type SafeJSSnapshot, type RestoreOptions } from \"./restore.js\";\nimport {\n deepCopyFromSandbox as copyFromSandboxInternal,\n type SandboxPromise,\n type SandboxValue\n} from \"./interp/values.js\";\n\nexport { parse } from \"./parse.js\";\nexport const parseModule: (source: string, filename?: string) => Module = parseModuleInternal;\nexport const parseSourceModule: (source: string, filename?: string) => ParsedSourceModule = parseSourceModuleInternal;\nexport type { ParsedSourceModule, SourceImport, SourceExport } from \"./parse/module-syntax.js\";\nexport const restore: <TSnapshot extends SafeJSSnapshot>(\n snapshot: TSnapshot,\n options: RestoreOptions\n) => TSnapshot = restoreInternal;\ntype PublicCopyOptions = Omit<\n NonNullable<Parameters<typeof copyFromSandboxInternal>[1]>,\n \"compilation\" | \"unwrapHostObject\"\n>;\nexport const deepCopyFromSandbox: {\n (value: SandboxPromise, options?: PublicCopyOptions): Promise<unknown>;\n (value: SandboxValue, options?: PublicCopyOptions): unknown;\n} = copyFromSandboxInternal;\nexport { lint, type Diagnostic, type Fix, type LintFixResult, type LintOptions } from \"./lint.js\";\nexport { run } from \"./run.js\";\nexport type { RunPromise } from \"./run.js\";\nexport type { ExecutionControl } from \"./interp/jobs.js\";\nexport { createRealm, type SafeJSRealm, type RealmOptions, type RealmResult, type RealmLimits } from \"./realm.js\";\nexport { defineExtension, type SafeJSExtension, type ExtensionDefinition, type ExtensionManifest, type ExtensionContext, type ExtensionExports, type CallbackOptions, type CallbackInvocation } from \"./extensions.js\";\nexport type { HostObject, HostObjectDefinition, HostObjectIndexedDefinition, HostObjectNamedDefinition, GuestReference } from \"./interp/host-capabilities.js\";\nexport { createReplayableRandom, type ReplayableRandom } from \"./random.js\";\nexport type { RunClock, RunClockSnapshot, RunRandom } from \"./run.js\";\nexport { noopOtelSink } from \"./observability/otel.js\";\nexport type { OtelSink, OtelSpan } from \"./observability/otel.js\";\nexport { FileSnapshotBackend } from \"./snapshot/backend.js\";\nexport type { Snapshot, SnapshotBackend } from \"./snapshot/backend.js\";\nexport { declareHostOperation } from \"./interp/host-bridge.js\";\nexport { HostCallResumabilityError } from \"./interp/host-call.js\";\nexport type {\n HostCallLifecycle,\n HostCallOutcome,\n HostCallRecord,\n HostCallResumeContext,\n HostCallResumeProof,\n HostCallResumeProvider,\n HostCallResumeRequest\n} from \"./interp/host-call.js\";\nexport {\n HostOperationResumePolicyError,\n registerPendingHostCallPolicy\n} from \"./snapshot/policy.js\";\nexport type {\n PendingHostCallPolicyMode,\n PendingHostCallPolicyRegistration\n} from \"./snapshot/policy.js\";\nexport { dump, type DumpOptions } from \"./dump.js\";\nexport { inspectSnapshotMigration, migrateSnapshot } from \"./migrate.js\";\nexport { migrateSnapshotFile, type SnapshotMigrationFileOptions } from \"./migration-file.js\";\nexport type {\n SnapshotMigration,\n SnapshotMigrationOptions,\n SnapshotMigrationReconciliation,\n SnapshotMigrationResolution\n} from \"./migrate.js\";\nexport { SnapshotValidationError } from \"./snapshot/validation.js\";\nexport type { SnapshotValidationCode } from \"./snapshot/validation.js\";\nexport { Budget, SandboxError } from \"./interp/budget.js\";\nexport type { BudgetName, BudgetOptions } from \"./interp/budget.js\";\nexport { formatInterpreterError, type InterpreterDiagnostic } from \"./error/format.js\";\nexport { deepCopyToSandbox } from \"./interp/values.js\";\nexport { runHarness, runHarnessPair } from \"./runner/run-harness.js\";\nexport { extractBlock } from \"./loader/extract-block.js\";\nexport { findExportedConstInitializer } from \"./loader/find-exported.js\";\nexport { splitFrontmatter } from \"./loader/frontmatter.js\";\nexport type { ExportDefaultDeclaration, ExportNamedDeclaration, MetaProperty } from \"./parse.js\";\nexport {\n AgentSpawnError,\n createSpawnUsageAccumulator,\n makeAgentModule,\n runWithSpawnUsageAccumulator\n} from \"./modules/agent.js\";\nexport type {\n AgentModuleDefinition,\n AgentModuleOptions,\n AgentModuleParallelCall,\n AgentModuleRetryOptions,\n AgentModuleSpawnOptions,\n AgentSpawnEvent,\n SpawnAgent,\n SpawnAgentInput,\n SpawnAgentResult,\n SpawnUsageAccumulator,\n SpawnUsageTotal\n} from \"./modules/agent.js\";\nexport { EnvAccessError, makeEnvModule, parseEnvConfig } from \"./modules/env.js\";\nexport type { EnvModule, EnvModuleOptions } from \"./modules/env.js\";\nexport { makeFailModule } from \"./modules/fail.js\";\nexport { makeFsModule } from \"./modules/fs.js\";\nexport { parseFsConfig, resolveFsConfig } from \"./modules/fs-config.js\";\nexport type { FsConfig, ResolveFsConfigOptions } from \"./modules/fs-config.js\";\nexport type {\n FsImplementation,\n FsModule,\n FsModuleOptions,\n SandboxDirent,\n SandboxStats\n} from \"./modules/fs.js\";\nexport { makeHarnessModule } from \"./modules/harness.js\";\nexport { makeLogModule } from \"./modules/log.js\";\nexport { makeMetricModule } from \"./modules/metric.js\";\nexport { makeMcpModule } from \"./modules/mcp.js\";\nexport { parseMcpConfig } from \"./modules/mcp-transport.js\";\nexport type { McpModuleOptions, McpServerConfig } from \"./modules/mcp-transport.js\";\nexport type { ManagedMcpClient, ManagedMcpModule, McpNamedServerHandle } from \"./modules/mcp.js\";\nexport { makeTimeModule } from \"./modules/time.js\";\n\nexport type {SourceResolver, SourceModule} from \"./modules/source-graph.js\";\nexport {createRootedSourceResolver} from \"./modules/source-files.js\";\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGO,IAAMA,SAA2D;;;ACHxE,SAAS,UAAU,YAAY;AAC/B,SAAS,eAAe;AAuCxB,SAAS,YAAY,QAAiC,KAAsB;AAC1E,SAAO,OAAO,UAAU,eAAe,KAAK,QAAQ,GAAG,IAAI,OAAO,GAAG,IAAI;AAC3E;AAEA,SAAS,kBAAkB,UAAkB,aAAmD;AAC9F,SAAO;AAAA,IACL;AAAA,IACA,MAAM,YAAY,aAAa,MAAM;AAAA,IACrC,SAAS,YAAY,aAAa,SAAS;AAAA,EAC7C;AACF;AAEA,SAAS,4BAA4B,aAA4C;AAC/E,QAAM,SAAS,YAAY,aAAa,QAAQ;AAChD,MAAI,OAAO,WAAW,YAAY,WAAW,QAAQ,MAAM,QAAQ,MAAM,GAAG;AAC1E;AAAA,EACF;AAEA,aAAW,CAAC,MAAM,UAAU,KAAK,OAAO,QAAQ,MAAM,GAAG;AACvD,QAAI,O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AKV,IAAMC,uBAGT;",
6
6
  "names": ["parse", "rawModules", "parseModule", "parseSourceModule", "restore", "deepCopyFromSandbox"]
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@poe-platform/safe-js",
3
- "version": "0.1.728",
3
+ "version": "0.1.729",
4
4
  "description": "Budgeted JavaScript interpreter with explicit host capabilities and resumable execution",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -58,8 +58,9 @@
58
58
  "access": "public"
59
59
  },
60
60
  "dependencies": {
61
- "@poe-platform/safe-fs": "0.1.728",
61
+ "@poe-platform/safe-fs": "0.1.729",
62
62
  "@petamoriken/float16": "^3.9.3",
63
+ "@noble/hashes": "2.4.0",
63
64
  "@formatjs/intl-localematcher": "0.8.13",
64
65
  "@formatjs/bigdecimal": "0.2.7",
65
66
  "temporal-polyfill": "1.0.4",
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/migration-file.ts", "../../src/migrate.ts"],
4
- "sourcesContent": ["import { randomUUID } from \"node:crypto\";\nimport { link, open, readFile, unlink } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { hasOwnErrorCode } from \"./error-codes.js\";\n\nimport {\n inspectSnapshotMigration,\n migrateSnapshot,\n type SnapshotMigrationOptions\n} from \"./migrate.js\";\nimport type { SafeJSSnapshot } from \"./restore.js\";\nimport { serializeSafeJSSnapshot } from \"./snapshot/dump-format.js\";\n\nexport type SnapshotMigrationFileOptions = {\n snapshotPath: string;\n sourcePath: string;\n targetSourcePath?: string;\n planPath?: string;\n outputPath?: string;\n inspect?: boolean;\n dryRun?: boolean;\n cwd?: string;\n};\n\nexport async function migrateSnapshotFile(options: SnapshotMigrationFileOptions) {\n const cwd = options.cwd ?? process.cwd();\n const resolvePath = (value: string | undefined, label: string) => {\n if (typeof value !== \"string\" || value.trim().length === 0)\n throw new TypeError(`Migration requires ${label}.`);\n return path.resolve(cwd, value);\n };\n const snapshotPath = resolvePath(options.snapshotPath, \"a snapshot path\");\n const sourcePath = resolvePath(options.sourcePath, \"--from <original.ajs>\");\n if (\n options.inspect &&\n [options.targetSourcePath, options.planPath, options.outputPath].some(\n (value) => value !== undefined\n )\n )\n throw new TypeError(\"Migration --inspect cannot be combined with --to, --plan, or --output.\");\n const outputPath = options.inspect\n ? undefined\n : resolvePath(options.outputPath, \"--output <new-checkpoint.json>\");\n const targetSourcePath = options.inspect\n ? undefined\n : resolvePath(options.targetSourcePath, \"--to <continuation.ajs>\");\n const planPath = options.inspect\n ? undefined\n : resolvePath(options.planPath, \"--plan <migration.json>\");\n for (const filepath of [sourcePath, targetSourcePath]) {\n if (filepath !== undefined && ![\".ajs\", \".safejs\"].includes(path.extname(filepath)))\n throw new TypeError(\n \"Migration source paths must name executable .ajs or .safejs files, not harness Markdown.\"\n );\n }\n const snapshot: SafeJSSnapshot = JSON.parse(await readFile(snapshotPath, \"utf8\"));\n const source = await readFile(sourcePath, \"utf8\");\n const inspection = inspectSnapshotMigration(snapshot, { source });\n if (options.inspect) return { inspection };\n const plan: unknown = JSON.parse(await readFile(planPath!, \"utf8\"));\n if (\n plan === null ||\n typeof plan !== \"object\" ||\n !Object.hasOwn(plan, \"state\") ||\n !Object.hasOwn(plan, \"reconciliation\")\n )\n throw new TypeError(\"Migration plan requires explicit state and reconciliation fields.\");\n const targetSource = await readFile(targetSourcePath!, \"utf8\");\n const migrated = migrateSnapshot(snapshot, {\n source,\n targetSource,\n state: (plan as SnapshotMigrationOptions).state,\n reconciliation: (plan as SnapshotMigrationOptions).reconciliation\n });\n const contents = serializeSafeJSSnapshot(migrated);\n if (!options.dryRun) {\n const temporaryPath = path.join(\n path.dirname(outputPath!),\n `.safejs-migration-${randomUUID()}.tmp`\n );\n let created = false;\n try {\n const handle = await open(temporaryPath, \"wx\", 0o600);\n created = true;\n try {\n await handle.writeFile(contents, \"utf8\");\n await handle.sync();\n } finally {\n await handle.close();\n }\n try {\n await link(temporaryPath, outputPath!);\n } catch (error) {\n if (hasOwnErrorCode(error, \"EEXIST\"))\n throw Object.assign(\n new Error(\n `Migration output already exists: ${JSON.stringify(outputPath)}. Choose a new output path; existing files are never overwritten.`,\n { cause: error }\n ),\n { code: \"EEXIST\" }\n );\n throw error;\n }\n } finally {\n if (created) await unlink(temporaryPath);\n }\n }\n return { inspection, outputPath, dryRun: options.dryRun === true };\n}\n", "import { createHash } from \"node:crypto\";\n\nimport { assertSnapshotInactive } from \"./interp/running-state.js\";\nimport { deepCopyToSandbox } from \"./interp/values.js\";\nimport { hashSource } from \"./parse/hash.js\";\nimport { parseModule } from \"./parse/parser.js\";\nimport type { SafeJSSnapshot } from \"./restore.js\";\nimport { DUMP_FORMAT_VERSION, EXECUTION_SEMANTICS } from \"./snapshot/dump-format.js\";\nimport {\n validateMigrationJournal,\n validateMigrationReconciliation,\n validateMigrationSemantics,\n validateSnapshotMigration,\n type SnapshotMigration,\n type SnapshotMigrationReconciliation\n} from \"./snapshot/migration.js\";\nimport { encodeReplayData } from \"./snapshot/replay-data.js\";\nimport { validateDumpEnvelope, validateSnapshotData } from \"./snapshot/validation.js\";\n\nexport type {\n SnapshotMigration,\n SnapshotMigrationReconciliation,\n SnapshotMigrationResolution\n} from \"./snapshot/migration.js\";\n\nexport type SnapshotMigrationOptions = {\n source: string;\n targetSource: string;\n state: unknown;\n reconciliation: SnapshotMigrationReconciliation;\n};\n\nexport function inspectSnapshotMigration(snapshot: SafeJSSnapshot, options: { source: string }) {\n assertSnapshotInactive(snapshot);\n validateSnapshotData(snapshot);\n validateDumpEnvelope(snapshot);\n validateMigrationSemantics(snapshot.executionSemantics);\n const sourceHash = hashSource(\n options.source,\n undefined,\n snapshot.executionSemantics === \"jobs-v8\" || snapshot.executionSemantics === EXECUTION_SEMANTICS\n );\n if (snapshot.sourceHash !== sourceHash)\n throw new TypeError(\n `Migration requires the original executable source (checkpoint hash ${snapshot.sourceHash}, supplied ${sourceHash}). Preserve the checkpoint; do not replace its hash.`\n );\n validateSnapshotMigration(snapshot.migration, sourceHash);\n const replay = validateMigrationJournal(sourceHash, snapshot.replay, snapshot.hostCalls);\n return {\n checkpointDigest: createHash(\"sha256\").update(canonicalData(snapshot)).digest(\"hex\"),\n sourceHash,\n executionSemantics: snapshot.executionSemantics,\n calls: replay.calls,\n unresolvedCalls: replay.calls.filter(\n (call) => ![\"settled\", \"consumed\"].includes(call.lifecycle)\n )\n };\n}\n\nexport function migrateSnapshot(\n snapshot: SafeJSSnapshot,\n options: SnapshotMigrationOptions\n): SafeJSSnapshot & { migration: SnapshotMigration } {\n if (!Object.hasOwn(options, \"state\"))\n throw new TypeError(\"Migration requires explicit application state.\");\n const inspection = inspectSnapshotMigration(snapshot, { source: options.source });\n parseModule(options.targetSource);\n const targetSourceHash = hashSource(options.targetSource);\n validateMigrationReconciliation(\n options.reconciliation,\n inspection.checkpointDigest,\n inspection.calls\n );\n const state = encodeReplayData(deepCopyToSandbox(options.state));\n const previous = snapshot.migration as SnapshotMigration | undefined;\n const migration: SnapshotMigration = {\n version: 1,\n state,\n history: [\n ...structuredClone(previous?.history ?? []),\n {\n sourceHash: inspection.sourceHash,\n targetSourceHash,\n executionSemantics: inspection.executionSemantics,\n replay: { version: 1, calls: inspection.calls },\n reconciliation: structuredClone(options.reconciliation)\n }\n ]\n };\n validateSnapshotMigration(migration, targetSourceHash);\n return {\n version: DUMP_FORMAT_VERSION,\n executionSemantics: EXECUTION_SEMANTICS,\n sourceHash: targetSourceHash,\n bindings: {},\n replay: { version: 1, calls: [] },\n migration\n };\n}\n\nfunction canonicalData(value: unknown): string {\n if (Array.isArray(value)) return `[${value.map(canonicalData).join(\",\")}]`;\n if (value !== null && typeof value === \"object\")\n return `{${Object.keys(value)\n .sort()\n .map(\n (key) => `${JSON.stringify(key)}:${canonicalData((value as Record<string, unknown>)[key])}`\n )\n .join(\",\")}}`;\n return JSON.stringify(value);\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,kBAAkB;AAC3B,SAAS,M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