feat(agent): chat panel to edit selected demo via LiteLLM#23
Open
shimoncohen wants to merge 12 commits into
Open
feat(agent): chat panel to edit selected demo via LiteLLM#23shimoncohen wants to merge 12 commits into
shimoncohen wants to merge 12 commits into
Conversation
- gate /api/agent + /models behind AGENT_ENABLED and a same-origin check (assertAgentAccess); hide chat panel unless enabled via data.agentEnabled - rebuild the system prompt each tool iteration so its file list stays current - return an explicit reply when the iteration limit is hit - log agent/model errors server-side, return a generic message to clients - avoid an empty assistant bubble when the reply is blank Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
shimoncohen
force-pushed
the
worktree-feat+agent-chat-edit
branch
from
July 22, 2026 10:34
a51afa0 to
5e03203
Compare
…ution
Flems (CodeMirror) mutates the file objects it receives, attaching
circular editor state that breaks JSON.stringify for consumers sharing
the same array (e.g. the agent panel). Pass fresh {name, content} copies.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Missing min-h-0 on the flex chain let content expand past the viewport, scrolling the whole page. Bound the demo layout slot wrapper and the chat message list so overflow scrolls inside the panel. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Lift the chat thread to a controlled prop so the demo page owns it, caching it in localStorage under a per-example key (demo-chat:v1). On reload or when switching examples the thread restores for that specific example; clearing the cache wipes files and chat together. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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
agentClient.tsruns an OpenAI-compatible tool-call loop (write_file/edit_file) against LiteLLM, mutating only the in-memoryfiles[]from the request. No server-side filesystem writes.POST /api/agent(run agent) andGET /api/agent/models(proxy the model list). LiteLLM key/base URL stay server-side.agentChat.svelteposts to the route and hands edited files back to the demo page, which live-updates Flems and persists via the existing localStoragedemoCache(so "Clear cache" reverts agent edits too). Chat history is in-memory only.AGENT_MODEL..env.example:LITELLM_BASE_URL,LITELLM_API_KEY,AGENT_MODEL.Test Plan
npm test— 43 passed (15 new:applyTool,runAgent,fetchModels,agentChat)npm run check— 0 errors, 0 warnings🤖 Generated with Claude Code