Repository navigation
Conversation
A fold chat host on Cloudflare deployed with Alchemy v2. Each session is a Durable Object named by its SessionId, with the fold event log stored in the object's SQLite. An alarm heartbeat keeps the object alive while a turn runs, and a turn cut off by a restart is nudged to continue (at most 3 times). HttpRouter routes reach the objects through a ChatSessions service. The model is OpenAI gpt-5.6-terra on medium reasoning, with the API key bound from the deploy environment. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> HumanLayer-Session: https://app.dev.codelayer.gg/sessions/01a0ef41-7f9a-7c78-83e6-b468fe8c440e
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
A new example,
examples/alchemy-cloudflare: a fold chat host on Cloudflare, deployed with Alchemy v2.ChatSession.ts: the Durable Object. Each fold session is one object, named by itsSessionId.sendto a new ID starts the session; after that, the object resumes it from its log when it starts up.sendtakeswhenRunning:queue(the default),steerorinterrupt.DurableObjectEventLog.ts: fold'sEventLogServicestored in the object's SQLite.Keepalive.ts: a 30s alarm heartbeat that keeps the object from being evicted while a turn runs.Api.ts/Worker.ts:HttpRouterroutes over aChatSessionsservice, which calls the Durable Objects.POST /sessions/:sessionId/messagesGET /sessions/:sessionIdgpt-5.6-terraon medium reasoning, throughopenaiModel. The deploy readsOPENAI_API_KEYfrom your environment and stores it on the Worker as a secret.Other changes
package.json: adds theexamples/*workspace, andtypecheck/testnow also run over the examples.alchemy,@cloudflare/workers-typesand@effect/platform-bun.Why not Workers AI
Alchemy's Workers AI
LanguageModelrepeats streamed text on some models and never emits streamed tool calls. fold always usesstreamText, so both bugs hit it. Reported upstream: alchemy-run/alchemy#1907.Testing
bun run typecheck, lint and the route tests (test/Api.test.ts, against an in-memoryChatSessions) pass.🤖 Generated with Claude Code