AI Draft
Capabilities
Section titled “Capabilities”| Capability | API |
|---|---|
| Password | Web Crypto PBKDF2 — two-format parser supporting legacy hashes |
| SQLite | Stub — throws EdgeUnsupportedError |
| Server | Stub — throws EdgeUnsupportedError |
| Filesystem | Read-only via fileStore (fetch-based) — three-layer cap enforcement |
| Glob | Stub — throws EdgeUnsupportedError |
| KV ISR | kv-isr.ts — Cloudflare Workers KV-backed ISR adapter |
Runtime Contract
Section titled “Runtime Contract”edgeRuntime(opts?) returns SlingshotRuntime (frozen). Unsupported capabilities throw
descriptive EdgeUnsupportedError rather than failing silently. runtimeCapabilities()
provides programmatic introspection.
Edge-specific Details
Section titled “Edge-specific Details”readFile()enforces size caps at three layers: declared size, streaming accumulation, post-buffer- File store timeout uses
AbortControllerfor proper cancellation - Password verification uses constant-time comparison
EdgePasswordConfigErrorthrown eagerly when only one ofhashPassword/verifyPasswordis providedKvNamespaceis structurally typed —@cloudflare/workers-typesis not a dependency- KV ISR: concurrency-limited fan-out, per-tag serialization locks, bounded memory
Key Files
Section titled “Key Files”src/index.ts—edgeRuntime()factory, all capability implementationssrc/kv-isr.ts— KV-backed ISR cache adaptersrc/errors.ts—EdgeRuntimeError,EdgeUnsupportedError,EdgeFileReadError,EdgeFileSizeExceededError,EdgePasswordConfigErrorsrc/lib/withAbortTimeout.ts— AbortController-based timeout utilitysrc/testing.ts—TEST_EDGE_TIMEOUT_MS,TEST_MAX_FILE_BYTES