import type { ToolResult } from '../types/index.js';
/**
 * Returns true if planu.json was found at the given projectPath on the
 * most recent tool call. Returns false if the path was never seen or if
 * planu.json was absent.
 */
export declare function isProjectInitialized(projectPath: string): boolean;
/**
 * Removes a project path from the uninitialized set.
 * Called by init-project after a successful initialization so subsequent
 * tool calls reflect the new state.
 */
export declare function markProjectInitialized(projectPath: string): void;
/**
 * Races a promise against a hard deadline, resolving with `fallback` on timeout.
 * Unlike withTimeout (which rejects), this always resolves — safe for non-critical gates
 * where a timeout should degrade gracefully rather than throw.
 *
 * @param p       - The promise to race
 * @param ms      - Timeout in milliseconds
 * @param fallback - Value returned when the timeout fires
 */
export declare function withToolTimeout<T>(p: Promise<T>, ms: number, fallback: T): Promise<T>;
/**
 * Wraps a tool handler so that any unhandled error is caught and returned as a
 * graceful MCP error response, preventing server crashes. Also enforces a
 * configurable execution timeout (default 60s, env PLANU_TOOL_TIMEOUT_MS).
 *
 * Usage — only for alwaysAllowed tools (activate_license, license_status, etc.):
 *   server.registerTool('my_tool', schema, safe(async (args) => { ... }));
 */
export declare function safe<T>(handler: (args: T, extra?: unknown) => Promise<ToolResult>): (args: T, extra?: unknown) => Promise<ToolResult>;
/**
 * Composable wrapper: usage tracking + error boundary.
 * Use for free-tier tools that need rate limiting and usage recording.
 *
 * Usage:
 *   server.registerTool('free_tool', schema, safeTracked('free_tool', async (args) => { ... }));
 */
export declare function safeTracked<T>(toolName: string, handler: (args: T, extra?: unknown) => Promise<ToolResult>): (args: T, extra?: unknown) => Promise<ToolResult>;
/**
 * Composable wrapper: usage tracking + license gate + error boundary.
 * Use for tools that require a paid plan.
 *
 * Trial bypass: if the 30-day free trial is active, skips the license gate
 * entirely and routes to safeTracked (usage tracking without restriction).
 *
 * Usage:
 *   server.registerTool('pro_tool', schema, safeLicensed('pro_tool', async (args) => { ... }));
 */
export declare function safeLicensed<T>(toolName: string, handler: (args: T, extra?: unknown) => Promise<ToolResult>): (args: T, extra?: unknown) => Promise<ToolResult>;
//# sourceMappingURL=safe-handler.d.ts.map