summaryrefslogtreecommitdiff
path: root/agent/extensions
diff options
context:
space:
mode:
authort <t@tjp.lol>2026-06-16 11:49:54 -0600
committert <t@tjp.lol>2026-06-16 11:58:44 -0600
commit28cb3eacfcf1217b4d014dd864005deb2d7f0585 (patch)
tree22a49deb365589e3180a8e119870d6abb2ed308c /agent/extensions
parent92ce53385fa438cab221c6881da141b5ef0a7261 (diff)
tool collapsed state, and fixing dirty component flags
Diffstat (limited to 'agent/extensions')
-rw-r--r--agent/extensions/std_render.lua15
1 files changed, 14 insertions, 1 deletions
diff --git a/agent/extensions/std_render.lua b/agent/extensions/std_render.lua
index d82ccfa..43a2c86 100644
--- a/agent/extensions/std_render.lua
+++ b/agent/extensions/std_render.lua
@@ -14,6 +14,7 @@ end
local states_by_index = {}
local states_by_id = {}
local index_by_id = {}
+local collapsed_tail_lines = 8
local function decode(s)
if type(s) ~= "string" or s == "" or not ok_json then return nil end
@@ -130,7 +131,16 @@ local function component(st)
body = edit_diff(st.input)
end
body = body or st.output or "(…)"
- add(body)
+ local body_lines = wrap_text(body, inner)
+ local start = 1
+ if st.collapsed and #body_lines > collapsed_tail_lines then
+ add("…")
+ start = #body_lines - collapsed_tail_lines + 1
+ end
+ for i = start, #body_lines do
+ local l = body_lines[i]
+ lines[#lines + 1] = " " .. l .. spaces(inner - #l + 1)
+ end
lines[#lines + 1] = ""
return lines
end,
@@ -170,6 +180,8 @@ local function state_for_event(e)
if e.input then st.input = e.input end
if e.delta then st.input = (st.input or "") .. e.delta end
if e.output then st.output = e.output end
+ if e.collapsed ~= nil then st.collapsed = e.collapsed end
+ if st.collapsed == nil then st.collapsed = true end
if st.name or st.input ~= "" then st.header_text = derive_header(st) end
return st
end
@@ -191,3 +203,4 @@ panto.ext.on("tool_details", on_tool_event)
panto.ext.on("tool_delta", on_tool_event)
panto.ext.on("tool_call_complete", on_tool_event)
panto.ext.on("tool_result", on_tool_event)
+panto.ext.on("tool_collapse", on_tool_event)