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 @@ -140,7 +140,9 @@ describe("WorkflowActionListToolCall", () => {

expect(view.getByText("git.changedFiles")).toBeTruthy();
expect(view.getByText("read")).toBeTruthy();
expect(view.getByText("blocked")).toBeTruthy();
const blockedBadge = view.getByText("blocked");
expect(blockedBadge.classList.contains("text-danger")).toBe(true);
expect(blockedBadge.classList.contains("text-warning")).toBe(false);
// Blocked actions surface their reason in the row description slot.
expect(view.getByText("Project is not trusted")).toBeTruthy();
});
Expand Down
2 changes: 1 addition & 1 deletion src/browser/features/Tools/WorkflowActionListToolCall.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ function WorkflowActionListRow(props: { descriptor: WorkflowActionDescriptor })
{action.metadata.effect}
</WorkflowBadge>
) : (
<WorkflowBadge tone="warning">blocked</WorkflowBadge>
<WorkflowBadge tone="danger">blocked</WorkflowBadge>
)}
</span>
<span
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,9 @@ describe("WorkflowDefinitionToolCall", () => {
clickToolHeader(view, "2 definitions");

expect(view.queryByText("executable")).toBeNull();
expect(view.getByText("blocked")).toBeTruthy();
const blockedBadge = view.getByText("blocked");
expect(blockedBadge.classList.contains("text-danger")).toBe(true);
expect(blockedBadge.classList.contains("text-warning")).toBe(false);
expect(view.getByText("Project is not trusted")).toBeTruthy();
});
});
8 changes: 5 additions & 3 deletions src/browser/features/Tools/WorkflowDefinitionToolCall.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,16 @@ export function WorkflowKindBadge() {

export function WorkflowBadge(props: {
children: React.ReactNode;
tone?: "normal" | "success" | "warning";
tone?: "normal" | "success" | "warning" | "danger";
}) {
return (
<span
className={cn(
"border-border bg-background/40 rounded border px-1.5 py-0.5 text-[10px] font-medium whitespace-nowrap",
props.tone === "success" && "border-success/30 text-success",
props.tone === "warning" && "border-warning/30 text-warning",
// Blocked workflows/actions need to stand apart from yellow external-action warnings.
props.tone === "danger" && "border-danger/40 bg-danger-overlay text-danger",
(props.tone == null || props.tone === "normal") && "text-muted"
)}
>
Expand Down Expand Up @@ -149,7 +151,7 @@ function WorkflowDefinitionListRow(props: { descriptor: WorkflowDefinitionDescri
</span>
<div className="flex items-center gap-1.5">
<WorkflowBadge>{descriptor.scope}</WorkflowBadge>
{!descriptor.executable && <WorkflowBadge tone="warning">blocked</WorkflowBadge>}
{!descriptor.executable && <WorkflowBadge tone="danger">blocked</WorkflowBadge>}
</div>
<div className="min-w-0 [@container(max-width:640px)]:col-span-2">
<div className="text-muted truncate text-[11px]" title={descriptor.description}>
Expand Down Expand Up @@ -193,7 +195,7 @@ export function WorkflowDefinitionCard(props: {
<div className="flex flex-wrap items-center gap-2">
<span className="text-foreground font-mono text-[12px] font-medium">{descriptor.name}</span>
<WorkflowBadge>{descriptor.scope}</WorkflowBadge>
{!descriptor.executable && <WorkflowBadge tone="warning">blocked</WorkflowBadge>}
{!descriptor.executable && <WorkflowBadge tone="danger">blocked</WorkflowBadge>}
</div>
{!props.compact && (
<div className="text-muted mt-1 text-[11px]">{descriptor.description}</div>
Expand Down
Loading