feat(workflow): serve step type titles with the step vocabulary (#1961)

Each step type declares its title beside its factory and settings; the
control plane serves it in x-step-types, and the dashboard reads it instead
of a hand-written TYPE_TITLES table. Parallel and switch are YAML shapes, not
registered types, so their titles stay with the graph.
This commit is contained in:
sam committed 2026-11-13 20:26:27 +11:00
1 parent 841c6aea16
commit ca4b039cb4
19 files changed
+72 -75

No files matched your search

@@ -63,7 +63,7 @@ func NewServer(resources ResourceStore, steps *workflow.Manager) (*Server, error
if err != nil {
return nil, err
}
definitions := builtinDefinitions(registry, steps.Settings())
definitions := builtinDefinitions(registry, steps.Types())
byKind := make(map[string]Definition, len(definitions))
for _, definition := range definitions {
byKind[definition.Kind] = definition
@@ -7,8 +7,8 @@ import (
// Schemas are not declared here: each Definition names its document type, and
// Definition.Descriptor derives the JSON Schema from it (internal/infrastructure/controlplanestore/schema.go).
func builtinDefinitions(steps workflow.StepRegistry, settings map[string]any) []Definition {
definitions := []Definition{taskPolicyDefinition(), workflowDefinition(), workflowDefinitionsDefinition(steps, settings), workflowDraftsDefinition(), workflowEnablementDefinition(), curatorDefinition(), soulDefinition(), agentProfileDefinition(), playbooksDefinition(), skillsDefinition(), credentialBindingsDefinition(), identityGrantsDefinition(), orgModelPolicyDefinition(), forgeConnectionsDefinition()}
func builtinDefinitions(steps workflow.StepRegistry, types map[string]workflow.StepType) []Definition {
definitions := []Definition{taskPolicyDefinition(), workflowDefinition(), workflowDefinitionsDefinition(steps, types), workflowDraftsDefinition(), workflowEnablementDefinition(), curatorDefinition(), soulDefinition(), agentProfileDefinition(), playbooksDefinition(), skillsDefinition(), credentialBindingsDefinition(), identityGrantsDefinition(), orgModelPolicyDefinition(), forgeConnectionsDefinition()}
definitions = append(definitions, modelDefinitions()...)
definitions = append(definitions, operationalDefinitions()...)
return definitions
@@ -21,7 +21,7 @@ func stepRegistry(steps *workflow.Manager) (workflow.StepRegistry, error) {
return steps.Registry(), nil
}
func workflowDefinitionsDefinition(steps workflow.StepRegistry, settings map[string]any) Definition {
func workflowDefinitionsDefinition(steps workflow.StepRegistry, types map[string]workflow.StepType) Definition {
return Definition{
Kind: WorkflowDefinitionsKind,
Title: "Workflow definitions",
@@ -45,18 +45,18 @@ func workflowDefinitionsDefinition(steps workflow.StepRegistry, settings map[str
value, err := json.Marshal(collection)
return value, removed, err
},
SchemaExtensions: map[string]any{"x-step-types": stepTypeVocabulary(steps, settings), "x-intake-routes": workflow.IntakeRoutes()},
SchemaExtensions: map[string]any{"x-step-types": stepTypeVocabulary(steps, types), "x-intake-routes": workflow.IntakeRoutes()},
}
}
// stepTypeVocabulary is the registered step types as the dashboard editor
// reads them: each name, whether it needs a repository, and the schema of its
// settings (absent for a step that takes none).
func stepTypeVocabulary(steps workflow.StepRegistry, settings map[string]any) []map[string]any {
// reads them: each name, title, whether it needs a repository, and the schema
// of its settings (absent for a step that takes none).
func stepTypeVocabulary(steps workflow.StepRegistry, types map[string]workflow.StepType) []map[string]any {
vocabulary := make([]map[string]any, 0, len(steps))
for _, name := range slices.Sorted(maps.Keys(steps)) {
entry := map[string]any{"name": name, "needs_repository": workflow.NeedsRepository(name)}
if schema := settingsSchema(settings[name]); schema != nil {
entry := map[string]any{"name": name, "title": types[name].Title, "needs_repository": workflow.NeedsRepository(name)}
if schema := settingsSchema(types[name].Settings); schema != nil {
entry["settings"] = schema
}
vocabulary = append(vocabulary, entry)