/** * Shared app manager contracts. */ import type * as zod from "zod"; import type { IAgentRuntime } from "../types/runtime.js"; import type { ViewKind } from "../views/declarations.js"; import type { appNpmSchema, appSessionSchema, appSupportsSchema } from "./schema.js"; /** Accepts canonical app slugs used to select installed route modules. */ export declare function isValidAppRouteSlug(value: unknown): value is string; export declare function getRegisteredCuratedApps(): ElizaCuratedAppDefinition[]; export type AppSessionConfig = zod.infer; export type AppSessionMode = AppSessionConfig["mode"]; export type AppSessionFeature = NonNullable[number]; export type AppSessionControlAction = "pause" | "resume"; export type AppRunViewerAttachment = "attached" | "detached" | "unavailable"; export type AppRunHealthState = "healthy" | "degraded" | "offline"; export type AppRunCapabilityAvailability = "available" | "unavailable" | "unknown"; export type AppRunEventKind = "launch" | "refresh" | "attach" | "detach" | "stop" | "status" | "summary" | "health"; export type AppRunEventSeverity = "info" | "warning" | "error"; export type AppSessionJsonValue = string | number | boolean | null | AppSessionJsonValue[] | { [key: string]: AppSessionJsonValue; }; export interface AppViewerAuthMessage { type: string; authToken?: string; characterId?: string; sessionToken?: string; agentId?: string; followEntity?: string; } export interface AppSessionRecommendation { id: string; label: string; type?: string; reason?: string | null; priority?: number | null; command?: string | null; } export interface AppSessionActivityItem { id: string; type: string; message: string; timestamp?: number | null; severity?: "info" | "warning" | "error"; } export interface AppViewerConfig { url: string; embedParams?: Record; postMessageAuth?: boolean; sandbox?: string; authMessage?: AppViewerAuthMessage; } export interface AppUiExtensionConfig { detailPanelId: string; } export type RegistryAppSupports = zod.infer; export type RegistryAppNpmInfo = zod.infer; export interface RegistryAppInfo { name: string; displayName: string; description: string; category: string; launchType: string; launchUrl: string | null; icon: string | null; /** * Absolute or app-scoped URL to a large hero image (ideally a 1024×1024 * square webp) used as the card background on the apps page. Apps declare * this in their `package.json` under `elizaos.app.heroImage` as a path * relative to the package root; the runtime rewrites app hero requests * through `/api/apps/hero/` and will synthesize generated artwork * there when the app does not ship a dedicated hero asset. */ heroImage: string | null; capabilities: string[]; stars: number; repository: string; latestVersion: string | null; supports: RegistryAppSupports; npm: RegistryAppNpmInfo; directory?: string | null; registryKind?: string; origin?: "builtin" | "third-party" | string; source?: string; support?: "first-party" | "community" | string; builtIn?: boolean; firstParty?: boolean; thirdParty?: boolean; status?: string; uiExtension?: AppUiExtensionConfig; viewer?: Omit; session?: AppSessionConfig; /** Four-tier visibility category; absent values default to release. */ viewKind?: ViewKind; /** * Controls whether the app appears in the user-facing app store/catalog. * Defaults to true. Set to false for apps that auto-install or are surfaced * only via direct deep-links. */ visibleInAppStore?: boolean; /** * If true, the app declares itself as the default landing tab. Exactly one * installed app should set this. Sourced from `package.json` → * `elizaos.app.mainTab`. Consumed by `getMainTabApp()` in `@elizaos/ui` * to compute the shell's landing tab at boot. */ mainTab?: boolean; /** * Declared home section for the app catalog, sourced from `package.json` → * `elizaos.app.catalogSection`. One of the concrete catalog sections * (`games` | `developerUtilities` | `finance` | `other`). When absent, the * section is derived from `category` and keyword heuristics. The dynamic * `featured` / `favorites` sections are never declared here (they are * computed from `featured` and the user's starred apps). */ catalogSection?: string; /** * If true, the app is promoted into the Featured catalog section. Sourced * from `elizaos.app.featured`. Featured is presentational only — it does not * make an otherwise-hidden app appear. */ featured?: boolean; /** * If true, the app is hidden from the catalog by default and only surfaces * when explicitly configured as a default app, or — for `scope: "wallet"` * apps — when the wallet is enabled. Sourced from `elizaos.app.defaultHidden`. */ defaultHidden?: boolean; /** * Capability scope that gates default visibility. `"wallet"` apps are * revealed when the wallet is enabled. Sourced from `elizaos.app.scope`. */ scope?: string; } export interface AppSessionState { sessionId: string; appName: string; mode: AppSessionMode; status: string; displayName?: string; agentId?: string; characterId?: string; followEntity?: string; canSendCommands?: boolean; controls?: AppSessionControlAction[]; summary?: string | null; goalLabel?: string | null; suggestedPrompts?: string[]; recommendations?: AppSessionRecommendation[]; activity?: AppSessionActivityItem[]; telemetry?: Record | null; } export interface AppSessionActionResult { success: boolean; message: string; session?: AppSessionState | null; } export interface AppRunHealth { state: AppRunHealthState; message: string | null; } export interface AppRunHealthFacet { state: AppRunHealthState | "unknown"; message: string | null; } export interface AppRunHealthDetails { checkedAt: string | null; auth: AppRunHealthFacet; runtime: AppRunHealthFacet; viewer: AppRunHealthFacet; chat: AppRunHealthFacet; control: AppRunHealthFacet; message: string | null; } export interface AppRunEvent { eventId: string; kind: AppRunEventKind; severity: AppRunEventSeverity; message: string; createdAt: string; status?: string | null; details?: Record | null; } export interface AppRunAwaySummary { generatedAt: string; message: string; eventCount: number; since: string | null; until: string | null; } export interface AppRunSummary { runId: string; appName: string; displayName: string; pluginName: string; launchType: string; launchUrl: string | null; viewer: AppViewerConfig | null; session: AppSessionState | null; characterId: string | null; agentId: string | null; status: string; summary: string | null; startedAt: string; updatedAt: string; lastHeartbeatAt: string | null; supportsBackground: boolean; supportsViewerDetach: boolean; chatAvailability: AppRunCapabilityAvailability; controlAvailability: AppRunCapabilityAvailability; viewerAttachment: AppRunViewerAttachment; recentEvents: AppRunEvent[]; awaySummary: AppRunAwaySummary | null; health: AppRunHealth; healthDetails: AppRunHealthDetails; } export interface AppRunActionResult { success: boolean; message: string; run?: AppRunSummary | null; } /** * Runtime service type for an optional host-provided app-run reader. Consumers (e.g. the agent's hosted-app session gate) query * `runtime.getService(APP_SESSION_SERVICE_TYPE)` instead of statically importing * the plugin, keeping the host→plugin dependency direction correct. */ export declare const APP_SESSION_SERVICE_TYPE = "app-session"; /** * Contract for the app-session runtime service. Exposes the current AppManager * run snapshot so gate logic can decide whether a hosted app is active without * reaching into the plugin's on-disk store directly. */ export interface AppSessionServiceLike { /** Current AppManager run snapshot (unfiltered; callers apply status logic). */ getRuns(): AppRunSummary[]; } export type AppLaunchDiagnosticSeverity = "info" | "warning" | "error"; export interface AppLaunchDiagnostic { code: string; severity: AppLaunchDiagnosticSeverity; message: string; } export interface AppLaunchPreparation { diagnostics?: AppLaunchDiagnostic[]; launchUrl?: string | null; viewer?: Omit | null; skipRuntimePluginRegistration?: boolean; } export interface AppLaunchResult { pluginInstalled: boolean; needsRestart: boolean; displayName: string; launchType: string; launchUrl: string | null; viewer: AppViewerConfig | null; session: AppSessionState | null; run: AppRunSummary | null; diagnostics?: AppLaunchDiagnostic[]; } /** Context available during app launch (before a run is started). */ export interface AppLaunchSessionContext { appName: string; launchUrl: string | null; runtime: IAgentRuntime | null; viewer: AppLaunchResult["viewer"] | null; } /** Context available during an active app run. */ export interface AppRunSessionContext extends AppLaunchSessionContext { runId?: string; session: AppSessionState | null; } export interface InstalledAppInfo { name: string; displayName: string; pluginName: string; version: string; installedAt: string; } export interface ElizaCuratedAppDefinition { slug: string; canonicalName: string; aliases: string[]; } export interface AppStopResult { success: boolean; appName: string; runId: string | null; stoppedAt: string; pluginUninstalled: boolean; needsRestart: boolean; stopScope: "plugin-uninstalled" | "viewer-session" | "nothing-stopped"; message: string; } export declare const ELIZA_CURATED_APP_DEFINITIONS: readonly ElizaCuratedAppDefinition[]; export declare function packageNameToAppRouteSlug(packageName: string): string | null; export declare function packageNameToAppDisplayName(packageName: string): string; export declare function hasAppInterface(value: { kind?: string | null; appMeta?: unknown; } | null | undefined): boolean; export declare function getElizaCuratedAppDefinition(value: string): ElizaCuratedAppDefinition | null; export declare function normalizeElizaCuratedAppName(value: string): string | null; export declare function isElizaCuratedAppName(value: string): boolean; /** * Register an additional curated app definition at runtime. * Plugins should call this during initialization to add their app to the * curated catalog. */ export declare function registerCuratedApp(def: ElizaCuratedAppDefinition): void; /** * Get all curated app definitions: hardcoded list merged with * runtime-registered apps. Runtime registrations with the same slug * override hardcoded entries. */ export declare function getCuratedAppDefinitions(): ElizaCuratedAppDefinition[]; export declare function getElizaCuratedAppCatalogOrder(value: string): number;