import { Nr as AgentToolUpdateCallback } from "./proxy-CGIA3yMu.js";
import { a as PluginManifestActivation } from "./manifest-registry-VKy0dJLg.js";
import { t as JsonSchemaObject } from "./json-schema.types-fpZiub1R.js";
import { C as NodmixPluginApi, Mo as NodmixPluginToolContext } from "./types-CLo6hM78.js";
import { r as AnyAgentTool } from "./common-C7RKFa1F.js";
import { t as definePluginEntry } from "./plugin-entry-BqGw_9B5.js";
import { Static, TSchema } from "typebox";

//#region src/plugin-sdk/tool-plugin.d.ts
declare const toolPluginMetadataSymbol: unique symbol;
type ToolPluginExecutionContext = {
  api: NodmixPluginApi;
  signal?: AbortSignal;
  toolCallId: string;
  onUpdate?: AgentToolUpdateCallback;
};
type ToolPluginConfig<TConfigSchema extends TSchema | undefined> = TConfigSchema extends TSchema ? Static<TConfigSchema> : Record<string, never>;
type ToolPluginToolFactory<TConfig> = <TParamsSchema extends TSchema>(definition: ToolPluginToolDefinition<TConfig, TParamsSchema>) => DefinedToolPluginTool;
type ToolPluginFactoryContext<TConfig> = {
  api: NodmixPluginApi;
  config: TConfig;
  toolContext: NodmixPluginToolContext;
};
type ToolPluginToolDefinitionBase<TParamsSchema extends TSchema> = {
  name: string;
  label?: string;
  description: string;
  parameters: TParamsSchema;
  optional?: boolean;
};
type ToolPluginToolDefinition<TConfig, TParamsSchema extends TSchema> = ToolPluginToolDefinitionBase<TParamsSchema> & ({
  execute: (params: Static<TParamsSchema>, config: TConfig, context: ToolPluginExecutionContext) => unknown;
  factory?: never;
} | {
  factory: (context: ToolPluginFactoryContext<TConfig>) => AnyAgentTool | AnyAgentTool[] | null | undefined;
  execute?: never;
});
type DefinedToolPluginTool = {
  name: string;
  label: string;
  description: string;
  parameters: TSchema;
  optional: boolean;
  execute?: (params: unknown, config: unknown, context: ToolPluginExecutionContext) => unknown;
  factory?: (context: ToolPluginFactoryContext<unknown>) => AnyAgentTool | AnyAgentTool[] | null | undefined;
};
type ToolPluginStaticToolMetadata = {
  name: string;
  label: string;
  description: string;
  parameters: JsonSchemaObject;
  optional?: boolean;
};
type ToolPluginMetadata = {
  id: string;
  name: string;
  description: string;
  activation: PluginManifestActivation;
  configSchema: JsonSchemaObject;
  tools: ToolPluginStaticToolMetadata[];
};
type DefineToolPluginOptions<TConfigSchema extends TSchema | undefined = undefined> = {
  id: string;
  name: string;
  description: string;
  activation?: PluginManifestActivation;
  configSchema?: TConfigSchema;
  tools: (tool: ToolPluginToolFactory<ToolPluginConfig<TConfigSchema>>) => readonly DefinedToolPluginTool[];
};
type DefinedToolPluginEntry = ReturnType<typeof definePluginEntry> & {
  [toolPluginMetadataSymbol]: ToolPluginMetadata;
};
declare function defineToolPlugin<TConfigSchema extends TSchema | undefined = undefined>(definition: DefineToolPluginOptions<TConfigSchema>): DefinedToolPluginEntry;
declare function getToolPluginMetadata(entry: unknown): ToolPluginMetadata | undefined;
//#endregion
export { DefineToolPluginOptions, DefinedToolPluginEntry, ToolPluginExecutionContext, ToolPluginFactoryContext, ToolPluginMetadata, ToolPluginStaticToolMetadata, ToolPluginToolDefinition, defineToolPlugin, getToolPluginMetadata, toolPluginMetadataSymbol };