feat: RAG, memory, plugins, lessons, file editor, split panes, Markdown rendering, PWA + UI overhaul
All checks were successful
Stable Release / stable (push) Successful in 1m34s
All checks were successful
Stable Release / stable (push) Successful in 1m34s
Major additions: - RAG pipeline (indexing, chunking, search) with sidebar upload button - Memory system with CRUD API - Plugins and lessons modules - MCP discovery and MCP server - Advanced skills (auto-create, conditional, improver) - Agent browser/image support, delegate, sessions - File editor with CodeMirror in split panes - Markdown rendering via react-markdown + KaTeX + highlight.js - Raw markdown toggle - PWA manifest + service worker - Extension UI redesign with new design tokens and studio-style chat - Pipeline API for chat streaming - Mobile responsive layout 💘 Generated with Crush Assisted-by: GLM-5.1 via Crush <crush@charm.land>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
@@ -11,6 +12,11 @@ import (
|
||||
"github.com/muyue/muyue/internal/agent"
|
||||
"github.com/muyue/muyue/internal/config"
|
||||
"github.com/muyue/muyue/internal/installer"
|
||||
"github.com/muyue/muyue/internal/lessons"
|
||||
"github.com/muyue/muyue/internal/memory"
|
||||
"github.com/muyue/muyue/internal/mcpserver"
|
||||
"github.com/muyue/muyue/internal/plugins"
|
||||
"github.com/muyue/muyue/internal/rag"
|
||||
"github.com/muyue/muyue/internal/scanner"
|
||||
"github.com/muyue/muyue/internal/workflow"
|
||||
)
|
||||
@@ -27,9 +33,16 @@ type Server struct {
|
||||
shellAgentRegistry *agent.Registry
|
||||
shellAgentToolsJSON json.RawMessage
|
||||
workflowEngine *workflow.Engine
|
||||
pluginManager *plugins.Manager
|
||||
hookRegistry *plugins.HookRegistry
|
||||
browserTestStore *BrowserTestStore
|
||||
memoryStore *memory.Store
|
||||
ragStore *rag.Store
|
||||
pipeline *Pipeline
|
||||
activeCrushAgents atomic.Int32
|
||||
activeClaudeAgents atomic.Int32
|
||||
mcpServer *mcpserver.MCPServer
|
||||
agentTracker *AgentSessionTracker
|
||||
}
|
||||
|
||||
func NewServer(cfg *config.MuyueConfig) *Server {
|
||||
@@ -76,6 +89,33 @@ func NewServer(cfg *config.MuyueConfig) *Server {
|
||||
s.shellAgentToolsJSON = json.RawMessage(shellToolsJSON)
|
||||
|
||||
s.workflowEngine, _ = workflow.NewEngine(s.agentRegistry)
|
||||
|
||||
if cfg.Lessons.Enabled {
|
||||
lessons.EnsureBuiltinLessons()
|
||||
}
|
||||
|
||||
s.hookRegistry = plugins.NewHookRegistry()
|
||||
s.pluginManager = plugins.NewManager(s.hookRegistry)
|
||||
|
||||
pluginPaths := cfg.Plugins.Paths
|
||||
if len(pluginPaths) == 0 {
|
||||
pluginPaths = plugins.DefaultPluginPaths()
|
||||
}
|
||||
discovered := plugins.DiscoverPlugins(pluginPaths)
|
||||
for _, dp := range discovered {
|
||||
if dp.Valid {
|
||||
p, err := plugins.LoadExecutablePlugin(dp)
|
||||
if err == nil {
|
||||
s.pluginManager.Register(p)
|
||||
}
|
||||
}
|
||||
}
|
||||
s.pluginManager.EnableFromConfig(context.Background(), cfg.Plugins.Enabled, s.agentRegistry)
|
||||
|
||||
s.pipeline = NewPipeline()
|
||||
|
||||
s.agentTracker = NewAgentSessionTracker()
|
||||
|
||||
s.initStarship()
|
||||
s.routes()
|
||||
return s
|
||||
@@ -108,6 +148,7 @@ func (s *Server) routes() {
|
||||
s.mux.HandleFunc("/api/starship/apply-theme", s.handleApplyStarshipTheme)
|
||||
s.mux.HandleFunc("/api/providers/validate", s.handleValidateProvider)
|
||||
s.mux.HandleFunc("/api/update/run", s.handleRunUpdate)
|
||||
s.mux.HandleFunc("/api/images/generate", s.handleImageGenerate)
|
||||
s.mux.HandleFunc("/api/images/", s.handleServeImage)
|
||||
s.mux.HandleFunc("/api/chat", s.handleChat)
|
||||
s.mux.HandleFunc("/api/chat/history", s.handleChatHistory)
|
||||
@@ -157,6 +198,41 @@ func (s *Server) routes() {
|
||||
s.mux.HandleFunc("/api/test/sessions", s.handleBrowserTestSessions)
|
||||
s.mux.HandleFunc("/api/test/console/", s.handleBrowserTestConsole)
|
||||
s.mux.HandleFunc("/api/ws/browser-test", s.handleBrowserTestWS)
|
||||
|
||||
s.mux.HandleFunc("/api/skills/auto-create", s.handleSkillAutoCreate)
|
||||
s.mux.HandleFunc("/api/skills/proposals", s.handleSkillProposals)
|
||||
s.mux.HandleFunc("/api/skills/detail/", s.handleSkillDetail)
|
||||
s.mux.HandleFunc("/api/plugins", s.handlePlugins)
|
||||
s.mux.HandleFunc("/api/plugins/", s.handlePluginAction)
|
||||
s.mux.HandleFunc("/api/lessons", s.handleLessons)
|
||||
s.mux.HandleFunc("/api/lessons/match", s.handleLessonsMatch)
|
||||
s.mux.HandleFunc("/api/mcp/discover", s.handleMCPDiscover)
|
||||
s.mux.HandleFunc("/api/browser/navigate", s.handleBrowserNavigate)
|
||||
s.mux.HandleFunc("/api/browser/screenshot", s.handleBrowserScreenshot)
|
||||
s.mux.HandleFunc("/api/browser/action", s.handleBrowserAction)
|
||||
|
||||
s.mux.HandleFunc("/api/rag/index", s.handleRAGIndex)
|
||||
s.mux.HandleFunc("/api/rag/search", s.handleRAGSearch)
|
||||
s.mux.HandleFunc("/api/rag/status", s.handleRAGStatus)
|
||||
s.mux.HandleFunc("/api/rag/documents", s.handleRAGDocuments)
|
||||
s.mux.HandleFunc("/api/rag/index/", s.handleRAGDelete)
|
||||
s.mux.HandleFunc("/api/pipeline/filters", s.handlePipelineFilters)
|
||||
s.mux.HandleFunc("/api/pipeline/filters/", s.handlePipelineToggle)
|
||||
s.mux.HandleFunc("/api/memory", s.handleMemoryList)
|
||||
s.mux.HandleFunc("/api/memory/create", s.handleMemoryCreate)
|
||||
s.mux.HandleFunc("/api/memory/", s.handleMemoryOperation)
|
||||
s.mux.HandleFunc("/api/memory/search", s.handleMemorySearch)
|
||||
s.mux.HandleFunc("/api/memory/recall", s.handleMemoryRecall)
|
||||
s.mux.HandleFunc("/api/memory/context", s.handleMemoryContext)
|
||||
s.mux.HandleFunc("/api/files/content", s.handleFileContent)
|
||||
s.mux.HandleFunc("/api/mcp-server/status", s.handleMuyueMCPServerStatus)
|
||||
s.mux.HandleFunc("/api/mcp-server/start", s.handleMuyueMCPServerStart)
|
||||
s.mux.HandleFunc("/api/mcp-server/stop", s.handleMuyueMCPServerStop)
|
||||
s.mux.HandleFunc("/api/agent-sessions", s.handleAgentSessionsList)
|
||||
s.mux.HandleFunc("/api/agent-sessions/", s.handleAgentSessionOutput)
|
||||
s.mux.HandleFunc("/api/workspaces", s.handleWorkspaceList)
|
||||
s.mux.HandleFunc("/api/workspace", s.handleWorkspaceSave)
|
||||
s.mux.HandleFunc("/api/workspace/", s.handleWorkspaceGet)
|
||||
}
|
||||
|
||||
func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
@@ -227,3 +303,16 @@ func (s *Server) initStarship() {
|
||||
}
|
||||
ApplyStarshipTheme(s.config.Terminal.PromptTheme)
|
||||
}
|
||||
|
||||
func (s *Server) buildMemoryContext(query string) string {
|
||||
store, err := s.ensureMemoryStore()
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
injector := memory.NewInjector(store)
|
||||
ctx, err := injector.BuildContextBlock(query)
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
return ctx
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user