docs(graphs): verify mermaid syntax

This commit is contained in:
Tianyi Cui
2026-07-03 01:32:01 +08:00
parent 665c10ff19
commit 8caf923196
9 changed files with 1328 additions and 64 deletions

View File

@@ -11,31 +11,31 @@ This sequence is the visual companion to [architecture.md](../architecture.md#lo
sequenceDiagram
participant User
participant Agent
participant Loop
participant Driver
participant Prompt as ctx.systemPrompt
participant LLM as ctx.llm
participant Tools as ctx.tools
participant Session
participant Persistence
User->>Agent: send(content)
Agent->>Loop: queued work wakes driver
Loop->>Session: turn/start + user/message
Loop-->>User: agent/turn-start
Loop->>Prompt: system-prompt/assemble waterfall
Loop-->>Loop: agent/pre-step serial checkpoint
Loop->>Session: step/start
Loop->>LLM: agent/request waterfall, then llm/stream waterfall
LLM-->>Loop: StreamChunk*
Loop->>Session: assistant/chunk*
Loop-->>User: agent/stream-chunk* (master live mirror)
Loop->>Session: assistant/message
Loop->>Tools: tools/execute waterfall for each tool-call
Agent->>Driver: queued work wakes driver
Driver->>Session: turn/start + user/message
Driver-->>User: agent/turn-start
Driver->>Prompt: system-prompt/assemble waterfall
Driver-->>Driver: agent/pre-step serial checkpoint
Driver->>Session: step/start
Driver->>LLM: agent/request waterfall, then llm/stream waterfall
LLM-->>Driver: StreamChunk*
Driver->>Session: assistant/chunk*
Driver-->>User: agent/stream-chunk* (master live mirror)
Driver->>Session: assistant/message
Driver->>Tools: tools/execute waterfall for each tool-call
Tools-->>Session: tool-owned events when applicable
Loop->>Session: tool/result
Loop-->>Loop: agent/turn-continuation waterfall
Loop->>Session: turn/end
Loop->>Persistence: session/flush parallel checkpoint
Loop-->>User: agent/status idle
Driver->>Session: tool/result
Driver-->>Driver: agent/turn-continuation waterfall
Driver->>Session: turn/end
Driver->>Persistence: session/flush parallel checkpoint
Driver-->>User: agent/status idle
```
Future pressure from the hooks stack: PR #129 removes the live `agent/stream-chunk` mirror and leaves durable `assistant/chunk` on `session/event` as the authoritative token stream. Consumers that need replayable transcript data should already treat `session/event` as the load-bearing path.

View File

@@ -10,21 +10,21 @@ This graph shows where policy, hooks, sandboxing, and future filesystem guards f
```mermaid
flowchart TD
model["Assistant message contains tool-call block"]
call["Session event: tool/call"]
toolCall["Session event: tool/call"]
waterfall["ctx.tools.execute()<br/>tools/execute waterfall"]
policy["Policy / permission / hooks listener"]
body["Registered tool execute() body"]
toolBody["Registered tool execute() body"]
owned["Tool-owned session events<br/>todo/write, future fs policy facts"]
result["Session event: tool/result"]
toolResult["Session event: tool/result"]
ui["UI presentation<br/>presentCall / presentResult"]
model --> call --> waterfall
model --> toolCall --> waterfall
waterfall --> policy
policy -->|next()| body
policy -->|veto / throw| result
body --> owned
body --> result
call --> ui
result --> ui
policy -->|next| toolBody
policy -->|veto / throw| toolResult
toolBody --> owned
toolBody --> toolResult
toolCall --> ui
toolResult --> ui
```
Future pressure from the fs stack: PR #128 snapshots a policy rejection card. The graph keeps the veto path explicit because filesystem read-before-edit checks, permission prompts, and hook bridges all belong on this path.