fix package

This commit is contained in:
LPF
2026-03-10 00:33:23 +08:00
parent e9a47ac02a
commit c18fdb690e
85 changed files with 381 additions and 316 deletions

View File

@@ -8,9 +8,9 @@ import (
"strings"
"time"
"clawgo/pkg/logger"
"clawgo/pkg/providers"
"clawgo/pkg/skills"
"github.com/YspCoder/clawgo/pkg/logger"
"github.com/YspCoder/clawgo/pkg/providers"
"github.com/YspCoder/clawgo/pkg/skills"
)
type ContextBuilder struct {

View File

@@ -23,17 +23,17 @@ import (
"time"
"unicode/utf8"
"clawgo/pkg/bus"
"clawgo/pkg/config"
"clawgo/pkg/cron"
"clawgo/pkg/ekg"
"clawgo/pkg/logger"
"clawgo/pkg/nodes"
"clawgo/pkg/providers"
"clawgo/pkg/runtimecfg"
"clawgo/pkg/scheduling"
"clawgo/pkg/session"
"clawgo/pkg/tools"
"github.com/YspCoder/clawgo/pkg/bus"
"github.com/YspCoder/clawgo/pkg/config"
"github.com/YspCoder/clawgo/pkg/cron"
"github.com/YspCoder/clawgo/pkg/ekg"
"github.com/YspCoder/clawgo/pkg/logger"
"github.com/YspCoder/clawgo/pkg/nodes"
"github.com/YspCoder/clawgo/pkg/providers"
"github.com/YspCoder/clawgo/pkg/runtimecfg"
"github.com/YspCoder/clawgo/pkg/scheduling"
"github.com/YspCoder/clawgo/pkg/session"
"github.com/YspCoder/clawgo/pkg/tools"
)
type AgentLoop struct {

View File

@@ -3,8 +3,8 @@ package agent
import (
"testing"
"clawgo/pkg/bus"
"clawgo/pkg/config"
"github.com/YspCoder/clawgo/pkg/bus"
"github.com/YspCoder/clawgo/pkg/config"
)
func TestNewAgentLoopDisablesNodeP2PByDefault(t *testing.T) {

View File

@@ -4,9 +4,9 @@ import (
"context"
"testing"
"clawgo/pkg/bus"
"clawgo/pkg/config"
"clawgo/pkg/providers"
"github.com/YspCoder/clawgo/pkg/bus"
"github.com/YspCoder/clawgo/pkg/config"
"github.com/YspCoder/clawgo/pkg/providers"
)
type stubLLMProvider struct{}

View File

@@ -6,7 +6,7 @@ import (
"testing"
"time"
"clawgo/pkg/bus"
"github.com/YspCoder/clawgo/pkg/bus"
)
func TestPrepareOutboundSubagentNoReplyFallback(t *testing.T) {

View File

@@ -7,9 +7,9 @@ import (
"testing"
"time"
"clawgo/pkg/bus"
"clawgo/pkg/config"
"clawgo/pkg/runtimecfg"
"github.com/YspCoder/clawgo/pkg/bus"
"github.com/YspCoder/clawgo/pkg/config"
"github.com/YspCoder/clawgo/pkg/runtimecfg"
)
func TestAppendDailySummaryLogUsesSubagentNamespaceAndTitle(t *testing.T) {

View File

@@ -5,10 +5,10 @@ import (
"strings"
"time"
"clawgo/pkg/bus"
"clawgo/pkg/config"
"clawgo/pkg/runtimecfg"
"clawgo/pkg/tools"
"github.com/YspCoder/clawgo/pkg/bus"
"github.com/YspCoder/clawgo/pkg/config"
"github.com/YspCoder/clawgo/pkg/runtimecfg"
"github.com/YspCoder/clawgo/pkg/tools"
)
func (al *AgentLoop) maybeAutoRoute(ctx context.Context, msg bus.InboundMessage) (string, bool, error) {

View File

@@ -4,10 +4,10 @@ import (
"context"
"testing"
"clawgo/pkg/bus"
"clawgo/pkg/config"
"clawgo/pkg/runtimecfg"
"clawgo/pkg/tools"
"github.com/YspCoder/clawgo/pkg/bus"
"github.com/YspCoder/clawgo/pkg/config"
"github.com/YspCoder/clawgo/pkg/runtimecfg"
"github.com/YspCoder/clawgo/pkg/tools"
)
func TestResolveAutoRouteTarget(t *testing.T) {
@@ -27,9 +27,9 @@ func TestResolveAutoRouteTargetRulesFirst(t *testing.T) {
cfg.Agents.Router.Strategy = "rules_first"
cfg.Agents.Subagents["coder"] = config.SubagentConfig{Enabled: true, Role: "coding", SystemPromptFile: "agents/coder/AGENT.md"}
cfg.Agents.Subagents["tester"] = config.SubagentConfig{Enabled: true, Role: "testing", SystemPromptFile: "agents/tester/AGENT.md"}
cfg.Agents.Router.Rules = []config.AgentRouteRule{{AgentID: "coder", Keywords: []string{"登录", "bug"}}}
cfg.Agents.Router.Rules = []config.AgentRouteRule{{AgentID: "coder", Keywords: []string{"鐧诲綍", "bug"}}}
agentID, task := resolveAutoRouteTarget(cfg, "请帮我修复登录接口的 bug 并改代码")
agentID, task := resolveAutoRouteTarget(cfg, "璇峰府鎴戜慨澶嶇櫥褰曟帴鍙g殑 bug 骞舵敼浠g爜")
if agentID != "coder" || task == "" {
t.Fatalf("expected coder route, got %s / %s", agentID, task)
}
@@ -113,7 +113,7 @@ func TestMaybeAutoRouteDispatchesRulesFirstMatch(t *testing.T) {
Channel: "cli",
ChatID: "direct",
SessionKey: "main",
Content: "请做一次回归测试并验证这个修复",
Content: "璇峰仛涓€娆″洖褰掓祴璇曞苟楠岃瘉杩欎釜淇",
})
if err != nil {
t.Fatalf("rules-first auto route failed: %v", err)

View File

@@ -10,9 +10,9 @@ import (
"strings"
"time"
"clawgo/pkg/config"
"clawgo/pkg/runtimecfg"
"clawgo/pkg/tools"
"github.com/YspCoder/clawgo/pkg/config"
"github.com/YspCoder/clawgo/pkg/runtimecfg"
"github.com/YspCoder/clawgo/pkg/tools"
)
func (al *AgentLoop) HandleSubagentRuntime(ctx context.Context, action string, args map[string]interface{}) (interface{}, error) {

View File

@@ -7,9 +7,9 @@ import (
"testing"
"time"
"clawgo/pkg/config"
"clawgo/pkg/runtimecfg"
"clawgo/pkg/tools"
"github.com/YspCoder/clawgo/pkg/config"
"github.com/YspCoder/clawgo/pkg/runtimecfg"
"github.com/YspCoder/clawgo/pkg/tools"
)
func TestHandleSubagentRuntimeDispatchAndWait(t *testing.T) {

View File

@@ -14,10 +14,10 @@ import (
"sync"
"time"
"clawgo/pkg/bus"
"clawgo/pkg/ekg"
"clawgo/pkg/providers"
"clawgo/pkg/scheduling"
"github.com/YspCoder/clawgo/pkg/bus"
"github.com/YspCoder/clawgo/pkg/ekg"
"github.com/YspCoder/clawgo/pkg/providers"
"github.com/YspCoder/clawgo/pkg/scheduling"
)
type plannedTask struct {

View File

@@ -4,8 +4,8 @@ import (
"context"
"testing"
"clawgo/pkg/bus"
"clawgo/pkg/providers"
"github.com/YspCoder/clawgo/pkg/bus"
"github.com/YspCoder/clawgo/pkg/providers"
)
func TestSplitPlannedSegmentsDoesNotSplitPlainNewlines(t *testing.T) {

View File

@@ -7,7 +7,7 @@ import (
"sync"
"sync/atomic"
"clawgo/pkg/scheduling"
"github.com/YspCoder/clawgo/pkg/scheduling"
)
const (

View File

@@ -6,8 +6,8 @@ import (
"path/filepath"
"strings"
"clawgo/pkg/bus"
"clawgo/pkg/tools"
"github.com/YspCoder/clawgo/pkg/bus"
"github.com/YspCoder/clawgo/pkg/tools"
)
func (al *AgentLoop) maybeHandleSubagentConfigIntent(ctx context.Context, msg bus.InboundMessage) (string, bool, error) {

View File

@@ -5,8 +5,8 @@ import (
"strings"
"testing"
"clawgo/pkg/nodes"
"clawgo/pkg/tools"
"github.com/YspCoder/clawgo/pkg/nodes"
"github.com/YspCoder/clawgo/pkg/tools"
)
func TestDispatchNodeSubagentTaskUsesNodeAgentTask(t *testing.T) {

View File

@@ -6,7 +6,7 @@ import (
"strings"
"testing"
"clawgo/pkg/tools"
"github.com/YspCoder/clawgo/pkg/tools"
)
func TestBuildSubagentTaskInputPrefersPromptFile(t *testing.T) {

View File

@@ -19,12 +19,12 @@ type triggerAudit struct {
}
type triggerEvent struct {
Time string `json:"time"`
Trigger string `json:"trigger"`
Channel string `json:"channel"`
Session string `json:"session"`
Time string `json:"time"`
Trigger string `json:"trigger"`
Channel string `json:"channel"`
Session string `json:"session"`
Suppressed bool `json:"suppressed,omitempty"`
Error string `json:"error,omitempty"`
Error string `json:"error,omitempty"`
}
func newTriggerAudit(workspace string) *triggerAudit {
@@ -37,10 +37,10 @@ func (ta *triggerAudit) Record(trigger, channel, session string, suppressed bool
}
trigger = normalizeTrigger(trigger)
e := triggerEvent{
Time: time.Now().UTC().Format(time.RFC3339),
Trigger: trigger,
Channel: channel,
Session: session,
Time: time.Now().UTC().Format(time.RFC3339),
Trigger: trigger,
Channel: channel,
Session: session,
Suppressed: suppressed,
}
if err != nil {