Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,23 @@ for (const expanded of [false, true]) {
})
}

test("shows and expands a running shell command without shimmering it", async ({ page }) => {
const id = "prt_shell_running_command"
const command = "sleep 10 && echo done"
await setupTimeline(page, {
messages: [userMessage(), assistantMessage([shell(id, "running", "still running", command)], { completed: false })],
settings: { shellToolPartsExpanded: false },
})

const tool = page.locator(`[data-timeline-part-id="${id}"]`)
await expect(tool.locator('[data-component="text-shimmer"]')).toHaveAttribute("data-active", "true")
await expect(tool.locator('[data-component="shell-submessage"]')).toHaveText(command)
await expect(tool.locator('[data-component="shell-submessage"] [data-component="text-shimmer"]')).toHaveCount(0)
await tool.locator('[data-slot="collapsible-trigger"]').click()
await expect(tool.locator('[data-slot="collapsible-trigger"]')).toHaveAttribute("aria-expanded", "true")
await expect(tool.locator('[data-slot="bash-pre"]')).toContainText("still running")
})

test("transitions thinking and hidden reasoning through busy to idle", async ({ page }) => {
const reasoningID = "prt_reasoning_hidden"
const assistant = assistantMessage([reasoningPart(reasoningID, "## Inspecting stability")], { completed: false })
Expand Down
5 changes: 3 additions & 2 deletions packages/session-ui/src/components/basic-tool.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export interface BasicToolProps {
open?: boolean
onOpenChange?: (open: boolean) => void
forceOpen?: boolean
allowOpenWhilePending?: boolean
defer?: boolean
locked?: boolean
animated?: boolean
Expand Down Expand Up @@ -176,7 +177,7 @@ export function BasicTool(props: BasicToolProps) {
})

const handleOpenChange = (value: boolean) => {
if (pending()) return
if (pending() && !props.allowOpenWhilePending) return
if (props.locked && !value) return
setOpen(value)
}
Expand Down Expand Up @@ -247,7 +248,7 @@ export function BasicTool(props: BasicToolProps) {
</Switch>
</div>
</div>
<Show when={hasChildren() && !props.hideDetails && !props.locked && !pending()}>
<Show when={hasChildren() && !props.hideDetails && !props.locked && (!pending() || props.allowOpenWhilePending)}>
<Collapsible.Arrow />
</Show>
</div>
Expand Down
3 changes: 2 additions & 1 deletion packages/session-ui/src/components/message-part.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2126,13 +2126,14 @@ ToolRegistry.register({
<BasicTool
{...props}
icon="console"
allowOpenWhilePending
trigger={(open) => (
<div data-slot="basic-tool-tool-info-structured">
<div data-slot="basic-tool-tool-info-main">
<span data-slot="basic-tool-tool-title">
<TextShimmer text={i18n.t("ui.tool.shell")} active={pending()} />
</span>
<Show when={!pending() && !open() && props.input.command}>
<Show when={!open() && props.input.command}>
<ShellSubmessage text={props.input.command} animate={sawPending} />
</Show>
</div>
Expand Down
Loading