Simplify framework structure and shared configuration - #82
Merged
Conversation
shibayan
marked this pull request as ready for review
August 14, 2026 07:05
Contributor
There was a problem hiding this comment.
Pull request overview
This PR reduces duplication across the monorepo by centralizing tsdown/Vitest/TypeScript configuration, and simplifies core runtime layering by removing single-consumer abstractions (stream piping + run-scope symbol) while preserving run-scoped middleware behavior via an explicit per-run client binding. It also simplifies FoundryChatClient by inheriting the OpenAI implementation, and updates Foundry example Dockerfiles to better match Foundry’s runtime storage expectations.
Changes:
- Consolidate repeated build/test config into shared helpers (
scripts/vitest-config.ts,scripts/tsdown-config.ts) and new TS presets (tsconfig.node.json,tsconfig.neutral.json, updatedtsconfig.tools.json). - Refactor function invocation/run scoping: remove
run-scopesymbol plumbing andpipeStream, add a function-invocation client factory, and rewireAgentto bind per-run session/middleware explicitly. - Simplify Foundry client implementation by extending
OpenAIChatClient; update Foundry example Dockerfiles for root execution.
Reviewed changes
Copilot reviewed 63 out of 63 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tsconfig.tools.json | Enables .ts extension imports for tooling typechecks and centralizes inclusion of workspace config scripts. |
| tsconfig.node.json | New shared TS preset for Node-typed compilation. |
| tsconfig.neutral.json | New shared TS preset for runtime-neutral (DOM lib, no Node types) compilation. |
| scripts/vitest-config.ts | Adds shared Vitest aliases + test discovery helper for packages. |
| scripts/tsdown-config.ts | Adds shared tsdown defaults helper for publishable packages. |
| packages/openai/vitest.config.ts | Switches to shared Vitest preset helper. |
| packages/openai/tsdown.config.ts | Switches to shared tsdown preset helper. |
| packages/openai/tsconfig.src.json | Uses shared neutral TS preset for runtime-agnostic typechecking. |
| packages/openai/tsconfig.json | Uses shared Node TS preset for Node-typed compilation. |
| packages/openai/tsconfig.config.json | Removes per-package config tsconfig (now covered by root tools TS project). |
| packages/openai/package.json | Simplifies typecheck script to exclude removed config tsconfig. |
| packages/meta/vitest.config.ts | Switches to shared Vitest preset helper. |
| packages/meta/tsdown.config.ts | Switches to shared tsdown preset helper. |
| packages/meta/tsconfig.json | Uses shared Node TS preset. |
| packages/meta/tsconfig.config.json | Removes per-package config tsconfig. |
| packages/meta/package.json | Simplifies typecheck script to exclude removed config tsconfig. |
| packages/mcp/vitest.config.ts | Switches to shared Vitest preset helper. |
| packages/mcp/tsdown.config.ts | Switches to shared tsdown preset helper. |
| packages/mcp/tsconfig.src.json | Uses shared neutral TS preset. |
| packages/mcp/tsconfig.json | Uses shared Node TS preset. |
| packages/mcp/tsconfig.config.json | Removes per-package config tsconfig. |
| packages/mcp/package.json | Simplifies typecheck script to exclude removed config tsconfig. |
| packages/foundry/vitest.config.ts | Switches to shared Vitest preset helper. |
| packages/foundry/tsdown.config.ts | Switches to shared tsdown preset helper. |
| packages/foundry/tsconfig.json | Uses shared Node TS preset. |
| packages/foundry/tsconfig.config.json | Removes per-package config tsconfig. |
| packages/foundry/src/chat-client.ts | Simplifies FoundryChatClient by extending OpenAIChatClient and reusing its tool/client surface. |
| packages/foundry/package.json | Simplifies typecheck script to exclude removed config tsconfig. |
| packages/core/vitest.config.ts | Switches to shared Vitest preset helper. |
| packages/core/tsdown.config.ts | Switches to shared tsdown preset helper. |
| packages/core/tsconfig.src.json | Uses shared neutral TS preset and trims now-redundant comments. |
| packages/core/tsconfig.json | Uses shared Node TS preset. |
| packages/core/tsconfig.config.json | Removes per-package config tsconfig. |
| packages/core/src/streaming/response-stream.ts | Removes internal pipeStream and its internal iterator-claiming hook. |
| packages/core/src/streaming/response-stream.test.ts | Removes tests for removed pipeStream. |
| packages/core/src/middleware/run-scope.ts | Deletes run-scope symbol plumbing (now handled via explicit per-run client binding). |
| packages/core/src/middleware/middleware.test.ts | Adds coverage ensuring run middleware/session isolation across concurrent runs. |
| packages/core/src/client/structured-output.ts | Replaces pipeStream usage with explicit relay logic using createResponseStream. |
| packages/core/src/client/function-invocation.ts | Introduces per-run client factory; removes run-scope symbol reading/stripping. |
| packages/core/src/agent/agent.ts | Rewires agent composition to bind session + run middleware through the new function-invocation factory. |
| packages/core/package.json | Simplifies typecheck script to exclude removed config tsconfig. |
| packages/anthropic/vitest.config.ts | Switches to shared Vitest preset helper. |
| packages/anthropic/tsdown.config.ts | Switches to shared tsdown preset helper. |
| packages/anthropic/tsconfig.src.json | Uses shared neutral TS preset. |
| packages/anthropic/tsconfig.json | Uses shared Node TS preset. |
| packages/anthropic/tsconfig.config.json | Removes per-package config tsconfig. |
| packages/anthropic/package.json | Simplifies typecheck script to exclude removed config tsconfig. |
| packages/agentserver/vitest.config.ts | Switches to shared Vitest preset helper. |
| packages/agentserver/tsdown.config.ts | Switches to shared tsdown preset helper. |
| packages/agentserver/tsconfig.json | Uses shared Node TS preset. |
| packages/agentserver/tsconfig.config.json | Removes per-package config tsconfig. |
| packages/agentserver/package.json | Simplifies typecheck script to exclude removed config tsconfig. |
| packages/a2a/vitest.config.ts | Switches to shared Vitest preset helper. |
| packages/a2a/tsdown.config.ts | Switches to shared tsdown preset helper. |
| packages/a2a/tsconfig.src.json | Uses shared neutral TS preset. |
| packages/a2a/tsconfig.json | Uses shared Node TS preset. |
| packages/a2a/tsconfig.config.json | Removes per-package config tsconfig. |
| packages/a2a/package.json | Simplifies typecheck script to exclude removed config tsconfig. |
| package.json | Updates root typecheck to include tsconfig.tools.json project for config-file typechecking. |
| examples/02-foundry/02-hosted-agent/Dockerfile | Removes node user + explicit state root; now runs as root. |
| examples/02-foundry/05-invocations-agent/Dockerfile | Removes node user + explicit state root; now runs as root. |
| examples/02-foundry/06-memory-agent/Dockerfile | Removes node user + explicit state root; now runs as root. |
| examples/02-foundry/07-toolbox-skills/Dockerfile | Removes node user + explicit state root; now runs as root. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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
Why
The workspace repeated nearly identical configuration across eight packages and retained internal abstractions with a single consumer. This made the repository larger and obscured the execution paths. The Hosted Agent images also forced a non-root user even though Foundry mounts
/home/sessionas root-owned, preventing the hosting stores from writing session and approval state.Impact
Validation
pnpm checkgit diff --check