/**
 * Module: tool
 *
 * Tool type definitions and argument validation helpers.
 * Dominds tools are function tools (`func`) only.
 *
 * NOTE: "tellask" is reserved for teammate tellasks / dialog orchestration and is
 * not a tool type.
 */
import type { JsonArray as KernelJsonArray, JsonObject as KernelJsonObject, JsonPrimitive as KernelJsonPrimitive, JsonSchema as KernelJsonSchema, JsonValue as KernelJsonValue, ReminderUpdateResult as KernelReminderUpdateResult, ToolArguments as KernelToolArguments, ToolCallOutput as KernelToolCallOutput, ToolOutcome as KernelToolOutcome } from '@longrun-ai/kernel/app-json';
import type { I18nText } from '@longrun-ai/kernel/types/i18n';
import type { FuncResultContentItem } from '@longrun-ai/kernel/types/storage';
import type { Dialog } from './dialog';
import type { ChatMessage } from './llm/client';
import { Team } from './team';
export type JsonPrimitive = KernelJsonPrimitive;
export type JsonValue = KernelJsonValue;
export type JsonObject = KernelJsonObject;
export type JsonArray = KernelJsonArray;
export type ToolArguments = KernelToolArguments;
export type JsonSchema = KernelJsonSchema;
export type FuncToolFollowupMode = 'immediate' | 'deferred';
export type ToolOutcome = KernelToolOutcome;
export interface FuncTool {
    readonly type: 'func';
    readonly name: string;
    readonly description?: string;
    readonly descriptionI18n?: I18nText;
    readonly parameters: JsonSchema;
    readonly argsValidation?: 'dominds' | 'passthrough';
    readonly followupMode?: FuncToolFollowupMode;
    call(dlg: Dialog, caller: Team.Member, args: ToolArguments): Promise<ToolCallOutput>;
}
export type Tool = FuncTool;
export type ToolCallOutput = KernelToolCallOutput;
export declare function toolResult(content: string, outcome: ToolOutcome, contentItems?: FuncResultContentItem[]): ToolCallOutput;
export declare function toolSuccess(content: string, contentItems?: FuncResultContentItem[]): ToolCallOutput;
export declare function toolFailure(content: string, contentItems?: FuncResultContentItem[]): ToolCallOutput;
export declare function toolPartialFailure(content: string, contentItems?: FuncResultContentItem[]): ToolCallOutput;
type PreparedRawToolArguments = Readonly<{
    ok: true;
    raw: ToolArguments;
    contextArguments: string;
    persistedArguments: ToolArguments;
}> | Readonly<{
    ok: false;
    error: string;
    contextArguments: string;
    persistedArguments: ToolArguments;
}>;
export interface ReminderOptions {
    readonly echoback?: boolean;
    readonly scope?: ReminderScope;
    readonly renderMode?: ReminderRenderMode;
}
export type ReminderScope = 'dialog' | 'task' | 'agent' | 'runtime';
export type ReminderRenderMode = 'plain' | 'markdown';
export type ReminderPriority = 'high' | 'medium' | 'low';
export interface Reminder extends ReminderOptions {
    readonly id: string;
    readonly content: string;
    readonly owner?: ReminderOwner;
    readonly meta?: JsonValue;
    readonly createdAt?: string;
    readonly priority?: ReminderPriority;
    readonly renderMode?: ReminderRenderMode;
}
export declare function reminderEchoBackEnabled(reminder: Reminder): boolean;
export declare function reminderIsVirtual(reminder: Reminder): boolean;
export declare function reminderIsListed(reminder: Reminder): boolean;
export declare function generateReminderId(): string;
export declare function materializeReminder(input: Readonly<{
    id?: string;
    content: string;
    owner?: ReminderOwner;
    meta?: JsonValue;
    echoback?: boolean;
    scope?: ReminderScope;
    createdAt?: string;
    priority?: ReminderPriority;
    renderMode?: ReminderRenderMode;
}>): Reminder;
export declare function cloneReminder(reminder: Reminder): Reminder;
export declare function computeReminderRenderRevision(reminder: Reminder): string;
export declare function compareReminderDisplayOrder(a: Reminder, b: Reminder): number;
export declare function getReminderOwnerName(reminder: Pick<Reminder, 'owner'>): string | undefined;
export declare function reminderOwnedBy(reminder: Reminder, owner: ReminderOwner | string): boolean;
export type ReminderTreatment = 'drop' | 'keep' | 'update';
export type ReminderUpdateResult = KernelReminderUpdateResult;
export type ReminderWakeEvent = Readonly<{
    eventId: string;
    reminderId: string;
    content: string;
    updatedContent?: string;
    updatedMeta?: JsonValue;
}>;
export interface ReminderOwner {
    readonly name: string;
    updateReminder(dlg: Dialog, reminder: Reminder): Promise<ReminderUpdateResult>;
    renderReminder(dlg: Dialog, reminder: Reminder): Promise<ChatMessage>;
    waitForReminderWakeEvent?(dlg: Dialog, reminders: readonly Reminder[], signal: AbortSignal): Promise<ReminderWakeEvent | readonly ReminderWakeEvent[] | null>;
}
export declare function validateArgs(schema: JsonSchema, args: unknown): {
    ok: true;
} | {
    ok: false;
    error: string;
};
export declare function formatToolArgumentsForContext(arguments_: ToolArguments): string;
export declare function prepareRawToolArguments(argumentsStr: string): PreparedRawToolArguments;
export type FuncToolInvocationResolution = Readonly<{
    ok: true;
    args: ToolArguments;
    contextArguments: string;
    persistedArguments: ToolArguments;
}> | Readonly<{
    ok: false;
    error: string;
    contextArguments: string;
    persistedArguments: ToolArguments;
}>;
export declare function resolveFuncToolInvocationArguments(tool: FuncTool, argumentsStr: string): FuncToolInvocationResolution;
export {};
