diff options
Diffstat (limited to 'spec/test_init.lua')
| -rw-r--r-- | spec/test_init.lua | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/spec/test_init.lua b/spec/test_init.lua index 2d5e7d1..97f0eba 100644 --- a/spec/test_init.lua +++ b/spec/test_init.lua @@ -176,8 +176,23 @@ return { local claimed, pins = nil, {} handle.emit("tool_call_complete", { + id = "replayed-call", + tool_name = "subagents.workflow", + set_component = function(_, component) + claimed = component + return { + invalidate = function() end, + alive = function() return true end, + set_pinned = function(_, value) pins[#pins + 1] = value end, + } + end, + }) + assert(#pins == 0, "a workflow restored during startup stays in transcript order") + + handle.emit("turn_start", {}) + handle.emit("tool_call_complete", { id = "call-1", - tool_name = "subagents.run", + tool_name = "subagents.workflow", set_component = function(_, component) claimed = component return { @@ -189,9 +204,13 @@ return { }) assert(type(claimed) == "table" and type(claimed.render) == "function", "the entry is given a component that renders the cards") - assert(pins[1] == true, "the progress component pins after claim") - handle.emit("tool_result", { id = "call-1", tool_name = "subagents.run" }) - assert(pins[2] == false, "the matching result unpins it") + assert(pins[1] == true, "the live progress component pins after claim") + local output = handle.tools_by_name["subagents.workflow"].handler( + { prompt = "", steps = {} }, { tool_call_id = "call-1" }) + assert(type(output) == "string", "the workflow handler returned its result") + assert(pins[2] == false, "handler completion unpins before the next model action") + handle.emit("tool_result", { id = "call-1", tool_name = "subagents.workflow" }) + assert(#pins == 2, "the later host result is an inert fallback") local foreign handle.emit("tool_call_complete", { |
