Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions plugins/workflow/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ For example:
Start an agent and ask it to use the workflow. For the test workflow above
send: `Demonstrate workflow plugin`

New workflows put into `pluginWorkflowInstructionsDir` while the agent is
running become available after the agent calls the `workflow-refresh-list`
skill. Ask the agent to refresh the list of workflows, or just ask it to load
the new workflow by name.

## Workflow parameters

Wofkflow plugin Omega configuration parameters:
Expand Down
13 changes: 10 additions & 3 deletions plugins/workflow/workflow.metta
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
(log INFO "workflow-plugin" "Adding plugin's skills")
(add-skill workflow-load-instructions "Load an existing workflow instructions into the active context" (workflow_name))
(add-skill workflow-unload-instructions "Unload active workflow from the active context" ())
(let $workflows (join (newline) (cons-atom "Available workflows: " (workflow-list-available)))
(add-prompt-extension workflows-available $workflows))
(add-skill workflow-refresh-list "Re-read available workflows from disk; use when a workflow was added or is missing from the list" ())
(workflow-refresh-list)
())
$rc)))))

Expand Down Expand Up @@ -52,7 +52,7 @@
(Error (quote (workflow-load-instructions $name)) (strings-concat ("ERROR: invalid workflow name: " $name)))
(let $path (joinPath ((instructionsDir) $name "SKILL.md"))
(if (not (exists-file $path))
(Error (quote (workflow-load-instructions $name)) (strings-concat ("ERROR: skill file not found: " $path)))
(Error (quote (workflow-load-instructions $name)) (strings-concat ("ERROR: skill file not found: " $path ". Try to call workflow-refresh-list")))
(let $content (read-file $path)
(progn
(log INFO "workflow-plugin" (strings-concat ("Loading workflow instructions for: " $name)))
Expand Down Expand Up @@ -108,6 +108,13 @@
($dirs (directory-dirs $base)))
(collect-description $dirs $base)))

;; re-reads available workflows into the prompt
(= (workflow-refresh-list)
(let $text (join (newline) (cons-atom "Available workflows: " (workflow-list-available)))
(progn
(remove-prompt-extension workflows-available)
(add-prompt-extension workflows-available $text))))

;; collects workflow description from description.txt
(= (collect-description () $base) ())
(= (collect-description (cons $first $tail) $base)
Expand Down
Loading