feat(core): compact durable tool metadata (#38343)
This commit is contained in:
parent
b91dd78ab3
commit
7a1f9764a2
14 changed files with 169 additions and 14 deletions
|
|
@ -2669,8 +2669,7 @@ function WebFetch(props: ToolProps) {
|
|||
function WebSearch(props: ToolProps) {
|
||||
return (
|
||||
<InlineTool icon="◈" pending="Searching web..." complete={stringValue(props.input.query)} part={props.part}>
|
||||
{webSearchProviderLabel(props.metadata.provider)} "{stringValue(props.input.query)}"{" "}
|
||||
<Show when={finiteNumber(props.metadata.numResults)}>({finiteNumber(props.metadata.numResults)} results)</Show>
|
||||
{webSearchProviderLabel(props.metadata.provider)} "{stringValue(props.input.query)}"
|
||||
</InlineTool>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import { describe, expect, test } from "bun:test"
|
||||
import { normalizeTool, toolInlineInfo, toolOutputText, toolPath, toolScroll } from "../../src/mini/tool"
|
||||
import { canonicalToolPart } from "./fixture/tool-part"
|
||||
|
||||
describe("Mini tool presentation", () => {
|
||||
test("uses V2 shell output without the model-facing status", () => {
|
||||
|
|
@ -105,6 +106,29 @@ describe("Mini tool presentation", () => {
|
|||
).toBe('→ Skill "effect"')
|
||||
})
|
||||
|
||||
test("renders compact search metadata", () => {
|
||||
expect(
|
||||
toolInlineInfo(
|
||||
canonicalToolPart("glob", {
|
||||
status: "completed",
|
||||
input: { pattern: "*.ts" },
|
||||
structured: { count: 3 },
|
||||
content: [],
|
||||
}),
|
||||
).description,
|
||||
).toBe("3 matches")
|
||||
expect(
|
||||
toolInlineInfo(
|
||||
canonicalToolPart("grep", {
|
||||
status: "completed",
|
||||
input: { pattern: "needle" },
|
||||
structured: { matches: 1 },
|
||||
content: [],
|
||||
}),
|
||||
).description,
|
||||
).toBe("1 match")
|
||||
})
|
||||
|
||||
test("keeps segment-safe contained tool paths relative", () => {
|
||||
expect(toolPath("..cache/result.txt", { directory: "/work/project" })).toBe("..cache/result.txt")
|
||||
expect(toolPath("../shared/result.txt", { directory: "/work/project" })).toBe("/work/shared/result.txt")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue