import type { SuperagentToolCall } from '../types'; /** * Pure logic backing the built-in tool widgets (src/toolWidgets) and the tool * timeline's argument previews (ToolCallSummary.tsx). Mirrors the * web builder's tools-ui helpers (frontend/apps/builder/.../tools-ui/utils.ts) * so the native widgets read the same statuses, labels and arguments as their * web counterparts. No RN imports here — everything is unit-testable in the * node environment. */ export type ToolWidgetStatus = 'running' | 'success' | 'error' | 'stopped' | 'waiting'; export declare function getWidgetStatus(status?: string): ToolWidgetStatus; /** * Widget status with the web card widgets' staleness correction * (CreateAutomationWidget / CreateWorkflowWidget / AgentBlueprint): a * running/pending status with results already present — or on a message that * is no longer the latest assistant turn (`isLastAssistantMessage === false`, * the turn ended without a status update) — means the call finished but the * status update was lost. Treat it as success so the card renders instead of * a stuck spinner. `undefined` chat position settles on results only * (backward compatible for hosts that don't supply it). */ export declare function getSettledWidgetStatus(toolCall: SuperagentToolCall, isLastAssistantMessage?: boolean): ToolWidgetStatus; /** * Whether an approval-capable widget may act for its chat position. Only an * explicit `false` (an older assistant turn — the submit endpoint resumes by * tool_call_id, so a stale card could resume out of order) blocks acting; * `undefined` means the host didn't supply chat position and is treated as * actionable for backward compatibility (web isLastAssistantMessage parity). */ export declare function isActionableTurn(isLastAssistantMessage?: boolean): boolean; /** * Raw combined status for a synthetic grouped call — port of the web * computeGroupStatus (tool-call-preprocessing.ts): waiting/running win * immediately, then error beats success. Stays in the raw backend vocabulary * so downstream consumers (approval detection, getWidgetStatus) keep working. */ export declare function computeGroupStatus(calls: SuperagentToolCall[]): string; /** * Collapse runs of *consecutive* tool calls whose name is in `groupableNames` * into one synthetic `grouped: true` call (children under `toolCalls`), * preserving the order of everything else — the native mirror of the web's * groupConsecutive preprocessing (used there for grep and generated-image * batches). Grouped calls flow through flattenToolCall, so the timeline and * approval handling see the individual children unchanged. */ export declare function groupConsecutiveToolCalls(toolCalls: SuperagentToolCall[], groupableNames: ReadonlySet): SuperagentToolCall[]; /** Parsed tool arguments (arguments_string wins, matching the web parser). */ export declare function parseToolArgs(toolCall: SuperagentToolCall): Record | null; export declare function getStringArg(args: Record | null, keys: string[]): string; /** File path for file-op tools — same fallbacks as the web widgets. */ export declare function getToolFilePath(args: Record | null): string; export declare function truncateSingleLine(value: string, maxLength: number): string | null; export type DiffLineType = 'added' | 'removed' | 'context'; export type DiffLine = { text: string; type: DiffLineType; }; /** All-added diff for freshly written content (write_file has no old text). */ export declare function diffLinesFromNew(newText: string): DiffLine[]; /** * Exact-name registry lookup with ordered fallback matchers, for tool families * that can't be exact-name-keyed (mcp_* prefixes, artifact aliases). Generic * over the renderer type so the ordering logic stays unit-testable without * importing React Native components. */ export declare function resolveFromRegistry(registry: Record, resolvers: ReadonlyArray<(toolCall: SuperagentToolCall) => R | undefined>, toolCall: SuperagentToolCall): R | undefined; export declare const MCP_TOOL_PREFIX = "mcp_"; export declare function isMcpToolName(name: string): boolean; export declare function parseMcpToolName(fullName: string): { serverName: string; toolName: string; }; /** snake_case → Title Case, same as the web MCPToolUI formatDisplayName. */ export declare function formatMcpDisplayName(name: string): string; /** * MCP row title — web MCPToolUI's Running/Failed/Run verbs. Stopped renders * as failed so an interrupted call never reads as a completed run * (skills/automation widget parity). */ export declare function getMcpToolRowTitle(status: ToolWidgetStatus): string; export declare function formatUnknownValue(value: unknown): string; /** * Entry count for a get_backend_function_logs call. The tool answers with a * human-readable message (backend_function_tools.py `_format_logs`): one * "[LEVEL] timestamp - message" line per entry, or "No logs found.". * Deliberately never returns the payload itself: function logs carry the * function's console output, which the web confines to an admin-only debug * affordance. */ export declare function countBackendFunctionLogEntries(results: SuperagentToolCall['results']): number | null; export declare function humanizeFilePath(filePath: string): string; //# sourceMappingURL=toolWidgetUtils.d.ts.map