summaryrefslogtreecommitdiff
path: root/spec/test_toml_workflows.lua
diff options
context:
space:
mode:
Diffstat (limited to 'spec/test_toml_workflows.lua')
-rw-r--r--spec/test_toml_workflows.lua29
1 files changed, 28 insertions, 1 deletions
diff --git a/spec/test_toml_workflows.lua b/spec/test_toml_workflows.lua
index 8ae2cac..4755b8e 100644
--- a/spec/test_toml_workflows.lua
+++ b/spec/test_toml_workflows.lua
@@ -11,6 +11,7 @@
local fake = require("spec.fake_ext")
local paths = require("subagents.paths")
+local progress = require("subagents.progress")
local toml_workflows = require("subagents.toml_workflows")
local function has(text, needle)
@@ -384,9 +385,25 @@ return {
end)
end },
- { "the tool runs a transient definition", function()
+ { "the tool runs a transient definition and presents each child prompt only when expanded", function()
with_host(function(handle, profiles)
handle.queue_for("alpha", { output = "transient output" })
+ progress.reset()
+ local component
+ progress.claim({
+ id = "workflow-call",
+ tool_name = "subagents.workflow",
+ collapsed = true,
+ set_component = function(_, value)
+ component = value
+ return {
+ invalidate = function() end,
+ alive = function() return true end,
+ set_pinned = function() end,
+ }
+ end,
+ })
+ progress.bind({ tool_call_id = "workflow-call" })
local text = toml_workflows.handle({
prompt = "the input",
steps = { { id = "only", agent = "alpha", prompt = "Do it." } },
@@ -394,11 +411,21 @@ return {
has(text, "step: only")
has(text, "transient output")
has(handle.spawns[1].prompt, "Do it.\n\n## Workflow input\n\nthe input")
+ local compact = table.concat(component:render(100), "\n")
+ assert(not compact:find("Do it.", 1, true), compact)
+ assert(not compact:find("the input", 1, true), compact)
+ progress.collapse({ collapsed = false })
+ local expanded = table.concat(component:render(100), "\n")
+ has(expanded, "prompt: Do it.")
+ has(expanded, "## Workflow input")
+ has(expanded, "the input")
+ assert(not expanded:find("system prompt:", 1, true), expanded)
has(toml_workflows.handle({
prompt = "x",
steps = { { id = "only", agent = "alpha", prompt = "p", needs = { "ghost" } } },
}, profiles), "unknown dependency 'ghost'")
+ progress.reset()
end)
end },
}