import type { createClient } from "@ai-kod/api-client"; import type { z } from "zod"; export type ApiClient = ReturnType; export interface Hint { /** Человекочитаемый совет, что сделать дальше */ title: string; /** Мета: возможная следующая команда/аргументы (CLI/MCP могут отобразить) */ next?: { command?: string; tool?: string; args?: Record; }; } export interface ActionDescriptor { id: string; description: string; inputSchema: z.ZodType; execute: (client: ApiClient, input: I) => Promise; hints?: (input: I, output: O) => Hint[]; } /** * Допустимые блоки, которые можно включать в отчёт по задаче. */ export declare const TASK_REPORT_INCLUDE_BLOCKS: readonly ["inputs", "outputs", "errors", "retries", "files", "metadata", "system-files"]; /** Блоки данных, которые можно включать в отчёт (`include`). */ export type TaskReportIncludeBlock = (typeof TASK_REPORT_INCLUDE_BLOCKS)[number]; /** Блоки данных, которые можно исключить из отчёта (`exclude`). */ export type TaskReportExcludeBlock = TaskReportIncludeBlock; /** * Опции формирования отчёта по задаче. */ export interface TaskReportOptions { /** Идентификатор задачи. */ taskId: string; /** Явно включённые блоки (по умолчанию: inputs, outputs, errors, retries, files). */ include?: TaskReportIncludeBlock[]; /** Исключённые блоки (по умолчанию: metadata, system-files). */ exclude?: TaskReportExcludeBlock[]; } /** * Сводка по задаче, прикрепляемая к отчёту. */ export interface TaskReportSummary { taskId: string; workflowId: string; status: string; runMode?: string; createdAt: string; updatedAt?: string; startedAt?: string; completedAt?: string; currentStage?: string | null; totalSteps: number; stepByStatus: Record; } /** * Метаданные файла шага. */ export interface TaskReportFile { name: string; path: string; size: number; modified: string; type: string; /** Файл технический (служебные артефакты оркестратора). */ isSystem?: boolean; } /** * Описание ошибки шага. */ export interface TaskReportStepError { type: string; message: string; code?: string; stack?: string; retryable?: boolean; severity?: string; attempts?: number; policyAction?: string; timestamp?: string; } /** * Дополнительные сведения о выполнении шага. */ export interface TaskReportStepMetadata { progress?: { phase?: string; percentage?: number; }; timings?: { createdAt?: string; startedAt?: string; completedAt?: string; durationMs?: number; }; navigation?: Record; metrics?: Record; quality?: Record; execution?: Record; waiting?: { controller?: string; expectedChildren?: number; readyChildren?: number; since?: string; }; workerId?: string; engineType?: string; engineProfile?: string | null; } /** Снимок inputs шага. */ export interface TaskReportStepInputs { direct?: Record; inherited?: Record; variables?: Record; runtime?: Record; } /** Снимок outputs шага. */ export interface TaskReportStepOutputs { result?: Record; filesCreated?: string[]; filesModified?: string[]; navigation?: Record; } /** * Структура шага внутри отчёта. */ export interface TaskReportStep { stepId: string; stageId: string; stageFQN: string; workflowId: string; status: string; createdAt: string; startedAt?: string; completedAt?: string; kind?: string; iteration?: number; retryIndex?: number; inputs?: TaskReportStepInputs | null; outputs?: TaskReportStepOutputs | null; errors?: TaskReportStepError[]; files?: TaskReportFile[]; metadata?: TaskReportStepMetadata; } /** * Финальный отчёт по задаче. */ export interface TaskReport { summary: TaskReportSummary; steps: TaskReportStep[]; options: { include: TaskReportIncludeBlock[]; exclude: TaskReportExcludeBlock[]; }; }