@robota-sdk/agent-core 3.0.0-beta.54 → 3.0.0-beta.56

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -244,6 +244,7 @@ interface IToolSchema {
244
244
  type: 'object';
245
245
  properties: Record<string, IParameterSchema>;
246
246
  required?: string[];
247
+ additionalProperties?: boolean | IParameterSchema;
247
248
  };
248
249
  }
249
250
  /**
@@ -1632,6 +1633,8 @@ interface IRunOptions {
1632
1633
  metadata?: TMetadata;
1633
1634
  /** AbortSignal for cancelling execution */
1634
1635
  signal?: AbortSignal;
1636
+ /** Per-run streaming text callback. Prefer this over mutating provider callback state. */
1637
+ onTextDelta?: TTextDeltaCallback;
1635
1638
  }
1636
1639
  /**
1637
1640
  * Generic agent interface with type parameters for enhanced type safety
@@ -1678,6 +1681,50 @@ interface ISafetySetting {
1678
1681
  [key: string]: TConfigValue;
1679
1682
  }
1680
1683
 
1684
+ interface IProviderConfig$1 {
1685
+ name: string;
1686
+ model: string;
1687
+ apiKey?: string;
1688
+ baseURL?: string;
1689
+ timeout?: number;
1690
+ }
1691
+ interface IProviderProfileDefaults {
1692
+ model?: string;
1693
+ apiKey?: string;
1694
+ baseURL?: string;
1695
+ timeout?: number;
1696
+ }
1697
+ interface IProviderProfileConfig {
1698
+ type?: string;
1699
+ model?: string;
1700
+ apiKey?: string;
1701
+ baseURL?: string;
1702
+ timeout?: number;
1703
+ }
1704
+ interface IProviderProbeResult {
1705
+ ok: boolean;
1706
+ message: string;
1707
+ models?: string[];
1708
+ }
1709
+ type TProviderSetupField = 'baseURL' | 'model' | 'apiKey';
1710
+ interface IProviderSetupStepDefinition {
1711
+ key: TProviderSetupField;
1712
+ title: string;
1713
+ defaultValue?: string;
1714
+ required?: boolean;
1715
+ masked?: boolean;
1716
+ }
1717
+ interface IProviderDefinition {
1718
+ type: string;
1719
+ defaults?: IProviderProfileDefaults;
1720
+ setupSteps?: readonly IProviderSetupStepDefinition[];
1721
+ requiresApiKey?: boolean;
1722
+ createProvider: (config: IProviderConfig$1) => IAIProvider;
1723
+ probeProfile?: (profile: IProviderProfileConfig) => Promise<IProviderProbeResult>;
1724
+ }
1725
+ declare function findProviderDefinition(definitions: readonly IProviderDefinition[], type: string): IProviderDefinition | undefined;
1726
+ declare function formatSupportedProviderTypes(definitions: readonly IProviderDefinition[]): string;
1727
+
1681
1728
  /**
1682
1729
  * Provider-agnostic media output reference.
1683
1730
  * Providers must not return raw binary payloads in this contract.
@@ -2730,55 +2777,26 @@ declare abstract class AbstractExecutor implements IExecutor {
2730
2777
  protected validateResponse(response: TUniversalMessage): void;
2731
2778
  }
2732
2779
 
2733
- interface IOpenAIMessage {
2734
- role: 'system' | 'user' | 'assistant' | 'tool';
2735
- content: string | null;
2736
- tool_calls?: {
2737
- id: string;
2738
- type: 'function';
2739
- function: {
2740
- name: string;
2741
- arguments: string;
2742
- };
2743
- }[];
2744
- tool_call_id?: string;
2745
- name?: string;
2746
- }
2747
- interface IAnthropicProviderMessage {
2748
- role: 'user' | 'assistant';
2749
- content: string;
2750
- }
2751
- interface IGoogleProviderMessage {
2752
- role: 'user' | 'model';
2753
- parts: {
2754
- text: string;
2755
- }[];
2756
- }
2757
2780
  /**
2758
- * Provider message format union type
2781
+ * Provider message format type.
2782
+ *
2783
+ * Provider packages own concrete message shapes. Core only carries the generic
2784
+ * conversion hook and never branches on provider names.
2759
2785
  */
2760
- type TProviderMessage = IOpenAIMessage | IAnthropicProviderMessage | IGoogleProviderMessage | TUniversalMessage;
2786
+ type TProviderMessage = TUniversalMessage | IUniversalObjectValue;
2787
+ type TMessageFormatConverter<TMessage extends TProviderMessage = TProviderMessage> = (messages: readonly TUniversalMessage[]) => TMessage[];
2788
+ type TMessageConverterRegistry = Readonly<Record<string, TMessageFormatConverter>>;
2761
2789
  /**
2762
2790
  * Universal message converter utility
2763
- * Handles message format conversion between different providers
2791
+ *
2792
+ * The converter is registry-based so provider-specific message conversion is
2793
+ * injected by provider packages or callers instead of being hardcoded in core.
2764
2794
  */
2765
2795
  declare class MessageConverter {
2766
2796
  /**
2767
- * Convert messages to provider-specific format
2768
- */
2769
- static toProviderFormat(messages: TUniversalMessage[], providerName: string): TProviderMessage[];
2770
- /**
2771
- * Convert to OpenAI format
2772
- */
2773
- private static toOpenAIFormat;
2774
- /**
2775
- * Convert to Anthropic format
2776
- */
2777
- private static toAnthropicFormat;
2778
- /**
2779
- * Convert to Google format
2797
+ * Convert messages using an injected converter or converter registry.
2780
2798
  */
2781
- private static toGoogleFormat;
2799
+ static toProviderFormat(messages: TUniversalMessage[], converter?: TMessageFormatConverter | string, registry?: TMessageConverterRegistry): TProviderMessage[];
2782
2800
  /**
2783
2801
  * Convert to universal format (no conversion)
2784
2802
  */
@@ -2824,7 +2842,7 @@ declare class Validator {
2824
2842
  /**
2825
2843
  * Validate API key format (basic check)
2826
2844
  */
2827
- static validateApiKey(apiKey: string, provider?: string): ISimpleValidationResult;
2845
+ static validateApiKey(apiKey: string): ISimpleValidationResult;
2828
2846
  }
2829
2847
  declare const validateAgentConfig: typeof Validator.validateAgentConfig;
2830
2848
  declare const validateUserInput: typeof Validator.validateUserInput;
@@ -4351,7 +4369,9 @@ declare function formatTokenCount(tokens: number): string;
4351
4369
  * Hook system types — Claude Code compatible event/hook model.
4352
4370
  */
4353
4371
  /** Hook lifecycle events */
4354
- type THookEvent = 'PreToolUse' | 'PostToolUse' | 'SessionStart' | 'Stop' | 'PreCompact' | 'PostCompact' | 'UserPromptSubmit';
4372
+ type THookEvent = 'PreToolUse' | 'PostToolUse' | 'SessionStart' | 'SessionEnd' | 'Stop' | 'StopFailure' | 'PreCompact' | 'PostCompact' | 'UserPromptSubmit' | 'SubagentStart' | 'SubagentStop' | 'WorktreeCreate' | 'WorktreeRemove';
4373
+ /** Claude Code compatible session end reasons. */
4374
+ type TSessionEndReason = 'clear' | 'resume' | 'logout' | 'prompt_input_exit' | 'bypass_permissions_disabled' | 'other';
4355
4375
  /** Command hook — executes a shell command */
4356
4376
  interface ICommandHookDefinition {
4357
4377
  type: 'command';
@@ -4408,6 +4428,20 @@ interface IHookInput {
4408
4428
  prompt?: string;
4409
4429
  /** Assistant response text (Stop only) */
4410
4430
  response?: string;
4431
+ /** Last assistant message text (StopFailure only) */
4432
+ last_assistant_message?: string;
4433
+ /** Stop hook recursion guard (Stop/StopFailure only) */
4434
+ stop_hook_active?: boolean;
4435
+ /** Session end reason (SessionEnd only) */
4436
+ reason?: TSessionEndReason | string;
4437
+ /** Session transcript path when available (SessionEnd/SubagentStop only) */
4438
+ transcript_path?: string;
4439
+ /** Subagent identifier (SubagentStart/SubagentStop only) */
4440
+ agent_id?: string;
4441
+ /** Subagent type/name (SubagentStart/SubagentStop only) */
4442
+ agent_type?: string;
4443
+ /** Subagent transcript path when available (SubagentStop only) */
4444
+ agent_transcript_path?: string;
4411
4445
  /** Additional environment variables to pass to hook child processes */
4412
4446
  env?: Record<string, string>;
4413
4447
  }
@@ -4458,4 +4492,4 @@ interface IRunHooksResult {
4458
4492
  }
4459
4493
  declare function runHooks(config: THooksConfig | undefined, event: THookEvent, input: IHookInput, executors?: IHookTypeExecutor[]): Promise<IRunHooksResult>;
4460
4494
 
4461
- export { AGENT_EVENTS, AGENT_EVENT_PREFIX, AbstractAIProvider, AbstractAgent, AbstractEventService, AbstractExecutor, AbstractManager, AbstractPlugin, AbstractTool, AgentFactory, AgentTemplates, AuthenticationError, CLAUDE_MODELS, CacheIntegrityError, CircuitBreakerOpenError, ConfigurationError, ConsoleLogger, ConversationHistory, ConversationStore, DEFAULT_ABSTRACT_EVENT_SERVICE, DEFAULT_CONTEXT_WINDOW, DEFAULT_MAX_OUTPUT, DefaultEventService, EVENT_EMITTER_EVENTS, EXECUTION_EVENTS, EXECUTION_EVENT_PREFIX, ErrorUtils, EventEmitterPlugin, EventHistoryModule, ExecutionProxy, type IAIProvider, type IAIProviderInstance, type IAIProviderManager, type IAbstractTool, type IAbstractToolOptions, type IAgent, type IAgentConfig, type IAgentCreationOptions, type IAgentCreationStats, type IAgentEventData, type IAgentFactory, type IAgentFactoryOptions, type IAgentHookDefinition, type IAgentLifecycleEvents, type IAgentTemplate, type IAssistantMessage, type IBaseEventData, type IBaseMessage, type ICacheEntry, type ICacheKey, type ICacheOptions, type ICacheStats, type ICacheStorage, type IChatExecutionRequest, type IChatOptions, type ICommandHookDefinition, type IConfigValidationResult, type IContextOptions, type IContextTokenUsage, type IContextWindowState, type IConversationContext, type IConversationResponse, type IConversationService, type IConversationServiceOptions, type IEventContext, type IEventEmitterEventData, type IEventEmitterHierarchicalEventData, type IEventEmitterMetrics, type IEventEmitterMetricsSnapshot, type IEventEmitterPlugin, type IEventEmitterPluginOptions, type IEventHistoryModule, type IEventHistoryRecord, type IEventHistorySnapshot, type IEventObjectValue, type IEventService, type IEventServiceOwnerBinding, type IExecutionEventData, type IExecutionService, type IExecutionServiceOptions, type IExecutor, type IExecutorAwareProviderConfig, type IFunctionTool, type IHistoryEntry, type IHookDefinition, type IHookGroup, type IHookInput, type IHookResult, type IHookTypeExecutor, type IHttpHookDefinition, type IImageComposeRequest, type IImageEditRequest, type IImageGenerationProvider, type IImageGenerationRequest, type IImageGenerationResult, type IInlineImageInputSource, type IInlineImageMessagePart, type ILocalExecutorConfig, type ILogger, type IMCPToolConfig, type IMediaOutputRef, type IModelDefinition, type IOpenAPIToolConfig, type IOwnerPathSegment, type IParameterSchema, type IParameterValidationResult, type IPermissionLists, type IPlugin, type IPluginConfig, type IPluginContext, type IPluginContract, type IPluginData, type IPluginErrorContext, type IPluginExecutionContext, type IPluginExecutionResult, type IPluginHooks, type IPluginOptions, type IPluginStats, type IProgressReportingTool, type IPromptHookDefinition, type IProviderConfig, type IProviderMediaError, type IProviderOptions, type IProviderRequest, type IProviderSpecificOptions, type IRawProviderResponse, type IRemoteExecutorConfig, type IRunOptions, type ISimpleValidationResult, type IStreamExecutionRequest, type IStreamingChunk, type ISystemMessage, type ITemplateApplicationResult, type ITextMessagePart, type ITokenUsage, type ITool, type IToolCall, type IToolContract, type IToolEventData, type IToolExecutionContext, type IToolExecutionRequest, type IToolExecutionResult, type IToolExecutionService, type IToolExecutionStep, type IToolFactory, type IToolManager, type IToolMessage, type IToolRegistry, type IToolResult, type IToolSchema, type IToolWithEventService, type IUniversalObjectValue, type IUriImageInputSource, type IUriImageMessagePart, type IUserMessage, type IUtilLogEntry, type IValidationIssue, type IValidationOptions, type IValidationResult, type IVideoGenerationProvider, type IVideoGenerationRequest, type IVideoJobAccepted, type IVideoJobSnapshot, type IWorkflowConfig, type IWorkflowConversionOptions, type IWorkflowConversionResult, type IWorkflowConverter, type IWorkflowData, type IWorkflowMetadata, type IWorkflowValidator, InMemoryEventEmitterMetrics, LocalExecutor, MODE_POLICY, MessageConverter, ModelNotAvailableError, NetworkError, ObservableEventService, PluginCategory, PluginError, PluginPriority, ProviderError, RateLimitError, Robota, RobotaError, SilentLogger, StorageError, StructuredEventService, TASK_EVENTS, TASK_EVENT_PREFIX, type TAgentCreationMetadata, type TComplexConfigValue, type TConfigData, type TConfigValue, type TContextData, type TConversationContextMetadata, type TErrorContextData, type TErrorExternalInput, type TEventEmitterListener, type TEventExtensionValue, type TEventListener, type TEventLoggerData, type TEventName, type TEventUniversalValue, type TExecutionEventName, type TExecutionMetadata, type THookEvent, type THooksConfig, type TImageInputSource, type TJSONSchemaEnum, type TJSONSchemaKind, type TKnownToolName, type TLoggerData, type TManagerToolParameters, type TMessageState, type TMetadata, type TMetadataValue, TOOL_EVENTS, TOOL_EVENT_PREFIX, type TParameterDefaultValue, type TPermissionDecision, type TPermissionMode, type TPrimitiveValue, type TProviderConfigValue, type TProviderLoggingData, type TProviderMediaResult, type TProviderOptionValueBase, TRUST_TO_MODE, type TResponseMetadata, type TTextDeltaCallback, type TTimerId, type TToolArgs, type TToolExecutionFunction, type TToolExecutionParameters, type TToolExecutor, type TToolMetadata, type TToolParameters, type TToolProgressCallback, type TTrustLevel, type TUniversalArrayValue, type TUniversalMessage, type TUniversalMessageMetadata, type TUniversalMessagePart, type TUniversalMessageRole, type TUniversalValue, type TUserEvent, type TUtilLogLevel, ToolExecutionError, TypeUtils, UNKNOWN_TOOL_FALLBACK, USER_EVENTS, USER_EVENT_PREFIX, ValidationError, ValidationSeverity, Validator, bindEventServiceOwner, bindWithOwnerPath, chatEntryToMessage, composeEventName, createAssistantMessage, createExecutionProxy, createLogger, createSystemMessage, createToolMessage, createUserMessage, evaluatePermission, formatTokenCount, getGlobalLogLevel, getMessagesForAPI, getModelContextWindow, getModelMaxOutput, getModelName, getToolEstimatedDuration, getToolExecutionSteps, isAssistantMessage, isChatEntry, isDefaultEventService, isImageGenerationProvider, isProgressReportingTool, isSystemMessage, isToolMessage, isUserMessage, isVideoGenerationProvider, logger, messageToHistoryEntry, runHooks, setGlobalLogLevel, setToolProgressCallback, startPeriodicTask, stopPeriodicTask, validateAgentConfig, validateApiKey, validateModelName, validateProviderName, validateUserInput, withEventEmission };
4495
+ export { AGENT_EVENTS, AGENT_EVENT_PREFIX, AbstractAIProvider, AbstractAgent, AbstractEventService, AbstractExecutor, AbstractManager, AbstractPlugin, AbstractTool, AgentFactory, AgentTemplates, AuthenticationError, CLAUDE_MODELS, CacheIntegrityError, CircuitBreakerOpenError, ConfigurationError, ConsoleLogger, ConversationHistory, ConversationStore, DEFAULT_ABSTRACT_EVENT_SERVICE, DEFAULT_CONTEXT_WINDOW, DEFAULT_MAX_OUTPUT, DefaultEventService, EVENT_EMITTER_EVENTS, EXECUTION_EVENTS, EXECUTION_EVENT_PREFIX, ErrorUtils, EventEmitterPlugin, EventHistoryModule, ExecutionProxy, type IAIProvider, type IAIProviderInstance, type IAIProviderManager, type IAbstractTool, type IAbstractToolOptions, type IAgent, type IAgentConfig, type IAgentCreationOptions, type IAgentCreationStats, type IAgentEventData, type IAgentFactory, type IAgentFactoryOptions, type IAgentHookDefinition, type IAgentLifecycleEvents, type IAgentTemplate, type IAssistantMessage, type IBaseEventData, type IBaseMessage, type ICacheEntry, type ICacheKey, type ICacheOptions, type ICacheStats, type ICacheStorage, type IChatExecutionRequest, type IChatOptions, type ICommandHookDefinition, type IConfigValidationResult, type IContextOptions, type IContextTokenUsage, type IContextWindowState, type IConversationContext, type IConversationResponse, type IConversationService, type IConversationServiceOptions, type IEventContext, type IEventEmitterEventData, type IEventEmitterHierarchicalEventData, type IEventEmitterMetrics, type IEventEmitterMetricsSnapshot, type IEventEmitterPlugin, type IEventEmitterPluginOptions, type IEventHistoryModule, type IEventHistoryRecord, type IEventHistorySnapshot, type IEventObjectValue, type IEventService, type IEventServiceOwnerBinding, type IExecutionEventData, type IExecutionService, type IExecutionServiceOptions, type IExecutor, type IExecutorAwareProviderConfig, type IFunctionTool, type IHistoryEntry, type IHookDefinition, type IHookGroup, type IHookInput, type IHookResult, type IHookTypeExecutor, type IHttpHookDefinition, type IImageComposeRequest, type IImageEditRequest, type IImageGenerationProvider, type IImageGenerationRequest, type IImageGenerationResult, type IInlineImageInputSource, type IInlineImageMessagePart, type ILocalExecutorConfig, type ILogger, type IMCPToolConfig, type IMediaOutputRef, type IModelDefinition, type IOpenAPIToolConfig, type IOwnerPathSegment, type IParameterSchema, type IParameterValidationResult, type IPermissionLists, type IPlugin, type IPluginConfig, type IPluginContext, type IPluginContract, type IPluginData, type IPluginErrorContext, type IPluginExecutionContext, type IPluginExecutionResult, type IPluginHooks, type IPluginOptions, type IPluginStats, type IProgressReportingTool, type IPromptHookDefinition, type IProviderConfig$1 as IProviderConfig, type IProviderDefinition, type IProviderMediaError, type IProviderOptions, type IProviderProbeResult, type IProviderProfileConfig, type IProviderProfileDefaults, type IProviderRequest, type IProviderSetupStepDefinition, type IProviderSpecificOptions, type IRawProviderResponse, type IRemoteExecutorConfig, type IRunOptions, type ISimpleValidationResult, type IStreamExecutionRequest, type IStreamingChunk, type ISystemMessage, type ITemplateApplicationResult, type ITextMessagePart, type ITokenUsage, type ITool, type IToolCall, type IToolContract, type IToolEventData, type IToolExecutionContext, type IToolExecutionRequest, type IToolExecutionResult, type IToolExecutionService, type IToolExecutionStep, type IToolFactory, type IToolManager, type IToolMessage, type IToolRegistry, type IToolResult, type IToolSchema, type IToolWithEventService, type IUniversalObjectValue, type IUriImageInputSource, type IUriImageMessagePart, type IUserMessage, type IUtilLogEntry, type IValidationIssue, type IValidationOptions, type IValidationResult, type IVideoGenerationProvider, type IVideoGenerationRequest, type IVideoJobAccepted, type IVideoJobSnapshot, type IWorkflowConfig, type IWorkflowConversionOptions, type IWorkflowConversionResult, type IWorkflowConverter, type IWorkflowData, type IWorkflowMetadata, type IWorkflowValidator, InMemoryEventEmitterMetrics, LocalExecutor, MODE_POLICY, MessageConverter, ModelNotAvailableError, NetworkError, ObservableEventService, PluginCategory, PluginError, PluginPriority, ProviderError, RateLimitError, Robota, RobotaError, SilentLogger, StorageError, StructuredEventService, TASK_EVENTS, TASK_EVENT_PREFIX, type TAgentCreationMetadata, type TComplexConfigValue, type TConfigData, type TConfigValue, type TContextData, type TConversationContextMetadata, type TErrorContextData, type TErrorExternalInput, type TEventEmitterListener, type TEventExtensionValue, type TEventListener, type TEventLoggerData, type TEventName, type TEventUniversalValue, type TExecutionEventName, type TExecutionMetadata, type THookEvent, type THooksConfig, type TImageInputSource, type TJSONSchemaEnum, type TJSONSchemaKind, type TKnownToolName, type TLoggerData, type TManagerToolParameters, type TMessageConverterRegistry, type TMessageFormatConverter, type TMessageState, type TMetadata, type TMetadataValue, TOOL_EVENTS, TOOL_EVENT_PREFIX, type TParameterDefaultValue, type TPermissionDecision, type TPermissionMode, type TPrimitiveValue, type TProviderConfigValue, type TProviderLoggingData, type TProviderMediaResult, type TProviderMessage, type TProviderOptionValueBase, type TProviderSetupField, TRUST_TO_MODE, type TResponseMetadata, type TSessionEndReason, type TTextDeltaCallback, type TTimerId, type TToolArgs, type TToolExecutionFunction, type TToolExecutionParameters, type TToolExecutor, type TToolMetadata, type TToolParameters, type TToolProgressCallback, type TTrustLevel, type TUniversalArrayValue, type TUniversalMessage, type TUniversalMessageMetadata, type TUniversalMessagePart, type TUniversalMessageRole, type TUniversalValue, type TUserEvent, type TUtilLogLevel, ToolExecutionError, TypeUtils, UNKNOWN_TOOL_FALLBACK, USER_EVENTS, USER_EVENT_PREFIX, ValidationError, ValidationSeverity, Validator, bindEventServiceOwner, bindWithOwnerPath, chatEntryToMessage, composeEventName, createAssistantMessage, createExecutionProxy, createLogger, createSystemMessage, createToolMessage, createUserMessage, evaluatePermission, findProviderDefinition, formatSupportedProviderTypes, formatTokenCount, getGlobalLogLevel, getMessagesForAPI, getModelContextWindow, getModelMaxOutput, getModelName, getToolEstimatedDuration, getToolExecutionSteps, isAssistantMessage, isChatEntry, isDefaultEventService, isImageGenerationProvider, isProgressReportingTool, isSystemMessage, isToolMessage, isUserMessage, isVideoGenerationProvider, logger, messageToHistoryEntry, runHooks, setGlobalLogLevel, setToolProgressCallback, startPeriodicTask, stopPeriodicTask, validateAgentConfig, validateApiKey, validateModelName, validateProviderName, validateUserInput, withEventEmission };
@@ -244,6 +244,7 @@ interface IToolSchema {
244
244
  type: 'object';
245
245
  properties: Record<string, IParameterSchema>;
246
246
  required?: string[];
247
+ additionalProperties?: boolean | IParameterSchema;
247
248
  };
248
249
  }
249
250
  /**
@@ -1632,6 +1633,8 @@ interface IRunOptions {
1632
1633
  metadata?: TMetadata;
1633
1634
  /** AbortSignal for cancelling execution */
1634
1635
  signal?: AbortSignal;
1636
+ /** Per-run streaming text callback. Prefer this over mutating provider callback state. */
1637
+ onTextDelta?: TTextDeltaCallback;
1635
1638
  }
1636
1639
  /**
1637
1640
  * Generic agent interface with type parameters for enhanced type safety
@@ -1678,6 +1681,50 @@ interface ISafetySetting {
1678
1681
  [key: string]: TConfigValue;
1679
1682
  }
1680
1683
 
1684
+ interface IProviderConfig$1 {
1685
+ name: string;
1686
+ model: string;
1687
+ apiKey?: string;
1688
+ baseURL?: string;
1689
+ timeout?: number;
1690
+ }
1691
+ interface IProviderProfileDefaults {
1692
+ model?: string;
1693
+ apiKey?: string;
1694
+ baseURL?: string;
1695
+ timeout?: number;
1696
+ }
1697
+ interface IProviderProfileConfig {
1698
+ type?: string;
1699
+ model?: string;
1700
+ apiKey?: string;
1701
+ baseURL?: string;
1702
+ timeout?: number;
1703
+ }
1704
+ interface IProviderProbeResult {
1705
+ ok: boolean;
1706
+ message: string;
1707
+ models?: string[];
1708
+ }
1709
+ type TProviderSetupField = 'baseURL' | 'model' | 'apiKey';
1710
+ interface IProviderSetupStepDefinition {
1711
+ key: TProviderSetupField;
1712
+ title: string;
1713
+ defaultValue?: string;
1714
+ required?: boolean;
1715
+ masked?: boolean;
1716
+ }
1717
+ interface IProviderDefinition {
1718
+ type: string;
1719
+ defaults?: IProviderProfileDefaults;
1720
+ setupSteps?: readonly IProviderSetupStepDefinition[];
1721
+ requiresApiKey?: boolean;
1722
+ createProvider: (config: IProviderConfig$1) => IAIProvider;
1723
+ probeProfile?: (profile: IProviderProfileConfig) => Promise<IProviderProbeResult>;
1724
+ }
1725
+ declare function findProviderDefinition(definitions: readonly IProviderDefinition[], type: string): IProviderDefinition | undefined;
1726
+ declare function formatSupportedProviderTypes(definitions: readonly IProviderDefinition[]): string;
1727
+
1681
1728
  /**
1682
1729
  * Provider-agnostic media output reference.
1683
1730
  * Providers must not return raw binary payloads in this contract.
@@ -2730,55 +2777,26 @@ declare abstract class AbstractExecutor implements IExecutor {
2730
2777
  protected validateResponse(response: TUniversalMessage): void;
2731
2778
  }
2732
2779
 
2733
- interface IOpenAIMessage {
2734
- role: 'system' | 'user' | 'assistant' | 'tool';
2735
- content: string | null;
2736
- tool_calls?: {
2737
- id: string;
2738
- type: 'function';
2739
- function: {
2740
- name: string;
2741
- arguments: string;
2742
- };
2743
- }[];
2744
- tool_call_id?: string;
2745
- name?: string;
2746
- }
2747
- interface IAnthropicProviderMessage {
2748
- role: 'user' | 'assistant';
2749
- content: string;
2750
- }
2751
- interface IGoogleProviderMessage {
2752
- role: 'user' | 'model';
2753
- parts: {
2754
- text: string;
2755
- }[];
2756
- }
2757
2780
  /**
2758
- * Provider message format union type
2781
+ * Provider message format type.
2782
+ *
2783
+ * Provider packages own concrete message shapes. Core only carries the generic
2784
+ * conversion hook and never branches on provider names.
2759
2785
  */
2760
- type TProviderMessage = IOpenAIMessage | IAnthropicProviderMessage | IGoogleProviderMessage | TUniversalMessage;
2786
+ type TProviderMessage = TUniversalMessage | IUniversalObjectValue;
2787
+ type TMessageFormatConverter<TMessage extends TProviderMessage = TProviderMessage> = (messages: readonly TUniversalMessage[]) => TMessage[];
2788
+ type TMessageConverterRegistry = Readonly<Record<string, TMessageFormatConverter>>;
2761
2789
  /**
2762
2790
  * Universal message converter utility
2763
- * Handles message format conversion between different providers
2791
+ *
2792
+ * The converter is registry-based so provider-specific message conversion is
2793
+ * injected by provider packages or callers instead of being hardcoded in core.
2764
2794
  */
2765
2795
  declare class MessageConverter {
2766
2796
  /**
2767
- * Convert messages to provider-specific format
2768
- */
2769
- static toProviderFormat(messages: TUniversalMessage[], providerName: string): TProviderMessage[];
2770
- /**
2771
- * Convert to OpenAI format
2772
- */
2773
- private static toOpenAIFormat;
2774
- /**
2775
- * Convert to Anthropic format
2776
- */
2777
- private static toAnthropicFormat;
2778
- /**
2779
- * Convert to Google format
2797
+ * Convert messages using an injected converter or converter registry.
2780
2798
  */
2781
- private static toGoogleFormat;
2799
+ static toProviderFormat(messages: TUniversalMessage[], converter?: TMessageFormatConverter | string, registry?: TMessageConverterRegistry): TProviderMessage[];
2782
2800
  /**
2783
2801
  * Convert to universal format (no conversion)
2784
2802
  */
@@ -2824,7 +2842,7 @@ declare class Validator {
2824
2842
  /**
2825
2843
  * Validate API key format (basic check)
2826
2844
  */
2827
- static validateApiKey(apiKey: string, provider?: string): ISimpleValidationResult;
2845
+ static validateApiKey(apiKey: string): ISimpleValidationResult;
2828
2846
  }
2829
2847
  declare const validateAgentConfig: typeof Validator.validateAgentConfig;
2830
2848
  declare const validateUserInput: typeof Validator.validateUserInput;
@@ -4351,7 +4369,9 @@ declare function formatTokenCount(tokens: number): string;
4351
4369
  * Hook system types — Claude Code compatible event/hook model.
4352
4370
  */
4353
4371
  /** Hook lifecycle events */
4354
- type THookEvent = 'PreToolUse' | 'PostToolUse' | 'SessionStart' | 'Stop' | 'PreCompact' | 'PostCompact' | 'UserPromptSubmit';
4372
+ type THookEvent = 'PreToolUse' | 'PostToolUse' | 'SessionStart' | 'SessionEnd' | 'Stop' | 'StopFailure' | 'PreCompact' | 'PostCompact' | 'UserPromptSubmit' | 'SubagentStart' | 'SubagentStop' | 'WorktreeCreate' | 'WorktreeRemove';
4373
+ /** Claude Code compatible session end reasons. */
4374
+ type TSessionEndReason = 'clear' | 'resume' | 'logout' | 'prompt_input_exit' | 'bypass_permissions_disabled' | 'other';
4355
4375
  /** Command hook — executes a shell command */
4356
4376
  interface ICommandHookDefinition {
4357
4377
  type: 'command';
@@ -4408,6 +4428,20 @@ interface IHookInput {
4408
4428
  prompt?: string;
4409
4429
  /** Assistant response text (Stop only) */
4410
4430
  response?: string;
4431
+ /** Last assistant message text (StopFailure only) */
4432
+ last_assistant_message?: string;
4433
+ /** Stop hook recursion guard (Stop/StopFailure only) */
4434
+ stop_hook_active?: boolean;
4435
+ /** Session end reason (SessionEnd only) */
4436
+ reason?: TSessionEndReason | string;
4437
+ /** Session transcript path when available (SessionEnd/SubagentStop only) */
4438
+ transcript_path?: string;
4439
+ /** Subagent identifier (SubagentStart/SubagentStop only) */
4440
+ agent_id?: string;
4441
+ /** Subagent type/name (SubagentStart/SubagentStop only) */
4442
+ agent_type?: string;
4443
+ /** Subagent transcript path when available (SubagentStop only) */
4444
+ agent_transcript_path?: string;
4411
4445
  /** Additional environment variables to pass to hook child processes */
4412
4446
  env?: Record<string, string>;
4413
4447
  }
@@ -4458,4 +4492,4 @@ interface IRunHooksResult {
4458
4492
  }
4459
4493
  declare function runHooks(config: THooksConfig | undefined, event: THookEvent, input: IHookInput, executors?: IHookTypeExecutor[]): Promise<IRunHooksResult>;
4460
4494
 
4461
- export { AGENT_EVENTS, AGENT_EVENT_PREFIX, AbstractAIProvider, AbstractAgent, AbstractEventService, AbstractExecutor, AbstractManager, AbstractPlugin, AbstractTool, AgentFactory, AgentTemplates, AuthenticationError, CLAUDE_MODELS, CacheIntegrityError, CircuitBreakerOpenError, ConfigurationError, ConsoleLogger, ConversationHistory, ConversationStore, DEFAULT_ABSTRACT_EVENT_SERVICE, DEFAULT_CONTEXT_WINDOW, DEFAULT_MAX_OUTPUT, DefaultEventService, EVENT_EMITTER_EVENTS, EXECUTION_EVENTS, EXECUTION_EVENT_PREFIX, ErrorUtils, EventEmitterPlugin, EventHistoryModule, ExecutionProxy, type IAIProvider, type IAIProviderInstance, type IAIProviderManager, type IAbstractTool, type IAbstractToolOptions, type IAgent, type IAgentConfig, type IAgentCreationOptions, type IAgentCreationStats, type IAgentEventData, type IAgentFactory, type IAgentFactoryOptions, type IAgentHookDefinition, type IAgentLifecycleEvents, type IAgentTemplate, type IAssistantMessage, type IBaseEventData, type IBaseMessage, type ICacheEntry, type ICacheKey, type ICacheOptions, type ICacheStats, type ICacheStorage, type IChatExecutionRequest, type IChatOptions, type ICommandHookDefinition, type IConfigValidationResult, type IContextOptions, type IContextTokenUsage, type IContextWindowState, type IConversationContext, type IConversationResponse, type IConversationService, type IConversationServiceOptions, type IEventContext, type IEventEmitterEventData, type IEventEmitterHierarchicalEventData, type IEventEmitterMetrics, type IEventEmitterMetricsSnapshot, type IEventEmitterPlugin, type IEventEmitterPluginOptions, type IEventHistoryModule, type IEventHistoryRecord, type IEventHistorySnapshot, type IEventObjectValue, type IEventService, type IEventServiceOwnerBinding, type IExecutionEventData, type IExecutionService, type IExecutionServiceOptions, type IExecutor, type IExecutorAwareProviderConfig, type IFunctionTool, type IHistoryEntry, type IHookDefinition, type IHookGroup, type IHookInput, type IHookResult, type IHookTypeExecutor, type IHttpHookDefinition, type IImageComposeRequest, type IImageEditRequest, type IImageGenerationProvider, type IImageGenerationRequest, type IImageGenerationResult, type IInlineImageInputSource, type IInlineImageMessagePart, type ILocalExecutorConfig, type ILogger, type IMCPToolConfig, type IMediaOutputRef, type IModelDefinition, type IOpenAPIToolConfig, type IOwnerPathSegment, type IParameterSchema, type IParameterValidationResult, type IPermissionLists, type IPlugin, type IPluginConfig, type IPluginContext, type IPluginContract, type IPluginData, type IPluginErrorContext, type IPluginExecutionContext, type IPluginExecutionResult, type IPluginHooks, type IPluginOptions, type IPluginStats, type IProgressReportingTool, type IPromptHookDefinition, type IProviderConfig, type IProviderMediaError, type IProviderOptions, type IProviderRequest, type IProviderSpecificOptions, type IRawProviderResponse, type IRemoteExecutorConfig, type IRunOptions, type ISimpleValidationResult, type IStreamExecutionRequest, type IStreamingChunk, type ISystemMessage, type ITemplateApplicationResult, type ITextMessagePart, type ITokenUsage, type ITool, type IToolCall, type IToolContract, type IToolEventData, type IToolExecutionContext, type IToolExecutionRequest, type IToolExecutionResult, type IToolExecutionService, type IToolExecutionStep, type IToolFactory, type IToolManager, type IToolMessage, type IToolRegistry, type IToolResult, type IToolSchema, type IToolWithEventService, type IUniversalObjectValue, type IUriImageInputSource, type IUriImageMessagePart, type IUserMessage, type IUtilLogEntry, type IValidationIssue, type IValidationOptions, type IValidationResult, type IVideoGenerationProvider, type IVideoGenerationRequest, type IVideoJobAccepted, type IVideoJobSnapshot, type IWorkflowConfig, type IWorkflowConversionOptions, type IWorkflowConversionResult, type IWorkflowConverter, type IWorkflowData, type IWorkflowMetadata, type IWorkflowValidator, InMemoryEventEmitterMetrics, LocalExecutor, MODE_POLICY, MessageConverter, ModelNotAvailableError, NetworkError, ObservableEventService, PluginCategory, PluginError, PluginPriority, ProviderError, RateLimitError, Robota, RobotaError, SilentLogger, StorageError, StructuredEventService, TASK_EVENTS, TASK_EVENT_PREFIX, type TAgentCreationMetadata, type TComplexConfigValue, type TConfigData, type TConfigValue, type TContextData, type TConversationContextMetadata, type TErrorContextData, type TErrorExternalInput, type TEventEmitterListener, type TEventExtensionValue, type TEventListener, type TEventLoggerData, type TEventName, type TEventUniversalValue, type TExecutionEventName, type TExecutionMetadata, type THookEvent, type THooksConfig, type TImageInputSource, type TJSONSchemaEnum, type TJSONSchemaKind, type TKnownToolName, type TLoggerData, type TManagerToolParameters, type TMessageState, type TMetadata, type TMetadataValue, TOOL_EVENTS, TOOL_EVENT_PREFIX, type TParameterDefaultValue, type TPermissionDecision, type TPermissionMode, type TPrimitiveValue, type TProviderConfigValue, type TProviderLoggingData, type TProviderMediaResult, type TProviderOptionValueBase, TRUST_TO_MODE, type TResponseMetadata, type TTextDeltaCallback, type TTimerId, type TToolArgs, type TToolExecutionFunction, type TToolExecutionParameters, type TToolExecutor, type TToolMetadata, type TToolParameters, type TToolProgressCallback, type TTrustLevel, type TUniversalArrayValue, type TUniversalMessage, type TUniversalMessageMetadata, type TUniversalMessagePart, type TUniversalMessageRole, type TUniversalValue, type TUserEvent, type TUtilLogLevel, ToolExecutionError, TypeUtils, UNKNOWN_TOOL_FALLBACK, USER_EVENTS, USER_EVENT_PREFIX, ValidationError, ValidationSeverity, Validator, bindEventServiceOwner, bindWithOwnerPath, chatEntryToMessage, composeEventName, createAssistantMessage, createExecutionProxy, createLogger, createSystemMessage, createToolMessage, createUserMessage, evaluatePermission, formatTokenCount, getGlobalLogLevel, getMessagesForAPI, getModelContextWindow, getModelMaxOutput, getModelName, getToolEstimatedDuration, getToolExecutionSteps, isAssistantMessage, isChatEntry, isDefaultEventService, isImageGenerationProvider, isProgressReportingTool, isSystemMessage, isToolMessage, isUserMessage, isVideoGenerationProvider, logger, messageToHistoryEntry, runHooks, setGlobalLogLevel, setToolProgressCallback, startPeriodicTask, stopPeriodicTask, validateAgentConfig, validateApiKey, validateModelName, validateProviderName, validateUserInput, withEventEmission };
4495
+ export { AGENT_EVENTS, AGENT_EVENT_PREFIX, AbstractAIProvider, AbstractAgent, AbstractEventService, AbstractExecutor, AbstractManager, AbstractPlugin, AbstractTool, AgentFactory, AgentTemplates, AuthenticationError, CLAUDE_MODELS, CacheIntegrityError, CircuitBreakerOpenError, ConfigurationError, ConsoleLogger, ConversationHistory, ConversationStore, DEFAULT_ABSTRACT_EVENT_SERVICE, DEFAULT_CONTEXT_WINDOW, DEFAULT_MAX_OUTPUT, DefaultEventService, EVENT_EMITTER_EVENTS, EXECUTION_EVENTS, EXECUTION_EVENT_PREFIX, ErrorUtils, EventEmitterPlugin, EventHistoryModule, ExecutionProxy, type IAIProvider, type IAIProviderInstance, type IAIProviderManager, type IAbstractTool, type IAbstractToolOptions, type IAgent, type IAgentConfig, type IAgentCreationOptions, type IAgentCreationStats, type IAgentEventData, type IAgentFactory, type IAgentFactoryOptions, type IAgentHookDefinition, type IAgentLifecycleEvents, type IAgentTemplate, type IAssistantMessage, type IBaseEventData, type IBaseMessage, type ICacheEntry, type ICacheKey, type ICacheOptions, type ICacheStats, type ICacheStorage, type IChatExecutionRequest, type IChatOptions, type ICommandHookDefinition, type IConfigValidationResult, type IContextOptions, type IContextTokenUsage, type IContextWindowState, type IConversationContext, type IConversationResponse, type IConversationService, type IConversationServiceOptions, type IEventContext, type IEventEmitterEventData, type IEventEmitterHierarchicalEventData, type IEventEmitterMetrics, type IEventEmitterMetricsSnapshot, type IEventEmitterPlugin, type IEventEmitterPluginOptions, type IEventHistoryModule, type IEventHistoryRecord, type IEventHistorySnapshot, type IEventObjectValue, type IEventService, type IEventServiceOwnerBinding, type IExecutionEventData, type IExecutionService, type IExecutionServiceOptions, type IExecutor, type IExecutorAwareProviderConfig, type IFunctionTool, type IHistoryEntry, type IHookDefinition, type IHookGroup, type IHookInput, type IHookResult, type IHookTypeExecutor, type IHttpHookDefinition, type IImageComposeRequest, type IImageEditRequest, type IImageGenerationProvider, type IImageGenerationRequest, type IImageGenerationResult, type IInlineImageInputSource, type IInlineImageMessagePart, type ILocalExecutorConfig, type ILogger, type IMCPToolConfig, type IMediaOutputRef, type IModelDefinition, type IOpenAPIToolConfig, type IOwnerPathSegment, type IParameterSchema, type IParameterValidationResult, type IPermissionLists, type IPlugin, type IPluginConfig, type IPluginContext, type IPluginContract, type IPluginData, type IPluginErrorContext, type IPluginExecutionContext, type IPluginExecutionResult, type IPluginHooks, type IPluginOptions, type IPluginStats, type IProgressReportingTool, type IPromptHookDefinition, type IProviderConfig$1 as IProviderConfig, type IProviderDefinition, type IProviderMediaError, type IProviderOptions, type IProviderProbeResult, type IProviderProfileConfig, type IProviderProfileDefaults, type IProviderRequest, type IProviderSetupStepDefinition, type IProviderSpecificOptions, type IRawProviderResponse, type IRemoteExecutorConfig, type IRunOptions, type ISimpleValidationResult, type IStreamExecutionRequest, type IStreamingChunk, type ISystemMessage, type ITemplateApplicationResult, type ITextMessagePart, type ITokenUsage, type ITool, type IToolCall, type IToolContract, type IToolEventData, type IToolExecutionContext, type IToolExecutionRequest, type IToolExecutionResult, type IToolExecutionService, type IToolExecutionStep, type IToolFactory, type IToolManager, type IToolMessage, type IToolRegistry, type IToolResult, type IToolSchema, type IToolWithEventService, type IUniversalObjectValue, type IUriImageInputSource, type IUriImageMessagePart, type IUserMessage, type IUtilLogEntry, type IValidationIssue, type IValidationOptions, type IValidationResult, type IVideoGenerationProvider, type IVideoGenerationRequest, type IVideoJobAccepted, type IVideoJobSnapshot, type IWorkflowConfig, type IWorkflowConversionOptions, type IWorkflowConversionResult, type IWorkflowConverter, type IWorkflowData, type IWorkflowMetadata, type IWorkflowValidator, InMemoryEventEmitterMetrics, LocalExecutor, MODE_POLICY, MessageConverter, ModelNotAvailableError, NetworkError, ObservableEventService, PluginCategory, PluginError, PluginPriority, ProviderError, RateLimitError, Robota, RobotaError, SilentLogger, StorageError, StructuredEventService, TASK_EVENTS, TASK_EVENT_PREFIX, type TAgentCreationMetadata, type TComplexConfigValue, type TConfigData, type TConfigValue, type TContextData, type TConversationContextMetadata, type TErrorContextData, type TErrorExternalInput, type TEventEmitterListener, type TEventExtensionValue, type TEventListener, type TEventLoggerData, type TEventName, type TEventUniversalValue, type TExecutionEventName, type TExecutionMetadata, type THookEvent, type THooksConfig, type TImageInputSource, type TJSONSchemaEnum, type TJSONSchemaKind, type TKnownToolName, type TLoggerData, type TManagerToolParameters, type TMessageConverterRegistry, type TMessageFormatConverter, type TMessageState, type TMetadata, type TMetadataValue, TOOL_EVENTS, TOOL_EVENT_PREFIX, type TParameterDefaultValue, type TPermissionDecision, type TPermissionMode, type TPrimitiveValue, type TProviderConfigValue, type TProviderLoggingData, type TProviderMediaResult, type TProviderMessage, type TProviderOptionValueBase, type TProviderSetupField, TRUST_TO_MODE, type TResponseMetadata, type TSessionEndReason, type TTextDeltaCallback, type TTimerId, type TToolArgs, type TToolExecutionFunction, type TToolExecutionParameters, type TToolExecutor, type TToolMetadata, type TToolParameters, type TToolProgressCallback, type TTrustLevel, type TUniversalArrayValue, type TUniversalMessage, type TUniversalMessageMetadata, type TUniversalMessagePart, type TUniversalMessageRole, type TUniversalValue, type TUserEvent, type TUtilLogLevel, ToolExecutionError, TypeUtils, UNKNOWN_TOOL_FALLBACK, USER_EVENTS, USER_EVENT_PREFIX, ValidationError, ValidationSeverity, Validator, bindEventServiceOwner, bindWithOwnerPath, chatEntryToMessage, composeEventName, createAssistantMessage, createExecutionProxy, createLogger, createSystemMessage, createToolMessage, createUserMessage, evaluatePermission, findProviderDefinition, formatSupportedProviderTypes, formatTokenCount, getGlobalLogLevel, getMessagesForAPI, getModelContextWindow, getModelMaxOutput, getModelName, getToolEstimatedDuration, getToolExecutionSteps, isAssistantMessage, isChatEntry, isDefaultEventService, isImageGenerationProvider, isProgressReportingTool, isSystemMessage, isToolMessage, isUserMessage, isVideoGenerationProvider, logger, messageToHistoryEntry, runHooks, setGlobalLogLevel, setToolProgressCallback, startPeriodicTask, stopPeriodicTask, validateAgentConfig, validateApiKey, validateModelName, validateProviderName, validateUserInput, withEventEmission };