feat(eda): workflow inputs, optional repository and agent profiles
Workflow definitions declare inputs, repository (none, optional or required; default required) and profile. A binding assigns each input from a mapped parameter or a constant and may take its repository from a parameter, which must name a configured repo; both are checked when the binding is saved and again at dispatch. Inputs travel as structured task data (tasks.inputs, the task brief, and a JSON block in the agent's mission), never as body text. A task with no repository runs in a per-task scratch workspace with no clone and no publication grant. The agent.run step runs one mission without a repository and finishes the task in the new completed status. Agent profiles live under [containers.profiles.<name>]: an image and an allowlist over the tools archie adds (MCP, scripts, plugins). [containers].image is the default profile; an unconfigured profile parks the task. The workflow is now pinned before the container starts so the profile can choose its image. Also stop two archied tests writing embedded NATS state into the package directory, refuse an empty state_dir for embedded NATS, and drop the NATS store files an earlier lane commit tracked.
This commit is contained in:
1 parent
7181e7917d
commit
c431834e2b
118 files changed
+2163
-327
No files matched your search
@@ -107,36 +107,53 @@ func (s *Server) handleWorkRequest(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func (s *Server) hasWorkflow(ctx context.Context, id string) (bool, error) {
|
||||
definitions, err := s.workflowDefinitions(ctx)
|
||||
_, found, err := s.workflowEntry(ctx, id)
|
||||
return found, err
|
||||
}
|
||||
|
||||
// workflowEntry returns the stored definition of workflow id.
|
||||
func (s *Server) workflowEntry(ctx context.Context, id string) (task.WorkflowDefinitionEntry, bool, error) {
|
||||
collection, err := s.workflowCollection(ctx)
|
||||
if err != nil {
|
||||
return false, err
|
||||
return task.WorkflowDefinitionEntry{}, false, err
|
||||
}
|
||||
for _, definition := range definitions {
|
||||
if definition.ID == id {
|
||||
return true, nil
|
||||
}
|
||||
entry, found := collection.DefinitionByID(id)
|
||||
return entry, found, nil
|
||||
}
|
||||
|
||||
func (s *Server) workflowCollection(ctx context.Context) (task.WorkflowDefinitionCollection, error) {
|
||||
if s.ControlPlane == nil {
|
||||
return task.WorkflowDefinitionCollection{}, nil
|
||||
}
|
||||
return false, nil
|
||||
response, err := s.ControlPlane.Query(ctx, &controlpb.QueryRequest{Kind: workflowDefinitionsKind})
|
||||
if err != nil {
|
||||
return task.WorkflowDefinitionCollection{}, err
|
||||
}
|
||||
if response.Resource == nil {
|
||||
return task.WorkflowDefinitionCollection{}, errors.New("workflow definitions missing")
|
||||
}
|
||||
var collection task.WorkflowDefinitionCollection
|
||||
if err := json.Unmarshal(response.Resource.ValueJson, &collection); err != nil {
|
||||
return task.WorkflowDefinitionCollection{}, err
|
||||
}
|
||||
return collection, nil
|
||||
}
|
||||
|
||||
func (s *Server) workflowDefinitions(ctx context.Context) ([]task.Definition, error) {
|
||||
if s.ControlPlane == nil {
|
||||
return nil, nil
|
||||
}
|
||||
response, err := s.ControlPlane.Query(ctx, &controlpb.QueryRequest{Kind: workflowDefinitionsKind})
|
||||
collection, err := s.workflowCollection(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if response.Resource == nil {
|
||||
return nil, errors.New("workflow definitions missing")
|
||||
}
|
||||
var collection task.WorkflowDefinitionCollection
|
||||
if err := json.Unmarshal(response.Resource.ValueJson, &collection); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
definitions := make([]task.Definition, 0, len(collection.Definitions))
|
||||
for _, entry := range collection.Definitions {
|
||||
definitions = append(definitions, task.Definition{ID: entry.ID, Name: entry.ID, Origin: "database", Enabled: true})
|
||||
definition := task.Definition{ID: entry.ID, Name: entry.ID, Origin: "database", Enabled: true, Repository: task.RepositoryRequired}
|
||||
if iface, err := task.ParseWorkflowInterface(entry.YAML); err == nil {
|
||||
definition.Inputs, definition.Repository = iface.Inputs, iface.RepositoryMode()
|
||||
}
|
||||
definitions = append(definitions, definition)
|
||||
}
|
||||
return definitions, nil
|
||||
}
|
||||
Reference in new issue
Block a user