import { C as SourceTarget, S as SourceRuntime, d as ProcessedSource, g as SourceFile, i as FileTarget, l as PlannedSourceTarget, m as ProcessorPostprocessContext, o as FunctionTarget, p as ProcessorContext, r as ClassTarget, s as LanguageContext, t as BaseSourceFile, x as SourceRange } from "./types-DM4idR4w.mjs"; import { GenericSchema, InferInput, InferOutput } from "valibot"; //#region src/config/types.d.ts type ModelSize = 'large' | 'medium' | 'small'; interface ProviderDefinition { endpoint: string; headers?: Record; id: string; models: SetupModelDefinition[]; type: ProviderType; } type ProviderType = 'openai-compatible'; interface RunnerCacheConfig { enabled?: boolean; location?: string; } interface RunnerConfig { /** Retries after the initial attempt for replay-safe agent failures. @default 2 */ agentRetries?: number; cache?: boolean | RunnerCacheConfig; ruleConcurrency?: number; stats?: boolean | RunnerStatsConfig; timeoutMs?: number; } interface RunnerStatsConfig { enabled?: boolean; location?: string; retentionMonths?: number; } interface SetupConfig { providers: ProviderDefinition[]; runner?: RunnerConfig; version: 1; } interface SetupModelDefinition { aliases?: string[]; capabilities?: string[]; contextWindow?: number; defaultParams?: Record; id: string; name?: string; size?: ModelSize; } //#endregion //#region src/models/types.d.ts interface ModelRequirement { capabilities?: string[]; minContextWindow?: number; params?: Record; size?: ModelSize; } interface ResolvedModel { aliases: string[]; capabilities: string[]; contextWindow?: number; id: string; name: string; params: Record; provider: ResolvedProvider; size?: ModelSize; } interface ResolvedProvider { endpoint: string; headers: Record; id: string; type: 'openai-compatible'; } interface ResolveModelOptions { request?: string; requirement?: ModelRequirement; ruleId?: string; } //#endregion //#region src/agent/types.d.ts type AgentAdapter = (request: AgentRequest) => Promise; interface AgentRequest { instructions: string; model: ResolvedModel; prompt: string; signal?: AbortSignal; tools: AgentTool[]; } interface AgentResult { answer: string; usage?: AgentUsage; } /** Agent-agnostic tool definition. Each adapter translates it to its framework's tool format. */ interface AgentTool { description: string; execute: (input: unknown) => Promise | unknown; name: string; parameters: Record; } interface AgentUsage { inputTokens?: number; outputTokens?: number; totalTokens?: number; } //#endregion //#region src/dsl/types.d.ts type AlintConfig = readonly AlintConfigInput[]; type AlintConfigExtends = AlintConfigInput | string; type AlintConfigInput = AlintConfigItem | readonly AlintConfigInput[]; interface AlintConfigItem { agent?: AgentAdapter; basePath?: string; directories?: readonly (readonly string[] | string)[]; extends?: readonly AlintConfigExtends[]; files?: readonly (readonly string[] | string)[]; ignore?: IgnoreConfig; ignores?: readonly string[]; integrations?: IntegrationsConfig; language?: string; languageOptions?: Record; linterOptions?: AlintLinterOptions; name?: string; plugins?: Record; processor?: ProcessorDefinition | string; rules?: Record; runner?: RunnerConfig; settings?: Record; } interface AlintLinterOptions { noInlineConfig?: boolean; /** * How the run reports files it lints that no language claimed, so they were handled as plain * text. Defaults to `'warn'`. An explicit `language: 'plaintext'` pin means plain text was the * intent, so pinned files are never reported. */ reportUnregisteredLanguages?: RuleSeverity; reportUnusedDisableDirectives?: RuleSeverity; } type Awaitable = Promise | T; interface DiagnosticDescriptor { evidence?: unknown; filePath?: string; loc?: DiagnosticLocation; message: string; } interface DiagnosticLocation { end?: { column: number; line: number; }; start: { column: number; line: number; }; } interface DirectoryTarget { kind: 'directory'; path: string; } interface EnabledRule { id: string; localId: string; options: readonly unknown[]; rule: RuleDefinition; severity: Exclude; } interface IgnoreConfig { gitignore?: boolean; } interface IntegrationsConfig { stopGate?: StopGateConfig; } interface LanguageDefinition { extensions?: readonly string[]; extract: (file: SourceFile, context: LanguageContext) => Awaitable; /** * The language's id: what a config pins through `language:`, what a rule's `languages` lists, and * what every target it extracts reports. The registry is keyed by it, so two packs cannot claim * the same one. * * Use the identifier editors already use — `go`, `python`, `rust`, `typescript`, `plaintext` — * rather than inventing a spelling. Anyone can register a language, so the set is open by * definition and only a shared convention keeps one language from arriving under three names. * * NOTICE: the list is VS Code's. The Language Server Protocol shares it for the languages it * covers, but its table has no entry for plain text, so `plaintext` comes from VS Code alone. * https://code.visualstudio.com/docs/languages/identifiers * https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocumentItem */ name: string; } interface PluginDefinition> = Record>> { configs?: Record; languages?: Record; processors?: Record; rules?: Rules; } interface ProcessorDefinition { postprocess?: (diagnostics: DiagnosticDescriptor[], context: ProcessorPostprocessContext) => Awaitable; preprocess: (file: SourceFile, context: ProcessorContext) => Awaitable; } interface ProjectFileEntry extends BaseSourceFile { targetCount: number; } interface ProjectTarget { files: readonly ProjectFileEntry[]; kind: 'project'; root: string; targets: readonly ProjectTargetEntry[]; } interface ProjectTargetEntry { filePath: string; identity: string; kind: string; name?: string; range?: SourceRange; } type RuleCacheConfig = boolean | { level?: 'target'; }; type RuleConfigEntry = readonly [RuleSeverity, ...Partial] | RuleSeverity; interface RuleContext { agent?: AgentAdapter; cwd: string; id: string; localId: string; logger: { debug: (...args: unknown[]) => void; }; metering: { recordUsage: (usage: RuleInferenceUsageRecord) => void; }; model: (selector?: ModelRequirement | string) => Promise; options: Options; outputLanguage?: string; report: (diagnostic: DiagnosticDescriptor) => void; settings: Record; /** * Cancels the run. Forward it to anything long-running a rule starts, so cancelling stops * the work instead of letting it finish and bill. * * `ctx.agent` already injects it, and `generateStructured` accepts it as `signal`. */ signal?: AbortSignal; src: SourceRuntime; } interface RuleDefinition { cache?: RuleCacheConfig; /** Additional stable rule inputs, such as imported prompts, that invalidate cached results when changed. */ cacheKey?: unknown; create: (context: RuleContext>) => RuleHandlers; /** * Which languages this rule reads. Omitting it opts out of extraction: the rule still receives * file targets, but never the function and class targets a language produces. * * It does not choose how a file is parsed. A config's `language:` pin, or the extension, settles * that before any rule is consulted. Directory and project targets ignore it too: they index a * tree rather than come from a language. */ languages?: RuleLanguages; model?: ModelRequirement; options?: OptionsSchema; } type RuleHandlers = RuleSpecializedHandlers | RuleWithHandler; interface RuleInferenceUsageRecord { filePath?: string; inputTokens?: number; metadata?: unknown; modelId: string; outputTokens?: number; providerId: string; ruleId?: string; totalTokens?: number; } /** * - `'any'` — every language except `plaintext`, and never a failure. Plain text is what a file * falls back to when no language claims it, so a rule asking for any language is asking for a * real one. Rules that work from `FunctionInfo` alone want this: install another language pack * and they cover it too, unchanged. * - A list of language ids — `LanguageDefinition.name` values such as `go` or `typescript`, never * file extensions. The rule handles exactly these. Files of other languages are skipped * rather than failed, so one plugin can carry rules for several languages behind one `files:` * glob. If a listed language is not registered at all the run fails, because a rule scoped to a * language nothing provides would otherwise skip every file in silence. * - `{ ids: string[], skipMissing?: boolean }` — the same scoping, but an unregistered id can be * skipped instead of failing. For a plugin whose rules span languages a given user may not have installed. */ type RuleLanguages = 'any' | readonly string[] | { /** Language ids this rule applies to. */ ids: readonly string[]; /** Whether to skip unregistered languages instead of failing. */ skipMissing?: boolean; }; type RuleOptionsInput = { readonly [Index in keyof OptionsSchema]: InferInput; }; type RuleOptionsOutput = { readonly [Index in keyof OptionsSchema]: InferOutput; }; type RuleOptionsSchema = readonly GenericSchema[]; interface RuleRegistry { enabledRules: EnabledRule[]; rules: Map>; } type RuleSeverity = 'error' | 'off' | 'warn'; interface RuleSpecializedHandlers { onTargetClass?: (target: ClassTarget) => Awaitable; onTargetDirectory?: (target: DirectoryTarget) => Awaitable; onTargetFile?: (target: FileTarget) => Awaitable; onTargetFunction?: (target: FunctionTarget) => Awaitable; onTargetProject?: (target: ProjectTarget) => Awaitable; onTargetWith?: never; } interface RuleWithHandler { onTargetClass?: never; onTargetDirectory?: never; onTargetFile?: never; onTargetFunction?: never; onTargetProject?: never; onTargetWith: (target: Target) => Awaitable; } interface StopGateConfig { enabled?: boolean; target?: StopGateTarget; timeoutMs?: number; } type StopGateTarget = 'all' | 'dirty-files'; type Target = DirectoryTarget | PlannedSourceTarget | ProjectTarget; //#endregion export { RuleSpecializedHandlers as A, ModelRequirement as B, RuleHandlers as C, RuleOptionsSchema as D, RuleOptionsOutput as E, AgentAdapter as F, ProviderDefinition as G, ResolvedModel as H, AgentRequest as I, RunnerStatsConfig as J, ProviderType as K, AgentResult as L, StopGateConfig as M, StopGateTarget as N, RuleRegistry as O, Target as P, AgentTool as R, RuleDefinition as S, RuleOptionsInput as T, ResolvedProvider as U, ResolveModelOptions as V, ModelSize as W, SetupModelDefinition as X, SetupConfig as Y, ProjectTarget as _, AlintLinterOptions as a, RuleConfigEntry as b, DiagnosticLocation as c, IgnoreConfig as d, IntegrationsConfig as f, ProjectFileEntry as g, ProcessorDefinition as h, AlintConfigItem as i, RuleWithHandler as j, RuleSeverity as k, DirectoryTarget as l, PluginDefinition as m, AlintConfigExtends as n, Awaitable as o, LanguageDefinition as p, RunnerConfig as q, AlintConfigInput as r, DiagnosticDescriptor as s, AlintConfig as t, EnabledRule as u, ProjectTargetEntry as v, RuleInferenceUsageRecord as w, RuleContext as x, RuleCacheConfig as y, AgentUsage as z };