/** * tool-result-helpers.ts — Shared helpers for formatting tool results, * notifications, and agent status used by index.ts tools. */ import type { AgentRecord, NotificationDetails } from "./types.js"; import type { AgentActivity, AgentDetails } from "./ui/agent-ui-types.js"; import { type LifetimeUsage } from "./usage.js"; /** Tool execute return value for a text response. */ export declare function textResult(msg: string, details?: AgentDetails): { content: { type: "text"; text: string; }[]; details: any; }; /** Format an agent's lifetime token total, or "" when zero. */ export declare function formatLifetimeTokens(o: { lifetimeUsage: LifetimeUsage; }): string; /** * Create an AgentActivity state and spawn callbacks for tracking tool usage. * Used by both foreground and background paths to avoid duplication. */ export declare function createActivityTracker(maxTurns?: number, onStreamUpdate?: () => void): { state: AgentActivity; callbacks: { onToolActivity: (activity: { type: "start" | "end"; toolName: string; }) => void; onTextDelta: (_delta: string, fullText: string) => void; onTurnEnd: (turnCount: number) => void; onSessionCreated: (session: any) => void; onAssistantUsage: (usage: { input: number; output: number; cacheWrite: number; }) => void; }; }; /** Human-readable status label for agent completion. */ export declare function getStatusLabel(status: string, error?: string): string; /** Parenthetical status note for completed agent result text. */ export declare function getStatusNote(status: string): string; /** Escape XML special characters to prevent injection in structured notifications. */ export declare function escapeXml(s: string): string; /** Format a structured task notification matching Claude Code's XML. */ export declare function formatTaskNotification(record: AgentRecord, resultMaxLen: number): string; /** Build AgentDetails from a base + record-specific fields. */ export declare function buildDetails(base: Pick, record: Pick, activity?: AgentActivity, overrides?: Partial): AgentDetails; /** Build notification details for the custom message renderer. */ export declare function buildNotificationDetails(record: AgentRecord, resultMaxLen: number, activity?: AgentActivity): NotificationDetails;