mirror of
https://github.com/aljazceru/opencode.git
synced 2025-12-21 17:54:23 +01:00
wip: desktop work
This commit is contained in:
4
bun.lock
4
bun.lock
@@ -347,7 +347,7 @@
|
|||||||
"@hono/zod-validator": "0.4.2",
|
"@hono/zod-validator": "0.4.2",
|
||||||
"@kobalte/core": "0.13.11",
|
"@kobalte/core": "0.13.11",
|
||||||
"@openauthjs/openauth": "0.0.0-20250322224806",
|
"@openauthjs/openauth": "0.0.0-20250322224806",
|
||||||
"@pierre/precision-diffs": "0.3.6",
|
"@pierre/precision-diffs": "0.4.1",
|
||||||
"@solidjs/meta": "0.29.4",
|
"@solidjs/meta": "0.29.4",
|
||||||
"@tailwindcss/vite": "4.1.11",
|
"@tailwindcss/vite": "4.1.11",
|
||||||
"@tsconfig/bun": "1.0.9",
|
"@tsconfig/bun": "1.0.9",
|
||||||
@@ -941,7 +941,7 @@
|
|||||||
|
|
||||||
"@petamoriken/float16": ["@petamoriken/float16@3.9.2", "", {}, "sha512-VgffxawQde93xKxT3qap3OH+meZf7VaSB5Sqd4Rqc+FP5alWbpOyan/7tRbOAvynjpG3GpdtAuGU/NdhQpmrog=="],
|
"@petamoriken/float16": ["@petamoriken/float16@3.9.2", "", {}, "sha512-VgffxawQde93xKxT3qap3OH+meZf7VaSB5Sqd4Rqc+FP5alWbpOyan/7tRbOAvynjpG3GpdtAuGU/NdhQpmrog=="],
|
||||||
|
|
||||||
"@pierre/precision-diffs": ["@pierre/precision-diffs@0.3.6", "", { "dependencies": { "@shikijs/core": "3.13.0", "@shikijs/transformers": "3.13.0", "diff": "8.0.2", "fast-deep-equal": "3.1.3", "hast-util-to-html": "9.0.5", "shiki": "3.13.0" }, "peerDependencies": { "react": "^18.3.1 || ^19.0.0", "react-dom": "^18.3.1 || ^19.0.0" } }, "sha512-cKM3HcMmyr5wPFll0bHYcgHplcHgMlL6Dw4Pi4giL0jVt7ySlGwwVyXTRFW5Fva43stOL+EWB+9U5VBDSktBJA=="],
|
"@pierre/precision-diffs": ["@pierre/precision-diffs@0.4.1", "", { "dependencies": { "@shikijs/core": "3.13.0", "@shikijs/transformers": "3.13.0", "diff": "8.0.2", "fast-deep-equal": "3.1.3", "hast-util-to-html": "9.0.5", "shiki": "3.13.0" }, "peerDependencies": { "react": "^18.3.1 || ^19.0.0", "react-dom": "^18.3.1 || ^19.0.0" } }, "sha512-AoozHakINGyNJFgbYc/1PlDK0yunrAxbtXEMBe9fdu8RLkNjVtYRTLw7EF2mM/YuVoVRjj2HT/2VJ4a2rMyDOA=="],
|
||||||
|
|
||||||
"@pkgjs/parseargs": ["@pkgjs/parseargs@0.11.0", "", {}, "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg=="],
|
"@pkgjs/parseargs": ["@pkgjs/parseargs@0.11.0", "", {}, "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg=="],
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
"@tsconfig/bun": "1.0.9",
|
"@tsconfig/bun": "1.0.9",
|
||||||
"@cloudflare/workers-types": "4.20251008.0",
|
"@cloudflare/workers-types": "4.20251008.0",
|
||||||
"@openauthjs/openauth": "0.0.0-20250322224806",
|
"@openauthjs/openauth": "0.0.0-20250322224806",
|
||||||
"@pierre/precision-diffs": "0.3.6",
|
"@pierre/precision-diffs": "0.4.1",
|
||||||
"@solidjs/meta": "0.29.4",
|
"@solidjs/meta": "0.29.4",
|
||||||
"@tailwindcss/vite": "4.1.11",
|
"@tailwindcss/vite": "4.1.11",
|
||||||
"diff": "8.0.2",
|
"diff": "8.0.2",
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ registerPartComponent("text", function TextPartDisplay(props) {
|
|||||||
const part = props.part as TextPart
|
const part = props.part as TextPart
|
||||||
return (
|
return (
|
||||||
<Show when={part.text.trim()}>
|
<Show when={part.text.trim()}>
|
||||||
<Markdown text={part.text.trim()} />
|
<Markdown text={part.text.trim()} class="mt-8" />
|
||||||
</Show>
|
</Show>
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
@@ -36,9 +36,12 @@ registerPartComponent("tool", function ToolPartDisplay(props) {
|
|||||||
const metadata = part.state.status === "pending" ? {} : (part.state.metadata ?? {})
|
const metadata = part.state.status === "pending" ? {} : (part.state.metadata ?? {})
|
||||||
const input = part.state.status === "completed" ? part.state.input : {}
|
const input = part.state.status === "completed" ? part.state.input : {}
|
||||||
|
|
||||||
if (part.state.status === "error") {
|
return (
|
||||||
const error = part.state.error.replace("Error: ", "")
|
<Switch>
|
||||||
const [title, ...rest] = error.split(": ")
|
<Match when={part.state.status === "error" && part.state.error}>
|
||||||
|
{(error) => {
|
||||||
|
const cleaned = error().replace("Error: ", "")
|
||||||
|
const [title, ...rest] = cleaned.split(": ")
|
||||||
return (
|
return (
|
||||||
<Card variant="error">
|
<Card variant="error">
|
||||||
<div class="flex items-center gap-2">
|
<div class="flex items-center gap-2">
|
||||||
@@ -50,14 +53,14 @@ registerPartComponent("tool", function ToolPartDisplay(props) {
|
|||||||
<span>{rest.join(": ")}</span>
|
<span>{rest.join(": ")}</span>
|
||||||
</div>
|
</div>
|
||||||
</Match>
|
</Match>
|
||||||
<Match when={true}>{error}</Match>
|
<Match when={true}>{cleaned}</Match>
|
||||||
</Switch>
|
</Switch>
|
||||||
</div>
|
</div>
|
||||||
</Card>
|
</Card>
|
||||||
)
|
)
|
||||||
}
|
}}
|
||||||
|
</Match>
|
||||||
return (
|
<Match when={true}>
|
||||||
<Dynamic
|
<Dynamic
|
||||||
component={render}
|
component={render}
|
||||||
input={input}
|
input={input}
|
||||||
@@ -66,6 +69,8 @@ registerPartComponent("tool", function ToolPartDisplay(props) {
|
|||||||
output={part.state.status === "completed" ? part.state.output : undefined}
|
output={part.state.status === "completed" ? part.state.output : undefined}
|
||||||
hideDetails={props.hideDetails}
|
hideDetails={props.hideDetails}
|
||||||
/>
|
/>
|
||||||
|
</Match>
|
||||||
|
</Switch>
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -832,7 +832,7 @@ export default function Page() {
|
|||||||
</div>
|
</div>
|
||||||
</Collapsible.Trigger>
|
</Collapsible.Trigger>
|
||||||
<Collapsible.Content>
|
<Collapsible.Content>
|
||||||
<div class="w-full flex flex-col items-start self-stretch gap-8">
|
<div class="w-full flex flex-col items-start self-stretch gap-3">
|
||||||
<For each={assistantMessages()}>
|
<For each={assistantMessages()}>
|
||||||
{(assistantMessage) => {
|
{(assistantMessage) => {
|
||||||
const parts = createMemo(
|
const parts = createMemo(
|
||||||
|
|||||||
@@ -3,12 +3,12 @@ import {
|
|||||||
FileDiff,
|
FileDiff,
|
||||||
type DiffLineAnnotation,
|
type DiffLineAnnotation,
|
||||||
type HunkData,
|
type HunkData,
|
||||||
DiffFileRendererOptions,
|
FileDiffOptions,
|
||||||
// registerCustomTheme,
|
// registerCustomTheme,
|
||||||
} from "@pierre/precision-diffs"
|
} from "@pierre/precision-diffs"
|
||||||
import { ComponentProps, createEffect, splitProps } from "solid-js"
|
import { ComponentProps, createEffect, splitProps } from "solid-js"
|
||||||
|
|
||||||
export type DiffProps<T = {}> = Omit<DiffFileRendererOptions<T>, "themes"> & {
|
export type DiffProps<T = {}> = FileDiffOptions<T> & {
|
||||||
before: FileContents
|
before: FileContents
|
||||||
after: FileContents
|
after: FileContents
|
||||||
annotations?: DiffLineAnnotation<T>[]
|
annotations?: DiffLineAnnotation<T>[]
|
||||||
@@ -54,13 +54,9 @@ export function Diff<T>(props: DiffProps<T>) {
|
|||||||
// When ready to render, simply call .render with old/new file, optional
|
// When ready to render, simply call .render with old/new file, optional
|
||||||
// annotations and a container element to hold the diff
|
// annotations and a container element to hold the diff
|
||||||
createEffect(() => {
|
createEffect(() => {
|
||||||
// @ts-expect-error
|
|
||||||
const instance = new FileDiff<T>({
|
const instance = new FileDiff<T>({
|
||||||
// theme: "pierre-light",
|
// theme: "pierre-light",
|
||||||
// theme: "pierre-light",
|
theme: { dark: "pierre-dark", light: "pierre-light" },
|
||||||
// Or can also provide a 'themes' prop, which allows the code to adapt
|
|
||||||
// to your OS light or dark theme
|
|
||||||
themes: { dark: "pierre-dark", light: "pierre-light" },
|
|
||||||
// When using the 'themes' prop, 'themeType' allows you to force 'dark'
|
// When using the 'themes' prop, 'themeType' allows you to force 'dark'
|
||||||
// or 'light' theme, or inherit from the OS ('system') theme.
|
// or 'light' theme, or inherit from the OS ('system') theme.
|
||||||
themeType: "system",
|
themeType: "system",
|
||||||
|
|||||||
@@ -55,11 +55,7 @@ export function AssistantMessageDisplay(props: { message: AssistantMessage; part
|
|||||||
return x.type !== "tool" || (x as ToolPart).tool !== "todoread"
|
return x.type !== "tool" || (x as ToolPart).tool !== "todoread"
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
return (
|
return <For each={filteredParts()}>{(part) => <Part part={part} message={props.message} />}</For>
|
||||||
<div data-component="assistant-message">
|
|
||||||
<For each={filteredParts()}>{(part) => <Part part={part} message={props.message} />}</For>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function UserMessageDisplay(props: { message: UserMessage; parts: PartType[] }) {
|
export function UserMessageDisplay(props: { message: UserMessage; parts: PartType[] }) {
|
||||||
|
|||||||
Reference in New Issue
Block a user