|
| 1 | +# 🤖 Copilot SDK Integration Roadmap (TODO.SDK.md) |
| 2 | + |
| 3 | +Objective: Integrate the official GitHub Copilot SDK to provide native, streaming LLM capabilities with proper session management and tool bridging. |
| 4 | + |
| 5 | +## Prerequisites |
| 6 | +- [x] Analyze `copilot-sdk/go` architecture and types |
| 7 | +- [x] Ensure `copilot` CLI is detectable/installable (graceful fallback if missing) |
| 8 | + |
| 9 | +--- |
| 10 | + |
| 11 | +## Phase 1: Foundation (SDK Provider) ✅ |
| 12 | +- [x] **Create `internal/copilot/` package** |
| 13 | + - [x] `provider.go` - Implement `model.Provider` interface wrapping SDK |
| 14 | + - [x] `bridge.go` - Bridge VibeAuracle `tooling.Tool` → Copilot SDK `Tool` |
| 15 | + - [x] `events.go` - Handle streaming events (`assistant.message_delta`, etc.) |
| 16 | + - [x] `mcp.go` - Bridge for Model Context Protocol servers |
| 17 | + |
| 18 | +- [x] **Add SDK dependency** |
| 19 | + - [x] Add `github.com/github/copilot-sdk/go` to workspace (`internal/copilot-sdk-go`) |
| 20 | + - [x] Configure local replace directive pointing to `./internal/copilot-sdk-go` |
| 21 | + |
| 22 | +- [x] **Graceful Detection** |
| 23 | + - [x] Check if `copilot` CLI exists in PATH |
| 24 | + - [x] Fall back to existing `langchaingo` OpenAI provider if missing |
| 25 | + - [x] Log clear message about degraded mode |
| 26 | + |
| 27 | +--- |
| 28 | + |
| 29 | +## Phase 2: Brain Integration ✅ |
| 30 | +- [x] **Wire into Cognitive Loop** |
| 31 | + - [x] Import copilot package in brain |
| 32 | + - [x] Auto-select `copilot-sdk` when CLI available and gh auth present |
| 33 | + - [x] Dual generation path (SDK or standard model) |
| 34 | + - [x] Graceful shutdown via `Brain.Shutdown()` |
| 35 | + |
| 36 | +- [x] **System Message Customization** |
| 37 | + - [x] Use `SystemMessageConfig.Mode = "append"` to inject VibeAuracle personality |
| 38 | + - [x] Preserve SDK guardrails while adding our prompt layers |
| 39 | + |
| 40 | +--- |
| 41 | + |
| 42 | +## Phase 3: Tool Bridge ✅ |
| 43 | +- [x] **Export VibeAuracle Tools to Copilot** |
| 44 | + - [x] Convert `tooling.ToolMetadata` → `copilot.Tool` |
| 45 | + - [x] Auto-generate JSON schema from our `Parameters` field |
| 46 | + - [x] Implement `ToolHandler` that routes to our `Tool.Execute()` |
| 47 | + - [x] Register core tools with SDK on startup |
| 48 | + |
| 49 | +- [ ] **Bi-directional Tool Awareness** |
| 50 | + - [ ] Allow Copilot's native tools (file, bash, etc.) to coexist |
| 51 | + - [ ] Use `AvailableTools`/`ExcludedTools` for fine-grained control |
| 52 | + |
| 53 | +--- |
| 54 | + |
| 55 | +## Phase 4: Streaming & Events ✅ |
| 56 | +- [x] **Replace Blocking Generation** |
| 57 | + - [x] Use `session.On()` event handler for callbacks |
| 58 | + - [x] Emit `assistant.message_delta` to provider callbacks |
| 59 | + - [x] Handle `session.idle` to know when response is complete |
| 60 | + |
| 61 | +- [x] **TUI Integration** |
| 62 | + - [x] Add `streamDeltaMsg` and `streamDoneMsg` message types |
| 63 | + - [x] Add streaming content state to model struct |
| 64 | + - [x] Real-time viewport updates with cursor indicator |
| 65 | + |
| 66 | +--- |
| 67 | + |
| 68 | +## Phase 5: BYOK (Bring Your Own Key) ✅ |
| 69 | +- [x] **Custom Provider Passthrough** |
| 70 | + - [x] Add `ProviderOptions` struct with BYOK fields |
| 71 | + - [x] Check vault for `openai_api_key` and `anthropic_api_key` |
| 72 | + - [x] Configure `sdk.ProviderConfig` with custom credentials |
| 73 | + - [x] Allow `BaseURL` override for local models (Ollama via OpenAI-compat) |
| 74 | + |
| 75 | +--- |
| 76 | + |
| 77 | +## Phase 6: MCP Integration ✅ |
| 78 | +- [x] **Model Context Protocol** |
| 79 | + - [x] Create `MCPBridge` in `internal/copilot/mcp.go` |
| 80 | + - [x] Support local/stdio and remote HTTP/SSE servers |
| 81 | + - [x] `RegisterMCPServers()` for SDK session config |
| 82 | + - [x] Common MCP server presets (filesystem, github, memory) |
| 83 | + |
| 84 | +--- |
| 85 | + |
| 86 | +## Implementation Status |
| 87 | +✅ Phase 1 Complete - Foundation SDK provider with streaming and tool bridge |
| 88 | +✅ Phase 2 Complete - Brain integration with dual-path generation |
| 89 | +✅ Phase 3 Complete - Core tools registered with Copilot SDK |
| 90 | +✅ Phase 4 Complete - Streaming events and TUI integration |
| 91 | +✅ Phase 5 Complete - BYOK support for OpenAI/Anthropic/Ollama |
| 92 | +✅ Phase 6 Complete - MCP server bridge |
| 93 | + |
| 94 | +## Build Status |
| 95 | +``` |
| 96 | +✅ internal/copilot - builds successfully |
| 97 | +✅ internal/brain - builds successfully |
| 98 | +✅ internal/model - builds successfully |
| 99 | +✅ cmd/vibeaura - builds successfully |
| 100 | +``` |
| 101 | + |
| 102 | +## Files Created/Modified |
| 103 | +- `internal/copilot/provider.go` - Main SDK provider with BYOK |
| 104 | +- `internal/copilot/bridge.go` - VibeAuracle tool → SDK tool bridge |
| 105 | +- `internal/copilot/events.go` - Event routing for streaming |
| 106 | +- `internal/copilot/mcp.go` - MCP server integration |
| 107 | +- `internal/brain/brain.go` - Dual-path generation, tool registration |
| 108 | +- `cmd/vibeaura/chat.go` - TUI streaming support |
0 commit comments