From 545f34584847e3216ecf95ab493dacac282ec465 Mon Sep 17 00:00:00 2001 From: Adam <2363879+adamdotdevin@users.noreply.github.com> Date: Tue, 28 Oct 2025 15:29:11 -0500 Subject: wip: desktop work --- packages/desktop/src/pages/index.tsx | 136 +++++++++++++++++------------------ 1 file changed, 68 insertions(+), 68 deletions(-) (limited to 'packages/desktop/src/pages') diff --git a/packages/desktop/src/pages/index.tsx b/packages/desktop/src/pages/index.tsx index b4bd36162..c1884b2c0 100644 --- a/packages/desktop/src/pages/index.tsx +++ b/packages/desktop/src/pages/index.tsx @@ -1,8 +1,19 @@ -import { Button, List, SelectDialog, Tooltip, IconButton, Tabs, Icon, Accordion, Diff } from "@opencode-ai/ui" +import { + Button, + List, + SelectDialog, + Tooltip, + IconButton, + Tabs, + Icon, + Accordion, + Diff, + Collapsible, +} from "@opencode-ai/ui" import { FileIcon } from "@/ui" import FileTree from "@/components/file-tree" import { For, onCleanup, onMount, Show, Match, Switch, createSignal, createEffect, createMemo } from "solid-js" -import { useLocal, type LocalFile, type TextSelection } from "@/context/local" +import { useLocal, type LocalFile } from "@/context/local" import { createStore } from "solid-js/store" import { getDirectory, getFilename } from "@/utils" import { ContentPart, PromptInput } from "@/components/prompt-input" @@ -185,42 +196,10 @@ export default function Page() { } if (!session) return - interface SubmissionAttachment { - path: string - selection?: TextSelection - label: string - } - - const createAttachmentKey = (path: string, selection?: TextSelection) => { - if (!selection) return path - return `${path}:${selection.startLine}:${selection.startChar}:${selection.endLine}:${selection.endChar}` - } - - const formatAttachmentLabel = (path: string, selection?: TextSelection) => { - if (!selection) return getFilename(path) - return `${getFilename(path)} (${selection.startLine}-${selection.endLine})` - } - const toAbsolutePath = (path: string) => (path.startsWith("/") ? path : sync.absolute(path)) const text = parts.map((part) => part.content).join("") - const attachments = new Map() - - const registerAttachment = (path: string, selection: TextSelection | undefined, label?: string) => { - if (!path) return - const key = createAttachmentKey(path, selection) - if (attachments.has(key)) return - attachments.set(key, { - path, - selection, - label: label ?? formatAttachmentLabel(path, selection), - }) - } - - const promptAttachments = parts.filter((part) => part.type === "file") - for (const part of promptAttachments) { - registerAttachment(part.path, part.selection, part.content) - } + const attachments = parts.filter((part) => part.type === "file") // const activeFile = local.context.active() // if (activeFile) { @@ -239,7 +218,7 @@ export default function Page() { // ) // } - const attachmentParts = Array.from(attachments.values()).map((attachment) => { + const attachmentParts = attachments.map((attachment) => { const absolute = toAbsolutePath(attachment.path) const query = attachment.selection ? `?start=${attachment.selection.startLine}&end=${attachment.selection.endLine}` @@ -252,9 +231,9 @@ export default function Page() { source: { type: "file" as const, text: { - value: `@${attachment.label}`, - start: 0, - end: 0, + value: attachment.content, + start: attachment.start, + end: attachment.end, }, path: absolute, }, @@ -510,8 +489,8 @@ export default function Page() { - -
+ +
{(activeSession) => ( -
+
1}>
    @@ -665,30 +644,65 @@ export default function Page() { (m) => m.role === "assistant" && m.parentID == message.id, ) as AssistantMessageType[] }) + const working = createMemo(() => { + const last = assistantMessages()[assistantMessages().length - 1] + if (!last) return false + return !last.time.completed + }) + const lastWithContent = createMemo(() => + assistantMessages().findLast((m) => { + const parts = sync.data.part[m.id] + return parts?.find((p) => p.type === "text" || p.type === "tool") + }), + ) return ( -
    +
    {/* Title */} -
    +

    {title() ?? prompt()}

    - -
    {prompt()}
    +
    + +
    {prompt()}
    +
    + {/* Response */} +
    + + +
    +

    Show steps

    + +
    +
    + +
    + + {(assistantMessage) => { + const parts = createMemo(() => sync.data.part[assistantMessage.id]) + return + }} + +
    +
    +
    + + {(last) => { + const lastParts = createMemo(() => sync.data.part[last().id]) + return ( + + ) + }}
    {/* Summary */} -
    - + +

    Summary

    {summary()}
    - - {(diff) => ( @@ -735,22 +749,8 @@ export default function Page() { )} - -
    - {/* Response */} -
    -
    -

    Response

    -
    - - {(assistantMessage) => { - const parts = createMemo(() => sync.data.part[assistantMessage.id]) - return - }} - -
    -
    +
    ) }} -- cgit v1.2.3