X-Git-Url: https://git.giacomolli.uk/onechat/blobdiff_plain/5a93b6124068c2a8748fc0bfbb2a2d151815bcf0..c781f79f3c8cb9a7577ee1574d196988da2719b3:/daemon_children_test.go?ds=sidebyside diff --git a/daemon_children_test.go b/daemon_children_test.go index 16f326f..b377b4d 100644 --- a/daemon_children_test.go +++ b/daemon_children_test.go @@ -49,6 +49,7 @@ func TestDaemonToolsCreateAndTellAChildDuringATurn(t *testing.T) { modelWriteEvents(w, modelCompletedEvent(items, 100, 0, 5)) } + whatsapp, _, _ := whatsappStartTest(t, dir, newTestClock()) listener, err := daemonListenSocket(filepath.Join(dir, socketFileName)) require.NoError(t, err) @@ -111,6 +112,7 @@ func TestChildCreationRefusesUsedNames(t *testing.T) { test.root.runs.subagents.draw = func() string { return "BlueFox" } + subagent, err := test.root.runs.subagents.Create(t.Context()) require.NoError(t, err) require.Equal(t, "BlueFox", subagent.name) @@ -145,6 +147,7 @@ func TestChildCreationAcceptsAreaNames(t *testing.T) { child: "A" + strings.Repeat("b", 31), }, } + for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { test := newDaemonChildrenTest(t) @@ -209,6 +212,7 @@ func TestChildCreationRefusesInvalidAreaNames(t *testing.T) { child: "Hous\u00e9", }, } + for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { test := newDaemonChildrenTest(t) @@ -320,6 +324,7 @@ func TestChildNamesStayOutOfSubagentDraws(t *testing.T) { return name } + subagent, err := test.root.runs.subagents.Create(t.Context()) require.NoError(t, err) require.Equal(t, "BlueFox", subagent.name) @@ -335,6 +340,8 @@ func TestChildToolsExcludeCreationAndWhatsApp(t *testing.T) { names := promptToolNames(child.agent.Tools()) require.NotContains(t, names, "agent_create") + require.NotContains(t, names, "image_show") + require.Equal(t, `error: unknown tool "image_show"`, child.tools.run(t.Context(), "image_show", `{"image":"unknown","caption":""}`)) require.NotContains(t, names, "whatsapp_send") require.NotContains(t, names, "whatsapp_find") require.Contains(t, names, "spawn") @@ -362,6 +369,7 @@ func TestZoomReadsTheChildViewAndKeepsSubagentLogs(t *testing.T) { test.root.runs.subagents.draw = func() string { return "BlueFox" } + subagent, err := test.root.runs.subagents.Create(t.Context()) require.NoError(t, err) @@ -437,6 +445,7 @@ func newDaemonChildrenTest(t *testing.T) *DaemonChildrenTest { test := &DaemonChildrenTest{ server: newModelFake(t), } + agents, err := openDaemonAgents(t.Context(), t.TempDir(), test.server.URL, ModelAPIKey(modelTestKey), defaultConfig().Compactor, time.Now, discardLog()) require.NoError(t, err) @@ -455,6 +464,7 @@ func newDaemonChildrenTest(t *testing.T) *DaemonChildrenTest { root: test.root, messages: messages, } + test.root.tools.children = test.runtime t.Cleanup(func() { cancel()