Surface-only PR (no behavior wiring — that's PR-9c-2):
- kebab-core: RefusalReason::NliVerificationFailed + NliModelUnavailable (serde rename_all="snake_case", wire = identical strings).
- kebab-core: Answer.verification: Option<VerificationSummary> field (additive minor wire — pre-v0.18 reader 무영향).
- kebab-core: VerificationSummary { nli_score: f32, nli_threshold: f32, nli_passed: bool } struct + lib.rs 재-export.
- kebab-config: NliCfg { model, provider } + ModelsCfg.nli (default Xenova/mDeBERTa-v3-base-xnli-multilingual-nli-2mil7).
- kebab-config: RagCfg.nli_threshold: f32 (default 0.0 = disabled, spec §2.6 single gate).
- kebab-config: env override KEBAB_MODELS_NLI_MODEL/PROVIDER + KEBAB_RAG_NLI_THRESHOLD (parse 실패 시 tracing::warn + default 유지).
- kebab-rag: RagPipeline.verifier: Option<Arc<dyn NliVerifier>> field + with_verifier builder (모두 #[allow(dead_code)] — PR-9c-2 의 step 8.5 hook 가 활성화 시 제거). RagPipeline::new signature 유지 (round-2 NEW-M1 Option B).
- kebab-rag: Cargo.toml 에 kebab-nli path 의존 추가.
- kebab-store-sqlite + kebab-tui: 두 신규 RefusalReason variant 에 대한 exhaustive match arm 추가 (snake_case label / 표시 문구).
- 모든 Answer 구축 site (rag 6 + cli/tui/eval 3 fixture) 에 verification: None 추가.
- wire schemas: answer.schema.json verification field + \$defs.VerificationSummary + refusal_reason.enum 2 추가. error.schema.json code.enum + details.description 2 추가 (forward-looking reserved).
- docs/ARCHITECTURE.md: Mermaid Adapters subgraph 의 nli 노드 + rag→nli + app→nli (forward-looking) + nli→config edges. nli→core edge 는 skip (kebab-nli/Cargo.toml direct dep 가 config 만, ARCHITECTURE 컨벤션 = direct deps only). 디렉토리 트리에 crates/kebab-nli/ 추가.
Tests: kebab-core 3 (serde rename + verification skip + struct shape) + kebab-config 6 (defaults + legacy + env + malformed env) + kebab-cli wire 5 (schema verification + enum 검증).
검증: cargo test --workspace -j 1 회귀 0 (pre-existing kebab-mcp::tools_call_ask_multi_hop flaky 1개 동일 — spec 에 명시된 known-flaky). cargo clippy --workspace --all-targets -D warnings clean.
Wire 영향: additive minor — answer.v1 의 verification optional + refusal_reason.enum 확장 + error.v1.code 확장.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
74 lines
2.7 KiB
Rust
74 lines
2.7 KiB
Rust
//! `kb-core` — frozen domain types, traits, and ID recipe.
|
|
//!
|
|
//! Per design §3, §4, §7. This crate has zero dependencies on any other
|
|
//! `kb-*` crate, so every other crate in the workspace can depend on it
|
|
//! freely.
|
|
//!
|
|
//! See `docs/superpowers/specs/2026-04-27-kebab-final-form-design.md` for
|
|
//! the canonical type bodies — this crate is the byte-for-byte mirror.
|
|
|
|
pub mod ids;
|
|
pub mod versions;
|
|
pub mod media;
|
|
pub mod asset;
|
|
pub mod document;
|
|
pub mod chunk;
|
|
pub mod citation;
|
|
pub mod metadata;
|
|
pub mod search;
|
|
pub mod answer;
|
|
pub mod ingest;
|
|
pub mod jobs;
|
|
pub mod vector;
|
|
pub mod errors;
|
|
pub mod traits;
|
|
pub mod normalize;
|
|
pub mod fetch;
|
|
|
|
// Re-export the most commonly used items at the crate root, mirroring the
|
|
// public surface listed in the task spec.
|
|
|
|
pub use ids::{
|
|
AssetId, BlockId, ChunkId, DocumentId, EmbeddingId, IndexId,
|
|
id_for_asset, id_for_block, id_for_chunk, id_for_doc, id_for_embedding,
|
|
id_for_index, id_from,
|
|
};
|
|
pub use versions::{
|
|
ChunkerVersion, EmbeddingModelId, EmbeddingVersion, IndexVersion,
|
|
ParserVersion, PromptTemplateVersion, SchemaVersion,
|
|
};
|
|
pub use media::{AudioType, Checksum, ImageType, Lang, MediaType};
|
|
pub use asset::{AssetStorage, RawAsset, SourceUri, WorkspacePath};
|
|
pub use document::{
|
|
AudioRefBlock, Block, CanonicalDocument, CodeBlock, CommonBlock,
|
|
HeadingBlock, ImageRefBlock, Inline, ListBlock, ModelCaption, OcrRegion,
|
|
OcrText, SourceSpan, TableBlock, TextBlock, Transcript, TranscriptSegment,
|
|
};
|
|
pub use chunk::Chunk;
|
|
pub use citation::Citation;
|
|
pub use metadata::{
|
|
Metadata, Provenance, ProvenanceEvent, ProvenanceKind, SourceType,
|
|
TrustLevel,
|
|
};
|
|
pub use search::{
|
|
BulkSearchItem, BulkSearchResponse, BulkSearchSummary, DocFilter, DocSummary, IndexBytes, MEDIA_KINDS,
|
|
RetrievalDetail, ScoreKind, SearchFilters, SearchHit, SearchMode, SearchOpts, SearchQuery, SearchTrace,
|
|
TraceCandidate, TraceFusionInput, TraceTiming,
|
|
};
|
|
pub use answer::{
|
|
Answer, AnswerCitation, AnswerRetrievalSummary, HopKind, HopRecord, ModelRef,
|
|
RefusalReason, TokenUsage, TraceId, Turn, VerificationSummary,
|
|
};
|
|
pub use ingest::{IngestItem, IngestItemKind, IngestReport, SkipExamples};
|
|
pub use jobs::{JobFilter, JobId, JobKind, JobRow, JobStatus};
|
|
pub use vector::{VectorHit, VectorRecord};
|
|
pub use errors::CoreError;
|
|
pub use traits::{
|
|
ChatSessionRepo, ChatSessionRow, ChatTurnRow, ChunkPolicy, Chunker, DocumentStore,
|
|
Embedder, EmbeddingInput, EmbeddingKind, ExtractConfig, ExtractContext, Extractor,
|
|
FinishReason, GenerateRequest, JobRepo, LanguageModel, Retriever, SourceConnector,
|
|
SourceScope, TokenChunk, VectorStore,
|
|
};
|
|
pub use normalize::{nfc, to_posix};
|
|
pub use fetch::{FetchKind, FetchOpts, FetchQuery, FetchResult};
|