declare abstract class ContextItem { abstract readonly type: string; getType(): string; } declare class ModelContext { readonly id: string; readonly projectId: string; readonly items: ContextItem[]; constructor(id: string, projectId: string, items: ContextItem[]); addContextItem(item: ContextItem): ModelContext; applyModelOutput(items: ContextItem[]): ModelContext; getItems(): ContextItem[]; getLastItem(): ContextItem; static create(projectId: string): ModelContext; static rehydrate(data: { id: string; projectId: string; items: ContextItem[]; }): ModelContext; } declare abstract class ItemContent { abstract readonly type: string; } declare class InputText extends ItemContent { readonly text: string; readonly type = "input_text"; private constructor(); static create(text: string): InputText; static rehydrate(data: { text: string; }): InputText; } declare class UserMessageItem extends ContextItem { readonly type = "message"; readonly role = "user"; readonly content: InputText; private constructor(); static create(text: string): UserMessageItem; static rehydrate(data: { text: string; }): UserMessageItem; } declare class DeveloperMessageItem extends ContextItem { readonly type = "message"; readonly role = "developer"; readonly content: InputText; private constructor(); static create(text: string): DeveloperMessageItem; static rehydrate(data: { text: string; }): DeveloperMessageItem; } declare class OutputText extends ItemContent { readonly text: string; readonly type = "output_text"; private constructor(); static rehydrate(data: { text: string; }): OutputText; } declare class ModelMessageItem extends ContextItem { readonly type = "message"; readonly role = "assistant"; readonly content: OutputText; private constructor(); static rehydrate(data: { text: string; }): ModelMessageItem; } declare class FunctionCallItem extends ContextItem { readonly type = "function_call"; readonly callId: string; readonly name: string; readonly args: string; private constructor(); static rehydrate(data: { callId: string; name: string; args: string; }): FunctionCallItem; } declare class SummaryText extends ItemContent { readonly text: string; readonly type = "summary_text"; private constructor(); static rehydrate(data: { text: string; }): SummaryText; } declare class ReasoningItem extends ContextItem { readonly type = "reasoning"; readonly content: InputText | undefined; readonly encryptedContent: string | undefined; readonly summary: SummaryText[]; private constructor(); static rehydrate(data: { content: InputText | undefined; encryptedContent: string | undefined; summary: SummaryText[]; }): ReasoningItem; } interface FunctionTool { type: "function"; name: string; description: string; parameters: Record; strict: boolean; invoke: (args: any) => Promise; } type Tool = FunctionTool; declare class FunctionCallOutputItem extends ContextItem { readonly type = "function_call_output"; readonly callId: string; readonly output: InputText; private constructor(); static create(callId: string, output: string): FunctionCallOutputItem; static rehydrate(data: { callId: string; output: InputText; }): FunctionCallOutputItem; } declare class SemanticEvent { readonly type: string; readonly data: T; constructor(type: string, data: T); getType(): string; } interface AgenticErrorOpts { message: string; stack?: string; source?: Participant; enviornment?: AgenticEnvironment; } declare class AgenticError extends Error { private source?; private environment?; constructor({ message, stack, source, enviornment }: AgenticErrorOpts); getSource(): Participant | undefined; getEnvironment(): AgenticEnvironment | undefined; } type ParticipantClassConstructor = new (...args: any[]) => Participant; declare abstract class Participant { private environments; protected listens: ParticipantClassConstructor[]; private active; join(environment: AgenticEnvironment): void; leave(environment: AgenticEnvironment): void; isJoinedTo(environment: AgenticEnvironment): boolean; getEnvironments(): AgenticEnvironment[]; getListeners(): ParticipantClassConstructor[]; getEnvironmentState(environment: AgenticEnvironment): boolean | undefined; markInactive(environment: AgenticEnvironment): void; markActive(environment: AgenticEnvironment): void; abstract onParticipantJoined(participant: Participant): Promise | void; abstract onParticipantLeft(participant: Participant): Promise | void; abstract onJoined(): Promise | void; abstract onLeft(): Promise | void; abstract onFunctionCall(item: FunctionCallItem): Promise | void; abstract onExternalFunctionCall(source: Participant, item: FunctionCallItem): Promise | void; abstract onFunctionCallOutput(item: FunctionCallOutputItem): Promise | void; abstract onExternalFunctionCallOutput(source: Participant, item: FunctionCallOutputItem): Promise | void; abstract onReasoning(item: ReasoningItem): Promise | void; abstract onExternalReasoning(source: Participant, item: ReasoningItem): Promise | void; abstract onModelMessage(item: ModelMessageItem): Promise | void; abstract onExternalModelMessage(source: Participant, item: ModelMessageItem): Promise | void; abstract onMessage(message: string): Promise | void; abstract onInternalEvent(item: SemanticEvent): Promise | void; abstract onExternalEvent(source: Participant, item: SemanticEvent): Promise | void; abstract onError(error: AgenticError): void; abstract onParticipantError(source: Participant, error: AgenticError): void; } interface AgenticEnvironmentOptions { silent?: boolean; } declare class AgenticEnvironment { protected subscribers: Participant[]; private name?; private options?; private showLogs?; constructor(name?: string, opts?: AgenticEnvironmentOptions); subscribe(participant: Participant): void; unsubscribe(participant: Participant): void; deliverFunctionCall(source: Participant, item: FunctionCallItem): void; deliverModelMessage(source: Participant, item: ModelMessageItem): void; deliverReasoning(source: Participant, item: ReasoningItem): void; deliverFunctionCallOutput(source: Participant, item: FunctionCallOutputItem): void; deliverMessage(source: Participant, message: string): void; deliverSemanticEvent(source: Participant, item: SemanticEvent): void; deliverError(source: Participant, error: AgenticError): void; private getListeningParticipants; private deliverToSubscribers; private handleError; } type InferenceParams = { model: TModel; maxOutputTokens?: number; reasoningEffort?: string; tools?: Tool[]; streaming?: boolean; structuredOutput?: StructuredOutputFormat; context: ModelContext; caller: Participant; environment: AgenticEnvironment; signal?: AbortSignal; }; declare class InputTokenDetails { readonly cached_tokens: number; constructor(cached_tokens: number); } declare class OutputTokenDetails { readonly reasoning_tokens: number; constructor(reasoning_tokens: number); } declare class TokenUsage { readonly inputTokens: number; readonly outputTokens: number; readonly totalTokens: number; readonly inputTokenDetails: InputTokenDetails; readonly outputTokenDetails: OutputTokenDetails; constructor(inputTokens: number, outputTokens: number, totalTokens: number, inputTokenDetails: InputTokenDetails, outputTokenDetails: OutputTokenDetails); } declare class InferenceResponse { readonly contextItems: ContextItem[]; readonly tokenUsage?: TokenUsage; constructor(contextItems: ContextItem[], tokenUsage: TokenUsage | undefined); } interface InferenceEndpointMapper { toRequest(inferenceParams: InferenceParams): any; toResponse(response: any): InferenceResponse; } interface Endpoint { endpointMapper: InferenceEndpointMapper; infer(requestParams: InferenceParams): Promise; stream(requestParams: InferenceParams, signal?: AbortSignal): AsyncIterable>; } type ModelName = "gpt-5.4" | "gpt-5.4-mini" | "gpt-5.4-nano" | "gpt-5.5" | "claude-haiku-4-5" | "claude-sonnet-4-6" | "claude-opus-4-7" | "claude-opus-4-8" | "gemini-3.5-flash" | "gemini-3.1-pro-preview" | "deepseek-v4-flash" | "deepseek-v4-pro"; type StructuredOutputFormat = { name?: string; schema: Record; strict?: boolean; }; interface ModelContextRepository { save(context: ModelContext): Promise; get(id: string): Promise; getByProjectId(projectId: string): Promise; } interface McpServerConfig { /** The MCP server URL, e.g. https://api.githubcopilot.com/mcp/ */ url: string; /** Bearer token sent as `Authorization: Bearer ` (e.g. a GitHub token). */ authToken?: string; /** Extra headers merged into every request (overridden by `authToken` for Authorization). */ headers?: Record; /** Client name reported to the server (defaults to "mozaik"). */ name?: string; } interface McpToolSpec { name: string; description: string; /** JSON Schema for the tool's arguments (maps 1:1 to FunctionTool.parameters). */ inputSchema: Record; } /** * A thin wrapper over the MCP TypeScript SDK using the Streamable HTTP transport — what * remote MCP servers (e.g. GitHub's `api.githubcopilot.com/mcp/`) speak. One client per * server; lazily connects on first use. Infrastructure-only: the domain never sees this. */ declare class McpClient { private readonly config; private readonly client; private readonly transport; private connected; constructor(config: McpServerConfig); connect(): Promise; /** The tools this server exposes. */ listTools(): Promise; /** Call a tool by name; returns its text output. Throws if the server flags an error. */ callTool(name: string, args: Record): Promise; close(): Promise; } /** The slice of an MCP client the registry needs — lets tests inject a fake. */ interface McpClientLike { listTools(): Promise; }>>; callTool(name: string, args: Record): Promise; close(): Promise; } /** * Connects to one or more MCP servers and exposes their tools as mozaik `FunctionTool`s. * Each tool's `invoke()` proxies the call back to its MCP server. Because they are plain * FunctionTools, every provider mapper and the existing function-call loop handle them * with no changes — MCP support adds no new tool type and touches no provider code. * * `strict` is false: MCP servers publish arbitrary JSON Schemas that won't always satisfy * a provider's strict function-calling mode. */ declare class McpToolRegistry { private readonly servers; private readonly createClient; private readonly clients; constructor(servers: McpServerConfig[], createClient?: (config: McpServerConfig) => McpClientLike); /** Discover every tool across the configured servers, as FunctionTools ready to pass to a model. */ discoverTools(): Promise; /** Close all underlying MCP connections. */ close(): Promise; } declare class InMemoryModelContextRepository implements ModelContextRepository { private readonly store; private readonly projectIndex; save(context: ModelContext): Promise; get(id: string): Promise; getByProjectId(projectId: string): Promise; private clone; } declare class SystemMessageItem extends ContextItem { readonly type = "message"; readonly role = "system"; readonly content: InputText; private constructor(); static create(text: string): SystemMessageItem; static rehydrate(data: { text: string; }): SystemMessageItem; } declare class BaseParticipant extends Participant { onFunctionCall(_item: FunctionCallItem): void; onExternalFunctionCall(_source: Participant, _item: FunctionCallItem): void; onFunctionCallOutput(_item: FunctionCallOutputItem): void; onExternalFunctionCallOutput(_source: Participant, _item: FunctionCallOutputItem): void; onReasoning(_item: ReasoningItem): void; onExternalReasoning(_source: Participant, _item: ReasoningItem): void; onModelMessage(_item: ModelMessageItem): void; onExternalModelMessage(_source: Participant, _item: ModelMessageItem): void; onMessage(_message: string): void; onJoined(): void; onLeft(): void; onParticipantJoined(_participant: Participant): void; onParticipantLeft(_participant: Participant): void; onInternalEvent(_item: SemanticEvent): void; onExternalEvent(_source: Participant, _item: SemanticEvent): void; onError(_error: AgenticError): void; onParticipantError(_source: Participant, _error: AgenticError): void; } declare const runInference: (inferenceParams: InferenceParams) => void; declare const executeFunctionCall: (environment: AgenticEnvironment, functionCallItem: FunctionCallItem, tool: Tool, caller: Participant) => void; declare const sendMessage: (environment: AgenticEnvironment, message: string, caller: Participant) => void; export { AgenticEnvironment, AgenticError, BaseParticipant, ContextItem, DeveloperMessageItem, type Endpoint, FunctionCallItem, FunctionCallOutputItem, InMemoryModelContextRepository, type InferenceParams, InferenceResponse, InputTokenDetails, McpClient, type McpServerConfig, McpToolRegistry, type McpToolSpec, ModelContext, type ModelContextRepository, ModelMessageItem, type ModelName, OutputTokenDetails, Participant, ReasoningItem, SemanticEvent, type StructuredOutputFormat, SystemMessageItem, TokenUsage, type Tool, UserMessageItem, executeFunctionCall, runInference, sendMessage };