UNPKG

life

Version:

Life.js is the first fullstack framework to build agentic web applications. It is minimal, extensible, and typesafe. Well, everything you love.

909 lines (906 loc) 127 kB
import * as nanostores from 'nanostores'; import { L as LifeErrorUnion, a as Any, P as PluginEventsDefinition, b as PluginEvent } from './types-B6ejZKUB.js'; import { T as TypedPluginClientBuilder, P as PluginClientProvidedConfigs, a as PluginClientParams } from './create-COCmFmHD.js'; import { Z as ZodObjectWithTelemetry } from './config-n67P8tNt.js'; import z__default from 'zod'; declare const generationPluginEventsDef: [{ 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>; }] | [{ name: "messages.create"; dataSchema: z__default.ZodObject<{ message: z__default.ZodDiscriminatedUnion<[z__default.ZodObject<{ role: z__default.ZodLiteral<"user">; content: z__default.ZodPrefault<z__default.ZodString>; }, z__default.core.$strip>, z__default.ZodObject<{ role: z__default.ZodLiteral<"system">; content: z__default.ZodPrefault<z__default.ZodString>; }, z__default.core.$strip>, z__default.ZodObject<{ role: z__default.ZodLiteral<"agent">; content: z__default.ZodPrefault<z__default.ZodString>; toolsRequests: z__default.ZodPrefault<z__default.ZodArray<z__default.ZodObject<{ toolRequestId: z__default.ZodString; toolName: z__default.ZodString; toolInput: z__default.ZodRecord<z__default.ZodString, z__default.ZodAny>; }, z__default.core.$strip>>>; }, z__default.core.$strip>, z__default.ZodObject<{ role: z__default.ZodLiteral<"tool">; toolRequestId: z__default.ZodString; toolName: z__default.ZodString; toolSuccess: z__default.ZodBoolean; toolOutput: z__default.ZodOptional<z__default.ZodRecord<z__default.ZodString, z__default.ZodAny>>; toolError: z__default.ZodOptional<z__default.ZodString>; }, z__default.core.$strip>], "role">; }, z__default.core.$strip>; }, { name: "messages.update"; dataSchema: z__default.ZodObject<{ id: z__default.ZodString; role: z__default.ZodEnum<{ user: "user"; system: "system"; agent: "agent"; tool: "tool"; }>; message: z__default.ZodDiscriminatedUnion<[z__default.ZodObject<{ role: z__default.ZodLiteral<"user">; content: z__default.ZodPrefault<z__default.ZodString>; }, z__default.core.$strip>, z__default.ZodObject<{ role: z__default.ZodLiteral<"system">; content: z__default.ZodPrefault<z__default.ZodString>; }, z__default.core.$strip>, z__default.ZodObject<{ role: z__default.ZodLiteral<"agent">; content: z__default.ZodPrefault<z__default.ZodString>; toolsRequests: z__default.ZodPrefault<z__default.ZodArray<z__default.ZodObject<{ toolRequestId: z__default.ZodString; toolName: z__default.ZodString; toolInput: z__default.ZodRecord<z__default.ZodString, z__default.ZodAny>; }, z__default.core.$strip>>>; }, z__default.core.$strip>, z__default.ZodObject<{ role: z__default.ZodLiteral<"tool">; toolRequestId: z__default.ZodString; toolName: z__default.ZodString; toolSuccess: z__default.ZodBoolean; toolOutput: z__default.ZodOptional<z__default.ZodRecord<z__default.ZodString, z__default.ZodAny>>; toolError: z__default.ZodOptional<z__default.ZodString>; }, z__default.core.$strip>], "role">; }, z__default.core.$strip>; }, { name: "user.audio-chunk"; dataSchema: z__default.ZodObject<{ audioChunk: z__default.ZodCustom<Int16Array<ArrayBufferLike>, Int16Array<ArrayBufferLike>>; }, z__default.core.$strip>; }, { name: "user.voice-start"; }, { name: "user.voice-chunk"; dataSchema: z__default.ZodDiscriminatedUnion<[z__default.ZodObject<{ type: z__default.ZodLiteral<"voice">; voiceChunk: z__default.ZodCustom<Int16Array<ArrayBufferLike>, Int16Array<ArrayBufferLike>>; }, z__default.core.$strip>, z__default.ZodObject<{ type: z__default.ZodLiteral<"padding">; voiceChunk: z__default.ZodCustom<Int16Array<ArrayBufferLike>, Int16Array<ArrayBufferLike>>; paddingSide: z__default.ZodEnum<{ pre: "pre"; post: "post"; }>; paddingIndex: z__default.ZodNumber; }, z__default.core.$strip>], "type">; }, { name: "user.voice-end"; }, { name: "user.text-chunk"; dataSchema: z__default.ZodObject<{ textChunk: z__default.ZodString; }, z__default.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__default.ZodObject<{ interrupt: z__default.ZodPrefault<z__default.ZodUnion<[z__default.ZodEnum<{ abrupt: "abrupt"; smooth: "smooth"; }>, z__default.ZodLiteral<false>]>>; preventInterruption: z__default.ZodPrefault<z__default.ZodBoolean>; }, z__default.core.$strip>; }, { name: "agent.decide"; dataSchema: z__default.ZodObject<{ interrupt: z__default.ZodPrefault<z__default.ZodUnion<[z__default.ZodEnum<{ abrupt: "abrupt"; smooth: "smooth"; }>, z__default.ZodLiteral<false>]>>; preventInterruption: z__default.ZodPrefault<z__default.ZodBoolean>; messages: z__default.ZodArray<z__default.ZodDiscriminatedUnion<[z__default.ZodObject<{ role: z__default.ZodLiteral<"user">; content: z__default.ZodPrefault<z__default.ZodString>; id: z__default.ZodString; createdAt: z__default.ZodNumber; lastUpdated: z__default.ZodNumber; }, z__default.core.$strip>, z__default.ZodObject<{ role: z__default.ZodLiteral<"system">; content: z__default.ZodPrefault<z__default.ZodString>; id: z__default.ZodString; createdAt: z__default.ZodNumber; lastUpdated: z__default.ZodNumber; }, z__default.core.$strip>, z__default.ZodObject<{ role: z__default.ZodLiteral<"agent">; content: z__default.ZodPrefault<z__default.ZodString>; toolsRequests: z__default.ZodPrefault<z__default.ZodArray<z__default.ZodObject<{ toolRequestId: z__default.ZodString; toolName: z__default.ZodString; toolInput: z__default.ZodRecord<z__default.ZodString, z__default.ZodAny>; }, z__default.core.$strip>>>; id: z__default.ZodString; createdAt: z__default.ZodNumber; lastUpdated: z__default.ZodNumber; }, z__default.core.$strip>, z__default.ZodObject<{ role: z__default.ZodLiteral<"tool">; toolRequestId: z__default.ZodString; toolName: z__default.ZodString; toolSuccess: z__default.ZodBoolean; toolOutput: z__default.ZodOptional<z__default.ZodRecord<z__default.ZodString, z__default.ZodAny>>; toolError: z__default.ZodOptional<z__default.ZodString>; id: z__default.ZodString; createdAt: z__default.ZodNumber; lastUpdated: z__default.ZodNumber; }, z__default.core.$strip>], "role">>; }, z__default.core.$strip>; }, { name: "agent.say"; dataSchema: z__default.ZodObject<{ interrupt: z__default.ZodPrefault<z__default.ZodUnion<[z__default.ZodEnum<{ abrupt: "abrupt"; smooth: "smooth"; }>, z__default.ZodLiteral<false>]>>; preventInterruption: z__default.ZodPrefault<z__default.ZodBoolean>; text: z__default.ZodString; }, z__default.core.$strip>; }, { name: "agent.interrupt"; dataSchema: z__default.ZodObject<{ reason: z__default.ZodString; author: z__default.ZodEnum<{ user: "user"; application: "application"; }>; force: z__default.ZodPrefault<z__default.ZodBoolean>; }, z__default.core.$strip>; }, { name: "agent.resources-request"; }, { name: "agent.resources-response"; dataSchema: z__default.ZodObject<{ requestId: z__default.ZodString; resources: z__default.ZodObject<{ messages: z__default.ZodArray<z__default.ZodDiscriminatedUnion<[z__default.ZodObject<{ role: z__default.ZodLiteral<"user">; content: z__default.ZodPrefault<z__default.ZodString>; id: z__default.ZodString; createdAt: z__default.ZodNumber; lastUpdated: z__default.ZodNumber; }, z__default.core.$strip>, z__default.ZodObject<{ role: z__default.ZodLiteral<"system">; content: z__default.ZodPrefault<z__default.ZodString>; id: z__default.ZodString; createdAt: z__default.ZodNumber; lastUpdated: z__default.ZodNumber; }, z__default.core.$strip>, z__default.ZodObject<{ role: z__default.ZodLiteral<"agent">; content: z__default.ZodPrefault<z__default.ZodString>; toolsRequests: z__default.ZodPrefault<z__default.ZodArray<z__default.ZodObject<{ toolRequestId: z__default.ZodString; toolName: z__default.ZodString; toolInput: z__default.ZodRecord<z__default.ZodString, z__default.ZodAny>; }, z__default.core.$strip>>>; id: z__default.ZodString; createdAt: z__default.ZodNumber; lastUpdated: z__default.ZodNumber; }, z__default.core.$strip>, z__default.ZodObject<{ role: z__default.ZodLiteral<"tool">; toolRequestId: z__default.ZodString; toolName: z__default.ZodString; toolSuccess: z__default.ZodBoolean; toolOutput: z__default.ZodOptional<z__default.ZodRecord<z__default.ZodString, z__default.ZodAny>>; toolError: z__default.ZodOptional<z__default.ZodString>; id: z__default.ZodString; createdAt: z__default.ZodNumber; lastUpdated: z__default.ZodNumber; }, z__default.core.$strip>], "role">>; tools: z__default.ZodArray<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>>; }, z__default.core.$strip>; }, z__default.core.$strip>; }, { name: "agent.tool-requests"; dataSchema: z__default.ZodObject<{ requests: z__default.ZodArray<z__default.ZodObject<{ toolRequestId: z__default.ZodString; toolName: z__default.ZodString; toolInput: z__default.ZodRecord<z__default.ZodString, z__default.ZodAny>; }, z__default.core.$strip>>; }, z__default.core.$strip>; }, { name: "agent.interrupted"; dataSchema: z__default.ZodObject<{ reason: z__default.ZodString; forced: z__default.ZodBoolean; author: z__default.ZodEnum<{ user: "user"; application: "application"; }>; }, z__default.core.$strip>; }, { name: "agent.text-chunk"; dataSchema: z__default.ZodObject<{ textChunk: z__default.ZodString; }, z__default.core.$strip>; }, { name: "agent.voice-chunk"; dataSchema: z__default.ZodObject<{ voiceChunk: z__default.ZodCustom<Int16Array<ArrayBufferLike>, Int16Array<ArrayBufferLike>>; }, z__default.core.$strip>; }]; type PluginEventDataInput<EventsDef extends PluginEventsDefinition, Name extends EventsDef[number]["name"]> = Extract<PluginEvent<EventsDef, "input">, { name: Name; }> extends { data: infer Data; } ? Data : never; declare const generationPluginClient: TypedPluginClientBuilder<{ readonly name: "generation"; readonly config: ZodObjectWithTelemetry<z__default.ZodObject<{ enableVoice: z__default.ZodPrefault<z__default.ZodBoolean>; }, z__default.core.$strip>, "output">; readonly dependencies: []; readonly class: <const ProvidedConfigs extends PluginClientProvidedConfigs<ZodObjectWithTelemetry<z__default.ZodObject<{ enableVoice: z__default.ZodPrefault<z__default.ZodBoolean>; }, z__default.core.$strip>, "output">, ZodObjectWithTelemetry<z__default.ZodObject<{ voiceDetection: z__default.ZodPrefault<z__default.ZodObject<{ scoreInThreshold: z__default.ZodPrefault<z__default.ZodNumber>; scoreOutThreshold: z__default.ZodPrefault<z__default.ZodNumber>; prePaddingChunks: z__default.ZodPrefault<z__default.ZodNumber>; postPaddingChunks: z__default.ZodPrefault<z__default.ZodNumber>; minVoiceInterruptionMs: z__default.ZodPrefault<z__default.ZodNumber>; }, z__default.core.$strip>>; endOfTurnDetection: z__default.ZodPrefault<z__default.ZodObject<{ threshold: z__default.ZodPrefault<z__default.ZodNumber>; minTimeoutMs: z__default.ZodPrefault<z__default.ZodNumber>; maxTimeoutMs: z__default.ZodPrefault<z__default.ZodNumber>; }, z__default.core.$strip>>; }, z__default.core.$strip>, "output">>>({ plugin }: PluginClientParams<{ readonly name: "generation"; readonly config: ZodObjectWithTelemetry<z__default.ZodObject<{ enableVoice: z__default.ZodPrefault<z__default.ZodBoolean>; }, z__default.core.$strip>, "output">; readonly dependencies: []; readonly class: <const _ProvidedConfigs>(..._args: Any[]) => { new (): {}; }; readonly atoms: <const _ProvidedConfigs>(..._args: Any[]) => never[]; readonly $serverDef: { name: "generation"; config: ZodObjectWithTelemetry<z__default.ZodObject<{ voiceDetection: z__default.ZodPrefault<z__default.ZodObject<{ scoreInThreshold: z__default.ZodPrefault<z__default.ZodNumber>; scoreOutThreshold: z__default.ZodPrefault<z__default.ZodNumber>; prePaddingChunks: z__default.ZodPrefault<z__default.ZodNumber>; postPaddingChunks: z__default.ZodPrefault<z__default.ZodNumber>; minVoiceInterruptionMs: z__default.ZodPrefault<z__default.ZodNumber>; }, z__default.core.$strip>>; endOfTurnDetection: z__default.ZodPrefault<z__default.ZodObject<{ threshold: z__default.ZodPrefault<z__default.ZodNumber>; minTimeoutMs: z__default.ZodPrefault<z__default.ZodNumber>; maxTimeoutMs: z__default.ZodPrefault<z__default.ZodNumber>; }, z__default.core.$strip>>; }, z__default.core.$strip>, "output">; context: ZodObjectWithTelemetry<z__default.ZodObject<{ messages: z__default.ZodPrefault<z__default.ZodArray<z__default.ZodDiscriminatedUnion<[z__default.ZodObject<{ role: z__default.ZodLiteral<"user">; content: z__default.ZodPrefault<z__default.ZodString>; id: z__default.ZodString; createdAt: z__default.ZodNumber; lastUpdated: z__default.ZodNumber; }, z__default.core.$strip>, z__default.ZodObject<{ role: z__default.ZodLiteral<"system">; content: z__default.ZodPrefault<z__default.ZodString>; id: z__default.ZodString; createdAt: z__default.ZodNumber; lastUpdated: z__default.ZodNumber; }, z__default.core.$strip>, z__default.ZodObject<{ role: z__default.ZodLiteral<"agent">; content: z__default.ZodPrefault<z__default.ZodString>; toolsRequests: z__default.ZodPrefault<z__default.ZodArray<z__default.ZodObject<{ toolRequestId: z__default.ZodString; toolName: z__default.ZodString; toolInput: z__default.ZodRecord<z__default.ZodString, z__default.ZodAny>; }, z__default.core.$strip>>>; id: z__default.ZodString; createdAt: z__default.ZodNumber; lastUpdated: z__default.ZodNumber; }, z__default.core.$strip>, z__default.ZodObject<{ role: z__default.ZodLiteral<"tool">; toolRequestId: z__default.ZodString; toolName: z__default.ZodString; toolSuccess: z__default.ZodBoolean; toolOutput: z__default.ZodOptional<z__default.ZodRecord<z__default.ZodString, z__default.ZodAny>>; toolError: z__default.ZodOptional<z__default.ZodString>; id: z__default.ZodString; createdAt: z__default.ZodNumber; lastUpdated: z__default.ZodNumber; }, z__default.core.$strip>], "role">>>; status: z__default.ZodPrefault<z__default.ZodObject<{ listening: z__default.ZodPrefault<z__default.ZodBoolean>; thinking: z__default.ZodPrefault<z__default.ZodBoolean>; speaking: z__default.ZodPrefault<z__default.ZodBoolean>; }, z__default.core.$strip>>; voiceEnabled: z__default.ZodPrefault<z__default.ZodBoolean>; }, z__default.core.$strip>, "output">; events: [{ 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>; }] | [{ name: "messages.create"; dataSchema: z__default.ZodObject<{ message: z__default.ZodDiscriminatedUnion<[z__default.ZodObject<{ role: z__default.ZodLiteral<"user">; content: z__default.ZodPrefault<z__default.ZodString>; }, z__default.core.$strip>, z__default.ZodObject<{ role: z__default.ZodLiteral<"system">; content: z__default.ZodPrefault<z__default.ZodString>; }, z__default.core.$strip>, z__default.ZodObject<{ role: z__default.ZodLiteral<"agent">; content: z__default.ZodPrefault<z__default.ZodString>; toolsRequests: z__default.ZodPrefault<z__default.ZodArray<z__default.ZodObject<{ toolRequestId: z__default.ZodString; toolName: z__default.ZodString; toolInput: z__default.ZodRecord<z__default.ZodString, z__default.ZodAny>; }, z__default.core.$strip>>>; }, z__default.core.$strip>, z__default.ZodObject<{ role: z__default.ZodLiteral<"tool">; toolRequestId: z__default.ZodString; toolName: z__default.ZodString; toolSuccess: z__default.ZodBoolean; toolOutput: z__default.ZodOptional<z__default.ZodRecord<z__default.ZodString, z__default.ZodAny>>; toolError: z__default.ZodOptional<z__default.ZodString>; }, z__default.core.$strip>], "role">; }, z__default.core.$strip>; }, { name: "messages.update"; dataSchema: z__default.ZodObject<{ id: z__default.ZodString; role: z__default.ZodEnum<{ user: "user"; system: "system"; agent: "agent"; tool: "tool"; }>; message: z__default.ZodDiscriminatedUnion<[z__default.ZodObject<{ role: z__default.ZodLiteral<"user">; content: z__default.ZodPrefault<z__default.ZodString>; }, z__default.core.$strip>, z__default.ZodObject<{ role: z__default.ZodLiteral<"system">; content: z__default.ZodPrefault<z__default.ZodString>; }, z__default.core.$strip>, z__default.ZodObject<{ role: z__default.ZodLiteral<"agent">; content: z__default.ZodPrefault<z__default.ZodString>; toolsRequests: z__default.ZodPrefault<z__default.ZodArray<z__default.ZodObject<{ toolRequestId: z__default.ZodString; toolName: z__default.ZodString; toolInput: z__default.ZodRecord<z__default.ZodString, z__default.ZodAny>; }, z__default.core.$strip>>>; }, z__default.core.$strip>, z__default.ZodObject<{ role: z__default.ZodLiteral<"tool">; toolRequestId: z__default.ZodString; toolName: z__default.ZodString; toolSuccess: z__default.ZodBoolean; toolOutput: z__default.ZodOptional<z__default.ZodRecord<z__default.ZodString, z__default.ZodAny>>; toolError: z__default.ZodOptional<z__default.ZodString>; }, z__default.core.$strip>], "role">; }, z__default.core.$strip>; }, { name: "user.audio-chunk"; dataSchema: z__default.ZodObject<{ audioChunk: z__default.ZodCustom<Int16Array<ArrayBufferLike>, Int16Array<ArrayBufferLike>>; }, z__default.core.$strip>; }, { name: "user.voice-start"; }, { name: "user.voice-chunk"; dataSchema: z__default.ZodDiscriminatedUnion<[z__default.ZodObject<{ type: z__default.ZodLiteral<"voice">; voiceChunk: z__default.ZodCustom<Int16Array<ArrayBufferLike>, Int16Array<ArrayBufferLike>>; }, z__default.core.$strip>, z__default.ZodObject<{ type: z__default.ZodLiteral<"padding">; voiceChunk: z__default.ZodCustom<Int16Array<ArrayBufferLike>, Int16Array<ArrayBufferLike>>; paddingSide: z__default.ZodEnum<{ pre: "pre"; post: "post"; }>; paddingIndex: z__default.ZodNumber; }, z__default.core.$strip>], "type">; }, { name: "user.voice-end"; }, { name: "user.text-chunk"; dataSchema: z__default.ZodObject<{ textChunk: z__default.ZodString; }, z__default.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__default.ZodObject<{ interrupt: z__default.ZodPrefault<z__default.ZodUnion<[z__default.ZodEnum<{ abrupt: "abrupt"; smooth: "smooth"; }>, z__default.ZodLiteral<false>]>>; preventInterruption: z__default.ZodPrefault<z__default.ZodBoolean>; }, z__default.core.$strip>; }, { name: "agent.decide"; dataSchema: z__default.ZodObject<{ interrupt: z__default.ZodPrefault<z__default.ZodUnion<[z__default.ZodEnum<{ abrupt: "abrupt"; smooth: "smooth"; }>, z__default.ZodLiteral<false>]>>; preventInterruption: z__default.ZodPrefault<z__default.ZodBoolean>; messages: z__default.ZodArray<z__default.ZodDiscriminatedUnion<[z__default.ZodObject<{ role: z__default.ZodLiteral<"user">; content: z__default.ZodPrefault<z__default.ZodString>; id: z__default.ZodString; createdAt: z__default.ZodNumber; lastUpdated: z__default.ZodNumber; }, z__default.core.$strip>, z__default.ZodObject<{ role: z__default.ZodLiteral<"system">; content: z__default.ZodPrefault<z__default.ZodString>; id: z__default.ZodString; createdAt: z__default.ZodNumber; lastUpdated: z__default.ZodNumber; }, z__default.core.$strip>, z__default.ZodObject<{ role: z__default.ZodLiteral<"agent">; content: z__default.ZodPrefault<z__default.ZodString>; toolsRequests: z__default.ZodPrefault<z__default.ZodArray<z__default.ZodObject<{ toolRequestId: z__default.ZodString; toolName: z__default.ZodString; toolInput: z__default.ZodRecord<z__default.ZodString, z__default.ZodAny>; }, z__default.core.$strip>>>; id: z__default.ZodString; createdAt: z__default.ZodNumber; lastUpdated: z__default.ZodNumber; }, z__default.core.$strip>, z__default.ZodObject<{ role: z__default.ZodLiteral<"tool">; toolRequestId: z__default.ZodString; toolName: z__default.ZodString; toolSuccess: z__default.ZodBoolean; toolOutput: z__default.ZodOptional<z__default.ZodRecord<z__default.ZodString, z__default.ZodAny>>; toolError: z__default.ZodOptional<z__default.ZodString>; id: z__default.ZodString; createdAt: z__default.ZodNumber; lastUpdated: z__default.ZodNumber; }, z__default.core.$strip>], "role">>; }, z__default.core.$strip>; }, { name: "agent.say"; dataSchema: z__default.ZodObject<{ interrupt: z__default.ZodPrefault<z__default.ZodUnion<[z__default.ZodEnum<{ abrupt: "abrupt"; smooth: "smooth"; }>, z__default.ZodLiteral<false>]>>; preventInterruption: z__default.ZodPrefault<z__default.ZodBoolean>; text: z__default.ZodString; }, z__default.core.$strip>; }, { name: "agent.interrupt"; dataSchema: z__default.ZodObject<{ reason: z__default.ZodString; author: z__default.ZodEnum<{ user: "user"; application: "application"; }>; force: z__default.ZodPrefault<z__default.ZodBoolean>; }, z__default.core.$strip>; }, { name: "agent.resources-request"; }, { name: "agent.resources-response"; dataSchema: z__default.ZodObject<{ requestId: z__default.ZodString; resources: z__default.ZodObject<{ messages: z__default.ZodArray<z__default.ZodDiscriminatedUnion<[z__default.ZodObject<{ role: z__default.ZodLiteral<"user">; content: z__default.ZodPrefault<z__default.ZodString>; id: z__default.ZodString; createdAt: z__default.ZodNumber; lastUpdated: z__default.ZodNumber; }, z__default.core.$strip>, z__default.ZodObject<{ role: z__default.ZodLiteral<"system">; content: z__default.ZodPrefault<z__default.ZodString>; id: z__default.ZodString; createdAt: z__default.ZodNumber; lastUpdated: z__default.ZodNumber; }, z__default.core.$strip>, z__default.ZodObject<{ role: z__default.ZodLiteral<"agent">; content: z__default.ZodPrefault<z__default.ZodString>; toolsRequests: z__default.ZodPrefault<z__default.ZodArray<z__default.ZodObject<{ toolRequestId: z__default.ZodString; toolName: z__default.ZodString; toolInput: z__default.ZodRecord<z__default.ZodString, z__default.ZodAny>; }, z__default.core.$strip>>>; id: z__default.ZodString; createdAt: z__default.ZodNumber; lastUpdated: z__default.ZodNumber; }, z__default.core.$strip>, z__default.ZodObject<{ role: z__default.ZodLiteral<"tool">; toolRequestId: z__default.ZodString; toolName: z__default.ZodString; toolSuccess: z__default.ZodBoolean; toolOutput: z__default.ZodOptional<z__default.ZodRecord<z__default.ZodString, z__default.ZodAny>>; toolError: z__default.ZodOptional<z__default.ZodString>; id: z__default.ZodString; createdAt: z__default.ZodNumber; lastUpdated: z__default.ZodNumber; }, z__default.core.$strip>], "role">>; tools: z__default.ZodArray<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>>; }, z__default.core.$strip>; }, z__default.core.$strip>; }, { name: "agent.tool-requests"; dataSchema: z__default.ZodObject<{ requests: z__default.ZodArray<z__default.ZodObject<{ toolRequestId: z__default.ZodString; toolName: z__default.ZodString; toolInput: z__default.ZodRecord<z__default.ZodString, z__default.ZodAny>; }, z__default.core.$strip>>; }, z__default.core.$strip>; }, { name: "agent.interrupted"; dataSchema: z__default.ZodObject<{ reason: z__default.ZodString; forced: z__default.ZodBoolean; author: z__default.ZodEnum<{ user: "user"; application: "application"; }>; }, z__default.core.$strip>; }, { name: "agent.text-chunk"; dataSchema: z__default.ZodObject<{ textChunk: z__default.ZodString; }, z__default.core.$strip>; }, { name: "agent.voice-chunk"; dataSchema: z__default.ZodObject<{ voiceChunk: z__default.ZodCustom<Int16Array<ArrayBufferLike>, Int16Array<ArrayBufferLike>>; }, z__default.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; }]; } & { dependencies: []; }; }, ProvidedConfigs>) => { new (): { continue(params: PluginEventDataInput<typeof generationPluginEventsDef, "agent.continue">): Promise<string>; decide(params: PluginEventDataInput<typeof generationPluginEventsDef, "agent.decide">): Promise<string>; say(params: PluginEventDataInput<typeof generationPluginEventsDef, "agent.say">): Promise<string>; interrupt(params: PluginEventDataInput<typeof generationPluginEventsDef, "agent.interrupt">): Promise<string>; messages: { create: (params: PluginEventDataInput<typeof generationPluginEventsDef, "messages.create">) => Promise<string>; update: (params: PluginEventDataInput<typeof generationPluginEventsDef, "messages.update">) => Promise<string>; get: () => ({ 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; })[]; }; }; }; readonly atoms: <const ProvidedConfigs extends PluginClientProvidedConfigs<ZodObjectWithTelemetry<z__default.ZodObject<{ enableVoice: z__default.ZodPrefault<z__default.ZodBoolean>; }, z__default.core.$strip>, "output">, ZodObjectWithTelemetry<z__default.ZodObject<{ voiceDetection: z__default.ZodPrefault<z__default.ZodObject<{ scoreInThreshold: z__default.ZodPrefault<z__default.ZodNumber>; scoreOutThreshold: z__default.ZodPrefault<z__default.ZodNumber>; prePaddingChunks: z__default.ZodPrefault<z__default.ZodNumber>; postPaddingChunks: z__default.ZodPrefault<z__default.ZodNumber>; minVoiceInterruptionMs: z__default.ZodPrefault<z__default.ZodNumber>; }, z__default.core.$strip>>; endOfTurnDetection: z__default.ZodPrefault<z__default.ZodObject<{ threshold: z__default.ZodPrefault<z__default.ZodNumber>; minTimeoutMs: z__default.ZodPrefault<z__default.ZodNumber>; maxTimeoutMs: z__default.ZodPrefault<z__default.ZodNumber>; }, z__default.core.$strip>>; }, z__default.core.$strip>, "output">>>({ plugin, telemetry }: PluginClientParams<{ readonly name: "generation"; readonly config: ZodObjectWithTelemetry<z__default.ZodObject<{ enableVoice: z__default.ZodPrefault<z__default.ZodBoolean>; }, z__default.core.$strip>, "output">; readonly dependencies: []; readonly class: <const ProvidedConfigs_1 extends PluginClientProvidedConfigs<ZodObjectWithTelemetry<z__default.ZodObject<{ enableVoice: z__default.ZodPrefault<z__default.ZodBoolean>; }, z__default.core.$strip>, "output">, ZodObjectWithTelemetry<z__default.ZodObject<{ voiceDetection: z__default.ZodPrefault<z__default.ZodObject<{ scoreInThreshold: z__default.ZodPrefault<z__default.ZodNumber>; scoreOutThreshold: z__default.ZodPrefault<z__default.ZodNumber>; prePaddingChunks: z__default.ZodPrefault<z__default.ZodNumber>; postPaddingChunks: z__default.ZodPrefault<z__default.ZodNumber>; minVoiceInterruptionMs: z__default.ZodPrefault<z__default.ZodNumber>; }, z__default.core.$strip>>; endOfTurnDetection: z__default.ZodPrefault<z__default.ZodObject<{ threshold: z__default.ZodPrefault<z__default.ZodNumber>; minTimeoutMs: z__default.ZodPrefault<z__default.ZodNumber>; maxTimeoutMs: z__default.ZodPrefault<z__default.ZodNumber>; }, z__default.core.$strip>>; }, z__default.core.$strip>, "output">>>({ plugin }: PluginClientParams<{ readonly name: "generation"; readonly config: ZodObjectWithTelemetry<z__default.ZodObject<{ enableVoice: z__default.ZodPrefault<z__default.ZodBoolean>; }, z__default.core.$strip>, "output">; readonly dependencies: []; readonly class: <const _ProvidedConfigs>(..._args: Any[]) => { new (): {}; }; readonly atoms: <const _ProvidedConfigs>(..._args: Any[]) => never[]; readonly $serverDef: { name: "generation"; config: ZodObjectWithTelemetry<z__default.ZodObject<{ voiceDetection: z__default.ZodPrefault<z__default.ZodObject<{ scoreInThreshold: z__default.ZodPrefault<z__default.ZodNumber>; scoreOutThreshold: z__default.ZodPrefault<z__default.ZodNumber>; prePaddingChunks: z__default.ZodPrefault<z__default.ZodNumber>; postPaddingChunks: z__default.ZodPrefault<z__default.ZodNumber>; minVoiceInterruptionMs: z__default.ZodPrefault<z__default.ZodNumber>; }, z__default.core.$strip>>; endOfTurnDetection: z__default.ZodPrefault<z__default.ZodObject<{ threshold: z__default.ZodPrefault<z__default.ZodNumber>; minTimeoutMs: z__default.ZodPrefault<z__default.ZodNumber>; maxTimeoutMs: z__default.ZodPrefault<z__default.ZodNumber>; }, z__default.core.$strip>>; }, z__default.core.$strip>, "output">; context: ZodObjectWithTelemetry<z__default.ZodObject<{ messages: z__default.ZodPrefault<z__default.ZodArray<z__default.ZodDiscriminatedUnion<[z__default.ZodObject<{ role: z__default.ZodLiteral<"user">; content: z__default.ZodPrefault<z__default.ZodString>; id: z__default.ZodString; createdAt: z__default.ZodNumber; lastUpdated: z__default.ZodNumber;