Skip to content

Simplify framework structure and shared configuration - #82

Merged
shibayan merged 1 commit into
masterfrom
agent/simplify-framework-structure
Aug 14, 2026
Merged

Simplify framework structure and shared configuration#82
shibayan merged 1 commit into
masterfrom
agent/simplify-framework-structure

Conversation

@shibayan

Copy link
Copy Markdown
Member

Summary

  • consolidate repeated tsdown, Vitest, and TypeScript package configuration into shared helpers and presets
  • remove unused run-scope and generic stream-piping layers while preserving run-scoped middleware and structured-output behavior
  • simplify FoundryChatClient by inheriting the OpenAI implementation
  • align Hosted Agent Dockerfiles with Foundry's root-owned persistent HOME mount

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/session as root-owned, preventing the hosting stores from writing session and approval state.

Impact

  • removes 397 net lines across 63 files
  • keeps published package entry points and generated declaration exports unchanged
  • avoids permission failures for Hosted Agent session and approval persistence
  • preserves middleware ordering, concurrent-run isolation, streaming finalization, and provider behavior

Validation

  • pnpm check
  • Docker build and persistent-HOME write test
  • git diff --check

@github-actions github-actions Bot added core Usage: [Issues, PRs], Target: packages/core foundry Usage: [Issues, PRs], Target: Microsoft Foundry integrations hosting Usage: [Issues, PRs], Target: agent hosting protocols and runtime agents Usage: [Issues, PRs], Target: single-agent runtime and APIs labels Aug 14, 2026
@shibayan shibayan self-assigned this Aug 14, 2026
@shibayan
shibayan marked this pull request as ready for review August 14, 2026 07:05
Copilot AI lite review requested due to automatic review settings August 14, 2026 07:05

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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, updated tsconfig.tools.json).
  • Refactor function invocation/run scoping: remove run-scope symbol plumbing and pipeStream, add a function-invocation client factory, and rewire Agent to 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.

Comment thread examples/02-foundry/02-hosted-agent/Dockerfile
Comment thread examples/02-foundry/05-invocations-agent/Dockerfile
Comment thread examples/02-foundry/06-memory-agent/Dockerfile
Comment thread examples/02-foundry/07-toolbox-skills/Dockerfile
@shibayan
shibayan merged commit ff3d01c into master Aug 14, 2026
9 checks passed
@shibayan
shibayan deleted the agent/simplify-framework-structure branch August 14, 2026 07:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Usage: [Issues, PRs], Target: single-agent runtime and APIs core Usage: [Issues, PRs], Target: packages/core foundry Usage: [Issues, PRs], Target: Microsoft Foundry integrations hosting Usage: [Issues, PRs], Target: agent hosting protocols and runtime

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants