xonecas.io
64875
Mc

mini-coder / files

mini-coder / src / tools / common.ts

825 bytes
1import type { ImageContent } from "@earendil-works/pi-ai";
2
3export interface ToolContext {
4  signal: AbortSignal;
5  /** Whether the current model accepts image input. */
6  supportsImages: boolean;
7  onOutput?: (chunk: string) => void;
8}
9
10/** One changed file, display-only; never reaches the model. */
11export interface FileDiff {
12  /** Path relative to the working directory. */
13  path: string;
14  /** Unified diff body; absent when content cannot be tracked. */
15  patch?: string;
16  /** Why no patch is available, e.g. "binary file changed". */
17  note?: string;
18}
19
20export interface ToolResult {
21  text: string;
22  isError: boolean;
23  /** Image blocks appended to the tool result, after `text`. */
24  images?: ImageContent[];
25  /** Files the tool changed under the working directory, for display only. */
26  diffs?: FileDiff[];
27}