Phase 4 (ADR-0001). internal/attention scores thought candidates as a normalised weighted sum over ten named features with a per-term breakdown, ranked by (score, id) so ordering is total and replayable. internal/workspace holds the capacity-limited workspace (refresh by subject, decayed competition, explained admit/reject outcomes) and the decaying working memory. internal/brain runs one runtime per active mind: debounced wake-ups from the event bus (own output never re-triggers), a settle window so concurrently committing events are not skipped, bounded concurrent Observe calls with per-process isolation and timeouts, deterministic scoring, a loop detector that suppresses recurring thoughts and raises a metacognition warning, executive dispatch by thought kind, and one transaction per cycle whose events are published only after commit. Every candidate, selection, attention shift and broadcast is an event with provenance back to the triggering observation. Operators can run a cycle, pause, resume, reset transient state and change attention weights live; the manager reconciles runtimes with mind status. cognition/attend is the first process: deterministic candidates from external events using an urgency lexicon, novelty against context and trust-based operator priority.
36 lines
1020 B
Go
36 lines
1020 B
Go
// Package app holds the dependency bundle shared by the HTTP API, the web UI
|
|
// and the CLI-facing services. It exists so that constructors take one typed
|
|
// value instead of a growing parameter list, without resorting to globals.
|
|
package app
|
|
|
|
import (
|
|
"io/fs"
|
|
"log/slog"
|
|
"time"
|
|
|
|
"github.com/jackc/pgx/v5/pgxpool"
|
|
|
|
"github.com/andydixon/noema/internal/audit"
|
|
"github.com/andydixon/noema/internal/auth"
|
|
"github.com/andydixon/noema/internal/brain"
|
|
"github.com/andydixon/noema/internal/config"
|
|
"github.com/andydixon/noema/internal/events"
|
|
"github.com/andydixon/noema/internal/minds"
|
|
"github.com/andydixon/noema/internal/observability"
|
|
)
|
|
|
|
// Deps is everything a handler may need. Fields are added per phase.
|
|
type Deps struct {
|
|
Config config.Config
|
|
Log *slog.Logger
|
|
DB *pgxpool.Pool
|
|
Auth *auth.Service
|
|
Audit *audit.Logger
|
|
Metrics *observability.Metrics
|
|
Minds *minds.Store
|
|
Events *events.Store
|
|
Brain *brain.Manager
|
|
Migrations fs.FS
|
|
Started time.Time
|
|
}
|