Add browser-compatible agent loop packages#31
Merged
Conversation
95360b1 to
2608506
Compare
There was a problem hiding this comment.
Pull request overview
This PR refactors the ACP agent loop into a new runtime-neutral core package and introduces separate Node and browser “assembly” packages so browser builds can avoid leaking Node-only dependencies.
Changes:
- Extracted the agent loop + core interfaces into
@fledgling/agent-core, and rewired@fledgling/acp-agentto inject Node implementations. - Added session manager implementations for memory, localStorage, and filesystem, plus a Node MCP tool provider package.
- Added a browser
@fledgling/web-agentpackage with a webpack “fail on Node builtins” proof and a WebContainer-backed MCP workspace sidecar.
Reviewed changes
Copilot reviewed 65 out of 66 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| rush.json | Registers new workspace packages (agent-core, session managers, MCP providers, web-agent, webcontainer sidecar). |
| packages/web-agent/webpack.config.cjs | Webpack proof bundle targeting web with a plugin that throws on Node builtin imports. |
| packages/web-agent/tsconfig.json | Browser TS config (DOM libs) emitting to lib/. |
| packages/web-agent/src/webpack-entry.ts | Webpack entry that re-exports the public web-agent surface. |
| packages/web-agent/src/tool-provider.ts | Browser MCP tool provider wiring via in-memory transport sidecar. |
| packages/web-agent/src/index.ts | Web-agent public exports (core + sidecar + wiring helpers). |
| packages/web-agent/src/dependencies.ts | Browser dependency assembly (localStorage session manager + sidecar tool provider + injected model runner). |
| packages/web-agent/package.json | Web-agent package scripts + deps (including webpack bundle script). |
| packages/web-agent/eslint.config.cjs | ESLint config via repo rig. |
| packages/web-agent/config/rig.json | Heft rig configuration for web-agent. |
| packages/tools-mcp-node/vitest.config.ts | Vitest config for tools-mcp-node. |
| packages/tools-mcp-node/tsconfig.json | TS config for tools-mcp-node. |
| packages/tools-mcp-node/src/index.ts | Node MCP tool provider implementation (stdio/http/sse + first-party workspace). |
| packages/tools-mcp-node/src/config.ts | Filesystem-backed config loader for MCP server config. |
| packages/tools-mcp-node/src/config.test.ts | Tests for MCP config loading. |
| packages/tools-mcp-node/package.json | Package definition for Node MCP tool provider. |
| packages/tools-mcp-node/eslint.config.cjs | ESLint config via repo rig. |
| packages/tools-mcp-node/config/rig.json | Heft rig configuration for tools-mcp-node. |
| packages/session-memory/vitest.config.ts | Vitest config for session-memory. |
| packages/session-memory/tsconfig.json | TS config for session-memory. |
| packages/session-memory/src/session-memory.test.ts | Tests for in-memory session event persistence. |
| packages/session-memory/src/index.ts | In-memory ISessionManager implementation using Web Crypto IDs. |
| packages/session-memory/package.json | Package definition for session-memory. |
| packages/session-memory/eslint.config.cjs | ESLint config via repo rig. |
| packages/session-memory/config/rig.json | Heft rig configuration for session-memory. |
| packages/session-local-storage/vitest.config.ts | Vitest config for session-local-storage. |
| packages/session-local-storage/tsconfig.json | Browser TS config (DOM libs) for local-storage session manager. |
| packages/session-local-storage/src/session-local-storage.test.ts | Tests for localStorage session persistence and key prefix isolation. |
| packages/session-local-storage/src/index.ts | localStorage-backed ISessionManager implementation. |
| packages/session-local-storage/package.json | Package definition for session-local-storage. |
| packages/session-local-storage/eslint.config.cjs | ESLint config via repo rig. |
| packages/session-local-storage/config/rig.json | Heft rig configuration for session-local-storage. |
| packages/session-file-system/vitest.config.ts | Vitest config for session-file-system. |
| packages/session-file-system/tsconfig.json | TS config for session-file-system. |
| packages/session-file-system/src/session-file-system.test.ts | Tests for filesystem JSONL session persistence. |
| packages/session-file-system/src/index.ts | Filesystem JSONL ISessionManager implementation (Node). |
| packages/session-file-system/package.json | Package definition for session-file-system. |
| packages/session-file-system/eslint.config.cjs | ESLint config via repo rig. |
| packages/session-file-system/config/rig.json | Heft rig configuration for session-file-system. |
| packages/mcp-workspace-webcontainer/vitest.config.ts | Vitest config for webcontainer workspace sidecar package. |
| packages/mcp-workspace-webcontainer/tsconfig.json | Browser TS config (DOM libs) for webcontainer sidecar package. |
| packages/mcp-workspace-webcontainer/src/sidecar.ts | In-memory MCP server exposing workspace tools (read/write/list/search/run). |
| packages/mcp-workspace-webcontainer/src/runtime.ts | WebContainer workspace runtime implementation used by sidecar tools. |
| packages/mcp-workspace-webcontainer/src/runtime.test.ts | Tests for path normalization + search behavior in the runtime. |
| packages/mcp-workspace-webcontainer/src/index.ts | Public exports for runtime + sidecar. |
| packages/mcp-workspace-webcontainer/package.json | Package definition for webcontainer workspace sidecar. |
| packages/mcp-workspace-webcontainer/eslint.config.cjs | ESLint config via repo rig. |
| packages/mcp-workspace-webcontainer/config/rig.json | Heft rig configuration for webcontainer sidecar. |
| packages/agent-core/vitest.config.ts | Vitest config for agent-core. |
| packages/agent-core/tsconfig.json | TS config for agent-core. |
| packages/agent-core/src/session-cleanup.ts | Browser-safe session cleanup utilities + client close helper. |
| packages/agent-core/src/prompt-errors.ts | Prompt error normalization + sanitization/redaction utilities. |
| packages/agent-core/src/prompt-errors.test.ts | Tests for error sanitization/redaction behavior. |
| packages/agent-core/src/prompt-content.ts | Prompt/message/tool output flattening helpers + context-hint extraction. |
| packages/agent-core/src/interfaces.ts | Core injected interfaces (ISessionManager, IToolProvider, IModelTurnRunner, logger types, etc.). |
| packages/agent-core/src/index.ts | Barrel exports for agent-core. |
| packages/agent-core/src/agent.ts | Extracted runtime-neutral ACP agent loop (FledglingAgent) using injected deps. |
| packages/agent-core/package.json | Package definition for agent-core. |
| packages/agent-core/eslint.config.cjs | ESLint config via repo rig. |
| packages/agent-core/config/rig.json | Heft rig configuration for agent-core. |
| packages/acp-agent/src/index.ts | Node entrypoint updated to construct FledglingAgent with default injected deps. |
| packages/acp-agent/src/agent.ts | Node assembly updated to re-export core + provide Node default deps (FS sessions, Node MCP tools, OpenAI runner). |
| packages/acp-agent/src/agent-session-lifecycle.test.ts | Tests updated for injected dependencies + filesystem session manager. |
| packages/acp-agent/src/agent-prompt-cancellation.test.ts | Tests updated for injected dependencies + filesystem session manager. |
| packages/acp-agent/package.json | Adds deps on new packages (agent-core/session-file-system/tools-mcp-node). |
| common/config/rush/pnpm-lock.yaml | Lockfile updates reflecting added workspaces and dependencies. |
Files not reviewed (1)
- common/config/rush/pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
1d1d24a to
3c1a0ae
Compare
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
@fledgling/agent-corewith injected session, tool, model, and logger interfaces.@fledgling/acp-agentas a Node assembly package.Verification
rush test --to @fledgling/acp-agentrush build --to @fledgling/web-agentrushx bundlefrompackages/web-agent(passes with webpack size warnings for the 374 KiB bundle)Closes #30.