@lastshotlabs/slingshot-runtime-edge
npm install @lastshotlabs/slingshot-runtime-edge
Functions
Section titled “Functions”configureRuntimeEdgeLogger
Section titled “configureRuntimeEdgeLogger”Replace the runtime’s structured logger. Pass null to reset to the
default JSON console logger. Returns the previous logger so tests can
save and restore state.
function configureRuntimeEdgeLogger(logger: Logger | null): LoggerSource: packages/runtime-edge/src/index.ts
edgeRuntime
Section titled “edgeRuntime”Create a SlingshotRuntime implementation for edge runtimes.
Provides runtime capabilities compatible with Cloudflare Workers and Deno Deploy. Uses the Web Crypto API for password hashing — no native modules, no Node.js built-ins.
Limitations vs. Bun/Node runtimes:
supportsAsyncLocalStorageisfalse. Use explicit context passing instead ofAsyncLocalStoragefor per-request state propagation.- SQLite is not supported. Use a cloud database instead.
- HTTP server factory (
runtime.server.listen()) is not callable. Export afetchhandler from your Worker entry module. - Glob scanning is not supported. Route discovery must happen at build time.
- Filesystem writes are not supported. Use KV, R2, or another storage service.
readFile()always returnsnullunlessfileStoreis provided.- No process lifecycle hooks (
SIGTERM/SIGINT). Edge isolates are started and stopped by the platform; the runtime does not expose aprocess.on('SIGTERM')equivalent. Cleanup should happen at the worker level via platform hooks (e.g., Cloudflare’sctx.waitUntil).
Timeout behaviour:
fileStoreTimeoutMsuses anAbortController-backed timeout. When the deadline fires, the controller is aborted and callers who accept the optionalAbortSignalparameter can cancel their underlying work.heartbeatTimeoutMswraps long-running operations with a global timeout guard (seeEdgeRuntimeOptions.heartbeatTimeoutMs).
For a complete capability matrix see runtimeCapabilities.
function edgeRuntime(options: EdgeRuntimeOptions = {}): SlingshotRuntimeSource: packages/runtime-edge/src/index.ts
runtimeCapabilities
Section titled “runtimeCapabilities”Return a frozen capability descriptor for the edge runtime platform.
This is a static report — it always describes what the edge platform can
and cannot do, independent of any particular edgeRuntime() configuration.
function runtimeCapabilities(): EdgeRuntimeCapabilitiesSource: packages/runtime-edge/src/index.ts
Classes
Section titled “Classes”EdgeFileReadError
Section titled “EdgeFileReadError”Raised when the edge runtime cannot read a configured static file.
Source: packages/runtime-edge/src/errors.ts
EdgeFileSizeExceededError
Section titled “EdgeFileSizeExceededError”Raised when an edge runtime file read exceeds the configured byte limit.
Source: packages/runtime-edge/src/errors.ts
EdgePasswordConfigError
Section titled “EdgePasswordConfigError”Raised when edge password hashing and verification hooks are configured inconsistently.
Source: packages/runtime-edge/src/errors.ts
EdgeRuntimeError
Section titled “EdgeRuntimeError”Errors thrown by the Edge runtime implementation.
Source: packages/runtime-edge/src/errors.ts
EdgeUnsupportedError
Section titled “EdgeUnsupportedError”Raised when code requests a runtime feature that edge isolates do not support.
Source: packages/runtime-edge/src/errors.ts
Interfaces
Section titled “Interfaces”EdgeRuntimeCapabilities
Section titled “EdgeRuntimeCapabilities”Programmatic capability report for the edge runtime platform.
Consumers can use this to feature-detect at runtime without needing to instantiate a full runtime or catch errors from stubs.
All boolean capabilities reflect what the platform itself supports
(not what an individual edgeRuntime() caller configured). For example,
filesystem.read is always false because edge runtimes have no local
filesystem — even when fileStore is configured, reads go through the
network, not the local FS.
Source: packages/runtime-edge/src/index.ts
EdgeRuntimeOptions
Section titled “EdgeRuntimeOptions”Options for edgeRuntime().
Source: packages/runtime-edge/src/index.ts
FileStoreStream
Section titled “FileStoreStream”Streaming descriptor returned by fileStore.
Allows readFile() to enforce maxFileBytes without buffering the entire
payload first. If size is supplied (e.g. from a HEAD response or stat),
the runtime rejects oversized files before reading any bytes. Otherwise it
pulls chunks from stream and aborts as soon as the running byte count
exceeds the cap.
Source: packages/runtime-edge/src/index.ts
FileStoreResult
Section titled “FileStoreResult”Result returned by a fileStore lookup.
string: a fully buffered UTF-8 payload. Suitable for small bundled assets where the size is known to be safe.FileStoreStream: a streaming descriptor with optional declared size. Required for any source that may return large files; the runtime will honourmaxFileBytesbefore fully buffering.null: file not found.
Source: packages/runtime-edge/src/index.ts