Phase 3. Events are the append-only record of everything a mind does (ADR-0002). pkg/events defines the closed type vocabulary, categories, evidence references and the observation payload with explicit trust levels. The store validates and appends inside the caller's transaction, publishes to a bounded fan-out bus only after commit, queries by seq cursor with type/category/source/salience/confidence/time/search filters, and walks provenance: cause, parents, children, cited evidence, derived events and correlation groups. Durable per-consumer cursors never move backwards. Server-Sent Events streams (per mind and global) subscribe before replaying history after Last-Event-ID so nothing is missed, apply the same filter vocabulary live, and heartbeat. Operators can inject observations tagged with operator trust for demos and tests. UI: live thought stream with filters and paging, forensic event page with causal chain and evidence navigation, dashboard important events. Personality and status changes now leave operator_action events in the mind's own history. CLI: event inspect/list/tail, observe.
34 lines
948 B
Go
34 lines
948 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/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
|
|
Migrations fs.FS
|
|
Started time.Time
|
|
}
|