Skip to content

AI Draft

CapabilityAPI
Passwordbcryptjs (bundled) — hash + verify
SQLitebetter-sqlite3 (peer dep, lazy loaded) — CRUD, WAL, transactions
Filesystemnode:fs — sync read/write/exists
Globtinyglobby (peer dep) — async scan
Server@hono/node-server — HTTP + WebSocket via ws
Process safetyuncaughtException + controlled exit

nodeRuntime(opts?) returns SlingshotRuntime. All peer dependencies are lazy-loaded via dynamic import() or createRequire — missing deps surface at use-time, not at import time.

  • WebSocket upgrade has configurable timeout (default 30s) with socket destruction on timeout
  • Per-upgrade promise chain prevents timer/socket double-free
  • Idle-timeout uses terminate() (not close()) for unresponsive peers
  • stop() supports three modes: graceful, forced, and timeout-bounded drain
  • Fetch error callback is doubly guarded — throw falls back to uncaughtException
  • Request body size enforcement at two levels: Content-Length header and streaming accumulation
  • Channel cleanup removes stale sockets on both close and error events
  • src/index.tsnodeRuntime() factory, all capability implementations
  • src/errors.tsNodeRuntimeError, NodeServerError, NodeWebSocketError, NodeContentLengthError, NodeRequestBodyTooLargeError, NodeShutdownError
  • src/testing.tscreateTestServer(), runtimeNodeInternals