diff --git a/index.ts b/index.ts index 2287870..626db09 100644 --- a/index.ts +++ b/index.ts @@ -2,6 +2,7 @@ // a shared headless Firefox session. Provider config lives in // ~/.pi/pi-web/config.json (env overrides supported). import type { ExtensionAPI } from "@mariozechner/pi-coding-agent"; +import { Text } from "@mariozechner/pi-tui"; import { Type } from "typebox"; import { ConfigError, loadConfig, resolveSettings } from "./src/config.ts"; import { fetchPage, type FetchResult } from "./src/fetch.ts"; @@ -45,6 +46,15 @@ export default function (pi: ExtensionAPI) { parameters: Type.Object({ query: Type.String({ description: "Search query text" }), }), + renderCall(args, theme, context) { + const query = args?.query; + const display = query && query.length > 0 + ? query + : theme.fg("toolOutput", "..."); + const text = new Text("", 0, 0); + text.setText(theme.fg("toolTitle", theme.bold(`web_search "${display}"`))); + return text; + }, async execute(_toolCallId, params) { try { const results = await runSearch(params.query); @@ -74,6 +84,15 @@ export default function (pi: ExtensionAPI) { parameters: Type.Object({ url: Type.String({ description: "Absolute URL to fetch" }), }), + renderCall(args, theme, context) { + const url = args?.url; + const display = url && url.length > 0 + ? url + : theme.fg("toolOutput", "..."); + const text = new Text("", 0, 0); + text.setText(theme.fg("toolTitle", theme.bold(`web_fetch ${display}`))); + return text; + }, async execute(_toolCallId, params) { try { const result = await fetchPage({ url: params.url });