feat: add conversation with grounded replies, sample mind and M1 acceptance test
Phase 8, completing milestone M1. A user message is stored and appended as an observation event carrying trust, actor, channel and reference. The perceive process analyses it deterministically (intent, introspection kind, entities, claims, urgency) and, within the per-cycle model allowance, enriches it through the perceive prompt. Its handler writes a perception event, an episodic memory with participants, turns claims into beliefs whose evidence is the message, and builds a response intent from state: beliefs and memories for the topic, evidence rows for why-questions, the uncertain band, contested beliefs and their links, recent learning, status changes, and honest declines for subsystems that do not exist yet or for requests with no capabilities. The respond prompt phrases the intent when a model is assigned; otherwise the reply is a direct rendering of the intent. response_generated cites the message, the perception, every belief and memory used, the episode and the model call. API: conversations, messages with optional wait, one-shot ask; chat UI with live refresh and a per-reply intent view. Sample mind Dani as a strictly decoded seed document with an import endpoint and noemactl mind import. tests/m1 drives all fourteen milestone steps including restart.
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
{{define "content"}}
|
||||
{{$m := .Data.Mind}}{{$c := .Data.Conversation}}
|
||||
<div class="pagehead mindhead"><div><p class="muted small"><a href="/minds/{{$m.Slug}}/conversations">conversations</a> › {{$c.Channel}}{{if $c.Person}} · {{$c.Person}}{{end}}{{if $c.Project}} · {{$c.Project}}{{end}}</p><h1>{{if $c.Title}}{{$c.Title}}{{else}}Conversation with {{$m.DisplayName}}{{end}}</h1></div>
|
||||
<div class="row"><span data-stream-status class="badge">connecting…</span>{{if not .Data.LLM}}<span class="badge warn" title="Replies are deterministic renderings of state until a model is assigned to the respond role">no respond model</span>{{end}}</div></div>
|
||||
<section class="grid cols-3-1">
|
||||
<div class="card chat">
|
||||
<div id="chat-live" data-refresh-on="response_generated,observation" data-refresh-url="/minds/{{$m.Slug}}/conversations/{{$c.ID}}" data-stream="/api/v1/minds/{{$m.Slug}}/events/stream?type=response_generated,observation">
|
||||
<ol class="messages">{{range .Data.Messages}}<li class="msg msg-{{.Role}}">
|
||||
<div class="msg-head"><strong>{{.Actor}}</strong> <span class="muted small">{{.CreatedAt.Local.Format "15:04:05"}}</span>{{if .EventID}} <a class="small" href="/events/{{.EventID}}">event</a>{{end}}{{if .LLMCallID}} <span class="badge small">model</span>{{else if eq .Role "mind"}} <span class="badge small" title="Deterministic rendering">state</span>{{end}}</div>
|
||||
<div class="msg-body">{{.Content}}</div>
|
||||
{{if .Intent}}<details class="small muted"><summary>why this reply</summary><pre class="json">{{pretty .Intent}}</pre></details>{{end}}
|
||||
</li>{{else}}<li class="muted">Say something.</li>{{end}}</ol>
|
||||
</div>
|
||||
{{if .Principal.User.Role.AtLeast "operator"}}
|
||||
<form method="post" action="/minds/{{$m.Slug}}/conversations/{{$c.ID}}/messages" class="row chat-input">
|
||||
<input type="hidden" name="_csrf" value="{{.CSRF}}">
|
||||
<input name="text" class="grow" placeholder="Ask {{$m.DisplayName}} something… e.g. What are you thinking about?" required maxlength="20000" autofocus autocomplete="off">
|
||||
<button class="btn btn-primary" type="submit">Send</button>
|
||||
</form>
|
||||
{{end}}
|
||||
</div>
|
||||
<div class="stack">
|
||||
<div class="card small">
|
||||
<h2>How a reply forms</h2>
|
||||
<ol class="steps"><li>message → <span class="etype cat-perception">observation</span></li><li><span class="etype cat-perception">perception</span>: intent, entities, claims</li><li>recall + workspace competition</li><li>intent built from beliefs and memories</li><li>wording by the respond model, or a direct rendering of state</li><li><span class="etype cat-cognition">response_generated</span> with cited evidence</li></ol>
|
||||
<p class="muted">Open “why this reply” under any answer, or its event, to see the evidence.</p>
|
||||
</div>
|
||||
<div class="card small">
|
||||
<h2>Try asking</h2>
|
||||
<ul class="plain muted">{{range .Data.Suggestions}}<li>“{{.}}”</li>{{end}}</ul>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
{{end}}
|
||||
@@ -0,0 +1,24 @@
|
||||
{{define "content"}}
|
||||
{{$m := .Data.Mind}}
|
||||
<div class="pagehead mindhead"><div><h1>{{$m.DisplayName}} <span class="muted small">conversations</span></h1><p class="muted">Messages become observations; replies are grounded in beliefs and memories and carry their provenance.</p></div></div>
|
||||
{{template "mind_tabs" (dict "M" $m "Active" "conversation")}}
|
||||
<section class="grid cols-3-1">
|
||||
<div class="card">
|
||||
{{if .Data.Conversations}}<table class="table compact"><thead><tr><th>Title</th><th>Person</th><th>Project</th><th>Channel</th><th>Last message</th></tr></thead>
|
||||
<tbody>{{range .Data.Conversations}}<tr><td><a href="/minds/{{$m.Slug}}/conversations/{{.ID}}">{{if .Title}}{{.Title}}{{else}}<em class="muted">untitled</em>{{end}}</a></td><td class="small">{{.Person}}</td><td class="small">{{.Project}}</td><td class="small muted">{{.Channel}}</td><td class="small muted">{{ago .LastMessageAt}}</td></tr>{{end}}</tbody></table>
|
||||
{{else}}<p class="muted">No conversations yet.</p>{{end}}
|
||||
</div>
|
||||
{{if .Principal.User.Role.AtLeast "operator"}}
|
||||
<div class="card">
|
||||
<h2>New conversation</h2>
|
||||
<form method="post" action="/minds/{{$m.Slug}}/conversations" class="stack">
|
||||
<input type="hidden" name="_csrf" value="{{.CSRF}}">
|
||||
<label>Person <input name="person" value="{{.Principal.User.Username}}"></label>
|
||||
<label>Project <input name="project" placeholder="optional"></label>
|
||||
<label>Title <input name="title" placeholder="optional; taken from the first message"></label>
|
||||
<button class="btn btn-primary" type="submit">Start</button>
|
||||
</form>
|
||||
</div>
|
||||
{{end}}
|
||||
</section>
|
||||
{{end}}
|
||||
@@ -3,6 +3,6 @@
|
||||
<a href="/minds/{{$m.Slug}}" {{if eq $a "overview"}}aria-current="page"{{end}}>Overview</a>
|
||||
<a href="/minds/{{$m.Slug}}/thoughts" {{if eq $a "thoughts"}}aria-current="page"{{end}}>Thoughts</a>
|
||||
<a href="/minds/{{$m.Slug}}/personality" {{if eq $a "personality"}}aria-current="page"{{end}}>Personality</a>
|
||||
<a href="/minds/{{$m.Slug}}/workspace" {{if eq $a "workspace"}}aria-current="page"{{end}}>Workspace</a><a href="/minds/{{$m.Slug}}/memory" {{if eq $a "memory"}}aria-current="page"{{end}}>Memory</a><a href="/minds/{{$m.Slug}}/beliefs" {{if eq $a "beliefs"}}aria-current="page"{{end}}>Beliefs</a><a class="disabled" title="Phase 8">Conversation</a>
|
||||
<a href="/minds/{{$m.Slug}}/workspace" {{if eq $a "workspace"}}aria-current="page"{{end}}>Workspace</a><a href="/minds/{{$m.Slug}}/memory" {{if eq $a "memory"}}aria-current="page"{{end}}>Memory</a><a href="/minds/{{$m.Slug}}/beliefs" {{if eq $a "beliefs"}}aria-current="page"{{end}}>Beliefs</a><a href="/minds/{{$m.Slug}}/conversations" {{if eq $a "conversation"}}aria-current="page"{{end}}>Conversation</a>
|
||||
</nav>
|
||||
{{end}}
|
||||
|
||||
Reference in New Issue
Block a user