feat(parser): render OpenCode task as Agent cards with nested tool calls
Transform OpenCode "task" tool calls with subagent_type into unified Agent card display: rewrite as "Agent" tool with subagent_type, prompt, description, and model; compute duration from time fields; query sub-agent session parts from SQLite for nested tool call lists; extract <task_result> content to strip preamble noise from agent output; guard Streamdown code plugin against unsupported Shiki language identifiers (e.g. "##", "function") in fenced code blocks from tool output.
This commit is contained in:
@@ -327,7 +327,22 @@ export const MessageBranchPage = ({
|
||||
export type MessageResponseProps = ComponentProps<typeof Streamdown>
|
||||
|
||||
const math = createMathPlugin({ singleDollarTextMath: true })
|
||||
const streamdownPlugins = { cjk, code, math, mermaid }
|
||||
|
||||
// Wrap the code plugin to guard against unsupported language identifiers
|
||||
// (e.g. "##", "function") that appear in fenced code blocks from tool output.
|
||||
// Without this, Shiki's createHighlighter tries to load unknown grammars and
|
||||
// produces noisy console errors.
|
||||
const safeCode: typeof code = {
|
||||
...code,
|
||||
highlight(options, callback) {
|
||||
const lang = code.supportsLanguage(options.language)
|
||||
? options.language
|
||||
: ("text" as typeof options.language)
|
||||
return code.highlight({ ...options, language: lang }, callback)
|
||||
},
|
||||
}
|
||||
|
||||
const streamdownPlugins = { cjk, code: safeCode, math, mermaid }
|
||||
|
||||
// remark-math only supports `$` delimiters. Convert LaTeX-style
|
||||
// `\[...\]` / `\(...\)` to `$$...$$` / `$...$` so they are recognized.
|
||||
|
||||
Reference in New Issue
Block a user