feat: v2 - ai assistant web worker scaffolding#2328
Open
maxy-shpfy wants to merge 1 commit into
Open
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 28, 2026
13d4bc7 to
8dfdf7a
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
Introduces the Web Worker infrastructure for the in-browser AI agent. A dedicated worker (
src/agent/worker.ts) is spawned lazily on the first chat turn and communicates with the main thread over Comlink. The worker currently returns an echo response, establishing that the bundling, lazy-spawn, and Comlink round-trip work end-to-end before the LLM and tool bridge are wired in.AgentClient(agentClient.ts) manages the worker lifecycle — spawning, wrapping with Comlink, callinginitonce, and exposing a typedask()method.AiChatStoreis updated to callAgentClient.ask()instead of the previous hardcoded echo, and now threadsthreadIdand livethinkingTextstatus updates through from the worker response.The worker bundle is configured to emit ES module output so
import.meta.urlresolves correctly inside the worker. AglobalThis.processpolyfill is inlined in the worker entry point to handle an unguardedprocess.envread in@openai/agents-corev0.4.x without falsely advertising a Node.js environment.An
ARCHITECTURE.mdis added undersrc/agent/documenting the full topology: thread split, Comlink bridge contract, dispatcher/sub-agent structure, tool registry, session and memory model, observability hooks, skills loader, configuration knobs, and known caveats.Related Issue and Pull requests
Type of Change
Checklist
Screenshots (if applicable)
AI Assistant - WebWorker.mov (uploaded via Graphite)
Test Instructions
Worker echo: <your message>.threadIdis assigned and persists across subsequent messages in the same session.Additional Comments
The
comlinkpackage is added as a production dependency. The@openai/agents-core/_shimsVite alias and the SDK dependency itself are deferred to the next PR, which wires the actual LLM round-trip and tool bridge.