Merge upstream/main into ralph/tool-result-refactor

Resolved conflicts:
- pkg/heartbeat/service.go: merged both 'started' field and 'onHeartbeatWithTools'
- pkg/tools/edit.go: use validatePath() with ToolResult return
- pkg/tools/filesystem.go: fixed return values to use ToolResult
- cmd/picoclaw/main.go: kept active setupCronTool, fixed toolsPkg import
- pkg/tools/cron.go: fixed Execute return value handling

Fixed tests for new function signatures (NewEditFileTool, NewAppendFileTool, NewExecTool)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
yinwm
2026-02-13 01:00:26 +08:00
25 changed files with 2049 additions and 202 deletions

View File

@@ -1033,25 +1033,24 @@ func getConfigPath() string {
return filepath.Join(home, ".picoclaw", "config.json")
}
// TEMPORARILY DISABLED - cronTool is being refactored to use ToolResult (US-016)
// func setupCronTool(agentLoop *agent.AgentLoop, msgBus *bus.MessageBus, workspace string) *cron.CronService {
// cronStorePath := filepath.Join(workspace, "cron", "jobs.json")
//
// // Create cron service
// cronService := cron.NewCronService(cronStorePath, nil)
//
// // Create and register CronTool
// cronTool := tools.NewCronTool(cronService, agentLoop, msgBus)
// agentLoop.RegisterTool(cronTool)
//
// // Set the onJob handler
// cronService.SetOnJob(func(job *cron.CronJob) (string, error) {
// result := cronTool.ExecuteJob(context.Background(), job)
// return result, nil
// })
//
// return cronService
// }
func setupCronTool(agentLoop *agent.AgentLoop, msgBus *bus.MessageBus, workspace string) *cron.CronService {
cronStorePath := filepath.Join(workspace, "cron", "jobs.json")
// Create cron service
cronService := cron.NewCronService(cronStorePath, nil)
// Create and register CronTool
cronTool := toolsPkg.NewCronTool(cronService, agentLoop, msgBus, workspace)
agentLoop.RegisterTool(cronTool)
// Set the onJob handler
cronService.SetOnJob(func(job *cron.CronJob) (string, error) {
result := cronTool.ExecuteJob(context.Background(), job)
return result, nil
})
return cronService
}
func loadConfig() (*config.Config, error) {
return config.LoadConfig(getConfigPath())