import type { z } from 'zod'; import type { ConnectorId, ConnectorInstanceId } from '../ids/index.js'; import type { AuthConfig, AuthType, ConnectionType, ConnectorCategory, ConnectorMethod, ConnectorStatus, ConnectorTrigger } from './core.js'; export interface ConnectorDefinition { id: ConnectorId; name: string; description: string; version?: string; category?: ConnectorCategory; connectionType: ConnectionType; /** * Authentication schemes this connector can consume. When present, the * manager refuses an unsupported explicit credential before publishing an * instance and revalidates the effective scheme immediately before connect. * Omit only when a custom connector intentionally accepts every scheme. */ supportedAuth?: readonly AuthType[]; configSchema: z.ZodType; methods: ConnectorMethod[]; /** * Declared, not implemented — see {@link ConnectorTrigger}. * * @deprecated The SDK never reads this field or starts a turn from it. Move * subscription metadata into a host-owned store before the next major. * It remains readable through `ConnectorRegistry` during this migration * release so existing host dispatchers do not break without warning. */ triggers?: ConnectorTrigger[]; } export interface ConnectorConfig { readonly connectorId: ConnectorId; name: string; auth?: AuthConfig; options?: Record; } export interface ConnectorInstance { readonly id: ConnectorInstanceId; readonly connectorId: ConnectorId; readonly config: ConnectorConfig; status: ConnectorStatus; readonly createdAt: number; connectedAt?: number; lastUsedAt?: number; error?: string; } /** What the client can establish about a connector side effect. */ export type ConnectorRemoteOutcome = 'not_started' | 'unknown' | 'response_received'; /** Whether repeating the connector call can be recommended without duplicating a side effect. */ export type ConnectorRetrySafety = 'safe' | 'unsafe' | 'unknown'; export interface ConnectorOperationOptions { /** The authority for this operation. A pre-aborted signal starts no connector work. */ signal?: AbortSignal; } export interface ConnectorExecutionMetadata extends Record { remoteOutcome?: ConnectorRemoteOutcome; retrySafety?: ConnectorRetrySafety; bodyAvailable?: boolean; } export interface ConnectorExecuteParams extends ConnectorOperationOptions { instanceId: ConnectorInstanceId; method: string; input: unknown; } export interface ConnectorExecuteResult { success: boolean; output: unknown; error?: string; durationMs: number; metadata?: ConnectorExecutionMetadata; } export interface ConnectorLifecycle { connect(config: TConfig, auth?: AuthConfig): Promise; disconnect(): Promise; healthCheck(options?: ConnectorOperationOptions): Promise; execute(method: string, /** ConnectorManager supplies the method schema's parsed canonical value on managed calls. */ input: unknown, options?: ConnectorOperationOptions): Promise; } export type ConnectorLifecycleEvent = { type: 'connector_registered'; connectorId: ConnectorId; } | { type: 'connector_unregistered'; connectorId: ConnectorId; } | { type: 'instance_created'; instanceId: ConnectorInstanceId; connectorId: ConnectorId; } | { type: 'instance_connecting'; instanceId: ConnectorInstanceId; } | { type: 'instance_connected'; instanceId: ConnectorInstanceId; } | { type: 'instance_disconnected'; instanceId: ConnectorInstanceId; } | { type: 'instance_error'; instanceId: ConnectorInstanceId; error: string; } | { type: 'instance_removed'; instanceId: ConnectorInstanceId; } | { type: 'action_executing'; instanceId: ConnectorInstanceId; method: string; } | { type: 'action_completed'; instanceId: ConnectorInstanceId; method: string; success: boolean; durationMs: number; }; export type ConnectorEventListener = (event: ConnectorLifecycleEvent) => void; //# sourceMappingURL=definition.d.ts.map