Skip to content

feat: alpha → beta — major feature release#77

Merged
Rohitjoshi9023 merged 81 commits intomainfrom
beta
Mar 30, 2026
Merged

feat: alpha → beta — major feature release#77
Rohitjoshi9023 merged 81 commits intomainfrom
beta

Conversation

@Sahil5963
Copy link
Copy Markdown
Contributor

What's in this release

This PR brings all alpha work into main — a significant feature expansion across the SDK, UI layer, and developer tooling.


🔀 Fallback Chain & Routing (@yourgpt/llm-sdk/fallback)

New subpath export for multi-provider resilience:

  • createFallbackChain() — priority and round-robin routing across any LLMAdapter
  • Per-model retries with exponential/fixed backoff before falling back
  • FallbackExhaustedError with per-model failure breakdown
  • Pluggable RoutingStore interface (Redis, Upstash, Cloudflare KV, etc.)
  • onRetry / onFallback callbacks for observability
  • Smart error detection — 5xx, 429, timeouts retry; 4xx never falls back

💬 Conversation Branching

  • Full branch tree with MessageTree — create, switch, and persist branches
  • useBranching hook + <BranchNavigator /> component
  • Branch persistence via localStorage adapter

🧠 Context Management

  • Message history compaction strategies: sliding window, selective prune, summary buffer
  • useContextStats — live token usage tracking against the context window
  • Context budget controls and token counter utilities

🎯 Skills System

  • SkillProvider + useSkill / useSkillStatus hooks
  • Server-side skill loading from MDX frontmatter
  • Dynamic skill activation with __skills transport wire-up

📎 File Attachments

  • Full attachment handling in chat — upload, preview, and send media
  • useAttachments hook + <AttachmentStrip /> component
  • Drag-and-drop overlay support

💾 Storage Adapter

  • Plug-in any backend for automatic session + message persistence
  • Built-in localStorage adapter with auto-eviction
  • YourGPT cloud storage integration

🧩 Headless Primitives

  • useCopilotEvent — subscribe to SDK lifecycle events
  • useMessageMeta — per-message metadata without re-renders
  • Full headless Slack-style demo

🎨 Chat Primitives & Customization

  • ChatPrimitives — composable building blocks for custom layouts
  • messageView prop for fully custom message rendering
  • allowEdit, checkpoint exports, and message action slots
  • CSS class reference (csdk-*) for styling all overlays

⚙️ Generative UI (Experimental)

  • useGenerativeUI + generativeUITool — stream structured UI from the LLM
  • Built-in renderers: CardRenderer, TableRenderer, ChartRenderer, StatRenderer

🛠 DX & Examples

  • fallback-demo — Express server with 8 routes covering all fallback scenarios
  • headless-slack-demo — full Slack-style UI built on headless primitives
  • generative-ui-demo + skills-demo — standalone Vite examples
  • Deferred tools, tool profiles, hidden tools, agentic loop docs
  • Full docs pages: Fallback, Storage, Skills, Context, Branching, Headless, CSS Classes

Breaking changes

None — all additions are new exports or opt-in props.


🤖 Generated with Claude Code

Sahil5963 and others added 30 commits March 6, 2026 13:12
- Add Resolvable<T> type for static or getter function values
- Support dynamic headers, runtimeUrl, and body props
- Values resolved fresh at request time
- Backward compatible - static values still work

Co-Authored-By: Claude <noreply@anthropic.com>
- Added '@anthropic-ai/sdk' dependency to the project.
- Introduced a new test page for the Express demo showcasing custom tool renderers.
- Enhanced server-side tool execution tracking with hidden flags to manage UI visibility.
- Updated environment variables and package versions for better integration.
- Improved knowledge base search functionality and tool execution management in the Copilot SDK.
…rsion

- Bump version from 2.1.3 to 2.1.4 in package.json.
- Improve zodToJsonSchema function to support ToolInputSchema compatibility.
- Refactor internal schema conversion logic for better clarity and maintainability.
- Enhance useTool hook to support both Zod schemas and JSON schemas for input parameters.
- Introduced a BODY_SIZE_LIMIT environment variable for request size management.
- Added minimal runtime for a simple AI assistant prompt.
- Implemented two new endpoints: a streaming endpoint and a non-streaming endpoint for copilot responses.
…fied tool search

Breaking: removed agentLoop config block (use flat maxIterations + toolSearch),
removed toolCatalog from ChatRequest (use tools only), removed AgentLoopConfig /
ToolSelectionConfig / ToolDynamicSelectionConfig from public API, removed
strictDeferredLoading and providerHints (use flat toolChoice/parallelCalls in ToolSearchConfig).

New: auto-detection of deferred tools (zero config, deferLoading flag on tool is
enough), flat ToolSearchConfig with description/name/maxEagerTools/maxResults/
exposeWhenExceeds/toolChoice/parallelCalls/defaultProfile/profiles/includeUnprofiled,
native provider tool search auto-detected for Anthropic Sonnet/Opus 4+ and GPT-5.4+,
ToolSearchConfig now exported from server index, full BM25 rewrite in tool-selection.ts
(selectTools, searchTools, filterToolsByProfile, shouldExposeToolSearch,
resolveNativeToolSearch, buildProviderToolOptions), AgentLoopOptions flattened to
maxIterations/debug/toolSelectionConfig.

copilot-sdk: useTool hook gains deferLoading/profiles/searchKeywords/group/category/
resultConfig/title/executingTitle/completedTitle/aiResponseMode/aiContext props;
CopilotProvider maxIterations promoted to top-level; AbstractChat.buildRequest sends full
tools array with deferLoading flags intact for server-side deferred management;
HttpTransport drops toolCatalog from request body.

Examples: express-demo migrated to flat API with profiles and debug payload capture;
tool-scale example updated for 100-tool deferred loading; other routes updated.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add skill-system/ (types, registry, load-skills, frontmatter) for defining and resolving skills
- Add react/skill/ (SkillProvider, SkillContext, define-skill) for React integration
- Add useSkill hook for per-component skill registration/unregistration
- Add useSkillStatus hook for querying registered skill state
- Add setInlineSkills to ChatWithTools (delegates to AbstractChat)
- Add setInlineSkills + skills prop to CopilotProvider
- Export all skills APIs from react/index.ts
- Rename from skills/ to skill-system/ and react/skill/ to avoid .gitignore conflict with Claude Code skill folders
- Fix source type mapping in SkillProvider (inline→client-inline, url→remote-url, file→server-dir)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add server/index.ts entry (loadSkills, SkillRegistry, parseSkillFile + all types)
- Add ./server subpath export to package.json
- Add server/index build entry to tsup.config.ts
- Add __skills field to ChatRequest interface (ChatTransport.ts)
- Pass __skills in HttpTransport request body so server receives inline client skills

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add react/message-history/types.ts: DisplayMessage (extends UIMessage),
  CompactionMarker, LLMMessage, CompactedToolResult, SessionCompactionState,
  TokenUsage, CompactionEvent, CompactionStrategy, MessageHistoryConfig,
  UseMessageHistoryOptions, UseMessageHistoryReturn
- Add react/message-history/message-utils.ts: toDisplayMessage(), toLLMMessage(),
  toLLMMessages(), keepToolPairsAtomic(), findSafeWindowStart(), type guards
- Add react/message-history/context.ts: MessageHistoryContext + defaults
- Add react/message-history/useMessageHistory.ts: Phase 1 skeleton — promotes
  UIMessages to DisplayMessages, builds llmMessages (no compaction yet)
- Export all from react/index.ts

Strategy 'none' (default) preserves 100% backward-compat.
Phases 2-5 add compaction strategies on top of this foundation.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Introduced a new `message-history` system to manage long conversations within token limits.
- Added four compaction strategies: `none`, `sliding-window`, `selective-prune`, and `summary-buffer`.
- Implemented `useMessageHistory` hook for dual-layer message access with optional compaction.
- Added session persistence for display messages and compaction state using localStorage and IndexedDB.
- Enhanced token estimation with a two-tier system for improved accuracy.
- Integrated compaction triggers and UI indicators for user feedback during compaction processes.

This update lays the groundwork for efficient message management and enhances user experience by maintaining context while optimizing token usage.
- Introduced a new logging utility to improve debug output with scoped logging capabilities.
- Updated the `ChatWithTools` and `AbstractChat` classes to utilize the new logger for better debugging.
- Refactored the `AbstractAgentLoop` to execute tool calls in parallel, improving performance and responsiveness.
- Enhanced message handling in `CopilotProvider` to support new logging features.
- Cleaned up code by removing unnecessary line breaks and comments for better readability.

These changes aim to improve the overall debugging experience and performance of the SDK.
- Introduced a `fallbackToolRenderer` prop to the `Chat` and `DefaultMessage` components, allowing for a catch-all rendering option for unmatched tools.
- Implemented `groupConsecutiveMessages` functionality to hide avatars for consecutive messages from the same role, enhancing message display in chat.
- Updated type definitions to include new props and ensure proper usage across components.

These enhancements improve the flexibility of tool rendering and the visual organization of chat messages.
…acking

- Added the `useContextStats` hook to provide live statistics on the AI copilot's context window usage, including token counts and percentages.
- Updated `CopilotProvider` to manage context characters and usage, ensuring reactive updates during message interactions.
- Re-exported relevant types and hooks for better accessibility in the SDK.

These enhancements improve the monitoring of context usage, aiding in efficient resource management during interactions.
- MessageTree: bidirectional flat-map tree (parentId + childrenIds[] + activeChildMap)
- ReactChatState: backed by MessageTree; messages getter = visible path; getAllMessages() = all branches
- AbstractChat: branch-aware regenerate() (setCurrentLeaf instead of slice); sendMessage({editMessageId}) fork support
- ChatWithTools + ReactChat + ReactChatWithTools: switchBranch/getBranchInfo/editMessage/hasBranches pass-throughs
- useChat/CopilotProvider/CopilotContext: branching methods wired into context
- BranchNavigator: ← N/M → presentational component
- default-message: inline edit (pencil on hover, textarea, submit), BranchNavigator below user bubbles
- connected-chat: switchBranch/getBranchInfo/editMessage wired from useCopilot to Chat
- BranchInfo/MessageTree exported from chat/index + react/index (framework-agnostic)
- All new fields optional — zero breaking changes for linear conversations

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…Messages

- CopilotProvider: add getAllMessages() to CopilotContextValue; onMessagesChange effect
  now uses chatRef.current.getAllMessages() so all branches (not just visible path) are
  passed to external callbacks; adds parent_id/children_ids to Message mapping
- useInternalThreadManager: destructure getAllMessages from useCopilot(); save effect
  now persists getAllMessages() instead of visible-path messages; convertToCore includes
  parent_id/children_ids; both load paths (switchThread + auto-restore) now map
  parent_id→parentId and children_ids→childrenIds so branches survive page reload

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- AbstractChat: _allMessages() helper — onMessagesChange callbacks now pass
  all branches (not just visible path) for framework-agnostic persistence
- AbstractChat: regenerate(messageId) falls back to getAllMessages() when
  target is on an inactive branch (was silently failing before)
- BRANCHING.md: full feature doc — APIs, DB changes, adoption guide,
  how-it-works, live demo reference
- examples/experimental: /branching demo route — BranchTreePanel live tree
  visualization + CopilotChat side-by-side inside one CopilotProvider

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Introduced comprehensive documentation for the new context management features, detailing dual-layer message storage, message history compaction strategies, and token counting.
- Added a skills system section explaining the use of skills as instruction playbooks, including client-side and server-side implementations, skill file formats, and the `defineSkill` helper.
- Enhanced the overall structure and clarity of the documentation to facilitate better understanding and usage of the SDK's capabilities.
Merges feat/branching and feature/skills-system into a single
release/alpha integration branch. Resolves all conflicts by
keeping both feature sets (messageHistory + skills props,
compactSession + loadSkills server exports, context stats +
skill hooks).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…odes

Streaming fixes (AbstractChat.ts):
- All three updateMessageById calls now preserve parentId/childrenIds from
  the pre-pushed placeholder so the branch tree is not corrupted when
  setCurrentLeaf() walks up the chain. Root cause was the final finalization
  block running after the per-chunk fix and re-discarding parentId.

Non-streaming fixes (AbstractChat.ts):
- handleJsonResponse now chains parentId correctly so AI messages are
  placed as children of the current leaf, not at root level.
- Placeholder removal now uses getAllMessages() instead of visible-only
  messages so inactive branches are preserved across tree.reset().
- Active path is captured before tree.reset() and restored after so edits
  on any branch land on the correct parent node.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- New header: layered logo icon + Syne display font, clean back button,
  edit hint with icon — feat/branching badge removed
- Background: deep navy with radial indigo/violet gradient mesh
- Branch tree panel: BRANCH TREE uppercase label, stat chips (total/visible),
  indigo branched badge, tree connector lines (vertical + horizontal elbows),
  green active dots with glow, blue U / orange A role badges, monospace font
- Chat header renamed to AI Copilot, loaderVariant set to wave
- Top gradient accent bar increased to 3px
- runtimeUrl switched back to /api/chat/branching (streaming)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Brings in branch tree corruption fixes (streaming + non-streaming)
and the redesigned branching demo with premium dark UI.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Updated AbstractChat to correctly chain tool messages under the appropriate parent message, ensuring proper conversation flow.
- Adjusted error handling for unresolved tool calls to maintain message hierarchy.
- Improved rendering logic in DefaultMessage to prioritize tool's own render function over fallback options, enhancing customization for tool results.
…tion

- Refactored the minimal runtime setup to support both Claude and GPT models, allowing dynamic selection based on the x-copilot-model header.
- Updated API endpoints to utilize the selected runtime for processing requests.
- Enhanced health check response to list available models and provide selection hints.
- Bumped copilot-sdk version to 2.1.5-alpha.1.
- Added a new `messageView` prop to `<CopilotChat>` and `<Chat>` components, allowing developers to customize the message list rendering.
- Enhanced the API to provide pre-rendered message elements and raw messages for conditional rendering.
- Updated documentation to include usage examples and details on the new prop.
- Bumped version to 2.1.5-alpha.2 to reflect these changes.
- Shipped the headless primitive API for chat components, allowing developers to build custom chat layouts using `ChatPrimitives`.
- Updated documentation to reflect the new API and provide usage examples.
- Added message actions support with floating action buttons for user and assistant messages.
- Enhanced the `DefaultMessage` component to integrate floating actions and improve message rendering flexibility.
…ence controls

- Updated the thread data structure to include an optional activeLeafId for preserving branch selection across reloads.
- Enhanced the ThreadManager to handle activeLeafId during thread creation and updates.
- Modified CopilotProvider and internal thread manager to support parentId and childrenIds for improved message hierarchy.
- Added an enabled flag to control thread management effects based on persistence settings, preventing unwanted interactions in non-persistent instances.
- Bumped version to 2.1.5-alpha.3 to reflect these changes.
Docs (apps/docs):
- Convert chat.mdx → chat/ folder with branching + message-actions sub-pages
- Convert smart-ai-context.mdx → context/ folder with compaction, token-tracking, session sub-pages
- Convert customizations.mdx → customizations/ folder with chat-primitives + custom-message-view sub-pages
- Add skills/ section (index, client, server)
- Add tools/deferred-tools.mdx and tools/hidden-tools.mdx
- All new alpha pages marked Beta in sidebar badge and page callout

Playground (examples/playground):
- Add AlphaConfig type with message actions, branching, skills, context management, tools, custom message view
- Add AlphaFeaturesSection control panel accordion with all toggles
- Add ContextStatsBar (useContextStats token usage display)
- Add HiddenAnalyticsTool (hidden: true demo) and DeferredSearchTool (deferLoading: true demo)
- Wire SkillProvider with brand-voice (eager) and code-review (auto) skills
- Add CopilotChat.MessageActions (Copy, Edit, Feedback) to all three layouts
- Add messageView custom footer demo
- All alpha config persisted to localStorage

SDK (packages/copilot-sdk):
- Forward MessageActions, CopyAction, EditAction, FeedbackAction onto CopilotChat export in connected-chat.tsx

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Remove unsupported page object syntax from all meta.json files
- Narrow skills/ gitignore rule to examples/*/skills/ so docs/skills/ is tracked

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sahil5963 and others added 2 commits March 29, 2026 12:12
Adds @yourgpt/llm-sdk/fallback subpath export:
- createFallbackChain() with priority and round-robin routing
- Per-model retries with exponential/fixed backoff before fallback
- FallbackExhaustedError with per-model failure breakdown
- MemoryRoutingStore (default) + pluggable RoutingStore interface
- onRetry / onFallback observability callbacks
- Two-tier error detection (class-based for complete(), message-regex for stream())

Includes fallback-demo example and docs page.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds @yourgpt/llm-sdk/fallback subpath export:
- createFallbackChain() with priority and round-robin routing
- Per-model retries with exponential/fixed backoff before fallback
- FallbackExhaustedError with per-model failure breakdown
- MemoryRoutingStore (default) + pluggable RoutingStore interface
- onRetry / onFallback observability callbacks
- Two-tier error detection (class-based for complete(), message-regex for stream())

Includes fallback-demo example and docs page.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 29, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
copilot-playground Ready Ready Preview, Comment Mar 31, 2026 2:18pm
copilot-sdk-docs Ready Ready Preview, Comment Mar 31, 2026 2:18pm

Request Review

Sahil5963 and others added 2 commits March 29, 2026 12:18
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
# Conflicts:
#	pnpm-lock.yaml
Sahil5963 and others added 2 commits March 29, 2026 12:22
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…o and generative-ui-demo

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ensions with composite

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sahil5963 and others added 3 commits March 29, 2026 19:19
…ion and UI improvements

- Added support for dynamic skills registration via API, allowing skills to be registered at runtime.
- Updated server to handle dynamic skills, including new endpoints for skill management.
- Introduced a new skill for frontend design with detailed guidelines.
- Improved UI with new font styles (DM Sans and DM Mono) and animations for skill activation.
- Enhanced the skills panel to display both static and dynamic skills, improving user experience.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Added 'vaul' version 1.1.2 and 'tw-animate-css' version 1.4.0 to dependencies.
- Updated 'yourgpt-server-demo' with new dependencies including 'cors', 'dotenv', 'express', and 'ws'.
- Updated devDependencies for 'yourgpt-server-demo' with '@types/cors', '@types/express', '@types/ws', 'tsx', and 'typescript'.
- Updated integrity checks for '@types/ws' and 'vaul' in the lockfile.
- Deleted the comprehensive documentation for the tool management branch, which included details on features, configurations, and known issues related to the tool management stack across copilot-sdk and llm-sdk.
@Rohitjoshi9023 Rohitjoshi9023 merged commit 3a25c66 into main Mar 30, 2026
4 checks passed
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.

2 participants