Indexing API¶
The CLI adds effect-approval gates around these functions. Direct callers must implement equivalent authorization for network access, deletion, empty-corpus publication, and configuration migration.
.. py:class:: PreparedIndex(config: ‘SteadlithConfig’, expected_generation: ‘int’, old_manifest: ‘CorpusManifest | None’, target_manifest: ‘CorpusManifest’, documents: ‘Mapping[str, BuiltDocument]’, plan: ‘IndexPlan’, model_id: ‘str’, params_hash: ‘str’, embed_all: ‘bool’)
- module:
steadlith.index.service
.. py:class:: ApplyResult(plan: ‘IndexPlan’, active_chunks: ‘int’, tombstoned_chunks: ‘int’, cache_hits: ‘int’, embedded_chunks: ‘int’, embedded_tokens: ‘int’)
- module:
steadlith.index.service
.. py:function:: prepare_index(config, paths=(), *, chunker_strategy=None, embedding_model=None, force_embed_all=False)
- module:
steadlith.index.service
Read sources and durable state, then return a plan without writing anything.
.. py:function:: apply_prepared(prepared)
- module:
steadlith.index.service
Embed missing content, then atomically publish the target index snapshot.
.. py:function:: index_status(config)
- module:
steadlith.index.service
.. py:function:: query_index(config, text, *, limit=5)
- module:
steadlith.index.service
Embed a query with the indexed model and return ranked active chunks.
.. py:function:: compact_index(config, *, before=None, dry_run=False)
- module:
steadlith.index.service
.. py:function:: verify_index(config)
- module:
steadlith.index.service
Plan models¶
.. py:class:: IndexPlan(old_root: ‘str | None’, new_root: ‘str’, operations: ‘tuple[PlanOperation, …]’, cost: ‘CostEstimate’, old_chunks: ‘int’, new_chunks: ‘int’, requires_apply: ‘bool’)
- module:
steadlith.index.plan
.. py:class:: PlanOperation(kind: ‘OperationKind’, document_id: ‘str’, chunk_hash: ‘str’, old_position: ‘int | None’ = None, new_position: ‘int | None’ = None, old_chunk: ‘ChunkRecord | None’ = None, new_chunk: ‘ChunkRecord | None’ = None)
- module:
steadlith.index.plan
.. py:class:: CostEstimate(cache_hits: ‘int’, chunks_to_embed: ‘int’, tokens_to_embed: ‘int’, estimated_cost: ‘float | None’, naive_chunks_to_embed: ‘int’, naive_tokens_to_embed: ‘int’, naive_estimated_cost: ‘float | None’)
- module:
steadlith.index.plan