Checkpoint commit covering concurrent work across several archie-core-abg epics to avoid losing in-progress state: - Memory manager (18.7-18.16): background sync pipeline, prefetch with timeout, memory-write notification, threat scanning, shutdown drain with abandoned-write tracking, frozen snapshot pattern. Wired ScanContent and NotifyMemoryToolWrite into HandleToolCall so scanning and notification actually apply to writes, not just exist as unused primitives. - Fixed a literal unresolved merge-conflict that had been committed to internal/memory/scrubber/scrubber.go. - Tool provider/registry, MCP client/transport (stdio, HTTP, SSE), multimodal results, disclosure. - Pairing device auth store, rate limiting. - Gateway compression, session store, tasks. - Various workflow, plugin host, and agentexec updates.
51 lines
1.2 KiB
Go
51 lines
1.2 KiB
Go
package tools
|
|
|
|
import (
|
|
"encoding/json"
|
|
"testing"
|
|
)
|
|
|
|
func TestMultimodalResultJSONFields(t *testing.T) {
|
|
r := MultimodalResult{
|
|
IsMultimodal: true,
|
|
Summary: "generated a chart",
|
|
SubdirHint: "tool-output/chart_generator",
|
|
Files: []string{"tool-output/chart_generator/0.png"},
|
|
}
|
|
data, err := json.Marshal(r)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
var got map[string]any
|
|
if err := json.Unmarshal(data, &got); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if got["is_multimodal"] != true {
|
|
t.Errorf("is_multimodal = %v, want true", got["is_multimodal"])
|
|
}
|
|
if got["summary"] != "generated a chart" {
|
|
t.Errorf("summary = %v", got["summary"])
|
|
}
|
|
if got["subdir_hint"] != "tool-output/chart_generator" {
|
|
t.Errorf("subdir_hint = %v", got["subdir_hint"])
|
|
}
|
|
}
|
|
|
|
func TestMultimodalResultOmitsEmptyOptionalFields(t *testing.T) {
|
|
r := MultimodalResult{IsMultimodal: true, Summary: "no media dir configured"}
|
|
data, err := json.Marshal(r)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
var got map[string]any
|
|
if err := json.Unmarshal(data, &got); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if _, ok := got["subdir_hint"]; ok {
|
|
t.Error("subdir_hint should be omitted when empty")
|
|
}
|
|
if _, ok := got["files"]; ok {
|
|
t.Error("files should be omitted when empty")
|
|
}
|
|
}
|