refactor: pluginize text cleaning and tool NoMemory control

- SDK: ToolDef.NoMemory field, PluginSDK.RegisterTextCleaner/TextCleaners
- Registry: aggregate text cleaners from plugins, expose CleanText()
- Memory: replace hardcoded QQ regex CleanTemplateText with dynamic CleanText/SetTextCleaner
- StageHost: add ToolDef(name) lookup
- eventloop: check ToolDef.NoMemory before emitMemoryCandidate
- context/Prune: replace hardcoded agentcli/terminal source filter with ToolsUsed NoMemory check
- agentcli/cmd: mark tools with NoMemory: true
- main.go: wire memory.SetTextCleaner(pluginReg.CleanText)
This commit is contained in:
root
2026-07-24 14:49:08 +08:00
parent 097c8e80b7
commit 3fc2151588
32 changed files with 2368 additions and 69 deletions

View File

@ -180,7 +180,7 @@ func TestBilingualVectorizeClean(t *testing.T) {
cleanVec := e.VectorizeClean(inp)
sim := cosineSim(rawVec, cleanVec)
rawTokens := len(e.tokenize(inp))
cleanTokens := len(e.tokenize(CleanTemplateText(inp)))
cleanTokens := len(e.tokenize(CleanText(inp)))
t.Logf("[%d] sim(raw,clean)=%.4f tokens: raw=%d clean=%d", i, sim, rawTokens, cleanTokens)
}
}
@ -236,8 +236,8 @@ func genBilingualEvents() []bilingualEvent {
func textForBilingual(ev bilingualEvent, modelPaths []string) string {
switch {
case ev.source == "agent" && ev.text != "":
return CleanTemplateText(ev.text)
return CleanText(ev.text)
default:
return CleanTemplateText(ev.text)
return CleanText(ev.text)
}
}