@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
59 lines • 3.32 kB
TypeScript
import { type Static, Type } from "typebox";
import { type ExtensionToolContext, type ToolDefinition } from "../../core/extensions/types.ts";
import { type PendingHandedPages } from "./handed-pages.ts";
declare const Params: Type.TObject<{
html: Type.TString;
title: Type.TString;
height: Type.TOptional<Type.TInteger>;
}>;
export interface ShowHtmlPageDetails {
path: string;
title: string;
height: number | undefined;
prepared: boolean;
/**
* The page for a host that publishes it itself (the desktop renders it in the thread), never part
* of the model-visible content. When it fits MAX_HANDED_PAGE_CHARACTERS its local images are inlined
* as data URIs, so it needs no file on this machine and a viewer on another machine renders the same
* page; otherwise it is the page as the agent wrote it, and `imagesInlined` is false.
*/
html: string;
imagesInlined: boolean;
/**
* The exact text part this call's result carries, so a later step that rewrites the result (the brain's page
* budget for a hand) finds the page's own text whatever a `tool_result` handler added around it (senpi#6934).
* writeHtmlPage always sets it; a result a host route produced elsewhere may lack it.
*/
resultText?: string;
}
type ShowHtmlPageResult = Awaited<ReturnType<ToolDefinition<typeof Params, ShowHtmlPageDetails>["execute"]>>;
/**
* The standalone file producer, shared by CLI and desktop host attachments. `shownInline` says whether
* the host shows the page to the reader; the result states which happened, because the model trusts
* it in later turns too (senpi#6273). A host attachment serves its own renderer (the OmO desktop shows
* the page inline), so it defaults to true; the standalone tool passes what its session's surface does.
* The page is handed with its images inlined when it fits MAX_HANDED_PAGE_CHARACTERS; the session's
* budget across pages is applied by handHtmlPage, which sees the session.
*/
export declare function writeHtmlPage(params: Static<typeof Params>, cwd: string, shownInline?: boolean): Promise<ShowHtmlPageResult>;
/**
* handHtmlPage for a result a host route produced in another process: its params and details are checked
* here, and a result of another shape is recorded as the host returned it.
*/
export declare function handRoutedHtmlPage(toolCallId: string, params: unknown, ctx: ExtensionToolContext, pending: PendingHandedPages, result: Awaited<ReturnType<ToolDefinition["execute"]>>): Awaited<ReturnType<ToolDefinition["execute"]>>;
export declare function createShowHtmlPageTool(pending: PendingHandedPages): ToolDefinition<Type.TObject<{
html: Type.TString;
title: Type.TString;
height: Type.TOptional<Type.TInteger>;
}>, ShowHtmlPageDetails, any> & ToolDefinition<any, any, any>;
/**
* The tool's public descriptor (name, description, schema) for hosts that serve it. Every session runs
* its own instance from the html-render extension, so the pending-page ledger never spans sessions.
*/
export declare const showHtmlPageTool: ToolDefinition<Type.TObject<{
html: Type.TString;
title: Type.TString;
height: Type.TOptional<Type.TInteger>;
}>, ShowHtmlPageDetails, any> & ToolDefinition<any, any, any>;
export {};
//# sourceMappingURL=tool.d.ts.map