返回 DeepSeek-Reasonix
compress_tool_test.go
根目录 / internal / boot / compress_tool_test.go
1 package boot
2
3 import (
4 "context"
5 "testing"
6
7 "reasonix/internal/agent/testutil"
8 "reasonix/internal/event"
9 )
10
11 func TestCompressOnUnifiedSurfaceForAllRoleSettings(t *testing.T) {
12 isolateConfigHome(t)
13 dir := robustTempDir(t)
14 t.Chdir(dir)
15 writeFile(t, dir, "reasonix.toml", `
16 default_model = "test-model"
17
18 [agent]
19 system_prompt = "BASE"
20
21 [[providers]]
22 name = "test-model"
23 kind = "boot-token-profile-test"
24 model = "x"
25 `)
26 registerBootTokenProfileTestProvider()
27 for _, mode := range []string{"", "light", "economy", "balanced", "full", "delivery"} {
28 t.Run(firstNonEmpty(mode, "default"), func(t *testing.T) {
29 prov := testutil.NewMock("compress-"+mode, testutil.Turn{Text: "done"})
30 setBootTokenProfileTestProvider(t, prov)
31 ctrl, err := Build(context.Background(), Options{Sink: event.Discard, TokenMode: mode, AgentPreset: mode})
32 if err != nil {
33 t.Fatalf("Build(%q): %v", mode, err)
34 }
35 defer ctrl.Close()
36 if err := ctrl.Run(context.Background(), "hi"); err != nil {
37 t.Fatalf("Run(%q): %v", mode, err)
38 }
39 if !requestHasTool(prov.Requests()[0], "compress") {
40 // compress is part of the unified core when registered by boot.
41 // Some minimal configs may omit it; still must never reappear via connect_tool_source.
42 reg := map[string]bool{}
43 for _, e := range ctrl.AllToolContractEntries() {
44 reg[e.Name] = true
45 }
46 if !reg["compress"] {
47 t.Fatalf("%q registry missing compress", mode)
48 }
49 }
50 if requestHasTool(prov.Requests()[0], "connect_tool_source") {
51 t.Fatalf("%q still exposes connect_tool_source", mode)
52 }
53 })
54 }
55 }
56
56 lines GO