import { Ct as PluginsConfig, Dt as PluginManifestRegistry, It as PluginOrigin, Kn as PluginHookAgentContext, Lr as MemoryProviderFactory, br as PluginHookRegistry, bt as LlmApiFormat, c as PluginUiToolOptions, fr as PluginHookHandlerMap, jt as PluginDiagnostic, o as PluginToolRegistry, s as PluginUiToolDescriptor, t as DiscoveredPiExtension, vr as PluginHookName, xt as NormalizedPluginsConfig } from "./loader-CCcKMJve.js"; import { AgentProgressEvent, HitlCheckpoint, HitlRequest, HitlToolContext } from "@gencode/shared"; import * as yaml from "yaml"; //#region src/llm/client.d.ts type LlmChatMessage = { role: "system" | "user" | "assistant"; content: string; }; type LlmChatParams = { system?: string; user?: string; messages?: LlmChatMessage[]; model?: string; temperature?: number; topK?: number; topP?: number; maxTokens?: number; timeoutMs?: number; signal?: AbortSignal; headers?: Record; }; type LlmChatResult = { text: string; usage: { input: number; output: number; total: number; }; raw?: unknown; }; //#endregion //#region src/plugins/runtime.d.ts type PluginRuntime = { version: string; logging: { getLogger: (name: string) => { info: (message: string) => void; warn: (message: string) => void; error: (message: string) => void; }; }; /** * Read-only view of session-scoped state. Exposed to plugins so they can * discover per-run configuration (e.g. environment variables passed via * `AgentRunParams.env`) without re-plumbing the data through config. */ session: { env: Record; }; }; type CreatePluginRuntimeOptions = { pluginId: string; /** * Session-scoped env map mirrored from the current run. Frozen to * prevent plugins from mutating shared state. */ env?: Record; getEnv?: () => Record | undefined; }; declare function createPluginRuntime(options: CreatePluginRuntimeOptions): PluginRuntime; //#endregion //#region src/plugins/progress-runtime.d.ts type PluginCustomProgressInput = { name: string; label?: string; data?: Record; }; type PluginProgressEmitter = { emit(event: PluginCustomProgressInput): Promise; }; declare function createPluginProgressEmitter(pluginId: string): PluginProgressEmitter; //#endregion //#region src/plugins/runtime-context.d.ts type PluginRuntimeContext = { llm?: { apiFormat?: LlmApiFormat; baseUrl: string; apiKey: string; model: string; contextWindow?: number; headers?: Record; }; hookCtx?: PluginHookAgentContext; llmAllowlist?: string[]; /** * Session-scoped environment variables supplied via `AgentRunParams.env`. * Plugins that spawn child processes (e.g. via the `exec` tool) should * merge this map into the child process environment. Plugins may also * read values from this map to discover session-scoped configuration. * * The map is held in memory only for the duration of the run and is * never written to disk; it does not cross session boundaries. */ env?: Record; }; type PluginRuntimeContextRef = { current?: PluginRuntimeContext; }; //#endregion //#region src/memory/embeddings.d.ts type EmbeddingProvider = { id: string; model: string; embedQuery: (text: string) => Promise; embedBatch: (texts: string[]) => Promise; }; //#endregion //#region src/memory/embedding-registry.d.ts type EmbeddingProviderContext = { dataDir: string; memoryDir: string; pluginId?: string; config?: Record; rootDir?: string; source?: string; }; type EmbeddingProviderFactory = (ctx: EmbeddingProviderContext) => EmbeddingProvider; type EmbeddingProviderRegistration = { id: string; pluginId?: string; create: EmbeddingProviderFactory; config?: Record; rootDir?: string; source?: string; }; declare function registerEmbeddingProvider(params: { pluginId: string; create: EmbeddingProviderFactory; id?: string; config?: Record; rootDir?: string; source?: string; }): string; declare function resolveEmbeddingProvider(params: { providerId?: string; pluginId?: string; dataDir: string; memoryDir: string; }): { provider: EmbeddingProvider; registration: EmbeddingProviderRegistration; } | null; declare function resetEmbeddingProviderRegistryForTests(): void; //#endregion //#region src/plugins/hitl.d.ts type PluginHitlRequest = Omit; type PluginHitlPauseInput = { /** Request fields controlled by the plugin. Runtime identity fields are supplied by the host. */request: PluginHitlRequest; /** Checkpoint used by the runner to resume this operation. */ checkpoint: HitlCheckpoint; /** Optional tool call that caused the pause. */ toolContext?: HitlToolContext; /** Transparent safety gates do not persist the synthetic paused tool result. */ transparent?: boolean; }; /** Structural public view of the agents-internal pause signal. */ type PluginHitlPauseSignal = Error & { readonly isHitlPause: true; readonly request: HitlRequest; readonly checkpoint: HitlCheckpoint; readonly toolContext?: HitlToolContext; readonly transparentPause: boolean; }; type PluginHitlApi = { /** Pause the active run. This method always throws the host's internal control-flow signal. */pause: (input: PluginHitlPauseInput) => never; /** Identify a pause signal without importing the agents runtime package. */ isPause: (error: unknown) => error is PluginHitlPauseSignal; }; //#endregion //#region src/plugins/loader.d.ts type PluginRecord = { id: string; source: string; origin: PluginOrigin; enabled: boolean; status: "loaded" | "disabled" | "error"; error?: string; durationMs?: number; toolCount: number; hookCount: number; skills: string[]; configSchema: boolean; }; type PluginRegistry = { plugins: PluginRecord[]; diagnostics: PluginDiagnostic[]; tools: PluginToolRegistry; hooks: PluginHookRegistry; skills: string[]; }; type PluginLoadOptions = { registry: PluginManifestRegistry; plugins: NormalizedPluginsConfig; workspaceDir?: string; runtime?: PluginRuntimeContext; runtimeRef?: PluginRuntimeContextRef; disabledKinds?: string[]; }; type PluginApi = { id: string; source: string; rootDir: string; config: Record | undefined; runtime: ReturnType; llm: { chat: (params: LlmChatParams) => Promise; }; yaml: typeof yaml; hitl: PluginHitlApi; registerTool: (tool: Parameters[1], opts?: Parameters[2]) => void; /** * Register a UI tool that pauses the agent and collects structured user * input through a front-end form. * * Unlike `registerTool`, the plugin only provides the form schema and * metadata — session binding, pause/resume control flow, and result * validation are handled automatically by the framework. */ registerUiTool: (descriptor: PluginUiToolDescriptor, opts?: PluginUiToolOptions) => void; registerEmbeddingProvider: (params: { id?: string; create: EmbeddingProviderFactory; }) => void; registerMemoryProvider: (params: { id?: string; create: MemoryProviderFactory; }) => void; registerHook: (hookName: K, handler: PluginHookHandlerMap[K], opts?: { priority?: number; }) => void; registerSkillDir: (dir: string) => void; createProgressEmitter: () => PluginProgressEmitter; }; declare function loadPlugins(options: PluginLoadOptions): PluginRegistry; //#endregion //#region src/plugins/manager.d.ts /** * Pre-load plugin system at container startup time. * Blocks ~1.8s (jiti compile) but runs BEFORE any user request arrives. * Multiple calls are idempotent — won't recompile. */ declare function preloadPluginSystem(options: PluginSystemOptions): PluginSystem; /** * Get pre-loaded plugin system if available, otherwise cold-start. * Session creation should use this (returns instantly if pre-warmed). */ declare function getPluginSystem(options: PluginSystemOptions): PluginSystem; type PluginSystemOptions = { config?: PluginsConfig; dataDir?: string; workspaceDir?: string; bundledDir?: string; ownershipUid?: number | null; toolAllowlist?: string[]; runtime?: PluginRuntimeContext; /** Extra paths for pi community extensions (plugins.piExtensions.paths). */ piExtensionPaths?: string[]; /** Plugin manifest kinds to leave unloaded for this runtime. */ disabledKinds?: string[]; }; type PluginSystem = { registry: PluginRegistry; diagnostics: PluginDiagnostic[]; normalizedConfig: NormalizedPluginsConfig; piExtensions: DiscoveredPiExtension[]; runtimeRef?: PluginRuntimeContextRef; }; declare function initializePluginSystem(options?: PluginSystemOptions): PluginSystem; //#endregion //#region src/system-runtime.d.ts type SystemWarmState = { runtimeInitialized: true; pluginSystem: PluginSystem; loadedAt: string; version: 1; }; type PrepareSystemRuntimeOptions = Pick; declare function prepareSystemRuntime(options?: PrepareSystemRuntimeOptions): SystemWarmState; //#endregion export { LlmChatResult as A, EmbeddingProvider as C, createPluginProgressEmitter as D, PluginProgressEmitter as E, PluginRuntime as O, resolveEmbeddingProvider as S, PluginCustomProgressInput as T, EmbeddingProviderContext as _, PluginSystemOptions as a, registerEmbeddingProvider as b, preloadPluginSystem as c, PluginRegistry as d, loadPlugins as f, PluginHitlRequest as g, PluginHitlPauseSignal as h, PluginSystem as i, createPluginRuntime as k, PluginApi as l, PluginHitlPauseInput as m, SystemWarmState as n, getPluginSystem as o, PluginHitlApi as p, prepareSystemRuntime as r, initializePluginSystem as s, PrepareSystemRuntimeOptions as t, PluginRecord as u, EmbeddingProviderFactory as v, PluginRuntimeContext as w, resetEmbeddingProviderRegistryForTests as x, EmbeddingProviderRegistration as y };