feat: v2 - ai assistant llm proxy and dispatcher agent#2329
Open
maxy-shpfy wants to merge 1 commit into
Conversation
🎩 PreviewA preview build has been created at: |
8 tasks
Collaborator
Author
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
This was referenced May 28, 2026
295b24e to
65cce3b
Compare
3209a15 to
3a918bd
Compare
This was referenced May 28, 2026
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.

Description
Wires the
@openai/agentsSDK into the in-browser AI assistant, replacing the previous echo-only worker stub with a real LLM-backed dispatcher.A new
TangleDispatcherwraps an@openai/agentsAgentinstance configured to use a user-supplied LLM proxy token stored in IndexedDB vialocalforage. Static configuration (proxy base URL, model names, proxy mode) is read from a committedsrc/config/aiAssistantConfig.jsonfile. The proxy token is resolved per-turn from IndexedDB and passed intoensureProxyConfigured(), which rebuilds the OpenAI client only when the token rotates.The worker's
init(onStatus)/ask()lifecycle is preserved.createWorkerApi()now instantiates the dispatcher oninit()and delegatesask()calls through it, resolving the token from IndexedDB, creating a per-threadMemorySession, and mapping the result back to the existingAgentResponseshape.Observability hooks translate
@openai/agentslifecycle events (agent_start,agent_end,agent_tool_start,agent_handoff) into human-readable status strings forwarded to the main thread via the Comlink-proxiedStatusCallback.A
AiTokenSetupcomponent is shown in the chat panel when no token is stored, allowing the user to paste and save a proxy token without leaving the editor. The token is persisted to IndexedDB and the React Query cache is updated immediately on save.The Vite worker bundle is configured with a scoped
resolveIdplugin that forces@openai/agents-core/_shimsto resolve to its browser variant, working around Vite's worker bundler not reliably applying thebrowserexport condition. AglobalThis.processstub in the worker entry point covers an unguardedprocess.envread in@openai/agents-corev0.4.x.Related Issue and Pull requests
Type of Change
Checklist
Screenshots (if applicable)
AI Assistant - Set token and first LLM.mov (uploaded via Graphite)
Test Instructions
proxyBaseUrlandorchestratorModelinsrc/config/aiAssistantConfig.json.Additional Comments
src/config/aiAssistantConfig.jsonis committed with empty strings forproxyBaseUrlandorchestratorModel. These must be filled in before the assistant will function. ThesubagentModelfield is reserved for a future sub-agent PR and is not read yet.