mini: fix shell tool output display (#37711)
This commit is contained in:
parent
cbcf191fdb
commit
cf6e5b3604
4 changed files with 29 additions and 10 deletions
|
|
@ -2,7 +2,7 @@ import { describe, expect, test } from "bun:test"
|
|||
import { InstallationVersion } from "@opencode-ai/core/installation/version"
|
||||
import path from "node:path"
|
||||
import { mergeInteractiveInput, mergeNonInteractiveInput, parseRunModel, pickRunModel } from "../src/mini"
|
||||
import { toolInlineInfo, toolView } from "../src/mini/tool"
|
||||
import { toolInlineInfo, toolOutputText, toolView } from "../src/mini/tool"
|
||||
|
||||
async function cli(args: string[]) {
|
||||
const child = Bun.spawn([process.execPath, "run", "src/index.ts", ...args], {
|
||||
|
|
@ -36,6 +36,24 @@ describe("mini command", () => {
|
|||
expect(toolInlineInfo(part)).toMatchObject({ icon: "$", title: "pwd", mode: "block" })
|
||||
})
|
||||
|
||||
test("uses non-empty V2 shell output without the model-facing status", () => {
|
||||
expect(
|
||||
toolOutputText("shell", [
|
||||
{ type: "text", text: "mini-output\n" },
|
||||
{ type: "text", text: "Command exited with code 0." },
|
||||
]),
|
||||
).toBe("mini-output\n")
|
||||
})
|
||||
|
||||
test("keeps empty V2 shell output empty", () => {
|
||||
expect(
|
||||
toolOutputText("shell", [
|
||||
{ type: "text", text: "" },
|
||||
{ type: "text", text: "Command exited with code 0." },
|
||||
]),
|
||||
).toBe("")
|
||||
})
|
||||
|
||||
test("uses piped stdin as the initial prompt", () => {
|
||||
expect(mergeInteractiveInput("from stdin", undefined)).toBe("from stdin")
|
||||
expect(mergeInteractiveInput("from stdin", "from flag")).toBe("from stdin\nfrom flag")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue