/** * `inspectTrace`: orientation tool for `.trace` bundles. Lists which * schemas are present, how many rows each carries, the time range, the * device model, the template name, and a pre-baked `suggestedNextCalls` * pointing at the matching analyzer for each populated schema. * * The use case is "I have a .trace, what's worth looking at?". Without * this tool the caller has to either pick an `analyze*` blindly or * read the full xctrace export which is wasteful. The MCP-native * agent loop benefits the most: discovery costs 1 call instead of 5. * * Implementation notes: * * - Single `xctrace export --xpath '/trace-toc/run'` invocation. Returns * the run metadata + all table schemas in one shot. We parse just enough * to enumerate schemas + count rows; we deliberately do NOT parse row * contents (the downstream `analyze*` tools do that). * * - Time range: derived from the schema-level `start-time` / `end-time` * attributes when present; falls back to the run's `` * timestamp string when not parseable. * * - The 5 known schemas (potential-hangs, animation-hitches, time-profile, * allocations, app-launch) map 1:1 to the existing analyzers. Any * schema NOT in that map is still surfaced in the `schemas[]` list (so * the user sees it) but does not contribute a `suggestedNextCalls` * entry — there's no analyzer to chain into. */ import { z } from "zod"; import type { NextCallSuggestion } from "../types.js"; export declare const inspectTraceSchema: z.ZodObject<{ tracePath: z.ZodString; }, "strip", z.ZodTypeAny, { tracePath: string; }, { tracePath: string; }>; export type InspectTraceInput = z.infer; export interface TraceSchemaSummary { /** Schema name (e.g. "potential-hangs", "time-profile"). */ name: string; /** Number of rows in this schema's table. 0 means the schema is present in the trace but carries no data. */ rowCount: number; /** Engineering description when the schema declares one; absent otherwise. */ description?: string; } export interface InspectTraceResult { ok: boolean; tracePath: string; /** All schemas present in the trace TOC, ranked by rowCount desc. */ schemas: TraceSchemaSummary[]; /** Convenience: schemaName -> rowCount, same data as `schemas[]` in object form. */ rowCounts: Record; /** Trace file size in bytes (the .trace bundle is a directory; reports the directory entry size, not recursive). */ fileSize?: number; /** Device model name when the trace's run metadata exposes one. */ deviceModel?: string; /** OS version when present. */ osVersion?: string; /** Template name (e.g. "Time Profiler", "Allocations"). */ templateName?: string; /** Recording timestamp string (raw, unparsed). */ recordedWhen?: string; /** Plain-English orientation diagnosis. */ diagnosis: string; /** Pipeline hints based on which analyzers have data to chain into. */ suggestedNextCalls: NextCallSuggestion[]; } /** Pure: parse the trace-toc XML payload into an inspection result. */ export declare function parseTraceToc(xml: string, tracePath: string): Omit; export declare function inspectTrace(input: InspectTraceInput): Promise; export declare function _basenameForTests(p: string): string;