Skip to content

Agent examples on cellb: a fake OpenAI-compatible model, pi and opencode in Durable Objects - #12

Merged
mkotelnikov merged 1 commit into
mainfrom
ccr-ab3c0d30-6du8do-agent-examples
Oct 28, 2026
Merged

mkotelnikov merged 1 commit into
mainfrom
ccr-ab3c0d30-6du8do-agent-examples

Conversation

@mkotelnikov

Copy link
Copy Markdown
Contributor

What

  • packages/fake-openai (new, private): a scripted OpenAI-compatible endpoint.
    • It serves chat completions, streamed or not, as text or tool calls. Text streams a word at a time; tool calls stream as OpenAI streams them.
    • It also serves /v1/embeddings and /v1/models, with CORS open, and records every request.
    • A CLI runs it for celld dev (node packages/fake-openai/src/cli.ts 8787).
    • The Flue example's tests now use it.
  • packages/agent-examples (new, private), both tested on cellb (Node) against the fake model:
    • pi: pi's agent loop (@earendil-works/pi-agent-core + pi-ai) in a Durable Object with one tool. A prompt calls the tool and gets the follow-up reply; the transcript persists in storage and a second prompt continues it.
      • CellD's examples/pi needs PiHarness from a pkg.pr.new preview of agents, which no published release contains and which some networks block, so this version uses pi's published packages instead.
    • opencode: CellD's examples/opencode, with an endpoint provider (@ai-sdk/openai-compatible, base URL from OPENCODE_BASE_URL) instead of opencode's free registry model. All 8 SDK steps succeed and the reply is the fake model's.
  • cellb fixes these examples exposed:
    • A Response used as another Response's init (new Response(body, response)) kept only status: the spread dropped the prototype getters headers and statusText. opencode's SDK does this and failed with ClientError: UnsupportedContentType. Added a regression test in p07w.
    • Node bundles now resolve packages as celld deploy does: conditions workerd, worker, browser, then module and main. The neutral platform has no main fields, so packages with only main (opencode's @smithy/*) did not resolve.
    • A containers config is reported in unsupported instead of being silently ignored (test in p13).
  • Docs: a "Features at a glance" table in docs/celld-compatibility.md against CellD, covering WebSockets, Workers AI, Python, containers and agent frameworks; docs/gaps.md is updated.
  • CI runs the fake model's and the agent examples' tests.

Tests

Suite Result
fake-openai 3 passed
agent-examples 2 passed (pi about 4 s; opencode about 37 s, mostly bundling its SDK)
flue-example on Node 6 passed
flue-example in the browser 8 passed
cellb unit tests 353 passed, 6 expected fail
cellb interop 123 passed, 6 expected fail
Chromium 209 passed, 15 skipped

Typecheck and Biome are clean.

Note

The Node bundler change overlaps the pending switch to @statewalker/webrun-bundler (branch ccr-ab3c0d30-6du8do-webrun-bundler), which resolves these fields itself. Whichever merges second needs a small merge in node-project.ts.


Generated by Claude Code

…ode in Durable Objects

- packages/fake-openai: a scripted OpenAI-compatible endpoint (chat completions streamed or
  not, text or tool calls, embeddings, model list; CORS open; every request recorded), with a
  CLI for celld dev. The Flue example's tests use it.
- packages/agent-examples: pi's agent loop (@earendil-works/pi-agent-core) and opencode's
  workerd SDK (celld's example, with its model from an endpoint in the vars) in Durable
  Objects, tested on cellb against the fake model.
- cellb: a Response given as another Response's init keeps its headers and statusText (the
  opencode SDK rebuilds responses that way; the spread lost the prototype's getters).
- cellb: Node bundles resolve packages as celld deploy does (conditions workerd, worker,
  browser; then module and main): a package with only `main` did not resolve.
- cellb: a `containers` config is reported in `unsupported`.
- docs: a feature table against celld (WebSockets, Workers AI, Python, containers, agents).
- CI runs the fake model's and the agent examples' tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SXJQA3LbggJHi5qZBpUKe8
@mkotelnikov
mkotelnikov merged commit 8be9a7c into main Oct 28, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants