import * as z from 'zod';
import z__default, { z as z$1 } from 'zod';
import * as zod_v4_core from 'zod/v4/core';
import { Z as ZodObjectWithTelemetry, A as AsyncQueue, T as TelemetryResource, c as TelemetryAttributes, e as TelemetryScopesDefinition, f as TelemetrySpan, g as TelemetryConsumer, h as TelemetrySpanHandle, i as TelemetrySignal, j as TelemetryLogHandle, b as ZodUnionWithTelemetry, a as agentServerConfig } from './config-n67P8tNt.js';
import { CamelCase } from 'type-fest';

declare const lifeErrorCodes: {
    /**
     * Used when the user sends or the server returns invalid data.
     */
    readonly Validation: {
        readonly retriable: false;
        readonly defaultMessage: "Invalid data provided.";
        readonly httpEquivalent: 400;
    };
    /**
     * Used when the user is not authorized to access a resource
     */
    readonly Forbidden: {
        readonly retriable: false;
        readonly defaultMessage: "Not allowed to access this resource.";
        readonly httpEquivalent: 403;
    };
    /**
     * Used when an operation took too long and timed out.
     */
    readonly Timeout: {
        readonly retriable: true;
        readonly defaultMessage: "Operation timed out.";
        readonly httpEquivalent: 504;
    };
    /**
     * Used when the user has exceeded the rate limit for a resource.
     */
    readonly RateLimit: {
        readonly retriable: true;
        readonly defaultMessage: "Rate limit exceeded.";
        readonly httpEquivalent: 429;
    };
    /**
     * Used when a resource was not found or missing.
     */
    readonly NotFound: {
        readonly retriable: false;
        readonly defaultMessage: "Resource not found.";
        readonly httpEquivalent: 404;
    };
    /**
     * Used when an operation is about to conflict with another.
     * E.g., a version mismatch, a unique constraint violation, etc.
     */
    readonly Conflict: {
        readonly retriable: false;
        readonly defaultMessage: "Operation conflicted.";
        readonly httpEquivalent: 409;
    };
    /**
     * Used when an upstream service or resource fails.
     * E.g., a database connection error, an OpenAI API downtime, etc.
     */
    readonly Upstream: {
        readonly retriable: true;
        readonly defaultMessage: "Upstream error.";
        readonly httpEquivalent: 502;
    };
    /**
     * Used when an unexpected error is thrown.
     */
    readonly Unknown: {
        readonly retriable: false;
        readonly defaultMessage: "Unknown error.";
        readonly httpEquivalent: 500;
    };
    /**
     * Used to obfuscate internal errors publicly.
     * Prevents leaking sensitive informations to public consumers.
     */
    readonly Internal: {
        readonly retriable: true;
        readonly defaultMessage: "Internal error.";
        readonly httpEquivalent: 500;
    };
};
type LifeErrorCode = keyof typeof lifeErrorCodes;
type LifeErrorParameters<Code extends LifeErrorCode> = {
    code: Code;
    message?: string;
    attributes?: LifeErrorAttributes;
    retryAfterMs?: number;
    isPublic?: boolean;
    cause?: unknown;
};
type LifeErrorAttributes = Record<string, SerializableValue>;
/**
 * @internal Use `lifeError()` instead.
 */
declare class LifeErrorClass extends Error {
    readonly name = "LifeError";
    /**
     * The unique identifier of the error.
     */
    readonly id: string;
    /**
     * The error code.
     * Can be one of:
     * - Validation
     * - Forbidden
     * - Timeout
     * - RateLimit
     * - NotFound
     * - Conflict
     * - Upstream
     * - Unknown
     * - Internal
     */
    readonly code: LifeErrorCode;
    /**
     * Additional pieces of evidence attached to the error.
     */
    readonly attributes: LifeErrorAttributes;
    /**
     * Used to indicate whether the operation that caused the error can be retried.
     */
    readonly retriable: boolean;
    /**
     * The suggested time (in ms) to wait before retrying the operation that caused the error.
     * Check `.retriable` first to ensure the operation can be retried.
     */
    readonly retryAfterMs?: number;
    /**
     * The HTTP status code equivalent to the error code.
     */
    readonly httpEquivalent: number;
    /**
     * Used to indicate whether this error is public and can be safely sent to external clients.
     */
    readonly isPublic: boolean;
    constructor({ code, message, attributes, retryAfterMs, cause, isPublic, }: LifeErrorParameters<LifeErrorCode>);
    toJSON(): {
        id: string;
        code: "Validation" | "Forbidden" | "Timeout" | "RateLimit" | "NotFound" | "Conflict" | "Upstream" | "Unknown" | "Internal";
        message: string;
        retriable: boolean;
        attributes: LifeErrorAttributes;
        retryAfterMs: number | undefined;
        httpEquivalent: number;
        stack: string | undefined;
        cause: unknown;
    };
}
/**
 * Error emitted by the Life.js framework.
 * Check attributes documentation for more information.
 */
type LifeError<Code extends LifeErrorCode = LifeErrorCode> = LifeErrorClass & {
    code: Code;
};
/**
 * Union of all LifeError types.
 */
type LifeErrorUnion<Code extends LifeErrorCode = LifeErrorCode> = Code extends LifeErrorCode ? LifeError<Code> : never;

/**
 * Avoids repeating the same type signature for functions that can return a promise or not.
 */
type MaybePromise<T> = T | Promise<T>;
type ClassShape = {
    prototype: object;
    new (...arguments_: any[]): any;
};
type Prettify<T> = {
    [K in keyof T]: T[K];
} & {};
type Any = any;
type IsAny<T> = 0 extends 1 & T ? true : false;
type IsNever<T> = [T] extends [never] ? true : false;
type IsFunction<T> = T extends (...args: Any) => Any ? true : false;
type IsInstance<T> = IsAny<T> extends true ? false : IsNever<T> extends true ? false : IsFunction<T> extends true ? false : T extends object ? true : false;
type IsClass<T> = T extends ClassShape ? (ClassShape extends T ? true : false) : false;
/**
 * Override a property type in an object without creating nested type aliases.
 *
 * Unlike `Omit<T, K> & { [K]: V }` which creates type alias references that nest
 * when chained, this produces an evaluated (expanded) type. This prevents type
 * instantiation depth issues common in builder patterns where types are repeatedly
 * transformed.
 *
 * @example
 * type User = { name: string; age: number };
 * type UpdatedUser = Override<User, "age", string>; // { name: string; age: string }
 */
type Override<T extends object, K extends keyof T, V> = Prettify<{
    [I in keyof T]: I extends K ? V : T[I];
}>;
/**
 * Exclude specific properties from an object, producing an expanded type.
 *
 * Functionally similar to `Omit<T, K>` but ensures the result is an evaluated type
 * rather than a type alias reference, preventing excessive type nesting in chained
 * transformations.
 *
 * @example
 * type User = { name: string; age: number; email: string };
 * type PublicUser = Without<User, "email">; // { name: string; age: number }
 */
type Without<T extends object, K extends keyof T> = Prettify<{
    [I in keyof T as I extends K ? never : I]: T[I];
}>;
declare const __opaque: unique symbol;
type Opaque<T> = T & {
    [__opaque]?: never;
};

/**
 * The 'operation' library (usually imported as 'op') is a minimal and type-safe
 * helper to enforce return type consistency across the entire codebase.
 *
 *
 * ## Why not using something like Effect.js or NeverThrow?
 *
 * While powerful, those libraries come with significant learning curves. We want
 * the Life.js codebase to remain accessible, so the community can easily engage,
 * learn, and contribute to it. Those libraries were incompatible with this goal.
 *
 * Also, we wanted the solution to be unnoticeable on the public API. The Life.js
 * SDKs shouldn't force developers to think differently about their program design.
 * Complex libraries like Effect.js or NeverThrow were again challenging with that
 * goal, this library solves that in ~100 LOC with the `toPublic()` helper.
 *
 * Still, 'operation' is not a perfect alternative to more complex libraries.
 * For example, it doesn't provide error-level type safety, yet it enforces errors
 * to be narrowed to LifeError (a 9 error codes surface), and strongly encourages
 * contributors to handle them properly. We found it being a good compromise.
 *
 *
 * ## Why 'error' comes first in the result tuple?
 *
 * We use `[error, data]` instead of `[data, error]` for two main reasons:
 *
 * 1. A function doesn't always return data, while it will always return a potential
 * error. When there is no data, with error first we can simply do:
 * ```ts
 * const [err] = op.attempt(...)
 * // instead of the more verbose
 * const [_, err] = op.attempt(...)
 * ```
 *
 * 2. With error first, the developer explicitly acknowledges the potential error
 * before destructuring the data. If `data` was first, it would be easy to:
 * ```ts
 * const [data] = op.attempt(...) // <-- Easy to forget to destructure the error here!
 * if (data) { ... }
 * ```
 */

type OperationData = unknown;
type OperationSuccess<D extends OperationData> = readonly [error: undefined, data: D];
type OperationFailure<_ extends OperationData = never> = readonly [
    error: LifeErrorUnion,
    data: undefined
];
type OperationResult<D extends OperationData> = OperationSuccess<D> | OperationFailure<D>;
type VoidIfNever<T> = [T] extends [never] ? void : T;
type IsOpFunction<T> = T extends (...args: Any) => MaybePromise<OperationResult<Any>> ? true : false;
type IsOpInstance<T> = {
    [K in keyof T]: IsFunction<T[K]> extends true ? IsOpFunction<T[K]> : false;
} extends {
    [K in keyof T]: false;
} ? false : true;
/**
 * In some rare cases where a types produces another type itself containing generics,
 * Typescript won't be able to infer the precise branch and ToPublic will incorreclty
 * match the type and produce broken results.
 * This helper is used to assert that a type is already public and avoid the issue.
 */
type AssertPublic<T> = T & {
    [__public]: [T];
};
declare const __public: unique symbol;
type IsAsserted<T> = T extends {
    [__public]: Any;
} ? true : false;
type UnwrapAssert<T> = T extends {
    [__public]: [infer U];
} ? U : never;
type FunctionToPublic<T> = T extends (...args: infer Args) => MaybePromise<OperationResult<infer Data>> ? Opaque<(...args: Args) => VoidIfNever<Data>> : T;
type InstanceToPublic<T> = IsInstance<T> extends true ? Prettify<{
    [K in keyof T]: ToPublic<T[K]>;
} & (IsOpInstance<T> extends true ? Opaque<{
    safe: {
        [K in keyof T as IsOpFunction<T[K]> extends true ? K : never]: T[K];
    };
}> : unknown)> : T;
type ClassToPublic<T> = IsClass<T> extends true ? Opaque<new (...args: Any) => InstanceToPublic<InstanceType<T extends ClassShape ? T : never>>> : T;
type ToPublic<T> = IsAsserted<T> extends true ? UnwrapAssert<T> : T extends z__default.ZodType ? T : IsClass<T> extends true ? ClassToPublic<T> : IsFunction<T> extends true ? FunctionToPublic<T> : IsInstance<T> extends true ? InstanceToPublic<T> : T;

declare const serializablePrimitivesSchema: z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodNumber, z$1.ZodBoolean, z$1.ZodNull, z$1.ZodUndefined, z$1.ZodBigInt, z$1.ZodDate, z$1.ZodCustom<RegExp, RegExp>, z$1.ZodCustom<Error, Error>, z$1.ZodCustom<URL, URL>, z$1.ZodCustom<ArrayBuffer, ArrayBuffer>, z$1.ZodCustom<Int8Array<ArrayBuffer>, Int8Array<ArrayBuffer>>, z$1.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>, z$1.ZodCustom<Uint8ClampedArray<ArrayBuffer>, Uint8ClampedArray<ArrayBuffer>>, z$1.ZodCustom<Int16Array<ArrayBuffer>, Int16Array<ArrayBuffer>>, z$1.ZodCustom<Uint16Array<ArrayBuffer>, Uint16Array<ArrayBuffer>>, z$1.ZodCustom<Int32Array<ArrayBuffer>, Int32Array<ArrayBuffer>>, z$1.ZodCustom<Uint32Array<ArrayBuffer>, Uint32Array<ArrayBuffer>>, z$1.ZodCustom<Float32Array<ArrayBuffer>, Float32Array<ArrayBuffer>>, z$1.ZodCustom<Float64Array<ArrayBuffer>, Float64Array<ArrayBuffer>>, z$1.ZodCustom<BigInt64Array<ArrayBuffer>, BigInt64Array<ArrayBuffer>>, z$1.ZodCustom<BigUint64Array<ArrayBuffer>, BigUint64Array<ArrayBuffer>>]>;
type SerializablePrimitives = z$1.infer<typeof serializablePrimitivesSchema>;
type SerializableValue = SerializablePrimitives | SerializableValue[] | readonly SerializableValue[] | [SerializableValue, ...SerializableValue[]] | readonly [SerializableValue, ...SerializableValue[]] | Set<SerializableValue> | Map<SerializableValue, SerializableValue> | {
    [key: string]: SerializableValue;
};

declare const storeConfigSchema: z$1.ZodUnion<readonly [z$1.ZodObject<{
    schema: z$1.ZodCustom<z$1.ZodArray<z$1.ZodType<SerializableValue, unknown, z$1.core.$ZodTypeInternals<SerializableValue, unknown>>> | z$1.ZodRecord<z$1.ZodString, z$1.ZodType<SerializableValue, unknown, z$1.core.$ZodTypeInternals<SerializableValue, unknown>>>, z$1.ZodArray<z$1.ZodType<SerializableValue, unknown, z$1.core.$ZodTypeInternals<SerializableValue, unknown>>> | z$1.ZodRecord<z$1.ZodString, z$1.ZodType<SerializableValue, unknown, z$1.core.$ZodTypeInternals<SerializableValue, unknown>>>>;
    type: z$1.ZodLiteral<"controlled">;
    ttl: z$1.ZodOptional<z$1.ZodNumber>;
}, z$1.core.$strip>, z$1.ZodObject<{
    schema: z$1.ZodCustom<z$1.ZodArray<z$1.ZodType<SerializableValue, unknown, z$1.core.$ZodTypeInternals<SerializableValue, unknown>>> | z$1.ZodRecord<z$1.ZodString, z$1.ZodType<SerializableValue, unknown, z$1.core.$ZodTypeInternals<SerializableValue, unknown>>>, z$1.ZodArray<z$1.ZodType<SerializableValue, unknown, z$1.core.$ZodTypeInternals<SerializableValue, unknown>>> | z$1.ZodRecord<z$1.ZodString, z$1.ZodType<SerializableValue, unknown, z$1.core.$ZodTypeInternals<SerializableValue, unknown>>>>;
    type: z$1.ZodLiteral<"freeform">;
}, z$1.core.$strip>]>;
type StoreConfig<T extends "input" | "output"> = T extends "input" ? z$1.input<typeof storeConfigSchema> : z$1.output<typeof storeConfigSchema>;
type StoreRetrieve<Config extends StoreConfig<"output">> = () => z$1.infer<Config["schema"]> | Promise<z$1.infer<Config["schema"]>>;
interface StoreDefinition {
    name: string;
    config: StoreConfig<"output">;
    retrieve?: () => unknown | Promise<unknown>;
}
declare class StoreDefinitionBuilder<const Definition extends StoreDefinition, Excluded extends string = never> {
    _definition: Definition;
    constructor(def: Definition);
    config<Config extends StoreConfig<"input">>(config: Config): Omit<StoreDefinitionBuilder<Definition & {
        config: Config;
    }, "config" | Excluded | (Config["type"] extends "controlled" ? never : "retrieve")>, "config" | Excluded | (Config["type"] extends "controlled" ? never : "retrieve")>;
    retrieve(retrieve: StoreRetrieve<Definition["config"]>): Omit<StoreDefinitionBuilder<Definition & {
        retrieve: StoreRetrieve<Definition["config"]>;
    }, Excluded | "retrieve">, Excluded | "retrieve">;
}
declare function defineStore<const Name extends string>(name: Name): StoreDefinitionBuilder<{
    readonly name: Name;
    readonly config: {
        schema: z$1.ZodArray<z$1.ZodType<SerializableValue, unknown, z$1.core.$ZodTypeInternals<SerializableValue, unknown>>> | z$1.ZodRecord<z$1.ZodString, z$1.ZodType<SerializableValue, unknown, z$1.core.$ZodTypeInternals<SerializableValue, unknown>>>;
        type: "controlled";
        ttl?: number | undefined;
    } | {
        schema: z$1.ZodArray<z$1.ZodType<SerializableValue, unknown, z$1.core.$ZodTypeInternals<SerializableValue, unknown>>> | z$1.ZodRecord<z$1.ZodString, z$1.ZodType<SerializableValue, unknown, z$1.core.$ZodTypeInternals<SerializableValue, unknown>>>;
        type: "freeform";
    };
}, never>;

declare const agentToolRequestSchema: z$1.ZodObject<{
    toolRequestId: z$1.ZodString;
    toolName: z$1.ZodString;
    toolInput: z$1.ZodRecord<z$1.ZodString, z$1.ZodAny>;
}, z$1.core.$strip>;
type AgentToolRequest = z$1.output<typeof agentToolRequestSchema>;
declare const messageSchema: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{
    role: z$1.ZodLiteral<"user">;
    content: z$1.ZodPrefault<z$1.ZodString>;
    id: z$1.ZodString;
    createdAt: z$1.ZodNumber;
    lastUpdated: z$1.ZodNumber;
}, z$1.core.$strip>, z$1.ZodObject<{
    role: z$1.ZodLiteral<"system">;
    content: z$1.ZodPrefault<z$1.ZodString>;
    id: z$1.ZodString;
    createdAt: z$1.ZodNumber;
    lastUpdated: z$1.ZodNumber;
}, z$1.core.$strip>, z$1.ZodObject<{
    role: z$1.ZodLiteral<"agent">;
    content: z$1.ZodPrefault<z$1.ZodString>;
    toolsRequests: z$1.ZodPrefault<z$1.ZodArray<z$1.ZodObject<{
        toolRequestId: z$1.ZodString;
        toolName: z$1.ZodString;
        toolInput: z$1.ZodRecord<z$1.ZodString, z$1.ZodAny>;
    }, z$1.core.$strip>>>;
    id: z$1.ZodString;
    createdAt: z$1.ZodNumber;
    lastUpdated: z$1.ZodNumber;
}, z$1.core.$strip>, z$1.ZodObject<{
    role: z$1.ZodLiteral<"tool">;
    toolRequestId: z$1.ZodString;
    toolName: z$1.ZodString;
    toolSuccess: z$1.ZodBoolean;
    toolOutput: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodAny>>;
    toolError: z$1.ZodOptional<z$1.ZodString>;
    id: z$1.ZodString;
    createdAt: z$1.ZodNumber;
    lastUpdated: z$1.ZodNumber;
}, z$1.core.$strip>], "role">;
type Message = z$1.output<typeof messageSchema>;

interface _MemoryDependenciesDefinition {
    stores: {
        name: string;
    }[];
    collections: {
        name: string;
    }[];
}
type MemoryDependenciesDefinition = _MemoryDependenciesDefinition | {
    _definition: _MemoryDependenciesDefinition;
};
declare const memoryConfigSchema: z$1.ZodObject<{
    behavior: z$1.ZodPrefault<z$1.ZodEnum<{
        blocking: "blocking";
        "non-blocking": "non-blocking";
    }>>;
}, z$1.core.$strip>;
type MemoryConfig<T extends "input" | "output"> = T extends "input" ? z$1.input<typeof memoryConfigSchema> : z$1.output<typeof memoryConfigSchema>;
interface MemoryDefinition {
    name: string;
    config: MemoryConfig<"output">;
    output?: Message[] | ((params: {
        messages: Message[];
    }) => Message[] | Promise<Message[]>);
    onHistoryChange?: (params: {
        messages: Message[];
    }) => void;
    dependencies: MemoryDependenciesDefinition;
}
declare class MemoryDefinitionBuilder<const Definition extends MemoryDefinition, Excluded extends string = never> {
    _definition: Definition;
    constructor(def: Definition);
    dependencies<Dependencies extends MemoryDependenciesDefinition>(dependencies: Dependencies): Omit<MemoryDefinitionBuilder<Definition & {
        dependencies: Dependencies;
    }, "dependencies" | Excluded>, "dependencies" | Excluded>;
    config(config: MemoryConfig<"input">): Omit<MemoryDefinitionBuilder<Definition & {
        config: {
            behavior: "blocking" | "non-blocking";
        };
    }, "config" | Excluded>, "config" | Excluded>;
    output(params: Message[] | ((params: {
        messages: Message[];
    }) => Message[] | Promise<Message[]>)): Omit<MemoryDefinitionBuilder<Definition & {
        output: typeof params;
    }, "output" | Excluded>, "output" | Excluded>;
    onHistoryChange(params: (params: {
        messages: Message[];
    }) => void): Omit<MemoryDefinitionBuilder<Definition & {
        onHistoryChange: typeof params;
    }, Excluded | "onHistoryChange">, Excluded | "onHistoryChange">;
}
declare function defineMemory<const Name extends string>(name: Name): MemoryDefinitionBuilder<{
    readonly name: Name;
    readonly config: {
        behavior: "blocking" | "non-blocking";
    };
    readonly dependencies: {
        readonly stores: [];
        readonly collections: [];
    };
}, never>;

declare abstract class EOUBase<ConfigSchema extends z$1.ZodObject> {
    protected config: z$1.infer<ConfigSchema>;
    constructor(configSchema: ConfigSchema, config: Partial<z$1.infer<ConfigSchema>>);
    abstract predict(messages: Message[]): Promise<number> | number;
}

declare const livekitEOUConfig: ZodObjectWithTelemetry<z$1.ZodObject<{
    provider: z$1.ZodLiteral<"livekit">;
    quantized: z$1.ZodPrefault<z$1.ZodBoolean>;
    maxMessages: z$1.ZodPrefault<z$1.ZodNumber>;
    maxTokens: z$1.ZodPrefault<z$1.ZodNumber>;
}, z$1.core.$strip>, "output">;
declare class LivekitEOU extends EOUBase<typeof livekitEOUConfig.schema> {
    #private;
    constructor(config: z$1.input<typeof livekitEOUConfig.schema>);
    predict(messages: Message[]): Promise<number>;
}

declare const turnSenseEOUConfig: ZodObjectWithTelemetry<z$1.ZodObject<{
    provider: z$1.ZodLiteral<"turnsense">;
    quantized: z$1.ZodPrefault<z$1.ZodBoolean>;
    maxMessages: z$1.ZodPrefault<z$1.ZodNumber>;
}, z$1.core.$strip>, "output">;
declare class TurnSenseEOU extends EOUBase<typeof turnSenseEOUConfig.schema> {
    #private;
    constructor(config: z$1.input<typeof turnSenseEOUConfig.schema>);
    predict(messages: Message[]): Promise<number>;
}

declare const eouProviders: {
    readonly turnsense: {
        readonly class: typeof TurnSenseEOU;
        readonly configSchema: z.ZodObject<{
            provider: z.ZodLiteral<"turnsense">;
            quantized: z.ZodPrefault<z.ZodBoolean>;
            maxMessages: z.ZodPrefault<z.ZodNumber>;
        }, zod_v4_core.$strip>;
    };
    readonly livekit: {
        readonly class: typeof LivekitEOU;
        readonly configSchema: z.ZodObject<{
            provider: z.ZodLiteral<"livekit">;
            quantized: z.ZodPrefault<z.ZodBoolean>;
            maxMessages: z.ZodPrefault<z.ZodNumber>;
            maxTokens: z.ZodPrefault<z.ZodNumber>;
        }, zod_v4_core.$strip>;
    };
};
type EOUProvider = (typeof eouProviders)[keyof typeof eouProviders]["class"];

declare const llmToolSchema: z__default.ZodObject<{
    name: z__default.ZodString;
    description: z__default.ZodString;
    schema: z__default.ZodObject<{
        input: z__default.ZodCustom<z__default.ZodObject<z__default.core.$ZodLooseShape, z__default.core.$strip>, z__default.ZodObject<z__default.core.$ZodLooseShape, z__default.core.$strip>>;
        output: z__default.ZodCustom<z__default.ZodObject<z__default.core.$ZodLooseShape, z__default.core.$strip>, z__default.ZodObject<z__default.core.$ZodLooseShape, z__default.core.$strip>>;
    }, z__default.core.$strip>;
    run: z__default.ZodFunction<z__default.ZodTuple<readonly [z__default.ZodRecord<z__default.ZodString, z__default.ZodAny>], null>, z__default.ZodUnion<readonly [z__default.ZodObject<{
        success: z__default.ZodBoolean;
        output: z__default.ZodOptional<z__default.ZodRecord<z__default.ZodString, z__default.ZodAny>>;
        error: z__default.ZodOptional<z__default.ZodString>;
    }, z__default.core.$strip>, z__default.ZodPromise<z__default.ZodObject<{
        success: z__default.ZodBoolean;
        output: z__default.ZodOptional<z__default.ZodRecord<z__default.ZodString, z__default.ZodAny>>;
        error: z__default.ZodOptional<z__default.ZodString>;
    }, z__default.core.$strip>>]>>;
}, z__default.core.$strip>;
/**
 * Represents a tool definition for an LLM.
 */
type LLMToolDefinition = z__default.infer<typeof llmToolSchema>;

type LLMGenerateMessageChunk = {
    type: "content";
    content: string;
} | {
    type: "tools";
    tools: AgentToolRequest[];
} | {
    type: "end";
} | {
    type: "error";
    error: string;
};
interface LLMGenerateMessageJob {
    id: string;
    cancel: () => void;
    stream: AsyncQueue<LLMGenerateMessageChunk>;
    _abortController: AbortController;
}
type LLMGenerateObjectChunk<T extends z$1.ZodObject> = {
    type: "content";
    data: z$1.infer<T>;
} | {
    type: "error";
    error: string;
};
/**
 * Base class for all LLMs providers.
 */
declare abstract class LLMBase<ConfigSchema extends z$1.ZodObject> {
    config: z$1.infer<ConfigSchema>;
    constructor(configSchema: ConfigSchema, config: Partial<z$1.infer<ConfigSchema>>);
    protected createGenerateMessageJob(): LLMGenerateMessageJob;
    abstract generateMessage(params: {
        messages: Message[];
        tools: LLMToolDefinition[];
    }): Promise<LLMGenerateMessageJob>;
    abstract generateObject<T extends z$1.ZodObject>(params: {
        messages: Message[];
        schema: T;
    }): Promise<LLMGenerateObjectChunk<T>>;
}

declare const mistralLLMConfig: ZodObjectWithTelemetry<z$1.ZodObject<{
    provider: z$1.ZodLiteral<"mistral">;
    apiKey: z$1.ZodPrefault<z$1.ZodString>;
    model: z$1.ZodPrefault<z$1.ZodEnum<{
        "mistral-large-latest": "mistral-large-latest";
        "mistral-large-2411": "mistral-large-2411";
        "mistral-large-2407": "mistral-large-2407";
        "mistral-small-latest": "mistral-small-latest";
        "mistral-small-2501": "mistral-small-2501";
        "mistral-small-2503": "mistral-small-2503";
        "mistral-medium-latest": "mistral-medium-latest";
        "mistral-medium-2505": "mistral-medium-2505";
        "pixtral-large-latest": "pixtral-large-latest";
        "pixtral-large-2411": "pixtral-large-2411";
        "codestral-latest": "codestral-latest";
        "codestral-2501": "codestral-2501";
        "codestral-2405": "codestral-2405";
        "ministral-3b-latest": "ministral-3b-latest";
        "ministral-8b-latest": "ministral-8b-latest";
        "open-mistral-7b": "open-mistral-7b";
        "open-mixtral-8x7b": "open-mixtral-8x7b";
        "open-mixtral-8x22b": "open-mixtral-8x22b";
    }>>;
    temperature: z$1.ZodPrefault<z$1.ZodNumber>;
}, z$1.core.$strip>, "output">;
declare class MistralLLM extends LLMBase<typeof mistralLLMConfig.schema> {
    #private;
    constructor(config: z$1.input<typeof mistralLLMConfig.schema>);
    /**
     * Generate a message with job management - returns jobId along with stream
     */
    generateMessage(params: Parameters<typeof LLMBase.prototype.generateMessage>[0]): Promise<LLMGenerateMessageJob>;
    generateObject<T extends z$1.ZodObject>(params: {
        messages: Message[];
        schema: T;
    }): Promise<LLMGenerateObjectChunk<T>>;
}

declare const openAILLMConfig: ZodObjectWithTelemetry<z$1.ZodObject<{
    provider: z$1.ZodLiteral<"openai">;
    apiKey: z$1.ZodPrefault<z$1.ZodString>;
    model: z$1.ZodPrefault<z$1.ZodEnum<{
        "gpt-4o-mini": "gpt-4o-mini";
        "gpt-4o": "gpt-4o";
        "gpt-5": "gpt-5";
        "gpt-5-nano": "gpt-5-nano";
    }>>;
    temperature: z$1.ZodPrefault<z$1.ZodNumber>;
}, z$1.core.$strip>, "output">;
declare class OpenAILLM extends LLMBase<typeof openAILLMConfig.schema> {
    #private;
    constructor(config: z$1.input<typeof openAILLMConfig.schema>);
    /**
     * Generate a message with job management - returns jobId along with stream
     */
    generateMessage(params: Parameters<typeof LLMBase.prototype.generateMessage>[0]): Promise<LLMGenerateMessageJob>;
    generateObject<T extends z$1.ZodObject>(params: {
        messages: Message[];
        schema: T;
    }): Promise<LLMGenerateObjectChunk<T>>;
}

declare const xaiLLMConfig: ZodObjectWithTelemetry<z$1.ZodObject<{
    provider: z$1.ZodLiteral<"xai">;
    apiKey: z$1.ZodPrefault<z$1.ZodString>;
    model: z$1.ZodPrefault<z$1.ZodEnum<{
        "grok-3": "grok-3";
        "grok-3-fast": "grok-3-fast";
        "grok-3-mini": "grok-3-mini";
        "grok-3-mini-fast": "grok-3-mini-fast";
        "grok-2-1212": "grok-2-1212";
        "grok-2-vision-1212": "grok-2-vision-1212";
        "grok-beta": "grok-beta";
        "grok-vision-beta": "grok-vision-beta";
    }>>;
    temperature: z$1.ZodPrefault<z$1.ZodNumber>;
}, z$1.core.$strip>, "output">;
declare class XaiLLM extends LLMBase<typeof xaiLLMConfig.schema> {
    #private;
    constructor(config: z$1.input<typeof xaiLLMConfig.schema>);
    /**
     * Generate a message with job management - returns jobId along with stream
     */
    generateMessage(params: Parameters<typeof LLMBase.prototype.generateMessage>[0]): Promise<LLMGenerateMessageJob>;
    generateObject<T extends z$1.ZodObject>(params: {
        messages: Message[];
        schema: T;
    }): Promise<LLMGenerateObjectChunk<T>>;
}

declare const llmProviders: {
    readonly mistral: {
        readonly class: typeof MistralLLM;
        readonly configSchema: ZodObjectWithTelemetry<z.ZodObject<{
            provider: z.ZodLiteral<"mistral">;
            apiKey: z.ZodPrefault<z.ZodString>;
            model: z.ZodPrefault<z.ZodEnum<{
                "mistral-large-latest": "mistral-large-latest";
                "mistral-large-2411": "mistral-large-2411";
                "mistral-large-2407": "mistral-large-2407";
                "mistral-small-latest": "mistral-small-latest";
                "mistral-small-2501": "mistral-small-2501";
                "mistral-small-2503": "mistral-small-2503";
                "mistral-medium-latest": "mistral-medium-latest";
                "mistral-medium-2505": "mistral-medium-2505";
                "pixtral-large-latest": "pixtral-large-latest";
                "pixtral-large-2411": "pixtral-large-2411";
                "codestral-latest": "codestral-latest";
                "codestral-2501": "codestral-2501";
                "codestral-2405": "codestral-2405";
                "ministral-3b-latest": "ministral-3b-latest";
                "ministral-8b-latest": "ministral-8b-latest";
                "open-mistral-7b": "open-mistral-7b";
                "open-mixtral-8x7b": "open-mixtral-8x7b";
                "open-mixtral-8x22b": "open-mixtral-8x22b";
            }>>;
            temperature: z.ZodPrefault<z.ZodNumber>;
        }, zod_v4_core.$strip>, "output">;
    };
    readonly openai: {
        readonly class: typeof OpenAILLM;
        readonly configSchema: ZodObjectWithTelemetry<z.ZodObject<{
            provider: z.ZodLiteral<"openai">;
            apiKey: z.ZodPrefault<z.ZodString>;
            model: z.ZodPrefault<z.ZodEnum<{
                "gpt-4o-mini": "gpt-4o-mini";
                "gpt-4o": "gpt-4o";
                "gpt-5": "gpt-5";
                "gpt-5-nano": "gpt-5-nano";
            }>>;
            temperature: z.ZodPrefault<z.ZodNumber>;
        }, zod_v4_core.$strip>, "output">;
    };
    readonly xai: {
        readonly class: typeof XaiLLM;
        readonly configSchema: ZodObjectWithTelemetry<z.ZodObject<{
            provider: z.ZodLiteral<"xai">;
            apiKey: z.ZodPrefault<z.ZodString>;
            model: z.ZodPrefault<z.ZodEnum<{
                "grok-3": "grok-3";
                "grok-3-fast": "grok-3-fast";
                "grok-3-mini": "grok-3-mini";
                "grok-3-mini-fast": "grok-3-mini-fast";
                "grok-2-1212": "grok-2-1212";
                "grok-2-vision-1212": "grok-2-vision-1212";
                "grok-beta": "grok-beta";
                "grok-vision-beta": "grok-vision-beta";
            }>>;
            temperature: z.ZodPrefault<z.ZodNumber>;
        }, zod_v4_core.$strip>, "output">;
    };
};
type LLMProvider = (typeof llmProviders)[keyof typeof llmProviders]["class"];

type STTChunk = {
    type: "content";
    textChunk: string;
} | {
    type: "end";
} | {
    type: "error";
    error: string;
};
type STTJob = {
    id: string;
    stream: AsyncQueue<STTChunk>;
    cancel: () => void;
    inputVoice: (chunk: Int16Array) => void;
    _abortController: AbortController;
};
/**
 * Base class for all STT providers.
 */
declare abstract class STTBase<ConfigSchema extends z$1.ZodObject> {
    protected config: z$1.infer<ConfigSchema>;
    constructor(configSchema: ConfigSchema, config: Partial<z$1.infer<ConfigSchema>>);
    protected createGenerateJob(): STTJob;
    abstract generate(): Promise<STTJob>;
    protected abstract onVoiceInput(job: STTJob, pcm: Int16Array): Promise<void>;
}

declare const deepgramSTTConfig: ZodObjectWithTelemetry<z$1.ZodObject<{
    provider: z$1.ZodLiteral<"deepgram">;
    apiKey: z$1.ZodPrefault<z$1.ZodString>;
    model: z$1.ZodPrefault<z$1.ZodEnum<{
        "nova-3": "nova-3";
        "nova-2": "nova-2";
        "nova-2-general": "nova-2-general";
        "nova-2-meeting": "nova-2-meeting";
        "nova-2-phonecall": "nova-2-phonecall";
        "nova-2-voicemail": "nova-2-voicemail";
        "nova-2-finance": "nova-2-finance";
        "nova-2-conversationalai": "nova-2-conversationalai";
        "nova-2-video": "nova-2-video";
        "nova-2-medical": "nova-2-medical";
        "nova-2-drivethru": "nova-2-drivethru";
        "nova-2-automotive": "nova-2-automotive";
        "nova-2-atc": "nova-2-atc";
        nova: "nova";
        "nova-general": "nova-general";
        "nova-phonecall": "nova-phonecall";
        enhanced: "enhanced";
        "enhanced-general": "enhanced-general";
        "enhanced-meeting": "enhanced-meeting";
        "enhanced-phonecall": "enhanced-phonecall";
        "enhanced-finance": "enhanced-finance";
        base: "base";
        "base-general": "base-general";
        "base-meeting": "base-meeting";
        "base-phonecall": "base-phonecall";
        "base-voicemail": "base-voicemail";
        "base-finance": "base-finance";
        "base-conversationalai": "base-conversationalai";
        "base-video": "base-video";
        "whisper-tiny": "whisper-tiny";
        "whisper-base": "whisper-base";
        "whisper-small": "whisper-small";
        "whisper-medium": "whisper-medium";
        "whisper-large": "whisper-large";
    }>>;
    language: z$1.ZodPrefault<z$1.ZodString>;
}, z$1.core.$strip>, "output">;
declare class DeepgramSTT extends STTBase<typeof deepgramSTTConfig.schema> {
    #private;
    constructor(config: z$1.input<typeof deepgramSTTConfig.schema>);
    generate(): Promise<STTJob>;
    protected onVoiceInput(job: STTJob, pcm: Int16Array): Promise<void>;
}

declare const sttProviders: {
    readonly deepgram: {
        readonly class: typeof DeepgramSTT;
        readonly configSchema: ZodObjectWithTelemetry<z.ZodObject<{
            provider: z.ZodLiteral<"deepgram">;
            apiKey: z.ZodPrefault<z.ZodString>;
            model: z.ZodPrefault<z.ZodEnum<{
                "nova-3": "nova-3";
                "nova-2": "nova-2";
                "nova-2-general": "nova-2-general";
                "nova-2-meeting": "nova-2-meeting";
                "nova-2-phonecall": "nova-2-phonecall";
                "nova-2-voicemail": "nova-2-voicemail";
                "nova-2-finance": "nova-2-finance";
                "nova-2-conversationalai": "nova-2-conversationalai";
                "nova-2-video": "nova-2-video";
                "nova-2-medical": "nova-2-medical";
                "nova-2-drivethru": "nova-2-drivethru";
                "nova-2-automotive": "nova-2-automotive";
                "nova-2-atc": "nova-2-atc";
                nova: "nova";
                "nova-general": "nova-general";
                "nova-phonecall": "nova-phonecall";
                enhanced: "enhanced";
                "enhanced-general": "enhanced-general";
                "enhanced-meeting": "enhanced-meeting";
                "enhanced-phonecall": "enhanced-phonecall";
                "enhanced-finance": "enhanced-finance";
                base: "base";
                "base-general": "base-general";
                "base-meeting": "base-meeting";
                "base-phonecall": "base-phonecall";
                "base-voicemail": "base-voicemail";
                "base-finance": "base-finance";
                "base-conversationalai": "base-conversationalai";
                "base-video": "base-video";
                "whisper-tiny": "whisper-tiny";
                "whisper-base": "whisper-base";
                "whisper-small": "whisper-small";
                "whisper-medium": "whisper-medium";
                "whisper-large": "whisper-large";
            }>>;
            language: z.ZodPrefault<z.ZodString>;
        }, zod_v4_core.$strip>, "output">;
    };
};
type STTProvider = (typeof sttProviders)[keyof typeof sttProviders]["class"];

type TTSChunk = {
    type: "content";
    voiceChunk: Int16Array;
    textChunk: string;
    durationMs: number;
} | {
    type: "end";
} | {
    type: "error";
    error: string;
};
type TTSChunkInput = {
    type: "content";
    voiceChunk: Int16Array;
} | {
    type: "end";
} | {
    type: "error";
    error: string;
};
interface TTSJob {
    id: string;
    stream: AsyncQueue<TTSChunk>;
    cancel: () => void;
    inputText: (text: string, isLast?: boolean) => Promise<void>;
    _abortController: AbortController;
    _receiveVoiceChunk: (chunk: TTSChunkInput) => Promise<void>;
}
/**
 * Base class for all TTS providers.
 */
declare abstract class TTSBase<ConfigSchema extends z$1.ZodObject> {
    #private;
    config: z$1.infer<ConfigSchema>;
    constructor(configSchema: ConfigSchema, config: Partial<z$1.infer<ConfigSchema>>);
    protected createGenerateJob(): TTSJob;
    abstract generate(): Promise<TTSJob>;
    protected abstract onTextInput(job: TTSJob, text: string, isLast: boolean): Promise<void>;
}

declare const cartesiaTTSConfig: ZodObjectWithTelemetry<z$1.ZodObject<{
    provider: z$1.ZodLiteral<"cartesia">;
    apiKey: z$1.ZodPrefault<z$1.ZodString>;
    model: z$1.ZodPrefault<z$1.ZodEnum<{
        "sonic-2": "sonic-2";
        "sonic-turbo": "sonic-turbo";
        sonic: "sonic";
        "sonic-3": "sonic-3";
    }>>;
    language: z$1.ZodPrefault<z$1.ZodEnum<{
        pt: "pt";
        en: "en";
        fr: "fr";
        de: "de";
        es: "es";
        zh: "zh";
        ja: "ja";
        hi: "hi";
        it: "it";
        ko: "ko";
        nl: "nl";
        pl: "pl";
        ru: "ru";
        sv: "sv";
        tr: "tr";
    }>>;
    voiceId: z$1.ZodPrefault<z$1.ZodString>;
}, z$1.core.$strip>, "output">;
declare class CartesiaTTS extends TTSBase<typeof cartesiaTTSConfig.schema> {
    #private;
    constructor(config: z$1.input<typeof cartesiaTTSConfig.schema>);
    generate(): Promise<TTSJob>;
    protected onTextInput(job: TTSJob, text: string, isLast?: boolean): Promise<void>;
}

declare const ttsProviders: {
    readonly cartesia: {
        readonly class: typeof CartesiaTTS;
        readonly configSchema: ZodObjectWithTelemetry<z.ZodObject<{
            provider: z.ZodLiteral<"cartesia">;
            apiKey: z.ZodPrefault<z.ZodString>;
            model: z.ZodPrefault<z.ZodEnum<{
                "sonic-2": "sonic-2";
                "sonic-turbo": "sonic-turbo";
                sonic: "sonic";
                "sonic-3": "sonic-3";
            }>>;
            language: z.ZodPrefault<z.ZodEnum<{
                pt: "pt";
                en: "en";
                fr: "fr";
                de: "de";
                es: "es";
                zh: "zh";
                ja: "ja";
                hi: "hi";
                it: "it";
                ko: "ko";
                nl: "nl";
                pl: "pl";
                ru: "ru";
                sv: "sv";
                tr: "tr";
            }>>;
            voiceId: z.ZodPrefault<z.ZodString>;
        }, zod_v4_core.$strip>, "output">;
    };
};
type TTSProvider = (typeof ttsProviders)[keyof typeof ttsProviders]["class"];

type VADChunk = {
    type: "result";
    chunk: Int16Array;
    score: number;
};
type VADJob = {
    id: string;
    cancel: () => void;
    stream: AsyncQueue<VADChunk>;
    inputVoice: (pcm: Int16Array) => void;
    _abortController: AbortController;
};
declare abstract class VADBase<ConfigSchema extends z$1.ZodObject> {
    protected config: z$1.infer<ConfigSchema>;
    constructor(configSchema: ConfigSchema, config: Partial<z$1.infer<ConfigSchema>>);
    protected createGenerateJob(): VADJob;
    /**
     * Create a new job to detect voice activity of an incomoing audio stream.
     */
    abstract detect(): Promise<VADJob>;
    protected abstract onVoiceInput(job: VADJob, pcm: Int16Array): Promise<void>;
}

declare const sileroVADConfig: ZodObjectWithTelemetry<z$1.ZodObject<{
    provider: z$1.ZodLiteral<"silero">;
}, z$1.core.$strip>, "output">;
declare class SileroVAD extends VADBase<typeof sileroVADConfig.schema> {
    #private;
    constructor(config: z$1.input<typeof sileroVADConfig.schema>);
    detect(): Promise<VADJob>;
    protected onVoiceInput(job: VADJob, pcm: Int16Array): Promise<void>;
}

declare const vadProviders: {
    readonly silero: {
        readonly class: typeof SileroVAD;
        readonly configSchema: ZodObjectWithTelemetry<z.ZodObject<{
            provider: z.ZodLiteral<"silero">;
        }, zod_v4_core.$strip>, "output">;
    };
};
type VADProvider = (typeof vadProviders)[keyof typeof vadProviders]["class"];

/**
 * The telemetry client provides a unified interface for logging, tracing, and metrics
 * collection across the Life.js codebase. The collected data is almost OTEL-compliant
 * and can be piped to any provider via consumers registering.
 *
 * @dev The program shouldn't fail or throw an error because of telemetry, so the
 * telemetry clients are not using the 'operation' library, they swallow and log any error.
 *
 * @todo Support auto-capture OTEL telemetry data from nested libraries.
 * @todo Properly parse and clean stack traces. Right now, we're using the raw stack trace string from the Error object.
 */
declare abstract class TelemetryClient {
    #private;
    readonly scope: string;
    readonly resource: TelemetryResource;
    clientAttributes: TelemetryAttributes;
    constructor(scopesDefinition: TelemetryScopesDefinition, scope: string);
    protected abstract getResource(): TelemetryResource;
    protected abstract getCurrentSpanData(): TelemetrySpan | undefined;
    protected abstract runWithSpanData(spanData: TelemetrySpan | undefined, fn: () => unknown): unknown;
    /**
     * Registers a callback consumer to receive telemetry data from all the clients.
     * @param consumer - The consumer to register
     * @returns A function that unregisters the consumer when called
     * @example
     * ```typescript
     * const unregister = telemetry.registerGlobalConsumer(myConsumer);
     * unregister(); // Later, to stop receiving events
     * ```
     */
    static registerGlobalConsumer(consumer: TelemetryConsumer): () => void;
    /**
     * Flushes any globally pending telemetry data, ensuring that all the consumers
     * of all the TelemetryClient instances have finished processing before returning
     * or until the timeout is reached.
     * @param timeoutMs - Maximum time to wait in milliseconds (default: 10000ms)
     * @returns A promise that resolves when flushing is complete or timeout is reached
     */
    static flushAllConsumers(timeoutMs?: number): Promise<void>;
    /**
     * Registers a callback consumer to receive telemetry data from this client.
     * @param consumer - The consumer to register
     * @returns A function that unregisters the consumer when called
     * @example
     * ```typescript
     * const unregister = telemetry.registerConsumer(myConsumer);
     * unregister(); // Later, to stop receiving events
     * ```
     */
    registerConsumer(consumer: TelemetryConsumer): () => void;
    /**
     * Flushes any pending telemetry data, ensuring that all consumers have finished
     * processing before returning or until the timeout is reached.
     * @param timeoutMs - Maximum time to wait in milliseconds (default: 10000ms)
     * @returns A promise that resolves when flushing is complete or timeout is reached
     */
    flushConsumers(timeoutMs?: number): Promise<void>;
    /**
     * Sets a client-level attribute that will be included in all telemetry data from this client.
     * @param key - The attribute key
     * @param value - The attribute value (must be serializable, else will be ignored)
     * @example
     * ```typescript
     * telemetry.setAttribute("modelId", "abc");
     * telemetry.setAttribute("region", "us-west-2");
     * ```
     */
    setAttribute(key: string, value: unknown): void;
    /**
     * Sets multiple client-level attributes that will be included in all telemetry data from this client.
     * @param attributes - The attributes to set
     * @example
     * ```typescript
     * telemetry.setAttributes({ modelId: "abc", region: "us-west-2" });
     * ```
     */
    setAttributes(attributes: TelemetryAttributes): void;
    /**
     * Measure the duration and capture logs about an operation.
     * Automatically handles both sync and async functions, preserving their return types.
     * trace() calls can be nested and will produce nested spans.
     * @param name - The name of the operation being traced
     * @param fn - The function to execute within the span context (sync or async)
     * @param options - Optional attributes and parent span
     * @returns The result of the function (direct value for sync, Promise for async)
     * @example
     * ```typescript
     * // Sync function - no await needed
     * const hash = telemetry.trace("compute-hash", ({ log, setAttribute }) => {
     *   log.info({ message: "Computing hash" });
     *   const result = computeHash(data);
     *   setAttribute("algorithm", "sha256");
     *   return result;
     * }, { attributes: { dataSize: data.length } });
     *
     * // Async function - await the result
     * const user = await telemetry.trace("fetch-user", async ({ log }) => {
     *   log.info({ message: "Fetching user" });
     *   const response = await fetch(`/api/users/${id}`);
     *   return response.json();
     * }, { attributes: { userId: id } });
     *
     * // Early end example:
     * telemetry.trace("process-item", ({ end }) => {
     *   if (shouldSkip) {
     *     end();
     *     return;
     *   }
     *   // ... process item
     * });
     * ```
     */
    trace<T>(name: string, fn: (params: TelemetrySpanHandle) => T, options?: {
        attributes?: TelemetryAttributes;
        parent?: TelemetrySpanHandle;
    }): T;
    /**
     * Get the ambient tracing span handle.
     * @returns The current tracing span parent (if any)
     */
    getCurrentSpan(): TelemetrySpanHandle | undefined;
    /**
     * Send a telemetry signal to all consumers.
     * This a raw method, prefer using log.*(), counter(), updown(), histogram(), etc.
     * @param signal - The telemetry signal to send
     */
    sendSignal(signal: TelemetrySignal, throwOnError?: boolean): void;
    /**
     * Unsafe version of sendSignal() bypassing all validation and checks.
     * Used internally to forward telemetry signals between processes.
     * @internal
     */
    _unsafeSendSignal(signal: TelemetrySignal): void;
    /**
     * Creates a counter metric for tracking monotonically increasing values.
     * @param name - The name of the counter metric
     * @returns An object with methods to increment the counter
     * @example
     * ```typescript
     * const requestCounter = telemetry.counter("http_requests_total");
     * requestCounter.increment({ method: "GET", status: "200" });
     * requestCounter.add(5, { batch: "true" });
     * ```
     */
    counter(name: string): {
        add: (n: number | bigint, attributes?: TelemetryAttributes) => void;
        increment: (attributes?: TelemetryAttributes) => void;
    };
    /**
     * Creates an up/down counter metric for tracking values that can increase or decrease.
     * @param name - The name of the up/down counter metric
     * @returns An object with methods to modify the counter
     * @example
     * ```typescript
     * const connectionGauge = telemetry.updown("active_connections");
     * connectionGauge.increment(); // New connection
     * connectionGauge.decrement(); // Connection closed
     * connectionGauge.add(10); // Bulk connections
     * ```
     */
    updown(name: string): {
        add: (n: number | bigint, attributes?: TelemetryAttributes) => void;
        remove: (n: number | bigint, attributes?: TelemetryAttributes) => void;
        increment: (attributes?: TelemetryAttributes) => void;
        decrement: (attributes?: TelemetryAttributes) => void;
    };
    /**
     * Creates a histogram metric for recording value distributions over time.
     * @param name - The name of the histogram metric
     * @returns An object with a method to record values
     * @example
     * ```typescript
     * const latencyHistogram = telemetry.histogram("request_duration_ms");
     * latencyHistogram.record(responseTime, { endpoint: "/api/users" });
     * ```
     */
    histogram(name: string): {
        record: (value: number | bigint, attributes?: TelemetryAttributes) => void;
    };
    /**
     * Log writer for recording events at different severity levels.
     * Logs are automatically associated with the current span context if one exists.
     * @example
     * ```typescript
     * telemetry.log.info({ message: "Server started", attributes: { port: 3000 } });
     * telemetry.log.error({ error: new Error("Connection failed"), attributes: { host: "db.example.com" } });
     * telemetry.log.warn({ message: "Deprecated API used", attributes: { endpoint: "/v1/users" } });
     * ```
     */
    log: TelemetryLogHandle;
}

declare class PluginServer<const PluginDef extends PluginDefinition> {
    #private;
    readonly def: PluginDef;
    readonly agent: AgentServer;
    readonly config: PluginConfig<PluginDef["config"], "output">;
    context: PluginContext<PluginDef["context"], "output">;
    readonly telemetry: TelemetryClient;
    readonly queue: AsyncQueue<PluginEvent<PluginDef["events"], "output">>;
    readonly eventsListeners: Map<string, PluginEventsListener>;
    readonly contextListeners: Map<string, PluginContextListener>;
    readonly streamHandlersQueues: AsyncQueue<PluginEvent<PluginDef["events"], "output">>[];
    readonly externalInterceptHandlers: {
        dependent: PluginServer<PluginDefinition>;
        handler: PluginHandlerDefinition;
    }[];
    constructor({ agent, definition, config, context, }: {
        agent: AgentServer;
        definition: PluginDef;
        config: PluginConfig<PluginDef["config"], "input">;
        context: SerializableValue;
    });
    /**
     * Produces an accessor object, exposing methods to interact safely with the plugin
     * from a given source (plugin, handler, client).
     * @param source - The source accessing the plugin.
     * @param handlerAccess - The access mode for the handler.
     * @returns An accessor object.
     */
    getAccessor<Source extends PluginEventSource, HandlerAccess extends "read" | "write" = "read">(source: Source, handlerAccess?: HandlerAccess): readonly [error: LifeErrorUnion, data: undefined] | readonly [error: undefined, data: PluginAccessor<PluginDef, Source, HandlerAccess>];
    /**
     * Produces a map of dependencies' accessors, see `getAccessor()`.
     * @param source - The source accessing the dependencies.
     * @returns A map of dependencies' accessors.
     */
    getDependenciesAccessors<Source extends PluginEventSource>(source: Source): readonly [error: LifeErrorUnion, data: undefined] | readonly [error: undefined, data: PluginDependenciesAccessor<PluginDef["dependencies"], Source>];
    start(): Promise<readonly [error: LifeErrorUnion, data: undefined] | readonly [error: undefined, data: void]>;
    stop(): Promise<readonly [error: LifeErrorUnion, data: undefined] | readonly [error: undefined, data: void]>;
}

type TransportEvent = {
    type: "audio-chunk";
    chunk: Int16Array;
};
declare abstract class TransportProviderClientBase<ConfigSchema extends z$1.ZodObject> {
    config: z$1.infer<ConfigSchema>;
    listeners: Partial<Record<TransportEvent["type"], ((event: TransportEvent) => void)[]>>;
    constructor(configSchema: ConfigSchema, config: Partial<z$1.infer<ConfigSchema>>);
    on<EventType extends TransportEvent["type"]>(type: EventType, callback: (data: Extract<TransportEvent, {
        type: EventType;
    }>) => void): readonly [error: LifeErrorUnion, data: undefined] | readonly [error: undefined, data: () => void];
    abstract joinRoom(roomName: string, token: string): Promise<OperationResult<void>>;
    abstract leaveRoom(): Promise<OperationResult<void>>;
    abstract streamText(topic: string): Promise<OperationResult<Omit<WritableStreamDefaultWriter<string>, "desiredSize" | "closed" | "ready" | "abort" | "releaseLock">>>;
    abstract receiveStreamText(topic: string, callback: (iterator: AsyncIterable<string>, participantId: string) => void | Promise<void>, onError?: (error: LifeError) => void): OperationResult<() => void>;
    abstract enableMicrophone(): Promise<OperationResult<void>>;
    abstract playAudio(): Promise<OperationResult<void>>;
    abstract streamAudioChunk(chunk: Int16Array): Promise<OperationResult<void>>;
}

type RPCProcedureSchema = {
    input?: z__default.ZodObject;
    output?: z__default.ZodObject;
};
type RPCProcedure<Schema extends RPCProcedureSchema = RPCProcedureSchema> = {
    name: string;
    schema?: Schema;
    execute: (input: Schema["input"] extends z__default.ZodObject ? z__default.infer<Schema["input"]> : undefined) => MaybePromise<OperationResult<Schema["output"] extends z__default.ZodObject ? z__default.infer<Schema["output"]> : void>>;
};

declare abstract class TransportClientBase {
    #private;
    constructor({ provider, telemetry, obfuscateErrors, }: {
        provider: TransportProviderClientBase<z__default.ZodObject>;
        obfuscateErrors?: boolean;
        telemetry?: TelemetryClient | null;
    });
    sendText(topic: string, text: string): Promise<readonly [error: LifeErrorUnion, data: undefined] | readonly [error: undefined, data: void]>;
    receiveText(topic: string, callback: (text: string, participantId: string) => MaybePromise<void>, onError?: (error: LifeError) => void): readonly [error: LifeErrorUnion, data: undefined] | readonly [error: undefined, data: () => void];
    sendObject(topic: string, obj: SerializableValue): Promise<readonly [error: LifeErrorUnion, data: undefined] | readonly [error: undefined, data: void]>;
    receiveObject(topic: string, callback: (obj: unknown, participantId: string) => MaybePromise<void>, onError?: (error: LifeError) => void): readonly [error: LifeErrorUnion, data: undefined] | readonly [error: undefined, data: () => void];
    /**
     * Register a remote procedure.
     * @param procedure - The procedure to register
     */
    register<Schema extends RPCProcedureSchema>(procedure: RPCProcedure<Schema>): void;
    /**
     * Call a remote procedure.
     * @param name - The name of the procedure to call
     * @param inputs - The parameters to pass to the procedure
     * @returns A promise that resolves to the response from the procedure
     */
    call<Schema extends RPCProcedureSchema>({ name, schema, input, timeoutMs, }: {
        name: string;
        schema?: Schema;
        timeoutMs?: number;
    } & (Schema["input"] extends z__default.ZodObject ? {
        input: z__default.infer<Schema["input"]>;
    } : {
        input?: never;
    })): Promise<OperationResult<Schema["output"] extends z__default.ZodObject ? z__default.infer<Schema["output"]> : void>>;
    on: TransportProviderClientBase<z__default.ZodObject>["on"];
    joinRoom: TransportProviderClientBase<z__default.ZodObject>["joinRoom"];
    leaveRoom: TransportProviderClientBase<z__default.ZodObject>["leaveRoom"];
    streamText: TransportProviderClientBase<z__default.ZodObject>["streamText"];
    receiveStreamText: TransportProviderClientBase<z__default.ZodObject>["receiveStreamText"];
    enableMicrophone: TransportProviderClientBase<z__default.ZodObject>["enableMicrophone"];
    playAudio: TransportProviderClientBase<z__default.ZodObject>["playAudio"];
    streamAudioChunk: TransportProviderClientBase<z__default.ZodObject>["streamAudioChunk"];
}

declare const transportNodeConfig: ZodUnionWithTelemetry<"provider", readonly [ZodObjectWithTelemetry<z.ZodObject<{
    provider: z.ZodLiteral<"livekit">;
    serverUrl: z.ZodPrefault<z.ZodURL>;
    apiKey: z.ZodPrefault<z.ZodString>;
    apiSecret: z.ZodPrefault<z.ZodString>;
}, zod_v4_core.$strip>, "output">], z.ZodDiscriminatedUnion<z.ZodObject<{
    provider: z.ZodLiteral<"livekit">;
    serverUrl: z.ZodPrefault<z.ZodURL>;
    apiKey: z.ZodPrefault<z.ZodString>;
    apiSecret: z.ZodPrefault<z.ZodString>;
}, zod_v4_core.$strip>[], "provider">>;

declare class TransportNodeClient extends TransportClientBase {
    constructor({ config, obfuscateErrors, telemetry, }: {
        config: z$1.output<(typeof transportNodeConfig)["schema"]>;
        obfuscateErrors?: boolean;
        telemetry?: TelemetryClient | null;
    });
}

/**
 * Type representing a camelCase method name.
 * Used to enforce type safety when working with method names.
 */
type ToMethodName<T extends string = string> = CamelCase<T, {
    preserveConsecutiveUppercase: false;
}>;

declare class AgentBuilder<const AgentDef extends AgentDefinition, Excluded extends string = never> {
    readonly def: AgentDef;
    constructor(definition: AgentDef);
    config(config: z$1.input<typeof agentServerConfig.schema>): TypedAgentBuilder<AgentDef, Excluded | "config">;
    scope<Schema extends z$1.ZodObject>(scope: AgentScopeDefinition<Schema>): TypedAgentBuilder<Override<AgentDef, "scope", AgentScopeDefinition<Schema>>, Excluded | "scope">;
    /**
     * Register plugins to extend the agent server features.
     * Defaults to `[generation, memories, stores, actions, percepts]` plugins if not specified.
     *
     * In case you want to register custom plugins and still keep the defaults you can do:
     * ```ts
     * import { defaults } from "life/client";
     *
     * defineAgentClient("my-agent").plugins([...defaults.plugins, myCustomPlugin]);
     * ```
     *
     * Or if you want only some of the defaults, you can do:
     * ```ts
     * import { defaults } from "life/client";
     *
     * defineAgentClient("my-agent").plugins([defaults.plugins.generation, defaults.plugins.memories]);
     * ```
     */
    plugins<Plugins extends {
        def: PluginDefinition;
    }[]>(plugins: Plugins): TypedAgentBuilder<Override<Override<AgentDef, "plugins", { [K in keyof Plugins]: Plugins[K]["def"]; }>, "pluginConfigs", { [K in Plugins[number] as K["def"]["name"]]: PluginConfig<K["def"]["config"], "output">; }>, Excluded | "plugins">;
    static withPluginsMethods<Builder extends AgentBuilder<any, any>>(builder: Builder): Builder;
}
declare function defineAgent<const Name extends string>(name: Name): TypedAgentBuilder<{
    readonly name: Name;
    readonly config: {};
    readonly scope: {
        readonly schema: z$1.ZodObject<{
            [x: string]: any;
        }, z$1.core.$strip>;
        readonly hasAccess: () => true;
    };
    readonly plugins: ({
        name: "generation";
        dependencies: never[];
        config: ZodObjectWithTelemetry<z$1.ZodObject<{
            voiceDetection: z$1.ZodPrefault<z$1.ZodObject<{
                scoreInThreshold: z$1.ZodPrefault<z$1.ZodNumber>;
                scoreOutThreshold: z$1.ZodPrefault<z$1.ZodNumber>;
                prePaddingChunks: z$1.ZodPrefault<z$1.ZodNumber>;
                postPaddingChunks: z$1.ZodPrefault<z$1.ZodNumber>;
                minVoiceInterruptionMs: z$1.ZodPrefault<z$1.ZodNumber>;
            }, z$1.core.$strip>>;
            endOfTurnDetection: z$1.ZodPrefault<z$1.ZodObject<{
                threshold: z$1.ZodPrefault<z$1.ZodNumber>;
                minTimeoutMs: z$1.ZodPrefault<z$1.ZodNumber>;
                maxTimeoutMs: z$1.ZodPrefault<z$1.ZodNumber>;
            }, z$1.core.$strip>>;
        }, z$1.core.$strip>, "output">;
        context: ZodObjectWithTelemetry<z$1.ZodObject<{
            messages: z$1.ZodPrefault<z$1.ZodArray<z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{
                role: z$1.ZodLiteral<"user">;
                content: z$1.ZodPrefault<z$1.ZodString>;
                id: z$1.ZodString;
                createdAt: z$1.ZodNumber;
                lastUpdated: z$1.ZodNumber;
            }, z$1.core.$strip>, z$1.ZodObject<{
                role: z$1.ZodLiteral<"system">;
                content: z$1.ZodPrefault<z$1.ZodString>;
                id: z$1.ZodString;
                createdAt: z$1.ZodNumber;
                lastUpdated: z$1.ZodNumber;
            }, z$1.core.$strip>, z$1.ZodObject<{
                role: z$1.ZodLiteral<"agent">;
                content: z$1.ZodPrefault<z$1.ZodString>;
                toolsRequests: z$1.ZodPrefault<z$1.ZodArray<z$1.ZodObject<{
                    toolRequestId: z$1.ZodString;
                    toolName: z$1.ZodString;
                    toolInput: z$1.ZodRecord<z$1.ZodString, z$1.ZodAny>;
                }, z$1.core.$strip>>>;
                id: z$1.ZodString;
                createdAt: z$1.ZodNumber;
                lastUpdated: z$1.ZodNumber;
            }, z$1.core.$strip>, z$1.ZodObject<{
                role: z$1.ZodLiteral<"tool">;
                toolRequestId: z$1.ZodString;
                toolName: z$1.ZodString;
                toolSuccess: z$1.ZodBoolean;
                toolOutput: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodAny>>;
                toolError: z$1.ZodOptional<z$1.ZodString>;
                id: z$1.ZodString;
                createdAt: z$1.ZodNumber;
                lastUpdated: z$1.ZodNumber;
            }, z$1.core.$strip>], "role">>>;
            status: z$1.ZodPrefault<z$1.ZodObject<{
                listening: z$1.ZodPrefault<z$1.ZodBoolean>;
                thinking: z$1.ZodPrefault<z$1.ZodBoolean>;
                speaking: z$1.ZodPrefault<z$1.ZodBoolean>;
            }, z$1.core.$strip>>;
            voiceEnabled: z$1.ZodPrefault<z$1.ZodBoolean>;
        }, z$1.core.$strip>, "output">;
        events: [{
            readonly name: "plugin.start";
            readonly dataSchema: z$1.ZodObject<{
                isRestart: z$1.ZodPrefault<z$1.ZodBoolean>;
                restartCount: z$1.ZodPrefault<z$1.ZodNumber>;
            }, z$1.core.$strip>;
        }, {
            readonly name: "plugin.stop";
        }, {
            readonly name: "plugin.test";
        }, {
            readonly name: "plugin.error";
            readonly dataSchema: z$1.ZodObject<{
                error: z$1.ZodCustom<LifeErrorUnion, LifeErrorUnion>;
                event: z$1.ZodObject<{
                    id: z$1.ZodString;
                    name: z$1.ZodString;
                    urgent: z$1.ZodPrefault<z$1.ZodBoolean>;
                    data: z$1.ZodPrefault<z$1.ZodAny>;
                    created: z$1.ZodObject<{
                        at: z$1.ZodNumber;
                        by: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{
                            type: z$1.ZodLiteral<"handler">;
                            plugin: z$1.ZodString;
                            handler: z$1.ZodString;
                            event: z$1.ZodString;
                        }, z$1.core.$strip>, z$1.ZodObject<{
                            type: z$1.ZodLiteral<"server">;
                            name: z$1.ZodString;
                        }, z$1.core.$strip>, z$1.ZodObject<{
                            type: z$1.ZodLiteral<"client">;
                            name: z$1.ZodString;
                        }, z$1.core.$strip>], "type">;
                    }, z$1.core.$strip>;
                    edited: z$1.ZodDefault<z$1.ZodUnion<[z$1.ZodArray<z$1.ZodObject<{
                        at: z$1.ZodNumber;
                        by: z$1.ZodObject<{
                            plugin: z$1.ZodString;
                            handler: z$1.ZodString;
                        }, z$1.core.$strip>;
                        reason: z$1.ZodString;
                        dataBefore: z$1.ZodAny;
                        dataAfter: z$1.ZodAny;
                    }, z$1.core.$strip>>, z$1.ZodLiteral<false>]>>;
                    dropped: z$1.ZodPrefault<z$1.ZodUnion<[z$1.ZodObject<{
                        at: z$1.ZodNumber;
                        by: z$1.ZodObject<{
                            plugin: z$1.ZodString;
                            handler: z$1.ZodString;
                        }, z$1.core.$strip>;
                        reason: z$1.ZodString;
                    }, z$1.core.$strip>, z$1.ZodLiteral<false>]>>;
                    contextChanges: z$1.ZodPrefault<z$1.ZodArray<z$1.ZodObject<{
                        at: z$1.ZodNumber;
                        byHandler: z$1.ZodString;
                        valueBefore: z$1.ZodAny;
                        valueAfter: z$1.ZodAny;
                    }, z$1.core.$strip>>>;
                }, z$1.core.$strip>;
            }, z$1.core.$strip>;
        }] | [{
            name: "messages.create";
            dataSchema: z$1.ZodObject<{
                message: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{
                    role: z$1.ZodLiteral<"user">;
                    content: z$1.ZodPrefault<z$1.ZodString>;
                }, z$1.core.$strip>, z$1.ZodObject<{
                    role: z$1.ZodLiteral<"system">;
                    content: z$1.ZodPrefault<z$1.ZodString>;
                }, z$1.core.$strip>, z$1.ZodObject<{
                    role: z$1.ZodLiteral<"agent">;
                    content: z$1.ZodPrefault<z$1.ZodString>;
                    toolsRequests: z$1.ZodPrefault<z$1.ZodArray<z$1.ZodObject<{
                        toolRequestId: z$1.ZodString;
                        toolName: z$1.ZodString;
                        toolInput: z$1.ZodRecord<z$1.ZodString, z$1.ZodAny>;
                    }, z$1.core.$strip>>>;
                }, z$1.core.$strip>, z$1.ZodObject<{
                    role: z$1.ZodLiteral<"tool">;
                    toolRequestId: z$1.ZodString;
                    toolName: z$1.ZodString;
                    toolSuccess: z$1.ZodBoolean;
                    toolOutput: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodAny>>;
                    toolError: z$1.ZodOptional<z$1.ZodString>;
                }, z$1.core.$strip>], "role">;
            }, z$1.core.$strip>;
        }, {
            name: "messages.update";
            dataSchema: z$1.ZodObject<{
                id: z$1.ZodString;
                role: z$1.ZodEnum<{
                    user: "user";
                    system: "system";
                    agent: "agent";
                    tool: "tool";
                }>;
                message: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{
                    role: z$1.ZodLiteral<"user">;
                    content: z$1.ZodPrefault<z$1.ZodString>;
                }, z$1.core.$strip>, z$1.ZodObject<{
                    role: z$1.ZodLiteral<"system">;
                    content: z$1.ZodPrefault<z$1.ZodString>;
                }, z$1.core.$strip>, z$1.ZodObject<{
                    role: z$1.ZodLiteral<"agent">;
                    content: z$1.ZodPrefault<z$1.ZodString>;
                    toolsRequests: z$1.ZodPrefault<z$1.ZodArray<z$1.ZodObject<{
                        toolRequestId: z$1.ZodString;
                        toolName: z$1.ZodString;
                        toolInput: z$1.ZodRecord<z$1.ZodString, z$1.ZodAny>;
                    }, z$1.core.$strip>>>;
                }, z$1.core.$strip>, z$1.ZodObject<{
                    role: z$1.ZodLiteral<"tool">;
                    toolRequestId: z$1.ZodString;
                    toolName: z$1.ZodString;
                    toolSuccess: z$1.ZodBoolean;
                    toolOutput: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodAny>>;
                    toolError: z$1.ZodOptional<z$1.ZodString>;
                }, z$1.core.$strip>], "role">;
            }, z$1.core.$strip>;
        }, {
            name: "user.audio-chunk";
            dataSchema: z$1.ZodObject<{
                audioChunk: z$1.ZodCustom<Int16Array<ArrayBufferLike>, Int16Array<ArrayBufferLike>>;
            }, z$1.core.$strip>;
        }, {
            name: "user.voice-start";
        }, {
            name: "user.voice-chunk";
            dataSchema: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{
                type: z$1.ZodLiteral<"voice">;
                voiceChunk: z$1.ZodCustom<Int16Array<ArrayBufferLike>, Int16Array<ArrayBufferLike>>;
            }, z$1.core.$strip>, z$1.ZodObject<{
                type: z$1.ZodLiteral<"padding">;
                voiceChunk: z$1.ZodCustom<Int16Array<ArrayBufferLike>, Int16Array<ArrayBufferLike>>;
                paddingSide: z$1.ZodEnum<{
                    pre: "pre";
                    post: "post";
                }>;
                paddingIndex: z$1.ZodNumber;
            }, z$1.core.$strip>], "type">;
        }, {
            name: "user.voice-end";
        }, {
            name: "user.text-chunk";
            dataSchema: z$1.ZodObject<{
                textChunk: z$1.ZodString;
            }, z$1.core.$strip>;
        }, {
            name: "user.interrupted";
        }, {
            name: "agent.thinking-start";
        }, {
            name: "agent.thinking-end";
        }, {
            name: "agent.speaking-start";
        }, {
            name: "agent.speaking-end";
        }, {
            name: "agent.continue";
            dataSchema: z$1.ZodObject<{
                interrupt: z$1.ZodPrefault<z$1.ZodUnion<[z$1.ZodEnum<{
                    abrupt: "abrupt";
                    smooth: "smooth";
                }>, z$1.ZodLiteral<false>]>>;
                preventInterruption: z$1.ZodPrefault<z$1.ZodBoolean>;
            }, z$1.core.$strip>;
        }, {
            name: "agent.decide";
            dataSchema: z$1.ZodObject<{
                interrupt: z$1.ZodPrefault<z$1.ZodUnion<[z$1.ZodEnum<{
                    abrupt: "abrupt";
                    smooth: "smooth";
                }>, z$1.ZodLiteral<false>]>>;
                preventInterruption: z$1.ZodPrefault<z$1.ZodBoolean>;
                messages: z$1.ZodArray<z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{
                    role: z$1.ZodLiteral<"user">;
                    content: z$1.ZodPrefault<z$1.ZodString>;
                    id: z$1.ZodString;
                    createdAt: z$1.ZodNumber;
                    lastUpdated: z$1.ZodNumber;
                }, z$1.core.$strip>, z$1.ZodObject<{
                    role: z$1.ZodLiteral<"system">;
                    content: z$1.ZodPrefault<z$1.ZodString>;
                    id: z$1.ZodString;
                    createdAt: z$1.ZodNumber;
                    lastUpdated: z$1.ZodNumber;
                }, z$1.core.$strip>, z$1.ZodObject<{
                    role: z$1.ZodLiteral<"agent">;
                    content: z$1.ZodPrefault<z$1.ZodString>;
                    toolsRequests: z$1.ZodPrefault<z$1.ZodArray<z$1.ZodObject<{
                        toolRequestId: z$1.ZodString;
                        toolName: z$1.ZodString;
                        toolInput: z$1.ZodRecord<z$1.ZodString, z$1.ZodAny>;
                    }, z$1.core.$strip>>>;
                    id: z$1.ZodString;
                    createdAt: z$1.ZodNumber;
                    lastUpdated: z$1.ZodNumber;
                }, z$1.core.$strip>, z$1.ZodObject<{
                    role: z$1.ZodLiteral<"tool">;
                    toolRequestId: z$1.ZodString;
                    toolName: z$1.ZodString;
                    toolSuccess: z$1.ZodBoolean;
                    toolOutput: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodAny>>;
                    toolError: z$1.ZodOptional<z$1.ZodString>;
                    id: z$1.ZodString;
                    createdAt: z$1.ZodNumber;
                    lastUpdated: z$1.ZodNumber;
                }, z$1.core.$strip>], "role">>;
            }, z$1.core.$strip>;
        }, {
            name: "agent.say";
            dataSchema: z$1.ZodObject<{
                interrupt: z$1.ZodPrefault<z$1.ZodUnion<[z$1.ZodEnum<{
                    abrupt: "abrupt";
                    smooth: "smooth";
                }>, z$1.ZodLiteral<false>]>>;
                preventInterruption: z$1.ZodPrefault<z$1.ZodBoolean>;
                text: z$1.ZodString;
            }, z$1.core.$strip>;
        }, {
            name: "agent.interrupt";
            dataSchema: z$1.ZodObject<{
                reason: z$1.ZodString;
                author: z$1.ZodEnum<{
                    user: "user";
                    application: "application";
                }>;
                force: z$1.ZodPrefault<z$1.ZodBoolean>;
            }, z$1.core.$strip>;
        }, {
            name: "agent.resources-request";
        }, {
            name: "agent.resources-response";
            dataSchema: z$1.ZodObject<{
                requestId: z$1.ZodString;
                resources: z$1.ZodObject<{
                    messages: z$1.ZodArray<z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{
                        role: z$1.ZodLiteral<"user">;
                        content: z$1.ZodPrefault<z$1.ZodString>;
                        id: z$1.ZodString;
                        createdAt: z$1.ZodNumber;
                        lastUpdated: z$1.ZodNumber;
                    }, z$1.core.$strip>, z$1.ZodObject<{
                        role: z$1.ZodLiteral<"system">;
                        content: z$1.ZodPrefault<z$1.ZodString>;
                        id: z$1.ZodString;
                        createdAt: z$1.ZodNumber;
                        lastUpdated: z$1.ZodNumber;
                    }, z$1.core.$strip>, z$1.ZodObject<{
                        role: z$1.ZodLiteral<"agent">;
                        content: z$1.ZodPrefault<z$1.ZodString>;
                        toolsRequests: z$1.ZodPrefault<z$1.ZodArray<z$1.ZodObject<{
                            toolRequestId: z$1.ZodString;
                            toolName: z$1.ZodString;
                            toolInput: z$1.ZodRecord<z$1.ZodString, z$1.ZodAny>;
                        }, z$1.core.$strip>>>;
                        id: z$1.ZodString;
                        createdAt: z$1.ZodNumber;
                        lastUpdated: z$1.ZodNumber;
                    }, z$1.core.$strip>, z$1.ZodObject<{
                        role: z$1.ZodLiteral<"tool">;
                        toolRequestId: z$1.ZodString;
                        toolName: z$1.ZodString;
                        toolSuccess: z$1.ZodBoolean;
                        toolOutput: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodAny>>;
                        toolError: z$1.ZodOptional<z$1.ZodString>;
                        id: z$1.ZodString;
                        createdAt: z$1.ZodNumber;
                        lastUpdated: z$1.ZodNumber;
                    }, z$1.core.$strip>], "role">>;
                    tools: z$1.ZodArray<z$1.ZodObject<{
                        name: z$1.ZodString;
                        description: z$1.ZodString;
                        schema: z$1.ZodObject<{
                            input: z$1.ZodCustom<z$1.ZodObject<z$1.core.$ZodLooseShape, z$1.core.$strip>, z$1.ZodObject<z$1.core.$ZodLooseShape, z$1.core.$strip>>;
                            output: z$1.ZodCustom<z$1.ZodObject<z$1.core.$ZodLooseShape, z$1.core.$strip>, z$1.ZodObject<z$1.core.$ZodLooseShape, z$1.core.$strip>>;
                        }, z$1.core.$strip>;
                        run: z$1.ZodFunction<z$1.ZodTuple<readonly [z$1.ZodRecord<z$1.ZodString, z$1.ZodAny>], null>, z$1.ZodUnion<readonly [z$1.ZodObject<{
                            success: z$1.ZodBoolean;
                            output: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodAny>>;
                            error: z$1.ZodOptional<z$1.ZodString>;
                        }, z$1.core.$strip>, z$1.ZodPromise<z$1.ZodObject<{
                            success: z$1.ZodBoolean;
                            output: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodAny>>;
                            error: z$1.ZodOptional<z$1.ZodString>;
                        }, z$1.core.$strip>>]>>;
                    }, z$1.core.$strip>>;
                }, z$1.core.$strip>;
            }, z$1.core.$strip>;
        }, {
            name: "agent.tool-requests";
            dataSchema: z$1.ZodObject<{
                requests: z$1.ZodArray<z$1.ZodObject<{
                    toolRequestId: z$1.ZodString;
                    toolName: z$1.ZodString;
                    toolInput: z$1.ZodRecord<z$1.ZodString, z$1.ZodAny>;
                }, z$1.core.$strip>>;
            }, z$1.core.$strip>;
        }, {
            name: "agent.interrupted";
            dataSchema: z$1.ZodObject<{
                reason: z$1.ZodString;
                forced: z$1.ZodBoolean;
                author: z$1.ZodEnum<{
                    user: "user";
                    application: "application";
                }>;
            }, z$1.core.$strip>;
        }, {
            name: "agent.text-chunk";
            dataSchema: z$1.ZodObject<{
                textChunk: z$1.ZodString;
            }, z$1.core.$strip>;
        }, {
            name: "agent.voice-chunk";
            dataSchema: z$1.ZodObject<{
                voiceChunk: z$1.ZodCustom<Int16Array<ArrayBufferLike>, Int16Array<ArrayBufferLike>>;
            }, z$1.core.$strip>;
        }];
        handlers: [...never[], {
            name: "maintain-status";
            mode: "block";
            state: never;
            onEvent: (params: unknown) => void;
        }, {
            name: "maintain-messages";
            mode: "block";
            state: never;
            onEvent: (params: unknown) => string | undefined;
        }, {
            name: "receive-user-audio";
            mode: "block";
            state: never;
            onEvent: (params: unknown) => void;
        }, {
            name: "detect-user-voice";
            mode: "stream";
            state: never;
            onEvent: (params: unknown) => Promise<void>;
        }, {
            name: "transcribe-user-voice";
            mode: "stream";
            state: never;
            onEvent: (params: unknown) => Promise<void>;
        }, {
            name: "detect-end-of-turn";
            mode: "stream";
            state: never;
            onEvent: (params: unknown) => Promise<void>;
        }, {
            name: "generate-agent-response";
            mode: "block";
            state: never;
            onEvent: (params: unknown) => void;
        }, {
            name: "handle-resources-requests";
            mode: "block";
            state: never;
            onEvent: (params: unknown) => void;
        }, {
            name: "handle-tools-requests";
            mode: "block";
            state: never;
            onEvent: (params: unknown) => void;
        }, {
            name: "stream-outgoing-audio";
            mode: "stream";
            state: never;
            onEvent: (params: unknown) => void;
        }];
    } | {
        name: "memories";
        dependencies: {
            name: "generation";
            config: ZodObjectWithTelemetry<z$1.ZodObject<{
                voiceDetection: z$1.ZodPrefault<z$1.ZodObject<{
                    scoreInThreshold: z$1.ZodPrefault<z$1.ZodNumber>;
                    scoreOutThreshold: z$1.ZodPrefault<z$1.ZodNumber>;
                    prePaddingChunks: z$1.ZodPrefault<z$1.ZodNumber>;
                    postPaddingChunks: z$1.ZodPrefault<z$1.ZodNumber>;
                    minVoiceInterruptionMs: z$1.ZodPrefault<z$1.ZodNumber>;
                }, z$1.core.$strip>>;
                endOfTurnDetection: z$1.ZodPrefault<z$1.ZodObject<{
                    threshold: z$1.ZodPrefault<z$1.ZodNumber>;
                    minTimeoutMs: z$1.ZodPrefault<z$1.ZodNumber>;
                    maxTimeoutMs: z$1.ZodPrefault<z$1.ZodNumber>;
                }, z$1.core.$strip>>;
            }, z$1.core.$strip>, "output">;
            context: ZodObjectWithTelemetry<z$1.ZodObject<{
                messages: z$1.ZodPrefault<z$1.ZodArray<z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{
                    role: z$1.ZodLiteral<"user">;
                    content: z$1.ZodPrefault<z$1.ZodString>;
                    id: z$1.ZodString;
                    createdAt: z$1.ZodNumber;
                    lastUpdated: z$1.ZodNumber;
                }, z$1.core.$strip>, z$1.ZodObject<{
                    role: z$1.ZodLiteral<"system">;
                    content: z$1.ZodPrefault<z$1.ZodString>;
                    id: z$1.ZodString;
                    createdAt: z$1.ZodNumber;
                    lastUpdated: z$1.ZodNumber;
                }, z$1.core.$strip>, z$1.ZodObject<{
                    role: z$1.ZodLiteral<"agent">;
                    content: z$1.ZodPrefault<z$1.ZodString>;
                    toolsRequests: z$1.ZodPrefault<z$1.ZodArray<z$1.ZodObject<{
                        toolRequestId: z$1.ZodString;
                        toolName: z$1.ZodString;
                        toolInput: z$1.ZodRecord<z$1.ZodString, z$1.ZodAny>;
                    }, z$1.core.$strip>>>;
                    id: z$1.ZodString;
                    createdAt: z$1.ZodNumber;
                    lastUpdated: z$1.ZodNumber;
                }, z$1.core.$strip>, z$1.ZodObject<{
                    role: z$1.ZodLiteral<"tool">;
                    toolRequestId: z$1.ZodString;
                    toolName: z$1.ZodString;
                    toolSuccess: z$1.ZodBoolean;
                    toolOutput: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodAny>>;
                    toolError: z$1.ZodOptional<z$1.ZodString>;
                    id: z$1.ZodString;
                    createdAt: z$1.ZodNumber;
                    lastUpdated: z$1.ZodNumber;
                }, z$1.core.$strip>], "role">>>;
                status: z$1.ZodPrefault<z$1.ZodObject<{
                    listening: z$1.ZodPrefault<z$1.ZodBoolean>;
                    thinking: z$1.ZodPrefault<z$1.ZodBoolean>;
                    speaking: z$1.ZodPrefault<z$1.ZodBoolean>;
                }, z$1.core.$strip>>;
                voiceEnabled: z$1.ZodPrefault<z$1.ZodBoolean>;
            }, z$1.core.$strip>, "output">;
            events: [{
                readonly name: "plugin.start";
                readonly dataSchema: z$1.ZodObject<{
                    isRestart: z$1.ZodPrefault<z$1.ZodBoolean>;
                    restartCount: z$1.ZodPrefault<z$1.ZodNumber>;
                }, z$1.core.$strip>;
            }, {
                readonly name: "plugin.stop";
            }, {
                readonly name: "plugin.test";
            }, {
                readonly name: "plugin.error";
                readonly dataSchema: z$1.ZodObject<{
                    error: z$1.ZodCustom<LifeErrorUnion, LifeErrorUnion>;
                    event: z$1.ZodObject<{
                        id: z$1.ZodString;
                        name: z$1.ZodString;
                        urgent: z$1.ZodPrefault<z$1.ZodBoolean>;
                        data: z$1.ZodPrefault<z$1.ZodAny>;
                        created: z$1.ZodObject<{
                            at: z$1.ZodNumber;
                            by: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{
                                type: z$1.ZodLiteral<"handler">;
                                plugin: z$1.ZodString;
                                handler: z$1.ZodString;
                                event: z$1.ZodString;
                            }, z$1.core.$strip>, z$1.ZodObject<{
                                type: z$1.ZodLiteral<"server">;
                                name: z$1.ZodString;
                            }, z$1.core.$strip>, z$1.ZodObject<{
                                type: z$1.ZodLiteral<"client">;
                                name: z$1.ZodString;
                            }, z$1.core.$strip>], "type">;
                        }, z$1.core.$strip>;
                        edited: z$1.ZodDefault<z$1.ZodUnion<[z$1.ZodArray<z$1.ZodObject<{
                            at: z$1.ZodNumber;
                            by: z$1.ZodObject<{
                                plugin: z$1.ZodString;
                                handler: z$1.ZodString;
                            }, z$1.core.$strip>;
                            reason: z$1.ZodString;
                            dataBefore: z$1.ZodAny;
                            dataAfter: z$1.ZodAny;
                        }, z$1.core.$strip>>, z$1.ZodLiteral<false>]>>;
                        dropped: z$1.ZodPrefault<z$1.ZodUnion<[z$1.ZodObject<{
                            at: z$1.ZodNumber;
                            by: z$1.ZodObject<{
                                plugin: z$1.ZodString;
                                handler: z$1.ZodString;
                            }, z$1.core.$strip>;
                            reason: z$1.ZodString;
                        }, z$1.core.$strip>, z$1.ZodLiteral<false>]>>;
                        contextChanges: z$1.ZodPrefault<z$1.ZodArray<z$1.ZodObject<{
                            at: z$1.ZodNumber;
                            byHandler: z$1.ZodString;
                            valueBefore: z$1.ZodAny;
                            valueAfter: z$1.ZodAny;
                        }, z$1.core.$strip>>>;
                    }, z$1.core.$strip>;
                }, z$1.core.$strip>;
            }] | [{
                name: "messages.create";
                dataSchema: z$1.ZodObject<{
                    message: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{
                        role: z$1.ZodLiteral<"user">;
                        content: z$1.ZodPrefault<z$1.ZodString>;
                    }, z$1.core.$strip>, z$1.ZodObject<{
                        role: z$1.ZodLiteral<"system">;
                        content: z$1.ZodPrefault<z$1.ZodString>;
                    }, z$1.core.$strip>, z$1.ZodObject<{
                        role: z$1.ZodLiteral<"agent">;
                        content: z$1.ZodPrefault<z$1.ZodString>;
                        toolsRequests: z$1.ZodPrefault<z$1.ZodArray<z$1.ZodObject<{
                            toolRequestId: z$1.ZodString;
                            toolName: z$1.ZodString;
                            toolInput: z$1.ZodRecord<z$1.ZodString, z$1.ZodAny>;
                        }, z$1.core.$strip>>>;
                    }, z$1.core.$strip>, z$1.ZodObject<{
                        role: z$1.ZodLiteral<"tool">;
                        toolRequestId: z$1.ZodString;
                        toolName: z$1.ZodString;
                        toolSuccess: z$1.ZodBoolean;
                        toolOutput: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodAny>>;
                        toolError: z$1.ZodOptional<z$1.ZodString>;
                    }, z$1.core.$strip>], "role">;
                }, z$1.core.$strip>;
            }, {
                name: "messages.update";
                dataSchema: z$1.ZodObject<{
                    id: z$1.ZodString;
                    role: z$1.ZodEnum<{
                        user: "user";
                        system: "system";
                        agent: "agent";
                        tool: "tool";
                    }>;
                    message: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{
                        role: z$1.ZodLiteral<"user">;
                        content: z$1.ZodPrefault<z$1.ZodString>;
                    }, z$1.core.$strip>, z$1.ZodObject<{
                        role: z$1.ZodLiteral<"system">;
                        content: z$1.ZodPrefault<z$1.ZodString>;
                    }, z$1.core.$strip>, z$1.ZodObject<{
                        role: z$1.ZodLiteral<"agent">;
                        content: z$1.ZodPrefault<z$1.ZodString>;
                        toolsRequests: z$1.ZodPrefault<z$1.ZodArray<z$1.ZodObject<{
                            toolRequestId: z$1.ZodString;
                            toolName: z$1.ZodString;
                            toolInput: z$1.ZodRecord<z$1.ZodString, z$1.ZodAny>;
                        }, z$1.core.$strip>>>;
                    }, z$1.core.$strip>, z$1.ZodObject<{
                        role: z$1.ZodLiteral<"tool">;
                        toolRequestId: z$1.ZodString;
                        toolName: z$1.ZodString;
                        toolSuccess: z$1.ZodBoolean;
                        toolOutput: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodAny>>;
                        toolError: z$1.ZodOptional<z$1.ZodString>;
                    }, z$1.core.$strip>], "role">;
                }, z$1.core.$strip>;
            }, {
                name: "user.audio-chunk";
                dataSchema: z$1.ZodObject<{
                    audioChunk: z$1.ZodCustom<Int16Array<ArrayBufferLike>, Int16Array<ArrayBufferLike>>;
                }, z$1.core.$strip>;
            }, {
                name: "user.voice-start";
            }, {
                name: "user.voice-chunk";
                dataSchema: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{
                    type: z$1.ZodLiteral<"voice">;
                    voiceChunk: z$1.ZodCustom<Int16Array<ArrayBufferLike>, Int16Array<ArrayBufferLike>>;
                }, z$1.core.$strip>, z$1.ZodObject<{
                    type: z$1.ZodLiteral<"padding">;
                    voiceChunk: z$1.ZodCustom<Int16Array<ArrayBufferLike>, Int16Array<ArrayBufferLike>>;
                    paddingSide: z$1.ZodEnum<{
                        pre: "pre";
                        post: "post";
                    }>;
                    paddingIndex: z$1.ZodNumber;
                }, z$1.core.$strip>], "type">;
            }, {
                name: "user.voice-end";
            }, {
                name: "user.text-chunk";
                dataSchema: z$1.ZodObject<{
                    textChunk: z$1.ZodString;
                }, z$1.core.$strip>;
            }, {
                name: "user.interrupted";
            }, {
                name: "agent.thinking-start";
            }, {
                name: "agent.thinking-end";
            }, {
                name: "agent.speaking-start";
            }, {
                name: "agent.speaking-end";
            }, {
                name: "agent.continue";
                dataSchema: z$1.ZodObject<{
                    interrupt: z$1.ZodPrefault<z$1.ZodUnion<[z$1.ZodEnum<{
                        abrupt: "abrupt";
                        smooth: "smooth";
                    }>, z$1.ZodLiteral<false>]>>;
                    preventInterruption: z$1.ZodPrefault<z$1.ZodBoolean>;
                }, z$1.core.$strip>;
            }, {
                name: "agent.decide";
                dataSchema: z$1.ZodObject<{
                    interrupt: z$1.ZodPrefault<z$1.ZodUnion<[z$1.ZodEnum<{
                        abrupt: "abrupt";
                        smooth: "smooth";
                    }>, z$1.ZodLiteral<false>]>>;
                    preventInterruption: z$1.ZodPrefault<z$1.ZodBoolean>;
                    messages: z$1.ZodArray<z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{
                        role: z$1.ZodLiteral<"user">;
                        content: z$1.ZodPrefault<z$1.ZodString>;
                        id: z$1.ZodString;
                        createdAt: z$1.ZodNumber;
                        lastUpdated: z$1.ZodNumber;
                    }, z$1.core.$strip>, z$1.ZodObject<{
                        role: z$1.ZodLiteral<"system">;
                        content: z$1.ZodPrefault<z$1.ZodString>;
                        id: z$1.ZodString;
                        createdAt: z$1.ZodNumber;
                        lastUpdated: z$1.ZodNumber;
                    }, z$1.core.$strip>, z$1.ZodObject<{
                        role: z$1.ZodLiteral<"agent">;
                        content: z$1.ZodPrefault<z$1.ZodString>;
                        toolsRequests: z$1.ZodPrefault<z$1.ZodArray<z$1.ZodObject<{
                            toolRequestId: z$1.ZodString;
                            toolName: z$1.ZodString;
                            toolInput: z$1.ZodRecord<z$1.ZodString, z$1.ZodAny>;
                        }, z$1.core.$strip>>>;
                        id: z$1.ZodString;
                        createdAt: z$1.ZodNumber;
                        lastUpdated: z$1.ZodNumber;
                    }, z$1.core.$strip>, z$1.ZodObject<{
                        role: z$1.ZodLiteral<"tool">;
                        toolRequestId: z$1.ZodString;
                        toolName: z$1.ZodString;
                        toolSuccess: z$1.ZodBoolean;
                        toolOutput: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodAny>>;
                        toolError: z$1.ZodOptional<z$1.ZodString>;
                        id: z$1.ZodString;
                        createdAt: z$1.ZodNumber;
                        lastUpdated: z$1.ZodNumber;
                    }, z$1.core.$strip>], "role">>;
                }, z$1.core.$strip>;
            }, {
                name: "agent.say";
                dataSchema: z$1.ZodObject<{
                    interrupt: z$1.ZodPrefault<z$1.ZodUnion<[z$1.ZodEnum<{
                        abrupt: "abrupt";
                        smooth: "smooth";
                    }>, z$1.ZodLiteral<false>]>>;
                    preventInterruption: z$1.ZodPrefault<z$1.ZodBoolean>;
                    text: z$1.ZodString;
                }, z$1.core.$strip>;
            }, {
                name: "agent.interrupt";
                dataSchema: z$1.ZodObject<{
                    reason: z$1.ZodString;
                    author: z$1.ZodEnum<{
                        user: "user";
                        application: "application";
                    }>;
                    force: z$1.ZodPrefault<z$1.ZodBoolean>;
                }, z$1.core.$strip>;
            }, {
                name: "agent.resources-request";
            }, {
                name: "agent.resources-response";
                dataSchema: z$1.ZodObject<{
                    requestId: z$1.ZodString;
                    resources: z$1.ZodObject<{
                        messages: z$1.ZodArray<z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{
                            role: z$1.ZodLiteral<"user">;
                            content: z$1.ZodPrefault<z$1.ZodString>;
                            id: z$1.ZodString;
                            createdAt: z$1.ZodNumber;
                            lastUpdated: z$1.ZodNumber;
                        }, z$1.core.$strip>, z$1.ZodObject<{
                            role: z$1.ZodLiteral<"system">;
                            content: z$1.ZodPrefault<z$1.ZodString>;
                            id: z$1.ZodString;
                            createdAt: z$1.ZodNumber;
                            lastUpdated: z$1.ZodNumber;
                        }, z$1.core.$strip>, z$1.ZodObject<{
                            role: z$1.ZodLiteral<"agent">;
                            content: z$1.ZodPrefault<z$1.ZodString>;
                            toolsRequests: z$1.ZodPrefault<z$1.ZodArray<z$1.ZodObject<{
                                toolRequestId: z$1.ZodString;
                                toolName: z$1.ZodString;
                                toolInput: z$1.ZodRecord<z$1.ZodString, z$1.ZodAny>;
                            }, z$1.core.$strip>>>;
                            id: z$1.ZodString;
                            createdAt: z$1.ZodNumber;
                            lastUpdated: z$1.ZodNumber;
                        }, z$1.core.$strip>, z$1.ZodObject<{
                            role: z$1.ZodLiteral<"tool">;
                            toolRequestId: z$1.ZodString;
                            toolName: z$1.ZodString;
                            toolSuccess: z$1.ZodBoolean;
                            toolOutput: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodAny>>;
                            toolError: z$1.ZodOptional<z$1.ZodString>;
                            id: z$1.ZodString;
                            createdAt: z$1.ZodNumber;
                            lastUpdated: z$1.ZodNumber;
                        }, z$1.core.$strip>], "role">>;
                        tools: z$1.ZodArray<z$1.ZodObject<{
                            name: z$1.ZodString;
                            description: z$1.ZodString;
                            schema: z$1.ZodObject<{
                                input: z$1.ZodCustom<z$1.ZodObject<z$1.core.$ZodLooseShape, z$1.core.$strip>, z$1.ZodObject<z$1.core.$ZodLooseShape, z$1.core.$strip>>;
                                output: z$1.ZodCustom<z$1.ZodObject<z$1.core.$ZodLooseShape, z$1.core.$strip>, z$1.ZodObject<z$1.core.$ZodLooseShape, z$1.core.$strip>>;
                            }, z$1.core.$strip>;
                            run: z$1.ZodFunction<z$1.ZodTuple<readonly [z$1.ZodRecord<z$1.ZodString, z$1.ZodAny>], null>, z$1.ZodUnion<readonly [z$1.ZodObject<{
                                success: z$1.ZodBoolean;
                                output: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodAny>>;
                                error: z$1.ZodOptional<z$1.ZodString>;
                            }, z$1.core.$strip>, z$1.ZodPromise<z$1.ZodObject<{
                                success: z$1.ZodBoolean;
                                output: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodAny>>;
                                error: z$1.ZodOptional<z$1.ZodString>;
                            }, z$1.core.$strip>>]>>;
                        }, z$1.core.$strip>>;
                    }, z$1.core.$strip>;
                }, z$1.core.$strip>;
            }, {
                name: "agent.tool-requests";
                dataSchema: z$1.ZodObject<{
                    requests: z$1.ZodArray<z$1.ZodObject<{
                        toolRequestId: z$1.ZodString;
                        toolName: z$1.ZodString;
                        toolInput: z$1.ZodRecord<z$1.ZodString, z$1.ZodAny>;
                    }, z$1.core.$strip>>;
                }, z$1.core.$strip>;
            }, {
                name: "agent.interrupted";
                dataSchema: z$1.ZodObject<{
                    reason: z$1.ZodString;
                    forced: z$1.ZodBoolean;
                    author: z$1.ZodEnum<{
                        user: "user";
                        application: "application";
                    }>;
                }, z$1.core.$strip>;
            }, {
                name: "agent.text-chunk";
                dataSchema: z$1.ZodObject<{
                    textChunk: z$1.ZodString;
                }, z$1.core.$strip>;
            }, {
                name: "agent.voice-chunk";
                dataSchema: z$1.ZodObject<{
                    voiceChunk: z$1.ZodCustom<Int16Array<ArrayBufferLike>, Int16Array<ArrayBufferLike>>;
                }, z$1.core.$strip>;
            }];
            handlers: [...never[], {
                name: "maintain-status";
                mode: "block";
                state: never;
                onEvent: (params: unknown) => void;
            }, {
                name: "maintain-messages";
                mode: "block";
                state: never;
                onEvent: (params: unknown) => string | undefined;
            }, {
                name: "receive-user-audio";
                mode: "block";
                state: never;
                onEvent: (params: unknown) => void;
            }, {
                name: "detect-user-voice";
                mode: "stream";
                state: never;
                onEvent: (params: unknown) => Promise<void>;
            }, {
                name: "transcribe-user-voice";
                mode: "stream";
                state: never;
                onEvent: (params: unknown) => Promise<void>;
            }, {
                name: "detect-end-of-turn";
                mode: "stream";
                state: never;
                onEvent: (params: unknown) => Promise<void>;
            }, {
                name: "generate-agent-response";
                mode: "block";
                state: never;
                onEvent: (params: unknown) => void;
            }, {
                name: "handle-resources-requests";
                mode: "block";
                state: never;
                onEvent: (params: unknown) => void;
            }, {
                name: "handle-tools-requests";
                mode: "block";
                state: never;
                onEvent: (params: unknown) => void;
            }, {
                name: "stream-outgoing-audio";
                mode: "stream";
                state: never;
                onEvent: (params: unknown) => void;
            }];
        }[];
        config: ZodObjectWithTelemetry<z$1.ZodObject<{
            items: z$1.ZodPrefault<z$1.ZodArray<z$1.ZodCustom<{
                _definition: MemoryDefinition;
            }, {
                _definition: MemoryDefinition;
            }>>>;
        }, z$1.core.$strip>, "output">;
        context: ZodObjectWithTelemetry<z$1.ZodObject<{
            memoriesLastResults: z$1.ZodPrefault<z$1.ZodCustom<Map<string, ({
                role: "user";
                content: string;
                id: string;
                createdAt: number;
                lastUpdated: number;
            } | {
                role: "system";
                content: string;
                id: string;
                createdAt: number;
                lastUpdated: number;
            } | {
                role: "agent";
                content: string;
                toolsRequests: {
                    toolRequestId: string;
                    toolName: string;
                    toolInput: Record<string, any>;
                }[];
                id: string;
                createdAt: number;
                lastUpdated: number;
            } | {
                role: "tool";
                toolRequestId: string;
                toolName: string;
                toolSuccess: boolean;
                id: string;
                createdAt: number;
                lastUpdated: number;
                toolOutput?: Record<string, any> | undefined;
                toolError?: string | undefined;
            })[]>, Map<string, ({
                role: "user";
                content: string;
                id: string;
                createdAt: number;
                lastUpdated: number;
            } | {
                role: "system";
                content: string;
                id: string;
                createdAt: number;
                lastUpdated: number;
            } | {
                role: "agent";
                content: string;
                toolsRequests: {
                    toolRequestId: string;
                    toolName: string;
                    toolInput: Record<string, any>;
                }[];
                id: string;
                createdAt: number;
                lastUpdated: number;
            } | {
                role: "tool";
                toolRequestId: string;
                toolName: string;
                toolSuccess: boolean;
                id: string;
                createdAt: number;
                lastUpdated: number;
                toolOutput?: Record<string, any> | undefined;
                toolError?: string | undefined;
            })[]>>>;
            memoriesLastTimestamp: z$1.ZodPrefault<z$1.ZodCustom<Map<string, number>, Map<string, number>>>;
            processedRequestsIds: z$1.ZodPrefault<z$1.ZodCustom<Set<string>, Set<string>>>;
            computedMemoriesCache: z$1.ZodPrefault<z$1.ZodCustom<Map<string, {
                hash: string;
                memories: Message[];
            }>, Map<string, {
                hash: string;
                memories: Message[];
            }>>>;
        }, z$1.core.$strip>, "output">;
        events: [{
            readonly name: "plugin.start";
            readonly dataSchema: z$1.ZodObject<{
                isRestart: z$1.ZodPrefault<z$1.ZodBoolean>;
                restartCount: z$1.ZodPrefault<z$1.ZodNumber>;
            }, z$1.core.$strip>;
        }, {
            readonly name: "plugin.stop";
        }, {
            readonly name: "plugin.test";
        }, {
            readonly name: "plugin.error";
            readonly dataSchema: z$1.ZodObject<{
                error: z$1.ZodCustom<LifeErrorUnion, LifeErrorUnion>;
                event: z$1.ZodObject<{
                    id: z$1.ZodString;
                    name: z$1.ZodString;
                    urgent: z$1.ZodPrefault<z$1.ZodBoolean>;
                    data: z$1.ZodPrefault<z$1.ZodAny>;
                    created: z$1.ZodObject<{
                        at: z$1.ZodNumber;
                        by: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{
                            type: z$1.ZodLiteral<"handler">;
                            plugin: z$1.ZodString;
                            handler: z$1.ZodString;
                            event: z$1.ZodString;
                        }, z$1.core.$strip>, z$1.ZodObject<{
                            type: z$1.ZodLiteral<"server">;
                            name: z$1.ZodString;
                        }, z$1.core.$strip>, z$1.ZodObject<{
                            type: z$1.ZodLiteral<"client">;
                            name: z$1.ZodString;
                        }, z$1.core.$strip>], "type">;
                    }, z$1.core.$strip>;
                    edited: z$1.ZodDefault<z$1.ZodUnion<[z$1.ZodArray<z$1.ZodObject<{
                        at: z$1.ZodNumber;
                        by: z$1.ZodObject<{
                            plugin: z$1.ZodString;
                            handler: z$1.ZodString;
                        }, z$1.core.$strip>;
                        reason: z$1.ZodString;
                        dataBefore: z$1.ZodAny;
                        dataAfter: z$1.ZodAny;
                    }, z$1.core.$strip>>, z$1.ZodLiteral<false>]>>;
                    dropped: z$1.ZodPrefault<z$1.ZodUnion<[z$1.ZodObject<{
                        at: z$1.ZodNumber;
                        by: z$1.ZodObject<{
                            plugin: z$1.ZodString;
                            handler: z$1.ZodString;
                        }, z$1.core.$strip>;
                        reason: z$1.ZodString;
                    }, z$1.core.$strip>, z$1.ZodLiteral<false>]>>;
                    contextChanges: z$1.ZodPrefault<z$1.ZodArray<z$1.ZodObject<{
                        at: z$1.ZodNumber;
                        byHandler: z$1.ZodString;
                        valueBefore: z$1.ZodAny;
                        valueAfter: z$1.ZodAny;
                    }, z$1.core.$strip>>>;
                }, z$1.core.$strip>;
            }, z$1.core.$strip>;
        }] | [{
            name: "cache-build";
            dataSchema: z$1.ZodObject<{
                messagesHash: z$1.ZodString;
                memories: z$1.ZodArray<z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{
                    role: z$1.ZodLiteral<"user">;
                    content: z$1.ZodPrefault<z$1.ZodString>;
                    id: z$1.ZodString;
                    createdAt: z$1.ZodNumber;
                    lastUpdated: z$1.ZodNumber;
                }, z$1.core.$strip>, z$1.ZodObject<{
                    role: z$1.ZodLiteral<"system">;
                    content: z$1.ZodPrefault<z$1.ZodString>;
                    id: z$1.ZodString;
                    createdAt: z$1.ZodNumber;
                    lastUpdated: z$1.ZodNumber;
                }, z$1.core.$strip>, z$1.ZodObject<{
                    role: z$1.ZodLiteral<"agent">;
                    content: z$1.ZodPrefault<z$1.ZodString>;
                    toolsRequests: z$1.ZodPrefault<z$1.ZodArray<z$1.ZodObject<{
                        toolRequestId: z$1.ZodString;
                        toolName: z$1.ZodString;
                        toolInput: z$1.ZodRecord<z$1.ZodString, z$1.ZodAny>;
                    }, z$1.core.$strip>>>;
                    id: z$1.ZodString;
                    createdAt: z$1.ZodNumber;
                    lastUpdated: z$1.ZodNumber;
                }, z$1.core.$strip>, z$1.ZodObject<{
                    role: z$1.ZodLiteral<"tool">;
                    toolRequestId: z$1.ZodString;
                    toolName: z$1.ZodString;
                    toolSuccess: z$1.ZodBoolean;
                    toolOutput: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodAny>>;
                    toolError: z$1.ZodOptional<z$1.ZodString>;
                    id: z$1.ZodString;
                    createdAt: z$1.ZodNumber;
                    lastUpdated: z$1.ZodNumber;
                }, z$1.core.$strip>], "role">>;
            }, z$1.core.$strip>;
        }, {
            name: "cache-memory";
            dataSchema: z$1.ZodObject<{
                name: z$1.ZodString;
                messages: z$1.ZodArray<z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{
                    role: z$1.ZodLiteral<"user">;
                    content: z$1.ZodPrefault<z$1.ZodString>;
                    id: z$1.ZodString;
                    createdAt: z$1.ZodNumber;
                    lastUpdated: z$1.ZodNumber;
                }, z$1.core.$strip>, z$1.ZodObject<{
                    role: z$1.ZodLiteral<"system">;
                    content: z$1.ZodPrefault<z$1.ZodString>;
                    id: z$1.ZodString;
                    createdAt: z$1.ZodNumber;
                    lastUpdated: z$1.ZodNumber;
                }, z$1.core.$strip>, z$1.ZodObject<{
                    role: z$1.ZodLiteral<"agent">;
                    content: z$1.ZodPrefault<z$1.ZodString>;
                    toolsRequests: z$1.ZodPrefault<z$1.ZodArray<z$1.ZodObject<{
                        toolRequestId: z$1.ZodString;
                        toolName: z$1.ZodString;
                        toolInput: z$1.ZodRecord<z$1.ZodString, z$1.ZodAny>;
                    }, z$1.core.$strip>>>;
                    id: z$1.ZodString;
                    createdAt: z$1.ZodNumber;
                    lastUpdated: z$1.ZodNumber;
                }, z$1.core.$strip>, z$1.ZodObject<{
                    role: z$1.ZodLiteral<"tool">;
                    toolRequestId: z$1.ZodString;
                    toolName: z$1.ZodString;
                    toolSuccess: z$1.ZodBoolean;
                    toolOutput: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodAny>>;
                    toolError: z$1.ZodOptional<z$1.ZodString>;
                    id: z$1.ZodString;
                    createdAt: z$1.ZodNumber;
                    lastUpdated: z$1.ZodNumber;
                }, z$1.core.$strip>], "role">>;
                timestamp: z$1.ZodNumber;
            }, z$1.core.$strip>;
        }];
        handlers: never[];
    } | {
        name: "stores";
        dependencies: {
            name: "generation";
            config: ZodObjectWithTelemetry<z$1.ZodObject<{
                voiceDetection: z$1.ZodPrefault<z$1.ZodObject<{
                    scoreInThreshold: z$1.ZodPrefault<z$1.ZodNumber>;
                    scoreOutThreshold: z$1.ZodPrefault<z$1.ZodNumber>;
                    prePaddingChunks: z$1.ZodPrefault<z$1.ZodNumber>;
                    postPaddingChunks: z$1.ZodPrefault<z$1.ZodNumber>;
                    minVoiceInterruptionMs: z$1.ZodPrefault<z$1.ZodNumber>;
                }, z$1.core.$strip>>;
                endOfTurnDetection: z$1.ZodPrefault<z$1.ZodObject<{
                    threshold: z$1.ZodPrefault<z$1.ZodNumber>;
                    minTimeoutMs: z$1.ZodPrefault<z$1.ZodNumber>;
                    maxTimeoutMs: z$1.ZodPrefault<z$1.ZodNumber>;
                }, z$1.core.$strip>>;
            }, z$1.core.$strip>, "output">;
            context: ZodObjectWithTelemetry<z$1.ZodObject<{
                messages: z$1.ZodPrefault<z$1.ZodArray<z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{
                    role: z$1.ZodLiteral<"user">;
                    content: z$1.ZodPrefault<z$1.ZodString>;
                    id: z$1.ZodString;
                    createdAt: z$1.ZodNumber;
                    lastUpdated: z$1.ZodNumber;
                }, z$1.core.$strip>, z$1.ZodObject<{
                    role: z$1.ZodLiteral<"system">;
                    content: z$1.ZodPrefault<z$1.ZodString>;
                    id: z$1.ZodString;
                    createdAt: z$1.ZodNumber;
                    lastUpdated: z$1.ZodNumber;
                }, z$1.core.$strip>, z$1.ZodObject<{
                    role: z$1.ZodLiteral<"agent">;
                    content: z$1.ZodPrefault<z$1.ZodString>;
                    toolsRequests: z$1.ZodPrefault<z$1.ZodArray<z$1.ZodObject<{
                        toolRequestId: z$1.ZodString;
                        toolName: z$1.ZodString;
                        toolInput: z$1.ZodRecord<z$1.ZodString, z$1.ZodAny>;
                    }, z$1.core.$strip>>>;
                    id: z$1.ZodString;
                    createdAt: z$1.ZodNumber;
                    lastUpdated: z$1.ZodNumber;
                }, z$1.core.$strip>, z$1.ZodObject<{
                    role: z$1.ZodLiteral<"tool">;
                    toolRequestId: z$1.ZodString;
                    toolName: z$1.ZodString;
                    toolSuccess: z$1.ZodBoolean;
                    toolOutput: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodAny>>;
                    toolError: z$1.ZodOptional<z$1.ZodString>;
                    id: z$1.ZodString;
                    createdAt: z$1.ZodNumber;
                    lastUpdated: z$1.ZodNumber;
                }, z$1.core.$strip>], "role">>>;
                status: z$1.ZodPrefault<z$1.ZodObject<{
                    listening: z$1.ZodPrefault<z$1.ZodBoolean>;
                    thinking: z$1.ZodPrefault<z$1.ZodBoolean>;
                    speaking: z$1.ZodPrefault<z$1.ZodBoolean>;
                }, z$1.core.$strip>>;
                voiceEnabled: z$1.ZodPrefault<z$1.ZodBoolean>;
            }, z$1.core.$strip>, "output">;
            events: [{
                readonly name: "plugin.start";
                readonly dataSchema: z$1.ZodObject<{
                    isRestart: z$1.ZodPrefault<z$1.ZodBoolean>;
                    restartCount: z$1.ZodPrefault<z$1.ZodNumber>;
                }, z$1.core.$strip>;
            }, {
                readonly name: "plugin.stop";
            }, {
                readonly name: "plugin.test";
            }, {
                readonly name: "plugin.error";
                readonly dataSchema: z$1.ZodObject<{
                    error: z$1.ZodCustom<LifeErrorUnion, LifeErrorUnion>;
                    event: z$1.ZodObject<{
                        id: z$1.ZodString;
                        name: z$1.ZodString;
                        urgent: z$1.ZodPrefault<z$1.ZodBoolean>;
                        data: z$1.ZodPrefault<z$1.ZodAny>;
                        created: z$1.ZodObject<{
                            at: z$1.ZodNumber;
                            by: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{
                                type: z$1.ZodLiteral<"handler">;
                                plugin: z$1.ZodString;
                                handler: z$1.ZodString;
                                event: z$1.ZodString;
                            }, z$1.core.$strip>, z$1.ZodObject<{
                                type: z$1.ZodLiteral<"server">;
                                name: z$1.ZodString;
                            }, z$1.core.$strip>, z$1.ZodObject<{
                                type: z$1.ZodLiteral<"client">;
                                name: z$1.ZodString;
                            }, z$1.core.$strip>], "type">;
                        }, z$1.core.$strip>;
                        edited: z$1.ZodDefault<z$1.ZodUnion<[z$1.ZodArray<z$1.ZodObject<{
                            at: z$1.ZodNumber;
                            by: z$1.ZodObject<{
                                plugin: z$1.ZodString;
                                handler: z$1.ZodString;
                            }, z$1.core.$strip>;
                            reason: z$1.ZodString;
                            dataBefore: z$1.ZodAny;
                            dataAfter: z$1.ZodAny;
                        }, z$1.core.$strip>>, z$1.ZodLiteral<false>]>>;
                        dropped: z$1.ZodPrefault<z$1.ZodUnion<[z$1.ZodObject<{
                            at: z$1.ZodNumber;
                            by: z$1.ZodObject<{
                                plugin: z$1.ZodString;
                                handler: z$1.ZodString;
                            }, z$1.core.$strip>;
                            reason: z$1.ZodString;
                        }, z$1.core.$strip>, z$1.ZodLiteral<false>]>>;
                        contextChanges: z$1.ZodPrefault<z$1.ZodArray<z$1.ZodObject<{
                            at: z$1.ZodNumber;
                            byHandler: z$1.ZodString;
                            valueBefore: z$1.ZodAny;
                            valueAfter: z$1.ZodAny;
                        }, z$1.core.$strip>>>;
                    }, z$1.core.$strip>;
                }, z$1.core.$strip>;
            }] | [{
                name: "messages.create";
                dataSchema: z$1.ZodObject<{
                    message: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{
                        role: z$1.ZodLiteral<"user">;
                        content: z$1.ZodPrefault<z$1.ZodString>;
                    }, z$1.core.$strip>, z$1.ZodObject<{
                        role: z$1.ZodLiteral<"system">;
                        content: z$1.ZodPrefault<z$1.ZodString>;
                    }, z$1.core.$strip>, z$1.ZodObject<{
                        role: z$1.ZodLiteral<"agent">;
                        content: z$1.ZodPrefault<z$1.ZodString>;
                        toolsRequests: z$1.ZodPrefault<z$1.ZodArray<z$1.ZodObject<{
                            toolRequestId: z$1.ZodString;
                            toolName: z$1.ZodString;
                            toolInput: z$1.ZodRecord<z$1.ZodString, z$1.ZodAny>;
                        }, z$1.core.$strip>>>;
                    }, z$1.core.$strip>, z$1.ZodObject<{
                        role: z$1.ZodLiteral<"tool">;
                        toolRequestId: z$1.ZodString;
                        toolName: z$1.ZodString;
                        toolSuccess: z$1.ZodBoolean;
                        toolOutput: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodAny>>;
                        toolError: z$1.ZodOptional<z$1.ZodString>;
                    }, z$1.core.$strip>], "role">;
                }, z$1.core.$strip>;
            }, {
                name: "messages.update";
                dataSchema: z$1.ZodObject<{
                    id: z$1.ZodString;
                    role: z$1.ZodEnum<{
                        user: "user";
                        system: "system";
                        agent: "agent";
                        tool: "tool";
                    }>;
                    message: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{
                        role: z$1.ZodLiteral<"user">;
                        content: z$1.ZodPrefault<z$1.ZodString>;
                    }, z$1.core.$strip>, z$1.ZodObject<{
                        role: z$1.ZodLiteral<"system">;
                        content: z$1.ZodPrefault<z$1.ZodString>;
                    }, z$1.core.$strip>, z$1.ZodObject<{
                        role: z$1.ZodLiteral<"agent">;
                        content: z$1.ZodPrefault<z$1.ZodString>;
                        toolsRequests: z$1.ZodPrefault<z$1.ZodArray<z$1.ZodObject<{
                            toolRequestId: z$1.ZodString;
                            toolName: z$1.ZodString;
                            toolInput: z$1.ZodRecord<z$1.ZodString, z$1.ZodAny>;
                        }, z$1.core.$strip>>>;
                    }, z$1.core.$strip>, z$1.ZodObject<{
                        role: z$1.ZodLiteral<"tool">;
                        toolRequestId: z$1.ZodString;
                        toolName: z$1.ZodString;
                        toolSuccess: z$1.ZodBoolean;
                        toolOutput: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodAny>>;
                        toolError: z$1.ZodOptional<z$1.ZodString>;
                    }, z$1.core.$strip>], "role">;
                }, z$1.core.$strip>;
            }, {
                name: "user.audio-chunk";
                dataSchema: z$1.ZodObject<{
                    audioChunk: z$1.ZodCustom<Int16Array<ArrayBufferLike>, Int16Array<ArrayBufferLike>>;
                }, z$1.core.$strip>;
            }, {
                name: "user.voice-start";
            }, {
                name: "user.voice-chunk";
                dataSchema: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{
                    type: z$1.ZodLiteral<"voice">;
                    voiceChunk: z$1.ZodCustom<Int16Array<ArrayBufferLike>, Int16Array<ArrayBufferLike>>;
                }, z$1.core.$strip>, z$1.ZodObject<{
                    type: z$1.ZodLiteral<"padding">;
                    voiceChunk: z$1.ZodCustom<Int16Array<ArrayBufferLike>, Int16Array<ArrayBufferLike>>;
                    paddingSide: z$1.ZodEnum<{
                        pre: "pre";
                        post: "post";
                    }>;
                    paddingIndex: z$1.ZodNumber;
                }, z$1.core.$strip>], "type">;
            }, {
                name: "user.voice-end";
            }, {
                name: "user.text-chunk";
                dataSchema: z$1.ZodObject<{
                    textChunk: z$1.ZodString;
                }, z$1.core.$strip>;
            }, {
                name: "user.interrupted";
            }, {
                name: "agent.thinking-start";
            }, {
                name: "agent.thinking-end";
            }, {
                name: "agent.speaking-start";
            }, {
                name: "agent.speaking-end";
            }, {
                name: "agent.continue";
                dataSchema: z$1.ZodObject<{
                    interrupt: z$1.ZodPrefault<z$1.ZodUnion<[z$1.ZodEnum<{
                        abrupt: "abrupt";
                        smooth: "smooth";
                    }>, z$1.ZodLiteral<false>]>>;
                    preventInterruption: z$1.ZodPrefault<z$1.ZodBoolean>;
                }, z$1.core.$strip>;
            }, {
                name: "agent.decide";
                dataSchema: z$1.ZodObject<{
                    interrupt: z$1.ZodPrefault<z$1.ZodUnion<[z$1.ZodEnum<{
                        abrupt: "abrupt";
                        smooth: "smooth";
                    }>, z$1.ZodLiteral<false>]>>;
                    preventInterruption: z$1.ZodPrefault<z$1.ZodBoolean>;
                    messages: z$1.ZodArray<z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{
                        role: z$1.ZodLiteral<"user">;
                        content: z$1.ZodPrefault<z$1.ZodString>;
                        id: z$1.ZodString;
                        createdAt: z$1.ZodNumber;
                        lastUpdated: z$1.ZodNumber;
                    }, z$1.core.$strip>, z$1.ZodObject<{
                        role: z$1.ZodLiteral<"system">;
                        content: z$1.ZodPrefault<z$1.ZodString>;
                        id: z$1.ZodString;
                        createdAt: z$1.ZodNumber;
                        lastUpdated: z$1.ZodNumber;
                    }, z$1.core.$strip>, z$1.ZodObject<{
                        role: z$1.ZodLiteral<"agent">;
                        content: z$1.ZodPrefault<z$1.ZodString>;
                        toolsRequests: z$1.ZodPrefault<z$1.ZodArray<z$1.ZodObject<{
                            toolRequestId: z$1.ZodString;
                            toolName: z$1.ZodString;
                            toolInput: z$1.ZodRecord<z$1.ZodString, z$1.ZodAny>;
                        }, z$1.core.$strip>>>;
                        id: z$1.ZodString;
                        createdAt: z$1.ZodNumber;
                        lastUpdated: z$1.ZodNumber;
                    }, z$1.core.$strip>, z$1.ZodObject<{
                        role: z$1.ZodLiteral<"tool">;
                        toolRequestId: z$1.ZodString;
                        toolName: z$1.ZodString;
                        toolSuccess: z$1.ZodBoolean;
                        toolOutput: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodAny>>;
                        toolError: z$1.ZodOptional<z$1.ZodString>;
                        id: z$1.ZodString;
                        createdAt: z$1.ZodNumber;
                        lastUpdated: z$1.ZodNumber;
                    }, z$1.core.$strip>], "role">>;
                }, z$1.core.$strip>;
            }, {
                name: "agent.say";
                dataSchema: z$1.ZodObject<{
                    interrupt: z$1.ZodPrefault<z$1.ZodUnion<[z$1.ZodEnum<{
                        abrupt: "abrupt";
                        smooth: "smooth";
                    }>, z$1.ZodLiteral<false>]>>;
                    preventInterruption: z$1.ZodPrefault<z$1.ZodBoolean>;
                    text: z$1.ZodString;
                }, z$1.core.$strip>;
            }, {
                name: "agent.interrupt";
                dataSchema: z$1.ZodObject<{
                    reason: z$1.ZodString;
                    author: z$1.ZodEnum<{
                        user: "user";
                        application: "application";
                    }>;
                    force: z$1.ZodPrefault<z$1.ZodBoolean>;
                }, z$1.core.$strip>;
            }, {
                name: "agent.resources-request";
            }, {
                name: "agent.resources-response";
                dataSchema: z$1.ZodObject<{
                    requestId: z$1.ZodString;
                    resources: z$1.ZodObject<{
                        messages: z$1.ZodArray<z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{
                            role: z$1.ZodLiteral<"user">;
                            content: z$1.ZodPrefault<z$1.ZodString>;
                            id: z$1.ZodString;
                            createdAt: z$1.ZodNumber;
                            lastUpdated: z$1.ZodNumber;
                        }, z$1.core.$strip>, z$1.ZodObject<{
                            role: z$1.ZodLiteral<"system">;
                            content: z$1.ZodPrefault<z$1.ZodString>;
                            id: z$1.ZodString;
                            createdAt: z$1.ZodNumber;
                            lastUpdated: z$1.ZodNumber;
                        }, z$1.core.$strip>, z$1.ZodObject<{
                            role: z$1.ZodLiteral<"agent">;
                            content: z$1.ZodPrefault<z$1.ZodString>;
                            toolsRequests: z$1.ZodPrefault<z$1.ZodArray<z$1.ZodObject<{
                                toolRequestId: z$1.ZodString;
                                toolName: z$1.ZodString;
                                toolInput: z$1.ZodRecord<z$1.ZodString, z$1.ZodAny>;
                            }, z$1.core.$strip>>>;
                            id: z$1.ZodString;
                            createdAt: z$1.ZodNumber;
                            lastUpdated: z$1.ZodNumber;
                        }, z$1.core.$strip>, z$1.ZodObject<{
                            role: z$1.ZodLiteral<"tool">;
                            toolRequestId: z$1.ZodString;
                            toolName: z$1.ZodString;
                            toolSuccess: z$1.ZodBoolean;
                            toolOutput: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodAny>>;
                            toolError: z$1.ZodOptional<z$1.ZodString>;
                            id: z$1.ZodString;
                            createdAt: z$1.ZodNumber;
                            lastUpdated: z$1.ZodNumber;
                        }, z$1.core.$strip>], "role">>;
                        tools: z$1.ZodArray<z$1.ZodObject<{
                            name: z$1.ZodString;
                            description: z$1.ZodString;
                            schema: z$1.ZodObject<{
                                input: z$1.ZodCustom<z$1.ZodObject<z$1.core.$ZodLooseShape, z$1.core.$strip>, z$1.ZodObject<z$1.core.$ZodLooseShape, z$1.core.$strip>>;
                                output: z$1.ZodCustom<z$1.ZodObject<z$1.core.$ZodLooseShape, z$1.core.$strip>, z$1.ZodObject<z$1.core.$ZodLooseShape, z$1.core.$strip>>;
                            }, z$1.core.$strip>;
                            run: z$1.ZodFunction<z$1.ZodTuple<readonly [z$1.ZodRecord<z$1.ZodString, z$1.ZodAny>], null>, z$1.ZodUnion<readonly [z$1.ZodObject<{
                                success: z$1.ZodBoolean;
                                output: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodAny>>;
                                error: z$1.ZodOptional<z$1.ZodString>;
                            }, z$1.core.$strip>, z$1.ZodPromise<z$1.ZodObject<{
                                success: z$1.ZodBoolean;
                                output: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodAny>>;
                                error: z$1.ZodOptional<z$1.ZodString>;
                            }, z$1.core.$strip>>]>>;
                        }, z$1.core.$strip>>;
                    }, z$1.core.$strip>;
                }, z$1.core.$strip>;
            }, {
                name: "agent.tool-requests";
                dataSchema: z$1.ZodObject<{
                    requests: z$1.ZodArray<z$1.ZodObject<{
                        toolRequestId: z$1.ZodString;
                        toolName: z$1.ZodString;
                        toolInput: z$1.ZodRecord<z$1.ZodString, z$1.ZodAny>;
                    }, z$1.core.$strip>>;
                }, z$1.core.$strip>;
            }, {
                name: "agent.interrupted";
                dataSchema: z$1.ZodObject<{
                    reason: z$1.ZodString;
                    forced: z$1.ZodBoolean;
                    author: z$1.ZodEnum<{
                        user: "user";
                        application: "application";
                    }>;
                }, z$1.core.$strip>;
            }, {
                name: "agent.text-chunk";
                dataSchema: z$1.ZodObject<{
                    textChunk: z$1.ZodString;
                }, z$1.core.$strip>;
            }, {
                name: "agent.voice-chunk";
                dataSchema: z$1.ZodObject<{
                    voiceChunk: z$1.ZodCustom<Int16Array<ArrayBufferLike>, Int16Array<ArrayBufferLike>>;
                }, z$1.core.$strip>;
            }];
            handlers: [...never[], {
                name: "maintain-status";
                mode: "block";
                state: never;
                onEvent: (params: unknown) => void;
            }, {
                name: "maintain-messages";
                mode: "block";
                state: never;
                onEvent: (params: unknown) => string | undefined;
            }, {
                name: "receive-user-audio";
                mode: "block";
                state: never;
                onEvent: (params: unknown) => void;
            }, {
                name: "detect-user-voice";
                mode: "stream";
                state: never;
                onEvent: (params: unknown) => Promise<void>;
            }, {
                name: "transcribe-user-voice";
                mode: "stream";
                state: never;
                onEvent: (params: unknown) => Promise<void>;
            }, {
                name: "detect-end-of-turn";
                mode: "stream";
                state: never;
                onEvent: (params: unknown) => Promise<void>;
            }, {
                name: "generate-agent-response";
                mode: "block";
                state: never;
                onEvent: (params: unknown) => void;
            }, {
                name: "handle-resources-requests";
                mode: "block";
                state: never;
                onEvent: (params: unknown) => void;
            }, {
                name: "handle-tools-requests";
                mode: "block";
                state: never;
                onEvent: (params: unknown) => void;
            }, {
                name: "stream-outgoing-audio";
                mode: "stream";
                state: never;
                onEvent: (params: unknown) => void;
            }];
        }[];
        config: ZodObjectWithTelemetry<z$1.ZodObject<{
            items: z$1.ZodPrefault<z$1.ZodArray<z$1.ZodCustom<{
                _definition: StoreDefinition;
            }, {
                _definition: StoreDefinition;
            }>>>;
        }, z$1.core.$strip>, "output">;
        context: ZodObjectWithTelemetry<z$1.ZodObject<{
            storesData: z$1.ZodPrefault<z$1.ZodRecord<z$1.ZodString, z$1.ZodAny>>;
        }, z$1.core.$strip>, "output">;
        events: [{
            readonly name: "plugin.start";
            readonly dataSchema: z$1.ZodObject<{
                isRestart: z$1.ZodPrefault<z$1.ZodBoolean>;
                restartCount: z$1.ZodPrefault<z$1.ZodNumber>;
            }, z$1.core.$strip>;
        }, {
            readonly name: "plugin.stop";
        }, {
            readonly name: "plugin.test";
        }, {
            readonly name: "plugin.error";
            readonly dataSchema: z$1.ZodObject<{
                error: z$1.ZodCustom<LifeErrorUnion, LifeErrorUnion>;
                event: z$1.ZodObject<{
                    id: z$1.ZodString;
                    name: z$1.ZodString;
                    urgent: z$1.ZodPrefault<z$1.ZodBoolean>;
                    data: z$1.ZodPrefault<z$1.ZodAny>;
                    created: z$1.ZodObject<{
                        at: z$1.ZodNumber;
                        by: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{
                            type: z$1.ZodLiteral<"handler">;
                            plugin: z$1.ZodString;
                            handler: z$1.ZodString;
                            event: z$1.ZodString;
                        }, z$1.core.$strip>, z$1.ZodObject<{
                            type: z$1.ZodLiteral<"server">;
                            name: z$1.ZodString;
                        }, z$1.core.$strip>, z$1.ZodObject<{
                            type: z$1.ZodLiteral<"client">;
                            name: z$1.ZodString;
                        }, z$1.core.$strip>], "type">;
                    }, z$1.core.$strip>;
                    edited: z$1.ZodDefault<z$1.ZodUnion<[z$1.ZodArray<z$1.ZodObject<{
                        at: z$1.ZodNumber;
                        by: z$1.ZodObject<{
                            plugin: z$1.ZodString;
                            handler: z$1.ZodString;
                        }, z$1.core.$strip>;
                        reason: z$1.ZodString;
                        dataBefore: z$1.ZodAny;
                        dataAfter: z$1.ZodAny;
                    }, z$1.core.$strip>>, z$1.ZodLiteral<false>]>>;
                    dropped: z$1.ZodPrefault<z$1.ZodUnion<[z$1.ZodObject<{
                        at: z$1.ZodNumber;
                        by: z$1.ZodObject<{
                            plugin: z$1.ZodString;
                            handler: z$1.ZodString;
                        }, z$1.core.$strip>;
                        reason: z$1.ZodString;
                    }, z$1.core.$strip>, z$1.ZodLiteral<false>]>>;
                    contextChanges: z$1.ZodPrefault<z$1.ZodArray<z$1.ZodObject<{
                        at: z$1.ZodNumber;
                        byHandler: z$1.ZodString;
                        valueBefore: z$1.ZodAny;
                        valueAfter: z$1.ZodAny;
                    }, z$1.core.$strip>>>;
                }, z$1.core.$strip>;
            }, z$1.core.$strip>;
        }] | [{
            name: "update-store-data";
            dataSchema: z$1.ZodObject<{
                name: z$1.ZodString;
                data: z$1.ZodAny;
            }, z$1.core.$strip>;
        }, {
            name: "retrieve-store-data";
            dataSchema: z$1.ZodObject<{
                name: z$1.ZodString;
            }, z$1.core.$strip>;
        }];
        handlers: never[];
    })[];
    readonly pluginConfigs: {};
}, never>;

type AgentScopeDefinition<Schema extends z__default.ZodObject = z__default.ZodObject> = {
    schema: Schema;
    hasAccess: (params: {
        request: Request;
        scope: z__default.output<Schema>;
    }) => boolean | Promise<boolean>;
};
type AgentScope<ScopeDefinition extends AgentScopeDefinition = AgentScopeDefinition> = z__default.output<ScopeDefinition["schema"]>;
type AgentPluginsDefinition = PluginDefinition[];
type AgentDefinition = {
    name: string;
    config: z__default.input<typeof agentServerConfig.schema>;
    plugins: AgentPluginsDefinition;
    pluginConfigs: Record<string, unknown>;
    scope: AgentScopeDefinition;
};
type TypedAgentBuilder<AgentDef extends AgentDefinition, Excluded extends string = never> = Omit<AgentBuilder<AgentDef, Excluded> & (Extract<AgentDef["plugins"][number], {
    name: "generation";
}> extends never ? unknown : {
    /**
     * TODO
     */
    generation: AgentBuilderPluginMethod<"generation", AgentDef, Excluded>;
}) & (Extract<AgentDef["plugins"][number], {
    name: "memories";
}> extends never ? unknown : {
    /**
     * TODO
     */
    memories: AgentBuilderPluginMethod<"memories", AgentDef, Excluded>;
}) & (Extract<AgentDef["plugins"][number], {
    name: "actions";
}> extends never ? unknown : {
    /**
     * TODO
     */
    actions: AgentBuilderPluginMethod<"actions", AgentDef, Excluded>;
}) & (Extract<AgentDef["plugins"][number], {
    name: "percepts";
}> extends never ? unknown : {
    /**
     * TODO
     */
    percepts: AgentBuilderPluginMethod<"percepts", AgentDef, Excluded>;
}) & (Extract<AgentDef["plugins"][number], {
    name: "stores";
}> extends never ? unknown : {
    /**
     * TODO
     */
    stores: AgentBuilderPluginMethod<"stores", AgentDef, Excluded>;
}) & (Extract<AgentDef["plugins"][number], {
    name: "effects";
}> extends never ? unknown : {
    /**
     * TODO
     */
    effects: AgentBuilderPluginMethod<"effects", AgentDef, Excluded>;
}) & {
    [PluginDef in Exclude<AgentDef["plugins"][number], {
        name: "generation" | "memories" | "actions" | "percepts" | "stores" | "effects";
    }> as ToMethodName<PluginDef["name"]>]: AgentBuilderPluginMethod<PluginDef["name"], AgentDef, Excluded>;
}, Excluded>;
type AgentBuilderPluginMethod<PluginName extends string, AgentDef extends AgentDefinition, Excluded extends string = never> = <const C extends PluginConfig<Extract<AgentDef["plugins"][number], {
    name: PluginName;
}>["config"], "input">>(config: C) => PluginName extends string ? TypedAgentBuilder<AgentDef & {
    pluginConfigs: {
        [Key in PluginName]: PluginConfig<Extract<AgentDef["plugins"][number], {
            name: PluginName;
        }>["config"], "output"> & C;
    };
}, Excluded | PluginName> : never;

declare class AgentServer {
    #private;
    readonly def: AgentDefinition;
    readonly id: string;
    readonly sha: string;
    readonly config: z__default.output<typeof agentServerConfig.schema>;
    readonly transport: TransportNodeClient;
    readonly storage: null;
    readonly models: {
        vad: InstanceType<VADProvider>;
        stt: InstanceType<STTProvider>;
        eou: InstanceType<EOUProvider>;
        llm: InstanceType<LLMProvider>;
        tts: InstanceType<TTSProvider>;
    };
    readonly plugins: Record<string, PluginServer<PluginDefinition>>;
    readonly scope: AgentScope<AgentDefinition["scope"]>;
    readonly isRestart: boolean;
    readonly telemetry: TelemetryClient;
    constructor({ id, sha, definition, scope, config, pluginsContexts, isRestart, }: {
        id: string;
        sha: string;
        definition: AgentDefinition;
        config: z__default.output<typeof agentServerConfig.schema>;
        scope?: AgentScope<AgentDefinition["scope"]>;
        isRestart?: boolean;
        pluginsContexts?: Record<string, SerializableValue>;
    });
    start(): Promise<readonly [error: LifeErrorUnion, data: undefined] | readonly [error: undefined, data: void]>;
    stop(): Promise<readonly [error: LifeErrorUnion, data: undefined] | readonly [error: undefined, data: void]>;
}

/**
 * Builder class for the plugin definition.
 * Do not use directly, use `definePlugin()` instead.
 */
declare class PluginBuilder<PluginDef extends PluginDefinition, Excluded extends string = never> {
    readonly def: PluginDef;
    constructor(definition: PluginDef);
    /**
     * ### `.dependencies()`
     *
     * Specify other plugins as required by this plugin.
     *
     * Their context, events, and config can then be accessed from `dependencies.*` inside handlers.
     *
     * @see TODO: Add docs link
     *
     * @example
     * ```ts
     * const plugin = definePlugin("my-plugin")
     *    .dependencies([anotherPlugin]);
     *    .addHandler({
     *        name: "handler-1",
     *        mode: "block",
     *        onEvent: ({ dependencies }) => {
     *            if (dependencies.anotherPlugin.config.delayMs > 10) { // <-- Here
     *              // ...
     *            }
     *        },
     *    });
     * ```
     * &nbsp;
     *
     * ---
     * @param plugins - The dependencies definitions.
     * @returns TypedPluginBuilder
     */
    dependencies<Plugins extends {
        def: PluginDefinition;
    }[]>(plugins: Plugins): TypedPluginBuilder<Override<PluginDef, "dependencies", { [K in keyof Plugins]: Without<Plugins[K]["def"], "dependencies">; }>, Excluded | "dependencies">;
    /**
     * ### `.config()`
     *
     * Add a configuration that users can provide to tweak plugin's behavior.
     *
     * @see TODO: Add docs link
     *
     * @example
     * ```ts
     * const myPlugin = definePlugin("my-plugin")
     *    .config({ schema: z.object({ enableVoice: z.boolean() }) });
     *
     * const myAgent = defineAgent("my-agent")
     *    .plugins([myPlugin])
     *    .myPlugin({ enableVoice: true }); // <-- Here
     * ```
     * &nbsp;
     *
     * ---
     *
     * The provided config can then be accessed from `plugin.config` inside handlers.
     *
     * @example
     * ```ts
     * const plugin = definePlugin("my-plugin")
     *    .config({ schema: z.object({ enableVoice: z.boolean() }) });
     *    .addHandler({
     *      name: "handler-1",
     *      mode: "block",
     *      onEvent: ({ plugin }) => {
     *        if (plugin.config.enableVoice) { // <-- Here
     *          // ...
     *        }
     *      },
     *    });
     *
     * ```
     * &nbsp;
     *
     * ---
     * @param config - The config definition.
     * @returns TypedPluginBuilder
     */
    config<Schema extends z$1.ZodObject>(config: ZodObjectWithTelemetry<Schema, "input">): TypedPluginBuilder<{ [K in keyof { [I in keyof PluginDef]: I extends "config" ? ZodObjectWithTelemetry<Schema, "output"> : PluginDef[I]; }]: { [I in keyof PluginDef]: I extends "config" ? ZodObjectWithTelemetry<Schema, "output"> : PluginDef[I]; }[K]; }, "config" | Excluded | "$config">;
    /**
     * ### `.$config()`
     *
     * Define plugin config from the output of `definePluginConfig()`.
     *
     * @see TODO: Add docs link for `definePluginConfig()`
     *
     * ---
     * @param config - The config definition.
     * @returns TypedPluginBuilder
     */
    $config<ConfigDef extends PluginConfigDefinition>(config: ConfigDef): TypedPluginBuilder<Override<PluginDef, "config", ConfigDef>, Excluded | "config" | "$config">;
    /**
     * ### `.context()`
     *
     * Add an in-memory object that handlers can read/write to share data without race conditions.
     *
     * Context is also exposed to dependent plugins and synced to the frontend via RPC.
     *
     * The context must be serializable, and thus cannot contain functions, instances, etc.
     * Use `state` property in handlers for non-serializable data instead.
     *
     * @see TODO: Add docs link
     *
     * @example
     * ```ts
     * const plugin = definePlugin("my-plugin")
     *    .context(z.object({ name: z.string() }));
     * ```
     * &nbsp;
     *
     * ---
     * @param context - The context definition.
     */
    context<Schema extends z$1.ZodObject>(context: ZodObjectWithTelemetry<Schema, "input">): TypedPluginBuilder<{ [K in keyof { [I in keyof PluginDef]: I extends "context" ? ZodObjectWithTelemetry<Schema, "output"> : PluginDef[I]; }]: { [I in keyof PluginDef]: I extends "context" ? ZodObjectWithTelemetry<Schema, "output"> : PluginDef[I]; }[K]; }, "context" | Excluded | "$context">;
    /**
     * ### `.$context()`
     *
     * Define plugin context from the output of `definePluginContext()`.
     *
     * @see TODO: Add docs link for `definePluginContext()`
     *
     * ---
     * @param context - The context definition.
     * @returns TypedPluginBuilder
     */
    $context<ContextDef extends PluginContextDefinition>(context: ContextDef): TypedPluginBuilder<Override<PluginDef, "context", ContextDef>, Excluded | "context" | "$context">;
    /**
     * ### `.events()`
     *
     * Add events that handlers can emit and observe to communicate with each other.
     *
     * Each plugin has a single event queue enforcing the order of execution, making
     * plugins more predictable and easier to write and maintain.
     *
     * @see TODO: Add docs link
     *
     * @example
     * ```ts
     * const plugin = definePlugin("my-plugin")
     *    .events([{ name: "my-event" }])
     *    .addHandler({
     *      name: "handler-1",
     *      mode: "block",
     *      onEvent: ({ event, plugin }) => {
     *        // Emit 'my-event' when the plugin starts
     *        if (event.name === "plugin.start") {
     *          plugin.events.emit({ name: "my-event" });
     *        }
     *      },
     *    })
     *    .addHandler({
     *      name: "handler-2",
     *      mode: "block",
     *      onEvent: ({ event, plugin }) => {
     *        // Listen to 'my-event' from handler-1
     *        if (event.name === "my-event") {
     *          // Do something...
     *        }
     *      },
     *    });
     * ```
     * &nbsp;
     *
     * ---
     * @param events - The events definition.
     * @returns TypedPluginBuilder
     */
    events<const Names extends string[], EventsDef extends PluginEventsDefinition<Names>>(...events: EventsDef): TypedPluginBuilder<{ [K in keyof { [I in keyof PluginDef]: I extends "events" ? [{
        readonly name: "plugin.start";
        readonly dataSchema: z$1.ZodObject<{
            isRestart: z$1.ZodPrefault<z$1.ZodBoolean>;
            restartCount: z$1.ZodPrefault<z$1.ZodNumber>;
        }, z$1.core.$strip>;
    }, {
        readonly name: "plugin.stop";
    }, {
        readonly name: "plugin.test";
    }, {
        readonly name: "plugin.error";
        readonly dataSchema: z$1.ZodObject<{
            error: z$1.ZodCustom<LifeErrorUnion, LifeErrorUnion>;
            event: z$1.ZodObject<{
                id: z$1.ZodString;
                name: z$1.ZodString;
                urgent: z$1.ZodPrefault<z$1.ZodBoolean>;
                data: z$1.ZodPrefault<z$1.ZodAny>;
                created: z$1.ZodObject<{
                    at: z$1.ZodNumber;
                    by: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{
                        type: z$1.ZodLiteral<"handler">;
                        plugin: z$1.ZodString;
                        handler: z$1.ZodString;
                        event: z$1.ZodString;
                    }, z$1.core.$strip>, z$1.ZodObject<{
                        type: z$1.ZodLiteral<"server">;
                        name: z$1.ZodString;
                    }, z$1.core.$strip>, z$1.ZodObject<{
                        type: z$1.ZodLiteral<"client">;
                        name: z$1.ZodString;
                    }, z$1.core.$strip>], "type">;
                }, z$1.core.$strip>;
                edited: z$1.ZodDefault<z$1.ZodUnion<[z$1.ZodArray<z$1.ZodObject<{
                    at: z$1.ZodNumber;
                    by: z$1.ZodObject<{
                        plugin: z$1.ZodString;
                        handler: z$1.ZodString;
                    }, z$1.core.$strip>;
                    reason: z$1.ZodString;
                    dataBefore: z$1.ZodAny;
                    dataAfter: z$1.ZodAny;
                }, z$1.core.$strip>>, z$1.ZodLiteral<false>]>>;
                dropped: z$1.ZodPrefault<z$1.ZodUnion<[z$1.ZodObject<{
                    at: z$1.ZodNumber;
                    by: z$1.ZodObject<{
                        plugin: z$1.ZodString;
                        handler: z$1.ZodString;
                    }, z$1.core.$strip>;
                    reason: z$1.ZodString;
                }, z$1.core.$strip>, z$1.ZodLiteral<false>]>>;
                contextChanges: z$1.ZodPrefault<z$1.ZodArray<z$1.ZodObject<{
                    at: z$1.ZodNumber;
                    byHandler: z$1.ZodString;
                    valueBefore: z$1.ZodAny;
                    valueAfter: z$1.ZodAny;
                }, z$1.core.$strip>>>;
            }, z$1.core.$strip>;
        }, z$1.core.$strip>;
    }] | EventsDef : PluginDef[I]; }]: { [I in keyof PluginDef]: I extends "events" ? [{
        readonly name: "plugin.start";
        readonly dataSchema: z$1.ZodObject<{
            isRestart: z$1.ZodPrefault<z$1.ZodBoolean>;
            restartCount: z$1.ZodPrefault<z$1.ZodNumber>;
        }, z$1.core.$strip>;
    }, {
        readonly name: "plugin.stop";
    }, {
        readonly name: "plugin.test";
    }, {
        readonly name: "plugin.error";
        readonly dataSchema: z$1.ZodObject<{
            error: z$1.ZodCustom<LifeErrorUnion, LifeErrorUnion>;
            event: z$1.ZodObject<{
                id: z$1.ZodString;
                name: z$1.ZodString;
                urgent: z$1.ZodPrefault<z$1.ZodBoolean>;
                data: z$1.ZodPrefault<z$1.ZodAny>;
                created: z$1.ZodObject<{
                    at: z$1.ZodNumber;
                    by: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{
                        type: z$1.ZodLiteral<"handler">;
                        plugin: z$1.ZodString;
                        handler: z$1.ZodString;
                        event: z$1.ZodString;
                    }, z$1.core.$strip>, z$1.ZodObject<{
                        type: z$1.ZodLiteral<"server">;
                        name: z$1.ZodString;
                    }, z$1.core.$strip>, z$1.ZodObject<{
                        type: z$1.ZodLiteral<"client">;
                        name: z$1.ZodString;
                    }, z$1.core.$strip>], "type">;
                }, z$1.core.$strip>;
                edited: z$1.ZodDefault<z$1.ZodUnion<[z$1.ZodArray<z$1.ZodObject<{
                    at: z$1.ZodNumber;
                    by: z$1.ZodObject<{
                        plugin: z$1.ZodString;
                        handler: z$1.ZodString;
                    }, z$1.core.$strip>;
                    reason: z$1.ZodString;
                    dataBefore: z$1.ZodAny;
                    dataAfter: z$1.ZodAny;
                }, z$1.core.$strip>>, z$1.ZodLiteral<false>]>>;
                dropped: z$1.ZodPrefault<z$1.ZodUnion<[z$1.ZodObject<{
                    at: z$1.ZodNumber;
                    by: z$1.ZodObject<{
                        plugin: z$1.ZodString;
                        handler: z$1.ZodString;
                    }, z$1.core.$strip>;
                    reason: z$1.ZodString;
                }, z$1.core.$strip>, z$1.ZodLiteral<false>]>>;
                contextChanges: z$1.ZodPrefault<z$1.ZodArray<z$1.ZodObject<{
                    at: z$1.ZodNumber;
                    byHandler: z$1.ZodString;
                    valueBefore: z$1.ZodAny;
                    valueAfter: z$1.ZodAny;
                }, z$1.core.$strip>>>;
            }, z$1.core.$strip>;
        }, z$1.core.$strip>;
    }] | EventsDef : PluginDef[I]; }[K]; }, "events" | Excluded | "$events">;
    /**
     * ### `.$events()`
     *
     * Define plugin events from the output of `definePluginEvents()`.
     *
     * @see TODO: Add docs link for `definePluginEvents()`
     *
     * ---
     * @param events - The events definition.
     * @returns TypedPluginBuilder
     */
    $events<EventsDef extends PluginEventsDefinition>(events: EventsDef): TypedPluginBuilder<Override<PluginDef, "events", EventsDef>, Excluded | "events" | "$events">;
    /**
     * ### `.addHandler()`
     *
     * Add a handler function to react to events from this plugin or dependent plugins.
     *
     * @see TODO: Add docs link
     *
     * @example
     * ```ts
     * const plugin = definePlugin("my-plugin")
     *    .addHandler({
     *      name: "handler-1",
     *      mode: "block",
     *      onEvent: ({ event, plugin }) => {
     *        // Do something...
     *      },
     *    });
     * ```
     * &nbsp;
     *
     * ---
     *
     * Handlers can return a value, which can be retrieved using the `events.waitForResult(eventId, handlerName)` method.
     *
     * @example
     * ```ts
     * const plugin = definePlugin("my-plugin")
     *    .events([{ name: "my-event" }])
     *    .addHandler({
     *      name: "handler-1",
     *      mode: "block",
     *      onEvent: () => 123;
     *    })
     *    .addHandler({
     *      name: "handler-2",
     *      mode: "block",
     *      onEvent: ({ event, plugin }) => {
     *        if (event.name === "my-event") {
     *          const eventId = plugin.events.emit({ name: "my-event" });
     *          const result = await plugin.events.waitForResult(eventId, "handler-1");
     *          // result: string (type-safe!)
     *        }
     *      },
     *    })
     * ```
     * &nbsp;
     *
     * ---
     * @param handler - The handler definition.
     * @returns TypedPluginBuilder
     */
    addHandler<Name extends string, Handler extends PluginHandlerDefinition<PluginDef, Name, StateDef>, StateDef extends PluginHandlerStateDefinition<PluginDef>>(handler: Handler & {
        state?: StateDef;
    }): TypedPluginBuilder<Override<PluginDef, "handlers", [...PluginDef["handlers"], {
        name: Handler["name"];
        mode: Handler["mode"];
        state: never;
        onEvent: (params: unknown) => ReturnType<Handler["onEvent"]>;
    }]>, Excluded>;
    /**
     * ### `.removeHandler()`
     *
     * Remove a previously added handler from the plugin.
     *
     * @see TODO: Add docs link
     *
     * @example
     * ```ts
     * const plugin = definePlugin("my-plugin")
     *    .addHandler({
     *      name: "handler-1",
     *      mode: "block",
     *      onEvent: ({ event, plugin }) => void 0,
     *    });
     *
     * const pluginWithoutHandler1 = plugin.removeHandler("handler-1");
     * ```
     * &nbsp;
     *
     * ---
     * @param name - The name of the handler to remove.
     * @returns TypedPluginBuilder
     */
    removeHandler<const Name extends PluginDef["handlers"][number]["name"]>(name: Name): TypedPluginBuilder<Override<PluginDef, "handlers", FilterHandlersByName<PluginDef["handlers"], Name>>, Excluded>;
}
/**
 * ### `definePlugin()`
 *
 * Define a new Life.js plugin.
 *
 * @see TODO: Add docs link
 */
declare function definePlugin<const Name extends string>(name: Name): PluginBuilder<{
    name: Name;
    dependencies: never[];
    config: ZodObjectWithTelemetry<z$1.ZodObject<{
        [x: string]: any;
    }, z$1.core.$strip>, "output">;
    context: ZodObjectWithTelemetry<z$1.ZodObject<{
        [x: string]: any;
    }, z$1.core.$strip>, "output">;
    events: [{
        readonly name: "plugin.start";
        readonly dataSchema: z$1.ZodObject<{
            isRestart: z$1.ZodPrefault<z$1.ZodBoolean>;
            restartCount: z$1.ZodPrefault<z$1.ZodNumber>;
        }, z$1.core.$strip>;
    }, {
        readonly name: "plugin.stop";
    }, {
        readonly name: "plugin.test";
    }, {
        readonly name: "plugin.error";
        readonly dataSchema: z$1.ZodObject<{
            error: z$1.ZodCustom<LifeErrorUnion, LifeErrorUnion>;
            event: z$1.ZodObject<{
                id: z$1.ZodString;
                name: z$1.ZodString;
                urgent: z$1.ZodPrefault<z$1.ZodBoolean>;
                data: z$1.ZodPrefault<z$1.ZodAny>;
                created: z$1.ZodObject<{
                    at: z$1.ZodNumber;
                    by: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{
                        type: z$1.ZodLiteral<"handler">;
                        plugin: z$1.ZodString;
                        handler: z$1.ZodString;
                        event: z$1.ZodString;
                    }, z$1.core.$strip>, z$1.ZodObject<{
                        type: z$1.ZodLiteral<"server">;
                        name: z$1.ZodString;
                    }, z$1.core.$strip>, z$1.ZodObject<{
                        type: z$1.ZodLiteral<"client">;
                        name: z$1.ZodString;
                    }, z$1.core.$strip>], "type">;
                }, z$1.core.$strip>;
                edited: z$1.ZodDefault<z$1.ZodUnion<[z$1.ZodArray<z$1.ZodObject<{
                    at: z$1.ZodNumber;
                    by: z$1.ZodObject<{
                        plugin: z$1.ZodString;
                        handler: z$1.ZodString;
                    }, z$1.core.$strip>;
                    reason: z$1.ZodString;
                    dataBefore: z$1.ZodAny;
                    dataAfter: z$1.ZodAny;
                }, z$1.core.$strip>>, z$1.ZodLiteral<false>]>>;
                dropped: z$1.ZodPrefault<z$1.ZodUnion<[z$1.ZodObject<{
                    at: z$1.ZodNumber;
                    by: z$1.ZodObject<{
                        plugin: z$1.ZodString;
                        handler: z$1.ZodString;
                    }, z$1.core.$strip>;
                    reason: z$1.ZodString;
                }, z$1.core.$strip>, z$1.ZodLiteral<false>]>>;
                contextChanges: z$1.ZodPrefault<z$1.ZodArray<z$1.ZodObject<{
                    at: z$1.ZodNumber;
                    byHandler: z$1.ZodString;
                    valueBefore: z$1.ZodAny;
                    valueAfter: z$1.ZodAny;
                }, z$1.core.$strip>>>;
            }, z$1.core.$strip>;
        }, z$1.core.$strip>;
    }];
    handlers: never[];
}, never>;

type PluginDependenciesDefinition = Without<PluginDefinition, "dependencies">[];
type PluginConfigDefinition = ZodObjectWithTelemetry<z__default.ZodObject, "output">;
type PluginConfig<ConfigDef extends PluginConfigDefinition, T extends "input" | "output"> = T extends "input" ? z__default.input<ConfigDef["schema"]> : z__default.output<ConfigDef["schema"]>;
type PluginContextDefinition = ZodObjectWithTelemetry<z__default.ZodObject, "output">;
type PluginContext<ContextDef extends PluginContextDefinition, T extends "input" | "output"> = T extends "input" ? z__default.input<ContextDef["schema"]> : z__default.output<ContextDef["schema"]>;
declare const eventSourceSchema: z__default.ZodDiscriminatedUnion<[z__default.ZodObject<{
    type: z__default.ZodLiteral<"handler">;
    plugin: z__default.ZodString;
    handler: z__default.ZodString;
    event: z__default.ZodString;
}, z__default.core.$strip>, z__default.ZodObject<{
    type: z__default.ZodLiteral<"server">;
    name: z__default.ZodString;
}, z__default.core.$strip>, z__default.ZodObject<{
    type: z__default.ZodLiteral<"client">;
    name: z__default.ZodString;
}, z__default.core.$strip>], "type">;
type PluginEventSource = z__default.infer<typeof eventSourceSchema>;
declare const pluginEventSchema: z__default.ZodObject<{
    id: z__default.ZodString;
    name: z__default.ZodString;
    urgent: z__default.ZodPrefault<z__default.ZodBoolean>;
    data: z__default.ZodPrefault<z__default.ZodAny>;
    created: z__default.ZodObject<{
        at: z__default.ZodNumber;
        by: z__default.ZodDiscriminatedUnion<[z__default.ZodObject<{
            type: z__default.ZodLiteral<"handler">;
            plugin: z__default.ZodString;
            handler: z__default.ZodString;
            event: z__default.ZodString;
        }, z__default.core.$strip>, z__default.ZodObject<{
            type: z__default.ZodLiteral<"server">;
            name: z__default.ZodString;
        }, z__default.core.$strip>, z__default.ZodObject<{
            type: z__default.ZodLiteral<"client">;
            name: z__default.ZodString;
        }, z__default.core.$strip>], "type">;
    }, z__default.core.$strip>;
    edited: z__default.ZodDefault<z__default.ZodUnion<[z__default.ZodArray<z__default.ZodObject<{
        at: z__default.ZodNumber;
        by: z__default.ZodObject<{
            plugin: z__default.ZodString;
            handler: z__default.ZodString;
        }, z__default.core.$strip>;
        reason: z__default.ZodString;
        dataBefore: z__default.ZodAny;
        dataAfter: z__default.ZodAny;
    }, z__default.core.$strip>>, z__default.ZodLiteral<false>]>>;
    dropped: z__default.ZodPrefault<z__default.ZodUnion<[z__default.ZodObject<{
        at: z__default.ZodNumber;
        by: z__default.ZodObject<{
            plugin: z__default.ZodString;
            handler: z__default.ZodString;
        }, z__default.core.$strip>;
        reason: z__default.ZodString;
    }, z__default.core.$strip>, z__default.ZodLiteral<false>]>>;
    contextChanges: z__default.ZodPrefault<z__default.ZodArray<z__default.ZodObject<{
        at: z__default.ZodNumber;
        byHandler: z__default.ZodString;
        valueBefore: z__default.ZodAny;
        valueAfter: z__default.ZodAny;
    }, z__default.core.$strip>>>;
}, z__default.core.$strip>;
type PluginEventDataSchema = z__default.ZodObject | z__default.ZodDiscriminatedUnion<z__default.ZodObject[]>;
type PluginEventDefinition<Name extends string> = {
    name: Name;
    dataSchema?: PluginEventDataSchema;
};
type PluginEventsDefinition<Names extends string[] = string[]> = {
    [K in keyof Names]: PluginEventDefinition<Names[K]>;
};
type PluginEvent<EventsDef extends PluginEventsDefinition, T extends "input" | "output"> = {
    [K in keyof EventsDef]: Omit<T extends "input" ? Omit<z__default.input<typeof pluginEventSchema>, "created" | "edited" | "dropped" | "id" | "contextChanges"> : z__default.output<typeof pluginEventSchema>, "data" | "name"> & {
        name: EventsDef[K]["name"];
    } & (EventsDef[K]["dataSchema"] extends PluginEventDataSchema ? T extends "input" ? {
        data: z__default.input<EventsDef[K]["dataSchema"]>;
    } : {
        data: z__default.output<EventsDef[K]["dataSchema"]>;
    } : T extends "input" ? unknown : {
        data: null;
    });
}[number];
declare const internalEventsDef: [{
    readonly name: "plugin.start";
    readonly dataSchema: z__default.ZodObject<{
        isRestart: z__default.ZodPrefault<z__default.ZodBoolean>;
        restartCount: z__default.ZodPrefault<z__default.ZodNumber>;
    }, z__default.core.$strip>;
}, {
    readonly name: "plugin.stop";
}, {
    readonly name: "plugin.test";
}, {
    readonly name: "plugin.error";
    readonly dataSchema: z__default.ZodObject<{
        error: z__default.ZodCustom<LifeErrorUnion, LifeErrorUnion>;
        event: z__default.ZodObject<{
            id: z__default.ZodString;
            name: z__default.ZodString;
            urgent: z__default.ZodPrefault<z__default.ZodBoolean>;
            data: z__default.ZodPrefault<z__default.ZodAny>;
            created: z__default.ZodObject<{
                at: z__default.ZodNumber;
                by: z__default.ZodDiscriminatedUnion<[z__default.ZodObject<{
                    type: z__default.ZodLiteral<"handler">;
                    plugin: z__default.ZodString;
                    handler: z__default.ZodString;
                    event: z__default.ZodString;
                }, z__default.core.$strip>, z__default.ZodObject<{
                    type: z__default.ZodLiteral<"server">;
                    name: z__default.ZodString;
                }, z__default.core.$strip>, z__default.ZodObject<{
                    type: z__default.ZodLiteral<"client">;
                    name: z__default.ZodString;
                }, z__default.core.$strip>], "type">;
            }, z__default.core.$strip>;
            edited: z__default.ZodDefault<z__default.ZodUnion<[z__default.ZodArray<z__default.ZodObject<{
                at: z__default.ZodNumber;
                by: z__default.ZodObject<{
                    plugin: z__default.ZodString;
                    handler: z__default.ZodString;
                }, z__default.core.$strip>;
                reason: z__default.ZodString;
                dataBefore: z__default.ZodAny;
                dataAfter: z__default.ZodAny;
            }, z__default.core.$strip>>, z__default.ZodLiteral<false>]>>;
            dropped: z__default.ZodPrefault<z__default.ZodUnion<[z__default.ZodObject<{
                at: z__default.ZodNumber;
                by: z__default.ZodObject<{
                    plugin: z__default.ZodString;
                    handler: z__default.ZodString;
                }, z__default.core.$strip>;
                reason: z__default.ZodString;
            }, z__default.core.$strip>, z__default.ZodLiteral<false>]>>;
            contextChanges: z__default.ZodPrefault<z__default.ZodArray<z__default.ZodObject<{
                at: z__default.ZodNumber;
                byHandler: z__default.ZodString;
                valueBefore: z__default.ZodAny;
                valueAfter: z__default.ZodAny;
            }, z__default.core.$strip>>>;
        }, z__default.core.$strip>;
    }, z__default.core.$strip>;
}];
type PluginHandlerBlockFunction<PluginDef extends PluginDefinition, StateDef extends PluginHandlerStateDefinition<PluginDef>> = (params: {
    event: PluginEvent<PluginDef["events"], "output">;
    state: PluginHandlerState<PluginDef, StateDef>;
    plugin: ToPublic<PluginAccessor<PluginDef, {
        type: "handler";
        plugin: string;
        handler: string;
        event: string;
    }, "write">>;
    agent: ToPublic<AgentServer>;
    dependencies: ToPublic<PluginDependenciesAccessor<PluginDef["dependencies"], {
        type: "handler";
        plugin: string;
        handler: string;
        event: string;
    }>>;
    telemetry: TelemetrySpanHandle;
}) => MaybePromise<unknown>;
type PluginHandlerStreamFunction<PluginDef extends PluginDefinition, StateDef extends PluginHandlerStateDefinition<PluginDef>> = (params: {
    event: PluginEvent<PluginDef["events"], "output">;
    state: PluginHandlerState<PluginDef, StateDef>;
    plugin: ToPublic<PluginAccessor<PluginDef, {
        type: "handler";
        plugin: string;
        handler: string;
        event: string;
    }>>;
    agent: ToPublic<AgentServer>;
    dependencies: ToPublic<PluginDependenciesAccessor<PluginDef["dependencies"], {
        type: "handler";
        plugin: string;
        handler: string;
        event: string;
    }>>;
    telemetry: TelemetrySpanHandle;
}) => MaybePromise<unknown>;
type PluginHandlerInterceptFunction<PluginDef extends PluginDefinition, StateDef extends PluginHandlerStateDefinition<PluginDef>> = (params: {
    event: PluginEvent<PluginDef["dependencies"][number]["events"], "output">;
    state: PluginHandlerState<PluginDef, StateDef>;
    next: (data: PluginEvent<PluginDef["dependencies"][number]["events"], "output">["data"], reason: string) => void;
    drop: (reason: string) => void;
    plugin: ToPublic<PluginAccessor<PluginDef, {
        type: "handler";
        plugin: string;
        handler: string;
        event: string;
    }>>;
    dependency: ToPublic<PluginAccessor<PluginDef["dependencies"][number] & {
        dependencies: [];
    }, {
        type: "handler";
        plugin: string;
        handler: string;
        event: string;
    }>>;
    agent: ToPublic<AgentServer>;
    telemetry: TelemetrySpanHandle;
}) => MaybePromise<unknown>;
type PluginHandlerStateDefinition<PluginDef extends PluginDefinition> = Record<string, unknown> | ((params: {
    config: PluginConfig<PluginDef["config"], "output">;
}) => Record<string, unknown>);
type PluginHandlerState<PluginDef extends PluginDefinition, StateDef extends PluginHandlerStateDefinition<PluginDef>> = StateDef extends (p: infer _) => Record<string, unknown> ? ReturnType<StateDef> : StateDef;
type PluginHandlerDefinition<PluginDef extends PluginDefinition = PluginDefinition, Name extends string = string, StateDef extends PluginHandlerStateDefinition<PluginDef> = Record<string, unknown>> = {
    name: Name;
    state?: PluginHandlerStateDefinition<PluginDef>;
} & ({
    mode: "block";
    onEvent: PluginHandlerBlockFunction<PluginDef, StateDef>;
} | {
    mode: "stream";
    onEvent: PluginHandlerStreamFunction<PluginDef, StateDef>;
} | {
    mode: "intercept";
    onEvent: PluginHandlerInterceptFunction<PluginDef, StateDef>;
});
type ExtractPluginContext<PluginDef extends PluginDefinition> = PluginContext<PluginDef["context"], "output">;
type PluginAccessor<PluginDef extends PluginDefinition, Source extends PluginEventSource, HandlerAccess extends "read" | "write" = "read"> = (Source["type"] extends "client" ? unknown : {
    config: PluginConfig<PluginDef["config"], "output">;
}) & {
    context: {
        get(): OperationResult<ExtractPluginContext<PluginDef>>;
        /** Subscribe to changes in the context. Returns a function to unsubscribe. */
        onChange(selector: (context: ExtractPluginContext<PluginDef>) => unknown, callback: (newContext: ExtractPluginContext<PluginDef>, oldContext: ExtractPluginContext<PluginDef>) => void): OperationResult<() => void>;
    } & (HandlerAccess extends "write" ? {
        /** Set a value in the context. */
        set(valueOrUpdater: ExtractPluginContext<PluginDef> | ((ctx: ExtractPluginContext<PluginDef>) => ExtractPluginContext<PluginDef>)): OperationResult<void>;
    } : unknown);
    events: {
        emit: (event: Exclude<PluginEvent<PluginDef["events"], "input">, {
            name: (typeof internalEventsDef)[number]["name"];
        }>) => Source["type"] extends "client" ? Promise<OperationResult<string>> : OperationResult<string>;
        /**
         * Wait for the return type of a specific handler when processing a given event.
         * Note that the intercept handlers don't return a result, and so are not supported by this method.
         * @param eventId
         * @param handlerName
         * @returns
         */
        waitForProcessing: (eventId: string) => Promise<OperationResult<void>>;
        waitForResult: <HandlerName extends Exclude<PluginDef["handlers"][number], {
            mode: "intercept";
        }>["name"]>(eventId: string, handlerName: HandlerName) => Promise<OperationResult<ReturnType<Extract<PluginDef["handlers"][number], {
            name: HandlerName;
        }>["onEvent"]>>>;
    } & (Source["type"] extends "handler" ? unknown : {
        on: <const Selector extends PluginEventsSelector<PluginDef["events"]>>(selector: Selector, callback: (event: PluginEventsSelection<PluginDef["events"], Selector>) => MaybePromise<void>, includeDropped?: boolean) => OperationResult<() => void>;
        once: <const Selector extends PluginEventsSelector<PluginDef["events"]>>(selector: Selector, callback: (event: PluginEventsSelection<PluginDef["events"], Selector>) => MaybePromise<void>, includeDropped?: boolean) => OperationResult<() => void>;
    });
};
type PluginDependenciesAccessor<DependenciesDef extends PluginDependenciesDefinition, Source extends PluginEventSource> = {
    [DependencyDef in DependenciesDef[number] as DependencyDef["name"]]: PluginAccessor<DependencyDef & {
        dependencies: [];
    }, Source>;
};
type PluginEventsSelector<EventsDef extends PluginEventsDefinition> = "*" | EventsDef[number]["name"] | EventsDef[number]["name"][] | {
    include: EventsDef[number]["name"][] | "*";
    exclude?: EventsDef[number]["name"][];
};
type PluginEventsSelection<EventsDef extends PluginEventsDefinition, Selector extends PluginEventsSelector<EventsDef>> = Selector extends "*" ? PluginEvent<EventsDef, "output"> : Selector extends string ? Extract<PluginEvent<EventsDef, "output">, {
    name: Selector;
}> : Selector extends (infer S)[] ? S extends EventsDef[number]["name"] ? Extract<PluginEvent<EventsDef, "output">, {
    name: S;
}> : never : Selector extends {
    include: infer I;
    exclude?: infer E;
} ? I extends "*" ? E extends string[] ? Extract<PluginEvent<EventsDef, "output">, {
    name: Exclude<EventsDef[number]["name"], E[number]>;
}> : PluginEvent<EventsDef, "output"> : I extends string[] ? E extends string[] ? Extract<PluginEvent<EventsDef, "output">, {
    name: Exclude<I[number], E[number]>;
}> : Extract<PluginEvent<EventsDef, "output">, {
    name: I[number];
}> : never : never;
interface PluginDefinition {
    name: string;
    dependencies: PluginDependenciesDefinition;
    config: PluginConfigDefinition;
    context: PluginContextDefinition;
    events: PluginEventsDefinition;
    handlers: PluginHandlerDefinition[];
}
type TypedPluginBuilder<PluginDef extends PluginDefinition, Excluded extends string = never> = Omit<PluginBuilder<PluginDef, Excluded>, Excluded>;
type FilterHandlersByName<Handlers extends {
    name: string;
}[], Name extends string> = Handlers extends [{
    name: infer N;
}, ...infer Rest extends {
    name: string;
}[]] ? N extends Name ? FilterHandlersByName<Rest, Name> : [Handlers[0], ...FilterHandlersByName<Rest, Name>] : [];
type PluginEventsListener = {
    id: string;
    selector: PluginEventsSelector<PluginEventsDefinition>;
    callback: ((event: Any) => MaybePromise<void>) | "remote";
    includeDropped: boolean;
};
type PluginContextListener = {
    id: string;
    selector: (context: Any) => Any;
    callback: (newContext: Any, oldContext: Any) => MaybePromise<void>;
};

export { type AgentDefinition as A, type ClassShape as C, type LifeErrorUnion as L, type MemoryDefinition as M, type OperationResult as O, type PluginEventsDefinition as P, type StoreDefinition as S, type ToPublic as T, type Without as W, type Any as a, type PluginEvent as b, type Message as c, type TypedPluginBuilder as d, defineAgent as e, defineMemory as f, defineStore as g, definePlugin as h, type PluginConfig as i, type PluginDefinition as j, TelemetryClient as k, TransportClientBase as l, type AgentScope as m, type ToMethodName as n, type Override as o, type Opaque as p, type PluginConfigDefinition as q, type AssertPublic as r, type PluginAccessor as s };
