import type { Tool, CallToolResult } from "@modelcontextprotocol/sdk/types" export type { CallToolResult, MCPInstance, MCPTransportOptions, MCPTool, MCPToolResult } import type { Low } from 'lowdb' import type { format, formatDistanceToNow } from '../utils/date.js' import type { RestEndpointMethodTypes } from '@octokit/plugin-rest-endpoint-methods' import type { Action, Choice, Choices, FlagsObject, ActionsConfig, Panel, Preview, PromptConfig, ScoredChoice, Script, Shortcut, Flags } from './core.js' import { ChannelHandler } from './core.js' import type { ConfigOptions, Options } from 'quick-score' // Import AI SDK specific types for global declaration import type { CoreMessage, FinishReason, LanguageModel } from 'ai' import type { AssistantOutcome, AssistantLastInteraction, ToolCallPart, AiOptions } from '../lib/ai.js' // Import our custom result types import type { ZodTypeAny } from 'zod'; // Import Zod types for global declaration import type { MCPInstance, MCPTransportOptions, ToolOptions as MCPToolOptions, MCPTool, MCPToolResult } from '../lib/mcp.js' // Import MCP types export interface Arg { [key: string]: any ( placeholderOrConfig?: string | PromptConfig, choicesOrPanel?: Choices | Panel, actionsOrPreview?: Action[] | Preview ): Promise } export type Select = ( placeholderOrConfig: string | PromptConfig, choices: Choices, actions?: Action[] ) => Promise export type Grid = ( placeholderOrConfig: string | PromptConfig, choices: Choices, actions?: Action[] ) => Promise export interface EnvConfig extends PromptConfig { reset?: boolean cacheDuration?: 'session' | 'until-quit' | 'until-sleep' } export interface Env { (envKey: string, promptConfig?: string | EnvConfig | (() => Promise)): Promise [key: string]: any } export interface Args extends Array { } export type UpdateArgs = (args: string[]) => void export type PathFn = (...pathParts: string[]) => string export type Inspect = (data: any, extension?: string) => Promise export type Store = (key: string, initialData?: any) => Promise> type DBExtensions = { data: T extends string[] ? { items: T } : T dbPath: string clear: () => Promise reset: () => Promise } type DBItems = T extends string[] ? { items: T } : {} export type DBKeyOrPath = string | T | (() => Promise) export type DBData = T | (() => Promise) export type DBReturnType = Low & DBItems & DBExtensions & T export type DB = < T = { [key: string]: any } >( dataOrKeyOrPath?: DBKeyOrPath, data?: DBData, fromCache?: boolean ) => Promise> export type OnTab = (name: string, fn: (input?: string) => void | Promise) => void export interface Trace { enabled: boolean begin: (fields: Parameters['begin']>[0]) => void end: (fields: Parameters['end']>[0]) => void instant: (fields: Parameters['instantEvent']>[0]) => void flush: () => void } export type KitModuleLoader = (packageName: string, ...moduleArgs: string[]) => Promise export type Edit = (file: string, dir?: string, line?: string | number, col?: string | number) => Promise export type Browse = (url: string) => Promise export type Wait = (time: number, submitValue?: any) => Promise export type IsCheck = (file: string) => Promise export type PathResolver = (dir: string) => (...pathParts: string[]) => string export type GetScripts = (fromCache?: boolean) => Promise export type FlagFn = (flags: FlagsObject, options?: ActionsConfig) => Promise export type ActionsFn = (actions: Action[], options?: ActionsConfig) => Promise export type PrepFlags = (flags: FlagsObject) => FlagsObject export type SelectKitEditor = (reset: boolean) => Promise export interface SelectScript { (message?: string, fromCache?: boolean, xf?: (x: Script[]) => Script[]): Promise