diff options
| author | t <t@tjp.lol> | 2026-09-01 12:00:53 -0600 |
|---|---|---|
| committer | t <t@tjp.lol> | 2026-09-02 08:29:54 -0600 |
| commit | 04791c3273ab7076cc53f146d7751670d86c5c9b (patch) | |
| tree | e8eba4e49fa5ea1de7f75b70f064c864158ce5d0 /_selfcheck.lua | |
| parent | 11aa2e9d8a8016eee008a8a043501aae96c873d4 (diff) | |
Keep Herdr reports current across Panto sessions
Use wall-clock-based report sequences so restarted processes supersede stale
state, adopt the current message flag, restore idle state after replay, and
release the agent report when a session ends.
Diffstat (limited to '_selfcheck.lua')
| -rw-r--r-- | _selfcheck.lua | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/_selfcheck.lua b/_selfcheck.lua index 8b83fa5..08df12c 100644 --- a/_selfcheck.lua +++ b/_selfcheck.lua @@ -16,6 +16,7 @@ end assert(loadfile(assert(find_rockspec(), "no .rockspec in the repo root"))) +package.loaded.panto = nil package.preload.panto = function() return { ext = { @@ -24,6 +25,7 @@ package.preload.panto = function() } end +package.loaded.luv = nil package.preload.luv = function() return { spawn = function(command, options, _) @@ -34,12 +36,14 @@ package.preload.luv = function() end local getenv = os.getenv +local now = 100 +os.time = function() return now end os.getenv = function(name) if name == "HERDR_PANE_ID" then return "w1:p1" end return getenv(name) end -local entry = require("panto-herdr") +local entry = assert(loadfile("panto-herdr/init.lua"))() entry.activate() events.session_start() events.user_message() @@ -47,11 +51,25 @@ events.user_message() events.tool_details({ tool_name = "read" }) events.assistant_text() events.assistant_text_complete() +events.session_end() -assert(#reports == 5) +-- A new process in the same pane/source must outrank the old process's final +-- sequence number instead of being ignored as stale. +now = 101 +events = {} +entry.activate() +events.session_start() +events.assistant_text() +events.session_ready() + +assert(#reports == 9) assert(reports[1].command == "herdr") -assert(table.concat(reports[1].args, " ") == "pane report-agent w1:p1 --source panto:extension --agent panto --state idle --seq 1") -assert(table.concat(reports[3].args, " ") == "pane report-agent w1:p1 --source panto:extension --agent panto --state working --seq 3 --custom-status tool:read") -assert(table.concat(reports[5].args, " ") == "pane report-agent w1:p1 --source panto:extension --agent panto --state idle --seq 5") +assert(table.concat(reports[1].args, " ") == "pane report-agent w1:p1 --source panto:extension --agent panto --state idle --seq 100000001") +assert(table.concat(reports[3].args, " ") == "pane report-agent w1:p1 --source panto:extension --agent panto --state working --seq 100000003 --message tool:read") +assert(table.concat(reports[5].args, " ") == "pane report-agent w1:p1 --source panto:extension --agent panto --state idle --seq 100000005") +assert(table.concat(reports[6].args, " ") == "pane release-agent w1:p1 --source panto:extension --agent panto --seq 100000006") +assert(table.concat(reports[7].args, " ") == "pane report-agent w1:p1 --source panto:extension --agent panto --state idle --seq 101000001") +assert(table.concat(reports[8].args, " ") == "pane report-agent w1:p1 --source panto:extension --agent panto --state working --seq 101000002 --message responding") +assert(table.concat(reports[9].args, " ") == "pane report-agent w1:p1 --source panto:extension --agent panto --state idle --seq 101000003") print("panto-herdr self-check: ok") |
