docs(channels): update README with route queue pattern and ack lifecycle

Document the new channel system design: FIFO pendingRoutes queue,
activeRoute/activeAcks state, agent_start/agent_end lifecycle,
InboundDebouncer, typing/reaction lifecycle, and UI metadata stripping.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Naiyuan Qing 2026-02-09 17:38:56 +08:00
parent ec67dd6706
commit c27f4e66b5
2 changed files with 148 additions and 26 deletions

View file

@ -22,7 +22,16 @@ function getThinkingText(blocks: ContentBlock[]): string {
.join("")
}
/** Strip LLM-facing metadata prefixes from user messages for clean display */
/**
* Strip LLM-facing metadata prefixes from user messages for clean display.
*
* TODO: This is a short-term workaround. The root cause is that agent.write()
* bakes timestamp and media-type prefixes into the message content, and
* session JSONL stores the enriched string as-is. The proper fix is to
* separate "displayContent" from "llmContent" at the storage layer so the
* UI never sees LLM context prefixes. This regex approach is fragile
* any change to timestamp format, locale, or new media types will break it.
*/
function stripUserMetadata(text: string): string {
// Strip timestamp envelope: [Mon 2026-02-09 14:38 GMT+8]
let cleaned = text.replace(/^\[(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun)\s+\d{4}-\d{2}-\d{2}\s+\d{2}:\d{2}[^\]]*\]\s*/, "")