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.
93 lines
5.5 KiB
HTML
93 lines
5.5 KiB
HTML
{{define "content"}}
|
|
{{$m := .Data.Mind}}
|
|
<div class="pagehead mindhead">
|
|
<div><h1>{{$m.DisplayName}} <span class="muted mono small">{{$m.Slug}}</span></h1>
|
|
<p class="muted">{{$m.Personality.Identity.Role}}{{with $m.Personality.Identity.Description}} · {{.}}{{end}}</p></div>
|
|
<div class="row">{{template "status_badge" $m.Status}}</div>
|
|
</div>
|
|
{{template "mind_tabs" (dict "M" $m "Active" "overview")}}
|
|
<section class="grid cols-3">
|
|
<div class="card">
|
|
<h2>Identity</h2>
|
|
<dl class="kv">
|
|
<dt>Name</dt><dd>{{$m.Personality.Identity.Name}}</dd>
|
|
<dt>Role</dt><dd>{{$m.Personality.Identity.Role}}</dd>
|
|
{{with $m.Personality.Identity.Pronouns}}<dt>Pronouns</dt><dd>{{.}}</dd>{{end}}
|
|
<dt>Created</dt><dd>{{date $m.CreatedAt}}</dd>
|
|
<dt>Personality</dt><dd>v{{$m.PersonalityVersion}} {{if $m.TemplateID}}<span class="badge accent">templated</span>{{end}} · <a href="/minds/{{$m.Slug}}/personality">edit</a></dd>
|
|
{{if $m.ClonedFromMind}}<dt>Cloned from</dt><dd class="mono small">{{$m.ClonedFromMind}}</dd>{{end}}
|
|
{{with $m.Notes}}<dt>Notes</dt><dd>{{.}}</dd>{{end}}
|
|
</dl>
|
|
</div>
|
|
<div class="card">
|
|
<h2>Recent activity</h2>
|
|
{{$st := .Data.Stats}}
|
|
<div class="stat-value small">{{$st.Total}} <span class="muted small">events in 24h</span></div>
|
|
<div class="cats small">{{range $k, $v := $st.ByCategory}}<span class="etype cat-{{$k}}">{{$k}} {{$v}}</span> {{end}}</div>
|
|
<p class="small"><a href="/minds/{{$m.Slug}}/thoughts">Open thought stream</a></p>
|
|
{{if .Principal.User.Role.AtLeast "operator"}}
|
|
<form method="post" action="/minds/{{$m.Slug}}/observe" class="stack" style="margin-top:.75rem">
|
|
<input type="hidden" name="_csrf" value="{{.CSRF}}">
|
|
<label>Inject observation <span class="muted small">as operator</span> <textarea name="text" rows="2" maxlength="20000" placeholder="e.g. server-01 reported SMART CRC errors at 09:12" required></textarea></label>
|
|
<div><button class="btn small" type="submit">Observe</button></div>
|
|
</form>{{end}}
|
|
</div>
|
|
<div class="card">
|
|
<h2>Cognitive configuration</h2>
|
|
<dl class="kv">
|
|
<dt>Workspace capacity</dt><dd>{{$m.Config.WorkspaceCapacity}}</dd>
|
|
<dt>Working memory</dt><dd>{{$m.Config.WorkingMemoryCapacity}} items · decay {{$m.Config.WorkingMemoryDecay}}</dd>
|
|
<dt>Cycle interval</dt><dd>{{$m.Config.CycleMinInterval}} min · {{$m.Config.IdleCycleInterval}} idle · max {{$m.Config.MaxCyclesPerMinute}}/min</dd>
|
|
<dt>LLM per cycle</dt><dd>{{$m.Config.LLMCallsPerCycle}} calls · {{$m.Config.DailyTokenBudget}} tokens/day</dd>
|
|
</dl>
|
|
</div>
|
|
</section>
|
|
<section class="grid cols-2">
|
|
<div class="card">
|
|
<h2>Personality brief <span class="muted small">what cognitive prompts receive</span></h2>
|
|
<pre class="brief">{{.Data.Brief}}</pre>
|
|
</div>
|
|
<div class="card">
|
|
<h2>Self-model</h2>
|
|
{{$sm := .Data.SelfModel}}
|
|
<h3>Capabilities</h3>
|
|
{{if $sm.Capabilities}}<ul class="plain">{{range $sm.Capabilities}}<li><code>{{.Name}}</code> <span class="badge {{if eq .Policy "allow"}}ok{{else if eq .Policy "ask"}}warn{{else}}danger{{end}}">{{.Policy}}</span> <span class="muted small">{{.Description}}</span></li>{{end}}</ul>
|
|
{{else}}<p class="muted small">No capabilities granted. This mind cannot act on external systems.</p>{{end}}
|
|
<h3>Known limitations</h3>
|
|
<ul class="small">{{range $sm.Limitations}}<li>{{.}}</li>{{end}}</ul>
|
|
{{if $sm.KnowledgeGaps}}<h3>Knowledge gaps</h3><ul class="small">{{range $sm.KnowledgeGaps}}<li>{{.}}</li>{{end}}</ul>{{end}}
|
|
<p class="muted small">Updated {{ago $sm.UpdatedAt}}</p>
|
|
</div>
|
|
</section>
|
|
{{if .Principal.User.Role.AtLeast "administrator"}}
|
|
<section class="grid cols-2">
|
|
<div class="card">
|
|
<h2>Lifecycle</h2>
|
|
<form method="post" action="/minds/{{$m.Slug}}/status" class="row">
|
|
<input type="hidden" name="_csrf" value="{{.CSRF}}">
|
|
{{if ne $m.Status "active"}}<button class="btn" name="status" value="active">Enable</button>{{end}}
|
|
{{if eq $m.Status "active"}}<button class="btn" name="status" value="disabled" data-confirm="Disable {{$m.DisplayName}}? Cognition stops; history is kept.">Disable</button>{{end}}
|
|
{{if ne $m.Status "archived"}}<button class="btn btn-danger" name="status" value="archived" data-confirm="Archive {{$m.DisplayName}}? It is hidden from lists but nothing is deleted.">Archive</button>{{end}}
|
|
</form>
|
|
<p class="muted small">Cognitive history is never hard-deleted by these actions.</p>
|
|
<form method="post" action="/minds/{{$m.Slug}}/notes" class="stack">
|
|
<input type="hidden" name="_csrf" value="{{.CSRF}}">
|
|
<label>Operator notes <textarea name="notes" rows="2">{{$m.Notes}}</textarea></label>
|
|
<div><button class="btn small" type="submit">Save notes</button></div>
|
|
</form>
|
|
</div>
|
|
<div class="card">
|
|
<h2>Clone</h2>
|
|
<p class="muted small">Same personality and configuration, fresh experience. Forking with memories arrives with snapshots.</p>
|
|
<form method="post" action="/minds/{{$m.Slug}}/clone" class="stack">
|
|
<input type="hidden" name="_csrf" value="{{.CSRF}}">
|
|
<label>New slug <input name="slug" required pattern="[a-z0-9][a-z0-9-]{0,62}" placeholder="{{$m.Slug}}-experiment"></label>
|
|
<label>Display name <input name="display_name"></label>
|
|
<div><button class="btn" type="submit">Clone</button></div>
|
|
</form>
|
|
</div>
|
|
</section>
|
|
{{end}}
|
|
{{end}}
|
|
{{define "status_badge"}}{{if eq . "active"}}<span class="badge ok">active</span>{{else if eq . "disabled"}}<span class="badge warn">disabled</span>{{else}}<span class="badge">archived</span>{{end}}{{end}}
|