Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
merge: resolve conflicts with main (search + runtime owner/delete)
Naiyuan Qinga092443a09eb
diff --cc apps/web/app/(dashboard)/layout.tsxindex 5c3a330cc7,ab31b92175..bb96558a8e--- a/apps/web/app/(dashboard)/layout.tsx+++ b/apps/web/app/(dashboard)/layout.tsx@@@ -3,12 -3,11 +3,13 @@@import { useEffect } from "react";import { useRouter, usePathname } from "next/navigation";import { MulticaIcon } from "@/components/multica-icon";-import { useNavigationStore } from "@/features/navigation";-import { SidebarProvider, SidebarInset } from "@/components/ui/sidebar";-import { useAuthStore } from "@/features/auth";-import { useWorkspaceStore } from "@/features/workspace";+import { useNavigationStore } from "@multica/core/navigation";+import { SidebarProvider, SidebarInset } from "@multica/ui/components/ui/sidebar";+import { useAuthStore } from "@/platform/auth";+import { useWorkspaceStore } from "@/platform/workspace";+import { WorkspaceIdProvider } from "@multica/core/hooks";+import { ModalRegistry } from "@multica/views/modals/registry";+ import { SearchCommand } from "@/features/search";import { AppSidebar } from "./_components/app-sidebar";export default function DashboardLayout({diff --cc apps/web/features/search/components/search-command.tsxindex 0000000000,3bfb8ddbe9..581839b4ebmode 000000,100644..100644--- a/apps/web/features/search/components/search-command.tsx+++ b/apps/web/features/search/components/search-command.tsx@@@ -1,0 -1,198 +1,198 @@@+ "use client";++ import { useCallback, useEffect, useRef, useState } from "react";+ import { useRouter } from "next/navigation";+ import { Loader2, MessageSquare, SearchIcon } from "lucide-react";+ import { Command as CommandPrimitive } from "cmdk";-import type { SearchIssueResult } from "@/shared/types";-import { api } from "@/shared/api";-import { StatusIcon } from "@/features/issues";-import { STATUS_CONFIG } from "@/features/issues/config";++import type { SearchIssueResult } from "@multica/core/types";++import { api } from "@/platform/api";++import { StatusIcon } from "@multica/views/issues/components";++import { STATUS_CONFIG } from "@multica/core/issues/config";+ import {+ Dialog,+ DialogContent,+ DialogHeader,+ DialogTitle,+ DialogDescription,-} from "@/components/ui/dialog";++} from "@multica/ui/components/ui/dialog";++ export function SearchCommand() {+ const router = useRouter();+ const [open, setOpen] = useState(false);+ const [query, setQuery] = useState("");+ const [results, setResults] = useState<SearchIssueResult[]>([]);+ const [isLoading, setIsLoading] = useState(false);+ const debounceRef = useRef<ReturnType<typeof setTimeout> | null>(null);+ const abortRef = useRef<AbortController | null>(null);++ // Global Cmd+K / Ctrl+K shortcut+ useEffect(() => {+ const handleKeyDown = (e: KeyboardEvent) => {+ if (e.key === "k" && (e.metaKey || e.ctrlKey)) {+ e.preventDefault();+ setOpen((prev) => !prev);+ }+ };+ document.addEventListener("keydown", handleKeyDown);+ return () => document.removeEventListener("keydown", handleKeyDown);+ }, []);++ // Cleanup debounce/abort on unmount+ useEffect(() => {+ return () => {+ if (debounceRef.current) clearTimeout(debounceRef.current);+ if (abortRef.current) abortRef.current.abort();+ };+ }, []);++ // Reset state when dialog closes+ useEffect(() => {+ if (!open) {+ setQuery("");+ setResults([]);+ setIsLoading(false);+ }+ }, [open]);++ const search = useCallback((q: string) => {+ if (debounceRef.current) clearTimeout(debounceRef.current);+ if (abortRef.current) abortRef.current.abort();++ if (!q.trim()) {+ setResults([]);+ setIsLoading(false);+ return;+ }++ setIsLoading(true);+ debounceRef.current = setTimeout(async () => {+ const controller = new AbortController();+ abortRef.current = controller;+ try {+ const res = await api.searchIssues({+ q: q.trim(),+ limit: 20,+ include_closed: true,+ signal: controller.signal,+ });+ if (!controller.signal.aborted) {+ setResults(res.issues);+ setIsLoading(false);+ }+ } catch {+ if (!controller.signal.aborted) {+ setIsLoading(false);+ }+ }+ }, 300);+ }, []);++ const handleValueChange = useCallback(+ (value: string) => {+ setQuery(value);+ search(value);+ },+ [search],+ );++ const handleSelect = useCallback(+ (issueId: string) => {+ setOpen(false);+ router.push(`/issues/${issueId}`);+ },+ [router],+ );++ return (+ <Dialog open={open} onOpenChange={setOpen}>+ <DialogContent+ className="top-[20%] translate-y-0 overflow-hidden rounded-xl! p-0 sm:max-w-xl!"+ showCloseButton={false}+ >+ <DialogHeader className="sr-only">+ <DialogTitle>Search Issues</DialogTitle>+ <DialogDescription>+ Search issues by title, description, or comments+ </DialogDescription>+ </DialogHeader>+ <CommandPrimitive+ shouldFilter={false}+ className="flex size-full flex-col overflow-hidden rounded-xl bg-popover text-popover-foreground"+ >+ {/* Search input */}+ <div className="flex items-center gap-3 border-b px-4 py-3">+ <SearchIcon className="size-5 shrink-0 text-muted-foreground" />+ <CommandPrimitive.Input+ placeholder="Type a command or search..."+ value={query}+ onValueChange={handleValueChange}+ className="flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground"+ />+ <kbd className="hidden shrink-0 rounded bg-muted px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground sm:inline">+ ESC+ </kbd>+ </div>++ {/* Results list */}+ <CommandPrimitive.List className="max-h-[min(400px,50vh)] overflow-y-auto overflow-x-hidden">+ {isLoading && (+ <div className="flex items-center justify-center py-10">+ <Loader2 className="size-5 animate-spin text-muted-foreground" />+ </div>+ )}++ {!isLoading && query.trim() && results.length === 0 && (+ <CommandPrimitive.Empty className="py-10 text-center text-sm text-muted-foreground">+ No issues found.+ </CommandPrimitive.Empty>+ )}++ {!isLoading && results.length > 0 && (+ <CommandPrimitive.Group className="p-2">+ {results.map((issue) => (+ <CommandPrimitive.Item+ key={issue.id}+ value={issue.id}+ onSelect={handleSelect}+ className="flex cursor-default select-none flex-col gap-1 rounded-lg px-3 py-2.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-selected:bg-accent"+ >+ <div className="flex items-center gap-2.5">+ <StatusIcon+ status={issue.status}+ className="size-4 shrink-0"+ />+ <span className="text-xs text-muted-foreground shrink-0">+ {issue.identifier}+ </span>+ <span className="truncate">{issue.title}</span>+ <span+ className={`ml-auto text-xs shrink-0 ${STATUS_CONFIG[issue.status].iconColor}`}+ >+ {STATUS_CONFIG[issue.status].label}+ </span>+ </div>+ {issue.match_source === "comment" &&+ issue.matched_snippet && (+ <div className="flex items-start gap-2 pl-[26px]">+ <MessageSquare className="size-3 shrink-0 text-muted-foreground mt-0.5" />+ <span className="text-xs text-muted-foreground truncate">+ {issue.matched_snippet}+ </span>+ </div>+ )}+ </CommandPrimitive.Item>+ ))}+ </CommandPrimitive.Group>+ )}++ {!isLoading && !query.trim() && (+ <div className="py-10 text-center text-sm text-muted-foreground">+ Type to search issues...+ </div>+ )}+ </CommandPrimitive.List>+ </CommandPrimitive>+ </DialogContent>+ </Dialog>+ );+ }diff --cc packages/core/package.jsonindex 479d089582,0000000000..492ca4e691mode 100644,000000..100644--- a/packages/core/package.json+++ b/packages/core/package.json@@@ -1,58 -1,0 +1,59 @@@+{+ "name": "@multica/core",+ "version": "0.0.0",+ "private": true,+ "type": "module",+ "exports": {+ ".": "./index.ts",+ "./types": "./types/index.ts",+ "./types/*": "./types/*.ts",+ "./api": "./api/index.ts",+ "./api/client": "./api/client.ts",+ "./api/ws-client": "./api/ws-client.ts",+ "./auth": "./auth/index.ts",+ "./workspace": "./workspace/index.ts",+ "./workspace/queries": "./workspace/queries.ts",+ "./workspace/mutations": "./workspace/mutations.ts",+ "./workspace/hooks": "./workspace/hooks.ts",+ "./issues": "./issues/index.ts",+ "./issues/queries": "./issues/queries.ts",+ "./issues/mutations": "./issues/mutations.ts",+ "./issues/ws-updaters": "./issues/ws-updaters.ts",+ "./issues/config": "./issues/config/index.ts",+ "./issues/config/status": "./issues/config/status.ts",+ "./issues/config/priority": "./issues/config/priority.ts",+ "./issues/stores": "./issues/stores/index.ts",+ "./issues/stores/view-store-context": "./issues/stores/view-store-context.tsx",+ "./issues/stores/*": "./issues/stores/*.ts",+ "./inbox": "./inbox/index.ts",+ "./inbox/queries": "./inbox/queries.ts",+ "./inbox/mutations": "./inbox/mutations.ts",+ "./inbox/ws-updaters": "./inbox/ws-updaters.ts",+ "./runtimes": "./runtimes/index.ts",+ "./runtimes/queries": "./runtimes/queries.ts",++ "./runtimes/mutations": "./runtimes/mutations.ts",+ "./realtime": "./realtime/index.ts",+ "./navigation": "./navigation/index.ts",+ "./modals": "./modals/index.ts",+ "./hooks": "./hooks.tsx",+ "./hooks/*": "./hooks/*.ts",+ "./query-client": "./query-client.ts",+ "./provider": "./provider.tsx",+ "./logger": "./logger.ts",+ "./utils": "./utils.ts",+ "./constants/*": "./constants/*.ts"+ },+ "dependencies": {+ "@tanstack/react-query": "catalog:",+ "@tanstack/react-query-devtools": "^5.96.2",+ "zustand": "catalog:"+ },+ "peerDependencies": {+ "react": "catalog:"+ },+ "devDependencies": {+ "@multica/tsconfig": "workspace:*",+ "@types/react": "catalog:",+ "typescript": "catalog:"+ }+}diff --cc packages/core/runtimes/index.tsindex b69c251208,0000000000..868bf87e53mode 100644,000000..100644--- a/packages/core/runtimes/index.ts+++ b/packages/core/runtimes/index.ts@@@ -1,1 -1,0 +1,2 @@@+export * from "./queries";++export * from "./mutations";diff --cc packages/core/runtimes/mutations.tsindex 0000000000,22980eddf3..741bd8efbamode 000000,100644..100644--- a/packages/core/runtimes/mutations.ts+++ b/packages/core/runtimes/mutations.ts@@@ -1,0 -1,13 +1,13 @@@+ import { useMutation, useQueryClient } from "@tanstack/react-query";-import { api } from "@/shared/api";++import { api } from "../api";+ import { runtimeKeys } from "./queries";++ export function useDeleteRuntime(wsId: string) {+ const qc = useQueryClient();+ return useMutation({+ mutationFn: (runtimeId: string) => api.deleteRuntime(runtimeId),+ onSettled: () => {+ qc.invalidateQueries({ queryKey: runtimeKeys.all(wsId) });+ },+ });+ }diff --cc packages/views/runtimes/components/runtime-detail.tsxindex 9873de332b,5ed7733087..0ff82eb38b--- a/packages/views/runtimes/components/runtime-detail.tsx+++ b/packages/views/runtimes/components/runtime-detail.tsx@@@ -1,4 -1,25 +1,25 @@@+ "use client";++ import { useState } from "react";+ import { Trash2 } from "lucide-react";+ import { toast } from "sonner";+ import { useQuery } from "@tanstack/react-query";-import type { AgentRuntime } from "@/shared/types";-import { useAuthStore } from "@/features/auth";-import { useWorkspaceId } from "@core/hooks";-import { memberListOptions } from "@core/workspace/queries";-import { useDeleteRuntime } from "@core/runtimes/mutations";-import { Button } from "@/components/ui/button";+import type { AgentRuntime } from "@multica/core/types";++import { useAuthStore } from "@multica/core/auth";++import { useWorkspaceId } from "@multica/core/hooks";++import { memberListOptions } from "@multica/core/workspace/queries";++import { useDeleteRuntime } from "@multica/core/runtimes/mutations";++import { Button } from "@multica/ui/components/ui/button";+ import {+ AlertDialog,+ AlertDialogAction,+ AlertDialogCancel,+ AlertDialogContent,+ AlertDialogDescription,+ AlertDialogFooter,+ AlertDialogHeader,+ AlertDialogTitle,-} from "@/components/ui/alert-dialog";++} from "@multica/ui/components/ui/alert-dialog";import { formatLastSeen } from "../utils";import { RuntimeModeIcon, StatusBadge, InfoField } from "./shared";import { PingSection } from "./ping-section";diff --cc packages/views/runtimes/components/runtime-list.tsxindex 8b1ae0f884,5f2db9279b..04c112b746--- a/packages/views/runtimes/components/runtime-list.tsx+++ b/packages/views/runtimes/components/runtime-list.tsx@@@ -1,7 -1,12 +1,12 @@@import { Server } from "lucide-react";+ import { useQuery } from "@tanstack/react-query";-import type { AgentRuntime } from "@/shared/types";-import { useWorkspaceId } from "@core/hooks";-import { memberListOptions } from "@core/workspace/queries";+import type { AgentRuntime } from "@multica/core/types";++import { useWorkspaceId } from "@multica/core/hooks";++import { memberListOptions } from "@multica/core/workspace/queries";import { RuntimeModeIcon } from "./shared";+ type RuntimeFilter = "mine" | "all";+function RuntimeListItem({runtime,isSelected,diff --cc pnpm-lock.yamlindex 60496c0aca,6d84135bab..37cbdc0c6d--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@@ -269,260 -245,6 +269,260 @@@ importersspecifier: ^4.1.0version: 4.1.0(@types/[email protected])([email protected](@noble/[email protected]))([email protected](@types/[email protected])([email protected]))([email protected](@types/[email protected])([email protected]))+ packages/core:+ dependencies:+ '@tanstack/react-query':+ specifier: 'catalog:'+ version: 5.96.2([email protected])+ '@tanstack/react-query-devtools':+ specifier: ^5.96.2+ react:+ specifier: 'catalog:'+ version: 19.2.3+ zustand:+ specifier: 'catalog:'+ version: 5.0.12(@types/[email protected])([email protected])([email protected])([email protected]([email protected]))+ devDependencies:+ '@multica/tsconfig':+ specifier: workspace:*+ version: link:../tsconfig+ '@types/react':+ specifier: ^19.2.0+ version: 19.2.14+ typescript:+ specifier: 'catalog:'+ version: 5.9.3++ packages/tsconfig: {}++ packages/ui:+ dependencies:+ '@base-ui/react':+ specifier: ^1.3.0+ '@emoji-mart/data':+ specifier: ^1.2.1+ version: 1.2.1+ class-variance-authority:+ specifier: 'catalog:'+ version: 0.7.1+ clsx:+ specifier: 'catalog:'+ version: 2.1.1+ cmdk:+ specifier: ^1.1.1+ version: 1.1.1(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])+ date-fns:+ specifier: ^4.1.0+ version: 4.1.0+ embla-carousel-react:+ specifier: ^8.6.0+ version: 8.6.0([email protected])+ emoji-mart:+ specifier: ^5.6.0+ version: 5.6.0+ input-otp:+ specifier: ^1.4.2+ linkify-it:+ specifier: ^5.0.0+ version: 5.0.0+ lucide-react:+ specifier: 'catalog:'+ version: 1.0.1([email protected])+ next-themes:+ specifier: ^0.4.6+ react:+ specifier: 'catalog:'+ version: 19.2.3+ react-day-picker:+ specifier: ^9.14.0+ version: 9.14.0([email protected])+ react-dom:+ specifier: 'catalog:'+ version: 19.2.3([email protected])+ react-markdown:+ specifier: ^10.1.0+ version: 10.1.0(@types/[email protected])([email protected])+ react-resizable-panels:+ specifier: ^4.7.5+ recharts:+ specifier: 3.8.0+ version: 3.8.0(@types/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])+ rehype-raw:+ specifier: ^7.0.0+ version: 7.0.0+ remark-gfm:+ specifier: ^4.0.1+ version: 4.0.1+ shiki:+ specifier: ^3.21.0+ version: 3.23.0+ sonner:+ specifier: ^2.0.7+ tailwind-merge:+ specifier: 'catalog:'+ version: 3.5.0+ tw-animate-css:+ specifier: ^1.4.0+ version: 1.4.0+ vaul:+ specifier: ^1.1.2+ version: 1.1.2(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])+ devDependencies:+ '@multica/tsconfig':+ specifier: workspace:*+ version: link:../tsconfig+ '@types/linkify-it':+ specifier: ^5.0.0+ version: 5.0.0+ '@types/react':+ specifier: ^19.2.0+ version: 19.2.14+ '@types/react-dom':+ specifier: ^19.2.0+ version: 19.2.3(@types/[email protected])+ typescript:+ specifier: 'catalog:'+ version: 5.9.3++ packages/views:+ dependencies:+ '@base-ui/react':+ specifier: ^1.3.0+ '@dnd-kit/core':+ specifier: ^6.3.1+ '@dnd-kit/sortable':+ specifier: ^10.0.0+ version: 10.0.0(@dnd-kit/[email protected]([email protected]([email protected]))([email protected]))([email protected])+ '@dnd-kit/utilities':+ specifier: ^3.2.2+ version: 3.2.2([email protected])+ '@floating-ui/dom':+ specifier: ^1.7.6+ version: 1.7.6+ '@multica/core':+ specifier: workspace:*+ version: link:../core+ '@multica/ui':+ specifier: workspace:*+ version: link:../ui+ '@tanstack/react-query':+ specifier: 'catalog:'+ version: 5.96.2([email protected])+ '@tiptap/core':+ specifier: ^3.22.1+ version: 3.22.1(@tiptap/[email protected])+ '@tiptap/extension-code-block-lowlight':+ specifier: ^3.22.1+ version: 3.22.1(@tiptap/[email protected](@tiptap/[email protected]))(@tiptap/[email protected](@tiptap/[email protected](@tiptap/[email protected]))(@tiptap/[email protected]))(@tiptap/[email protected])([email protected])([email protected])+ '@tiptap/extension-document':+ specifier: ^3.22.1+ version: 3.22.1(@tiptap/[email protected](@tiptap/[email protected]))+ '@tiptap/extension-image':+ specifier: ^3.22.1+ version: 3.22.1(@tiptap/[email protected](@tiptap/[email protected]))+ '@tiptap/extension-link':+ specifier: ^3.22.1+ '@tiptap/extension-mention':+ specifier: ^3.22.1+ version: 3.22.1(@tiptap/[email protected](@tiptap/[email protected]))(@tiptap/[email protected])(@tiptap/[email protected](@tiptap/[email protected](@tiptap/[email protected]))(@tiptap/[email protected]))+ '@tiptap/extension-paragraph':+ specifier: ^3.22.1+ version: 3.22.1(@tiptap/[email protected](@tiptap/[email protected]))+ '@tiptap/extension-placeholder':+ specifier: ^3.22.1+ version: 3.22.1(@tiptap/[email protected](@tiptap/[email protected](@tiptap/[email protected]))(@tiptap/[email protected]))+ '@tiptap/extension-table':+ specifier: ^3.22.1+ '@tiptap/extension-table-cell':+ specifier: ^3.22.1+ version: 3.22.1(@tiptap/[email protected](@tiptap/[email protected](@tiptap/[email protected]))(@tiptap/[email protected]))+ '@tiptap/extension-table-header':+ specifier: ^3.22.1+ version: 3.22.1(@tiptap/[email protected](@tiptap/[email protected](@tiptap/[email protected]))(@tiptap/[email protected]))+ '@tiptap/extension-table-row':+ specifier: ^3.22.1+ version: 3.22.1(@tiptap/[email protected](@tiptap/[email protected](@tiptap/[email protected]))(@tiptap/[email protected]))+ '@tiptap/extension-text':+ specifier: ^3.22.1+ version: 3.22.1(@tiptap/[email protected](@tiptap/[email protected]))+ '@tiptap/extension-typography':+ specifier: ^3.22.1+ version: 3.22.1(@tiptap/[email protected](@tiptap/[email protected]))+ '@tiptap/markdown':+ specifier: ^3.22.1+ '@tiptap/pm':+ specifier: ^3.22.1+ version: 3.22.1+ '@tiptap/react':+ specifier: ^3.22.1+ version: 3.22.1(@floating-ui/[email protected])(@tiptap/[email protected](@tiptap/[email protected]))(@tiptap/[email protected])(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])+ '@tiptap/starter-kit':+ specifier: ^3.22.1+ version: 3.22.1+ '@tiptap/suggestion':+ specifier: ^3.22.1+ hast-util-to-html:- specifier: ^4.0.0++ specifier: ^4.0.1+ version: 4.0.1+ lowlight:+ specifier: ^3.3.0+ version: 3.3.0+ lucide-react:+ specifier: 'catalog:'+ version: 1.0.1([email protected])+ react:+ specifier: 'catalog:'+ version: 19.2.3+ react-dom:+ specifier: 'catalog:'+ version: 19.2.3([email protected])+ react-markdown:+ specifier: ^10.1.0+ version: 10.1.0(@types/[email protected])([email protected])+ react-resizable-panels:+ specifier: ^4.7.5+ recharts:+ specifier: 3.8.0+ version: 3.8.0(@types/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])+ rehype-raw:+ specifier: ^7.0.0+ version: 7.0.0+ remark-gfm:+ specifier: ^4.0.1+ version: 4.0.1+ sonner:+ specifier: ^2.0.7+ zustand:+ specifier: 'catalog:'+ version: 5.0.12(@types/[email protected])([email protected])([email protected])([email protected]([email protected]))+ devDependencies:+ '@multica/tsconfig':+ specifier: workspace:*+ version: link:../tsconfig+ '@types/react':+ specifier: ^19.2.0+ version: 19.2.14+ '@types/react-dom':+ specifier: ^19.2.0+ version: 19.2.3(@types/[email protected])+ typescript:+ specifier: 'catalog:'+ version: 5.9.3+packages:'@adobe/[email protected]':