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
21 changes: 16 additions & 5 deletions apps/desktop/src/lib/trpc/routers/projects/projects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,12 @@ export const createProjectsRouter = (getWindow: () => BrowserWindow | null) => {
}),

listPullRequests: publicProcedure
.input(z.object({ projectId: z.string() }))
.input(
z.object({
projectId: z.string(),
includeClosed: z.boolean().optional(),
}),
)
.query(async ({ input }) => {
const project = localDb
.select()
Expand All @@ -496,7 +501,7 @@ export const createProjectsRouter = (getWindow: () => BrowserWindow | null) => {
"pr",
"list",
"--state",
"open",
input.includeClosed ? "all" : "open",
"--limit",
"30",
"--json",
Expand All @@ -517,6 +522,7 @@ export const createProjectsRouter = (getWindow: () => BrowserWindow | null) => {
z.object({
projectId: z.string(),
query: z.string(),
includeClosed: z.boolean().optional(),
}),
)
.query(async ({ input }) => {
Expand All @@ -534,7 +540,7 @@ export const createProjectsRouter = (getWindow: () => BrowserWindow | null) => {
"pr",
"list",
"--state",
"all",
input.includeClosed ? "all" : "open",
"--search",
input.query,
"--limit",
Expand All @@ -553,7 +559,12 @@ export const createProjectsRouter = (getWindow: () => BrowserWindow | null) => {
}),

listIssues: publicProcedure
.input(z.object({ projectId: z.string() }))
.input(
z.object({
projectId: z.string(),
includeClosed: z.boolean().optional(),
}),
)
.query(async ({ input }) => {
const project = localDb
.select()
Expand All @@ -569,7 +580,7 @@ export const createProjectsRouter = (getWindow: () => BrowserWindow | null) => {
"issue",
"list",
"--state",
"open",
input.includeClosed ? "all" : "open",
"--limit",
"30",
"--json",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ interface ChatInputFooterProps {
pendingQuestion?: {
questionId: string;
question: string;
description?: string;
options?: { label: string; description?: string }[];
} | null;
isQuestionSubmitting?: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ interface QuestionInputOverlayProps {
question: {
questionId: string;
question: string;
description?: string;
options?: QuestionOption[];
};
isSubmitting: boolean;
Expand Down Expand Up @@ -63,9 +64,16 @@ export function QuestionInputOverlay({
<div className="flex max-h-[300px] flex-col overflow-hidden rounded-[13px] border-[0.5px] border-border bg-foreground/[0.02]">
{/* Question — pinned header */}
<div className="flex shrink-0 items-start gap-2 px-3 pt-3 pb-3">
<p className="flex-1 text-sm leading-snug text-foreground">
{question.question}
</p>
<div className="flex-1 space-y-1">
<p className="text-sm leading-snug text-foreground">
{question.question}
</p>
{question.description && (
<p className="text-xs leading-snug text-muted-foreground">
{question.description}
</p>
)}
</div>
<Tooltip>
<TooltipTrigger asChild>
<button
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Checkbox } from "@superset/ui/checkbox";
import {
Command,
CommandEmpty,
Expand All @@ -11,7 +12,7 @@ import { Tooltip, TooltipContent, TooltipTrigger } from "@superset/ui/tooltip";
import { useLiveQuery } from "@tanstack/react-db";
import Fuse from "fuse.js";
import type { ReactNode } from "react";
import { useMemo, useState } from "react";
import { useId, useMemo, useState } from "react";
import {
StatusIcon,
type StatusType,
Expand All @@ -20,6 +21,10 @@ import { useCollections } from "renderer/routes/_authenticated/providers/Collect

const MAX_RESULTS = 20;

function isClosedStatus(type: StatusType | undefined): boolean {
return type === "completed" || type === "canceled";
}

interface IssueLinkCommandProps {
children: ReactNode;
tooltipLabel: string;
Expand All @@ -38,6 +43,8 @@ export function IssueLinkCommand({
}: IssueLinkCommandProps) {
const [open, setOpen] = useState(false);
const [searchQuery, setSearchQuery] = useState("");
const [showClosed, setShowClosed] = useState(false);
const showClosedId = useId();
const collections = useCollections();

const { data: allTasks } = useLiveQuery(
Expand Down Expand Up @@ -82,21 +89,35 @@ export function IssueLinkCommand({

const taskFuse = useMemo(
() =>
new Fuse(allTasks ?? [], {
keys: [
{ name: "slug", weight: 3 },
{ name: "title", weight: 2 },
],
threshold: 0.4,
ignoreLocation: true,
}),
[allTasks],
new Fuse(
(allTasks ?? []).filter((task) => {
if (showClosed) return true;
const status = task.statusId
? statusMap.get(task.statusId)
: undefined;
return !isClosedStatus(status?.type);
}),
{
keys: [
{ name: "slug", weight: 3 },
{ name: "title", weight: 2 },
],
threshold: 0.4,
ignoreLocation: true,
},
),
[allTasks, showClosed, statusMap],
);

const filteredTasks = useMemo(() => {
if (!allTasks?.length) return [];
const visibleTasks = allTasks.filter((task) => {
if (showClosed) return true;
const status = task.statusId ? statusMap.get(task.statusId) : undefined;
return !isClosedStatus(status?.type);
});
if (!searchQuery) {
return [...allTasks]
return visibleTasks
.sort(
(a, b) =>
new Date(b.updatedAt).getTime() - new Date(a.updatedAt).getTime(),
Expand All @@ -106,7 +127,7 @@ export function IssueLinkCommand({
return taskFuse
.search(searchQuery, { limit: MAX_RESULTS })
.map((r) => r.item);
}, [allTasks, searchQuery, taskFuse]);
}, [allTasks, searchQuery, showClosed, statusMap, taskFuse]);

const handleSelect = (
slug: string,
Expand Down Expand Up @@ -145,12 +166,35 @@ export function IssueLinkCommand({
value={searchQuery}
onValueChange={setSearchQuery}
/>
<div className="flex items-center gap-2 border-b px-3 py-2">
<Checkbox
id={showClosedId}
checked={showClosed}
onCheckedChange={(checked) => setShowClosed(checked === true)}
/>
<label
htmlFor={showClosedId}
className="cursor-pointer select-none text-xs text-muted-foreground"
>
Show closed
</label>
</div>
<CommandList className="max-h-[280px]">
{filteredTasks.length === 0 && (
<CommandEmpty>No issues found.</CommandEmpty>
<CommandEmpty>
{showClosed ? "No issues found." : "No open issues found."}
</CommandEmpty>
)}
{filteredTasks.length > 0 && (
<CommandGroup heading={searchQuery ? "Results" : "Recent issues"}>
<CommandGroup
heading={
searchQuery
? "Results"
: showClosed
? "Recent issues"
: "Open issues"
}
>
{filteredTasks.map((task) => {
const status = task.statusId
? statusMap.get(task.statusId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import { ListProjectsToolCall } from "./components/ListProjectsToolCall";
import { ListTaskStatusesToolCall } from "./components/ListTaskStatusesToolCall";
import { ListTasksToolCall } from "./components/ListTasksToolCall";
import { ListWorkspacesToolCall } from "./components/ListWorkspacesToolCall";
import { RequestSandboxAccessToolCall } from "./components/RequestSandboxAccessToolCall";
import { StartAgentSessionToolCall } from "./components/StartAgentSessionToolCall";
import { SubagentToolCall } from "./components/SubagentToolCall";
import { SupersetToolCall } from "./components/SupersetToolCall";
Expand All @@ -50,6 +51,7 @@ interface ToolCallBlockProps {
workspaceCwd?: string;
sessionId?: string | null;
organizationId?: string | null;
isInterrupted?: boolean;
onAnswer?: (
toolCallId: string,
answers: Record<string, string>,
Expand All @@ -68,6 +70,7 @@ export function ToolCallBlock({
workspaceCwd,
sessionId,
organizationId,
isInterrupted,
onAnswer,
}: ToolCallBlockProps) {
const args = getArgs(part);
Expand Down Expand Up @@ -592,8 +595,15 @@ export function ToolCallBlock({
);
}

if (toolName === "request_sandbox_access") {
return <SupersetToolCall part={part} toolName="Request sandbox access" />;
if (toolName === "request_access") {
return (
<RequestSandboxAccessToolCall
part={part}
args={args}
result={result}
isInterrupted={isInterrupted ?? false}
/>
);
}

if (toolName === "task_write") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ function findAnswerForQuestion({
return undefined;
}

// FORK NOTE: fork uses buildQuestionMarkdown + UserQuestionTool instead of the
// upstream ToolCallRow/ToolStatusBadge pattern; fork implementation maintained here.
function buildQuestionMarkdown({
questions,
answers,
Expand Down
Loading
Loading