@poe-platform/safe-js 0.1.0

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 (326) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +206 -0
  3. package/dist/agent-defs/agents/claude-code.d.ts +2 -0
  4. package/dist/agent-defs/agents/claude-desktop.d.ts +2 -0
  5. package/dist/agent-defs/agents/codex.d.ts +2 -0
  6. package/dist/agent-defs/agents/cursor.d.ts +2 -0
  7. package/dist/agent-defs/agents/gemini-cli.d.ts +2 -0
  8. package/dist/agent-defs/agents/goose.d.ts +2 -0
  9. package/dist/agent-defs/agents/index.d.ts +10 -0
  10. package/dist/agent-defs/agents/kimi.d.ts +2 -0
  11. package/dist/agent-defs/agents/opencode.d.ts +2 -0
  12. package/dist/agent-defs/agents/pi.d.ts +2 -0
  13. package/dist/agent-defs/agents/poe-agent.d.ts +2 -0
  14. package/dist/agent-defs/capabilities.d.ts +14 -0
  15. package/dist/agent-defs/index.d.ts +6 -0
  16. package/dist/agent-defs/registry.d.ts +3 -0
  17. package/dist/agent-defs/specifier.d.ts +7 -0
  18. package/dist/agent-defs/types.d.ts +35 -0
  19. package/dist/agent-harness-tools/binary-exists.d.ts +10 -0
  20. package/dist/agent-harness-tools/execution-env.d.ts +108 -0
  21. package/dist/agent-harness-tools/hooks.d.ts +30 -0
  22. package/dist/agent-harness-tools/index.d.ts +18 -0
  23. package/dist/agent-harness-tools/log-stream.d.ts +28 -0
  24. package/dist/agent-harness-tools/participant.d.ts +10 -0
  25. package/dist/agent-harness-tools/paths.d.ts +14 -0
  26. package/dist/agent-harness-tools/plan-readiness.d.ts +7 -0
  27. package/dist/agent-harness-tools/plans.d.ts +35 -0
  28. package/dist/agent-harness-tools/poe-command-execution.d.ts +37 -0
  29. package/dist/agent-harness-tools/run-logs.d.ts +17 -0
  30. package/dist/agent-harness-tools/run-poe-command.d.ts +33 -0
  31. package/dist/agent-harness-tools/runner.d.ts +33 -0
  32. package/dist/agent-harness-tools/select-agent.d.ts +18 -0
  33. package/dist/agent-harness-tools/sequence.d.ts +7 -0
  34. package/dist/agent-harness-tools/skill-config.d.ts +1 -0
  35. package/dist/agent-harness-tools/stage.d.ts +22 -0
  36. package/dist/agent-harness-tools/workspace-transfer.d.ts +3 -0
  37. package/dist/agent-spawn/acp/middleware.d.ts +38 -0
  38. package/dist/agent-spawn/acp/types.d.ts +180 -0
  39. package/dist/agent-spawn/adapters/claude.d.ts +3 -0
  40. package/dist/agent-spawn/adapters/codex.d.ts +2 -0
  41. package/dist/agent-spawn/adapters/cursor.d.ts +2 -0
  42. package/dist/agent-spawn/adapters/index.d.ts +12 -0
  43. package/dist/agent-spawn/adapters/kimi.d.ts +2 -0
  44. package/dist/agent-spawn/adapters/native.d.ts +5 -0
  45. package/dist/agent-spawn/adapters/opencode.d.ts +2 -0
  46. package/dist/agent-spawn/adapters/pi.d.ts +2 -0
  47. package/dist/agent-spawn/environment.d.ts +2 -0
  48. package/dist/agent-spawn/parallel.d.ts +30 -0
  49. package/dist/agent-spawn/retry.d.ts +26 -0
  50. package/dist/agent-spawn/types.d.ts +272 -0
  51. package/dist/auth-store/create-secret-store.d.ts +2 -0
  52. package/dist/auth-store/encrypted-file-store.d.ts +47 -0
  53. package/dist/auth-store/index.d.ts +7 -0
  54. package/dist/auth-store/keychain-store.d.ts +25 -0
  55. package/dist/auth-store/provider-store.d.ts +14 -0
  56. package/dist/auth-store/types.d.ts +22 -0
  57. package/dist/config-mutations/execution/run-mutations.d.ts +7 -0
  58. package/dist/config-mutations/fs-utils.d.ts +18 -0
  59. package/dist/config-mutations/index.d.ts +8 -0
  60. package/dist/config-mutations/mutations/config-mutation.d.ts +47 -0
  61. package/dist/config-mutations/mutations/file-mutation.d.ts +62 -0
  62. package/dist/config-mutations/mutations/template-mutation.d.ts +40 -0
  63. package/dist/config-mutations/template/render.d.ts +6 -0
  64. package/dist/config-mutations/types.d.ts +168 -0
  65. package/dist/poe-code-config/compile/schema-compiler.d.ts +11 -0
  66. package/dist/poe-code-config/config.d.ts +2 -0
  67. package/dist/poe-code-config/configured-services.d.ts +29 -0
  68. package/dist/poe-code-config/index.d.ts +16 -0
  69. package/dist/poe-code-config/inspect.d.ts +13 -0
  70. package/dist/poe-code-config/memory.d.ts +14 -0
  71. package/dist/poe-code-config/merge-callbacks.d.ts +38 -0
  72. package/dist/poe-code-config/merge.d.ts +2 -0
  73. package/dist/poe-code-config/plan-scope.d.ts +8 -0
  74. package/dist/poe-code-config/provider-config.d.ts +16 -0
  75. package/dist/poe-code-config/resolve.d.ts +2 -0
  76. package/dist/poe-code-config/runtime.d.ts +114 -0
  77. package/dist/poe-code-config/schema.d.ts +14 -0
  78. package/dist/poe-code-config/state/fs.d.ts +24 -0
  79. package/dist/poe-code-config/state/index.d.ts +12 -0
  80. package/dist/poe-code-config/state/jobs.d.ts +34 -0
  81. package/dist/poe-code-config/state/templates.d.ts +18 -0
  82. package/dist/poe-code-config/store.d.ts +12 -0
  83. package/dist/poe-code-config/types.d.ts +88 -0
  84. package/dist/process-runner/docker/build-context.d.ts +5 -0
  85. package/dist/process-runner/docker/context.d.ts +3 -0
  86. package/dist/process-runner/docker/docker-execution-env.d.ts +28 -0
  87. package/dist/process-runner/docker/docker-runner.d.ts +2 -0
  88. package/dist/process-runner/docker/engine.d.ts +3 -0
  89. package/dist/process-runner/host/host-execution-env.d.ts +2 -0
  90. package/dist/process-runner/host/host-runner.d.ts +3 -0
  91. package/dist/process-runner/index.d.ts +10 -0
  92. package/dist/process-runner/testing/index.d.ts +2 -0
  93. package/dist/process-runner/testing/mock-runner.d.ts +3 -0
  94. package/dist/process-runner/types.d.ts +191 -0
  95. package/dist/process-runner/workspace-transfer.d.ts +61 -0
  96. package/dist/providers/auth/api-key.d.ts +5 -0
  97. package/dist/providers/auth/types.d.ts +14 -0
  98. package/dist/providers/compatibility.d.ts +4 -0
  99. package/dist/providers/index.d.ts +8 -0
  100. package/dist/providers/providers/anthropic.d.ts +1 -0
  101. package/dist/providers/providers/cloudflare.d.ts +1 -0
  102. package/dist/providers/providers/generated.d.ts +5 -0
  103. package/dist/providers/providers/openai.d.ts +1 -0
  104. package/dist/providers/providers/poe.d.ts +2 -0
  105. package/dist/providers/registry.d.ts +44 -0
  106. package/dist/providers/types.d.ts +54 -0
  107. package/dist/safe-fs/bridge/filesystem.d.ts +88 -0
  108. package/dist/safe-fs/bridge/index.d.ts +6 -0
  109. package/dist/safe-fs/bridge/types.d.ts +75 -0
  110. package/dist/safe-fs/config.d.ts +15 -0
  111. package/dist/safe-fs/config.node.d.ts +2 -0
  112. package/dist/safe-fs/contracts/errors.d.ts +50 -0
  113. package/dist/safe-fs/contracts/filesystem.d.ts +96 -0
  114. package/dist/safe-fs/contracts/index.d.ts +4 -0
  115. package/dist/safe-fs/contracts/io.d.ts +8 -0
  116. package/dist/safe-fs/contracts/path.d.ts +8 -0
  117. package/dist/safe-fs/contracts/portable-path.d.ts +13 -0
  118. package/dist/safe-fs/contracts/virtual-path.d.ts +7 -0
  119. package/dist/safe-fs/core.d.ts +12 -0
  120. package/dist/safe-fs/fs/memory/index.d.ts +58 -0
  121. package/dist/safe-fs/fs/mount/comparison.d.ts +19 -0
  122. package/dist/safe-fs/fs/mount/index.d.ts +44 -0
  123. package/dist/safe-fs/fs/overlay/index.d.ts +73 -0
  124. package/dist/safe-fs/fs/readonly/index.d.ts +31 -0
  125. package/dist/safe-fs/fs/real/index.d.ts +76 -0
  126. package/dist/safe-fs/fs/s3/filesystem.d.ts +93 -0
  127. package/dist/safe-fs/fs/s3/http/index.d.ts +2 -0
  128. package/dist/safe-fs/fs/s3/http/transport.d.ts +3 -0
  129. package/dist/safe-fs/fs/s3/http/types.d.ts +30 -0
  130. package/dist/safe-fs/fs/s3/index.d.ts +6 -0
  131. package/dist/safe-fs/fs/s3/mock.d.ts +48 -0
  132. package/dist/safe-fs/fs/s3/transport.d.ts +103 -0
  133. package/dist/safe-fs/fs/webdav/index.d.ts +2 -0
  134. package/dist/safe-fs/fs/webdav/webdav.d.ts +101 -0
  135. package/dist/safe-fs/index.d.ts +14 -0
  136. package/dist/safe-fs/node/filesystem.d.ts +11 -0
  137. package/dist/safe-fs/node/index.d.ts +2 -0
  138. package/dist/safe-fs/node-host.d.ts +1 -0
  139. package/dist/safe-fs/node-unavailable.d.ts +1 -0
  140. package/dist/safe-fs/platform/browser.d.ts +12 -0
  141. package/dist/safe-fs/platform/node.d.ts +13 -0
  142. package/dist/safe-js/browser/chunks/chunk-QGN6DKT5.js +4335 -0
  143. package/dist/safe-js/browser/chunks/chunk-QGN6DKT5.js.map +7 -0
  144. package/dist/safe-js/browser/safe-fs-core.js +67 -0
  145. package/dist/safe-js/browser/safe-fs-core.js.map +7 -0
  146. package/dist/safe-js/browser/safe-fs.js +67 -0
  147. package/dist/safe-js/browser/safe-fs.js.map +7 -0
  148. package/dist/safe-js/chunks/chunk-2QRYPKQQ.js +4315 -0
  149. package/dist/safe-js/chunks/chunk-2QRYPKQQ.js.map +7 -0
  150. package/dist/safe-js/chunks/chunk-4YIDX44G.js +40 -0
  151. package/dist/safe-js/chunks/chunk-4YIDX44G.js.map +7 -0
  152. package/dist/safe-js/chunks/chunk-7M2SJPSZ.js +2613 -0
  153. package/dist/safe-js/chunks/chunk-7M2SJPSZ.js.map +7 -0
  154. package/dist/safe-js/chunks/chunk-DC5B3GYM.js +8248 -0
  155. package/dist/safe-js/chunks/chunk-DC5B3GYM.js.map +7 -0
  156. package/dist/safe-js/chunks/chunk-Z3D76J4U.js +30732 -0
  157. package/dist/safe-js/chunks/chunk-Z3D76J4U.js.map +7 -0
  158. package/dist/safe-js/cli.d.ts +36 -0
  159. package/dist/safe-js/cli.js +724 -0
  160. package/dist/safe-js/cli.js.map +7 -0
  161. package/dist/safe-js/core.d.ts +6 -0
  162. package/dist/safe-js/core.js +14 -0
  163. package/dist/safe-js/core.js.map +7 -0
  164. package/dist/safe-js/dump.d.ts +2 -0
  165. package/dist/safe-js/error/format.d.ts +15 -0
  166. package/dist/safe-js/error/shape.d.ts +28 -0
  167. package/dist/safe-js/index.d.ts +56 -0
  168. package/dist/safe-js/index.js +454 -0
  169. package/dist/safe-js/index.js.map +7 -0
  170. package/dist/safe-js/interp/arguments.d.ts +10 -0
  171. package/dist/safe-js/interp/async.d.ts +56 -0
  172. package/dist/safe-js/interp/budget.d.ts +95 -0
  173. package/dist/safe-js/interp/exceptions.d.ts +45 -0
  174. package/dist/safe-js/interp/generator.d.ts +16 -0
  175. package/dist/safe-js/interp/globals/console-json.d.ts +14 -0
  176. package/dist/safe-js/interp/host-bridge.d.ts +29 -0
  177. package/dist/safe-js/interp/host-call.d.ts +130 -0
  178. package/dist/safe-js/interp/interpreter.d.ts +63 -0
  179. package/dist/safe-js/interp/promise-replay.d.ts +70 -0
  180. package/dist/safe-js/interp/regex/compile-guard.d.ts +33 -0
  181. package/dist/safe-js/interp/regex/parse.d.ts +62 -0
  182. package/dist/safe-js/interp/scope.d.ts +43 -0
  183. package/dist/safe-js/interp/values.d.ts +136 -0
  184. package/dist/safe-js/lint/index.d.ts +38 -0
  185. package/dist/safe-js/lint/rules/AS-export-import-meta.d.ts +21 -0
  186. package/dist/safe-js/lint/rules/module-registry.d.ts +33 -0
  187. package/dist/safe-js/lint.d.ts +1 -0
  188. package/dist/safe-js/loader/extract-block.d.ts +10 -0
  189. package/dist/safe-js/loader/find-exported.d.ts +2 -0
  190. package/dist/safe-js/loader/frontmatter.d.ts +5 -0
  191. package/dist/safe-js/migrate.d.ts +33 -0
  192. package/dist/safe-js/migration-file.d.ts +55 -0
  193. package/dist/safe-js/modules/agent.d.ts +132 -0
  194. package/dist/safe-js/modules/env.d.ts +14 -0
  195. package/dist/safe-js/modules/fail.d.ts +6 -0
  196. package/dist/safe-js/modules/fs-config.d.ts +12 -0
  197. package/dist/safe-js/modules/fs.d.ts +82 -0
  198. package/dist/safe-js/modules/harness.d.ts +19 -0
  199. package/dist/safe-js/modules/log.d.ts +16 -0
  200. package/dist/safe-js/modules/mcp-transport.d.ts +26 -0
  201. package/dist/safe-js/modules/mcp.d.ts +63 -0
  202. package/dist/safe-js/modules/metric.d.ts +4 -0
  203. package/dist/safe-js/modules/registry.d.ts +16 -0
  204. package/dist/safe-js/modules/time.d.ts +12 -0
  205. package/dist/safe-js/observability/otel.d.ts +21 -0
  206. package/dist/safe-js/output-stream.d.ts +12 -0
  207. package/dist/safe-js/parse/parse-export.d.ts +36 -0
  208. package/dist/safe-js/parse/parser.d.ts +356 -0
  209. package/dist/safe-js/parse/tokenizer.d.ts +26 -0
  210. package/dist/safe-js/parse.d.ts +4 -0
  211. package/dist/safe-js/random.d.ts +9 -0
  212. package/dist/safe-js/restore.d.ts +26 -0
  213. package/dist/safe-js/run.d.ts +74 -0
  214. package/dist/safe-js/runner/run-harness.d.ts +32 -0
  215. package/dist/safe-js/safe-fs-core.js +130 -0
  216. package/dist/safe-js/safe-fs-core.js.map +7 -0
  217. package/dist/safe-js/safe-fs-node.js +94 -0
  218. package/dist/safe-js/safe-fs-node.js.map +7 -0
  219. package/dist/safe-js/safe-fs.js +94 -0
  220. package/dist/safe-js/safe-fs.js.map +7 -0
  221. package/dist/safe-js/snapshot/arguments.d.ts +17 -0
  222. package/dist/safe-js/snapshot/backend.d.ts +19 -0
  223. package/dist/safe-js/snapshot/dump-format.d.ts +7 -0
  224. package/dist/safe-js/snapshot/dump.d.ts +23 -0
  225. package/dist/safe-js/snapshot/float32array.d.ts +12 -0
  226. package/dist/safe-js/snapshot/migration.d.ts +35 -0
  227. package/dist/safe-js/snapshot/policy.d.ts +49 -0
  228. package/dist/safe-js/snapshot/replay-data.d.ts +71 -0
  229. package/dist/safe-js/snapshot/validation.d.ts +15 -0
  230. package/dist/task-list/backends/gh-issues-client.d.ts +19 -0
  231. package/dist/task-list/backends/gh-issues-sync.d.ts +46 -0
  232. package/dist/task-list/backends/gh-issues.d.ts +21 -0
  233. package/dist/task-list/index.d.ts +9 -0
  234. package/dist/task-list/move.d.ts +2 -0
  235. package/dist/task-list/open.d.ts +5 -0
  236. package/dist/task-list/state-machine.d.ts +16 -0
  237. package/dist/task-list/state.d.ts +29 -0
  238. package/dist/task-list/types.d.ts +206 -0
  239. package/dist/tiny-mcp-client/index.d.ts +662 -0
  240. package/dist/tiny-stdio-mcp-server/content/audio.d.ts +15 -0
  241. package/dist/tiny-stdio-mcp-server/content/convert.d.ts +16 -0
  242. package/dist/tiny-stdio-mcp-server/content/file-type.d.ts +11 -0
  243. package/dist/tiny-stdio-mcp-server/content/file.d.ts +28 -0
  244. package/dist/tiny-stdio-mcp-server/content/image.d.ts +15 -0
  245. package/dist/tiny-stdio-mcp-server/content/index.d.ts +7 -0
  246. package/dist/tiny-stdio-mcp-server/content/mime.d.ts +7 -0
  247. package/dist/tiny-stdio-mcp-server/content/remote.d.ts +5 -0
  248. package/dist/tiny-stdio-mcp-server/index.d.ts +9 -0
  249. package/dist/tiny-stdio-mcp-server/schema.d.ts +20 -0
  250. package/dist/tiny-stdio-mcp-server/server.d.ts +35 -0
  251. package/dist/tiny-stdio-mcp-server/types.d.ts +247 -0
  252. package/dist/toolcraft-design/acp/components.d.ts +19 -0
  253. package/dist/toolcraft-design/acp/index.d.ts +4 -0
  254. package/dist/toolcraft-design/acp/writer.d.ts +13 -0
  255. package/dist/toolcraft-design/components/browser.d.ts +15 -0
  256. package/dist/toolcraft-design/components/catalog.d.ts +26 -0
  257. package/dist/toolcraft-design/components/color.d.ts +31 -0
  258. package/dist/toolcraft-design/components/command-errors.d.ts +18 -0
  259. package/dist/toolcraft-design/components/detail-card.d.ts +22 -0
  260. package/dist/toolcraft-design/components/file-changes.d.ts +16 -0
  261. package/dist/toolcraft-design/components/help-formatter-plain.d.ts +5 -0
  262. package/dist/toolcraft-design/components/help-formatter.d.ts +50 -0
  263. package/dist/toolcraft-design/components/inspector-card.d.ts +21 -0
  264. package/dist/toolcraft-design/components/logger.d.ts +11 -0
  265. package/dist/toolcraft-design/components/resource-browser.d.ts +21 -0
  266. package/dist/toolcraft-design/components/symbols.d.ts +12 -0
  267. package/dist/toolcraft-design/components/table.d.ts +16 -0
  268. package/dist/toolcraft-design/components/template.d.ts +19 -0
  269. package/dist/toolcraft-design/components/text.d.ts +16 -0
  270. package/dist/toolcraft-design/dashboard/buffer.d.ts +25 -0
  271. package/dist/toolcraft-design/dashboard/components/footer.d.ts +8 -0
  272. package/dist/toolcraft-design/dashboard/dashboard.d.ts +20 -0
  273. package/dist/toolcraft-design/dashboard/index.d.ts +8 -0
  274. package/dist/toolcraft-design/dashboard/should-use-dashboard.d.ts +10 -0
  275. package/dist/toolcraft-design/dashboard/snapshot.d.ts +10 -0
  276. package/dist/toolcraft-design/dashboard/terminal.d.ts +37 -0
  277. package/dist/toolcraft-design/dashboard/types.d.ts +38 -0
  278. package/dist/toolcraft-design/explorer/events.d.ts +77 -0
  279. package/dist/toolcraft-design/explorer/index.d.ts +8 -0
  280. package/dist/toolcraft-design/explorer/keymap.d.ts +31 -0
  281. package/dist/toolcraft-design/explorer/runtime.d.ts +2 -0
  282. package/dist/toolcraft-design/explorer/state.d.ts +224 -0
  283. package/dist/toolcraft-design/index.d.ts +62 -0
  284. package/dist/toolcraft-design/internal/output-format.d.ts +6 -0
  285. package/dist/toolcraft-design/internal/strip-ansi.d.ts +1 -0
  286. package/dist/toolcraft-design/internal/theme-detect.d.ts +12 -0
  287. package/dist/toolcraft-design/internal/theme-state.d.ts +12 -0
  288. package/dist/toolcraft-design/prompts/index.d.ts +91 -0
  289. package/dist/toolcraft-design/prompts/interactive/cancel-symbol.d.ts +2 -0
  290. package/dist/toolcraft-design/prompts/interactive/select.d.ts +18 -0
  291. package/dist/toolcraft-design/prompts/primitives/cancel.d.ts +2 -0
  292. package/dist/toolcraft-design/prompts/primitives/intro.d.ts +1 -0
  293. package/dist/toolcraft-design/prompts/primitives/log.d.ts +18 -0
  294. package/dist/toolcraft-design/prompts/primitives/note.d.ts +1 -0
  295. package/dist/toolcraft-design/prompts/primitives/outro.d.ts +1 -0
  296. package/dist/toolcraft-design/prompts/primitives/spinner.d.ts +6 -0
  297. package/dist/toolcraft-design/prompts/theme.d.ts +11 -0
  298. package/dist/toolcraft-design/screen/screen.d.ts +40 -0
  299. package/dist/toolcraft-design/screen/style.d.ts +16 -0
  300. package/dist/toolcraft-design/static/index.d.ts +4 -0
  301. package/dist/toolcraft-design/static/menu.d.ts +11 -0
  302. package/dist/toolcraft-design/static/spinner.d.ts +14 -0
  303. package/dist/toolcraft-design/terminal/driver.d.ts +34 -0
  304. package/dist/toolcraft-design/terminal/input.d.ts +25 -0
  305. package/dist/toolcraft-design/terminal-markdown/ast.d.ts +98 -0
  306. package/dist/toolcraft-design/terminal-markdown/html-renderer.d.ts +7 -0
  307. package/dist/toolcraft-design/terminal-markdown/index.d.ts +12 -0
  308. package/dist/toolcraft-design/terminal-markdown/parser.d.ts +5 -0
  309. package/dist/toolcraft-design/terminal-markdown/plaintext-renderer.d.ts +11 -0
  310. package/dist/toolcraft-design/terminal-markdown/renderer.d.ts +7 -0
  311. package/dist/toolcraft-design/tokens/brand.d.ts +5 -0
  312. package/dist/toolcraft-design/tokens/colors.d.ts +37 -0
  313. package/dist/toolcraft-design/tokens/index.d.ts +6 -0
  314. package/dist/toolcraft-design/tokens/spacing.d.ts +6 -0
  315. package/dist/toolcraft-design/tokens/typography.d.ts +7 -0
  316. package/dist/toolcraft-design/tokens/widths.d.ts +5 -0
  317. package/dist/toolcraft-schema/index.d.ts +184 -0
  318. package/dist/toolcraft-schema/json-schema/index.d.ts +5 -0
  319. package/dist/toolcraft-schema/json-schema/types.d.ts +33 -0
  320. package/dist/toolcraft-schema/json-schema-document.d.ts +14 -0
  321. package/dist/toolcraft-schema/json.d.ts +10 -0
  322. package/dist/toolcraft-schema/oneof.d.ts +15 -0
  323. package/dist/toolcraft-schema/record.d.ts +5 -0
  324. package/dist/toolcraft-schema/union.d.ts +8 -0
  325. package/dist/toolcraft-schema/validate.d.ts +17 -0
  326. package/package.json +89 -0
@@ -0,0 +1,63 @@
1
+ import { type McpModuleOptions } from "./mcp-transport.js";
2
+ export type McpModuleServerHandle = {
3
+ command: string;
4
+ args?: string[];
5
+ env?: Record<string, string>;
6
+ };
7
+ export type McpModuleTool = {
8
+ name: string;
9
+ description?: string;
10
+ schema?: unknown;
11
+ };
12
+ export type McpModuleToolCall = {
13
+ name: string;
14
+ args?: unknown;
15
+ };
16
+ export type McpModuleToolBatchError = {
17
+ name: string;
18
+ message: string;
19
+ };
20
+ export type McpModuleToolBatchResult = {
21
+ ok: true;
22
+ value: unknown;
23
+ } | {
24
+ ok: false;
25
+ error: McpModuleToolBatchError;
26
+ };
27
+ export type McpModuleClient = {
28
+ tools(): Promise<McpModuleTool[]>;
29
+ tool(name: string, args?: unknown): Promise<unknown>;
30
+ toolBatch(calls: McpModuleToolCall[]): Promise<McpModuleToolBatchResult[]>;
31
+ };
32
+ type McpConnection = {
33
+ listTools(): Promise<{
34
+ tools: unknown[];
35
+ }>;
36
+ callTool(params: {
37
+ name: string;
38
+ arguments?: unknown;
39
+ }): Promise<unknown>;
40
+ callToolBatch?(params: Array<{
41
+ name: string;
42
+ arguments?: unknown;
43
+ }>): Promise<McpModuleToolBatchResult[]>;
44
+ };
45
+ export type ConnectMcp = (server: McpModuleServerHandle) => Promise<McpConnection> | McpConnection;
46
+ export type McpNamedServerHandle = {
47
+ name: string;
48
+ };
49
+ export type ManagedMcpClient = McpModuleClient & {
50
+ close(): Promise<void>;
51
+ };
52
+ export type ManagedMcpModule = {
53
+ servers: Record<string, ManagedMcpClient>;
54
+ server(name: string): McpNamedServerHandle;
55
+ client(handle: McpNamedServerHandle | string): Promise<ManagedMcpClient>;
56
+ };
57
+ type CustomMcpModule = {
58
+ server(server: McpModuleServerHandle): McpModuleServerHandle;
59
+ client(handle: McpModuleServerHandle): Promise<McpModuleClient>;
60
+ };
61
+ export declare function makeMcpModule(options: McpModuleOptions): ManagedMcpModule;
62
+ export declare function makeMcpModule(connectMcp: ConnectMcp): CustomMcpModule;
63
+ export {};
@@ -0,0 +1,4 @@
1
+ export type NpmRunner = (scriptName: string) => Promise<string>;
2
+ export declare function makeMetricModule(npmRunner: NpmRunner): {
3
+ run(name: string): Promise<number>;
4
+ };
@@ -0,0 +1,16 @@
1
+ import type { Budget, CompileOwner } from "../interp/budget.js";
2
+ import type { HostCallJournal } from "../interp/host-call.js";
3
+ import { type CallerInjectedBinding } from "../interp/host-bridge.js";
4
+ import type { SandboxValue } from "../interp/values.js";
5
+ import type { Module } from "../parse/parser.js";
6
+ export type ModuleExports = ReadonlyMap<string, CallerInjectedBinding> | Record<string, CallerInjectedBinding>;
7
+ export type ModuleRegistry = ReadonlyMap<string, ModuleExports> | Record<string, ModuleExports>;
8
+ export declare function createUnknownModuleMessage(moduleName: string, moduleNames: readonly string[]): string;
9
+ export declare function createUnknownExportMessage(moduleName: string, exportName: string, availableExports: readonly string[]): string;
10
+ export declare function resolveModuleImports(module: Module, modules: ModuleRegistry | undefined, options: {
11
+ budget: Budget;
12
+ compileOwner?: CompileOwner;
13
+ hostCalls?: HostCallJournal;
14
+ signal?: AbortSignal;
15
+ allowMissing?: boolean;
16
+ }): Record<string, SandboxValue>;
@@ -0,0 +1,12 @@
1
+ export type TimeModuleOptions = {
2
+ now?: () => number;
3
+ random?: () => number;
4
+ seed?: number;
5
+ signal?: AbortSignal;
6
+ };
7
+ export declare function makeTimeModule(options?: TimeModuleOptions): {
8
+ random: () => number;
9
+ now: () => number;
10
+ sleep: (ms: number) => Promise<void>;
11
+ uuid: () => string;
12
+ };
@@ -0,0 +1,21 @@
1
+ export type OtelSpan = {
2
+ setAttribute(key: string, value: unknown): void;
3
+ addEvent(name: string, attrs: Record<string, unknown>): void;
4
+ end(): void;
5
+ };
6
+ export interface OtelSink {
7
+ startSpan(name: string, attrs: Record<string, unknown>): OtelSpan;
8
+ recordException(span: ReturnType<OtelSink["startSpan"]>, error: unknown): void;
9
+ }
10
+ export declare const noopOtelSink: OtelSink;
11
+ export declare function bindOtelSpan(value: object, span: OtelSpan): void;
12
+ export declare function getBoundOtelSpan(value: unknown): OtelSpan | undefined;
13
+ export declare function activateOtelSpan(span: OtelSpan): () => void;
14
+ export declare function getActiveOtelSpan(): OtelSpan | undefined;
15
+ export declare function activateOtelSink(sink: OtelSink | undefined): () => void;
16
+ export declare function getActiveOtelSink(): OtelSink | undefined;
17
+ export declare function safeStartSpan(sink: OtelSink | undefined, name: string, attrs: Record<string, unknown>): OtelSpan;
18
+ export declare function safeSetAttribute(span: OtelSpan, key: string, value: unknown): void;
19
+ export declare function safeAddEvent(span: OtelSpan | undefined, name: string, attrs?: Record<string, unknown>): void;
20
+ export declare function safeRecordException(sink: OtelSink | undefined, span: OtelSpan, error: unknown): void;
21
+ export declare function safeEndSpan(span: OtelSpan): void;
@@ -0,0 +1,12 @@
1
+ export type OutputStream = {
2
+ off?(event: "error", listener: (error: unknown) => void): void;
3
+ on?(event: "error", listener: (error: unknown) => void): void;
4
+ write(chunk: string): void;
5
+ };
6
+ export type BrokenPipeState = {
7
+ closed: boolean;
8
+ };
9
+ export declare function createBrokenPipeState(): BrokenPipeState;
10
+ export declare function createSafeOutputStream(stream: OutputStream, brokenPipe: BrokenPipeState): OutputStream;
11
+ export declare function withBrokenPipeGuard<TResult>(streams: readonly OutputStream[], brokenPipe: BrokenPipeState, callback: () => Promise<TResult>): Promise<TResult>;
12
+ export declare function addBrokenPipeListener(stream: OutputStream, brokenPipe: BrokenPipeState): () => void;
@@ -0,0 +1,36 @@
1
+ import type { Token } from "./tokenizer.js";
2
+ import type { Expression, Module, SourceSpan, VariableDeclaration, VariableDeclarator } from "./parser.js";
3
+ export type ExportNamedDeclaration = {
4
+ nodeId?: number;
5
+ type: "ExportNamedDeclaration";
6
+ declaration: VariableDeclaration;
7
+ span: SourceSpan;
8
+ };
9
+ export type ExportDefaultDeclaration = {
10
+ nodeId?: number;
11
+ type: "ExportDefaultDeclaration";
12
+ declaration: Expression;
13
+ span: SourceSpan;
14
+ };
15
+ export type ExtractedNamedExport = {
16
+ type: "named";
17
+ name: string;
18
+ declaration: VariableDeclarator;
19
+ statement: ExportNamedDeclaration;
20
+ span: SourceSpan;
21
+ };
22
+ export type ExtractedDefaultExport = {
23
+ type: "default";
24
+ name: "default";
25
+ declaration: Expression;
26
+ statement: ExportDefaultDeclaration;
27
+ span: SourceSpan;
28
+ };
29
+ export type ExtractedTopLevelExport = ExtractedDefaultExport | ExtractedNamedExport;
30
+ export declare class ExportExtractionError extends Error {
31
+ readonly span?: SourceSpan;
32
+ constructor(message: string, span?: SourceSpan);
33
+ }
34
+ export declare function extractTopLevelExports(module: Module): ExtractedTopLevelExport[];
35
+ export declare function createExportNamedDeclaration(exportToken: Token, declaration: VariableDeclaration): ExportNamedDeclaration;
36
+ export declare function createExportDefaultDeclaration(exportToken: Token, declaration: Expression): ExportDefaultDeclaration;
@@ -0,0 +1,356 @@
1
+ import { type Position } from "./tokenizer.js";
2
+ import { type ExportDefaultDeclaration, type ExportNamedDeclaration } from "./parse-export.js";
3
+ import { type CompileOwner } from "../interp/budget.js";
4
+ export type { ExportDefaultDeclaration, ExportNamedDeclaration } from "./parse-export.js";
5
+ export type SourceSpan = {
6
+ start: Position;
7
+ end: Position;
8
+ };
9
+ export declare class DisallowedSyntaxError extends Error {
10
+ constructor(syntax: string, position: Position);
11
+ }
12
+ type BaseNode = {
13
+ nodeId?: number;
14
+ type: string;
15
+ span: SourceSpan;
16
+ };
17
+ export type Identifier = BaseNode & {
18
+ type: "Identifier";
19
+ name: string;
20
+ };
21
+ export type ThisExpression = BaseNode & {
22
+ type: "ThisExpression";
23
+ };
24
+ export type NumericLiteral = BaseNode & {
25
+ type: "NumericLiteral";
26
+ raw: string;
27
+ value: number;
28
+ };
29
+ export type StringLiteral = BaseNode & {
30
+ type: "StringLiteral";
31
+ raw: string;
32
+ value: string;
33
+ };
34
+ export type RegexLiteral = BaseNode & {
35
+ type: "RegexLiteral";
36
+ raw: string;
37
+ };
38
+ export type BooleanLiteral = BaseNode & {
39
+ type: "BooleanLiteral";
40
+ raw: "true" | "false";
41
+ value: boolean;
42
+ };
43
+ export type NullLiteral = BaseNode & {
44
+ type: "NullLiteral";
45
+ raw: "null";
46
+ value: null;
47
+ };
48
+ export type UndefinedLiteral = BaseNode & {
49
+ type: "UndefinedLiteral";
50
+ raw: "undefined";
51
+ value: undefined;
52
+ elision?: true;
53
+ };
54
+ export type TemplateElement = BaseNode & {
55
+ type: "TemplateElement";
56
+ tail: boolean;
57
+ value: {
58
+ raw: string;
59
+ cooked: string | undefined;
60
+ };
61
+ };
62
+ export type TemplateLiteral = BaseNode & {
63
+ type: "TemplateLiteral";
64
+ expressions: Expression[];
65
+ quasis: TemplateElement[];
66
+ };
67
+ export type TaggedTemplateExpression = BaseNode & {
68
+ type: "TaggedTemplateExpression";
69
+ tag: Expression;
70
+ quasi: TemplateLiteral;
71
+ };
72
+ export type SpreadElement = BaseNode & {
73
+ type: "SpreadElement";
74
+ argument: Expression;
75
+ };
76
+ export type Property = BaseNode & {
77
+ type: "Property";
78
+ computed: boolean;
79
+ shorthand: boolean;
80
+ key: Expression;
81
+ value: Expression;
82
+ };
83
+ export type PatternTarget = ArrayPattern | Identifier | MemberExpression | ObjectPattern;
84
+ export type AssignmentTarget = MetaProperty | PatternTarget;
85
+ export type UpdateTarget = Identifier | MemberExpression;
86
+ export type AssignmentPattern = BaseNode & {
87
+ type: "AssignmentPattern";
88
+ left: PatternTarget;
89
+ right: Expression;
90
+ };
91
+ export type RestElement = BaseNode & {
92
+ type: "RestElement";
93
+ argument: PatternTarget;
94
+ };
95
+ export type AssignmentProperty = BaseNode & {
96
+ type: "AssignmentProperty";
97
+ computed: boolean;
98
+ shorthand: boolean;
99
+ key: Expression;
100
+ value: AssignmentPattern | ArrayPattern | Identifier | MemberExpression | ObjectPattern;
101
+ };
102
+ export type ArrayPattern = BaseNode & {
103
+ type: "ArrayPattern";
104
+ elements: Array<AssignmentPattern | ArrayPattern | Identifier | MemberExpression | ObjectPattern | RestElement | null>;
105
+ };
106
+ export type ObjectPattern = BaseNode & {
107
+ type: "ObjectPattern";
108
+ properties: Array<AssignmentProperty | RestElement>;
109
+ };
110
+ export type ArrayExpression = BaseNode & {
111
+ type: "ArrayExpression";
112
+ elements: Array<Expression | SpreadElement>;
113
+ };
114
+ export type ObjectExpression = BaseNode & {
115
+ type: "ObjectExpression";
116
+ properties: Array<Property | SpreadElement>;
117
+ };
118
+ export type UnaryOperator = "!" | "+" | "-" | "~" | "delete" | "typeof" | "void";
119
+ export type UnaryExpression = BaseNode & {
120
+ type: "UnaryExpression";
121
+ operator: UnaryOperator;
122
+ prefix: true;
123
+ argument: Expression;
124
+ };
125
+ export type UpdateOperator = "++" | "--";
126
+ export type UpdateExpression = BaseNode & {
127
+ type: "UpdateExpression";
128
+ operator: UpdateOperator;
129
+ prefix: boolean;
130
+ argument: UpdateTarget;
131
+ };
132
+ export type AwaitExpression = BaseNode & {
133
+ type: "AwaitExpression";
134
+ argument: Expression;
135
+ };
136
+ export type YieldExpression = BaseNode & {
137
+ type: "YieldExpression";
138
+ argument?: Expression;
139
+ delegate: boolean;
140
+ };
141
+ export type BinaryOperator = "!=" | "!==" | "%" | "&" | "*" | "**" | "+" | "-" | "/" | "<" | "<<" | "<=" | "==" | "===" | ">" | ">=" | ">>" | ">>>" | "instanceof" | "in" | "^" | "|";
142
+ export type BinaryExpression = BaseNode & {
143
+ type: "BinaryExpression";
144
+ operator: BinaryOperator;
145
+ left: Expression;
146
+ right: Expression;
147
+ };
148
+ export type LogicalOperator = "&&" | "??" | "||";
149
+ export type LogicalExpression = BaseNode & {
150
+ type: "LogicalExpression";
151
+ operator: LogicalOperator;
152
+ left: Expression;
153
+ right: Expression;
154
+ };
155
+ export type ConditionalExpression = BaseNode & {
156
+ type: "ConditionalExpression";
157
+ test: Expression;
158
+ consequent: Expression;
159
+ alternate: Expression;
160
+ };
161
+ export type SequenceExpression = BaseNode & {
162
+ type: "SequenceExpression";
163
+ expressions: Expression[];
164
+ };
165
+ export type MemberExpression = BaseNode & {
166
+ type: "MemberExpression";
167
+ computed: boolean;
168
+ object: Expression;
169
+ optional: boolean;
170
+ property: Expression;
171
+ };
172
+ export type MetaProperty = BaseNode & {
173
+ type: "MetaProperty";
174
+ meta: Identifier & {
175
+ name: "import";
176
+ };
177
+ property: Identifier & {
178
+ name: "meta";
179
+ };
180
+ };
181
+ export type AssignmentOperator = "=" | "+=" | "-=" | "*=" | "/=" | "%=" | "**=" | "&=" | "|=" | "^=" | "<<=" | ">>=" | ">>>=" | "&&=" | "||=" | "??=";
182
+ export type AssignmentExpression = BaseNode & {
183
+ type: "AssignmentExpression";
184
+ operator: AssignmentOperator;
185
+ left: AssignmentTarget;
186
+ right: Expression;
187
+ };
188
+ export type CallExpression = BaseNode & {
189
+ type: "CallExpression";
190
+ arguments: Array<Expression | SpreadElement>;
191
+ callee: Expression;
192
+ optional: boolean;
193
+ };
194
+ export type NewExpression = BaseNode & {
195
+ type: "NewExpression";
196
+ arguments: Array<Expression | SpreadElement>;
197
+ callee: Expression;
198
+ };
199
+ export type VariableDeclarator = BaseNode & {
200
+ type: "VariableDeclarator";
201
+ id: ArrayPattern | Identifier | ObjectPattern;
202
+ init?: Expression;
203
+ };
204
+ export type VariableDeclarationKind = "const" | "let" | "var";
205
+ export type VariableDeclaration = BaseNode & {
206
+ type: "VariableDeclaration";
207
+ declarations: VariableDeclarator[];
208
+ kind: VariableDeclarationKind;
209
+ };
210
+ export type ReturnStatement = BaseNode & {
211
+ type: "ReturnStatement";
212
+ argument?: Expression;
213
+ };
214
+ export type BreakStatement = BaseNode & {
215
+ type: "BreakStatement";
216
+ label?: string;
217
+ };
218
+ export type ContinueStatement = BaseNode & {
219
+ type: "ContinueStatement";
220
+ label?: string;
221
+ };
222
+ export type ExpressionStatement = BaseNode & {
223
+ type: "ExpressionStatement";
224
+ expression: Expression;
225
+ };
226
+ export type EmptyStatement = BaseNode & {
227
+ type: "EmptyStatement";
228
+ };
229
+ export type BlockStatement = BaseNode & {
230
+ type: "BlockStatement";
231
+ body: Statement[];
232
+ };
233
+ export type FunctionDeclaration = BaseNode & {
234
+ type: "FunctionDeclaration";
235
+ async: boolean;
236
+ body: BlockStatement;
237
+ generator: boolean;
238
+ id: Identifier;
239
+ params: ArrowFunctionExpression["params"];
240
+ };
241
+ export type FunctionExpression = BaseNode & {
242
+ type: "FunctionExpression";
243
+ async: boolean;
244
+ body: BlockStatement;
245
+ generator: boolean;
246
+ id?: Identifier;
247
+ method?: true;
248
+ params: ArrowFunctionExpression["params"];
249
+ };
250
+ export type IfStatement = BaseNode & {
251
+ type: "IfStatement";
252
+ test: Expression;
253
+ consequent: Statement;
254
+ alternate?: Statement;
255
+ };
256
+ export type ForStatement = BaseNode & {
257
+ type: "ForStatement";
258
+ init?: Expression | VariableDeclaration;
259
+ test?: Expression;
260
+ update?: Expression;
261
+ body: Statement;
262
+ label?: string;
263
+ labels?: string[];
264
+ };
265
+ export type ForOfStatement = BaseNode & {
266
+ type: "ForOfStatement";
267
+ left: PatternTarget | VariableDeclaration;
268
+ right: Expression;
269
+ body: Statement;
270
+ label?: string;
271
+ labels?: string[];
272
+ };
273
+ export type ForInStatement = BaseNode & {
274
+ type: "ForInStatement";
275
+ left: Identifier | VariableDeclaration;
276
+ right: Expression;
277
+ body: Statement;
278
+ label?: string;
279
+ labels?: string[];
280
+ };
281
+ export type WhileStatement = BaseNode & {
282
+ type: "WhileStatement";
283
+ test: Expression;
284
+ body: Statement;
285
+ label?: string;
286
+ labels?: string[];
287
+ };
288
+ export type DoWhileStatement = BaseNode & {
289
+ type: "DoWhileStatement";
290
+ body: Statement;
291
+ test: Expression;
292
+ label?: string;
293
+ labels?: string[];
294
+ };
295
+ export type ThrowStatement = BaseNode & {
296
+ type: "ThrowStatement";
297
+ argument: Expression;
298
+ };
299
+ export type CatchClause = BaseNode & {
300
+ type: "CatchClause";
301
+ param?: ArrayPattern | Identifier | ObjectPattern;
302
+ body: BlockStatement;
303
+ };
304
+ export type TryStatement = BaseNode & {
305
+ type: "TryStatement";
306
+ block: BlockStatement;
307
+ handler?: CatchClause;
308
+ finalizer?: BlockStatement;
309
+ };
310
+ export type SwitchCase = BaseNode & {
311
+ type: "SwitchCase";
312
+ test?: Expression;
313
+ consequent: Statement[];
314
+ };
315
+ export type SwitchStatement = BaseNode & {
316
+ type: "SwitchStatement";
317
+ discriminant: Expression;
318
+ cases: SwitchCase[];
319
+ };
320
+ export type ImportSpecifier = BaseNode & {
321
+ type: "ImportSpecifier";
322
+ imported: Identifier;
323
+ local: Identifier;
324
+ };
325
+ export type ImportDefaultSpecifier = BaseNode & {
326
+ type: "ImportDefaultSpecifier";
327
+ local: Identifier;
328
+ };
329
+ export type ImportNamespaceSpecifier = BaseNode & {
330
+ type: "ImportNamespaceSpecifier";
331
+ local: Identifier;
332
+ };
333
+ export type ImportDeclaration = BaseNode & {
334
+ type: "ImportDeclaration";
335
+ specifiers: Array<ImportDefaultSpecifier | ImportNamespaceSpecifier | ImportSpecifier>;
336
+ source: StringLiteral;
337
+ };
338
+ export type Module = BaseNode & {
339
+ type: "Module";
340
+ body: Statement[];
341
+ };
342
+ export type Statement = BlockStatement | BreakStatement | DoWhileStatement | ExportDefaultDeclaration | ExportNamedDeclaration | ImportDeclaration | TryStatement | ContinueStatement | EmptyStatement | ExpressionStatement | FunctionDeclaration | ForInStatement | ForOfStatement | ForStatement | IfStatement | ReturnStatement | SwitchStatement | ThrowStatement | VariableDeclaration | WhileStatement;
343
+ export type ArrowFunctionExpression = BaseNode & {
344
+ type: "ArrowFunctionExpression";
345
+ async: boolean;
346
+ body: BlockStatement | Expression;
347
+ expression: boolean;
348
+ params: Array<AssignmentPattern | ArrayPattern | Identifier | ObjectPattern | RestElement>;
349
+ };
350
+ export type FunctionNode = ArrowFunctionExpression | FunctionDeclaration | FunctionExpression;
351
+ export type Expression = ArrowFunctionExpression | AssignmentExpression | ArrayExpression | AwaitExpression | BinaryExpression | BooleanLiteral | CallExpression | ConditionalExpression | FunctionExpression | Identifier | LogicalExpression | MemberExpression | MetaProperty | NewExpression | NullLiteral | NumericLiteral | ObjectExpression | RegexLiteral | SequenceExpression | StringLiteral | TaggedTemplateExpression | TemplateLiteral | ThisExpression | UnaryExpression | UpdateExpression | UndefinedLiteral | YieldExpression;
352
+ export type ParseResult = Expression | Statement;
353
+ export declare function parse(source: string, filename?: string, owner?: CompileOwner): ParseResult;
354
+ export declare function parseModule(source: string, filename?: string, owner?: CompileOwner): Module;
355
+ export declare function parseExecutableModule(source: string, filename?: string, owner?: CompileOwner): Module;
356
+ export declare function findRegexLiteral(node: unknown): RegexLiteral | undefined;
@@ -0,0 +1,26 @@
1
+ import { type CompileScope } from "../interp/regex/compile-guard.js";
2
+ export type Position = {
3
+ line: number;
4
+ column: number;
5
+ offset: number;
6
+ };
7
+ export type TokenType = "identifier" | "keyword" | "numeric" | "regex" | "string" | "template" | "punctuator" | "eof";
8
+ export type Token = {
9
+ type: TokenType;
10
+ value: string;
11
+ start: Position;
12
+ end: Position;
13
+ };
14
+ export type Comment = {
15
+ type: "block" | "line";
16
+ value: string;
17
+ start: Position;
18
+ end: Position;
19
+ };
20
+ export type TokenizeOptions = {
21
+ allowRegexLiterals?: boolean;
22
+ comments?: Comment[];
23
+ compilation?: CompileScope;
24
+ };
25
+ export declare function tokenize(source: string, options?: TokenizeOptions): Token[];
26
+ export declare function collectComments(source: string): Comment[];
@@ -0,0 +1,4 @@
1
+ import { type ParseResult as ParsedNode } from "./parse/parser.js";
2
+ export { DisallowedSyntaxError } from "./parse/parser.js";
3
+ export declare const parse: (source: string, filename?: string) => ParsedNode;
4
+ export type { ArrayPattern, ArrayExpression, ArrowFunctionExpression, AssignmentExpression, AssignmentPattern, AssignmentProperty, AwaitExpression, BinaryExpression, BlockStatement, BooleanLiteral, BreakStatement, CallExpression, CatchClause, ConditionalExpression, ContinueStatement, DoWhileStatement, EmptyStatement, Expression, ExpressionStatement, ExportDefaultDeclaration, ExportNamedDeclaration, ImportDeclaration, ImportDefaultSpecifier, ImportNamespaceSpecifier, ImportSpecifier, ForInStatement, ForOfStatement, ForStatement, FunctionDeclaration, FunctionExpression, Identifier, IfStatement, LogicalExpression, MemberExpression, MetaProperty, NewExpression, NullLiteral, NumericLiteral, ObjectExpression, ObjectPattern, ParseResult, PatternTarget, Property, RegexLiteral, RestElement, ReturnStatement, SequenceExpression, SourceSpan, SpreadElement, Statement, StringLiteral, SwitchCase, SwitchStatement, TaggedTemplateExpression, TemplateElement, TemplateLiteral, ThisExpression, ThrowStatement, TryStatement, UnaryExpression, UndefinedLiteral, UpdateExpression, UpdateTarget, VariableDeclaration, VariableDeclarationKind, VariableDeclarator, WhileStatement } from "./parse/parser.js";
@@ -0,0 +1,9 @@
1
+ import type { SafeJSSnapshot } from "./restore.js";
2
+ import type { RunRandom } from "./run.js";
3
+ export type ReplayableRandom = RunRandom & {
4
+ restore: (state: number) => void;
5
+ };
6
+ export declare function createReplayableRandom(options?: {
7
+ seed?: number;
8
+ snapshot?: SafeJSSnapshot;
9
+ }): ReplayableRandom;
@@ -0,0 +1,26 @@
1
+ import type { CompileOwner } from "./interp/budget.js";
2
+ import { type SnapshotMigration } from "./snapshot/migration.js";
3
+ export type SafeJSSnapshot = {
4
+ version?: number;
5
+ sourceHash: string;
6
+ migration?: SnapshotMigration;
7
+ clock?: {
8
+ next: number;
9
+ };
10
+ random?: {
11
+ seed: number;
12
+ state: number;
13
+ initialState?: number;
14
+ resumeState?: number;
15
+ };
16
+ [key: string]: unknown;
17
+ };
18
+ export type RestoreOptions = {
19
+ source: string;
20
+ };
21
+ export declare class SnapshotMismatchError extends Error {
22
+ readonly actualHash: string;
23
+ readonly expectedHash: string;
24
+ constructor(expectedHash: string, actualHash: string);
25
+ }
26
+ export declare function restore<TSnapshot extends SafeJSSnapshot>(snapshot: TSnapshot, options: RestoreOptions, owner?: CompileOwner): TSnapshot;
@@ -0,0 +1,74 @@
1
+ import { type ErrorSourceSpan } from "./error/shape.js";
2
+ import { type SourceSpan } from "./parse/parser.js";
3
+ import { type SafeJSSnapshot } from "./restore.js";
4
+ import { Budget } from "./interp/budget.js";
5
+ import { type PromiseReplaySnapshot } from "./interp/promise-replay.js";
6
+ import { type HostCallRecord, type HostCallReplay, type HostCallResumeProvider } from "./interp/host-call.js";
7
+ import { type ConsoleSink } from "./interp/globals/console-json.js";
8
+ import { type CallerInjectedBinding } from "./interp/host-bridge.js";
9
+ import { type InterpreterResult, type LoopIterationSnapshot } from "./interp/interpreter.js";
10
+ import { type ModuleRegistry } from "./modules/registry.js";
11
+ import { type OtelSink } from "./observability/otel.js";
12
+ import type { SnapshotBackend } from "./snapshot/backend.js";
13
+ import { type ReplayData } from "./snapshot/replay-data.js";
14
+ export type RunOptions = {
15
+ bindings?: Record<string, CallerInjectedBinding>;
16
+ budget?: Budget;
17
+ clock?: RunClock;
18
+ entryPointArgs?: readonly unknown[];
19
+ filename?: string;
20
+ importMeta?: Record<string, unknown>;
21
+ hostCallResumeProvider?: HostCallResumeProvider;
22
+ modules?: ModuleRegistry;
23
+ random?: RunRandom;
24
+ randomSeed?: number;
25
+ otelSink?: OtelSink;
26
+ signal?: AbortSignal;
27
+ snapshot?: SafeJSSnapshot;
28
+ snapshotBackend?: SnapshotBackend;
29
+ snapshotIntervalMs?: number;
30
+ snapshotPath?: string;
31
+ sink?: ConsoleSink;
32
+ };
33
+ export declare class UnhandledRejectionError extends Error {
34
+ readonly reason: unknown;
35
+ constructor(reason: unknown, span?: ErrorSourceSpan);
36
+ }
37
+ export type RunSnapshot = SafeJSSnapshot & {
38
+ bindings: InterpreterResult["snapshot"]["bindings"];
39
+ clock?: RunClockSnapshot;
40
+ hostCalls?: HostCallRecord[];
41
+ replay?: HostCallReplay;
42
+ replayError?: string;
43
+ promiseReplay?: PromiseReplaySnapshot;
44
+ initialInputs?: ReplayData;
45
+ loopIterations?: Record<string, LoopIterationSnapshot>;
46
+ pendingAwaits?: RunPendingAwaitSnapshot[];
47
+ random?: {
48
+ seed: number;
49
+ state: number;
50
+ initialState?: number;
51
+ resumeState?: number;
52
+ };
53
+ };
54
+ export type RunPendingAwaitSnapshot = {
55
+ nodeId?: number;
56
+ span: SourceSpan;
57
+ };
58
+ export type RunClockSnapshot = {
59
+ next: number;
60
+ };
61
+ export type RunClock = {
62
+ snapshot: () => RunClockSnapshot | undefined;
63
+ };
64
+ export type RunRandom = {
65
+ next: () => number;
66
+ seed: number;
67
+ snapshot: () => number;
68
+ };
69
+ type WithRunSnapshot<TResult extends InterpreterResult> = TResult extends unknown ? Omit<TResult, "snapshot"> & {
70
+ snapshot: RunSnapshot;
71
+ } : never;
72
+ export type RunResult = WithRunSnapshot<InterpreterResult>;
73
+ export declare function run(source: string, options?: RunOptions): Promise<RunResult>;
74
+ export {};