summaryrefslogtreecommitdiff
path: root/subagents/progress.lua
diff options
context:
space:
mode:
Diffstat (limited to 'subagents/progress.lua')
-rw-r--r--subagents/progress.lua14
1 files changed, 11 insertions, 3 deletions
diff --git a/subagents/progress.lua b/subagents/progress.lua
index 03fe62a..d88e239 100644
--- a/subagents/progress.lua
+++ b/subagents/progress.lua
@@ -326,8 +326,9 @@ end
function M.settle(event)
local key = type(event) == "table" and (event.id or event.tool_call_id) or nil
local board = key and boards[key]
- if not board then return end
- set_board_pinned(board, false)
+ if board then set_board_pinned(board, false) end
+ local co = coroutine.running()
+ if co and bound[co] == key then bound[co] = nil end
end
function M.collapse(event)
@@ -347,6 +348,12 @@ function M.bind(context)
if co then bound[co] = key end
end
+function M.bind_coroutine(co, tool_call_id)
+ if type(co) ~= "thread" then return end
+ if type(tool_call_id) ~= "string" or tool_call_id == "" then tool_call_id = nil end
+ bound[co] = tool_call_id
+end
+
-- The outer tool call is durable child-turn metadata, not model-visible output.
-- Expose it to the spawn seam without making the board state global: workflow
-- callbacks run on the same coroutine as their owning tool handler.
@@ -723,7 +730,8 @@ function M.reset()
set_board_pinned(board, false)
end
prune_boards()
- bound = setmetatable({}, { __mode = "k" })
+ -- `bound` has weak coroutine keys. Foreground handlers clear themselves in
+ -- settle(); background workflow bindings must survive turn boundaries.
end
return M