From a1266252a0f57ad913ab7df618166fa85be2b073 Mon Sep 17 00:00:00 2001 From: taekchef Date: Fri, 18 Sep 2026 09:56:19 +0800 Subject: [PATCH] docs: document the opt-in fenceFeedback config (#160) The fence auto-repair steer shipped with the #160 work but was never mentioned in either README, so the only discoverability was the source. --- README.md | 1 + README.zh-CN.md | 1 + 2 files changed, 2 insertions(+) diff --git a/README.md b/README.md index 503e397a..0d4ba9f1 100644 --- a/README.md +++ b/README.md @@ -169,6 +169,7 @@ The following is the detailed capability reference. Every behavior is constraine - **Event loop**: buttons/switches/inputs/dropdowns/checkboxes/radios/textareas/quizzes carry `action`; click or blur sends back to the model, which updates the UI; same-name actions are debounced with a 300 ms trailing edge — rapid clicks merge into one (last value wins) - **Tool channel**: the `render_ui` tool renders the same spec as a card in the tool row (deliverable-style UI goes through the tool, answer-style UI through the fence) - **Session panel**: a persistent dock above the composer; `render_ui` / `panel: true` fences update the same surface in place; `/panel` opens it from the client (`/panel ` customizes via the model, `/panel clear` clears); the top border is draggable to resize; `append: true` merges incrementally — same-named tabs append content, new tabs get added; the whole panel caps at 200 nodes / 200 appends, after which the model should send `replace` to rebuild +- **Fence auto-repair (opt-in)**: set `fenceFeedback: true` in this plugin's config (under the plugin entry's `config:` in your profile's cordis.patch.yml) — when a reply's dsh-ui fence fails to render, the plugin steers the SAME turn with the per-node diagnosis so the model can resend a fixed fence; at most one correction per turn and per fence, never in subagents, so it cannot loop. Off by default: retries spend model steps, which is the operator's call. - **Self-healing & limits**: every fence passes a spec guard — bad nodes are silently dropped (the surviving siblings keep rendering: one bad component no longer degrades the whole fence), numbers clamped, strings truncated; the whole tree is capped at 200 nodes / 8 nesting levels; pathological specs never crash the UI - **Canonical component protocol**: native field aliases such as `card.label` → `title`, `table.data`/`table.items` → `rows`, `callout.kind`/`callout.desc` → `tone`/`content` (tone value `danger` → `error`), `steps.items` → `steps`, `keyvalue.items` → `pairs` (record `label` → `key`), and `file-tree.nodes` → `items` (record `label` → `name`, `type` defaults to `dir` when children exist) are normalized deterministically before validation and rendering. A root-level component array is adopted as `items`, and a double-encoded JSON string is decoded once. `validate_dsh_ui` reports these normalizations and warns about unknown native fields without blocking custom renderer nodes. - **Chart error self-healing**: mermaid failures auto-retry with repairs (strip backticks, quote Chinese/space labels, remove `
`) before degrading to source; a broken chart never hits the screen diff --git a/README.zh-CN.md b/README.zh-CN.md index 75ce6cb9..cde4bc06 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -169,6 +169,7 @@ dsh plugin --profile web add link:$PWD - **事件循环**:按钮/开关/输入/下拉/复选/单选/文本域/测验带 `action`,点击/失焦回传模型,模型更新界面;同名 action 300ms 尾沿防抖,连点合并为一次(最后一次的值生效) - **工具通道**:`render_ui` 工具把同一份 spec 渲染成工具行卡片(交付物型 UI 走工具、回答型 UI 走围栏) - **会话面板**:composer 上方常驻 dock,`render_ui` / `panel: true` 围栏原地更新同一块界面;`/panel` 命令客户端直开(`/panel <指令>` 转模型定制、`/panel clear` 清空);顶边框可拖拽调高;`append: true` 增量合并——同名标签页追加内容、新标签页新增;整面板默认最多 200 节点 / 200 条追加,达到上限后模型应发送 `replace` 重建 +- **围栏自修(可选)**:插件配置 `fenceFeedback: true` 开启(profile 的 cordis.patch.yml 中本插件条目的 `config:` 下)——回答里有 dsh-ui 围栏没渲染成时,插件借宿主的轮内转向(steer)把逐节点诊断送回**同一轮**,模型重发修好的围栏;每轮至多一次、每个围栏至多一次、子代理不触发,不会循环。默认关闭:重试要花模型步数,由部署者决定。 - **自愈与上限**:每个围栏过规格守卫——坏节点静默丢弃(同围栏其余组件照常渲染,单个坏组件不再拖垮整条围栏)、数值钳位、字符串截断,整树 ≤200 节点 / 8 层嵌套,病态 spec 不会拖垮界面 - **统一组件协议**:`card.label` → `title`、`table.data`/`table.items` → `rows`、`callout.kind`/`callout.desc` → `tone`/`content`(tone 值 `danger` → `error`)、`steps.items` → `steps`、`keyvalue.items` → `pairs`(记录内 `label` → `key`)、`file-tree.nodes` → `items`(记录内 `label` → `name`、有 children 时缺省 `dir`)等原生字段别名会在校验和渲染前确定性归一化;根级组件数组视为 `items`、双重编码的 JSON 字符串解一层;`validate_dsh_ui` 会报告归一化结果,并对原生组件未知字段给出警告,同时保持自定义 renderer 节点的透明兼容。 - **图错误自愈**:mermaid 渲染失败自动修复重试(剥反引号、引号化中文/空格标签、去 `
`),仍失败才降级源码;错误图永不直接上屏