From 749e7838a444d6f2f846bd7e6e008edae25b0c69 Mon Sep 17 00:00:00 2001 From: Jay V Date: Tue, 15 Jul 2025 17:12:09 -0400 Subject: [PATCH] docs: share page task tool --- packages/web/src/components/Share.tsx | 1 + packages/web/src/components/icons/custom.tsx | 8 +++ .../share/content-markdown.module.css | 16 ++--- .../src/components/share/content-markdown.tsx | 10 +-- .../web/src/components/share/part.module.css | 28 ++++++++- packages/web/src/components/share/part.tsx | 62 ++++++++++++------- 6 files changed, 86 insertions(+), 39 deletions(-) diff --git a/packages/web/src/components/Share.tsx b/packages/web/src/components/Share.tsx index d5eebd45d..c75b5afb6 100644 --- a/packages/web/src/components/Share.tsx +++ b/packages/web/src/components/Share.tsx @@ -340,6 +340,7 @@ export default function Share(props: { const filteredParts = createMemo(() => msg.parts.filter((x, index) => { if (x.type === "step-start" && index > 0) return false + if (x.type === "snapshot") return false if (x.type === "step-finish") return false if (x.type === "text" && x.synthetic === true) return false if (x.type === "tool" && x.tool === "todoread") return false diff --git a/packages/web/src/components/icons/custom.tsx b/packages/web/src/components/icons/custom.tsx index 95f64c191..ba06ddfb3 100644 --- a/packages/web/src/components/icons/custom.tsx +++ b/packages/web/src/components/icons/custom.tsx @@ -58,3 +58,11 @@ export function IconMeta(props: JSX.SvgSVGAttributes) { ) } + +// https://icones.js.org/collection/ri?s=robot&icon=ri:robot-2-line +export function IconRobot(props: JSX.SvgSVGAttributes) { + return ( + + + ) +} diff --git a/packages/web/src/components/share/content-markdown.module.css b/packages/web/src/components/share/content-markdown.module.css index 0e6b83620..3e38ddf02 100644 --- a/packages/web/src/components/share/content-markdown.module.css +++ b/packages/web/src/components/share/content-markdown.module.css @@ -1,21 +1,13 @@ .root { - border: 1px solid var(--sl-color-blue-high); - padding: 0.5rem calc(0.5rem + 3px); - border-radius: 0.25rem; display: flex; flex-direction: column; align-items: flex-start; gap: 1rem; - align-self: flex-start; - - &[data-highlight="true"] { - background-color: var(--sl-color-blue-low); - } [data-slot="expand-button"] { flex: 0 0 auto; padding: 2px 0; - font-size: 0.75rem; + font-size: 0.857em; } [data-slot="markdown"] { @@ -29,7 +21,7 @@ display: block; } - font-size: 0.875rem; + font-size: 1em; line-height: 1.5; p, @@ -61,7 +53,7 @@ h4, h5, h6 { - font-size: 0.875rem; + font-size: 1em; font-weight: 600; margin-bottom: 0.5rem; } @@ -75,7 +67,7 @@ background-color: var(--sl-color-bg-surface) !important; padding: 0.5rem 0.75rem; line-height: 1.6; - font-size: 0.75rem; + font-size: 0.857em; white-space: pre-wrap; word-break: break-word; diff --git a/packages/web/src/components/share/content-markdown.tsx b/packages/web/src/components/share/content-markdown.tsx index f79271296..a083872e7 100644 --- a/packages/web/src/components/share/content-markdown.tsx +++ b/packages/web/src/components/share/content-markdown.tsx @@ -1,10 +1,10 @@ -import style from "./content-markdown.module.css" -import { createResource, createSignal } from "solid-js" -import { createOverflow } from "./common" -import { transformerNotationDiff } from "@shikijs/transformers" import { marked } from "marked" -import markedShiki from "marked-shiki" import { codeToHtml } from "shiki" +import markedShiki from "marked-shiki" +import { createOverflow } from "./common" +import { createResource, createSignal } from "solid-js" +import { transformerNotationDiff } from "@shikijs/transformers" +import style from "./content-markdown.module.css" const markedWithShiki = marked.use( markedShiki({ diff --git a/packages/web/src/components/share/part.module.css b/packages/web/src/components/share/part.module.css index 5ffb83f6b..17018fa02 100644 --- a/packages/web/src/components/share/part.module.css +++ b/packages/web/src/components/share/part.module.css @@ -103,7 +103,7 @@ [data-component="content"] { flex: 1 1 auto; min-width: 0; - padding: 0 0 0.375rem; + padding: 0 0 1rem; display: flex; flex-direction: column; gap: 1rem; @@ -135,6 +135,14 @@ gap: 1rem; flex-grow: 1; max-width: var(--md-tool-width); + + & > [data-component="assistant-text-markdown"] { + align-self: flex-start; + font-size: 0.875rem; + border: 1px solid var(--sl-color-blue-high); + padding: 0.5rem calc(0.5rem + 3px); + border-radius: 0.25rem; + } } [data-component="step-start"] { @@ -239,6 +247,24 @@ max-width: var(--lg-tool-width); } } + &[data-tool="task"] { + [data-component="tool-input"] { + font-size: 0.75rem; + line-height: 1.5; + max-width: var(--sm-tool-width); + display: -webkit-box; + -webkit-line-clamp: 3; + -webkit-box-orient: vertical; + overflow: hidden; + } + [data-component="tool-output"] { + max-width: var(--sm-tool-width); + font-size: 0.75rem; + border: 1px solid var(--sl-color-divider); + padding: 0.5rem calc(0.5rem + 3px); + border-radius: 0.25rem; + } + } } [data-component="tool-title"] { diff --git a/packages/web/src/components/share/part.tsx b/packages/web/src/components/share/part.tsx index fcfa8bec4..4a9320e6d 100644 --- a/packages/web/src/components/share/part.tsx +++ b/packages/web/src/components/share/part.tsx @@ -19,25 +19,25 @@ import { IconMagnifyingGlass, IconDocumentMagnifyingGlass, } from "../icons" -import { IconMeta, IconOpenAI, IconGemini, IconAnthropic } from "../icons/custom" -import { formatDuration } from "../share/common" +import { IconMeta, IconRobot, IconOpenAI, IconGemini, IconAnthropic } from "../icons/custom" import { ContentCode } from "./content-code" import { ContentDiff } from "./content-diff" import { ContentText } from "./content-text" -import { ContentError } from "./content-error" -import { ContentMarkdown } from "./content-markdown" import { ContentBash } from "./content-bash" +import { ContentError } from "./content-error" +import { formatDuration } from "../share/common" +import { ContentMarkdown } from "./content-markdown" import type { MessageV2 } from "opencode/session/message-v2" import type { Diagnostic } from "vscode-languageserver-types" import styles from "./part.module.css" -const MIN_DURATION = 2 +const MIN_DURATION = 2000 export interface PartProps { index: number message: MessageV2.Info - part: MessageV2.AssistantPart | MessageV2.UserPart + part: MessageV2.Part last: boolean } @@ -114,7 +114,7 @@ export function Part(props: PartProps) { - + @@ -131,12 +131,13 @@ export function Part(props: PartProps) { {props.message.role === "user" && props.part.type === "text" && (
-
)} {props.message.role === "assistant" && props.part.type === "text" && (
- +
+ +
{props.last && props.message.role === "assistant" && props.message.time.completed && (
)} -
)} {props.message.role === "user" && props.part.type === "file" && ( @@ -245,6 +245,14 @@ export function Part(props: PartProps) { state={props.part.state} />
+ + + + time={DateTime.fromMillis(props.part.state.time.end) + .diff(DateTime.fromMillis(props.part.state.time.start)) + .toMillis()} + /> )} @@ -636,12 +643,25 @@ function Footer(props: ParentProps<{ title: string }>) { } function ToolFooter(props: { time: number }) { - return props.time > MIN_DURATION ? ( -
- {formatDuration(props.time)} -
- ) : ( - + return props.time > MIN_DURATION &&
{formatDuration(props.time)}
+} + +function TaskTool(props: ToolProps) { + return ( + <> +
+ Task + {props.state.input.description} +
+
+ “{props.state.input.prompt}” +
+ +
+ +
+
+ ) }