The Web UI and messaging channels now read and write Archie's runtime settings through one versioned, audited control-plane API hosted on the State Store's existing gRPC server: catalog, query, command, watch. Each feature owns its resource, validation and commands; storage only writes versions and audit records. Workflows move with it. Definitions become portable YAML compiled through a closed, typed step registry and stored as a control-plane resource, so the yaegi interpretation paths (internal/gate, wfeval, wfextract, gateeval, gateextract, skillbuild) are deleted rather than carried. The UI process reads definitions as data: the JSON projection lives in internal/domain/workflow/task so a dashboard decodes the stored collection without linking the workflow engine, which cmd/archie-ui's deletion gate forbids. Shipped definitions ride the catalog descriptor rather than a bespoke REST route, keeping the API to its four operations. archie-messaging gains -state-store-target/-state-store-token and reads channel settings from the database, failing closed when the State Store is unreachable: the database is authoritative for those settings.
54 lines
1.9 KiB
Go
54 lines
1.9 KiB
Go
package agent
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
)
|
|
|
|
type Persona struct {
|
|
Name string `json:"name"`
|
|
Prompt string `json:"prompt"`
|
|
}
|
|
|
|
type PersonaCollection struct {
|
|
Default string `json:"default"`
|
|
Personas []Persona `json:"personas"`
|
|
}
|
|
|
|
func (c PersonaCollection) Validate() error {
|
|
if len(c.Personas) == 0 {
|
|
return fmt.Errorf("at least one persona is required")
|
|
}
|
|
defaultName := normalizePersonaName(c.Default)
|
|
seen := make(map[string]struct{}, len(c.Personas))
|
|
for _, persona := range c.Personas {
|
|
name := normalizePersonaName(persona.Name)
|
|
if name == "" || strings.TrimSpace(persona.Prompt) == "" {
|
|
return fmt.Errorf("persona name and prompt are required")
|
|
}
|
|
if _, exists := seen[name]; exists {
|
|
return fmt.Errorf("duplicate persona %q", name)
|
|
}
|
|
seen[name] = struct{}{}
|
|
}
|
|
if _, exists := seen[defaultName]; !exists {
|
|
return fmt.Errorf("default persona %q does not exist", c.Default)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func normalizePersonaName(name string) string {
|
|
return strings.ToLower(strings.TrimSpace(name))
|
|
}
|
|
|
|
func ShippedPersonas() PersonaCollection {
|
|
return PersonaCollection{Default: "archie", Personas: []Persona{
|
|
{Name: "archie", Prompt: "You are Archie, a capable coding and project assistant. Be direct without being brusque, grounded in the actual workspace state, and use available tools when asked. Do not claim tools, files, memories, actions, or results you have not verified. Do not impersonate another assistant, provider, or vendor."},
|
|
{Name: "helpful", Prompt: "You are a helpful, friendly AI assistant."},
|
|
{Name: "concise", Prompt: "You are a concise assistant. Keep responses brief and to the point."},
|
|
{Name: "technical", Prompt: "You are a technical expert. Provide detailed, accurate technical information."},
|
|
{Name: "creative", Prompt: "You are a creative assistant. Think outside the box and offer innovative solutions."},
|
|
{Name: "teacher", Prompt: "You are a patient teacher. Explain concepts clearly with examples."},
|
|
}}
|
|
}
|