The cognitive registry was assembled by hand in three places. Ablation experiments need the daemon, the test harness and replay sandboxes to name the same processes and hooks, so they now share cognition.NewRegistry; hooks are added only when their store exists, which keeps the harness's previous behaviour.
46 lines
1.7 KiB
Go
46 lines
1.7 KiB
Go
package cognition
|
|
|
|
import (
|
|
"github.com/andydixon/noema/internal/beliefs"
|
|
"github.com/andydixon/noema/internal/brain"
|
|
"github.com/andydixon/noema/internal/conversation"
|
|
"github.com/andydixon/noema/internal/epistemics"
|
|
"github.com/andydixon/noema/internal/graph"
|
|
"github.com/andydixon/noema/internal/memory"
|
|
"github.com/andydixon/noema/internal/motivation"
|
|
"github.com/andydixon/noema/internal/narrative"
|
|
"github.com/andydixon/noema/internal/notifications"
|
|
)
|
|
|
|
// Stores bundles what the default processes, handlers and hooks write to.
|
|
// A nil store disables the parts that depend on it.
|
|
type Stores struct {
|
|
Memory *memory.Store
|
|
Beliefs *beliefs.Store
|
|
Conversations *conversation.Store
|
|
Graph *graph.Store
|
|
Assertions *epistemics.Store
|
|
Motivation *motivation.Store
|
|
Narrative *narrative.Store
|
|
Notifications *notifications.Store
|
|
}
|
|
|
|
// NewRegistry assembles the cognitive registry. The daemon, the test harness
|
|
// and sandbox runtimes all call it, so they run the same cognition and an
|
|
// ablation names the same components everywhere.
|
|
func NewRegistry(s Stores) *brain.Registry {
|
|
r := brain.NewRegistry().AddProcess(Attend{}).AddProcess(Retrieve{}).AddProcess(Associate{}).AddProcess(Perceive{}).
|
|
AddProcess(GoalMonitor{}).AddProcess(Curiosity{}).AddProcess(Metacognition{}).AddProcess(Act{})
|
|
if s.Motivation != nil {
|
|
r.AddHook(MotivationHook{Store: s.Motivation})
|
|
}
|
|
if s.Narrative != nil {
|
|
r.AddHook(NarrativeHook{Store: s.Narrative})
|
|
}
|
|
if s.Notifications != nil {
|
|
r.AddHook(NotifyHook{Store: s.Notifications})
|
|
}
|
|
Handlers{Memory: s.Memory, Beliefs: s.Beliefs, Conversations: s.Conversations, Graph: s.Graph, Assertions: s.Assertions}.Register(r)
|
|
return r
|
|
}
|