/* auto-generated by NAPI-RS */
/* eslint-disable */
export declare class CatalogBuilder {
  constructor(memoryOnly?: boolean | undefined | null, outputDir?: string | undefined | null)
  /**
   * # Errors
   * Does not fail; invalid tool entries are skipped.
   */
  addTool(entry: any): void
  getToolInfo(serverName: string, toolName: string): any | null
  buildIndex(): CatalogIndexResult
  /**
   * # Errors
   * Returns an error when the catalog directory cannot be created or files cannot be written.
   */
  writeCatalog(): CatalogIndexResult
  toCatalogDict(catalogPrefix?: string | undefined | null): any
}
export type CatalogBuilderNapi = CatalogBuilder

/** In-memory decomposed catalog JSON (backed by Rust [`DecomposedCatalog`]). */
export declare class DecomposedCatalog {
  constructor(jsonFiles?: Record<string, any> | undefined | null)
  /**
   * # Errors
   * Does not fail; invalid index shapes yield an empty decomposed catalog.
   */
  static fromCatalogIndex(index: any): DecomposedCatalog
  static fromCatalogDict(data: any): DecomposedCatalog
  hasJson(key: string): boolean
  getJson(key: string): any | null
  resolveKey(filePath: string): string | null
  toJsonFiles(): Record<string, any>
}
export type DecomposedCatalogNapi = DecomposedCatalog

/** N-API policy context (defaults live in [`PolicyContext::new`]). */
export declare class PolicyContext {
  constructor(systemPolicy?: string | undefined | null, mcpPolicy?: string | undefined | null)
  get systemPolicy(): string
  set systemPolicy(value: string)
  get mcpPolicy(): string
  set mcpPolicy(value: string)
  get perTool(): Record<string, string>
  set perTool(value: Record<string, string>)
}
export type PolicyContextNapi = PolicyContext

export declare class SkillsBuilderNapi {
  constructor(memoryOnly?: boolean | undefined | null, outputDir?: string | undefined | null)
  /**
   * # Errors
   *
   * Returns an error when a skill directory is missing or a markdown file cannot be read.
   */
  buildFromDirs(skillDirs: Array<string>, config?: PageIndexConfigNapi | undefined | null): Record<string, any>
  /**
   * # Errors
   *
   * Returns an error when the index has not been built or files cannot be written.
   */
  writeCatalog(): Record<string, any>
  /**
   * # Errors
   *
   * Returns an error when the index has not been built.
   */
  toSkillsIndexJson(): any
  /**
   * # Errors
   *
   * Returns an error when the index has not been built.
   */
  toSkillsDict(): any
}

export interface AnthropicCatalogEntriesResult {
  entries: Array<any>
  enums: Array<any>
}

export declare function anthropicToolIsMcp(tool: any): boolean

export declare function anthropicToolIsSystem(tool: any): boolean

export declare function anthropicToolsToCatalogEntries(tools: Array<any>): AnthropicCatalogEntriesResult

export declare function anthropicToolToCatalogEntry(tool: any): any | null

export declare function appendDescriptionReinstateEntries(entries: Array<any>, buildCatalog: any, catalogIndex: any, ctx: PolicyContext): Array<any>

/**
 * # Errors
 *
 * Returns an error when config validation fails.
 */
export declare function bm25CohesionChunkNapi(text: string, config?: any | undefined | null): any

/**
 * # Errors
 * Does not fail; malformed tool entries are skipped during indexing.
 */
export declare function buildCatalogFromTools(tools: Array<any>): CatalogIndexResult

/**
 * # Errors
 * Does not fail; malformed tool entries are skipped during indexing.
 */
export declare function buildCatalogIndex(tools: Array<any>, allEnums: Array<any>): CatalogIndexResult

/**
 * # Errors
 *
 * Returns an error when a skill directory is missing or a markdown file cannot be read.
 */
export declare function buildSkillsIndexNapi(skillDirs: Array<string>, config?: PageIndexConfigNapi | undefined | null): Record<string, any>

export interface CatalogIndexResult {
  tools: Array<any>
  files: Record<string, string>
}

/**
 * # Errors
 * Does not fail; invalid index shapes yield an empty catalog dict.
 */
export declare function catalogIndexToCatalogDict(index: any, catalogPrefix?: string | undefined | null): any

export declare function catalogNeedsPartition(data: any, ctx: PolicyContext): boolean

export declare function catalogNeedsPrunedRecompose(data: any, ctx: PolicyContext): boolean

export declare function catalogPrefix(): string

/**
 * # Errors
 * Returns an error when the tool count exceeds `u32::MAX`.
 */
export declare function catalogToolCount(data: any): number

export declare function chunkSurvivorKey(item: any, section: string): string | null

export declare function chunkToolId(item: any): string

export declare function collectEnums(schema: any): Array<any>

/**
 * # Errors
 * Does not fail; updates in-process path configuration.
 */
export declare function configurePathConstants(config: PathConfigNapi): void

/**
 * # Errors
 * Does not fail; updates in-process runtime configuration.
 */
export declare function configureRuntimeDefaults(decomposedScore: number, enumScore: number, rerankScore: number, emptyOptionalFallbackK: number, defaultSystemPolicy: string, defaultMcpPolicy: string): void

export declare function decomposedPrefix(): string

export declare function decomposedRoot(): string

export declare function decomposedScore(): number

export declare function directRootOptionalChunksForTool(items: Array<any>, toolId: string): Array<any>

export declare function dropRecomposedToolsWithEmptyProperties(tools: Array<any>, catalogIndex: any, ctx: PolicyContext): Array<any>

export declare function effectivePolicy(ctx: PolicyContext, toolId: string): string

export declare function emptyOptionalFallbackK(): number

export declare function entriesForPolicy(ctx: PolicyContext, allEntries: Array<any>): Array<any>

export declare function enumScore(): number

export declare function extractDocumentText(item: any): string | null

export declare function extractJsonCatalogDocument(item: any): string | null

export declare function extractLevelInfo(item: any): Array<string>

export declare function extractMdCatalogDocument(item: any): string | null

export declare function filterRecomposeJsonEntries(jsonList: Array<any>, ctx: PolicyContext, rerankScore?: number | undefined | null, llmSelectedPaths?: Array<string> | undefined | null): Array<any>

export declare function fullPassThrough(ctx: PolicyContext): boolean

export declare function getRootToolKey(filePath: string): string | null

/**
 * # Errors
 *
 * Returns an error when specs are invalid or the document is missing.
 */
export declare function getSkillContentRetrieveResultNapi(index: any, docId: string, lineNumSpecs?: Array<string> | undefined | null, nodeIdSpecs?: Array<string> | undefined | null, chunkIdSpecs?: Array<string> | undefined | null, options?: ReconstructOptionsNapi | undefined | null): any

/**
 * # Errors
 *
 * Does not fail; returns an empty object when the document id is unknown.
 */
export declare function getSkillDocumentNapi(documents: any, docId: string): any

/**
 * # Errors
 *
 * Does not fail; returns an empty array when line numbers or document id are unknown.
 */
export declare function getSkillLineContentFromSpecNapi(index: any, docId: string, lineNumSpec: string): any

/**
 * # Errors
 *
 * Does not fail; returns an empty array when line numbers or document id are unknown.
 */
export declare function getSkillLineContentNapi(index: any, docId: string, lineNumSpecs?: Array<string> | undefined | null, nodeIdSpecs?: Array<string> | undefined | null, chunkIdSpecs?: Array<string> | undefined | null): any

/**
 * # Errors
 *
 * Does not fail; returns an empty array when the document id is unknown.
 */
export declare function getSkillStructureNapi(documents: any, docId: string): any

export declare function isDecomposedOptionalPropertyChunk(item: any): boolean

export declare function isDecomposedToolRootChunk(item: any): boolean

export declare function isDescriptionPolicy(policy: string): boolean

export declare function isDirectRootOptionalPropertyChunk(item: any): boolean

export declare function isMcpOptionalChunk(item: any): boolean

export declare function isMcpRootChunk(item: any): boolean

export declare function isNonSystemChunk(item: any): boolean

export declare function isNonSystemToolId(toolId: string): boolean

export declare function isSystemChunk(item: any): boolean

export declare function isSystemOptionalChunk(item: any): boolean

export declare function isSystemRootChunk(item: any): boolean

export declare function isSystemToolId(toolId: string): boolean

export declare function jsonExt(): string

/**
 * # Errors
 * Returns an error when the catalog directory cannot be read or parsed.
 */
export declare function loadCatalog(dirPath: string): any

/**
 * # Errors
 *
 * Returns an error when the catalog directory is invalid or files cannot be read.
 */
export declare function loadSkillsIndexFromDirNapi(catalogDir: string): Record<string, any>

export declare function mcpRequiredEnumValues(data: any): Array<string>

export declare function mcpToolsPassThrough(ctx: PolicyContext): boolean

export declare function mdExt(): string

/**
 * # Errors
 *
 * Does not fail; always returns a tree structure for the given markdown.
 */
export declare function mdToTreeNapi(markdownContent: string, sourcePath: string, config?: PageIndexConfigNapi | undefined | null): any

export declare function mergeCatalog(processed: any, pinned: any): any

export declare function mergeToolsPreservingOrder(original: Array<any>, prunedByName: Record<string, any>, stashedByName: Record<string, any>): Array<any>

export declare function mitigateEmptyOptionalProperties(entries: Array<any>, catalogIndex: any, ctx: PolicyContext, postRerankScored: any | undefined | null, pipeline: Array<string>): Array<any>

export declare function needsDescriptionReinstate(ctx: PolicyContext): boolean

export declare function needsPartition(ctx: PolicyContext): boolean

export declare function needsPrunedRecompose(ctx: PolicyContext): boolean

export declare function optionalLeafSurvivedRerank(item: any, ctx: PolicyContext, rerankScore?: number | undefined | null, llmSelectedPaths?: Array<string> | undefined | null): boolean

export interface PageIndexConfigNapi {
  ifAddNodeId?: boolean
  ifAddNodeText?: boolean
  enableBm25Chunking?: boolean
  bm25Cohesion?: any
}

/**
 * # Errors
 *
 * Returns an error when the chunk-id spec format is invalid.
 */
export declare function parseSkillChunkIdsNapi(spec: string): Array<number>

/**
 * # Errors
 *
 * Returns an error when the node-id spec format is invalid.
 */
export declare function parseSkillNodeIdsNapi(spec: string): Array<number>

/**
 * # Errors
 * Does not fail; returns empty partitions for invalid catalog shapes.
 */
export declare function partitionCatalog(data: any, ctx: PolicyContext): [any, any]

export declare function pathBuilderMemoryOnly(): boolean

export interface PathConfigNapi {
  mdExt: string
  jsonExt: string
  decomposedPrefix: string
  decomposedRoot: string
  catalogPrefix: string
  builderMemoryOnly: boolean
  defaultCatalogDir: string
  writeCatalogPrune: boolean
}

export declare function pathDefaultCatalogDir(): string

export declare function pathWriteCatalogPrune(): boolean

export declare function policyContextFromValues(config: any): PolicyContext

export interface PolicyContextJs {
  systemPolicy?: string
  mcpPolicy?: string
  perTool?: Record<string, string>
}

export interface PolicyOptions {
  pruneOptionalTools?: Array<string>
  systemPreserve?: Array<string>
  mcpPreserve?: Array<string>
  requiredByTool?: Record<string, Array<string>>
  requiredEnumValuesByTool?: Record<string, Array<string>>
}

/**
 * # Errors
 * Does not fail; invalid schema fragments are omitted from the entry.
 */
export declare function prepareToolEntry(serverName: string, name: string, description: string, inputSchema: any): any

export interface ReconstructOptionsNapi {
  keepAllHeaders?: boolean
}

/**
 * # Errors
 *
 * Returns an error when specs are invalid or the document is missing.
 */
export declare function reconstructSkillMarkdownNapi(index: any, docId: string, lineNumSpecs?: Array<string> | undefined | null, nodeIdSpecs?: Array<string> | undefined | null, chunkIdSpecs?: Array<string> | undefined | null, options?: ReconstructOptionsNapi | undefined | null): any

/**
 * # Errors
 * Does not fail; missing catalog sections are treated as empty.
 */
export declare function removedChunks(fullCatalog: any, surviving: any, applyDecomposedScoreFilter?: boolean | undefined | null): any

export declare function requestPassThrough(ctx: PolicyContext, tools: Array<any>): boolean

export declare function requiredEnumValuesByTool(data: any): Record<string, Array<string>>

export declare function rerankScore(): number

export declare function restoreMcpTools(stash: Array<any>): Array<any>

export declare function restoreSystemTools(stash: Array<any>): Array<any>

/**
 * # Errors
 * Does not fail; malformed survivor or store entries are skipped.
 */
export declare function retrieveCore(data: any, storeJsonFiles: Record<string, any>, survivorJsonFiles: Record<string, any>, applyDecomposedScoreFilter?: boolean | undefined | null, policyOptions?: PolicyOptions | undefined | null): Array<any>

/**
 * # Errors
 * Does not fail; missing catalog data is treated as empty.
 */
export declare function retrieveTools(data: any, catalog: any, applyDecomposedScoreFilter?: boolean | undefined | null, preserveValues?: Array<string> | undefined | null, policyCtx?: PolicyContextNapi | PolicyContextJs | undefined | null): Array<any>

export declare function rootChunkPropertiesEmpty(item: any): boolean

export declare function rootToolIdFromChunk(item: any): string

/**
 * # Errors
 * Returns an error when `policy` is not a recognized tool policy name.
 */
export declare function scoringPolicy(policy: string): string

/**
 * # Errors
 *
 * Returns an error when the decomposed directory is missing or contains no documents.
 */
export declare function skillsIndexFromDecomposedDirNapi(dir: string): Record<string, any>

export declare function splitAnthropicTools(tools: Array<any>): SplitAnthropicToolsResult

export interface SplitAnthropicToolsResult {
  nonSystem: Array<any>
  system: Array<any>
}

export declare function stashMcpTools(tools: Array<any>): Array<any>

export declare function stashSystemTools(tools: Array<any>): Array<any>

export declare function systemRequiredEnumValues(data: any): Array<string>

export declare function systemToolsPassThrough(ctx: PolicyContext): boolean

export declare function toDecomposedKey(filePath: string): string | null

export declare function toolIdFromDecomposedRel(relPath: string): string

export declare function toolIdHadEmptyOriginalRootProperties(catalogIndex: any, toolId: string): boolean

export declare function toolIdHasEmptyDecomposedRoot(catalogIndex: any, toolId: string): boolean

export declare function toolPassThrough(ctx: PolicyContext, toolId: string): boolean

export declare function toolPolicies(): Array<string>

export declare function toolsForCatalog(ctx: PolicyContext, tools: Array<any>): Array<any>

export declare function truncateDescription(description: string, maxTokens?: number | undefined | null): string

/**
 * # Errors
 * Returns an error when the output directory cannot be created or catalog files cannot be written.
 */
export declare function writeCatalogIndex(index: any, outputDir?: string | undefined | null, prune?: boolean | undefined | null): void

/**
 * # Errors
 *
 * Returns an error when reconstruction fails or the file cannot be written.
 */
export declare function writeReconstructedSkillNapi(catalogDir: string, index: any, docId: string, lineNumSpecs?: Array<string> | undefined | null, nodeIdSpecs?: Array<string> | undefined | null, chunkIdSpecs?: Array<string> | undefined | null, options?: ReconstructOptionsNapi | undefined | null): string

/**
 * # Errors
 *
 * Returns an error when the index shape is invalid or files cannot be written.
 */
export declare function writeSkillsIndexNapi(index: any, outputDir: string): void
