@@ -60,6 +60,63 @@ T["ToolRegistry"][":add"]["renders tool in the chat buffer"] = function()
6060 h .expect_contains (" func" , content )
6161end
6262
63+ T [" ToolRegistry" ][" :add" ][" hides tool context for ACP chats" ] = function ()
64+ child .lua ([[
65+ _G.chat = h.setup_chat_buffer({}, {
66+ name = "test_acp",
67+ config = {
68+ name = "test_acp",
69+ type = "acp",
70+ roles = { user = "user", assistant = "assistant" },
71+ handlers = {
72+ form_messages = function()
73+ return {}
74+ end,
75+ },
76+ },
77+ })
78+ _G.chat.tool_registry:add("func")
79+ _G.chat.context:render()
80+ _G.buf_lines = h.get_buf_lines(_G.chat.bufnr)
81+ ]] )
82+
83+ local lines = child .lua_get ([[ _G.buf_lines]] )
84+ local content = table.concat (lines , " \n " )
85+
86+ h .expect_tbl_contains (" func" , child .lua_get ([[ _G.chat.tool_registry.in_use]] ))
87+ h .eq (nil , content :find (" func" , 1 , true ))
88+ end
89+
90+ T [" ToolRegistry" ][" :add" ][" hides tool group context for ACP chats" ] = function ()
91+ child .lua ([[
92+ _G.chat = h.setup_chat_buffer({}, {
93+ name = "test_acp",
94+ config = {
95+ name = "test_acp",
96+ type = "acp",
97+ roles = { user = "user", assistant = "assistant" },
98+ handlers = {
99+ form_messages = function()
100+ return {}
101+ end,
102+ },
103+ },
104+ })
105+ _G.chat.tool_registry:add("senior_dev")
106+ _G.chat.context:render()
107+ _G.buf_lines = h.get_buf_lines(_G.chat.bufnr)
108+ ]] )
109+
110+ local lines = child .lua_get ([[ _G.buf_lines]] )
111+ local content = table.concat (lines , " \n " )
112+
113+ h .expect_tbl_contains (" func" , child .lua_get ([[ _G.chat.tool_registry.in_use]] ))
114+ h .expect_tbl_contains (" cmd" , child .lua_get ([[ _G.chat.tool_registry.in_use]] ))
115+ h .eq (nil , content :find (" senior_dev" , 1 , true ))
116+ h .eq (nil , content :find (" func" , 1 , true ))
117+ h .eq (nil , content :find (" cmd" , 1 , true ))
118+ end
119+
63120T [" ToolRegistry" ][" :add" ][" returns nil for unknown name" ] = function ()
64121 local result = child .lua_get ([[ _G.chat.tool_registry:add("nonexistent_tool_xyz")]] )
65122
0 commit comments