Add CodeNomad-inspired tool rendering system

Phase 1 of enhancement plan:
- Created tool-renderers.js with 13+ specialized tool renderers
- Created tool-rendering.css for context-specific tool styling
- Integrated into index.html with cache bust (v1769083100000)

Supported tools:
- bash, edit, write, read (file operations)
- websearch, webfetch (web operations)
- task, todowrite (agent operations)
- grep, glob, list, patch (utilities)

Each tool gets specialized rendering showing the most relevant
information in a user-friendly format.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
uroma
2026-01-22 11:58:39 +00:00
Unverified
parent eb0f95ac9e
commit 7cd97ce8d3
3 changed files with 1173 additions and 1 deletions

View File

@@ -0,0 +1,602 @@
/**
* Tool Call Rendering Styles
* Inspired by CodeNomad's tool rendering
* https://github.com/NeuralNomadsAI/CodeNomad
*/
/* ============================================================
Tool Call Container
============================================================ */
.tool-call {
border: 1px solid #333;
border-radius: 8px;
margin: 8px 0;
overflow: hidden;
background: #1a1a1a;
transition: border-color 0.2s ease;
}
/* Status-specific border colors */
.tool-call.tool-status-pending {
border-left: 3px solid #ffa500;
}
.tool-call.tool-status-running {
border-left: 3px solid #4a9eff;
}
.tool-call.tool-status-completed {
border-left: 3px solid #51cf66;
}
.tool-call.tool-status-error {
border-left: 3px solid #ff6b6b;
}
/* ============================================================
Tool Header (Toggle Button)
============================================================ */
.tool-header {
width: 100%;
display: flex;
align-items: center;
gap: 8px;
padding: 10px 12px;
background: #222;
border: none;
cursor: pointer;
color: #e0e0e0;
transition: background 0.2s ease;
}
.tool-header:hover {
background: #2a2a2a;
}
.tool-expand {
font-size: 10px;
transition: transform 0.2s ease;
min-width: 12px;
text-align: center;
}
.tool-icon {
font-size: 16px;
line-height: 1;
}
.tool-action {
flex: 1;
text-align: left;
font-size: 13px;
font-weight: 500;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.tool-status {
font-size: 14px;
line-height: 1;
}
/* ============================================================
Tool Body Content
============================================================ */
.tool-body {
padding: 12px;
border-top: 1px solid #333;
background: #1a1a1a;
font-size: 13px;
line-height: 1.5;
max-height: 400px;
overflow-y: auto;
}
/* Scrollbar styling */
.tool-body::-webkit-scrollbar {
width: 8px;
}
.tool-body::-webkit-scrollbar-track {
background: #1a1a1a;
}
.tool-body::-webkit-scrollbar-thumb {
background: #444;
border-radius: 4px;
}
.tool-body::-webkit-scrollbar-thumb:hover {
background: #555;
}
/* ============================================================
Bash Tool
============================================================ */
.tool-bash {
font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}
.bash-command {
color: #51cf66;
margin-bottom: 8px;
font-weight: 500;
}
.bash-output {
color: #e0e0e0;
white-space: pre-wrap;
word-break: break-all;
margin-bottom: 8px;
}
.bash-exit {
color: #888;
font-size: 12px;
padding-top: 4px;
border-top: 1px solid #333;
}
/* ============================================================
Edit Tool
============================================================ */
.tool-edit {
font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}
.edit-file {
color: #4a9eff;
margin-bottom: 8px;
font-weight: 500;
}
.edit-stats {
color: #888;
font-size: 12px;
margin-bottom: 8px;
}
.edit-diff {
font-size: 12px;
line-height: 1.4;
}
/* Diff rendering */
.diff-line {
padding: 2px 4px;
white-space: pre-wrap;
word-break: break-all;
}
.diff-add {
background: rgba(81, 207, 102, 0.15);
color: #51cf66;
}
.diff-remove {
background: rgba(255, 107, 107, 0.15);
color: #ff6b6b;
}
.diff-hunk {
color: #888;
background: rgba(136, 136, 136, 0.1);
}
/* ============================================================
Write Tool
============================================================ */
.tool-write {
font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}
.write-file {
color: #a78bfa;
margin-bottom: 8px;
font-weight: 500;
}
.write-stats {
color: #888;
font-size: 12px;
margin-bottom: 8px;
}
.write-preview {
margin-top: 8px;
padding: 8px;
background: #222;
border-radius: 4px;
font-size: 12px;
}
.write-preview pre {
margin: 0;
white-space: pre-wrap;
word-break: break-all;
}
/* ============================================================
Read Tool
============================================================ */
.tool-read {
font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}
.read-file {
color: #4a9eff;
margin-bottom: 8px;
font-weight: 500;
}
.read-preview {
margin-top: 8px;
padding: 8px;
background: #222;
border-radius: 4px;
font-size: 12px;
}
.read-preview pre {
margin: 0;
white-space: pre-wrap;
word-break: break-all;
}
.read-stats {
color: #888;
font-size: 12px;
margin-top: 4px;
}
/* ============================================================
Search Results (WebSearch, Grep)
============================================================ */
.tool-search-results,
.tool-grep-results {
display: flex;
flex-direction: column;
gap: 8px;
}
.search-result,
.grep-match {
padding: 8px;
background: #222;
border-radius: 4px;
}
.search-result a {
color: #4a9eff;
text-decoration: none;
font-weight: 500;
}
.search-result a:hover {
text-decoration: underline;
}
.result-snippet {
color: #888;
font-size: 12px;
margin-top: 4px;
}
.grep-file {
color: #4a9eff;
font-size: 12px;
font-weight: 500;
}
.grep-line {
color: #e0e0e0;
font-size: 12px;
margin-top: 2px;
font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}
.grep-stats {
color: #888;
font-size: 12px;
text-align: center;
padding: 4px;
}
/* ============================================================
WebFetch Tool
============================================================ */
.tool-fetch {
font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}
.fetch-url {
margin-bottom: 8px;
}
.fetch-url a {
color: #4a9eff;
text-decoration: none;
word-break: break-all;
}
.fetch-url a:hover {
text-decoration: underline;
}
.fetch-preview {
margin-top: 8px;
padding: 8px;
background: #222;
border-radius: 4px;
font-size: 12px;
}
.fetch-preview pre {
margin: 0;
white-space: pre-wrap;
word-break: break-all;
}
.fetch-stats {
color: #888;
font-size: 12px;
margin-top: 4px;
}
/* ============================================================
Task/Agent Delegation
============================================================ */
.tool-task-summary {
display: flex;
flex-direction: column;
gap: 6px;
}
.task-item {
display: flex;
align-items: center;
gap: 8px;
padding: 6px 8px;
background: #222;
border-radius: 4px;
font-size: 12px;
}
.task-icon {
font-size: 14px;
}
.task-desc {
color: #e0e0e0;
}
.tool-task-result {
font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
font-size: 12px;
}
.tool-task-result pre {
white-space: pre-wrap;
word-break: break-all;
}
/* ============================================================
Todo/Plan Tool
============================================================ */
.tool-todos {
display: flex;
flex-direction: column;
gap: 6px;
}
.todo-item {
display: flex;
align-items: flex-start;
gap: 8px;
padding: 6px 8px;
background: #222;
border-radius: 4px;
font-size: 13px;
}
.todo-checkbox {
font-size: 14px;
line-height: 1.4;
}
.todo-text {
flex: 1;
word-break: break-word;
}
/* Todo states */
.todo-completed .todo-text {
text-decoration: line-through;
color: #888;
}
.todo-in_progress .todo-text {
color: #4a9eff;
font-weight: 500;
}
/* ============================================================
Glob Tool
============================================================ */
.tool-glob-results {
font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}
.glob-stats {
color: #888;
font-size: 12px;
margin-bottom: 8px;
}
.glob-files {
display: flex;
flex-direction: column;
gap: 4px;
}
.glob-file {
color: #e0e0e0;
font-size: 12px;
padding: 4px 8px;
background: #222;
border-radius: 4px;
}
.glob-more {
color: #888;
font-size: 12px;
text-align: center;
padding: 8px;
}
/* ============================================================
List Tool
============================================================ */
.tool-list-results {
display: flex;
flex-direction: column;
gap: 4px;
}
.list-entry {
display: flex;
align-items: center;
gap: 8px;
padding: 6px 8px;
background: #222;
border-radius: 4px;
font-size: 13px;
}
.entry-icon {
font-size: 14px;
}
.entry-name {
color: #e0e0e0;
}
.list-more {
color: #888;
font-size: 12px;
text-align: center;
padding: 8px;
}
/* ============================================================
Patch Tool
============================================================ */
.tool-patch {
text-align: center;
padding: 12px;
}
.patch-applied {
color: #51cf66;
font-weight: 500;
}
/* ============================================================
Default Tool
============================================================ */
.tool-default {
font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}
.tool-default pre {
margin: 0;
white-space: pre-wrap;
word-break: break-all;
font-size: 12px;
}
/* ============================================================
Empty State
============================================================ */
.tool-empty {
color: #888;
font-style: italic;
text-align: center;
padding: 12px;
}
/* ============================================================
Responsive Design
============================================================ */
@media (max-width: 768px) {
.tool-header {
padding: 8px 10px;
}
.tool-action {
font-size: 12px;
}
.tool-body {
padding: 10px;
font-size: 12px;
}
.bash-command,
.edit-file,
.write-file,
.read-file {
font-size: 12px;
}
}
/* ============================================================
Animations
============================================================ */
@keyframes toolExpand {
from {
opacity: 0;
transform: translateY(-4px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.tool-body {
animation: toolExpand 0.15s ease-out;
}
/* Status pulse for running tools */
@keyframes statusPulse {
0%, 100% {
opacity: 1;
}
50% {
opacity: 0.6;
}
}
.tool-status-running .tool-status {
animation: statusPulse 1.5s ease-in-out infinite;
}