Fix stale default-open doc comments per argus's review
ClassifyCtx's tool_use-id correlation gates markdown-vs-plain body format for a recv result, not open/collapsed state — that's always the operator's uniform preference now. 5 backend comments still described it as controlling "default-open" rendering, contradicting the actual render path and this PR's own rewritten docs. Also fixed useAgentState.ts's stale comment promising an SSE-triggered refresh model "in a later commit" — that's permanently off the table now that the terminal stream's kind tag is gone by design (argus flagged this as a drive-by, not blocking, but it's a one-line cause-and-effect of this same PR so fixing it here).
This commit is contained in:
parent
cebf3c6ced
commit
907567ef76
4 changed files with 32 additions and 29 deletions
|
|
@ -268,9 +268,11 @@ fn classify_assistant_content(content: &[Value], ctx: &mut ClassifyCtx) -> Vec<T
|
|||
}
|
||||
|
||||
/// `_category === 'rich'` tools used to get an expandable row (diff body
|
||||
/// for Edit, default-open markdown for send, plain for everything else with
|
||||
/// a body). That's now just "does this row have a body" — `body.is_some()`
|
||||
/// on the returned [`TermMsg`] *is* the expandable signal, no separate flag.
|
||||
/// for Edit, markdown body for send, plain for everything else with a
|
||||
/// body). That's now just "does this row have a body" — `body.is_some()`
|
||||
/// on the returned [`TermMsg`] *is* the expandable signal, no separate
|
||||
/// flag; whether it renders open or collapsed is a uniform client-side
|
||||
/// preference, not something this function decides.
|
||||
fn classify_tool_use(c: &Value) -> TermMsg {
|
||||
let name = c.get("name").and_then(Value::as_str).unwrap_or("");
|
||||
let input = c.get("input").cloned().unwrap_or_else(|| json!({}));
|
||||
|
|
@ -418,12 +420,16 @@ fn classify_task_event(v: &Value) -> Option<TermMsg> {
|
|||
|
||||
/// Pre-compute the expandable body for rich tool entries.
|
||||
///
|
||||
/// Returns `Some((body, body_type))` where `body_type` tells the frontend
|
||||
/// which renderer to use:
|
||||
/// - `"diff"` → `api.detailsDiff` (colour-coded `+`/`-` lines)
|
||||
/// - `"plain"` → `api.details` (plain `<pre>` block)
|
||||
/// - `"markdown"` → `api.detailsOpenMd` (markdown rendered via marked + `DOMPurify`,
|
||||
/// default-open; used for message-bearing tools: `send`)
|
||||
/// Returns `Some((body, body_type))` where `body_type` becomes the
|
||||
/// `TermMsg`'s `body_format` and tells the frontend which renderer to use:
|
||||
/// - `"diff"` → colour-coded `+`/`-` lines
|
||||
/// - `"plain"` (`None` on the wire) → a plain `<pre>` block
|
||||
/// - `"markdown"` → rendered via `marked` + `DOMPurify`; used for
|
||||
/// message-bearing tools: `send`
|
||||
///
|
||||
/// Whether the resulting row renders open or collapsed is a uniform
|
||||
/// client-side preference (the operator's expand-tool-output setting),
|
||||
/// not something this function or its `body_type` decides.
|
||||
///
|
||||
/// Returns `None` for tools that have no body at all.
|
||||
///
|
||||
|
|
|
|||
Loading…
Reference in a new issue