mirror of
https://gitcode.com/JianFeeeee/HomeAgent.git
synced 2026-09-21 09:28:14 +00:00
feat: NoMemory/Cleaner memory system + doc update
- _sdk_local/ removed (moved to standalone sdk repo) - internal/agent/core: NoMemory/Cleaner data-flow breakpoints - internal/memory: clean_text, document store refactor - internal/plugin/registry.go: plugin API alignment - docs: PLUGIN_DEV.md, ARCHITECTURE.md NoMemory/Cleaner docs - plan.md, review.md: status update
This commit is contained in:
@ -214,8 +214,13 @@ func TestCmdRunNonZeroExit(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestTruncateOutput(t *testing.T) {
|
||||
p, _, err := setupPlugin()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
short := "hello"
|
||||
if s := truncateOutput(short); s != short {
|
||||
if s := p.truncateOutput(short); s != short {
|
||||
t.Fatalf("expected %q, got %q", short, s)
|
||||
}
|
||||
|
||||
@ -223,7 +228,7 @@ func TestTruncateOutput(t *testing.T) {
|
||||
for i := range long {
|
||||
long[i] = 'x'
|
||||
}
|
||||
s := truncateOutput(string(long))
|
||||
s := p.truncateOutput(string(long))
|
||||
if len(s) >= 40000 {
|
||||
t.Fatal("expected truncation")
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package files
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
@ -61,6 +62,14 @@ func (p *Plugin) Start(s *sdk.PluginSDK) error {
|
||||
s.RegisterTool(tp+"read", sdk.ToolDef{
|
||||
Name: tp + "read",
|
||||
Description: fmt.Sprintf("读取文件内容。支持 offset/limit 分段读取大文件。沙箱路径: %s", p.filesDir),
|
||||
NoMemory: false,
|
||||
Cleaner: func(output string) string {
|
||||
var r struct{ Content string }
|
||||
if err := json.Unmarshal([]byte(output), &r); err != nil {
|
||||
return output
|
||||
}
|
||||
return r.Content
|
||||
},
|
||||
Parameters: map[string]interface{}{
|
||||
"type": "object",
|
||||
"properties": map[string]interface{}{
|
||||
|
||||
Reference in New Issue
Block a user