fix(web-search-card): follow base rename kind->shape and view-drops-content

The base (feat/search-presenter) renamed the search result view's discriminant
from `kind` to `shape` and removed the view's `content` field (a UI without a
card now falls back to the raw tool/result content). Adapt the web consumer:

- searchCardModel switches on `result.shape`; SearchBlock's own `kind` prop is
  mapped from it.
- The truncation recovery footer reads the block's raw `content` (where the
  `Full … stored at …` locator now lives) instead of the removed view content.
- Fixture grep/glob views use `shape` and drop `content`; the recovery footer
  rides the raw tool/result text.
- Tests and the bilingual Agent Note follow the rename and the recovery source.
This commit is contained in:
Chinesezjc
2026-07-30 22:49:41 +08:00
parent 53b054f539
commit 4a4ec6fd4d
6 changed files with 83 additions and 81 deletions

View File

@@ -435,20 +435,16 @@ function presentResult(name: string, argsRaw: string, resultText: string): ToolR
const call = presentCall(name, argsRaw)
if (call === undefined) return undefined
// Search is result-time only: the call stays a generic search card, and the
// result view carries the structured shape the card renders, with the
// model-facing text as `content` for a UI without a search card. `total`
// exceeds the retained count so the card shows its capped indicator.
// result view carries the structured shape the card renders. The view holds no
// result text — a UI without a search card falls back to the raw tool/result
// content — so the truncation recovery footer rides that raw content (the
// `toolTurn` message text), not the view. `total` exceeds the retained count so
// the card shows its capped indicator.
if (name === 'grep') {
return {
card: 'search', kind: 'matches', files: SEARCH_MATCHES_FIXTURE,
truncated: true, total: 42, content: text(resultText),
}
return { card: 'search', shape: 'matches', files: SEARCH_MATCHES_FIXTURE, truncated: true, total: 42 }
}
if (name === 'glob') {
return {
card: 'search', kind: 'paths', paths: SEARCH_PATHS_FIXTURE,
truncated: true, total: 23, content: text(resultText),
}
return { card: 'search', shape: 'paths', paths: SEARCH_PATHS_FIXTURE, truncated: true, total: 23 }
}
switch (call.card) {
case 'terminal':