Skip to content

About

DeepSeek Harness in Cloudflare Durable Objects

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Repository files navigation

DeepSeek Durable Objects

Run a DeepSeek agent loop inside a SQLite-backed Cloudflare Durable Object. The package persists native session history, recovers interrupted turns, and resumes parked tool calls. It supports DeepSeek's API and the OpenRouter Messages route.

Install

npm install @checkfu/deepseek-durable-objects

Use with a Worker

Import openDeepSeekSession from @checkfu/deepseek-durable-objects. Construct one runtime per Durable Object. Pass the object's SQLite storage, a stable session ID, the initial model configuration, and a tool host. Keep the provider and model pinned for that runtime.

Use baseUrl: null for the default deepseek or openrouter endpoint. Set an explicit base URL for a custom provider.

Call submit, settle, and abort from the host's turn lifecycle. Use the same operation ID when recovering or resuming a turn. Drive recovery from the Durable Object alarm. The host supplies credentials and decides which tools can run, how to publish replies, and how to record usage. Use modelRequests to observe provider requests and record usage. Set fetchUpstream if the host owns the inference connection.

A settled refused outcome contains a safe display message and the final token usage. Preview text is provisional. Replace it with the settled message when the provider refuses a response.

Add deepSeekWorkerdBuild from @checkfu/deepseek-durable-objects/workerd to the Worker bundler using Cloudflare's Node compatibility. With Alchemy, load the plugin in the Worker source provider so the build sidecar can resolve it. The Worker starter includes a SQLite Durable Object and alarm recovery.

Develop

Run bun install --frozen-lockfile and bun run verify. The checks include the compiled package, direct provider fixtures, and a Workerd restart against the same SQLite Durable Object. Commit the generated dist/ after changing the source; CI checks that it matches. To release, update the version and lockfile, merge to main, push the matching v<version> tag, and run npm publish from that commit.

About

DeepSeek Harness in Cloudflare Durable Objects

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages