import { TSchema } from "typebox"; import { AgentTool, AgentToolResult, AgentToolUpdateCallback } from "@earendil-works/pi-agent-core"; //#region src/agents/image-sanitization.d.ts type ImageSanitizationLimits = { maxDimensionPx?: number; maxBytes?: number; }; //#endregion //#region src/agents/tools/common.d.ts type AgentToolWithMeta = AgentTool & { ownerOnly?: boolean; displaySummary?: string; }; type ErasedAgentToolExecute = { execute(this: void, toolCallId: string, params: unknown, signal?: AbortSignal, onUpdate?: AgentToolUpdateCallback): Promise>; }; type AnyAgentTool = Omit, "execute"> & ErasedAgentToolExecute & { ownerOnly?: boolean; displaySummary?: string; }; declare function asToolParamsRecord(params: unknown): Record; type StringParamOptions = { required?: boolean; trim?: boolean; label?: string; allowEmpty?: boolean; }; type ActionGate> = (key: keyof T, defaultValue?: boolean) => boolean; declare const OWNER_ONLY_TOOL_ERROR = "Tool restricted to owner senders."; declare class ToolInputError extends Error { readonly status: number; constructor(message: string); } declare class ToolAuthorizationError extends ToolInputError { readonly status = 403; constructor(message: string); } declare function createActionGate>(actions: T | undefined): ActionGate; declare function readStringParam(params: Record, key: string, options: StringParamOptions & { required: true; }): string; declare function readStringParam(params: Record, key: string, options?: StringParamOptions): string | undefined; /** * Normalize tool model override input. * - empty/whitespace => undefined * - "default" (case-insensitive) => undefined (sentinel: reset/fallback) * - otherwise returns trimmed explicit model string */ declare function normalizeToolModelOverride(value: string | undefined): string | undefined; declare function readStringOrNumberParam(params: Record, key: string, options?: { required?: boolean; label?: string; }): string | undefined; declare function readNumberParam(params: Record, key: string, options?: { required?: boolean; label?: string; integer?: boolean; strict?: boolean; }): number | undefined; declare function readStringArrayParam(params: Record, key: string, options: StringParamOptions & { required: true; }): string[]; declare function readStringArrayParam(params: Record, key: string, options?: StringParamOptions): string[] | undefined; type ReactionParams = { emoji: string; remove: boolean; isEmpty: boolean; }; declare function readReactionParams(params: Record, options: { emojiKey?: string; removeKey?: string; removeErrorMessage: string; }): ReactionParams; declare function stringifyToolPayload(payload: unknown): string; declare function textResult(text: string, details: TDetails): AgentToolResult; declare function failedTextResult(text: string, details: TDetails): AgentToolResult; declare function payloadTextResult(payload: TDetails): AgentToolResult; declare function jsonResult(payload: unknown): AgentToolResult; declare function wrapOwnerOnlyToolExecution(tool: AnyAgentTool, senderIsOwner: boolean): AnyAgentTool; declare function imageResult(params: { label: string; path: string; base64: string; mimeType: string; extraText?: string; details?: Record; imageSanitization?: ImageSanitizationLimits; }): Promise>; declare function imageResultFromFile(params: { label: string; path: string; extraText?: string; details?: Record; imageSanitization?: ImageSanitizationLimits; }): Promise>; type AvailableTag = { id?: string; name: string; moderated?: boolean; emoji_id?: string | null; emoji_name?: string | null; }; /** * Validate and parse an `availableTags` parameter from untrusted input. * Returns `undefined` when the value is missing or not an array. * Entries that lack a string `name` are silently dropped. */ declare function parseAvailableTags(raw: unknown): AvailableTag[] | undefined; //#endregion export { readStringParam as C, wrapOwnerOnlyToolExecution as E, readStringOrNumberParam as S, textResult as T, parseAvailableTags as _, OWNER_ONLY_TOOL_ERROR as a, readReactionParams as b, ToolAuthorizationError as c, createActionGate as d, failedTextResult as f, normalizeToolModelOverride as g, jsonResult as h, AvailableTag as i, ToolInputError as l, imageResultFromFile as m, AgentToolWithMeta as n, ReactionParams as o, imageResult as p, AnyAgentTool as r, StringParamOptions as s, ActionGate as t, asToolParamsRecord as u, payloadTextResult as v, stringifyToolPayload as w, readStringArrayParam as x, readNumberParam as y };