mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-16 05:01:03 +03:00
feat(desktop): clarify queued and pending steer messages (#53338)
Co-authored-by: LukeParkerDev <10430890+Hona@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
Unverified
parent
394a4fc64b
commit
754b144263
@@ -859,6 +859,45 @@ for (const delivery of ["steer", "queue"] as const) {
|
||||
await expect(pending).toContainText(followUp)
|
||||
await expect(thinking).toHaveCount(0)
|
||||
|
||||
const bubble = pending.locator('[data-slot="user-message-text"]')
|
||||
|
||||
const colors =
|
||||
delivery === "steer"
|
||||
? {
|
||||
delivered: await userRow(page, userID)
|
||||
.locator('[data-slot="user-message-text"]')
|
||||
.evaluate((element) => ({
|
||||
background: getComputedStyle(element).backgroundColor,
|
||||
text: getComputedStyle(element).color,
|
||||
})),
|
||||
pending: await bubble.evaluate((element) => {
|
||||
const probe = document.createElement("span")
|
||||
probe.style.backgroundColor = "var(--v2-background-bg-layer-02)"
|
||||
probe.style.color = "var(--v2-text-text-base)"
|
||||
element.appendChild(probe)
|
||||
|
||||
const colors = {
|
||||
background: getComputedStyle(probe).backgroundColor,
|
||||
text: getComputedStyle(probe).color,
|
||||
}
|
||||
|
||||
probe.remove()
|
||||
|
||||
return colors
|
||||
}),
|
||||
}
|
||||
: undefined
|
||||
|
||||
if (colors) {
|
||||
await expect(bubble).toHaveCSS("background-color", colors.pending.background)
|
||||
await expect(bubble).toHaveCSS("color", colors.pending.text)
|
||||
await pending.hover()
|
||||
await expect(pending.locator('[data-slot="user-message-meta"]')).toHaveText(
|
||||
/^Pending\s*·\s*Build\s*·\s*Queue Model$/,
|
||||
)
|
||||
await bubble.evaluate((element) => (element.dataset.deliveryMarker = "pending"))
|
||||
}
|
||||
|
||||
// The next assistant step still belongs to U1: U2 has been admitted, not delivered.
|
||||
mock.emit("session.step.started", {
|
||||
sessionID,
|
||||
@@ -921,6 +960,18 @@ for (const delivery of ["steer", "queue"] as const) {
|
||||
mock.emit("session.inbox.delivered", { sessionID, inboxID })
|
||||
await expect(thinking).toHaveCount(0)
|
||||
await expect(pending).toHaveCount(1)
|
||||
|
||||
if (colors) {
|
||||
await expect(bubble).toHaveAttribute("data-delivery-marker", "pending")
|
||||
await expect(pending.locator('[data-slot="user-message-meta"]')).toHaveText(/^Build\s*·\s*Queue Model$/)
|
||||
await expect(bubble).toHaveCSS("background-color", colors.delivered.background)
|
||||
await expect(bubble).toHaveCSS("color", colors.delivered.text)
|
||||
await expect(bubble).toHaveCSS("transition-property", "background-color, color")
|
||||
await transcript.screenshot({ path: testInfo.outputPath("delivered-steer.png") })
|
||||
await page.emulateMedia({ reducedMotion: "reduce" })
|
||||
await expect(bubble).toHaveCSS("transition-duration", "0s")
|
||||
}
|
||||
|
||||
await expect(transcript.locator('[data-timeline-row="UserMessage"]')).toHaveCount(2)
|
||||
await expect(transcript.locator('[data-timeline-row="AssistantPart"]').filter({ has: tools })).toHaveAttribute(
|
||||
"data-message-id",
|
||||
|
||||
@@ -186,7 +186,7 @@ function SessionQueueRow(props: { queue: SessionQueueView; id: string; index: nu
|
||||
type="button"
|
||||
size="small"
|
||||
variant="ghost-muted"
|
||||
icon={<Icon name="arrow-down-to-line" />}
|
||||
icon={<Icon name="outline-undo" />}
|
||||
disabled={props.queue.busy()}
|
||||
aria-label={language.t("session.queue.undo")}
|
||||
onClick={() => props.queue.undo(props.id)}
|
||||
|
||||
@@ -145,6 +145,13 @@
|
||||
border: none;
|
||||
padding: 8px 12px;
|
||||
border-radius: 10px;
|
||||
transition:
|
||||
background-color 200ms ease,
|
||||
color 200ms ease;
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
transition: none;
|
||||
}
|
||||
|
||||
[data-highlight="file"],
|
||||
[data-highlight="agent"] {
|
||||
@@ -156,6 +163,11 @@
|
||||
|
||||
[data-slot="user-message-mention-prefix"] {
|
||||
color: var(--user-message-mention-prefix-color);
|
||||
transition: color 200ms ease;
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
transition: none;
|
||||
}
|
||||
}
|
||||
|
||||
max-width: 100%;
|
||||
@@ -1573,29 +1585,41 @@
|
||||
background: var(--v2-background-bg-layer-02);
|
||||
}
|
||||
|
||||
:root body [data-workspace-session] [data-component="user-message"] [data-slot="user-message-text"] {
|
||||
:root body
|
||||
[data-workspace-session]
|
||||
[data-component="user-message"]:not([data-pending])
|
||||
[data-slot="user-message-text"] {
|
||||
--user-message-mention-prefix-color: var(--v2-blue-300);
|
||||
|
||||
background: var(--v2-background-bg-accent);
|
||||
color: var(--v2-text-text-contrast);
|
||||
}
|
||||
|
||||
:root body [data-local-session] [data-component="user-message"] [data-slot="user-message-text"] {
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
:root[data-color-scheme="light"]
|
||||
body
|
||||
[data-local-session]
|
||||
[data-component="user-message"]
|
||||
[data-component="user-message"]:not([data-pending])
|
||||
[data-slot="user-message-text"] {
|
||||
background: var(--v2-blue-100);
|
||||
color: var(--v2-blue-700);
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
:root[data-color-scheme="dark"]
|
||||
body
|
||||
[data-local-session]
|
||||
[data-component="user-message"]
|
||||
[data-component="user-message"]:not([data-pending])
|
||||
[data-slot="user-message-text"] {
|
||||
background: var(--v2-blue-1200);
|
||||
color: var(--v2-blue-300);
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
:root body [data-component="user-message"][data-pending] [data-slot="user-message-text"] {
|
||||
--user-message-mention-prefix-color: currentColor;
|
||||
|
||||
background: var(--v2-background-bg-layer-02);
|
||||
color: var(--v2-text-text-base);
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ function modelLabel(
|
||||
|
||||
function MessageActionButton(
|
||||
props: Pick<ComponentProps<"button">, "disabled" | "onMouseDown" | "onClick" | "aria-label"> & {
|
||||
icon: "check" | "copy" | "reset" | "bullet-list" | "outline-trash"
|
||||
icon: "check" | "copy" | "reset" | "arrow-down-to-line" | "outline-trash"
|
||||
label: JSX.Element
|
||||
},
|
||||
) {
|
||||
@@ -271,7 +271,9 @@ export function CurrentUserMessageDisplay(props: {
|
||||
const metaHead = createMemo(() => {
|
||||
const agent = props.agent
|
||||
|
||||
return [agent ? agent[0]?.toUpperCase() + agent.slice(1) : "", model()].filter(Boolean).join("\u00A0\u00B7\u00A0")
|
||||
return [pending() ? i18n.t("ui.message.pending") : "", agent ? agent[0]?.toUpperCase() + agent.slice(1) : "", model()]
|
||||
.filter(Boolean)
|
||||
.join("\u00A0\u00B7\u00A0")
|
||||
})
|
||||
|
||||
const stamp = createMemo(() => timefmt().format(props.message.time.created))
|
||||
@@ -349,7 +351,11 @@ export function CurrentUserMessageDisplay(props: {
|
||||
)
|
||||
|
||||
return (
|
||||
<div data-component="user-message" data-timeline-part-id={props.text ? `${props.message.id}:text:0` : undefined}>
|
||||
<div
|
||||
data-component="user-message"
|
||||
data-pending={pending() ? "true" : undefined}
|
||||
data-timeline-part-id={props.text ? `${props.message.id}:text:0` : undefined}
|
||||
>
|
||||
<Show
|
||||
when={props.text}
|
||||
fallback={
|
||||
@@ -388,7 +394,7 @@ export function CurrentUserMessageDisplay(props: {
|
||||
</span>
|
||||
<Show when={pending()}>
|
||||
<MessageActionButton
|
||||
icon="bullet-list"
|
||||
icon="arrow-down-to-line"
|
||||
label={i18n.t("ui.message.moveToQueue")}
|
||||
disabled={state.updating}
|
||||
onMouseDown={(event) => event.preventDefault()}
|
||||
|
||||
@@ -244,6 +244,7 @@ const source = {
|
||||
"ui.message.forkMessage": "Fork to new session",
|
||||
"ui.message.revertMessage": "Revert message",
|
||||
"ui.message.moveToQueue": "Move to queue",
|
||||
"ui.message.pending": "Pending",
|
||||
"ui.message.deletePending": "Delete",
|
||||
"ui.message.copyResponse": "Copy response",
|
||||
"ui.message.copied": "Copied",
|
||||
|
||||
@@ -222,6 +222,10 @@ const icons = {
|
||||
viewBox: "0 0 20 20",
|
||||
body: `<path d="M5.83333 4.16406L2.5 7.4974L5.83333 10.8307M3.33333 7.4974H17.9167V15.4141H10" stroke="currentColor" stroke-linecap="square"/>`,
|
||||
},
|
||||
"outline-undo": {
|
||||
viewBox: "0 0 16 16",
|
||||
body: `<path d="M2 10L4.25193 7.76999C7.29213 4.7594 12.4119 5.77372 14.0747 9.71606" stroke="currentColor"/><path d="M2 6V10H6" stroke="currentColor" stroke-linecap="square"/>`,
|
||||
},
|
||||
"outline-reset": {
|
||||
viewBox: "0 0 20 20",
|
||||
body: `<path d="M5.83333 4.16406L2.5 7.4974L5.83333 10.8307M3.33333 7.4974H17.9167V15.4141H10" stroke="currentColor" stroke-linecap="square"/>`,
|
||||
|
||||
Reference in New Issue
Block a user