Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,17 @@ Run a DeepSeek agent loop inside a SQLite-backed Cloudflare Durable Object. The
## Install

```sh
bun add github:checkfu/deepseek-durable-objects#v0.0.1
npm install @checkfu/deepseek-durable-objects
```

GitHub releases also include an installable tarball and its SHA-256 checksum. Checkfu pins this repository to an exact commit in its Bun catalog.

## Use with a Worker

Import `openDeepSeekSession` from `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.
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.

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 `withDeepSeekDispatch` from `deepseek-durable-objects/transport` to intercept a model dispatch for accounting.
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 `withDeepSeekDispatch` from `@checkfu/deepseek-durable-objects/transport` to intercept a model dispatch for accounting.

Add `deepSeekWorkerdBuild` from `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 [standalone Worker fixture](test/fixtures/worker.mjs) shows the storage and tool interfaces in use.
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 [standalone Worker fixture](test/fixtures/worker.mjs) shows the storage and tool interfaces in use.

## 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 so pinned Git installs can use it directly. To release, update the version and lockfile, merge to `main`, and push the matching `v<version>` tag.
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.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "deepseek-durable-objects",
"name": "@checkfu/deepseek-durable-objects",
"version": "0.0.1",
"description": "DeepSeek agent sessions for SQLite-backed Cloudflare Durable Objects.",
"license": "MIT",
Expand Down
6 changes: 3 additions & 3 deletions scripts/check-consumer.mjs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import assert from "node:assert/strict";
import { access } from "node:fs/promises";
import { fileURLToPath } from "node:url";
import { openDeepSeekSession } from "deepseek-durable-objects";
import { withDeepSeekDispatch } from "deepseek-durable-objects/transport";
import { deepSeekWorkerdBuild } from "deepseek-durable-objects/workerd";
import { openDeepSeekSession } from "@checkfu/deepseek-durable-objects";
import { withDeepSeekDispatch } from "@checkfu/deepseek-durable-objects/transport";
import { deepSeekWorkerdBuild } from "@checkfu/deepseek-durable-objects/workerd";

assert.equal(typeof openDeepSeekSession, "function");
assert.equal(typeof withDeepSeekDispatch, "function");
Expand Down
4 changes: 2 additions & 2 deletions test/Runtime.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import assert from "node:assert/strict";
import { createServer } from "node:http";
import { once } from "node:events";
import { text } from "node:stream/consumers";
import { openDeepSeekSession } from "deepseek-durable-objects";
import type { DeepSeekStorage, DeepSeekTurn } from "deepseek-durable-objects";
import { openDeepSeekSession } from "@checkfu/deepseek-durable-objects";
import type { DeepSeekStorage, DeepSeekTurn } from "@checkfu/deepseek-durable-objects";
import { expect, it } from "vitest";
import { scriptedMessage } from "./helpers/ScriptedMessages.ts";

Expand Down
2 changes: 1 addition & 1 deletion test/Workerd.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { mkdtemp, rm } from "node:fs/promises";
import { tmpdir } from "node:os";
import { join } from "node:path";
import { fileURLToPath } from "node:url";
import { deepSeekWorkerdBuild } from "deepseek-durable-objects/workerd";
import { deepSeekWorkerdBuild } from "@checkfu/deepseek-durable-objects/workerd";
import { convertV4MiniflareOptions, Miniflare } from "miniflare";
import { rolldown } from "rolldown";
import { expect, it } from "vitest";
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/worker.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { DurableObject } from "cloudflare:workers";
import { openDeepSeekSession } from "deepseek-durable-objects";
import { openDeepSeekSession } from "@checkfu/deepseek-durable-objects";

const turn = {
operationId: "turn:1",
Expand Down