summaryrefslogtreecommitdiff
path: root/_selfcheck.lua
diff options
context:
space:
mode:
authort <t@tjp.lol>2026-10-25 16:23:29 -0600
committert <t@tjp.lol>2026-10-26 10:28:44 -0600
commita139aba0d7426c5961ea26ec8d1ce70de25f12e6 (patch)
treecc1324530d128dbdbef8fa4d4ff63324007cb1a7 /_selfcheck.lua
parent8db51f9455a53fcd95982a75343ccfb8d8bac47b (diff)
Subscribe to pantograph's render_* events
The header wrap moves to `render_header` and the policy timer starts on `session_ready`, since `session_start` is now a lifecycle event that also fires for child agents.
Diffstat (limited to '_selfcheck.lua')
-rw-r--r--_selfcheck.lua54
1 files changed, 54 insertions, 0 deletions
diff --git a/_selfcheck.lua b/_selfcheck.lua
index fa6a0e2..6cc3e4a 100644
--- a/_selfcheck.lua
+++ b/_selfcheck.lua
@@ -173,6 +173,60 @@ local entry = assert(loadfile(here .. "/init.lua"))()
assert(type(entry) == "table" and entry.name == "warming" and type(entry.activate) == "function",
"init.lua returns the warming entry")
+-- Activation binds lifecycle timing to session_ready and the banner to the
+-- render boundary; neither handler is the old session_start event.
+do
+ local handlers = {}
+ local previous_panto = package.loaded.panto
+ local previous_luv = package.loaded.luv
+ local previous_config = package.loaded["warming.config"]
+ local previous_policy = package.loaded["warming.policy"]
+ local previous_warm = package.loaded["warming.warm"]
+ package.loaded["warming.config"] = {
+ default_io = function() return {} end,
+ read = function() return { enabled = true, interval_ms = MIN, duration_ms = MIN, prompt = "OK" } end,
+ }
+ package.loaded["warming.policy"] = {
+ new = function()
+ return {
+ activity = function(self, now) self.activity_at = now end,
+ turn_started = function() end, turn_ended = function() end,
+ expired = function() return false end, due = function() return false end,
+ attempted = function() end,
+ }
+ end,
+ }
+ package.loaded["warming.warm"] = { start = function() end, poll = function() end, abandon = function() end }
+ package.loaded.panto = { agent = function() end, ext = {
+ on = function(name, handler) handlers[name] = handler end,
+ resolve_model = function() end,
+ style = function() return { dim = "", reset = "" } end,
+ } }
+ package.loaded.luv = {
+ now = function() return 123 end,
+ new_timer = function()
+ return { start = function(self) self.active = true end, is_active = function(self) return self.active end,
+ is_closing = function() return false end, stop = function(self) self.active = false end,
+ close = function() end }
+ end,
+ }
+ local active_entry = assert(loadfile(here .. "/init.lua"))()
+ active_entry.activate()
+ assert(handlers.render_header and handlers.session_ready, "new event subscriptions are installed")
+ assert(handlers.session_start == nil, "old session_start subscription is absent")
+ handlers.session_ready()
+ local inner = { render = function() return { "header" } end }
+ local event = { get_component = function() return inner end }
+ event.set_component = function(_, component) event.component = component end
+ handlers.render_header(event)
+ assert(event.component and event.component:render(80)[1] == "header", "render_header wraps the banner")
+ package.loaded.panto = previous_panto
+ package.loaded.luv = previous_luv
+ package.loaded["warming.config"] = previous_config
+ package.loaded["warming.policy"] = previous_policy
+ package.loaded["warming.warm"] = previous_warm
+end
+
-- ---------------------------------------------------------------------------
-- Tool-schema fidelity probe (report-only)
--