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.
32 lines
1.4 KiB
SQL
32 lines
1.4 KiB
SQL
-- Conversations and messages. A user message is also an observation event;
|
|
-- a mind message is also a response_generated event. Rows here are the
|
|
-- conversational view; provenance lives in the events they reference.
|
|
CREATE TABLE conversations (
|
|
id uuid PRIMARY KEY,
|
|
mind_id uuid NOT NULL REFERENCES minds(id),
|
|
title text NOT NULL DEFAULT '',
|
|
channel text NOT NULL DEFAULT 'web',
|
|
person text NOT NULL DEFAULT '',
|
|
project text NOT NULL DEFAULT '',
|
|
context jsonb NOT NULL DEFAULT '{}'::jsonb,
|
|
created_at timestamptz NOT NULL DEFAULT now(),
|
|
last_message_at timestamptz NOT NULL DEFAULT now()
|
|
);
|
|
CREATE INDEX conversations_mind_idx ON conversations (mind_id, last_message_at DESC);
|
|
|
|
CREATE TABLE messages (
|
|
id uuid PRIMARY KEY,
|
|
conversation_id uuid NOT NULL REFERENCES conversations(id),
|
|
mind_id uuid NOT NULL REFERENCES minds(id),
|
|
role text NOT NULL CHECK (role IN ('user','mind','system')),
|
|
actor text NOT NULL DEFAULT '',
|
|
content text NOT NULL,
|
|
event_id uuid,
|
|
reply_to uuid REFERENCES messages(id),
|
|
intent jsonb,
|
|
llm_call_id uuid,
|
|
created_at timestamptz NOT NULL DEFAULT now()
|
|
);
|
|
CREATE INDEX messages_conversation_idx ON messages (conversation_id, created_at);
|
|
CREATE INDEX messages_reply_idx ON messages (reply_to) WHERE reply_to IS NOT NULL;
|