@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
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/modules/paths.ts"],
4
- "sourcesContent": ["import { basename, dirname, extname, isAbsolutePath, joinPath, relativePath, resolvePath } from \"@poe-code/safe-fs/core\";\nimport { hostCwd } from \"#safe-js-platform\";\nexport { basename, dirname, extname, isAbsolutePath as isAbsolute, joinPath as join };\nexport const sep = \"/\";\nexport function resolve(...paths: string[]): string { return resolvePath(hostCwd(), ...paths); }\nexport function relative(from: string, to: string): string { return relativePath(resolve(from), resolve(to)); }\nexport default { basename, dirname, extname, isAbsolute: isAbsolutePath, join: joinPath, relative, resolve, sep };\n\nexport function pathToFileURL(path: string): URL {\n return new URL(\"file://\" + resolve(path).split(\"/\").map(segment => encodeURIComponent(segment)).join(\"/\"));\n}\n"],
5
- "mappings": ";;;;;AAAA,SAAS,UAAU,SAAS,SAAS,gBAAgB,UAAU,cAAc,mBAAmB;AAGzF,IAAM,MAAM;AACZ,SAAS,WAAW,OAAyB;AAAE,SAAO,YAAY,QAAQ,GAAG,GAAG,KAAK;AAAG;AACxF,SAAS,SAAS,MAAc,IAAoB;AAAE,SAAO,aAAa,QAAQ,IAAI,GAAG,QAAQ,EAAE,CAAC;AAAG;AAC9G,IAAO,gBAAQ,EAAE,UAAU,SAAS,SAAS,YAAY,gBAAgB,MAAM,UAAU,UAAU,SAAS,IAAI;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/cli-runtime.ts"],
4
- "sourcesContent": ["import {createFsBridge, type FileSystem} from \"@poe-code/safe-fs/core\";\nimport {fsCodec} from \"./modules/fs-codec.js\";\nimport {createRootedSourceResolver} from \"./modules/source-files.js\";\nimport {parseSourceModule} from \"./parse/source-module.js\";\nimport { hostFs } from \"#safe-js-platform\";\nimport path, { dirname, extname } from \"./modules/paths.js\";\nimport { formatWithOptions } from \"#safe-js-platform\";\n\nimport { hasOwnErrorCode } from \"./error-codes.js\";\nimport { formatInterpreterError } from \"./error/format.js\";\nimport { replaceErrorStack } from \"./error/shape.js\";\nimport { Budget, SandboxError } from \"./interp/budget.js\";\nimport { countLineBreaks, extractBlock, maskSource } from \"./loader/extract-block.js\";\nimport { splitFrontmatter } from \"./loader/frontmatter.js\";\nimport { lint, type Diagnostic, type Fix } from \"./lint.js\";\nimport { makeAgentModule } from \"./modules/agent.js\";\nimport { makeEnvModule, parseEnvConfig, type EnvModuleOptions } from \"./modules/env.js\";\nimport { makeFailModule } from \"./modules/fail.js\";\nimport type { FsModuleOptions } from \"./modules/fs.js\";\nimport { parseFsConfig, resolveFsConfig } from \"./modules/fs-config.js\";\nimport { parseMcpConfig, type McpModuleOptions } from \"./modules/mcp-transport.js\";\nimport { makeLogModule, type LogModuleEntry } from \"./modules/log.js\";\nimport { makeMetricModule } from \"./modules/metric.js\";\nimport {\n createBrokenPipeState,\n createSafeOutputStream,\n withBrokenPipeGuard,\n type BrokenPipeState,\n type OutputStream\n} from \"./output-stream.js\";\nimport type { ModuleExports, ModuleRegistry } from \"./modules/registry.js\";\nimport { parseModule } from \"./parse/parser.js\";\nimport type { SafeJSSnapshot } from \"./restore.js\";\nimport type { RunResult } from \"./run.js\";\nimport type { SnapshotMigrationFileOptions } from \"./migration-file.js\";\n\ntype CliStream = OutputStream;\n\ntype CliProcess = Pick<NodeJS.Process, \"off\" | \"on\">;\n\ntype FileStats = {\n isFile(): boolean;\n};\n\nexport type ReadMarkdownFile = (filepath: string, encoding: \"utf8\") => Promise<string>;\nexport type WriteMarkdownFile = (\n filepath: string,\n source: string,\n options: { encoding: \"utf8\" }\n) => Promise<void>;\n\nexport type RunCliOptions = {\n adapter?: FileSystem;\n cwd?: string;\n env?: EnvModuleOptions;\n mcp?: McpModuleOptions;\n modulesFor?: (\n frontmatter: Record<string, unknown>,\n meta: HarnessMeta,\n streams: { stderr: CliStream; stdout: CliStream }\n ) => ModuleRegistry;\n process?: CliProcess;\n readFile?: ReadMarkdownFile;\n stat?: (filepath: string) => Promise<FileStats>;\n stdout?: CliStream;\n stderr?: CliStream;\n writeFile?: WriteMarkdownFile;\n};\n\ntype HarnessMeta = {\n filepath: string;\n kind: unknown;\n version: unknown;\n};\n\ntype ParsedArgs = {\n sourceType?: \"module\";\n sourceRoot?: string;\n filepath?: string;\n fix: boolean;\n fs: boolean;\n fsRoot?: string;\n fsConfig?: string;\n envConfig?: string;\n mcpConfig?: string;\n dataSize?: number;\n maxSteps?: number;\n restorePath?: string;\n snapshotPath?: string;\n};\n\ntype LoadedSource = {\n sourceOffset: number;\n fixRanges?: readonly Fix[\"range\"][];\n executableSource: string;\n frontmatter: Record<string, unknown>;\n isRawScript: boolean;\n rawSource: string;\n};\n\ntype CliRuntime = {\n registry: ModuleRegistry;\n};\n\nconst EXIT_RUNTIME = 1;\nconst EXIT_PARSE = 2;\nconst EXIT_BUDGET = 3;\nconst EXIT_SIGINT = 130;\n\nexport async function runCli(\n argv: readonly string[],\n options: RunCliOptions,\n usage: string\n): Promise<number> {\n const io = options.adapter ? createFsBridge(options.adapter, {codec: fsCodec}) : hostFs;\n const readFile = io.readFile.bind(io);\n const writeFile = io.writeFile.bind(io);\n const stat = io.stat.bind(io);\n const brokenPipe = createBrokenPipeState();\n const stdout = createSafeOutputStream(options.stdout ?? process.stdout, brokenPipe);\n const stderr = createSafeOutputStream(options.stderr ?? process.stderr, brokenPipe);\n\n return withBrokenPipeGuard(\n [options.stdout ?? process.stdout, options.stderr ?? process.stderr],\n brokenPipe,\n async () => {\n try {\n if (argv[0] === \"migrate\") {\n const { migrateSnapshotFile } = await import(\"./migration-file.js\");\n const result = await migrateSnapshotFile({\n ...parseMigrationArgs(argv.slice(1)),\n cwd: options.cwd ?? readCurrentWorkingDirectory(),\n adapter: options.adapter\n });\n stdout.write(`${JSON.stringify(result, null, 2)}\\n`);\n return 0;\n }\n const parsed = parseArgs(argv);\n if (parsed.filepath === undefined) {\n stderr.write(`${usage}\\n`);\n return brokenPipe.closed ? 0 : EXIT_RUNTIME;\n }\n\n const cwd = options.cwd ?? readCurrentWorkingDirectory();\n const filepath = path.resolve(cwd, parsed.filepath);\n const configuredFs =\n parsed.fsConfig === undefined\n ? undefined\n : await resolveFsConfig(\n parseFsConfig(\n await (options.readFile ?? readFile)(path.resolve(cwd, parsed.fsConfig), \"utf8\")\n )\n );\n await assertHarnessFile({\n displayPath: parsed.filepath,\n filepath,\n statFile: options.stat ?? stat\n });\n\n return await runScriptFile(filepath, parsed, {\n cwd,\n configuredFs,\n adapter: options.adapter,\n env: options.env,\n mcp: options.mcp,\n modulesFor: options.modulesFor,\n process: options.process ?? process,\n readFile: options.readFile ?? readFile,\n brokenPipe,\n stderr,\n stdout,\n writeFile: options.writeFile ?? writeFile\n });\n } catch (error) {\n if (brokenPipe.closed) {\n return 0;\n }\n stderr.write(`${isParseError(error) ? formatInterpreterError(error) : readErrorMessage(error)}\\n`);\n return brokenPipe.closed\n ? 0\n : error instanceof CliExitError\n ? error.exitCode\n : exitCodeForError(error);\n }\n }\n );\n}\n\nfunction readCurrentWorkingDirectory(): string {\n try {\n return process.cwd();\n } catch (error) {\n throw new Error(`Unable to resolve current working directory: ${readErrorMessage(error)}`);\n }\n}\n\nfunction parseMigrationArgs(argv: readonly string[]): SnapshotMigrationFileOptions {\n const result: SnapshotMigrationFileOptions = { snapshotPath: \"\", sourcePath: \"\" };\n const paths = new Map<string, \"sourcePath\" | \"targetSourcePath\" | \"planPath\" | \"outputPath\">([\n [\"--from\", \"sourcePath\"],\n [\"--to\", \"targetSourcePath\"],\n [\"--plan\", \"planPath\"],\n [\"--output\", \"outputPath\"]\n ]);\n const seen = new Set<string>();\n for (let index = 0; index < argv.length; index += 1) {\n const argument = argv[index]!;\n if (!argument.startsWith(\"-\")) {\n if (result.snapshotPath.length > 0)\n throw new TypeError(\"Migration accepts exactly one snapshot path.\");\n result.snapshotPath = argument;\n continue;\n }\n if (seen.has(argument)) throw new TypeError(`Duplicate migration option: ${argument}`);\n seen.add(argument);\n if (argument === \"--inspect\") {\n result.inspect = true;\n continue;\n }\n if (argument === \"--dry-run\") {\n result.dryRun = true;\n continue;\n }\n const key = paths.get(argument);\n if (key === undefined) throw new TypeError(`Unknown migration option: ${argument}`);\n const value = argv[++index];\n if (value === undefined || value.startsWith(\"--\"))\n throw new TypeError(`${argument} requires a path.`);\n result[key] = value;\n }\n return result;\n}\n\nfunction parseArgs(argv: readonly string[]): ParsedArgs {\n const parsed: ParsedArgs = {\n fix: false,\n fs: false\n };\n\n for (let index = 0; index < argv.length; index += 1) {\n const arg = argv[index];\n\n if (arg === \"--fix\") {\n parsed.fix = true;\n continue;\n }\n\n if (arg === \"--fs\") {\n parsed.fs = true;\n continue;\n }\n\n if (arg === \"--source-type\") {\n const type = readFlagValue(argv,index,arg);\n if (type !== \"module\") throw new CliExitError(\"--source-type must be module.\",EXIT_RUNTIME);\n parsed.sourceType = type;\n index += 1;\n continue;\n }\n if (arg === \"--source-root\") {\n parsed.sourceRoot = readFlagValue(argv,index,arg);\n index += 1;\n continue;\n }\n\n if (arg === \"--fs-root\") {\n parsed.fsRoot = readFlagValue(argv, index, arg);\n index += 1;\n continue;\n }\n\n if (arg === \"--fs-config\") {\n if (parsed.fsConfig !== undefined) {\n throw new CliExitError(\"--fs-config may be specified only once.\", EXIT_RUNTIME);\n }\n const value = readFlagValue(argv, index, arg);\n if (value.trim().length === 0 || value.startsWith(\"--\")) {\n throw new CliExitError(\"--fs-config needs a JSON file path.\", EXIT_RUNTIME);\n }\n parsed.fsConfig = value;\n index += 1;\n continue;\n }\n\n if (arg === \"--mcp-config\") {\n parsed.mcpConfig = readFlagValue(argv, index, arg);\n index += 1;\n continue;\n }\n\n if (arg === \"--env-config\") {\n parsed.envConfig = readFlagValue(argv, index, arg);\n index += 1;\n continue;\n }\n\n if (arg === \"--snapshot\") {\n parsed.snapshotPath = readFlagValue(argv, index, arg);\n index += 1;\n continue;\n }\n\n if (arg === \"--restore\") {\n parsed.restorePath = readFlagValue(argv, index, arg);\n index += 1;\n continue;\n }\n\n if (arg === \"--max-steps\") {\n parsed.maxSteps = readPositiveInteger(readFlagValue(argv, index, arg), arg);\n index += 1;\n continue;\n }\n\n if (arg === \"--data-size\") {\n parsed.dataSize = readPositiveInteger(readFlagValue(argv, index, arg), arg);\n index += 1;\n continue;\n }\n\n if (arg.startsWith(\"-\")) {\n throw new CliExitError(`Unknown flag: ${arg}`, EXIT_RUNTIME);\n }\n\n if (parsed.filepath !== undefined) {\n throw new CliExitError(`Unexpected argument: ${arg}`, EXIT_RUNTIME);\n }\n\n parsed.filepath = arg;\n }\n\n if (parsed.fsConfig !== undefined && (parsed.fs || parsed.fsRoot !== undefined)) {\n throw new CliExitError(\"--fs-config cannot be combined with --fs or --fs-root.\", EXIT_RUNTIME);\n }\n\n if (!parsed.fs && parsed.fsRoot !== undefined) {\n throw new CliExitError(\n \"--fs-root requires --fs. Pass --fs to give the script a filesystem confined to that root, or drop --fs-root.\",\n EXIT_RUNTIME\n );\n }\n\n return parsed;\n}\n\nfunction readFlagValue(argv: readonly string[], index: number, flag: string): string {\n const value = argv[index + 1];\n if (value === undefined || value.length === 0) {\n throw new CliExitError(`Missing value for ${flag}`, EXIT_RUNTIME);\n }\n\n return value;\n}\n\nfunction readPositiveInteger(value: string, flag: string): number {\n const parsed = Number(value);\n\n if (!Number.isInteger(parsed) || parsed <= 0) {\n throw new CliExitError(`${flag} must be a positive integer`, EXIT_RUNTIME);\n }\n\n return parsed;\n}\n\nasync function assertHarnessFile(input: {\n displayPath: string;\n filepath: string;\n statFile: (filepath: string) => Promise<FileStats>;\n}): Promise<void> {\n let stats: FileStats;\n try {\n stats = await input.statFile(input.filepath);\n } catch (error) {\n if (hasErrorCode(error, \"ENOENT\")) {\n throw new CliExitError(`File not found: ${input.displayPath}`, EXIT_RUNTIME);\n }\n\n throw error;\n }\n\n if (!stats.isFile()) {\n throw new CliExitError(`Harness path must point to a file: ${input.displayPath}`, EXIT_RUNTIME);\n }\n}\n\nasync function runScriptFile(\n filepath: string,\n parsed: ParsedArgs,\n options: {\n cwd: string;\n configuredFs: FsModuleOptions | undefined;\n env: EnvModuleOptions | undefined;\n mcp: McpModuleOptions | undefined;\n modulesFor: RunCliOptions[\"modulesFor\"];\n brokenPipe: BrokenPipeState;\n process: CliProcess;\n readFile: ReadMarkdownFile;\n stderr: CliStream;\n stdout: CliStream;\n writeFile: WriteMarkdownFile;\n adapter?: FileSystem;\n }\n): Promise<number> {\n const [{ run }, { restore }, { dump, dumpCurrent }, { createLintModulesFromRuntimeRegistry }, { makeFsModule }, { makeMcpModule }] = await Promise.all([\n import(\"./run.js\"), import(\"./restore.js\"), import(\"./snapshot/dump.js\"),\n import(\"./lint/runtime-modules.js\"), import(\"./modules/fs.js\"), import(\"./modules/mcp.js\")\n ]);\n const loaded = loadExecutableSource(filepath, await options.readFile(filepath, \"utf8\"));\n const meta = {\n filepath,\n kind: loaded.frontmatter.kind,\n version: loaded.frontmatter.version\n };\n const runtime = await createRuntime(loaded.frontmatter, meta, {\n fs: parsed.fs\n ? { root: path.resolve(options.cwd, parsed.fsRoot ?? dirname(filepath)), ...(options.adapter ? {adapter: options.adapter} : {}) }\n : undefined,\n modulesFor: options.modulesFor,\n stderr: options.stderr,\n stdout: options.stdout\n });\n if (options.configuredFs !== undefined) {\n const registry = new Map(\n runtime.registry instanceof Map ? runtime.registry : Object.entries(runtime.registry)\n );\n if (registry.has(\"fs\")) throw new TypeError(\"fs is already registered by modulesFor.\");\n registry.set(\"fs\", toModuleExports(makeFsModule(options.configuredFs)));\n runtime.registry = registry;\n }\n let env = options.env;\n if (parsed.envConfig !== undefined) {\n if (env !== undefined)\n throw new TypeError(\"Pass environment options or --env-config, not both.\");\n const configPath = path.resolve(options.cwd, parsed.envConfig);\n env = parseEnvConfig(await options.readFile(configPath, \"utf8\"));\n }\n if (env !== undefined) {\n const registry = new Map(\n runtime.registry instanceof Map ? runtime.registry : Object.entries(runtime.registry)\n );\n if (registry.has(\"env\"))\n throw new TypeError(\"Environment is already registered by modulesFor.\");\n registry.set(\"env\", makeEnvModule(env));\n runtime.registry = registry;\n }\n let mcp = options.mcp;\n if (parsed.mcpConfig !== undefined) {\n if (mcp !== undefined) throw new TypeError(\"Pass MCP options or --mcp-config, not both.\");\n const configPath = path.resolve(options.cwd, parsed.mcpConfig);\n mcp = parseMcpConfig(await options.readFile(configPath, \"utf8\"), dirname(configPath));\n }\n if (mcp !== undefined) {\n const registry = new Map(\n runtime.registry instanceof Map ? runtime.registry : Object.entries(runtime.registry)\n );\n if (registry.has(\"mcp\")) throw new TypeError(\"MCP is already registered by modulesFor.\");\n registry.set(\"mcp\", makeMcpModule(mcp));\n runtime.registry = registry;\n }\n const modules = excludeHarnessModule(runtime.registry, loaded.isRawScript);\n let executableSource = loaded.executableSource;\n const diagnosticFilename = parsed.filepath ?? filepath;\n if (parsed.sourceRoot !== undefined && parsed.sourceType !== \"module\")\n throw new CliExitError(\"--source-root requires --source-type module.\",EXIT_RUNTIME);\n if (parsed.sourceType === \"module\") {\n if (parsed.fix) throw new CliExitError(\"--fix applies to harness sources, not source modules.\",EXIT_RUNTIME);\n parseSourceModule(executableSource,diagnosticFilename);\n }\n const lintResult = parsed.sourceType === \"module\" ? [] : parsed.fix\n ? lint(executableSource, {\n allowedExportNames: [\"schema\"],\n filename: diagnosticFilename,\n fix: true,\n fixRanges: loaded.fixRanges,\n frontmatterFields: Object.keys(loaded.frontmatter),\n modules: createLintModulesFromRuntimeRegistry(modules)\n })\n : lint(executableSource, {\n allowedExportNames: [\"schema\"],\n filename: diagnosticFilename,\n frontmatterFields: Object.keys(loaded.frontmatter),\n modules: createLintModulesFromRuntimeRegistry(modules)\n });\n const diagnostics = Array.isArray(lintResult) ? lintResult : lintResult.diagnostics;\n\n if (!Array.isArray(lintResult)) {\n executableSource = lintResult.fixed;\n if (lintResult.fixed !== loaded.executableSource) {\n await options.writeFile(\n filepath,\n replaceExecutableSource(loaded.rawSource, loaded, lintResult.fixes),\n {\n encoding: \"utf8\"\n }\n );\n }\n }\n\n const lintErrors = diagnostics.filter((diagnostic) => diagnostic.severity === \"error\");\n if (lintErrors.length > 0) {\n options.stderr.write(`Lint failed:\\n${formatDiagnostics(lintErrors)}\\n`);\n if (options.brokenPipe.closed) {\n return 0;\n }\n return lintErrors.some((diagnostic) => diagnostic.code === \"AS001\") ? EXIT_PARSE : EXIT_RUNTIME;\n }\n\n const lintWarnings = diagnostics.filter((diagnostic) => diagnostic.severity === \"warning\");\n if (lintWarnings.length > 0) {\n options.stderr.write(`Lint warnings:\\n${formatDiagnostics(lintWarnings)}\\n`);\n if (options.brokenPipe.closed) {\n return 0;\n }\n }\n\n const snapshot = await readRestoreSnapshot(parsed.restorePath, options);\n if (snapshot !== undefined) {\n restore(snapshot, { source: executableSource });\n }\n\n const abortController = new AbortController();\n let interrupted = false;\n let runPromise: Promise<RunResult> | undefined;\n let signalSnapshotWrite: Promise<void> | undefined;\n const onSigint = () => {\n interrupted = true;\n abortController.abort(createAbortError());\n options.stderr.write(\"Interrupted by SIGINT\\n\");\n\n if (parsed.snapshotPath !== undefined && runPromise !== undefined) {\n signalSnapshotWrite = writeCurrentSnapshot(runPromise, parsed.snapshotPath, options, dumpCurrent);\n }\n };\n\n const sourceResolver = parsed.sourceRoot !== undefined && options.adapter !== undefined\n ? await createRootedSourceResolver(path.resolve(options.cwd, parsed.sourceRoot), options.adapter)\n : undefined;\n options.process.on(\"SIGINT\", onSigint);\n try {\n runPromise = run(executableSource, {\n budget:\n parsed.maxSteps === undefined && parsed.dataSize === undefined\n ? undefined\n : new Budget({ dataSize: parsed.dataSize, maxSteps: parsed.maxSteps }),\n entryPointArgs: parsed.sourceType === \"module\" ? undefined : hasDefaultExport(executableSource, diagnosticFilename) ? [] : undefined,\n sourceType:parsed.sourceType,\n sourceResolver,\n sourceRoot:sourceResolver !== undefined || parsed.sourceRoot === undefined ? undefined : path.resolve(options.cwd,parsed.sourceRoot),\n filename: sourceResolver === undefined ? diagnosticFilename : await sourceResolver.entryId(filepath),\n modules,\n signal: abortController.signal,\n sink: createConsoleSink(options.stdout, options.stderr),\n snapshot\n });\n const result = await runPromise;\n await signalSnapshotWrite;\n\n if (options.brokenPipe.closed) {\n return 0;\n }\n\n if (parsed.snapshotPath !== undefined) {\n await writeSnapshot(parsed.snapshotPath, await dump(result), options);\n }\n\n if (!result.ok) {\n options.stderr.write(\n `${formatInterpreterError(result.error, {\n filename: diagnosticFilename,\n source: executableSource\n })}\\n`\n );\n if (options.brokenPipe.closed) {\n return 0;\n }\n return interrupted ? EXIT_SIGINT : exitCodeForError(result.error);\n }\n\n options.stdout.write(`${JSON.stringify({ ok: true, returnValue: result.returnValue })}\\n`);\n return options.brokenPipe.closed ? 0 : interrupted ? EXIT_SIGINT : 0;\n } catch (error) {\n await signalSnapshotWrite;\n if (parsed.snapshotPath !== undefined && runPromise !== undefined) {\n try {\n await writeSnapshot(\n parsed.snapshotPath,\n await dump(runPromise, { onFailure: \"checkpoint\" }),\n options\n );\n } catch (snapshotError) {\n options.stderr.write(\n `Failed to write recovery snapshot at ${parsed.snapshotPath}: ${readErrorMessage(snapshotError)}. Any existing snapshot may be stale.\\n`\n );\n }\n }\n if (options.brokenPipe.closed) {\n return 0;\n }\n options.stderr.write(\n `${formatInterpreterError(error, {\n filename: diagnosticFilename,\n source: executableSource\n })}\\n`\n );\n return options.brokenPipe.closed ? 0 : interrupted ? EXIT_SIGINT : exitCodeForError(error);\n } finally {\n options.process.off(\"SIGINT\", onSigint);\n }\n}\n\nfunction loadExecutableSource(filepath: string, rawSource: string): LoadedSource {\n const source = stripByteOrderMark(rawSource);\n const byteOrderMarkLength = rawSource.length - source.length;\n\n if (isRawScriptExtension(extname(filepath))) {\n return {\n sourceOffset: byteOrderMarkLength,\n executableSource: source,\n frontmatter: {},\n isRawScript: true,\n rawSource\n };\n }\n\n const { frontmatter, body } = splitFrontmatter(source);\n const bodyStartOffset = rawSource.length - body.length;\n const executableBlock = extractBlock(body, countLineBreaks(rawSource, 0, bodyStartOffset) + 1);\n\n return {\n sourceOffset: 0,\n fixRanges: executableBlock.ranges.map(([start, end]) => [\n bodyStartOffset + start,\n bodyStartOffset + end\n ]),\n executableSource:\n maskSource(rawSource.slice(0, bodyStartOffset + executableBlock.startOffset)) +\n executableBlock.source,\n frontmatter,\n isRawScript: false,\n rawSource\n };\n}\n\nfunction isRawScriptExtension(extension: string): boolean {\n return extension === \".safejs\" || extension === \".ajs\";\n}\n\nfunction replaceExecutableSource(\n source: string,\n loaded: LoadedSource,\n fixes: readonly Fix[]\n): string {\n return fixes.reduce(\n (result, fix) =>\n `${result.slice(0, loaded.sourceOffset + fix.range[0])}${fix.replacement}${result.slice(loaded.sourceOffset + fix.range[1])}`,\n source\n );\n}\n\nasync function createRuntime(\n frontmatter: Record<string, unknown>,\n meta: HarnessMeta,\n options: {\n fs: FsModuleOptions | undefined;\n modulesFor: RunCliOptions[\"modulesFor\"];\n stderr: CliStream;\n stdout: CliStream;\n }\n): Promise<CliRuntime> {\n if (options.modulesFor !== undefined) {\n return {\n registry: options.modulesFor(frontmatter, meta, {\n stderr: options.stderr,\n stdout: options.stdout\n })\n };\n }\n\n const [{ makeHarnessModule }, { makeFsModule }] = await Promise.all([\n import(\"./modules/harness.js\"), import(\"./modules/fs.js\")\n ]);\n const state = {\n metricCalls: new Map<string, number>(),\n spawnCount: 0\n };\n const harness = makeHarnessModule(frontmatter, meta);\n const agent = makeAgentModule(async (input) => {\n state.spawnCount += 1;\n\n return {\n exitCode: 0,\n stdout: \"\",\n stderr: \"\",\n summary: `${input.agent} handled ${summarizePrompt(input.prompt)}`,\n durationMs: 25 * state.spawnCount\n };\n });\n const log = makeLogModule((entry) => {\n const normalized = normalizeLogEntry(entry);\n const stream = normalized.type === \"error\" ? options.stderr : options.stdout;\n stream.write(`${JSON.stringify(normalized)}\\n`);\n });\n const metric = makeMetricModule(async (scriptName) => `${readMetricScore(scriptName, state)}\\n`);\n\n return {\n registry: {\n agent: toModuleExports(agent),\n fail: toModuleExports(new Map([[\"default\", makeFailModule().default]])),\n // The one module here that is not a stub, so it is registered only when asked for.\n ...(options.fs === undefined ? {} : { fs: toModuleExports(makeFsModule(options.fs)) }),\n harness: toModuleExports(harness),\n log: toModuleExports(log),\n metric: toModuleExports(metric)\n }\n };\n}\n\nasync function readRestoreSnapshot(\n restorePath: string | undefined,\n options: {\n cwd: string;\n readFile: ReadMarkdownFile;\n }\n): Promise<SafeJSSnapshot | undefined> {\n if (restorePath === undefined) {\n return undefined;\n }\n\n const snapshotPath = path.resolve(options.cwd, restorePath);\n let rawSnapshot: string;\n try {\n rawSnapshot = await options.readFile(snapshotPath, \"utf8\");\n } catch (error) {\n if (hasErrorCode(error, \"ENOENT\")) {\n throw new CliExitError(`Snapshot not found: ${restorePath}`, EXIT_RUNTIME);\n }\n\n throw error;\n }\n\n try {\n return JSON.parse(rawSnapshot) as SafeJSSnapshot;\n } catch (error) {\n throw new Error(`Failed to parse snapshot at ${restorePath}: ${readErrorMessage(error)}`);\n }\n}\n\nasync function writeCurrentSnapshot(\n result: PromiseLike<RunResult>,\n snapshotPath: string,\n options: {\n cwd: string;\n stderr: CliStream;\n writeFile: WriteMarkdownFile;\n adapter?: FileSystem;\n },\n capture: typeof import(\"./snapshot/dump.js\").dumpCurrent\n): Promise<void> {\n try {\n await writeSnapshot(snapshotPath, await capture(result), options);\n } catch (error) {\n options.stderr.write(\n `Failed to write snapshot at ${snapshotPath}: ${readErrorMessage(error)}\\n`\n );\n }\n}\n\nasync function writeSnapshot(\n snapshotPath: string,\n content: string,\n options: {\n cwd: string;\n writeFile: WriteMarkdownFile;\n adapter?: FileSystem;\n }\n): Promise<void> {\n const resolvedPath = path.resolve(options.cwd, snapshotPath);\n await (options.adapter ? createFsBridge(options.adapter, {codec: fsCodec}) : hostFs).mkdir(dirname(resolvedPath), { recursive: true });\n await options.writeFile(resolvedPath, content, { encoding: \"utf8\" });\n}\n\nfunction createConsoleSink(\n stdout: CliStream,\n stderr: CliStream\n): {\n error: (...args: unknown[]) => void;\n log: (...args: unknown[]) => void;\n} {\n return {\n error(...args) {\n stderr.write(`${formatConsoleArgs(args)}\\n`);\n },\n log(...args) {\n stdout.write(`${formatConsoleArgs(args)}\\n`);\n }\n };\n}\n\nfunction formatConsoleArgs(args: readonly unknown[]): string {\n return formatWithOptions({ colors: false, depth: 4 }, ...args);\n}\n\nfunction formatDiagnostics(diagnostics: readonly Diagnostic[]): string {\n return diagnostics\n .map(\n (diagnostic) =>\n `${diagnostic.filename}:${diagnostic.line}:${diagnostic.column} ${diagnostic.code} ${diagnostic.message}`\n )\n .join(\"\\n\");\n}\n\nexport function exitCodeForError(error: unknown): number {\n if (error instanceof SandboxError && error.code === \"budgetExceeded\") {\n return EXIT_BUDGET;\n }\n\n if (isParseError(error)) {\n return EXIT_PARSE;\n }\n\n return EXIT_RUNTIME;\n}\n\nfunction isParseError(error: unknown): boolean {\n return error instanceof Error && (error.name === \"ParseError\" ||\n (\"kind\" in error && error.kind === \"ParseError\"));\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 = Object.create(null) as 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 normalizeLogEntry(entry: LogModuleEntry): LogModuleEntry {\n return {\n ...entry,\n ts: \"2026-04-29T00:00:00.000Z\"\n };\n}\n\nfunction summarizePrompt(prompt: string): string {\n const normalizedPrompt = prompt.trim().replaceAll(\"\\n\", \" \");\n return normalizedPrompt.length <= 48 ? normalizedPrompt : `${normalizedPrompt.slice(0, 45)}...`;\n}\n\nfunction readMetricScore(\n scriptName: string,\n state: {\n metricCalls: Map<string, number>;\n }\n): number {\n const callCount = (state.metricCalls.get(scriptName) ?? 0) + 1;\n state.metricCalls.set(scriptName, callCount);\n\n if (scriptName === \"tests\" && callCount === 1) {\n return 10;\n }\n\n if (scriptName === \"tests\" && callCount === 2) {\n return 9;\n }\n\n return 9 + callCount;\n}\n\nfunction toModuleExports(value: unknown): ModuleExports {\n return value as ModuleExports;\n}\n\nfunction createAbortError(): Error {\n if (typeof DOMException === \"function\") {\n const error = new DOMException(\"This operation was aborted\", \"AbortError\");\n replaceErrorStack(error);\n return error;\n }\n\n const error = new Error(\"This operation was aborted\");\n error.name = \"AbortError\";\n replaceErrorStack(error);\n return error;\n}\n\nfunction hasErrorCode(error: unknown, code: string): boolean {\n return hasOwnErrorCode(error, code);\n}\n\nfunction readErrorMessage(error: unknown): string {\n if (error instanceof Error) {\n if (\"filename\" in error && typeof error.filename === \"string\") {\n return `${error.name}: ${error.filename}\\n\\n${error.message}`;\n }\n return error.message;\n }\n\n return String(error);\n}\n\nclass CliExitError extends Error {\n readonly exitCode: number;\n\n constructor(message: string, exitCode: number) {\n super(message);\n this.name = \"CliExitError\";\n this.exitCode = exitCode;\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAQ,sBAAsC;AAwG9C,IAAM,eAAe;AACrB,IAAM,aAAa;AACnB,IAAM,cAAc;AACpB,IAAM,cAAc;AAEpB,eAAsB,OACpB,MACA,SACA,OACiB;AACjB,QAAM,KAAK,QAAQ,UAAU,eAAe,QAAQ,SAAS,EAAC,OAAO,QAAO,CAAC,IAAI;AACjF,QAAM,WAAW,GAAG,SAAS,KAAK,EAAE;AACpC,QAAM,YAAY,GAAG,UAAU,KAAK,EAAE;AACtC,QAAM,OAAO,GAAG,KAAK,KAAK,EAAE;AAC5B,QAAM,aAAa,sBAAsB;AACzC,QAAM,SAAS,uBAAuB,QAAQ,UAAU,QAAQ,QAAQ,UAAU;AAClF,QAAM,SAAS,uBAAuB,QAAQ,UAAU,QAAQ,QAAQ,UAAU;AAElF,SAAO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D,SAAO;AACT;AAEA,SAAS,mBAA0B;AACjC,MAAI,OAAO,iBAAiB,YAAY;AACtC,UAAMC,SAAQ,IAAI,aAAa,8BAA8B,YAAY;AACzE,sBAAkBA,MAAK;AACvB,WAAOA;AAAA,EACT;AAEA,QAAM,QAAQ,IAAI,MAAM,4BAA4B;AACpD,QAAM,OAAO;AACb,oBAAkB,KAAK;AACvB,SAAO;AACT;AAEA,SAAS,aAAa,OAAgB,MAAuB;AAC3D,SAAO,gBAAgB,OAAO,IAAI;AACpC;AAEA,SAAS,iBAAiB,OAAwB;AAChD,MAAI,iBAAiB,OAAO;AAC1B,QAAI,cAAc,SAAS,OAAO,MAAM,aAAa,UAAU;AAC7D,aAAO,GAAG,MAAM,IAAI,KAAK,MAAM,QAAQ;AAAA;AAAA,EAAO,MAAM,OAAO;AAAA,IAC7D;AACA,WAAO,MAAM;AAAA,EACf;AAEA,SAAO,OAAO,KAAK;AACrB;AAEA,IAAM,eAAN,cAA2B,MAAM;AAAA,EACtB;AAAA,EAET,YAAY,SAAiB,UAAkB;AAC7C,UAAM,OAAO;AACb,SAAK,OAAO;AACZ,SAAK,WAAW;AAAA,EAClB;AACF;",
6
- "names": ["rawModules", "error"]
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": [],
4
- "sourcesContent": [],
5
- "mappings": "",
6
- "names": []
7
- }
@@ -1,11 +0,0 @@
1
- import {
2
- makeHarnessModule
3
- } from "./chunk-24Z6PSCN.js";
4
- import "./chunk-J3CUCOMP.js";
5
- import "./chunk-LMS5SSTN.js";
6
- import "./chunk-UQPYTZOZ.js";
7
- import "./chunk-4YIDX44G.js";
8
- export {
9
- makeHarnessModule
10
- };
11
- //# sourceMappingURL=harness-QKPVLVOT.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": [],
4
- "sourcesContent": [],
5
- "mappings": "",
6
- "names": []
7
- }
@@ -1,12 +0,0 @@
1
- import {
2
- makeMcpModule
3
- } from "./chunk-WWETRQCF.js";
4
- import "./chunk-3ITVV2R6.js";
5
- import "./chunk-J3CUCOMP.js";
6
- import "./chunk-LMS5SSTN.js";
7
- import "./chunk-UQPYTZOZ.js";
8
- import "./chunk-4YIDX44G.js";
9
- export {
10
- makeMcpModule
11
- };
12
- //# sourceMappingURL=mcp-A4YKQCIS.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": [],
4
- "sourcesContent": [],
5
- "mappings": "",
6
- "names": []
7
- }
@@ -1,15 +0,0 @@
1
- import {
2
- migrateSnapshotFile
3
- } from "./chunk-47JWFV2B.js";
4
- import "./chunk-GVKXZW53.js";
5
- import "./chunk-2GVBG23M.js";
6
- import "./chunk-AUVGHYM5.js";
7
- import "./chunk-J3CUCOMP.js";
8
- import "./chunk-LMS5SSTN.js";
9
- import "./chunk-YUQFFRUF.js";
10
- import "./chunk-UQPYTZOZ.js";
11
- import "./chunk-4YIDX44G.js";
12
- export {
13
- migrateSnapshotFile
14
- };
15
- //# sourceMappingURL=migration-file-QCZTVXEU.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": [],
4
- "sourcesContent": [],
5
- "mappings": "",
6
- "names": []
7
- }
@@ -1,14 +0,0 @@
1
- import {
2
- SnapshotMismatchError,
3
- restore
4
- } from "./chunk-V72WS373.js";
5
- import "./chunk-AUVGHYM5.js";
6
- import "./chunk-J3CUCOMP.js";
7
- import "./chunk-LMS5SSTN.js";
8
- import "./chunk-UQPYTZOZ.js";
9
- import "./chunk-4YIDX44G.js";
10
- export {
11
- SnapshotMismatchError,
12
- restore
13
- };
14
- //# sourceMappingURL=restore-22OGYS6N.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": [],
4
- "sourcesContent": [],
5
- "mappings": "",
6
- "names": []
7
- }
@@ -1,20 +0,0 @@
1
- import {
2
- UnhandledRejectionError,
3
- run
4
- } from "./chunk-YDVEVDVT.js";
5
- import "./chunk-U7ZNMTSQ.js";
6
- import "./chunk-GVKXZW53.js";
7
- import "./chunk-2GVBG23M.js";
8
- import "./chunk-V72WS373.js";
9
- import "./chunk-AUVGHYM5.js";
10
- import "./chunk-IRYOK5BR.js";
11
- import "./chunk-J3CUCOMP.js";
12
- import "./chunk-LMS5SSTN.js";
13
- import "./chunk-YUQFFRUF.js";
14
- import "./chunk-UQPYTZOZ.js";
15
- import "./chunk-4YIDX44G.js";
16
- export {
17
- UnhandledRejectionError,
18
- run
19
- };
20
- //# sourceMappingURL=run-EMFOFJ22.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": [],
4
- "sourcesContent": [],
5
- "mappings": "",
6
- "names": []
7
- }
@@ -1,11 +0,0 @@
1
- import {
2
- createLintModulesFromRuntimeRegistry
3
- } from "./chunk-WEGFNME4.js";
4
- import "./chunk-J3CUCOMP.js";
5
- import "./chunk-LMS5SSTN.js";
6
- import "./chunk-UQPYTZOZ.js";
7
- import "./chunk-4YIDX44G.js";
8
- export {
9
- createLintModulesFromRuntimeRegistry
10
- };
11
- //# sourceMappingURL=runtime-modules-QCVDLUVF.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": [],
4
- "sourcesContent": [],
5
- "mappings": "",
6
- "names": []
7
- }
@@ -1,10 +0,0 @@
1
- import {
2
- createRootedSourceResolver
3
- } from "./chunk-F6CV74HU.js";
4
- import "./chunk-YUQFFRUF.js";
5
- import "./chunk-UQPYTZOZ.js";
6
- import "./chunk-4YIDX44G.js";
7
- export {
8
- createRootedSourceResolver
9
- };
10
- //# sourceMappingURL=source-files-L3SGK63Z.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": [],
4
- "sourcesContent": [],
5
- "mappings": "",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/cli.ts"],
4
- "sourcesContent": ["#!/usr/bin/env node\nimport { realpath } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\nimport type { RunCliOptions } from \"./cli-runtime.js\";\nimport {\n createBrokenPipeState,\n createSafeOutputStream,\n withBrokenPipeGuard\n} from \"./output-stream.js\";\n\nexport type { ReadMarkdownFile, WriteMarkdownFile, RunCliOptions } from \"./cli-runtime.js\";\n\nexport async function runCli(\n argv: readonly string[],\n options: RunCliOptions = {}\n): Promise<number> {\n if (!argv.includes(\"--help\") && !argv.includes(\"-h\")) {\n const runtime = await import(\"./cli-runtime.js\");\n return runtime.runCli(argv, options, createUsage());\n }\n\n const brokenPipe = createBrokenPipeState();\n const stdout = createSafeOutputStream(options.stdout ?? process.stdout, brokenPipe);\n const stderr = createSafeOutputStream(options.stderr ?? process.stderr, brokenPipe);\n return withBrokenPipeGuard(\n [options.stdout ?? process.stdout, options.stderr ?? process.stderr],\n brokenPipe,\n async () => {\n try {\n stdout.write(`${createUsage()}\\n`);\n return 0;\n } catch (error) {\n if (brokenPipe.closed) return 0;\n stderr.write(`${error instanceof Error ? error.message : String(error)}\\n`);\n if (brokenPipe.closed) return 0;\n const { exitCodeForError } = await import(\"./cli-runtime.js\");\n return exitCodeForError(error);\n }\n }\n );\n}\n\nfunction createUsage(): string {\n return [\n \"Usage: poe-safe-js [options] <script.md|script.safejs|script.ajs>\",\n \" poe-safe-js migrate <checkpoint.json> --from <original.ajs> --inspect\",\n \" poe-safe-js migrate <checkpoint.json> --from <original.ajs> --to <continuation.ajs>\",\n \" --plan <migration.json> --output <new-checkpoint.json> [--dry-run]\",\n \"\",\n \"Compatibility alias: poe-safejs\",\n \"\",\n \"Options:\",\n \" --source-type module execute an ECMAScript source module\",\n \" --source-root <path> grant relative module files within this directory\",\n \" --fix apply lint fixes before running\",\n \" --fs register the fs module: a real filesystem, unlike the agent\",\n \" and metric stubs this runner bundles\",\n \" --fs-root <path> directory --fs confines the script to (default: the script's\",\n \" directory)\",\n \" --fs-config <path> configure shared filesystem access from JSON (Node only)\",\n \" --mcp-config <path> register named MCP servers from an explicit JSON config\",\n \" --env-config <path> grant environment reads from an explicit JSON config\",\n \" --snapshot <path> write success/failure state; best-effort snapshot on SIGINT\",\n \" --restore <path> restore from a snapshot before running\",\n \" --max-steps <n> cap interpreter step budget\",\n \" --data-size <n> cap retained sandbox data units\",\n \" -h, --help print this help\",\n \"\",\n \"Exit codes:\",\n \" 0 success\",\n \" 1 runtime, usage, file, or restore error\",\n \" 2 parse error\",\n \" 3 budget exceeded\",\n \" 130 interrupted by SIGINT\"\n ].join(\"\\n\");\n}\n\n\nasync function isDirectExecution(entryPoint: string | undefined): Promise<boolean> {\n if (typeof entryPoint !== \"string\" || entryPoint.length === 0) {\n return false;\n }\n\n try {\n const [resolvedEntryPoint, resolvedModule] = await Promise.all([\n realpath(path.resolve(entryPoint)),\n realpath(fileURLToPath(import.meta.url))\n ]);\n return resolvedEntryPoint === resolvedModule;\n } catch {\n return false;\n }\n}\n\nif (await isDirectExecution(process.argv[1])) {\n process.exitCode = await runCli(process.argv.slice(2));\n}\n"],
5
- "mappings": ";;;;;;;;;;AACA,SAAS,gBAAgB;AACzB,OAAO,UAAU;AACjB,SAAS,qBAAqB;AAW9B,eAAsB,OACpB,MACA,UAAyB,CAAC,GACT;AACjB,MAAI,CAAC,KAAK,SAAS,QAAQ,KAAK,CAAC,KAAK,SAAS,IAAI,GAAG;AACpD,UAAM,UAAU,MAAM,OAAO,kCAAkB;AAC/C,WAAO,QAAQ,OAAO,MAAM,SAAS,YAAY,CAAC;AAAA,EACpD;AAEA,QAAM,aAAa,sBAAsB;AACzC,QAAM,SAAS,uBAAuB,QAAQ,UAAU,QAAQ,QAAQ,UAAU;AAClF,QAAM,SAAS,uBAAuB,QAAQ,UAAU,QAAQ,QAAQ,UAAU;AAClF,SAAO;AAAA,IACL,CAAC,QAAQ,UAAU,QAAQ,QAAQ,QAAQ,UAAU,QAAQ,MAAM;AAAA,IACnE;AAAA,IACA,YAAY;AACV,UAAI;AACF,eAAO,MAAM,GAAG,YAAY,CAAC;AAA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],
4
- "sourcesContent": [],
5
- "mappings": "",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 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 {createFsBridge, type FileSystem} from \"@poe-code/safe-fs/core\";\nimport {fsCodec} from \"../modules/fs-codec.js\";\nimport { hostFs } from \"#safe-js-platform\";\nimport { extname } from \"../modules/paths.js\";\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 adapter?: FileSystem;\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, options.adapter);\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, options.adapter),\n readHarnessFile(pair.scriptPath, options.adapter)\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, adapter?: FileSystem): Promise<string> {\n const io = adapter ? createFsBridge(adapter, {codec: fsCodec}) : hostFs;\n try {\n const stats = await io.stat(filepath);\n if (!stats.isFile()) {\n throw new Error(`Harness path must point to a file: ${filepath}`);\n }\n\n return await io.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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CAAC;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;;;AC1FO,IAAMC,eAA6D;AACnE,IAAMC,qBAA+E;AAErF,IAAMC,WAGI;AAKV,IAAMC,uBAGT;",
6
- "names": ["parse", "rawModules", "parseModule", "parseSourceModule", "restore", "deepCopyFromSandbox"]
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": [],
4
- "sourcesContent": [],
5
- "mappings": "",
6
- "names": []
7
- }