chore: update project files

This commit is contained in:
lpf
2026-04-03 18:35:04 +08:00
parent 428d944e52
commit ce2263ac8c
54 changed files with 1025 additions and 4613 deletions

View File

@@ -371,19 +371,6 @@ func (al *AgentLoop) buildSubagentRunInput(run *tools.SubagentRun) string {
return taskText
}
func nodeAgentTaskResult(payload map[string]interface{}) string {
if len(payload) == 0 {
return ""
}
if result := tools.MapStringArg(payload, "result"); result != "" {
return result
}
if content := tools.MapStringArg(payload, "content"); content != "" {
return content
}
return ""
}
func (al *AgentLoop) readSubagentPromptFile(relPath string) string {
if al == nil {
return ""

View File

@@ -6,25 +6,13 @@ func TestResolveMessageToolTargetUsesStringHelpers(t *testing.T) {
channel, chat := resolveMessageToolTarget(map[string]interface{}{
"channel": "telegram",
"to": "chat-2",
}, "whatsapp", "chat-1")
}, "weixin", "chat-1")
if channel != "telegram" || chat != "chat-2" {
t.Fatalf("unexpected target: %s %s", channel, chat)
}
channel, chat = resolveMessageToolTarget(map[string]interface{}{}, "whatsapp", "chat-1")
if channel != "whatsapp" || chat != "chat-1" {
channel, chat = resolveMessageToolTarget(map[string]interface{}{}, "weixin", "chat-1")
if channel != "weixin" || chat != "chat-1" {
t.Fatalf("unexpected fallback target: %s %s", channel, chat)
}
}
func TestNodeAgentTaskResultUsesCompatiblePayloadFields(t *testing.T) {
if got := nodeAgentTaskResult(map[string]interface{}{"result": "done"}); got != "done" {
t.Fatalf("unexpected result field extraction: %q", got)
}
if got := nodeAgentTaskResult(map[string]interface{}{"content": "fallback"}); got != "fallback" {
t.Fatalf("unexpected content field extraction: %q", got)
}
if got := nodeAgentTaskResult(nil); got != "" {
t.Fatalf("expected empty result for nil payload, got %q", got)
}
}