summaryrefslogtreecommitdiff
path: root/panto-herdr
diff options
context:
space:
mode:
authort <t@tjp.lol>2026-08-18 14:45:03 -0600
committert <t@tjp.lol>2026-08-18 14:45:08 -0600
commit2acd6b0e38e4af1fd13bad1cef8af7407b20684c (patch)
treee95c6a20a8b96bab627ef3974b7c355faba4d66a /panto-herdr
initial commit
Diffstat (limited to 'panto-herdr')
-rw-r--r--panto-herdr/init.lua53
1 files changed, 53 insertions, 0 deletions
diff --git a/panto-herdr/init.lua b/panto-herdr/init.lua
new file mode 100644
index 0000000..dffef51
--- /dev/null
+++ b/panto-herdr/init.lua
@@ -0,0 +1,53 @@
+local function tool_status(name)
+ name = name or "?"
+ return "tool:" .. name:sub(1, 27)
+end
+
+return {
+ name = "herdr",
+ activate = function()
+ local pane_id = os.getenv("HERDR_PANE_ID")
+ if not pane_id or pane_id == "" then return end
+
+ local panto = require("panto")
+ local uv = require("luv")
+ local seq = 0
+ local last_state
+ local last_status
+
+ local function report(state, status)
+ if state == last_state and status == last_status then return end
+ last_state, last_status = state, status
+ seq = seq + 1
+
+ local args = {
+ "pane", "report-agent", pane_id,
+ "--source", "panto:extension",
+ "--agent", "panto",
+ "--state", state,
+ "--seq", tostring(seq),
+ }
+ if status then
+ args[#args + 1] = "--custom-status"
+ args[#args + 1] = status
+ end
+
+ local handle
+ pcall(function()
+ handle = uv.spawn("herdr", { args = args, stdio = { nil, nil, nil } }, function()
+ if handle then handle:close() end
+ end)
+ end)
+ end
+
+ panto.ext.on("session_start", function() report("idle") end)
+ panto.ext.on("user_message", function() report("working", "thinking") end)
+ panto.ext.on("thinking", function() report("working", "thinking") end)
+ panto.ext.on("compaction", function() report("working", "compacting") end)
+ panto.ext.on("tool_details", function(event)
+ report("working", tool_status(event.tool_name))
+ end)
+ panto.ext.on("assistant_text", function() report("working", "responding") end)
+ panto.ext.on("assistant_text_complete", function() report("idle") end)
+ end,
+}