import { f as AppToolTaxonomy, b as AppToolContext } from './types-2rOJo8Hc.js';

/** The four canonical app-tool names. Stable identifiers the model calls in
 *  both the sandbox (MCP server name) and runtime (function-tool name) paths. */
declare const APP_TOOL_NAMES: readonly ["submit_proposal", "schedule_followup", "render_ui", "add_citation"];
type AppToolName = (typeof APP_TOOL_NAMES)[number];
declare function isAppToolName(name: string): name is AppToolName;
/** A minimal OpenAI Chat Completions function-tool shape — structurally
 *  compatible with `@tangle-network/agent-runtime`'s `OpenAIChatTool` without
 *  importing it (keeps this package runtime-free). */
interface OpenAIFunctionTool {
    type: 'function';
    function: {
        name: string;
        description: string;
        parameters: Record<string, unknown>;
    };
}
/**
 * Build the four app tools in OpenAI function-tool shape. `submit_proposal`'s
 * `type` enum is the product's {@link AppToolTaxonomy.proposalTypes}; the other
 * three are fixed. Pass the result to the agent-runtime backend's `tools`.
 */
declare function buildAppToolOpenAITools(taxonomy: AppToolTaxonomy): OpenAIFunctionTool[];

/**
 * Header names carrying the server-set per-turn context + the capability token.
 * Defaults are product-neutral (`X-Agent-App-*`); a product that already ships
 * a header convention (e.g. `X-Acme-User-Id`) passes its own.
 */
interface ToolHeaderNames {
    userId: string;
    workspaceId: string;
    threadId: string;
}
declare const DEFAULT_HEADER_NAMES: ToolHeaderNames;
interface AuthenticateOptions {
    /** Verify the bearer capability token belongs to `userId`. The product's
     *  HMAC/JWT impl — the seam that keeps token crypto out of this package. */
    verifyToken: (userId: string, bearer: string) => Promise<boolean>;
    headerNames?: ToolHeaderNames;
}
type ToolAuthResult = {
    ok: true;
    ctx: AppToolContext;
} | {
    ok: false;
    response: Response;
};
/**
 * Recover + verify the trusted context for a tool request. The user comes from
 * a server-set header and the bearer token MUST verify against THAT user; the
 * workspace comes from a header too — never from tool args — so the model can
 * neither forge identity nor target another workspace. Fail-closed: any missing
 * credential or a token minted for another user yields a 401/400 Response.
 */
declare function authenticateToolRequest(request: Request, opts: AuthenticateOptions): Promise<ToolAuthResult>;
/** Read a tool's argument object from the request body, tolerant of MCP host
 *  aliases (`args` / `arguments`) or a bare body. Returns null on non-JSON. */
declare function readToolArgs<T>(request: Request): Promise<T | null>;

export { APP_TOOL_NAMES as A, DEFAULT_HEADER_NAMES as D, type OpenAIFunctionTool as O, type ToolAuthResult as T, type AppToolName as a, type AuthenticateOptions as b, type ToolHeaderNames as c, authenticateToolRequest as d, buildAppToolOpenAITools as e, isAppToolName as i, readToolArgs as r };
