/** Open Knowledge Format discovery and AgentXM-profile validation (v0.2). */ import * as Effect from "effect/Effect"; import * as FileSystem from "effect/FileSystem"; import * as Path from "effect/Path"; import { FrontmatterParseFailure } from "../extensions/frontmatter.js"; import { type KnowledgeSearchQuery } from "./knowledge-search.js"; /** OKF dialect versions this inspector understands. */ export type OkfVersion = "0.2"; /** Actor that produced or confirmed a concept, per the OKF actor convention. */ export interface KnowledgeActorRecord { readonly by: string; readonly at?: string; } /** * Trust tier derived from `verified`, per OKF 0.2. A concept is * `human-reviewed` when any verifier is a `human:` actor, * `machine-confirmed` when verified only by non-human actors, and * `unverified` when `verified` is absent. */ export type KnowledgeTrustTier = "unverified" | "machine-confirmed" | "human-reviewed"; export type KnowledgeDocumentKind = "concept" | "index" | "log"; /** An authored Markdown link and the bundle-local concept it resolves to, when any. */ export interface KnowledgeAuthoredLink { readonly target: string; readonly line: number; readonly resolvedConceptId?: string; } export interface KnowledgeConcept { readonly id: string; readonly kind: KnowledgeDocumentKind; readonly title: string; /** The authored level-one heading, absent when `title` fell back to the concept ID. */ readonly authoredTitle?: string; readonly frontmatter?: Readonly>; readonly type?: string; readonly description?: string; readonly tags?: ReadonlyArray; readonly resource?: string; readonly status?: string; readonly staleAfter?: string; readonly generated?: KnowledgeActorRecord; readonly verified?: ReadonlyArray; readonly trust?: KnowledgeTrustTier; readonly authoredLinks: ReadonlyArray; readonly relativePath: string; readonly body: string; } export declare const KNOWLEDGE_DIAGNOSTIC_CODES: readonly ["bundle-too-large", "file-too-large", "invalid-tags", "missing-root-index", "missing-okf-version", "missing-title", "missing-description", "missing-manifest-description", "empty-bundle", "missing-tags", "symbolic-link", "too-many-files", "unsupported-okf-version", "missing-type", "invalid-frontmatter", "case-collision", "dangerous-uri", "detected-secret", "unsafe-path", "invalid-index", "invalid-log", "invalid-resource", "escaping-resource", "unresolved-resource", "broken-internal-link", "escaping-link", "unreachable-concept", "missing-index-entry", "stale-index-entry", "embedded-html", "duplicate-resource", "inconsistent-type", "large-concept", "large-index", "unreferenced-asset", "invalid-sources", "invalid-generated", "invalid-verified", "invalid-status", "invalid-stale-after", "invalid-attestation"]; export type KnowledgeDiagnosticCode = (typeof KNOWLEDGE_DIAGNOSTIC_CODES)[number]; export interface KnowledgeFrontmatterParseDetails { readonly kind: "frontmatter-parse"; readonly reason: string; } export interface KnowledgeDiagnostic { readonly code: KnowledgeDiagnosticCode; readonly severity: "error" | "warning"; readonly relativePath: string; readonly line?: number; readonly column?: number; readonly message: string; readonly details?: KnowledgeFrontmatterParseDetails; } /** Convert a typed frontmatter failure into the stable Knowledge diagnostic contract. */ export declare const frontmatterParseDiagnostic: (relativePath: string, failure: FrontmatterParseFailure) => KnowledgeDiagnostic; export interface KnowledgeInspection { readonly concepts: ReadonlyArray; readonly diagnostics: ReadonlyArray; /** Canonical dialect required at the bundle root. */ readonly okfVersion: OkfVersion; } export interface KnowledgeBundleEntry { readonly relativePath: string; readonly type: FileSystem.File.Type; readonly size: bigint; } /** Collect a bundle's normalized entry inventory without following symbolic links. */ export declare const collectKnowledgeBundleEntries: (sourceRoot: string) => Effect.Effect, unknown, FileSystem.FileSystem | Path.Path>; /** * Inspect a canonical OKF 0.2 bundle. The root index requirement is an explicit * AgentXM profile constraint; upstream OKF permits a root without it. */ export declare const inspectKnowledgeEntries: (entries: ReadonlyArray, readMarkdown: (relativePath: string) => Effect.Effect) => Effect.Effect; export declare const inspectKnowledgeBundle: (sourceRoot: string) => Effect.Effect; export declare const searchKnowledgeConcepts: (concepts: ReadonlyArray, query: KnowledgeSearchQuery) => ReadonlyArray; export declare const openKnowledgeConcept: (concepts: ReadonlyArray, id: string) => KnowledgeConcept | undefined; //# sourceMappingURL=okf.d.ts.map