import { type AsyncCapabilityId, type CapabilityAnalysis, type CapabilityId } from '@kernlang/core/runner'; import { type CliAsyncOpenAICompatibleLlmCapabilityOptions } from './run-async-host.js'; /** * Parse + execute `source`, returning the program's stdout as a single string, * or throwing {@link KernRunnerError} on any setup failure or runner abstention. * Pure with respect to process state so {@link runRun} is the one place that * touches stdout/stderr/exitCode — and so the executor is unit-testable without * spawning. The helper always provides volatile storage and explicit host crypto; * when sourcePath is provided, explicit RAG capability calls may also read * declared local corpus files through the injected Node capability. * * Atomicity: the runner returns the COMPLETE trace or throws, so stdout is built * only after the whole body succeeds; a body that abstains mid-way leaks nothing. */ export declare function executeKernSource(source: string, options?: { sourcePath?: string; }): string; export declare function executeKernSourceAsync(source: string, options: { sourcePath?: string; fsRoot?: string; fsWriteRoot?: string; netAllowedOrigins?: readonly string[]; llmResponse?: string; llmProvider?: CliAsyncOpenAICompatibleLlmCapabilityOptions; /** Per-call async capability provider timeout, in milliseconds. See --capability-timeout-ms. */ capabilityTimeoutMs?: number; }): Promise; interface ParsedLlmProviderOptions { readonly provider: 'openai'; readonly model?: string; readonly baseUrl?: string; } type RunLlmProviderOptions = CliAsyncOpenAICompatibleLlmCapabilityOptions | ParsedLlmProviderOptions; interface RunCapabilityRequirementReport { readonly id: string; readonly namespace: string; readonly operation: string; readonly status?: string; readonly syncBoundary?: string; readonly inputShape?: string; readonly bindingName?: string; readonly literalInput?: string; readonly sourceLine: number; readonly reason?: string; readonly containerType?: string; } interface RunAsyncProviderHint { readonly id: AsyncCapabilityId; readonly namespace: string; readonly operation: string; readonly providerFlags: readonly string[]; readonly required: boolean; readonly provided: boolean; readonly missing: boolean; } interface RunLlmProviderPolicyReport { readonly provider: 'openai'; readonly configured: boolean; readonly apiKeyPresent: boolean; readonly apiKeyValid: boolean; readonly modelPresent: boolean; readonly modelValid: boolean; readonly baseUrlPresent: boolean; readonly baseUrlValid: boolean; } interface RunProviderPolicyBlocker { readonly provider: 'openai'; readonly reason: 'missing-api-key' | 'invalid-api-key' | 'missing-model' | 'invalid-model' | 'invalid-base-url'; } interface RunCapabilityReport { readonly schemaVersion: 1; readonly mode: 'kern-run-capabilities'; readonly file: string; readonly hasCapabilityBlockers: boolean; /** * `sync`: no async runner boundary needed. `async`: the source needs the * async boundary but only for promoted ops (rag.retrieveAsync, rag.answer, * rag.ingest, llm.complete) — runnable by default without --async-preview. * `async-preview`: the source needs a still-preview-gated op (fs.*, * net.fetch) and requires --async-preview regardless of other flags. */ readonly capabilityReadinessMode: 'sync' | 'async' | 'async-preview'; readonly hasSyncCapabilityBlockers: boolean; readonly hasAsyncCapabilityBlockers: boolean; readonly providedCapabilities: readonly CapabilityId[]; readonly providedAsyncCapabilities: readonly AsyncCapabilityId[]; readonly asyncBoundaryRequired: boolean; readonly hasParseErrors: boolean; readonly requirements: readonly RunCapabilityRequirementReport[]; readonly plannedCapabilities: readonly RunCapabilityRequirementReport[]; readonly asyncPlannedCapabilities: readonly RunCapabilityRequirementReport[]; readonly missingProviders: readonly RunCapabilityRequirementReport[]; readonly missingAsyncProviders: readonly RunCapabilityRequirementReport[]; readonly unsupportedAsyncExecutions: readonly RunCapabilityRequirementReport[]; readonly unknownCapabilities: readonly RunCapabilityRequirementReport[]; readonly malformedCapabilities: readonly RunCapabilityRequirementReport[]; readonly unknownProvidedCapabilities: readonly string[]; readonly unknownProvidedAsyncCapabilities: readonly string[]; readonly asyncProviderHints: readonly RunAsyncProviderHint[]; readonly llmProviderPolicy?: RunLlmProviderPolicyReport; readonly providerPolicyBlockers: readonly RunProviderPolicyBlocker[]; readonly parseDiagnostics: CapabilityAnalysis['parseDiagnostics']; } export declare function analyzeRunCapabilities(source: string, filePath: string, options?: { fsRoot?: string; fsWriteRoot?: string; netAllowedOrigins?: readonly string[]; llmResponse?: string; llmProvider?: RunLlmProviderOptions; }): RunCapabilityReport; /** `kern run ` — execute the KERN-native `fn main` through the reference runner. */ export declare function runRun(args: string[]): Promise; export {};