fix: add _toolResultOneLiner to sibling test extractors and pin error-snippet behavior

This commit is contained in:
Rod Boev 2026-06-24 09:23:14 -04:00 committed by nesquena-hermes
parent 29604e5e7b
commit 32d171c1a1
3 changed files with 7 additions and 1 deletions

View file

@ -119,7 +119,7 @@ var _FN_NAMES=[
'_decodeToolLabelEntities','_redactToolTargetLabel','_shortToolLabel','_toolI18n',
'_toolTargetLabel','_toolVisibleTargetLabel','_toolCommandTitle','_toolQueryTitle',
'_toolActionLabelText','_toolArgPreviewValue','_toolArgPreviewKeyIsHidden',
'_formatToolArgPreview','_toolCardPreviewText','_toolCardAllowsDetail',
'_formatToolArgPreview','_toolResultOneLiner','_toolCardPreviewText','_toolCardAllowsDetail',
'_toolDetailLeadLabel','_toolDetailLeadText','_toolShortName','_transparentEventPreview',
'_transparentToolStatus','_transparentToolSummary',
'_isMemorySave','_isSkillUpdate','_tcAction',

View file

@ -197,6 +197,11 @@ class TestToolCardPreviewText:
tc = {"done": True, "preview": "", "snippet": "Found 3 matches", "args": {"path": "src/"}}
assert _preview_text(tc) == "Found 3 matches"
def test_error_with_text_snippet_shows_message(self):
"""Error tool with a plain-text snippet shows the error message, not 'Failed'."""
tc = {"done": True, "is_error": True, "preview": "", "snippet": "Permission denied", "args": {}}
assert _preview_text(tc) == "Permission denied"
def test_snippet_json_suppressed(self):
"""Cold-loaded tool with JSON in snippet falls through to args."""
tc = {"done": True, "preview": "", "snippet": '{"key":"val"}', "args": {"path": "src/"}}

View file

@ -38,6 +38,7 @@ function extractFunc(name) {
eval(extractFunc('_toolArgPreviewValue'));
eval(extractFunc('_toolArgPreviewKeyIsHidden'));
eval(extractFunc('_formatToolArgPreview'));
eval(extractFunc('_toolResultOneLiner'));
eval(extractFunc('_toolCardPreviewText'));
let buf = '';
process.stdin.on('data', c => { buf += c; });