feat(basic-host): improve host UI with collapsible panels and SDK types (#244)

* refactor(basic-host): use SDK types for ModelContext and AppMessage

- Import McpUiUpdateModelContextRequest and McpUiMessageRequest from SDK
- Replace custom ModelContext with McpUiUpdateModelContextRequest['params']
- Replace custom AppMessage with McpUiMessageRequest['params']
- Pass full message params instead of extracting text
- Format messages by extracting text from content blocks in display

* feat(basic-host): handle non-text content blocks in display

- Add formatContentBlock helper for text, image, audio, resource types
- Show placeholders like <image: image/png> for non-text content
- Apply to both messages and model context display

* test: update shadertoy screenshot

* test: update screenshots from CI (linux x64)
This commit is contained in:
Olivier Chafik 2026-01-12 19:42:11 +00:00 • committed by GitHub
commit 741b1d3925
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -126,6 +126,46 @@
min-width: 0;
}
.appOutputPanel {
flex: 1;
min-width: 0;
}
.appHeader {
display: flex;
align-items: center;
gap: 0.5rem;
margin-bottom: 0.5rem;
font-size: 1.25rem;
font-weight: 600;
position: relative;
.toolName {
font-family: monospace;
}
.closeButton {
position: absolute;
top: 0;
right: 0;
width: 1.5rem;
height: 1.5rem;
padding: 0;
border: none;
border-radius: 4px;
background: #e0e0e0;
font-size: 1.25rem;
line-height: 1;
color: #666;
cursor: pointer;
&:hover {
background: #d0d0d0;
color: #333;
}
}
}
.jsonBlock {
flex-grow: 1;
min-height: 0;
@ -148,6 +188,66 @@
}
}
.collapsiblePanel {
margin: 0.5rem 0;
padding: 0.5rem 0.75rem;
border: 1px solid #e0e0e0;
border-radius: 4px;
background-color: #fafafa;
font-size: 0.875rem;
cursor: pointer;
transition: background-color 0.15s;
&:hover {
background-color: #f0f0f0;
}
}
.collapsibleHeader {
display: flex;
align-items: center;
gap: 0.5rem;
}
.collapsibleLabel {
font-weight: 600;
color: #555;
}
.collapsibleSize {
color: #888;
font-size: 0.75rem;
}
.collapsibleToggle {
margin-left: auto;
color: #888;
font-size: 0.75rem;
}
.collapsiblePreview {
margin-top: 0.25rem;
color: #666;
font-family: monospace;
font-size: 0.8rem;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.collapsibleFull {
margin: 0.5rem 0 0;
padding: 0.5rem;
border-radius: 4px;
background-color: #f5f5f5;
font-family: monospace;
font-size: 0.8rem;
white-space: pre-wrap;
word-break: break-word;
max-height: 200px;
overflow: auto;
}
.error {
padding: 1.5rem;
background-color: #ddd;