From 5b86fa91099d66cdc876cd4209a97ae2c903d510 Mon Sep 17 00:00:00 2001
From: Adam <2363879+adamdotdevin@users.noreply.github.com>
Date: Wed, 29 Oct 2025 07:31:57 -0500
Subject: wip: desktop work
---
.../desktop/src/components/assistant-message.tsx | 70 ++++++++++------------
1 file changed, 33 insertions(+), 37 deletions(-)
(limited to 'packages/desktop/src/components')
diff --git a/packages/desktop/src/components/assistant-message.tsx b/packages/desktop/src/components/assistant-message.tsx
index 90f6e70fe..8c654660b 100644
--- a/packages/desktop/src/components/assistant-message.tsx
+++ b/packages/desktop/src/components/assistant-message.tsx
@@ -1,4 +1,4 @@
-import type { Part, AssistantMessage, ReasoningPart, TextPart, ToolPart } from "@opencode-ai/sdk"
+import type { Part, AssistantMessage, ReasoningPart, TextPart, ToolPart, Message } from "@opencode-ai/sdk"
import { children, Component, createMemo, For, Match, Show, Switch, type JSX } from "solid-js"
import { Dynamic } from "solid-js/web"
import { Markdown } from "./markdown"
@@ -17,47 +17,44 @@ import type { WriteTool } from "opencode/tool/write"
import type { TodoWriteTool } from "opencode/tool/todo"
import { DiffChanges } from "./diff-changes"
-export function AssistantMessage(props: { message: AssistantMessage; parts: Part[]; lastToolOnly?: boolean }) {
+export function AssistantMessage(props: { message: AssistantMessage; parts: Part[] }) {
const filteredParts = createMemo(() => {
- let tool = false
return props.parts?.filter((x) => {
- if (x.type === "tool" && props.lastToolOnly && tool) return false
- if (x.type === "tool") tool = true
+ if (x.type === "reasoning") return false
return x.type !== "tool" || x.tool !== "todoread"
})
})
return (
-
- {(part) => {
- const component = createMemo(() => PART_MAPPING[part.type as keyof typeof PART_MAPPING])
- return (
-
-
-
- )
- }}
-
+
{(part) => }
)
}
+export function Part(props: { part: Part; message: Message; readonly?: boolean }) {
+ const component = createMemo(() => PART_MAPPING[props.part.type as keyof typeof PART_MAPPING])
+ return (
+
+
+
+ )
+}
+
const PART_MAPPING = {
text: TextPart,
tool: ToolPart,
reasoning: ReasoningPart,
}
-function ReasoningPart(props: { part: ReasoningPart; message: AssistantMessage }) {
- return null
- // return (
- //
- // {props.part.text}
- //
- // )
+function ReasoningPart(props: { part: ReasoningPart; message: Message }) {
+ return (
+
+
+
+ )
}
-function TextPart(props: { part: TextPart; message: AssistantMessage }) {
+function TextPart(props: { part: TextPart; message: Message }) {
return (
@@ -65,17 +62,11 @@ function TextPart(props: { part: TextPart; message: AssistantMessage }) {
)
}
-function ToolPart(props: { part: ToolPart; message: AssistantMessage }) {
- // const sync = useSync()
-
+function ToolPart(props: { part: ToolPart; message: Message; readonly?: boolean }) {
const component = createMemo(() => {
const render = ToolRegistry.render(props.part.tool) ?? GenericTool
-
const metadata = props.part.state.status === "pending" ? {} : (props.part.state.metadata ?? {})
const input = props.part.state.status === "completed" ? props.part.state.input : {}
- // const permissions = sync.data.permission[props.message.sessionID] ?? []
- // const permissionIndex = permissions.findIndex((x) => x.callID === props.part.callID)
- // const permission = permissions[permissionIndex]
return (
)
})
@@ -106,7 +97,12 @@ const isTriggerTitle = (val: any): val is TriggerTitle => {
return typeof val === "object" && val !== null && "title" in val && !(val instanceof Node)
}
-function BasicTool(props: { icon: IconProps["name"]; trigger: TriggerTitle | JSX.Element; children?: JSX.Element }) {
+function BasicTool(props: {
+ icon: IconProps["name"]
+ trigger: TriggerTitle | JSX.Element
+ children?: JSX.Element
+ readonly?: boolean
+}) {
const resolved = children(() => props.children)
return (
@@ -161,13 +157,13 @@ function BasicTool(props: { icon: IconProps["name"]; trigger: TriggerTitle | JSX
-
+
-
- {props.children}
+
+ {resolved()}
// <>
@@ -177,15 +173,15 @@ function BasicTool(props: { icon: IconProps["name"]; trigger: TriggerTitle | JSX
}
function GenericTool(props: ToolProps) {
- return
+ return
}
type ToolProps = {
input: Partial>
metadata: Partial>
- // permission: Record
tool: string
output?: string
+ readonly?: boolean
}
const ToolRegistry = (() => {
--
cgit v1.2.3