poc: v2 - ai sidekick agent loop in browser#2305
Draft
maxy-shpfy wants to merge 1 commit into
Draft
Conversation
🎩 PreviewA preview build has been created at: |
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 21, 2026
Merged
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
Migrates the in-browser AI agent runtime from the LangChain/deepagents stack to
@openai/agents, running entirely inside a Web Worker via Comlink. The agent now communicates with the LLM through the Shopify proxy using the OpenAI Chat Completions surface, with all pipeline mutations happening directly on the live MobX spec through a typedToolBridgeApirather than through command serialization and replay.Key changes:
src/agent/): A dispatcher agent routes user intent to five specialist sub-agents —pipeline-architect,pipeline-repair,debug-assistant,general-help, andgeneric-assistant. Each sub-agent has a dedicated system prompt and a focused tool set.toolBridge.ts): Main-thread implementation ofToolBridgeApithat mutates the live MobXComponentSpecinside undo groups. The worker calls these methods via Comlink proxy — no command serialization needed.src/agent/worker.ts): Exposesask()andinit()via Comlink. Includes aglobalThis.processpolyfill to cover an unguardedprocess.envread in@openai/agents-corev0.4.x.search_componentsandsearch_docstools now POST to/api/agent/search_componentsand/api/agent/search_docsrespectively, replacing the in-browserMemoryVectorStore+OpenAIEmbeddingsapproach.src/agent/skills/loader.ts): FetchesSKILL.mdfiles from a configurable base URL with ETag-based IDB caching for revalidation on deploy.src/agent/middleware/observability.ts): Translates@openai/agentslifecycle events (agent_start,agent_tool_start,agent_handoff, etc.) into status text forwarded to the main thread.localStorage.setItem("agent.runtime", "worker")so the existing LangChain path remains active by default.@openai/agents,@openai/agents-core,openai(moved from devDependencies), andcomlink. Removes@langchain/anthropicand its transitive@anthropic-ai/sdkdependency.agent:publish-indexandagent:publish-skillscopy vector store files and skill assets intopublic/for static serving.resolveIdplugin forces@openai/agents-core/_shimsto resolve to its browser variant inside the worker bundle, preventing the Node shim from being bundled.Related Issue and Pull requests
Type of Change
Checklist
Screenshots (if applicable)
Demo - AI Sidekick - Openai Agent in Browser.mov (uploaded via Graphite)
Test Instructions
localStorage.setItem("agent.runtime", "worker")in the browser console, then reload.VITE_AI_PROXY_TOKENandVITE_AI_PROXY_BASE_URLare set in your.env.generic-assistantresponds with entity chip links.debug-assistantfetches logs from the backend.Additional Comments
The LangChain/deepagents runtime is preserved and remains the default. The worker runtime can be toggled per-session via
localStoragewithout a deploy. Per-thread conversation memory (MemorySession) lives for the lifetime of the worker and resets on page reload; persistent cross-session memory backed by Dexie is out of scope for this iteration.