Refactored orchestrator for staged file handling, added structured prompt support, adjusted Feishu file handling

This commit is contained in:
whlaoding
2026-03-08 22:38:29 +08:00
parent e2f806edb3
commit 52b8dbb835
30 changed files with 9325 additions and 34 deletions

View File

@@ -9,6 +9,7 @@ import (
"laodingbot/internal/logger"
"laodingbot/internal/tools"
"laodingbot/tools/fileoperation"
"laodingbot/tools/git"
"laodingbot/tools/shell"
"laodingbot/tools/websearch"
)
@@ -16,6 +17,7 @@ import (
func RunChild(ctx context.Context, cfg config.Config, log *logger.Logger) error {
var registryLog *logger.Logger
var fileLog *logger.Logger
var gitLog *logger.Logger
var shellLog *logger.Logger
var searchLog *logger.Logger
var serverLog *logger.Logger
@@ -23,12 +25,19 @@ func RunChild(ctx context.Context, cfg config.Config, log *logger.Logger) error
log.Infof("toolhost child starting")
registryLog = log.WithComponent("toolhost.registry")
fileLog = log.WithComponent("toolhost.file")
gitLog = log.WithComponent("toolhost.git")
shellLog = log.WithComponent("toolhost.shell")
searchLog = log.WithComponent("toolhost.websearch")
serverLog = log.WithComponent("toolhost.server")
}
registry := tools.NewRegistry(registryLog)
registry.Register(fileoperation.New(cfg.Security.AllowedDirs, cfg.ToolOutputMaxChars, fileLog))
registry.Register(git.New(
cfg.Security.WorkDir,
time.Duration(cfg.ToolCallTimeoutSec)*time.Second,
cfg.ToolOutputMaxChars,
gitLog,
))
registry.Register(shell.New(
cfg.Security.AllowedCommands,
cfg.Security.WorkDir,