feat: run chat fully offline with CopilotKit Intelligence optional - #94
Open
matthewhand wants to merge 1 commit into
Open
matthewhand wants to merge 1 commit into
matthewhand wants to merge 1 commit into
Conversation
CopilotKit Intelligence is no longer required. With a cloud key (or a self-hosted Intelligence shim via INTELLIGENCE_API_URL/WS_URL, which must be set together) the runtime behaves as before: cloud threads and the managed realtime WS. Without any key it falls back to the official SSE runtime mode with local thread endpoints, and a new DurableAgentRunner persists threads, messages, events and state to the existing PGlite store — snapshotting before and after each run and merging by runId and message id — so conversations survive restarts. Verified live in both directions: local mode boots with no cloud key, round-trips a real browser chat with zero cloud calls and rehydrates the conversation from PGlite after an API restart; cloud mode still reports mode=intelligence, hydrates the main thread and streams round-trips. Adapted from sunshaoan0808/openmuse (MIT) planB + planA commits. 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
This branch has not been deployed
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.
Summary
CopilotKit Intelligence is no longer a hard requirement. Three runtime modes now exist:
CPK_INTELLIGENCE_API_KEYsetINTELLIGENCE_API_URL+INTELLIGENCE_WS_URL(must be set together)DurableAgentRunnerWithout any Intelligence configuration the runtime falls back to its official SSE mode: local
/threadslist/messages/state endpoints, with a newDurableAgentRunnerpersisting threads, messages, events and state to the store the app already uses — snapshotting before and after each run, merging by runId and message id — so conversations survive restarts.The client needs no changes:
chat.tsxalready branches onrichThreads, and/api/main-threadserves a stable local id when Intelligence is absent.Notes
assertApiDeploymentConfignow validates the shim contract (URLs paired) instead of requiring the cloud key;intelligenceConfigured()is the single switch. TheintelligenceKeyRequiredMessageexport is kept for the demo entry, which still requires a key by design.auth.ownerpattern (a deployment-specificintelligenceUserIdrefactor was deliberately excluded from this PR).Testing
main;tsc --noEmitclean.mode=intelligenceand streams as before.Adapted from sunshaoan0808/openmuse (MIT), planB + planA commits, with attribution.
🤖 Generated with Codebuff