X-Git-Url: https://git.giacomolli.uk/onechat/blobdiff_plain/522d7fd117285e4e4ce3ea5ec9b5a1722521b681..3cdbd017da9ae7a7045f4272f16d4b262fd01c79:/prompt_test.go diff --git a/prompt_test.go b/prompt_test.go index ba02b23..06fea49 100644 --- a/prompt_test.go +++ b/prompt_test.go @@ -18,6 +18,7 @@ func TestPromptNamesTheAgent(t *testing.T) { require.Contains(t, text, `- work: an agent's report, starting "[Name]"`) require.Contains(t, text, "- zoom(id, 1) gives message id whole\n- zoom(\"Name\") gives an agent's whole chat\n") require.NotContains(t, text, promptName) + require.Contains(t, text, "[image FILE]") // The old agent name is built from parts, so the source does not spell // it. @@ -26,7 +27,7 @@ func TestPromptNamesTheAgent(t *testing.T) { func TestPromptLeavesOutAbsentFeatures(t *testing.T) { text := prompt("Ada", "/AGENT/instructions.md", "") - for _, absent := range []string{"image", "computer", "device", "instructions at the end"} { + for _, absent := range []string{"computer", "device", "instructions at the end"} { require.NotContains(t, text, absent) } } @@ -50,7 +51,7 @@ func TestSubagentPromptNamesTheAgentAndEndsWithTheInstructions(t *testing.T) { require.True(t, strings.HasSuffix(text, "\n\n# The user's instructions\n\nI am Lena.")) require.NotContains(t, text, promptName) - for _, absent := range []string{"image", "computer", "device", "Compaction"} { + for _, absent := range []string{"computer", "device", "Compaction"} { require.NotContains(t, text, absent) } @@ -128,7 +129,7 @@ func TestProbePromptKeepsTheInstructionsPathStable(t *testing.T) { func TestAgentToolsAreStrictAndStable(t *testing.T) { tools := promptTools() - require.Equal(t, []string{"zoom", "date", "shell", "read", "write", "edit", "spawn", "tell", "whatsapp_find", "whatsapp_send", "schedule_set", "schedule_list", "schedule_remove"}, promptToolNames(tools)) + require.Equal(t, []string{"zoom", "date", "shell", "read", "write", "edit", "spawn", "agent_create", "tell", "image_show", "whatsapp_find", "whatsapp_send", "route", "unroute", "routes", "schedule_set", "schedule_list", "schedule_remove"}, promptToolNames(tools)) require.Equal(t, []string{"zoom", "date", "shell", "read", "write", "edit"}, promptToolNames(promptSubagentTools())) for _, tool := range tools { @@ -150,12 +151,18 @@ func TestAgentToolsAreStrictAndStable(t *testing.T) { } } -// promptToolNames returns the names of tools. -func promptToolNames(tools []ModelTool) []string { - names := make([]string, len(tools)) - for n, tool := range tools { - names[n] = tool.Name - } - - return names +func TestRootPromptDefinesChildRoutingAndConsent(t *testing.T) { + text := prompt("Ada", "/AGENT/instructions.md", "Keep replies short.") + require.Contains(t, text, "Use agent_create for permanent children, whose areas are in the state.") + require.Contains(t, text, `Use tell for children and subagents, and zoom("Name") for their memory.`) + require.Contains(t, text, "Pass area messages from mixed chats to the right child with sender, date, and\nwords.") + require.Contains(t, text, "Never send a WhatsApp reply drafted by a child without the user's\nagreement.") + require.Contains(t, text, "Set or remove a route only after the user agrees.") + require.Contains(t, text, "You act again when a message or your own schedule wakes you.") + require.True(t, strings.HasSuffix(text, "Keep replies short.")) + + child := promptChild("GreenOtter", "Ada", "Keep garden plans.", "/CHILD/instructions.md", "") + require.NotContains(t, child, promptChildrenText) + require.NotContains(t, child, "Use agent_create") + require.Contains(t, child, "Send nothing to WhatsApp. Draft replies in your report instead") }