Tool Call Card Alignment
Nucleic-Session: FFDE42E0-22AB-4478-B2E2-FF69B2753CEE Co-authored-by: Nucleic <[email protected]>
This commit is contained in:
@@ -64,6 +64,28 @@ struct TranscriptRow: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private func modelLabel(_ model: String) -> String { model.isEmpty ? "agent" : model }
|
private func modelLabel(_ model: String) -> String { model.isEmpty ? "agent" : model }
|
||||||
|
|
||||||
|
/// The pretty card for a *completed* AskUserQuestion whose result records the user's choices,
|
||||||
|
/// or nil when this isn't that (wrong tool, still pending, errored, or an unexpected result
|
||||||
|
/// shape) — in which case the row falls back to a normal tool card. Mirrors the Mac's
|
||||||
|
/// `answeredQuestionCard`.
|
||||||
|
private func answeredQuestionCard(_ group: ToolGroup) -> AskUserQuestionResultCard? {
|
||||||
|
guard group.isAskUserQuestion, !group.isError, let result = group.result,
|
||||||
|
let questions = AskUserQuestion.questions(from: group.input) else { return nil }
|
||||||
|
let answers = AskUserQuestion.answers(in: result.resultText, for: questions)
|
||||||
|
guard !answers.isEmpty else { return nil }
|
||||||
|
return AskUserQuestionResultCard(questions: questions, answers: answers)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// A git-commit `Bash` pipeline rendered as the structured commit card the Mac shows at the row
|
||||||
|
/// level (subject + Markdown body + the new hash + "Show command"), or nil for any non-commit
|
||||||
|
/// call — which keeps the normal collapsible tool card. Mirrors the Mac's `gitCommitCard`.
|
||||||
|
private func gitCommitRowCard(_ group: ToolGroup) -> GitCommitCard? {
|
||||||
|
guard let command = group.bashCommand, let commit = GitCommitSummary.parse(command)
|
||||||
|
else { return nil }
|
||||||
|
let output = group.result.map(\.resultText).flatMap { $0.isEmpty ? nil : $0 }
|
||||||
|
return GitCommitCard(commit: commit, rawCommand: command, output: output)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Render an assistant/user message with the full Markdown renderer the Mac transcript uses
|
/// Render an assistant/user message with the full Markdown renderer the Mac transcript uses
|
||||||
|
|||||||
Reference in New Issue
Block a user