diff options
| -rw-r--r-- | README.md | 5 | ||||
| -rw-r--r-- | init.lua | 1 | ||||
| -rw-r--r-- | spec/test_init.lua | 2 |
3 files changed, 8 insertions, 0 deletions
@@ -145,6 +145,11 @@ records through `subagents.workflows[id]`, including named child status and outputs. Every `ctx:agent` needs a workflow-unique `name`, and the callback must return the workflow's string result. +The same read-only workflow records are exposed to other extensions as +`panto.ext.workflows`. Extensions can iterate this table or look up an ID; each +record has `id`, `status`, `result`, `error`, and `agents`, and a `status` of +`running` identifies in-flight background work. + Inline `agents` remain scoped to workflows started by that tool call. The API can await one job or a group and supports one-turn workers whose validated tool input is their structured result. Persistent TOML workflows remain the simpler @@ -267,6 +267,7 @@ local function activate() end jobs.MAX_CONCURRENT = configured_max_concurrent(ext) + ext.workflows = workflow_api.workflows -- Discover through spawn so the workflow lanes, which resolve profiles -- lazily, share the exact set this tool description advertises. diff --git a/spec/test_init.lua b/spec/test_init.lua index eb8777a..bb42c57 100644 --- a/spec/test_init.lua +++ b/spec/test_init.lua @@ -236,6 +236,8 @@ return { { "background workflows survive turn_end and interruption cancels them", function() activate_bare(function(handle, ok, err) assert(ok, tostring(err)) + assert(handle.ext.workflows == workflow.workflows, + "extensions can inspect background workflow status") local tool = handle.tools_by_name["subagents.lua"] handle.queue({ output = "finished", settle = 3 }) local id = tool.handler({ source = [[ |
