feat: expand local operator controls across CLI and WebUI

- Add structured CLI commands for status/kernel/settings/plugins/memory/knowledge/agents
- Inject core dependencies directly into CLI plugin for non-HTTP operator workflows
- Add plugin management panel and API proxy endpoints to WebUI
- Let cmd_run inherit default workdir from core.agent.workdir
- Use fixed loopback address for pluginmgr API
- Remove stale MaxToolTurns config usage from homed wiring
This commit is contained in:
root
2026-07-06 20:32:04 +08:00
parent b55f1dcf0e
commit eb55a8fb98
8 changed files with 455 additions and 16 deletions

View File

@ -368,7 +368,6 @@ func main() {
Indexer: memIdx,
Skills: skMgr,
Tracker: trk,
MaxToolTurns: 10,
DocStore: docStore,
Knowledge: ks,
SocialStore: socialStore,
@ -395,6 +394,9 @@ func main() {
pluginmgr.PluginDir = cfg.Plugin.Dir
pluginmgr.Reg = pluginReg
// CLI 插件结构化命令 — 直接注入内核依赖,不依赖 HTTP
cli.Configure(pluginReg, cfgReg, agent, cfg.Plugin.Dir)
// Auto-create plugins directory (without hardcoding plugin names)
os.MkdirAll(cfg.Plugin.Dir, 0755)

View File

@ -378,15 +378,29 @@ func handleBuiltin(cmd string, mode, addr *string, reconnect func()) bool {
switch {
case cmd == "/help":
fmt.Println(`Built-in commands:
/help show this help
/exit, /quit exit waiter
/clear clear screen
/reconnect force reconnection
/connect <path> switch to a different unix socket
/remote <url> switch to remote HTTP mode
/local switch back to local socket mode
/help show this help
/exit, /quit exit waiter
/clear clear screen
/reconnect force reconnection
/connect <path> switch to a different unix socket
/remote <url> switch to remote HTTP mode
/local switch back to local socket mode
Any other text is sent as a message to the agent.`)
Structured commands (processed server-side):
/status system status
/kernel kernel status
/settings [prefix] list settings
/settings set <k> <v> set a setting
/plugin list list installed plugins
/plugin install <url> install plugin
/plugin remove <name> remove plugin
/plugin info <name> plugin details
/memory query <text> query graph memory
/knowledge list knowledge base
/agents list agents
/chat <text> send to agent
Any other text is sent to the agent.`)
return true
case cmd == "/exit" || cmd == "/quit":
@ -580,7 +594,10 @@ func (e *LineEditor) historyNext() {
}
func (e *LineEditor) doCompletion() {
cmds := []string{"/help", "/exit", "/quit", "/clear", "/reconnect", "/connect ", "/remote ", "/local"}
cmds := []string{"/help", "/exit", "/quit", "/clear", "/reconnect", "/connect ", "/remote ", "/local",
"/status", "/kernel", "/settings ", "/settings set ", "/chat ",
"/plugin ", "/plugin list", "/plugin install ", "/plugin remove ", "/plugin info ",
"/memory ", "/memory query ", "/knowledge", "/agents"}
prefix := string(e.buf)
for _, c := range cmds {
if strings.HasPrefix(c, prefix) && c != prefix {