import { z } from "zod"; import { type CommandResult } from "../runtime/exec.js"; import type { NextCallSuggestion } from "../types.js"; import { type PlatformAdvisory } from "../runtime/platformCheck.js"; /** Base shape, exposed so the MCP layer can read `.shape`. */ export declare const captureMemgraphShape: { readonly pid: z.ZodOptional; readonly appName: z.ZodOptional; readonly output: z.ZodString; }; export declare const captureMemgraphSchema: z.ZodEffects; readonly appName: z.ZodOptional; readonly output: z.ZodString; }, "strip", z.ZodTypeAny, { output: string; pid?: number | undefined; appName?: string | undefined; }, { output: string; pid?: number | undefined; appName?: string | undefined; }>, { output: string; pid?: number | undefined; appName?: string | undefined; }, { output: string; pid?: number | undefined; appName?: string | undefined; }>; export type CaptureMemgraphInput = z.infer; export type WorkaroundIssue = "minimal-corpse" | "macos-26-task-for-pid-broken" | "permission-denied" | "leaks-not-found" | "transient"; export interface WorkaroundNotice { /** Stable identifier the LLM agent can branch on. */ issue: WorkaroundIssue; /** Human-readable explanation of what went wrong. */ message: string; /** Concrete next steps the agent can take to recover. */ fallbacks: string[]; } export interface CaptureMemgraphResult { ok: boolean; pid: number; /** Present when `ok:true`. Absent on failure paths. */ output?: string; /** * Limitation reminder. Surfaced so callers stay aware of the device-physical caveat. */ notice: string; /** Non-fatal observations (e.g. MallocStackLogging not active → backtraces will be incomplete). */ warnings?: string[]; /** Structured failure info when `ok:false`. */ workaroundNotice?: WorkaroundNotice; /** HATEOAS-style hints to recover via other tools. Populated on failure paths. */ suggestedNextCalls?: NextCallSuggestion[]; /** Raw stderr from `leaks` when capture failed. */ stderr?: string; /** * Present on hosts where a platform-side regression affects this capture * (today: macOS 26.x `task_for_pid` kernel regression). Agents should * surface this to the user before assuming a `workaroundNotice` is a * configuration issue specific to their setup. */ platformAdvisory?: PlatformAdvisory; } /** Resolve an app name to a PID via `pgrep -x`. Errors when zero or multiple matches. */ export declare function resolveAppNameToPid(appName: string): Promise; /** * Inspect a running process's environment block via `ps eww `. * Returns true when MallocStackLogging is set, false otherwise. Returns null * when the env cannot be read (e.g. process exited or restricted). */ export declare function detectMallocStackLogging(pid: number): Promise; /** * Pure: classify a leaks failure into a stable issue id, given exit + stderr. * * When `isMacOS26` is true and the failure matches the minimal-corpse pattern, * the issue is upgraded to `macos-26-task-for-pid-broken` so the workaround * notice can name the root cause (Apple-side kernel regression) rather than * implying the user's build configuration is at fault. The escalation keeps * the failure-mode signature (minimal-corpse) and adds platform context, so * agents that branch on the issue id can route to the iOS 18 simulator * fallback first. */ export declare function classifyLeaksFailure(result: CommandResult, isMacOS26?: boolean): WorkaroundIssue | null; export declare function captureMemgraph(input: CaptureMemgraphInput): Promise;