重构:把剩余 12 个顶层包全部迁到 internal/

继续之前的重构:把根目录残留的非数据/资源类子目录(agents、agenttool、ai、
autoreply、completion、conversation、llm、message、mqtpp、stream、
toolmanager、toolrouter)一并搬到 internal/ 下,并把全工程引用它们的
import 路径从 "meshtastic_mqtt_server/<x>" 重写为
"meshtastic_mqtt_server/internal/<x>"。

变更
- git mv 12 个顶层目录进 internal/,无函数体改动。
- 全工程 sed 把 import path 加上 internal/ 前缀,包括 main.go、
  internal/bot/bot_service.go、internal/store/bot_store.go 中对 mqtpp
  的引用,以及 ai 子系统内部 agents/agenttool/autoreply/conversation/
  llm/toolmanager/toolrouter 之间的相互引用。

验证
- go build ./... 通过;go test ./... 全部包通过。
- AI 自动回复链路(main → ai.NewService → autoreply.Service → botSender)
  保持不变,仅 import 路径调整。
- 根目录最终只剩 main.go / main_test.go / internal/ 加 go.mod / go.sum
  与数据资源目录(dist、doc、firmware、py、win、meshmap_frontend)。

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-06-18 18:43:42 +08:00
co-authored by Claude
parent 02b445884d
commit d57dff58f3
25 changed files with 36 additions and 36 deletions
@@ -10,7 +10,7 @@ import (
"math"
"strconv"
"meshtastic_mqtt_server/agenttool"
"meshtastic_mqtt_server/internal/agenttool"
"github.com/volcengine/volcengine-go-sdk/service/arkruntime/model"
)
@@ -6,7 +6,7 @@ import (
"fmt"
"time"
"meshtastic_mqtt_server/agenttool"
"meshtastic_mqtt_server/internal/agenttool"
"github.com/volcengine/volcengine-go-sdk/service/arkruntime/model"
)
+8 -8
View File
@@ -6,14 +6,14 @@ import (
"os"
"path/filepath"
"meshtastic_mqtt_server/agenttool"
_ "meshtastic_mqtt_server/agents/calculator"
_ "meshtastic_mqtt_server/agents/time"
"meshtastic_mqtt_server/autoreply"
"meshtastic_mqtt_server/conversation"
"meshtastic_mqtt_server/llm"
"meshtastic_mqtt_server/toolmanager"
"meshtastic_mqtt_server/toolrouter"
"meshtastic_mqtt_server/internal/agenttool"
_ "meshtastic_mqtt_server/internal/agents/calculator"
_ "meshtastic_mqtt_server/internal/agents/time"
"meshtastic_mqtt_server/internal/autoreply"
"meshtastic_mqtt_server/internal/conversation"
"meshtastic_mqtt_server/internal/llm"
"meshtastic_mqtt_server/internal/toolmanager"
"meshtastic_mqtt_server/internal/toolrouter"
"gorm.io/gorm"
)
@@ -8,12 +8,12 @@ import (
"time"
"unicode/utf8"
"meshtastic_mqtt_server/completion"
"meshtastic_mqtt_server/conversation"
"meshtastic_mqtt_server/llm"
"meshtastic_mqtt_server/message"
"meshtastic_mqtt_server/toolmanager"
"meshtastic_mqtt_server/toolrouter"
"meshtastic_mqtt_server/internal/completion"
"meshtastic_mqtt_server/internal/conversation"
"meshtastic_mqtt_server/internal/llm"
"meshtastic_mqtt_server/internal/message"
"meshtastic_mqtt_server/internal/toolmanager"
"meshtastic_mqtt_server/internal/toolrouter"
"github.com/volcengine/volcengine-go-sdk/service/arkruntime/model"
)
+1 -1
View File
@@ -16,7 +16,7 @@ import (
"gorm.io/gorm"
storepkg "meshtastic_mqtt_server/internal/store"
"meshtastic_mqtt_server/mqtpp"
"meshtastic_mqtt_server/internal/mqtpp"
)
const botMaxTextBytes = 200
@@ -6,8 +6,8 @@ import (
"strings"
"time"
"meshtastic_mqtt_server/llm"
"meshtastic_mqtt_server/message"
"meshtastic_mqtt_server/internal/llm"
"meshtastic_mqtt_server/internal/message"
"github.com/volcengine/volcengine-go-sdk/service/arkruntime/model"
)
@@ -11,7 +11,7 @@ import (
"sync"
"time"
"meshtastic_mqtt_server/message"
"meshtastic_mqtt_server/internal/message"
)
// Store manages conversations stored as JSON files
+1 -1
View File
@@ -11,7 +11,7 @@ import (
"time"
"unicode/utf8"
"meshtastic_mqtt_server/mqtpp"
"meshtastic_mqtt_server/internal/mqtpp"
"gorm.io/gorm"
)
@@ -8,7 +8,7 @@ import (
"sort"
"strings"
"meshtastic_mqtt_server/agenttool"
"meshtastic_mqtt_server/internal/agenttool"
)
// Manager manages loaded AI tools
@@ -6,11 +6,11 @@ import (
"strings"
"time"
"meshtastic_mqtt_server/completion"
"meshtastic_mqtt_server/llm"
"meshtastic_mqtt_server/message"
"meshtastic_mqtt_server/stream"
"meshtastic_mqtt_server/toolmanager"
"meshtastic_mqtt_server/internal/completion"
"meshtastic_mqtt_server/internal/llm"
"meshtastic_mqtt_server/internal/message"
"meshtastic_mqtt_server/internal/stream"
"meshtastic_mqtt_server/internal/toolmanager"
"github.com/volcengine/volcengine-go-sdk/service/arkruntime/model"
)
@@ -5,7 +5,7 @@ import (
"fmt"
"strings"
"meshtastic_mqtt_server/llm"
"meshtastic_mqtt_server/internal/llm"
)
// Config holds the tool router configuration
@@ -6,10 +6,10 @@ import (
"strings"
"time"
"meshtastic_mqtt_server/agenttool"
"meshtastic_mqtt_server/llm"
"meshtastic_mqtt_server/stream"
"meshtastic_mqtt_server/toolmanager"
"meshtastic_mqtt_server/internal/agenttool"
"meshtastic_mqtt_server/internal/llm"
"meshtastic_mqtt_server/internal/stream"
"meshtastic_mqtt_server/internal/toolmanager"
"github.com/volcengine/volcengine-go-sdk/service/arkruntime/model"
)
+4 -4
View File
@@ -19,8 +19,8 @@ import (
"github.com/mochi-mqtt/server/v2/listeners"
"github.com/mochi-mqtt/server/v2/packets"
"meshtastic_mqtt_server/ai"
"meshtastic_mqtt_server/autoreply"
"meshtastic_mqtt_server/internal/ai"
"meshtastic_mqtt_server/internal/autoreply"
"meshtastic_mqtt_server/internal/auth"
blockingpkg "meshtastic_mqtt_server/internal/blocking"
botpkg "meshtastic_mqtt_server/internal/bot"
@@ -29,8 +29,8 @@ import (
rspkg "meshtastic_mqtt_server/internal/runtimesettings"
storepkg "meshtastic_mqtt_server/internal/store"
webpkg "meshtastic_mqtt_server/internal/web"
"meshtastic_mqtt_server/llm"
"meshtastic_mqtt_server/mqtpp"
"meshtastic_mqtt_server/internal/llm"
"meshtastic_mqtt_server/internal/mqtpp"
)
const (