Skip to content

Conversation

@felixnorden
Copy link
Collaborator

@felixnorden felixnorden commented Nov 17, 2025

Summary

This PR introduces a complete rewrite of the playground package, transforming it from a basic MCP (Model Context Protocol) server management tool into a comprehensive AI Agent management and chat interface. The changes represent a fundamental architectural shift from server-focused management to agent-centric interaction.

Key Changes Overview

🏗️ Architecture Transformation

  • From: MCP server management tool with basic chat functionality
  • To: Comprehensive AI Agent playground with advanced chat interface and agent lifecycle management

📦 Package Structure Changes

  • Package Name: Retained @nullshot/playground but completely restructured
  • Exports: New modular export system for components, hooks, and utilities
  • Build System: Enhanced with tsup for library builds alongside Next.js app

🎨 UI/UX Revolution

  • Design System: Complete overhaul using shadcn/ui components in New York style
  • Components: 30+ new AI-specific components (ai-elements) for rich chat experiences
  • Styling: Tailwind CSS v4 with CSS variables and modern design patterns

Detailed Implementation

1. Core Architecture Changes

Agent Management System (src/lib/agent-*.ts)

  • agent-config.tsx: Centralized agent configuration management
  • agent-context.tsx: React context for agent state management with 285 lines of test coverage
  • agent-health.ts: Real-time agent health monitoring and status tracking
  • agent-persistence.ts: Local storage persistence for agent configurations
  • agent-storage.ts: Agent data storage utilities
  • agent-utils.tsx: Utility functions with comprehensive test suite (297 lines of tests)

New Component Architecture

  • AI Elements: 30+ specialized components for AI chat interfaces
    • Rich message rendering (message.tsx, response.tsx)
    • Interactive elements (actions.tsx, confirmation.tsx)
    • Visual components (canvas.tsx, image.tsx, web-preview.tsx)
    • Advanced features (chain-of-thought.tsx, reasoning.tsx, artifact.tsx)

2. Technology Stack Upgrades

Frontend Framework

  • Next.js: Upgraded to v15 with App Router
  • React: Updated to v19.1.1 with latest features
  • TypeScript: Strict mode with all strict flags enabled

UI/UX Enhancements

  • Tailwind CSS v4: Modern utility-first CSS framework
  • shadcn/ui: Comprehensive component library (New York style)
  • Radix UI: 15+ primitive components for accessibility
  • Framer Motion: Advanced animations and transitions
  • lucide-react: Modern icon library

Development Tools

  • Vitest: Modern testing framework with UI support
  • ESLint: Updated configuration with Next.js integration
  • TypeScript: Enhanced configuration with strict typing

3. New Features & Capabilities

Agent Management

  • Agent Selector: Multi-agent selection with health indicators
  • Agent Health Monitoring: Real-time status tracking
  • Agent Configuration: Flexible configuration system
  • Agent Persistence: Local storage for agent settings

Enhanced Chat Interface

  • Rich Message Rendering: Support for code blocks, images, web previews
  • Interactive Elements: Actions, confirmations, inline citations
  • Advanced Features: Chain-of-thought visualization, reasoning displays
  • Model Selection: Support for multiple AI models (Anthropic, OpenAI)

Developer Experience

  • Comprehensive Documentation: Multiple README files for different use cases
  • Agent Management Guide: Detailed documentation (AGENT_MANAGEMENT.md)
  • Testing Framework: Vitest with comprehensive test coverage
  • Build System: Dual build system for app and library exports

4. File Structure Changes

Added Files (150+ new files)

  • AI Elements: 30+ new components in src/components/ai-elements/
  • UI Components: Enhanced shadcn/ui components
  • Hooks: New React hooks for agent management
  • Utilities: Comprehensive utility functions
  • Tests: Extensive test coverage
  • Documentation: Multiple README and guide files
  • Assets: 19 avatar images for agent representation

Removed Files

  • Legacy Components: Old chat and MCP server management components
  • Outdated APIs: Removed old API routes and server management
  • Deprecated Styles: Replaced with new design system

Modified Files

  • Package Configuration: Complete overhaul of package.json
  • Build Configuration: Updated tsup.config.ts, tsconfig.json
  • Deployment: Enhanced wrangler.jsonc for Cloudflare Workers
  • Styling: Complete rewrite of global CSS

5. Export System

The package now provides a comprehensive export system:

// Main exports
export { PlaygroundProvider } from "./lib/exports/playground-provider"
export { Playground } from "./lib/exports/playground"
export { ChatContainer } from "./lib/exports/chat-container"

// Components
export * from "./lib/exports/components"

// Hooks
export * from "./lib/exports/hooks"

// Utilities
export * from "./lib/exports/utils"
export * from "./lib/exports/storage"

6. Testing & Quality Assurance

Test Coverage

  • Unit Tests: Comprehensive test suites for core functionality
  • Component Tests: React component testing with Testing Library
  • Integration Tests: End-to-end testing capabilities
  • Test Utilities: Custom test setup and utilities

Code Quality

  • TypeScript: Strict typing throughout codebase
  • ESLint: Comprehensive linting rules
  • Prettier: Code formatting consistency
  • Error Handling: Robust error handling with custom error types

Breaking Changes

API Changes

  • Complete API Redesign: Old MCP server management APIs removed
  • New Agent-Centric API: Focus on agent management and chat
  • Export Changes: New modular export system

Configuration Changes

  • Removed: Old configuration files and settings
  • New: Agent-specific configuration system
  • Migration: Manual migration required for existing implementations

Dependency Changes

  • Major Version Updates: Next.js, React, TypeScript upgrades
  • New Dependencies: 20+ new packages for enhanced functionality
  • Removed Dependencies: Old MCP-specific packages

Migration Guide

For Existing Users

  1. Review New Architecture: Understand the agent-centric approach
  2. Update Dependencies: Ensure compatibility with new versions
  3. Migrate Configuration: Use new agent configuration system
  4. Update Imports: Use new export system
  5. Test Thoroughly: Validate functionality with new system

For New Users

  1. Follow Setup Guide: Use setup-chat.md for initial setup
  2. Review Documentation: Read AGENT_MANAGEMENT.md for detailed guidance
  3. Explore Examples: Check showcase examples for implementation patterns

@felixnorden felixnorden linked an issue Nov 17, 2025 that may be closed by this pull request
AGENTS.md Outdated
- Mock filesystem with memfs where needed

## Development Practices
- Use yarn for package management
Copy link
Contributor

Choose a reason for hiding this comment

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

We should be using pnpm, we mostly reference this in our docs

Copy link
Contributor

Choose a reason for hiding this comment

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

@felixnorden yarn is still mentioned here

AGENTS.md Outdated
- Example application: examples/crud-mcp/src/index.ts

## Development Workflow
1. Install dependencies at root level: `yarn install`
Copy link
Contributor

Choose a reason for hiding this comment

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

same here

</PlaygroundProvider>
);
}
yarn dev
Copy link
Contributor

Choose a reason for hiding this comment

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

we should remove the others to stay in line with using pnpm across

@felixnorden
Copy link
Collaborator Author

felixnorden commented Nov 18, 2025 via email

AGENTS.md Outdated
- Mock filesystem with memfs where needed

## Development Practices
- Use yarn for package management
Copy link
Contributor

Choose a reason for hiding this comment

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

@felixnorden yarn is still mentioned here

@github-actions
Copy link
Contributor

🐳 Preview MCP Toolbox Docker Image Built

Image: ghcr.io/null-shot/typescript-agent-tookit/mcp-toolbox:pr-105

Tags:
ghcr.io/null-shot/typescript-agent-tookit/mcp-toolbox:pr-105
ghcr.io/null-shot/typescript-agent-tookit/mcp-toolbox:pr-105-5238ef3

Usage:

# Pull the preview image
docker pull ghcr.io/null-shot/typescript-agent-tookit/mcp-toolbox:pr-105

# Run the MCP Toolbox server
docker run -p 11990:11990 \
  -e PROXY_ID=preview-toolbox-105 \
  -e MCP_SERVER_HOST=host.docker.internal:6050 \
  --add-host host.docker.internal:host-gateway \
  -v $(pwd)/data:/app/data \
  ghcr.io/null-shot/typescript-agent-tookit/mcp-toolbox:pr-105

Health Check:

curl http://localhost:11990/health

Note: Preview images are automatically cleaned up after 7 days.

@github-actions
Copy link
Contributor

🐳 Preview MCP Toolbox Docker Image Built

Image: ghcr.io/null-shot/typescript-agent-tookit/mcp-toolbox:pr-105

Tags:
ghcr.io/null-shot/typescript-agent-tookit/mcp-toolbox:pr-105
ghcr.io/null-shot/typescript-agent-tookit/mcp-toolbox:pr-105-ba2f74f

Usage:

# Pull the preview image
docker pull ghcr.io/null-shot/typescript-agent-tookit/mcp-toolbox:pr-105

# Run the MCP Toolbox server
docker run -p 11990:11990 \
  -e PROXY_ID=preview-toolbox-105 \
  -e MCP_SERVER_HOST=host.docker.internal:6050 \
  --add-host host.docker.internal:host-gateway \
  -v $(pwd)/data:/app/data \
  ghcr.io/null-shot/typescript-agent-tookit/mcp-toolbox:pr-105

Health Check:

curl http://localhost:11990/health

Note: Preview images are automatically cleaned up after 7 days.

@github-actions
Copy link
Contributor

🐳 Preview MCP Toolbox Docker Image Built

Image: ghcr.io/null-shot/typescript-agent-tookit/mcp-toolbox:pr-105

Tags:
ghcr.io/null-shot/typescript-agent-tookit/mcp-toolbox:pr-105
ghcr.io/null-shot/typescript-agent-tookit/mcp-toolbox:pr-105-d06e40d

Usage:

# Pull the preview image
docker pull ghcr.io/null-shot/typescript-agent-tookit/mcp-toolbox:pr-105

# Run the MCP Toolbox server
docker run -p 11990:11990 \
  -e PROXY_ID=preview-toolbox-105 \
  -e MCP_SERVER_HOST=host.docker.internal:6050 \
  --add-host host.docker.internal:host-gateway \
  -v $(pwd)/data:/app/data \
  ghcr.io/null-shot/typescript-agent-tookit/mcp-toolbox:pr-105

Health Check:

curl http://localhost:11990/health

Note: Preview images are automatically cleaned up after 7 days.

@github-actions
Copy link
Contributor

🐳 Preview MCP Toolbox Docker Image Built

Image: ghcr.io/null-shot/typescript-agent-tookit/mcp-toolbox:pr-105

Tags:
ghcr.io/null-shot/typescript-agent-tookit/mcp-toolbox:pr-105
ghcr.io/null-shot/typescript-agent-tookit/mcp-toolbox:pr-105-dd44772

Usage:

# Pull the preview image
docker pull ghcr.io/null-shot/typescript-agent-tookit/mcp-toolbox:pr-105

# Run the MCP Toolbox server
docker run -p 11990:11990 \
  -e PROXY_ID=preview-toolbox-105 \
  -e MCP_SERVER_HOST=host.docker.internal:6050 \
  --add-host host.docker.internal:host-gateway \
  -v $(pwd)/data:/app/data \
  ghcr.io/null-shot/typescript-agent-tookit/mcp-toolbox:pr-105

Health Check:

curl http://localhost:11990/health

Note: Preview images are automatically cleaned up after 7 days.

@github-actions
Copy link
Contributor

🐳 Preview MCP Toolbox Docker Image Built

Image: ghcr.io/null-shot/typescript-agent-tookit/mcp-toolbox:pr-105

Tags:
ghcr.io/null-shot/typescript-agent-tookit/mcp-toolbox:pr-105
ghcr.io/null-shot/typescript-agent-tookit/mcp-toolbox:pr-105-e7fbf64

Usage:

# Pull the preview image
docker pull ghcr.io/null-shot/typescript-agent-tookit/mcp-toolbox:pr-105

# Run the MCP Toolbox server
docker run -p 11990:11990 \
  -e PROXY_ID=preview-toolbox-105 \
  -e MCP_SERVER_HOST=host.docker.internal:6050 \
  --add-host host.docker.internal:host-gateway \
  -v $(pwd)/data:/app/data \
  ghcr.io/null-shot/typescript-agent-tookit/mcp-toolbox:pr-105

Health Check:

curl http://localhost:11990/health

Note: Preview images are automatically cleaned up after 7 days.

@github-actions
Copy link
Contributor

🐳 Preview MCP Toolbox Docker Image Built

Image: ghcr.io/null-shot/typescript-agent-tookit/mcp-toolbox:pr-105

Tags:
ghcr.io/null-shot/typescript-agent-tookit/mcp-toolbox:pr-105
ghcr.io/null-shot/typescript-agent-tookit/mcp-toolbox:pr-105-e7df852

Usage:

# Pull the preview image
docker pull ghcr.io/null-shot/typescript-agent-tookit/mcp-toolbox:pr-105

# Run the MCP Toolbox server
docker run -p 11990:11990 \
  -e PROXY_ID=preview-toolbox-105 \
  -e MCP_SERVER_HOST=host.docker.internal:6050 \
  --add-host host.docker.internal:host-gateway \
  -v $(pwd)/data:/app/data \
  ghcr.io/null-shot/typescript-agent-tookit/mcp-toolbox:pr-105

Health Check:

curl http://localhost:11990/health

Note: Preview images are automatically cleaned up after 7 days.

@github-actions
Copy link
Contributor

🐳 Preview MCP Toolbox Docker Image Built

Image: ghcr.io/null-shot/typescript-agent-tookit/mcp-toolbox:pr-105

Tags:
ghcr.io/null-shot/typescript-agent-tookit/mcp-toolbox:pr-105
ghcr.io/null-shot/typescript-agent-tookit/mcp-toolbox:pr-105-bc35fdd

Usage:

# Pull the preview image
docker pull ghcr.io/null-shot/typescript-agent-tookit/mcp-toolbox:pr-105

# Run the MCP Toolbox server
docker run -p 11990:11990 \
  -e PROXY_ID=preview-toolbox-105 \
  -e MCP_SERVER_HOST=host.docker.internal:6050 \
  --add-host host.docker.internal:host-gateway \
  -v $(pwd)/data:/app/data \
  ghcr.io/null-shot/typescript-agent-tookit/mcp-toolbox:pr-105

Health Check:

curl http://localhost:11990/health

Note: Preview images are automatically cleaned up after 7 days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Open-Source Agent Chat UI Component

3 participants