Skip to content

Latest commit

 

History

History
108 lines (85 loc) · 4.17 KB

File metadata and controls

108 lines (85 loc) · 4.17 KB

🤖 Copilot SDK Integration Roadmap (TODO.SDK.md)

Objective: Integrate the official GitHub Copilot SDK to provide native, streaming LLM capabilities with proper session management and tool bridging.

Prerequisites

  • Analyze copilot-sdk/go architecture and types
  • Ensure copilot CLI is detectable/installable (graceful fallback if missing)

Phase 1: Foundation (SDK Provider) ✅

  • Create internal/copilot/ package

    • provider.go - Implement model.Provider interface wrapping SDK
    • bridge.go - Bridge VibeAuracle tooling.Tool → Copilot SDK Tool
    • events.go - Handle streaming events (assistant.message_delta, etc.)
    • mcp.go - Bridge for Model Context Protocol servers
  • Add SDK dependency

    • Add github.com/github/copilot-sdk/go to workspace (internal/copilot-sdk-go)
    • Configure local replace directive pointing to ./internal/copilot-sdk-go
  • Graceful Detection

    • Check if copilot CLI exists in PATH
    • Fall back to existing langchaingo OpenAI provider if missing
    • Log clear message about degraded mode

Phase 2: Brain Integration ✅

  • Wire into Cognitive Loop

    • Import copilot package in brain
    • Auto-select copilot-sdk when CLI available and gh auth present
    • Dual generation path (SDK or standard model)
    • Graceful shutdown via Brain.Shutdown()
  • System Message Customization

    • Use SystemMessageConfig.Mode = "append" to inject VibeAuracle personality
    • Preserve SDK guardrails while adding our prompt layers

Phase 3: Tool Bridge ✅

  • Export VibeAuracle Tools to Copilot

    • Convert tooling.ToolMetadatacopilot.Tool
    • Auto-generate JSON schema from our Parameters field
    • Implement ToolHandler that routes to our Tool.Execute()
    • Register core tools with SDK on startup
  • Bi-directional Tool Awareness

    • Allow Copilot's native tools (file, bash, etc.) to coexist
    • Use AvailableTools/ExcludedTools for fine-grained control

Phase 4: Streaming & Events ✅

  • Replace Blocking Generation

    • Use session.On() event handler for callbacks
    • Emit assistant.message_delta to provider callbacks
    • Handle session.idle to know when response is complete
  • TUI Integration

    • Add streamDeltaMsg and streamDoneMsg message types
    • Add streaming content state to model struct
    • Real-time viewport updates with cursor indicator

Phase 5: BYOK (Bring Your Own Key) ✅

  • Custom Provider Passthrough
    • Add ProviderOptions struct with BYOK fields
    • Check vault for openai_api_key and anthropic_api_key
    • Configure sdk.ProviderConfig with custom credentials
    • Allow BaseURL override for local models (Ollama via OpenAI-compat)

Phase 6: MCP Integration ✅

  • Model Context Protocol
    • Create MCPBridge in internal/copilot/mcp.go
    • Support local/stdio and remote HTTP/SSE servers
    • RegisterMCPServers() for SDK session config
    • Common MCP server presets (filesystem, github, memory)

Implementation Status

✅ Phase 1 Complete - Foundation SDK provider with streaming and tool bridge ✅ Phase 2 Complete - Brain integration with dual-path generation ✅ Phase 3 Complete - Core tools registered with Copilot SDK ✅ Phase 4 Complete - Streaming events and TUI integration ✅ Phase 5 Complete - BYOK support for OpenAI/Anthropic/Ollama ✅ Phase 6 Complete - MCP server bridge

Build Status

✅ internal/copilot - builds successfully
✅ internal/brain - builds successfully
✅ internal/model - builds successfully  
✅ cmd/vibeaura - builds successfully

Files Created/Modified

  • internal/copilot/provider.go - Main SDK provider with BYOK
  • internal/copilot/bridge.go - VibeAuracle tool → SDK tool bridge
  • internal/copilot/events.go - Event routing for streaming
  • internal/copilot/mcp.go - MCP server integration
  • internal/brain/brain.go - Dual-path generation, tool registration
  • cmd/vibeaura/chat.go - TUI streaming support