From 49408c00e964093c654ee270d545c0e29857e61f Mon Sep 17 00:00:00 2001 From: Dax Date: Fri, 21 Nov 2025 20:41:27 -0500 Subject: enterprise (#4617) Co-authored-by: GitHub Action Co-authored-by: Adam <2363879+adamdotdevin@users.noreply.github.com> --- packages/desktop/src/components/file-tree.tsx | 5 +- .../desktop/src/components/message-progress.tsx | 187 --------------------- packages/desktop/src/components/prompt-input.tsx | 15 +- packages/desktop/src/components/session-review.tsx | 104 ------------ packages/desktop/src/components/spinner.tsx | 39 ----- .../src/components/sticky-accordion-header.tsx | 17 -- 6 files changed, 13 insertions(+), 354 deletions(-) delete mode 100644 packages/desktop/src/components/message-progress.tsx delete mode 100644 packages/desktop/src/components/session-review.tsx delete mode 100644 packages/desktop/src/components/spinner.tsx delete mode 100644 packages/desktop/src/components/sticky-accordion-header.tsx (limited to 'packages/desktop/src/components') diff --git a/packages/desktop/src/components/file-tree.tsx b/packages/desktop/src/components/file-tree.tsx index 1347ecae6..f3729a8d3 100644 --- a/packages/desktop/src/components/file-tree.tsx +++ b/packages/desktop/src/components/file-tree.tsx @@ -1,6 +1,7 @@ import { useLocal, type LocalFile } from "@/context/local" -import { Tooltip } from "@opencode-ai/ui" -import { Collapsible, FileIcon } from "@/ui" +import { Collapsible } from "@/ui" +import { FileIcon } from "@opencode-ai/ui/file-icon" +import { Tooltip } from "@opencode-ai/ui/tooltip" import { For, Match, Switch, Show, type ComponentProps, type ParentProps } from "solid-js" import { Dynamic } from "solid-js/web" diff --git a/packages/desktop/src/components/message-progress.tsx b/packages/desktop/src/components/message-progress.tsx deleted file mode 100644 index a9be2ae5e..000000000 --- a/packages/desktop/src/components/message-progress.tsx +++ /dev/null @@ -1,187 +0,0 @@ -import { For, JSXElement, Match, Show, Switch, createEffect, createMemo, createSignal, onCleanup } from "solid-js" -import { Part } from "@opencode-ai/ui" -import { useSync } from "@/context/sync" -import type { AssistantMessage as AssistantMessageType, ToolPart } from "@opencode-ai/sdk" -import { Spinner } from "./spinner" - -export function MessageProgress(props: { assistantMessages: () => AssistantMessageType[]; done?: boolean }) { - const sync = useSync() - const parts = createMemo(() => props.assistantMessages().flatMap((m) => sync.data.part[m.id])) - const done = createMemo(() => props.done ?? false) - const currentTask = createMemo( - () => - parts().findLast( - (p) => - p && - p.type === "tool" && - p.tool === "task" && - p.state && - "metadata" in p.state && - p.state.metadata && - p.state.metadata.sessionId && - p.state.status === "running", - ) as ToolPart, - ) - const resolvedParts = createMemo(() => { - let resolved = parts() - const task = currentTask() - if (task && task.state && "metadata" in task.state && task.state.metadata?.sessionId) { - const messages = sync.data.message[task.state.metadata.sessionId as string]?.filter((m) => m.role === "assistant") - resolved = messages?.flatMap((m) => sync.data.part[m.id]) ?? parts() - } - return resolved - }) - // const currentText = createMemo( - // () => - // resolvedParts().findLast((p) => p?.type === "text")?.text || - // resolvedParts().findLast((p) => p?.type === "reasoning")?.text, - // ) - const eligibleItems = createMemo(() => { - return resolvedParts().filter((p) => p?.type === "tool" && p?.state.status === "completed") as ToolPart[] - }) - const finishedItems = createMemo<(JSXElement | ToolPart)[]>(() => [ -
, -
, -
, - ...eligibleItems(), - ...(done() ? [
,
,
] : []), - ]) - - const delay = createMemo(() => (done() ? 220 : 400)) - const [visibleCount, setVisibleCount] = createSignal(eligibleItems().length) - - createEffect(() => { - const total = finishedItems().length - if (total > visibleCount()) { - const timer = setTimeout(() => { - setVisibleCount((prev) => prev + 1) - }, delay()) - onCleanup(() => clearTimeout(timer)) - } else if (total < visibleCount()) { - setVisibleCount(total) - } - }) - - const translateY = createMemo(() => { - const total = visibleCount() - if (total < 2) return "0px" - return `-${(total - 2) * 40 - 8}px` - }) - - const lastPart = createMemo(() => resolvedParts().slice(-1)?.at(0)) - const rawStatus = createMemo(() => { - const last = lastPart() - if (!last) return undefined - - if (last.type === "tool") { - switch (last.tool) { - case "task": - return "Delegating work..." - case "todowrite": - case "todoread": - return "Planning next steps..." - case "read": - return "Gathering context..." - case "list": - case "grep": - case "glob": - return "Searching the codebase..." - case "webfetch": - return "Searching the web..." - case "edit": - case "write": - return "Making edits..." - case "bash": - return "Running commands..." - default: - break - } - } else if (last.type === "reasoning") { - return "Thinking..." - } else if (last.type === "text") { - return "Gathering thoughts..." - } - return undefined - }) - - const [status, setStatus] = createSignal(rawStatus()) - let lastStatusChange = Date.now() - let statusTimeout: number | undefined - - createEffect(() => { - const newStatus = rawStatus() - if (newStatus === status() || !newStatus) return - - const timeSinceLastChange = Date.now() - lastStatusChange - - if (timeSinceLastChange >= 1500) { - setStatus(newStatus) - lastStatusChange = Date.now() - if (statusTimeout) { - clearTimeout(statusTimeout) - statusTimeout = undefined - } - } else { - if (statusTimeout) clearTimeout(statusTimeout) - statusTimeout = setTimeout(() => { - setStatus(rawStatus()) - lastStatusChange = Date.now() - statusTimeout = undefined - }, 1000 - timeSinceLastChange) as unknown as number - } - }) - - return ( -
- {/* */} - {/* {(text) => ( */} - {/*
*/} - {/* */} - {/*
*/} - {/* )} */} - {/*
*/} -
- {status() ?? "Considering next steps..."} -
- 0}> -
-
- - {(part) => ( - - - {(p) => { - const part = p() as ToolPart - const message = createMemo(() => - sync.data.message[part.sessionID].find((m) => m.id === part.messageID), - ) - return ( -
- -
- ) - }} -
- -
{part as JSXElement}
-
-
- )} -
-
-
-
-
- ) -} diff --git a/packages/desktop/src/components/prompt-input.tsx b/packages/desktop/src/components/prompt-input.tsx index b2e552f71..94d8ff882 100644 --- a/packages/desktop/src/components/prompt-input.tsx +++ b/packages/desktop/src/components/prompt-input.tsx @@ -1,8 +1,6 @@ -import { Button, Icon, IconButton, Select, SelectDialog, Tooltip } from "@opencode-ai/ui" import { useFilteredList } from "@opencode-ai/ui/hooks" import { createEffect, on, Component, Show, For, onMount, onCleanup, Switch, Match } from "solid-js" import { createStore } from "solid-js/store" -import { FileIcon } from "@/ui" import { getDirectory, getFilename } from "@/utils" import { createFocusSignal } from "@solid-primitives/active-element" import { useLocal } from "@/context/local" @@ -11,6 +9,13 @@ import { ContentPart, DEFAULT_PROMPT, isPromptEqual, Prompt, useSession } from " import { useSDK } from "@/context/sdk" import { useNavigate } from "@solidjs/router" import { useSync } from "@/context/sync" +import { FileIcon } from "@opencode-ai/ui/file-icon" +import { SelectDialog } from "@opencode-ai/ui/select-dialog" +import { Button } from "@opencode-ai/ui/button" +import { Icon } from "@opencode-ai/ui/icon" +import { Tooltip } from "@opencode-ai/ui/tooltip" +import { IconButton } from "@opencode-ai/ui/icon-button" +import { Select } from "@opencode-ai/ui/select" interface PromptInputProps { class?: string @@ -184,8 +189,8 @@ export const PromptInput: Component = (props) => { const range = selection.getRangeAt(0) if (atMatch) { - let node: Node | null = range.startContainer - let offset = range.startOffset + // let node: Node | null = range.startContainer + // let offset = range.startOffset let runningLength = 0 const walker = document.createTreeWalker(editorRef, NodeFilter.SHOW_TEXT, null) @@ -448,7 +453,7 @@ export const PromptInput: Component = (props) => { {(i) => (
- +
{i.name} diff --git a/packages/desktop/src/components/session-review.tsx b/packages/desktop/src/components/session-review.tsx deleted file mode 100644 index 6022164c5..000000000 --- a/packages/desktop/src/components/session-review.tsx +++ /dev/null @@ -1,104 +0,0 @@ -import { useSession } from "@/context/session" -import { FileIcon } from "@/ui" -import { getDirectory, getFilename } from "@/utils" -import { Accordion, Button, Diff, DiffChanges, Icon, IconButton, Tooltip } from "@opencode-ai/ui" -import { For, Match, Show, Switch } from "solid-js" -import { StickyAccordionHeader } from "./sticky-accordion-header" -import { createStore } from "solid-js/store" -import { useLayout } from "@/context/layout" - -export const SessionReview = (props: { split?: boolean; class?: string; hideExpand?: boolean }) => { - const layout = useLayout() - const session = useSession() - const [store, setStore] = createStore({ - open: session.diffs().map((d) => d.file), - }) - - const handleChange = (open: string[]) => { - setStore("open", open) - } - - const handleExpandOrCollapseAll = () => { - if (store.open.length > 0) { - setStore("open", []) - } else { - setStore( - "open", - session.diffs().map((d) => d.file), - ) - } - } - - return ( -
-
-
Session changes
-
- - - - { - layout.review.tab() - session.layout.setActiveTab("review") - }} - /> - - -
-
- - - {(diff) => ( - - - -
-
- -
- - {getDirectory(diff.file)}‎ - - {getFilename(diff.file)} -
-
-
- - -
-
-
-
- - - -
- )} -
-
-
- ) -} diff --git a/packages/desktop/src/components/spinner.tsx b/packages/desktop/src/components/spinner.tsx deleted file mode 100644 index 5fc4cda64..000000000 --- a/packages/desktop/src/components/spinner.tsx +++ /dev/null @@ -1,39 +0,0 @@ -import { ComponentProps, For } from "solid-js" - -export function Spinner(props: { class?: string; classList?: ComponentProps<"div">["classList"] }) { - const squares = Array.from({ length: 16 }, (_, i) => ({ - id: i, - x: (i % 4) * 4, - y: Math.floor(i / 4) * 4, - delay: Math.random() * 3, - duration: 2 + Math.random() * 2, - })) - - return ( - - - {(square) => ( - - )} - - - ) -} diff --git a/packages/desktop/src/components/sticky-accordion-header.tsx b/packages/desktop/src/components/sticky-accordion-header.tsx deleted file mode 100644 index cb3f0d5eb..000000000 --- a/packages/desktop/src/components/sticky-accordion-header.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import { Accordion } from "@opencode-ai/ui" -import { ParentProps } from "solid-js" - -export function StickyAccordionHeader(props: ParentProps<{ class?: string }>) { - return ( - - {props.children} - - ) -} -- cgit v1.2.3