From 160428d2d4ea9fcceff9cbb41cea55c5f96221fe Mon Sep 17 00:00:00 2001 From: Jay V Date: Wed, 4 Jun 2025 20:14:14 -0400 Subject: [PATCH] share page glob --- packages/web/src/components/Share.tsx | 97 +++++++++++++++++++- packages/web/src/components/share.module.css | 17 ++++ 2 files changed, 113 insertions(+), 1 deletion(-) diff --git a/packages/web/src/components/Share.tsx b/packages/web/src/components/Share.tsx index a1b49a8d..b6bd7fd0 100644 --- a/packages/web/src/components/Share.tsx +++ b/packages/web/src/components/Share.tsx @@ -25,6 +25,7 @@ import { IconMagnifyingGlass, IconWrenchScrewdriver, IconDocumentArrowDown, + IconDocumentMagnifyingGlass, } from "./icons" import DiffView from "./DiffView" import CodeBlock from "./CodeBlock" @@ -735,6 +736,100 @@ export default function Share(props: { api: string }) { )} + {/* Grep tool */} + + {(part) => { + const metadata = createMemo(() => + msg.metadata?.tool[part().toolInvocation.toolCallId] + ) + const args = part().toolInvocation.args + const result = part().toolInvocation.state === "result" && part().toolInvocation.result + const matches = metadata()?.matches + + const { pattern, ...rest } = args + + const duration = createMemo(() => + DateTime.fromMillis(metadata()?.time.end || 0).diff( + DateTime.fromMillis(metadata()?.time.start || 0), + ).toMillis(), + ) + + return ( +
+
+
+ +
+
+
+
+
+ + Grep + “{pattern}” + + 0}> +
+ + {([name, value]) => ( + <> +
+
{name}
+
{value}
+ + )} +
+
+
+ + 0}> +
+ showResults((e) => !e)} + /> + + + +
+
+ +
+ +
+
+
+
+ +
+
+ ) + }} +
{/* Glob tool */}
-
+
diff --git a/packages/web/src/components/share.module.css b/packages/web/src/components/share.module.css index 6d7f2519..ef450734 100644 --- a/packages/web/src/components/share.module.css +++ b/packages/web/src/components/share.module.css @@ -332,6 +332,23 @@ } } + [data-part-type="tool-grep"] { + &:not(:has([data-part-tool-args])) + > [data-section="content"] > [data-part-tool-body] { + gap: 0.5rem; + } + [data-part-title] { + display: flex; + align-items: flex-start; + gap: 0.5rem; + + b { + color: var(--sl-color-text); + word-break: break-all; + } + } + } + [data-part-type="tool-read"] { [data-part-tool-result] { [data-part-tool-code] {