summaryrefslogtreecommitdiff
path: root/spec/test_models.lua
diff options
context:
space:
mode:
authort <t@tjp.lol>2026-08-19 19:02:30 -0600
committert <t@tjp.lol>2026-08-19 19:03:52 -0600
commitd1306506aa7f504b0e91c9c6ed7314afbf99978e (patch)
treee5a7295dbc566a3679e99e14dae13376b0469e84 /spec/test_models.lua
parent94e3fd8358bbdb5d6ed81aed475fab7fc73e2097 (diff)
Add background Lua workflows, inline child prompts, and layered config
subagents.lua now starts a workflow on its own coroutine and returns a session-scoped id immediately, so fan-out continues while the primary keeps working; completion wakes the primary, and later calls read immutable records from subagents.workflows. Every ctx:agent takes a workflow-unique name so those records are addressable. A session_start guidance message tells the primary when to reach for run vs lua. Children no longer inherit the primary's system context: a child starts from the fixed child-role instruction plus its profile, and subagents.run/ctx:agent accept an inline system_prompt instead of a profile. The now-redundant `agent` form of subagents.models is gone. Concurrency defaults to five and is configurable through [subagents] max_concurrent in any layered config.toml; turn boundaries reap only settled jobs so background workflows survive, while interrupt and session end cancel. Config roots come from panto.ext.dirs.layers rather than a hand-rolled XDG lookup, which picks up the base and git-ignored local layers for both agents/ and workflows/. TOML workflows tighten up: the subagents.workflow tool takes a discovered name only (inline `steps` duplicated subagents.lua at less power), an optional top-level `output` array chooses the reported steps and their order instead of the terminal set, a step with no workflow input gets no empty input heading, and a workflow naming an undiscovered agent is rejected at discovery rather than part-way through a run.
Diffstat (limited to 'spec/test_models.lua')
-rw-r--r--spec/test_models.lua49
1 files changed, 2 insertions, 47 deletions
diff --git a/spec/test_models.lua b/spec/test_models.lua
index ae01396..56d0877 100644
--- a/spec/test_models.lua
+++ b/spec/test_models.lua
@@ -1,4 +1,4 @@
--- subagents/models.lua: the four catalog query forms and the profile join.
+-- subagents/models.lua: the three catalog query forms.
--
-- The fake host answers by query shape, so each case checks both what the tool
-- asked the host for (`handle.models_queries`) and how it rendered the answer.
@@ -42,25 +42,9 @@ local function catalog(query)
}
end
-local function profile_set()
- local reviewer = {
- name = "reviewer",
- description = "Reviews changes",
- model = "anthropic:sonnet",
- reasoning = "high",
- body = "b",
- }
- local scout = { name = "scout", description = "", body = "b" }
- return {
- list = { reviewer, scout },
- by_name = { reviewer = reviewer, scout = scout },
- warnings = {},
- }
-end
-
local function with_host(fn)
local handle = fake.install({ models_response = catalog })
- local ok, err = pcall(fn, handle, profile_set())
+ local ok, err = pcall(fn, handle)
handle.restore()
if not ok then
error(err, 0)
@@ -119,35 +103,6 @@ return {
end)
end },
- { "an agent with a model reports that model", function()
- with_host(function(handle, profiles)
- local text = models.handle({ agent = "reviewer" }, profiles)
- has(text, "agent: reviewer")
- has(text, "description: Reviews changes")
- has(text, "wire model: claude-sonnet-4-6")
- has(text, "profile reasoning: high")
- assert(handle.models_queries[1].model == "anthropic:sonnet", "the profile model is looked up")
- end)
- end },
-
- { "an agent without a model says it inherits", function()
- with_host(function(handle, profiles)
- local text = models.handle({ agent = "scout" }, profiles)
- has(text, "agent: scout")
- has(text, "model: inherits the primary model")
- has(text, "inherited model: anthropic:sonnet")
- assert(next(handle.models_queries[1]) == nil, "the inherited case asks for the overview")
- end)
- end },
-
- { "an unknown agent names the known profiles", function()
- with_host(function(handle, profiles)
- local text = models.handle({ agent = "ghost" }, profiles)
- has(text, "Error: unknown agent 'ghost'")
- has(text, "reviewer, scout")
- end)
- end },
-
{ "a non-string field is refused", function()
with_host(function(handle, profiles)
has(models.handle({ query = 12 }, profiles), "Error: `query` must be a non-empty string")