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.

1,074 lines (1,063 loc) 509 kB
import * as z from 'zod'; import z__default, { z as z$1 } from 'zod'; import { i as PluginConfig, j as PluginDefinition, O as OperationResult, k as TelemetryClient, L as LifeErrorUnion, T as ToPublic, l as TransportClientBase, a as Any, m as AgentScope, A as AgentDefinition, n as ToMethodName, W as Without, o as Override, p as Opaque, q as PluginConfigDefinition, r as AssertPublic, s as PluginAccessor, C as ClassShape, M as MemoryDefinition, c as Message, S as StoreDefinition } from './types-B6ejZKUB.js'; import * as nanostores from 'nanostores'; import { WritableAtom, ReadableAtom } from 'nanostores'; import * as LIFE_CLIENT_BUILD_PATH from 'LIFE_CLIENT_BUILD_PATH'; import { b as ZodUnionWithTelemetry, Z as ZodObjectWithTelemetry } from './config-n67P8tNt.js'; import * as zod_v4_core from 'zod/v4/core'; type ClientBuildType = Record<string, { definition: AgentClientDefinition; plugins: Record<string, { def: PluginClientDefinition; $types: { atoms: ReturnType<PluginClientAtomsDefinition>; class: ReturnType<PluginClientExtensionDefinition>; serverConfig: PluginConfig<PluginDefinition["config"], "output">; clientConfig: PluginClientConfig<PluginClientDefinition["config"], "output">; }; }>; }>; type Mode = "LIFE_BUILD_MODE"; type ActualClientBuild = typeof LIFE_CLIENT_BUILD_PATH; declare const defaultBuild: { readonly "Run `life dev` to see your agents here.": ClientBuildType[string]; }; type ClientBuild = Mode extends "production" ? Awaited<ActualClientBuild>["default"] extends never ? Awaited<ActualClientBuild> : Awaited<ActualClientBuild>["default"] : typeof defaultBuild; declare function importClientBuild(): Promise<OperationResult<ClientBuild>>; declare const definition: { readonly "telemetry.send-signal": { readonly type: "cast"; readonly protected: false; readonly inputDataSchema: z__default.ZodObject<{ signal: z__default.ZodDiscriminatedUnion<[z__default.ZodObject<{ id: z__default.ZodString; scope: z__default.ZodString; resource: z__default.ZodIntersection<z__default.ZodObject<{ environment: z__default.ZodEnum<{ development: "development"; production: "production"; test: "test"; staging: "staging"; }>; lifeVersion: z__default.ZodString; }, z__default.core.$strip>, z__default.ZodDiscriminatedUnion<[z__default.ZodObject<{ platform: z__default.ZodLiteral<"node">; isCi: z__default.ZodBoolean; nodeVersion: z__default.ZodString; osName: z__default.ZodString; osVersion: z__default.ZodString; cpuCount: z__default.ZodNumber; cpuArchitecture: z__default.ZodString; schemaVersion: z__default.ZodPrefault<z__default.ZodString>; }, z__default.core.$strip>, z__default.ZodObject<{ platform: z__default.ZodLiteral<"browser">; deviceType: z__default.ZodEnum<{ unknown: "unknown"; desktop: "desktop"; mobile: "mobile"; tablet: "tablet"; wearable: "wearable"; smarttv: "smarttv"; console: "console"; xr: "xr"; embedded: "embedded"; }>; deviceBrand: z__default.ZodString; deviceModel: z__default.ZodString; osName: z__default.ZodString; osVersion: z__default.ZodString; cpuArchitecture: z__default.ZodOptional<z__default.ZodEnum<{ unknown: "unknown"; ia32: "ia32"; ia64: "ia64"; amd64: "amd64"; arm: "arm"; arm64: "arm64"; armhf: "armhf"; avr: "avr"; avr32: "avr32"; irix: "irix"; irix64: "irix64"; mips: "mips"; mips64: "mips64"; "68k": "68k"; "pa-risc": "pa-risc"; ppc: "ppc"; sparc: "sparc"; sparc64: "sparc64"; alpha: "alpha"; }>>; browserUserAgent: z__default.ZodString; browserName: z__default.ZodString; browserVersion: z__default.ZodString; browserEngine: z__default.ZodEnum<{ unknown: "unknown"; Amaya: "Amaya"; ArkWeb: "ArkWeb"; Blink: "Blink"; EdgeHTML: "EdgeHTML"; Flow: "Flow"; Gecko: "Gecko"; Goanna: "Goanna"; iCab: "iCab"; KHTML: "KHTML"; LibWeb: "LibWeb"; Links: "Links"; Lynx: "Lynx"; NetFront: "NetFront"; NetSurf: "NetSurf"; Presto: "Presto"; Servo: "Servo"; Tasman: "Tasman"; Trident: "Trident"; w3m: "w3m"; WebKit: "WebKit"; }>; isBot: z__default.ZodBoolean; isAiBot: z__default.ZodBoolean; schemaVersion: z__default.ZodPrefault<z__default.ZodString>; }, z__default.core.$strip>], "platform">>; attributes: z__default.ZodOptional<z__default.ZodRecord<z__default.ZodString, z__default.ZodUnknown>>; level: z__default.ZodEnum<{ error: "error"; debug: "debug"; info: "info"; warn: "warn"; fatal: "fatal"; }>; message: z__default.ZodString; messageUnstyled: z__default.ZodString; timestamp: z__default.ZodBigInt; stack: z__default.ZodString; traceId: z__default.ZodOptional<z__default.ZodString>; spanId: z__default.ZodOptional<z__default.ZodString>; error: z__default.ZodOptional<z__default.ZodCustom<Error, Error>>; type: z__default.ZodLiteral<"log">; }, z__default.core.$strip>, z__default.ZodObject<{ id: z__default.ZodString; scope: z__default.ZodString; resource: z__default.ZodIntersection<z__default.ZodObject<{ environment: z__default.ZodEnum<{ development: "development"; production: "production"; test: "test"; staging: "staging"; }>; lifeVersion: z__default.ZodString; }, z__default.core.$strip>, z__default.ZodDiscriminatedUnion<[z__default.ZodObject<{ platform: z__default.ZodLiteral<"node">; isCi: z__default.ZodBoolean; nodeVersion: z__default.ZodString; osName: z__default.ZodString; osVersion: z__default.ZodString; cpuCount: z__default.ZodNumber; cpuArchitecture: z__default.ZodString; schemaVersion: z__default.ZodPrefault<z__default.ZodString>; }, z__default.core.$strip>, z__default.ZodObject<{ platform: z__default.ZodLiteral<"browser">; deviceType: z__default.ZodEnum<{ unknown: "unknown"; desktop: "desktop"; mobile: "mobile"; tablet: "tablet"; wearable: "wearable"; smarttv: "smarttv"; console: "console"; xr: "xr"; embedded: "embedded"; }>; deviceBrand: z__default.ZodString; deviceModel: z__default.ZodString; osName: z__default.ZodString; osVersion: z__default.ZodString; cpuArchitecture: z__default.ZodOptional<z__default.ZodEnum<{ unknown: "unknown"; ia32: "ia32"; ia64: "ia64"; amd64: "amd64"; arm: "arm"; arm64: "arm64"; armhf: "armhf"; avr: "avr"; avr32: "avr32"; irix: "irix"; irix64: "irix64"; mips: "mips"; mips64: "mips64"; "68k": "68k"; "pa-risc": "pa-risc"; ppc: "ppc"; sparc: "sparc"; sparc64: "sparc64"; alpha: "alpha"; }>>; browserUserAgent: z__default.ZodString; browserName: z__default.ZodString; browserVersion: z__default.ZodString; browserEngine: z__default.ZodEnum<{ unknown: "unknown"; Amaya: "Amaya"; ArkWeb: "ArkWeb"; Blink: "Blink"; EdgeHTML: "EdgeHTML"; Flow: "Flow"; Gecko: "Gecko"; Goanna: "Goanna"; iCab: "iCab"; KHTML: "KHTML"; LibWeb: "LibWeb"; Links: "Links"; Lynx: "Lynx"; NetFront: "NetFront"; NetSurf: "NetSurf"; Presto: "Presto"; Servo: "Servo"; Tasman: "Tasman"; Trident: "Trident"; w3m: "w3m"; WebKit: "WebKit"; }>; isBot: z__default.ZodBoolean; isAiBot: z__default.ZodBoolean; schemaVersion: z__default.ZodPrefault<z__default.ZodString>; }, z__default.core.$strip>], "platform">>; attributes: z__default.ZodOptional<z__default.ZodRecord<z__default.ZodString, z__default.ZodUnknown>>; name: z__default.ZodString; startTimestamp: z__default.ZodBigInt; endTimestamp: z__default.ZodBigInt; duration: z__default.ZodBigInt; traceId: z__default.ZodString; parentSpanId: z__default.ZodOptional<z__default.ZodString>; logs: z__default.ZodArray<z__default.ZodObject<{ message: z__default.ZodString; error: z__default.ZodOptional<z__default.ZodCustom<Error, Error>>; attributes: z__default.ZodOptional<z__default.ZodRecord<z__default.ZodString, z__default.ZodUnknown>>; id: z__default.ZodString; stack: z__default.ZodString; level: z__default.ZodEnum<{ error: "error"; debug: "debug"; info: "info"; warn: "warn"; fatal: "fatal"; }>; messageUnstyled: z__default.ZodString; timestamp: z__default.ZodBigInt; }, z__default.core.$strip>>; type: z__default.ZodLiteral<"span">; }, z__default.core.$strip>, z__default.ZodObject<{ id: z__default.ZodString; scope: z__default.ZodString; resource: z__default.ZodIntersection<z__default.ZodObject<{ environment: z__default.ZodEnum<{ development: "development"; production: "production"; test: "test"; staging: "staging"; }>; lifeVersion: z__default.ZodString; }, z__default.core.$strip>, z__default.ZodDiscriminatedUnion<[z__default.ZodObject<{ platform: z__default.ZodLiteral<"node">; isCi: z__default.ZodBoolean; nodeVersion: z__default.ZodString; osName: z__default.ZodString; osVersion: z__default.ZodString; cpuCount: z__default.ZodNumber; cpuArchitecture: z__default.ZodString; schemaVersion: z__default.ZodPrefault<z__default.ZodString>; }, z__default.core.$strip>, z__default.ZodObject<{ platform: z__default.ZodLiteral<"browser">; deviceType: z__default.ZodEnum<{ unknown: "unknown"; desktop: "desktop"; mobile: "mobile"; tablet: "tablet"; wearable: "wearable"; smarttv: "smarttv"; console: "console"; xr: "xr"; embedded: "embedded"; }>; deviceBrand: z__default.ZodString; deviceModel: z__default.ZodString; osName: z__default.ZodString; osVersion: z__default.ZodString; cpuArchitecture: z__default.ZodOptional<z__default.ZodEnum<{ unknown: "unknown"; ia32: "ia32"; ia64: "ia64"; amd64: "amd64"; arm: "arm"; arm64: "arm64"; armhf: "armhf"; avr: "avr"; avr32: "avr32"; irix: "irix"; irix64: "irix64"; mips: "mips"; mips64: "mips64"; "68k": "68k"; "pa-risc": "pa-risc"; ppc: "ppc"; sparc: "sparc"; sparc64: "sparc64"; alpha: "alpha"; }>>; browserUserAgent: z__default.ZodString; browserName: z__default.ZodString; browserVersion: z__default.ZodString; browserEngine: z__default.ZodEnum<{ unknown: "unknown"; Amaya: "Amaya"; ArkWeb: "ArkWeb"; Blink: "Blink"; EdgeHTML: "EdgeHTML"; Flow: "Flow"; Gecko: "Gecko"; Goanna: "Goanna"; iCab: "iCab"; KHTML: "KHTML"; LibWeb: "LibWeb"; Links: "Links"; Lynx: "Lynx"; NetFront: "NetFront"; NetSurf: "NetSurf"; Presto: "Presto"; Servo: "Servo"; Tasman: "Tasman"; Trident: "Trident"; w3m: "w3m"; WebKit: "WebKit"; }>; isBot: z__default.ZodBoolean; isAiBot: z__default.ZodBoolean; schemaVersion: z__default.ZodPrefault<z__default.ZodString>; }, z__default.core.$strip>], "platform">>; attributes: z__default.ZodOptional<z__default.ZodRecord<z__default.ZodString, z__default.ZodUnknown>>; kind: z__default.ZodEnum<{ counter: "counter"; updown: "updown"; histogram: "histogram"; }>; name: z__default.ZodString; value: z__default.ZodUnion<[z__default.ZodNumber, z__default.ZodBigInt]>; type: z__default.ZodLiteral<"metric">; }, z__default.core.$strip>], "type">; }, z__default.core.$strip>; }; readonly "telemetry.signals-stream": { readonly type: "stream"; readonly protected: true; readonly outputDataSchema: z__default.ZodDiscriminatedUnion<[z__default.ZodObject<{ id: z__default.ZodString; scope: z__default.ZodString; resource: z__default.ZodIntersection<z__default.ZodObject<{ environment: z__default.ZodEnum<{ development: "development"; production: "production"; test: "test"; staging: "staging"; }>; lifeVersion: z__default.ZodString; }, z__default.core.$strip>, z__default.ZodDiscriminatedUnion<[z__default.ZodObject<{ platform: z__default.ZodLiteral<"node">; isCi: z__default.ZodBoolean; nodeVersion: z__default.ZodString; osName: z__default.ZodString; osVersion: z__default.ZodString; cpuCount: z__default.ZodNumber; cpuArchitecture: z__default.ZodString; schemaVersion: z__default.ZodPrefault<z__default.ZodString>; }, z__default.core.$strip>, z__default.ZodObject<{ platform: z__default.ZodLiteral<"browser">; deviceType: z__default.ZodEnum<{ unknown: "unknown"; desktop: "desktop"; mobile: "mobile"; tablet: "tablet"; wearable: "wearable"; smarttv: "smarttv"; console: "console"; xr: "xr"; embedded: "embedded"; }>; deviceBrand: z__default.ZodString; deviceModel: z__default.ZodString; osName: z__default.ZodString; osVersion: z__default.ZodString; cpuArchitecture: z__default.ZodOptional<z__default.ZodEnum<{ unknown: "unknown"; ia32: "ia32"; ia64: "ia64"; amd64: "amd64"; arm: "arm"; arm64: "arm64"; armhf: "armhf"; avr: "avr"; avr32: "avr32"; irix: "irix"; irix64: "irix64"; mips: "mips"; mips64: "mips64"; "68k": "68k"; "pa-risc": "pa-risc"; ppc: "ppc"; sparc: "sparc"; sparc64: "sparc64"; alpha: "alpha"; }>>; browserUserAgent: z__default.ZodString; browserName: z__default.ZodString; browserVersion: z__default.ZodString; browserEngine: z__default.ZodEnum<{ unknown: "unknown"; Amaya: "Amaya"; ArkWeb: "ArkWeb"; Blink: "Blink"; EdgeHTML: "EdgeHTML"; Flow: "Flow"; Gecko: "Gecko"; Goanna: "Goanna"; iCab: "iCab"; KHTML: "KHTML"; LibWeb: "LibWeb"; Links: "Links"; Lynx: "Lynx"; NetFront: "NetFront"; NetSurf: "NetSurf"; Presto: "Presto"; Servo: "Servo"; Tasman: "Tasman"; Trident: "Trident"; w3m: "w3m"; WebKit: "WebKit"; }>; isBot: z__default.ZodBoolean; isAiBot: z__default.ZodBoolean; schemaVersion: z__default.ZodPrefault<z__default.ZodString>; }, z__default.core.$strip>], "platform">>; attributes: z__default.ZodOptional<z__default.ZodRecord<z__default.ZodString, z__default.ZodUnknown>>; level: z__default.ZodEnum<{ error: "error"; debug: "debug"; info: "info"; warn: "warn"; fatal: "fatal"; }>; message: z__default.ZodString; messageUnstyled: z__default.ZodString; timestamp: z__default.ZodBigInt; stack: z__default.ZodString; traceId: z__default.ZodOptional<z__default.ZodString>; spanId: z__default.ZodOptional<z__default.ZodString>; error: z__default.ZodOptional<z__default.ZodCustom<Error, Error>>; type: z__default.ZodLiteral<"log">; }, z__default.core.$strip>, z__default.ZodObject<{ id: z__default.ZodString; scope: z__default.ZodString; resource: z__default.ZodIntersection<z__default.ZodObject<{ environment: z__default.ZodEnum<{ development: "development"; production: "production"; test: "test"; staging: "staging"; }>; lifeVersion: z__default.ZodString; }, z__default.core.$strip>, z__default.ZodDiscriminatedUnion<[z__default.ZodObject<{ platform: z__default.ZodLiteral<"node">; isCi: z__default.ZodBoolean; nodeVersion: z__default.ZodString; osName: z__default.ZodString; osVersion: z__default.ZodString; cpuCount: z__default.ZodNumber; cpuArchitecture: z__default.ZodString; schemaVersion: z__default.ZodPrefault<z__default.ZodString>; }, z__default.core.$strip>, z__default.ZodObject<{ platform: z__default.ZodLiteral<"browser">; deviceType: z__default.ZodEnum<{ unknown: "unknown"; desktop: "desktop"; mobile: "mobile"; tablet: "tablet"; wearable: "wearable"; smarttv: "smarttv"; console: "console"; xr: "xr"; embedded: "embedded"; }>; deviceBrand: z__default.ZodString; deviceModel: z__default.ZodString; osName: z__default.ZodString; osVersion: z__default.ZodString; cpuArchitecture: z__default.ZodOptional<z__default.ZodEnum<{ unknown: "unknown"; ia32: "ia32"; ia64: "ia64"; amd64: "amd64"; arm: "arm"; arm64: "arm64"; armhf: "armhf"; avr: "avr"; avr32: "avr32"; irix: "irix"; irix64: "irix64"; mips: "mips"; mips64: "mips64"; "68k": "68k"; "pa-risc": "pa-risc"; ppc: "ppc"; sparc: "sparc"; sparc64: "sparc64"; alpha: "alpha"; }>>; browserUserAgent: z__default.ZodString; browserName: z__default.ZodString; browserVersion: z__default.ZodString; browserEngine: z__default.ZodEnum<{ unknown: "unknown"; Amaya: "Amaya"; ArkWeb: "ArkWeb"; Blink: "Blink"; EdgeHTML: "EdgeHTML"; Flow: "Flow"; Gecko: "Gecko"; Goanna: "Goanna"; iCab: "iCab"; KHTML: "KHTML"; LibWeb: "LibWeb"; Links: "Links"; Lynx: "Lynx"; NetFront: "NetFront"; NetSurf: "NetSurf"; Presto: "Presto"; Servo: "Servo"; Tasman: "Tasman"; Trident: "Trident"; w3m: "w3m"; WebKit: "WebKit"; }>; isBot: z__default.ZodBoolean; isAiBot: z__default.ZodBoolean; schemaVersion: z__default.ZodPrefault<z__default.ZodString>; }, z__default.core.$strip>], "platform">>; attributes: z__default.ZodOptional<z__default.ZodRecord<z__default.ZodString, z__default.ZodUnknown>>; name: z__default.ZodString; startTimestamp: z__default.ZodBigInt; endTimestamp: z__default.ZodBigInt; duration: z__default.ZodBigInt; traceId: z__default.ZodString; parentSpanId: z__default.ZodOptional<z__default.ZodString>; logs: z__default.ZodArray<z__default.ZodObject<{ message: z__default.ZodString; error: z__default.ZodOptional<z__default.ZodCustom<Error, Error>>; attributes: z__default.ZodOptional<z__default.ZodRecord<z__default.ZodString, z__default.ZodUnknown>>; id: z__default.ZodString; stack: z__default.ZodString; level: z__default.ZodEnum<{ error: "error"; debug: "debug"; info: "info"; warn: "warn"; fatal: "fatal"; }>; messageUnstyled: z__default.ZodString; timestamp: z__default.ZodBigInt; }, z__default.core.$strip>>; type: z__default.ZodLiteral<"span">; }, z__default.core.$strip>, z__default.ZodObject<{ id: z__default.ZodString; scope: z__default.ZodString; resource: z__default.ZodIntersection<z__default.ZodObject<{ environment: z__default.ZodEnum<{ development: "development"; production: "production"; test: "test"; staging: "staging"; }>; lifeVersion: z__default.ZodString; }, z__default.core.$strip>, z__default.ZodDiscriminatedUnion<[z__default.ZodObject<{ platform: z__default.ZodLiteral<"node">; isCi: z__default.ZodBoolean; nodeVersion: z__default.ZodString; osName: z__default.ZodString; osVersion: z__default.ZodString; cpuCount: z__default.ZodNumber; cpuArchitecture: z__default.ZodString; schemaVersion: z__default.ZodPrefault<z__default.ZodString>; }, z__default.core.$strip>, z__default.ZodObject<{ platform: z__default.ZodLiteral<"browser">; deviceType: z__default.ZodEnum<{ unknown: "unknown"; desktop: "desktop"; mobile: "mobile"; tablet: "tablet"; wearable: "wearable"; smarttv: "smarttv"; console: "console"; xr: "xr"; embedded: "embedded"; }>; deviceBrand: z__default.ZodString; deviceModel: z__default.ZodString; osName: z__default.ZodString; osVersion: z__default.ZodString; cpuArchitecture: z__default.ZodOptional<z__default.ZodEnum<{ unknown: "unknown"; ia32: "ia32"; ia64: "ia64"; amd64: "amd64"; arm: "arm"; arm64: "arm64"; armhf: "armhf"; avr: "avr"; avr32: "avr32"; irix: "irix"; irix64: "irix64"; mips: "mips"; mips64: "mips64"; "68k": "68k"; "pa-risc": "pa-risc"; ppc: "ppc"; sparc: "sparc"; sparc64: "sparc64"; alpha: "alpha"; }>>; browserUserAgent: z__default.ZodString; browserName: z__default.ZodString; browserVersion: z__default.ZodString; browserEngine: z__default.ZodEnum<{ unknown: "unknown"; Amaya: "Amaya"; ArkWeb: "ArkWeb"; Blink: "Blink"; EdgeHTML: "EdgeHTML"; Flow: "Flow"; Gecko: "Gecko"; Goanna: "Goanna"; iCab: "iCab"; KHTML: "KHTML"; LibWeb: "LibWeb"; Links: "Links"; Lynx: "Lynx"; NetFront: "NetFront"; NetSurf: "NetSurf"; Presto: "Presto"; Servo: "Servo"; Tasman: "Tasman"; Trident: "Trident"; w3m: "w3m"; WebKit: "WebKit"; }>; isBot: z__default.ZodBoolean; isAiBot: z__default.ZodBoolean; schemaVersion: z__default.ZodPrefault<z__default.ZodString>; }, z__default.core.$strip>], "platform">>; attributes: z__default.ZodOptional<z__default.ZodRecord<z__default.ZodString, z__default.ZodUnknown>>; kind: z__default.ZodEnum<{ counter: "counter"; updown: "updown"; histogram: "histogram"; }>; name: z__default.ZodString; value: z__default.ZodUnion<[z__default.ZodNumber, z__default.ZodBigInt]>; type: z__default.ZodLiteral<"metric">; }, z__default.core.$strip>], "type">; }; readonly "agent.create": { readonly type: "call"; readonly protected: false; readonly inputDataSchema: z__default.ZodObject<{ id: z__default.ZodOptional<z__default.ZodString>; name: z__default.ZodString; }, z__default.core.$strip>; readonly outputDataSchema: z__default.ZodObject<{ id: z__default.ZodString; clientConfig: z__default.ZodObject<{ transport: z__default.ZodPrefault<z__default.ZodDiscriminatedUnion<z__default.ZodObject<{ provider: z__default.ZodLiteral<"livekit">; serverUrl: z__default.ZodPrefault<z__default.ZodURL>; }, z__default.core.$strip>[], "provider">>; experimental: z__default.ZodPrefault<z__default.ZodObject<{}, z__default.core.$strip>>; }, z__default.core.$strip>; }, z__default.core.$strip>; }; readonly "agent.start": { readonly type: "call"; readonly protected: false; readonly inputDataSchema: z__default.ZodObject<{ id: z__default.ZodString; scope: z__default.ZodRecord<z__default.ZodString, z__default.ZodUnknown>; }, z__default.core.$strip>; readonly outputDataSchema: z__default.ZodObject<{ sessionToken: z__default.ZodString; transportRoom: z__default.ZodObject<{ name: z__default.ZodString; token: z__default.ZodString; }, z__default.core.$strip>; }, z__default.core.$strip>; }; readonly "agent.stop": { readonly type: "call"; readonly protected: false; readonly inputDataSchema: z__default.ZodObject<{ id: z__default.ZodString; sessionToken: z__default.ZodString; }, z__default.core.$strip>; readonly timeoutMs: 30000; }; readonly "agent.ping": { readonly type: "call"; readonly protected: false; readonly inputDataSchema: z__default.ZodObject<{ id: z__default.ZodString; sessionToken: z__default.ZodString; }, z__default.core.$strip>; readonly outputDataSchema: z__default.ZodLiteral<"pong">; }; readonly "agent.info": { readonly type: "call"; readonly protected: false; readonly inputDataSchema: z__default.ZodObject<{ id: z__default.ZodString; sessionToken: z__default.ZodString; }, z__default.core.$strip>; readonly outputDataSchema: z__default.ZodObject<{ id: z__default.ZodString; name: z__default.ZodString; scope: z__default.ZodNullable<z__default.ZodRecord<z__default.ZodString, z__default.ZodUnknown>>; status: z__default.ZodEnum<{ stopped: "stopped"; stopping: "stopping"; starting: "starting"; running: "running"; }>; lastStartedAt: z__default.ZodOptional<z__default.ZodNumber>; lastSeenAt: z__default.ZodOptional<z__default.ZodNumber>; restartCount: z__default.ZodNumber; cpu: z__default.ZodObject<{ usedPercent: z__default.ZodNumber; usedNs: z__default.ZodNumber; }, z__default.core.$strip>; memory: z__default.ZodObject<{ usedPercent: z__default.ZodNumber; totalBytes: z__default.ZodNumber; freeBytes: z__default.ZodNumber; usedBytes: z__default.ZodNumber; }, z__default.core.$strip>; }, z__default.core.$strip>; }; readonly "agent.info-stream": { readonly type: "stream"; readonly protected: false; readonly inputDataSchema: z__default.ZodObject<{ id: z__default.ZodString; sessionToken: z__default.ZodString; pollingIntervalMs: z__default.ZodPrefault<z__default.ZodNumber>; }, z__default.core.$strip>; readonly outputDataSchema: z__default.ZodObject<{ id: z__default.ZodString; name: z__default.ZodString; scope: z__default.ZodNullable<z__default.ZodRecord<z__default.ZodString, z__default.ZodUnknown>>; status: z__default.ZodString; lastStartedAt: z__default.ZodOptional<z__default.ZodNumber>; lastSeenAt: z__default.ZodOptional<z__default.ZodNumber>; restartCount: z__default.ZodNumber; cpu: z__default.ZodObject<{ usedPercent: z__default.ZodNumber; usedNs: z__default.ZodNumber; }, z__default.core.$strip>; memory: z__default.ZodObject<{ usedPercent: z__default.ZodNumber; totalBytes: z__default.ZodNumber; freeBytes: z__default.ZodNumber; usedBytes: z__default.ZodNumber; }, z__default.core.$strip>; }, z__default.core.$strip>; }; readonly "server.ping": { readonly type: "call"; readonly protected: true; readonly outputDataSchema: z__default.ZodLiteral<"pong">; }; readonly "server.available": { readonly type: "call"; readonly protected: true; readonly outputDataSchema: z__default.ZodArray<z__default.ZodObject<{ name: z__default.ZodString; scopeKeys: z__default.ZodArray<z__default.ZodString>; }, z__default.core.$strip>>; }; readonly "server.info": { readonly type: "call"; readonly protected: true; readonly outputDataSchema: z__default.ZodObject<{ lifeVersion: z__default.ZodString; nodeVersion: z__default.ZodString; startedAt: z__default.ZodNumber; cpu: z__default.ZodObject<{ usedPercent: z__default.ZodNumber; usedNs: z__default.ZodNumber; }, z__default.core.$strip>; memory: z__default.ZodObject<{ usedPercent: z__default.ZodNumber; totalBytes: z__default.ZodNumber; freeBytes: z__default.ZodNumber; usedBytes: z__default.ZodNumber; }, z__default.core.$strip>; }, z__default.core.$strip>; }; readonly "server.info-stream": { readonly type: "stream"; readonly protected: true; readonly inputDataSchema: z__default.ZodObject<{ pollingIntervalMs: z__default.ZodPrefault<z__default.ZodNumber>; }, z__default.core.$strip>; readonly outputDataSchema: z__default.ZodObject<{ lifeVersion: z__default.ZodString; nodeVersion: z__default.ZodString; startedAt: z__default.ZodNumber; cpu: z__default.ZodObject<{ usedPercent: z__default.ZodNumber; usedNs: z__default.ZodNumber; }, z__default.core.$strip>; memory: z__default.ZodObject<{ usedPercent: z__default.ZodNumber; totalBytes: z__default.ZodNumber; freeBytes: z__default.ZodNumber; usedBytes: z__default.ZodNumber; }, z__default.core.$strip>; }, z__default.core.$strip>; }; readonly "server.processes": { readonly type: "call"; readonly protected: true; readonly outputDataSchema: z__default.ZodArray<z__default.ZodObject<{ id: z__default.ZodString; name: z__default.ZodString; status: z__default.ZodString; lastStartedAt: z__default.ZodOptional<z__default.ZodNumber>; }, z__default.core.$strip>>; }; readonly "server.processes-stream": { readonly type: "stream"; readonly protected: true; readonly inputDataSchema: z__default.ZodObject<{ pollingIntervalMs: z__default.ZodPrefault<z__default.ZodNumber>; }, z__default.core.$strip>; readonly outputDataSchema: z__default.ZodArray<z__default.ZodObject<{ id: z__default.ZodString; name: z__default.ZodString; status: z__default.ZodString; lastStartedAt: z__default.ZodOptional<z__default.ZodNumber>; }, z__default.core.$strip>>; }; }; type LifeApiCallDefinition = { type: "call"; protected: boolean; inputDataSchema?: z__default.ZodType; outputDataSchema?: z__default.ZodType; timeoutMs?: number; }; type LifeApiCastDefinition = { type: "cast"; protected: boolean; inputDataSchema?: z__default.ZodType; outputDataSchema?: never; timeoutMs?: number; }; type LifeApiStreamDefinition = { type: "stream"; protected: boolean; inputDataSchema?: z__default.ZodType; outputDataSchema?: z__default.ZodType; timeoutMs?: number; }; type LifeApiHandlerDefinition = LifeApiCallDefinition | LifeApiCastDefinition | LifeApiStreamDefinition; type LifeApiDefinition = Record<string, LifeApiHandlerDefinition>; type InferInput<T> = T extends { inputDataSchema: z__default.ZodType; } ? z__default.input<T["inputDataSchema"]> : undefined; type InferOutput<T> = T extends { outputDataSchema: z__default.ZodType; } ? z__default.output<T["outputDataSchema"]> : undefined; type CallHandlers<T extends LifeApiDefinition> = { [K in keyof T as T[K] extends LifeApiCallDefinition ? K : never]: T[K]; }; type CastHandlers<T extends LifeApiDefinition> = { [K in keyof T as T[K] extends LifeApiCastDefinition ? K : never]: T[K]; }; type StreamHandlers<T extends LifeApiDefinition> = { [K in keyof T as T[K] extends LifeApiStreamDefinition ? K : never]: T[K]; }; type UnsubscribeFunction = () => void; declare class LifeServerApiClient<Def extends LifeApiDefinition = typeof definition> { #private; constructor(params: { telemetry: TelemetryClient; serverUrl: string; serverToken?: string; }); private ensureWebSocket; call<K extends keyof CallHandlers<Def>>(handlerId: K, input?: InferInput<Def[K]>): Promise<readonly [error: LifeErrorUnion, data: undefined] | readonly [error: undefined, data: InferOutput<Def[K]>]>; cast<K extends keyof CastHandlers<Def>>(handlerId: K, input?: InferInput<Def[K]>): Promise<OperationResult<void>>; subscribe<K extends keyof StreamHandlers<Def>>(handlerId: K, callback: (data: InferOutput<Def[K]>) => void, input?: InferInput<Def[K]>): OperationResult<UnsubscribeFunction>; disconnect(): void; } declare const lifeClientOptionsSchema: z__default.ZodObject<{ serverUrl: z__default.ZodPrefault<z__default.ZodString>; serverToken: z__default.ZodOptional<z__default.ZodString>; }, z__default.core.$strip>; type LifeClientOptions = z__default.output<typeof lifeClientOptionsSchema>; declare class LifeClient { #private; readonly options: LifeClientOptions; api: LifeServerApiClient; constructor(options: LifeClientOptions); /** * Create a new agent instance on the server * @param name - Agent name/type to create * @param scope - Agent scope configuration * @returns AgentClient instance if creation successful */ createAgent<Name extends keyof ClientBuild>(name: Name, options?: { id?: string; }): Promise<readonly [error: LifeErrorUnion, data: undefined] | readonly [error: undefined, data: ToPublic<AgentClient<{ readonly "Run `life dev` to see your agents here.": ClientBuildType[string]; }[Name]["definition"]> & { [PluginName in keyof { readonly "Run `life dev` to see your agents here.": ClientBuildType[string]; }[Name]["plugins"]]: ((((PluginClientAccessor<{ readonly "Run `life dev` to see your agents here.": ClientBuildType[string]; }[Name]["plugins"][PluginName]["def"], { client: { readonly "Run `life dev` to see your agents here.": ClientBuildType[string]; }[Name]["plugins"][PluginName]["$types"]["clientConfig"]; server: { readonly "Run `life dev` to see your agents here.": ClientBuildType[string]; }[Name]["plugins"][PluginName]["$types"]["serverConfig"]; }> extends infer T_3 extends object ? { [I_1 in keyof T_3]: I_1 extends K_2 ? V : T_3[I_1]; } : never) extends infer T_2 ? { [K_1 in keyof T_2]: T_2[K_1]; } : never) extends infer T_1 extends object ? { [I in keyof T_1 as I extends keyof InstanceType<{ readonly "Run `life dev` to see your agents here.": ClientBuildType[string]; }[Name]["plugins"][PluginName]["$types"]["class"]> ? never : I]: T_1[I]; } : never) extends infer T ? { [K in keyof T]: T[K]; } : never) & InstanceType<{ readonly "Run `life dev` to see your agents here.": ClientBuildType[string]; }[Name]["plugins"][PluginName]["$types"]["class"]>; }>]>; /** * Get an existing agent client instance * @param id - Agent ID * @returns AgentClient instance or undefined */ getAgent<Name extends keyof ClientBuild>(name: Name, options?: { id?: string; }): readonly [error: LifeErrorUnion, data: undefined] | readonly [error: undefined, data: ToPublic<AgentClient<{ readonly "Run `life dev` to see your agents here.": ClientBuildType[string]; }[Name]["definition"]> & { [PluginName in keyof { readonly "Run `life dev` to see your agents here.": ClientBuildType[string]; }[Name]["plugins"]]: ((((PluginClientAccessor<{ readonly "Run `life dev` to see your agents here.": ClientBuildType[string]; }[Name]["plugins"][PluginName]["def"], { client: { readonly "Run `life dev` to see your agents here.": ClientBuildType[string]; }[Name]["plugins"][PluginName]["$types"]["clientConfig"]; server: { readonly "Run `life dev` to see your agents here.": ClientBuildType[string]; }[Name]["plugins"][PluginName]["$types"]["serverConfig"]; }> extends infer T_3 extends object ? { [I_1 in keyof T_3]: I_1 extends K_2 ? V : T_3[I_1]; } : never) extends infer T_2 ? { [K_1 in keyof T_2]: T_2[K_1]; } : never) extends infer T_1 extends object ? { [I in keyof T_1 as I extends keyof InstanceType<{ readonly "Run `life dev` to see your agents here.": ClientBuildType[string]; }[Name]["plugins"][PluginName]["$types"]["class"]> ? never : I]: T_1[I]; } : never) extends infer T ? { [K in keyof T]: T[K]; } : never) & InstanceType<{ readonly "Run `life dev` to see your agents here.": ClientBuildType[string]; }[Name]["plugins"][PluginName]["$types"]["class"]>; }>]; /** * Get or create an agent instance * @param name - Agent name/type * @param scope - Agent scope configuration * @returns AgentClient instance */ getOrCreateAgent<Name extends keyof ClientBuild>(name: Name, options?: { id?: string; }): Promise<readonly [error: LifeErrorUnion, data: undefined] | readonly [error: undefined, data: ToPublic<AgentClient<{ readonly "Run `life dev` to see your agents here.": ClientBuildType[string]; }[Name]["definition"]> & { [PluginName in keyof { readonly "Run `life dev` to see your agents here.": ClientBuildType[string]; }[Name]["plugins"]]: ((((PluginClientAccessor<{ readonly "Run `life dev` to see your agents here.": ClientBuildType[string]; }[Name]["plugins"][PluginName]["def"], { client: { readonly "Run `life dev` to see your agents here.": ClientBuildType[string]; }[Name]["plugins"][PluginName]["$types"]["clientConfig"]; server: { readonly "Run `life dev` to see your agents here.": ClientBuildType[string]; }[Name]["plugins"][PluginName]["$types"]["serverConfig"]; }> extends infer T_3 extends object ? { [I_1 in keyof T_3]: I_1 extends K_2 ? V : T_3[I_1]; } : never) extends infer T_2 ? { [K_1 in keyof T_2]: T_2[K_1]; } : never) extends infer T_1 extends object ? { [I in keyof T_1 as I extends keyof InstanceType<{ readonly "Run `life dev` to see your agents here.": ClientBuildType[string]; }[Name]["plugins"][PluginName]["$types"]["class"]> ? never : I]: T_1[I]; } : never) extends infer T ? { [K in keyof T]: T[K]; } : never) & InstanceType<{ readonly "Run `life dev` to see your agents here.": ClientBuildType[string]; }[Name]["plugins"][PluginName]["$types"]["class"]>; }>]>; /** * List all created agent instances * @returns Array of { name: string, id: string } */ listAgents(): readonly [error: LifeErrorUnion, data: undefined] | readonly [error: undefined, data: { name: string; id: string; }[]]; /** * Get server information * @returns Server info response */ info(): Promise<readonly [error: LifeErrorUnion, data: undefined] | readonly [error: undefined, data: { lifeVersion: string; nodeVersion: string; startedAt: number; cpu: { usedPercent: number; usedNs: number; }; memory: { usedPercent: number; totalBytes: number; freeBytes: number; usedBytes: number; }; }]>; /** * Check if the server is responsive * @returns True if server responds with "pong" */ ping(): Promise<readonly [error: LifeErrorUnion, data: undefined] | readonly [error: undefined, data: "pong"]>; } declare const transportBrowserConfig: ZodUnionWithTelemetry<"provider", readonly [ZodObjectWithTelemetry<z.ZodObject<{ provider: z.ZodLiteral<"livekit">; serverUrl: z.ZodPrefault<z.ZodURL>; }, zod_v4_core.$strip>, "output">], z.ZodDiscriminatedUnion<z.ZodObject<{ provider: z.ZodLiteral<"livekit">; serverUrl: z.ZodPrefault<z.ZodURL>; }, zod_v4_core.$strip>[], "provider">>; declare class TransportBrowserClient extends TransportClientBase { constructor({ config, obfuscateErrors, telemetry, }: { config: z$1.output<typeof transportBrowserConfig.schema>; obfuscateErrors?: boolean; telemetry?: TelemetryClient | null; }); } declare const agentClientConfig: ZodObjectWithTelemetry<z$1.ZodObject<{ transport: z$1.ZodPrefault<z$1.ZodDiscriminatedUnion<z$1.ZodObject<{ provider: z$1.ZodLiteral<"livekit">; serverUrl: z$1.ZodPrefault<z$1.ZodURL>; }, z$1.core.$strip>[], "provider">>; experimental: z$1.ZodPrefault<z$1.ZodObject<{}, z$1.core.$strip>>; }, z$1.core.$strip>, "output">; type AgentClientAtom = { store: WritableAtom | ReadableAtom; refresh: () => Promise<void>; }; type AgentAtomDefinition<Name extends string = string> = (params: { agent: AgentClient<AgentClientDefinition>; telemetry: TelemetryClient; }) => { name: Name; create: (...params: Any[]) => AgentClientAtom; }; declare const createAgentClientAtoms: (params: Parameters<AgentAtomDefinition>[0]) => { info: { name: "info"; create: (config: z.input<z