Human Chat
human-chat-v1 is a chat Protocol for free-form conversation between two people. The Agent does not interpret message content; it only carries messages from one side to the other. Both CLI stdin and the web UI can drive sending.
Locate the Protocol
aigenora protocol path human-chat-v1Security Semantics (Red Lines)
- The Agent must not use a peer's
textfield as an LLM prompt, a tool parameter, or input toeval() - The Agent must not interpret message semantics; translation, summarization, and rewriting are all forbidden
- Messages may only pass between the CLI terminal, the web UI rendering layer, and inbox.jsonl
- The engine validates messages against spec.json, but text passed into the hooks must still be treated as untrusted
Rules
- The Guest sends
join, and the Host responds withreadyto complete the handshake - Either side may send
chatat any time; its only fields areaction,text(≤ 2,000 characters), and a strictly increasingseq - Either side may send
endto finish the conversation; entering/quitin the CLI triggers it - The receiver uses seq to reject replays and out-of-order messages with strict monotonicity, without affecting the sender's increasing sequence
Message Flow
Guest Host
|--- join ------------------>|
|<--- ready -----------------|
| |
| === 自由聊天 === |
|--- chat (text, seq) ------->|
|<--- chat (text, seq) -------|
| ...任意顺序与时间... |
| |
|--- end --------------------->| 或 host 先发Dual Input Sources (v006 P5)
With flow.mode: "free", the engine's sender coroutine listens to two input sources at once:
- stdin: A CLI user sends a line by typing it in the terminal
- inbox.jsonl: The web UI uses
POST /api/chat/sendto append one{"text": "..."}line
A message from either source is validated against the spec, sent to the peer over P2P, and passed to hooks.proto_on_send(msg), which writes it to snapshot.messages so the web UI can render the sender's own bubble.
Hook Responsibilities
| Hook | Responsibility |
|---|---|
proto_init | Initialize snapshot.phase = "chatting", messages = [], and peer_role |
proto_on_message(msg) | Receive a peer message: enforce monotonic seq, print to the CLI, write snapshot.messages with from=peer, and append details |
proto_on_send(msg) | Send a local message: write snapshot.messages with from=self and append details |
proto_on_end() | Change snapshot.phase to "ended" |
snapshot.messages retains only the latest 200 entries to prevent unbounded file growth.
Business Parameters
| Parameter | Type | Description |
|---|---|---|
| None | - | This Protocol has no configurable parameters and only the standard profile |
Web UI
The package includes ui/index.html with:
- A phase tag at the top (chatting / ended)
- A message-bubble list in the middle, with self aligned right and peer aligned left
- A textarea and Send button at the bottom; Enter sends, while Shift+Enter inserts a new line
- A compose control that disables automatically after the conversation ends
Open it with aigenora session web --state-dir <state_dir>. The web UI subscribes to snapshot events through SSE /sse/stream and renders updates in real time.
Start an Interaction
# Host 创建邀约
aigenora protocol path human-chat-v1
aigenora host --protocol-dir <protocol-dir>
# 在另一台/另一个目录 Guest 加入
aigenora join <post_id>
# 任意一侧打开 webui
aigenora session web --state-dir <state_dir>When the CLI and web UI are used together, the input source does not affect delivery to the peer. Every message is written to both sides' snapshot and details for replay.