summa-client-typescript 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1071 @@
1
+ import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
2
+ export declare const protobufPackage = "summa";
3
+ /** Method for fusing sub-query result lists */
4
+ export declare enum FusionMethod {
5
+ /** FUSION_RRF - Reciprocal Rank Fusion (rank-based, default) */
6
+ FUSION_RRF = 0,
7
+ /** FUSION_NORMALIZED_WEIGHTED_SUM - Min-max normalized weighted score sum */
8
+ FUSION_NORMALIZED_WEIGHTED_SUM = 1,
9
+ /** FUSION_CANDIDATES - Return complete bounded nomination lists/union for coordinator-side fusion. */
10
+ FUSION_CANDIDATES = 2,
11
+ UNRECOGNIZED = -1
12
+ }
13
+ export declare function fusionMethodFromJSON(object: any): FusionMethod;
14
+ export declare function fusionMethodToJSON(object: FusionMethod): string;
15
+ /** Scope is explicit: document features never become body ordinal zero. */
16
+ export declare enum ScoreScope {
17
+ SCORE_SCOPE_UNSPECIFIED = 0,
18
+ SCORE_SCOPE_DOCUMENT = 1,
19
+ SCORE_SCOPE_CHUNK = 2,
20
+ UNRECOGNIZED = -1
21
+ }
22
+ export declare function scoreScopeFromJSON(object: any): ScoreScope;
23
+ export declare function scoreScopeToJSON(object: ScoreScope): string;
24
+ /** How to combine scores for multi-valued documents */
25
+ export declare enum MultiValueCombiner {
26
+ /** COMBINER_LOG_SUM_EXP - Softmax-weighted smooth maximum (default); count-invariant */
27
+ COMBINER_LOG_SUM_EXP = 0,
28
+ /** COMBINER_MAX - Take maximum score */
29
+ COMBINER_MAX = 1,
30
+ /** COMBINER_AVG - Average all scores */
31
+ COMBINER_AVG = 2,
32
+ /** COMBINER_SUM - Sum all scores */
33
+ COMBINER_SUM = 3,
34
+ /** COMBINER_WEIGHTED_TOP_K - Weighted top-k with decay */
35
+ COMBINER_WEIGHTED_TOP_K = 4,
36
+ UNRECOGNIZED = -1
37
+ }
38
+ export declare function multiValueCombinerFromJSON(object: any): MultiValueCombiner;
39
+ export declare function multiValueCombinerToJSON(object: MultiValueCombiner): string;
40
+ export declare enum VectorIndexAlterState {
41
+ VECTOR_INDEX_ALTER_STATE_UNSPECIFIED = 0,
42
+ VECTOR_INDEX_ALTER_STATE_BUILT = 1,
43
+ VECTOR_INDEX_ALTER_STATE_DEFERRED_FLAT = 2,
44
+ VECTOR_INDEX_ALTER_STATE_PARAMETERS_ONLY = 3,
45
+ UNRECOGNIZED = -1
46
+ }
47
+ export declare function vectorIndexAlterStateFromJSON(object: any): VectorIndexAlterState;
48
+ export declare function vectorIndexAlterStateToJSON(object: VectorIndexAlterState): string;
49
+ /** Query types */
50
+ export interface Query {
51
+ term?: TermQuery | undefined;
52
+ boolean?: BooleanQuery | undefined;
53
+ boost?: BoostQuery | undefined;
54
+ all?: AllQuery | undefined;
55
+ sparseVector?: SparseVectorQuery | undefined;
56
+ denseVector?: DenseVectorQuery | undefined;
57
+ match?: MatchQuery | undefined;
58
+ range?: RangeQuery | undefined;
59
+ prefix?: PrefixQuery | undefined;
60
+ binaryDenseVector?: BinaryDenseVectorQuery | undefined;
61
+ /** Top-level only (cannot be nested) */
62
+ fusion?: FusionQuery | undefined;
63
+ phrase?: PhraseQuery | undefined;
64
+ }
65
+ /** Weighted sub-query for hybrid fusion */
66
+ export interface WeightedQuery {
67
+ query: Query | undefined;
68
+ /** Legacy RRF/NWS contribution; 0 or unset = 1.0 */
69
+ weight: number;
70
+ /** Required, unique feature identity when l1 or score_export is supplied. */
71
+ name: string;
72
+ scope: ScoreScope;
73
+ /** Backfill this branch without using it to nominate candidates (L1/export only). */
74
+ scoreOnly: boolean;
75
+ }
76
+ /**
77
+ * Union fusion of independently-executed sub-queries (e.g. sparse + dense
78
+ * hybrid retrieval). Unlike the reranker (which can only re-score documents
79
+ * the first-stage query found), fusion keeps documents found by ANY
80
+ * sub-query. Only valid at the top level of SearchRequest.query; composes
81
+ * with SearchRequest.reranker (the fused list becomes the L1 candidates).
82
+ */
83
+ export interface FusionQuery {
84
+ queries: WeightedQuery[];
85
+ method: FusionMethod;
86
+ /** RRF rank constant; 0 = default 60 */
87
+ rrfK: number;
88
+ /**
89
+ * Combiner for fused per-chunk (ordinal) scores into a document score.
90
+ * Fusion runs at chunk granularity: same-chunk hits across sub-queries
91
+ * compound, and results carry per-chunk ordinal_scores.
92
+ * Unset (0) = MAX (recommended; LogSumExp is unsuitable at RRF magnitudes).
93
+ */
94
+ combiner: MultiValueCombiner;
95
+ /** Common document eligibility for every branch. Does not create an L1 feature. */
96
+ filters: Query[];
97
+ /**
98
+ * Independent per-branch nomination depth (L1/export only). 0 uses
99
+ * candidate_limit. The complete union survives until L1 ranking/export.
100
+ */
101
+ candidateDepth: number;
102
+ }
103
+ /**
104
+ * Fixed preprocessing trained offline, never derived from a shard/result page.
105
+ * The only L1 scoring contract: a compiled symbolic formula over branch scores.
106
+ */
107
+ export interface L1Ranking {
108
+ /** Omitted=true: backfill only missing raw cells. False uses organic values. */
109
+ backfill?: boolean | undefined;
110
+ /** Raw defaults for missing formula variables; omitted variables use zero. */
111
+ missingValues: {
112
+ [key: string]: number;
113
+ };
114
+ /**
115
+ * Required, nonempty expression over named raw scores and reserved `rrf`.
116
+ * Runs before passage/document selection. Requires formula_v1.
117
+ */
118
+ formula: string;
119
+ }
120
+ export interface L1Ranking_MissingValuesEntry {
121
+ key: string;
122
+ value: number;
123
+ }
124
+ export interface ScoreExport {
125
+ /**
126
+ * Maximum raw passage rows per hit; 0 = all (65536). With l1, exported rows
127
+ * are the best passages after complete scoring. Without l1, exceeding this
128
+ * bound fails instead of silently omitting features the caller needs to rank.
129
+ */
130
+ passagesPerDocument: number;
131
+ /**
132
+ * Diagnostics: score every stored passage of nominated documents. Default
133
+ * false scores the union of nominated passages only, plus document context.
134
+ */
135
+ allPassages: boolean;
136
+ /**
137
+ * Capability 4: score real body ordinals for document-only nominees.
138
+ * Requires backfill and a chunk-scoped feature. Existing body nominations
139
+ * retain their original passage union; no organic votes are fabricated.
140
+ */
141
+ seedDocumentPassages: boolean;
142
+ }
143
+ /**
144
+ * Sparse vector query for similarity search
145
+ * Either provide (indices, values) directly, or provide text for server-side tokenization
146
+ */
147
+ export interface SparseVectorQuery {
148
+ field: string;
149
+ /** Pre-computed token indices */
150
+ indices: number[];
151
+ /** Pre-computed token values */
152
+ values: number[];
153
+ /** Raw text (tokenized server-side if tokenizer configured) */
154
+ text: string;
155
+ /** How to combine scores for multi-value fields */
156
+ combiner: MultiValueCombiner;
157
+ /** BMP/MaxScore pruning factor (0 = schema default, 1 = exact). */
158
+ heapFactor: number;
159
+ /** Temperature for LogSumExp (default: 1.5) */
160
+ combinerTemperature: number;
161
+ /** K for WeightedTopK (default: 5) */
162
+ combinerTopK: number;
163
+ /** Decay for WeightedTopK (default: 0.7) */
164
+ combinerDecay: number;
165
+ /** Min abs(weight) for query dims (0 = no filtering) */
166
+ weightThreshold: number;
167
+ /** Max query dimensions to process (0 = all) */
168
+ maxQueryDims: number;
169
+ /** Fraction of query dims to keep (0 = no pruning, 0.1 = top 10%) */
170
+ pruning: number;
171
+ /** BMP LSP gamma (unset = depth-derived, 0 = exhaustive). */
172
+ lspGamma?: number | undefined;
173
+ /** Nomination query dimensions (1..64) */
174
+ seismicCut?: number | undefined;
175
+ /** Summary pruning factor (0..1) */
176
+ seismicFactor?: number | undefined;
177
+ /** Exact shared-forward scan; false allows approximation */
178
+ exhaustive?: boolean | undefined;
179
+ }
180
+ /** Dense vector query for similarity search */
181
+ export interface DenseVectorQuery {
182
+ field: string;
183
+ vector: number[];
184
+ /** Number of clusters to probe (for IVF indexes) */
185
+ nprobe: number;
186
+ /** How to combine scores for multi-value fields */
187
+ combiner: MultiValueCombiner;
188
+ /** Temperature for LogSumExp (default: 1.5) */
189
+ combinerTemperature: number;
190
+ /** K for WeightedTopK (default: 5) */
191
+ combinerTopK: number;
192
+ /** Decay for WeightedTopK (default: 0.7) */
193
+ combinerDecay: number;
194
+ }
195
+ /** Binary dense vector query for Hamming distance search */
196
+ export interface BinaryDenseVectorQuery {
197
+ field: string;
198
+ /** Packed-bit query vector (ceil(dim/8) bytes) */
199
+ vector: Uint8Array;
200
+ /** How to combine scores for multi-value fields */
201
+ combiner: MultiValueCombiner;
202
+ combinerTemperature: number;
203
+ combinerTopK: number;
204
+ combinerDecay: number;
205
+ }
206
+ export interface TermQuery {
207
+ field: string;
208
+ term: string;
209
+ /** Optional hint for the field's tokenizer (see MatchQuery.tokenizer_hint) */
210
+ tokenizerHint: string;
211
+ }
212
+ export interface BooleanQuery {
213
+ must: Query[];
214
+ should: Query[];
215
+ mustNot: Query[];
216
+ }
217
+ export interface BoostQuery {
218
+ query: Query | undefined;
219
+ boost: number;
220
+ }
221
+ export interface AllQuery {
222
+ }
223
+ /**
224
+ * Range query on a fast field (inclusive bounds)
225
+ * Exactly one pair of bounds should be set (u64, i64, or f64)
226
+ */
227
+ export interface RangeQuery {
228
+ field: string;
229
+ minU64?: number | undefined;
230
+ maxU64?: number | undefined;
231
+ minI64?: number | undefined;
232
+ maxI64?: number | undefined;
233
+ minF64?: number | undefined;
234
+ maxF64?: number | undefined;
235
+ }
236
+ /**
237
+ * Full-text match query - tokenizes text server-side and searches as OR of tokens
238
+ * Use this instead of TermQuery when searching with natural language text
239
+ */
240
+ export interface MatchQuery {
241
+ field: string;
242
+ text: string;
243
+ /**
244
+ * Optional hint passed to the field's tokenizer. Static tokenizers ignore
245
+ * it; a `lex(by: languages, ...)` tokenizer
246
+ * reads it as a comma-separated list of language codes ("ru,en") and stems
247
+ * each query token with the first listed language of the token's script.
248
+ * Empty = the tokenizer's default.
249
+ */
250
+ tokenizerHint: string;
251
+ /**
252
+ * Proximity rescoring (sequential dependence): the top candidates of the
253
+ * BM25 pass gain a bonus for adjacent query terms occurring next to each
254
+ * other (ordered windows) or within `proximity_window` positions
255
+ * (unordered windows, half weight), scaled by this weight. 0 = off.
256
+ * Approximate: the bonus applies to an over-fetched candidate pool.
257
+ */
258
+ proximityWeight: number;
259
+ /** Unordered window size; 0 = 8. */
260
+ proximityWindow: number;
261
+ /**
262
+ * Approximate MaxScore: scale the pruning threshold by 1/heap_factor
263
+ * (0/unset or 1 = exact, rank-safe; 0.8 prunes more aggressively at some
264
+ * recall cost). Must be finite and in [0, 1]. This option applies to text queries.
265
+ */
266
+ heapFactor: number;
267
+ /**
268
+ * Long queries: keep only the `max_terms` rarest (highest idf) tokens for
269
+ * scoring; 0 = all tokens. Approximate.
270
+ */
271
+ maxTerms: number;
272
+ }
273
+ /**
274
+ * Phrase query - text is tokenized server-side with the field's tokenizer
275
+ * (so stemming matches indexing) and the terms must occur at the distances
276
+ * the tokenizer assigned (consecutively unless the tokenizer dropped stop
277
+ * words between them, whose positions are kept as gaps) or within `slop`
278
+ * positions of that. Requires the field to be indexed with token positions
279
+ * (`indexed<token_position>` or `indexed<positions>`); without positions the
280
+ * engine degrades to a MUST of the terms. Scored with BM25 over the phrase
281
+ * frequency (occurrences of the whole phrase) and the summed idf of its terms.
282
+ * A phrase whose words are all stop words is rejected standalone and dropped
283
+ * (with a server warning) when it is a clause of a BooleanQuery.
284
+ */
285
+ export interface PhraseQuery {
286
+ field: string;
287
+ text: string;
288
+ slop: number;
289
+ /** See MatchQuery.tokenizer_hint */
290
+ tokenizerHint: string;
291
+ }
292
+ /**
293
+ * Prefix query - matches all documents containing any term starting with prefix
294
+ * Score is always 1.0 (filter-style). Efficient as a MUST clause in BooleanQuery.
295
+ */
296
+ export interface PrefixQuery {
297
+ field: string;
298
+ prefix: string;
299
+ }
300
+ /**
301
+ * L2 reranker: rerank L1 candidates by exact vector distance
302
+ * For dense vectors: set `vector` (f32). For binary dense vectors: set `binary_vector` (bytes).
303
+ */
304
+ export interface Reranker {
305
+ /** Vector field (dense or binary dense) */
306
+ field: string;
307
+ /** Query vector (f32, for dense fields) */
308
+ vector: number[];
309
+ combiner: MultiValueCombiner;
310
+ combinerTemperature: number;
311
+ combinerTopK: number;
312
+ combinerDecay: number;
313
+ /** Matryoshka pre-filter dims (0 = disabled) */
314
+ matryoshkaDims: number;
315
+ /** Query vector (packed bits, for binary dense fields) */
316
+ binaryVector: Uint8Array;
317
+ /** Reciprocal Rank Fusion k (0 = disabled, typical: 60) */
318
+ rrfK: number;
319
+ }
320
+ /** Search request/response */
321
+ export interface SearchRequest {
322
+ indexName: string;
323
+ query: Query | undefined;
324
+ limit: number;
325
+ offset: number;
326
+ fieldsToLoad: string[];
327
+ /** Optional L2 reranker */
328
+ reranker: Reranker | undefined;
329
+ /**
330
+ * First-stage candidate pool. 0 uses offset + limit; explicit values must
331
+ * be between offset + limit and the 2x ceiling.
332
+ */
333
+ candidateLimit: number;
334
+ /**
335
+ * Anytime mode: wall-clock budget in milliseconds for the scoring phase.
336
+ * Text (BM25) MaxScore executors stop at the deadline and return the best
337
+ * results found so far; `SearchResponse.truncated` reports that it fired.
338
+ * 0 = unbounded (exact top-k).
339
+ */
340
+ timeBudgetMs: number;
341
+ /**
342
+ * Cross-shard text statistics for BM25 (see `GetTextStats`). When set they
343
+ * replace the backend's own statistics for the listed fields and terms;
344
+ * unset = the backend aggregates over its own segments.
345
+ */
346
+ textStats: TextStats | undefined;
347
+ /** Requires named, scoped fusion branches. The formula may reference the RRF feature. */
348
+ l1: L1Ranking | undefined;
349
+ /**
350
+ * With no l1, exports the complete candidate union for external inference.
351
+ * Export-only requests require offset=0 and a limit covering the whole union.
352
+ */
353
+ scoreExport: ScoreExport | undefined;
354
+ /**
355
+ * Return RRF diagnostics alongside the requested ranking score. Requires
356
+ * top-level fusion and complete nomination; does not change ranking.
357
+ */
358
+ includeRrfScores: boolean;
359
+ /**
360
+ * Preserve bounded per-shard nomination and selection traces. Default false;
361
+ * does not rerun subqueries or change retrieval/ranking budgets.
362
+ */
363
+ tracing: boolean;
364
+ }
365
+ export interface GetTextStatsRequest {
366
+ indexName: string;
367
+ /**
368
+ * The query whose BM25 terms are collected (after this backend's own
369
+ * tokenization); sparse, dense and filter clauses contribute nothing.
370
+ */
371
+ query: Query | undefined;
372
+ }
373
+ export interface GetTextStatsResponse {
374
+ stats: TextStats | undefined;
375
+ }
376
+ /** BM25 statistics of a set of text terms. */
377
+ export interface TextStats {
378
+ /** Documents in the index (or the sum over shards). */
379
+ totalDocs: number;
380
+ fields: TextFieldStats[];
381
+ }
382
+ export interface TextFieldStats {
383
+ field: string;
384
+ /**
385
+ * Scoring units of the field: documents for a plain field, chunks for a
386
+ * chunked one.
387
+ */
388
+ corpusSize: number;
389
+ /** Average length of a scoring unit in tokens. */
390
+ avgLen: number;
391
+ terms: TermDocFreq[];
392
+ }
393
+ export interface TermDocFreq {
394
+ /** Index-time token bytes. */
395
+ term: Uint8Array;
396
+ docFreq: number;
397
+ }
398
+ /** Unique document address: segment + local doc_id */
399
+ export interface DocAddress {
400
+ /** Segment ID (hex, 32 chars) */
401
+ segmentId: string;
402
+ /** Segment-local document ID */
403
+ docId: number;
404
+ }
405
+ export interface SearchHit {
406
+ address: DocAddress | undefined;
407
+ score: number;
408
+ fields: {
409
+ [key: string]: FieldValueList;
410
+ };
411
+ /** Per-ordinal scores for multi-value fields */
412
+ ordinalScores: OrdinalScore[];
413
+ /** Present only when score_export is requested. */
414
+ candidateScores: CandidateScores | undefined;
415
+ /** Present when include_rrf_scores is requested. */
416
+ rrfScore?: number | undefined;
417
+ rrfContributions: RrfContribution[];
418
+ }
419
+ export interface SearchHit_FieldsEntry {
420
+ key: string;
421
+ value: FieldValueList | undefined;
422
+ }
423
+ /**
424
+ * One organic nomination vote. Document context has no ordinal; chunk votes
425
+ * are combined per ordinal before the document's fusion combiner is applied.
426
+ */
427
+ export interface RrfContribution {
428
+ queryIndex: number;
429
+ /** Empty for unnamed legacy branches. */
430
+ queryName: string;
431
+ /** One-based rank in the complete merged nomination list. */
432
+ rank: number;
433
+ /** Branch weight / (k + rank). */
434
+ score: number;
435
+ ordinal?: number | undefined;
436
+ }
437
+ export interface CandidateScores {
438
+ /**
439
+ * Branch name -> raw score. Absent key means unavailable indexed data;
440
+ * a valid nonmatch is explicitly 0. Negative dense scores are preserved.
441
+ */
442
+ document: {
443
+ [key: string]: number;
444
+ };
445
+ passages: PassageScores[];
446
+ /** Before limiting exported rows; L1 selected from all of these passages. */
447
+ scoredPassages: number;
448
+ }
449
+ export interface CandidateScores_DocumentEntry {
450
+ key: string;
451
+ value: number;
452
+ }
453
+ export interface PassageScores {
454
+ ordinal: number;
455
+ scores: {
456
+ [key: string]: number;
457
+ };
458
+ /** Final formula score when l1 is present, otherwise no ranking score. */
459
+ l1Score?: number | undefined;
460
+ }
461
+ export interface PassageScores_ScoresEntry {
462
+ key: string;
463
+ value: number;
464
+ }
465
+ /** List of field values — supports multi-value fields (e.g. multiple URIs per document) */
466
+ export interface FieldValueList {
467
+ values: FieldValue[];
468
+ }
469
+ /** Score contribution from a specific ordinal in a multi-valued field */
470
+ export interface OrdinalScore {
471
+ /** Which value in the multi-valued field (0-indexed) */
472
+ ordinal: number;
473
+ /** Score contribution from this ordinal */
474
+ score: number;
475
+ }
476
+ export interface FieldValue {
477
+ text?: string | undefined;
478
+ u64?: number | undefined;
479
+ i64?: number | undefined;
480
+ f64?: number | undefined;
481
+ bytesValue?: Uint8Array | undefined;
482
+ sparseVector?: SparseVector | undefined;
483
+ denseVector?: DenseVector | undefined;
484
+ /** JSON serialized as string */
485
+ jsonValue?: string | undefined;
486
+ /** Packed-bit binary vector */
487
+ binaryDenseVector?: Uint8Array | undefined;
488
+ }
489
+ /** Sparse vector with term indices and weights */
490
+ export interface SparseVector {
491
+ indices: number[];
492
+ values: number[];
493
+ }
494
+ /** Dense vector (float32 values) */
495
+ export interface DenseVector {
496
+ values: number[];
497
+ }
498
+ export interface SearchResponse {
499
+ hits: SearchHit[];
500
+ totalHits: number;
501
+ tookMs: number;
502
+ timings: SearchTimings | undefined;
503
+ /**
504
+ * True when `time_budget_ms` expired before every candidate was scored;
505
+ * the hits are then the best-so-far, not the exact top-k.
506
+ */
507
+ truncated: boolean;
508
+ /** Feature contracts: "formula_v1" or "feature_export_v2". */
509
+ rankingMethod: string;
510
+ /**
511
+ * Present for FUSION_CANDIDATES. Hits hold hydrated union entries once;
512
+ * these lists preserve independent branch scores and nominated ordinals.
513
+ */
514
+ fusionCandidates: FusionCandidateList[];
515
+ /** Present only when tracing is requested. */
516
+ trace: SearchTrace | undefined;
517
+ /**
518
+ * Capability 4 acknowledgment, true only when every backend honored the
519
+ * requested document-only passage seeding policy. Old adapters default false.
520
+ */
521
+ seededDocumentPassages: boolean;
522
+ }
523
+ export interface SearchTrace {
524
+ shards: ShardSearchTrace[];
525
+ }
526
+ export interface ShardSearchTrace {
527
+ /** Populated by the broker; empty on direct server calls. */
528
+ shardId: string;
529
+ backendId: string;
530
+ indexName: string;
531
+ queries: QueryTrace[];
532
+ /** Shard results before broker selection. */
533
+ selected: FusionCandidate[];
534
+ rankingMethod: string;
535
+ truncated: boolean;
536
+ /** Common fusion filters applied during nomination. */
537
+ filters: Query[];
538
+ }
539
+ export interface QueryTrace {
540
+ queryIndex: number;
541
+ queryName: string;
542
+ /** Original branch/root expression, including nested clauses. */
543
+ query: Query | undefined;
544
+ scope: ScoreScope;
545
+ scoreOnly: boolean;
546
+ candidateDepth: number;
547
+ totalSeen: number;
548
+ /** All organic nominations within the requested depth, before fusion/L1/L2. */
549
+ candidates: FusionCandidate[];
550
+ }
551
+ export interface FusionCandidateList {
552
+ queryIndex: number;
553
+ candidates: FusionCandidate[];
554
+ }
555
+ export interface FusionCandidate {
556
+ address: DocAddress | undefined;
557
+ score: number;
558
+ ordinalScores: OrdinalScore[];
559
+ }
560
+ /** Detailed timing breakdown for search phases (all values in microseconds) */
561
+ export interface SearchTimings {
562
+ /** L1 retrieval (query scoring across segments) */
563
+ searchUs: number;
564
+ /** L2 reranking (dense vector rescoring) */
565
+ rerankUs: number;
566
+ /** Document field loading from store */
567
+ loadUs: number;
568
+ /** Wall-clock total (includes overhead) */
569
+ totalUs: number;
570
+ /** Missing-only feature backfill and formula selection. */
571
+ candidateScoringUs: number;
572
+ }
573
+ /** Get document request/response */
574
+ export interface GetDocumentRequest {
575
+ indexName: string;
576
+ address: DocAddress | undefined;
577
+ }
578
+ export interface GetDocumentResponse {
579
+ fields: {
580
+ [key: string]: FieldValueList;
581
+ };
582
+ }
583
+ export interface GetDocumentResponse_FieldsEntry {
584
+ key: string;
585
+ value: FieldValueList | undefined;
586
+ }
587
+ /** Index info request/response */
588
+ export interface GetIndexInfoRequest {
589
+ indexName: string;
590
+ }
591
+ export interface GetIndexInfoResponse {
592
+ indexName: string;
593
+ numDocs: number;
594
+ numSegments: number;
595
+ /** Schema in SDL format */
596
+ schema: string;
597
+ /** Memory usage breakdown (if available) */
598
+ memoryStats: MemoryStats | undefined;
599
+ /** Per-field vector statistics */
600
+ vectorStats: VectorFieldStats[];
601
+ /**
602
+ * Per text field: how it is tokenized, so clients pick query forms
603
+ * without parsing the schema SDL.
604
+ */
605
+ textFields: TextFieldInfo[];
606
+ /** 3 requires symbolic L1 formula; preserves organic scores, optional backfill and raw defaults. */
607
+ candidateScoringVersion: number;
608
+ /** Fields requiring lookup preparation/migration. */
609
+ unpreparedCandidateFields: string[];
610
+ /** Includes tombstones; num_docs counts live rows. */
611
+ physicalNumDocs: number;
612
+ numDeletedDocs: number;
613
+ /** num_deleted_docs / physical_num_docs; zero for an empty index. */
614
+ deletedRatio: number;
615
+ }
616
+ /** Tokenization facts of one text field. */
617
+ export interface TextFieldInfo {
618
+ field: string;
619
+ /** The field uses a `lex(...)` tokenizer. */
620
+ lexical: boolean;
621
+ /**
622
+ * A `lex(by: <field>)` tokenizer: the query's `tokenizer_hint` selects
623
+ * the stemmer (empty when the field has no hint field).
624
+ */
625
+ hintField: string;
626
+ /**
627
+ * `lex(variants: true)`: the written word is indexed next to its stem and
628
+ * folded forms, so one clause per field suffices (phrases match the
629
+ * written form, match queries the stem).
630
+ */
631
+ variants: boolean;
632
+ /** Token positions are indexed, so phrase queries verify adjacency. */
633
+ positions: boolean;
634
+ /** `indexed<chunked>`: every value is its own BM25 unit with an ordinal. */
635
+ chunked: boolean;
636
+ }
637
+ /** Per-field vector statistics (dense or sparse) */
638
+ export interface VectorFieldStats {
639
+ fieldName: string;
640
+ /** "dense" or "sparse" */
641
+ vectorType: string;
642
+ totalVectors: number;
643
+ /** dim for dense, num_dimensions for sparse */
644
+ dimension: number;
645
+ /** sparse only: avg postings per vector (0 for dense) */
646
+ avgTermsPerVector: number;
647
+ }
648
+ /** Memory usage statistics */
649
+ export interface MemoryStats {
650
+ /** Total estimated memory usage in bytes */
651
+ totalBytes: number;
652
+ /** Indexing buffer memory (pending documents not yet flushed) */
653
+ indexingBuffer: IndexingBufferStats | undefined;
654
+ /** Segment reader memory (loaded for search) */
655
+ segmentReader: SegmentReaderStats | undefined;
656
+ }
657
+ /** Indexing buffer memory breakdown */
658
+ export interface IndexingBufferStats {
659
+ totalBytes: number;
660
+ postingsBytes: number;
661
+ sparseVectorsBytes: number;
662
+ denseVectorsBytes: number;
663
+ internerBytes: number;
664
+ positionIndexBytes: number;
665
+ pendingDocs: number;
666
+ uniqueTerms: number;
667
+ }
668
+ /**
669
+ * Segment-reader heap memory (search structures and decompressed caches).
670
+ * File-backed mappings and pinned residency are intentionally excluded:
671
+ * mapped file extent is not equivalent to resident memory.
672
+ */
673
+ export interface SegmentReaderStats {
674
+ totalBytes: number;
675
+ termDictCacheBytes: number;
676
+ storeCacheBytes: number;
677
+ sparseIndexBytes: number;
678
+ denseIndexBytes: number;
679
+ numSegmentsLoaded: number;
680
+ }
681
+ /** Create index request/response */
682
+ export interface CreateIndexRequest {
683
+ indexName: string;
684
+ /** Schema definition */
685
+ schema: string;
686
+ }
687
+ export interface CreateIndexResponse {
688
+ success: boolean;
689
+ }
690
+ /** Field entry for multi-value field support */
691
+ export interface FieldEntry {
692
+ name: string;
693
+ value: FieldValue | undefined;
694
+ }
695
+ /**
696
+ * Named document for batch indexing
697
+ * Uses repeated FieldEntry to support multi-value fields (same name, multiple values)
698
+ */
699
+ export interface NamedDocument {
700
+ fields: FieldEntry[];
701
+ }
702
+ /** Batch index documents request */
703
+ export interface BatchIndexDocumentsRequest {
704
+ indexName: string;
705
+ documents: NamedDocument[];
706
+ }
707
+ export interface BatchIndexDocumentsResponse {
708
+ indexedCount: number;
709
+ errorCount: number;
710
+ errors: DocumentError[];
711
+ }
712
+ /**
713
+ * Requests are bounded before conversion or writer admission. Both require a
714
+ * primary-key schema and an explicit Commit. No cross-partition transaction.
715
+ */
716
+ export interface DeleteDocumentsRequest {
717
+ indexName: string;
718
+ /** <=100,000 keys, <=8 MiB total key bytes */
719
+ primaryKeys: string[];
720
+ }
721
+ export interface UpsertDocumentsRequest {
722
+ indexName: string;
723
+ /** <=1,000 documents, <=32 MiB encoded request (<=200 MiB for one document) */
724
+ documents: NamedDocument[];
725
+ }
726
+ export interface DocumentMutationResponse {
727
+ /**
728
+ * Admitted operations, not affected rows. A missing deletion is accepted.
729
+ * Every input is accepted or has one error; Commit publishes accepted work.
730
+ */
731
+ acceptedCount: number;
732
+ errors: DocumentError[];
733
+ }
734
+ /** Per-document error detail (e.g. duplicate primary key) */
735
+ export interface DocumentError {
736
+ /** 0-based index in the request batch */
737
+ index: number;
738
+ /** Human-readable error message */
739
+ error: string;
740
+ }
741
+ /** Index document request/response */
742
+ export interface IndexDocumentRequest {
743
+ indexName: string;
744
+ fields: FieldEntry[];
745
+ }
746
+ export interface IndexDocumentsResponse {
747
+ indexedCount: number;
748
+ errors: DocumentError[];
749
+ }
750
+ /** Commit request/response */
751
+ export interface CommitRequest {
752
+ indexName: string;
753
+ }
754
+ export interface CommitResponse {
755
+ success: boolean;
756
+ numDocs: number;
757
+ }
758
+ /** Force merge request/response */
759
+ export interface ForceMergeRequest {
760
+ indexName: string;
761
+ /**
762
+ * Expensive physical removal of deleted rows, once per final output.
763
+ * Omitted/false copies encoded data and carries deletion masks unchanged.
764
+ */
765
+ compact: boolean;
766
+ }
767
+ export interface ForceMergeResponse {
768
+ success: boolean;
769
+ numSegments: number;
770
+ }
771
+ /** Delete index request/response */
772
+ export interface DeleteIndexRequest {
773
+ indexName: string;
774
+ }
775
+ export interface DeleteIndexResponse {
776
+ success: boolean;
777
+ }
778
+ /** List indexes request/response */
779
+ export interface ListIndexesRequest {
780
+ }
781
+ export interface ListIndexesResponse {
782
+ indexNames: string[];
783
+ }
784
+ /** Retrain vector index request/response */
785
+ export interface RetrainVectorIndexRequest {
786
+ indexName: string;
787
+ }
788
+ export interface RetrainVectorIndexResponse {
789
+ success: boolean;
790
+ }
791
+ export interface AlterVectorIndexRequest {
792
+ indexName: string;
793
+ fieldName: string;
794
+ /**
795
+ * SDL field type/options, for example:
796
+ * dense_vector<768, f16> [indexed<scann, tree_levels: 2, nprobe: 1024>]
797
+ */
798
+ fieldSchema: string;
799
+ }
800
+ export interface AlterVectorIndexResponse {
801
+ publicationGeneration: number;
802
+ state: VectorIndexAlterState;
803
+ }
804
+ /** Reorder request/response */
805
+ export interface ReorderRequest {
806
+ indexName: string;
807
+ }
808
+ export interface ReorderResponse {
809
+ success: boolean;
810
+ numSegments: number;
811
+ }
812
+ export declare const Query: MessageFns<Query>;
813
+ export declare const WeightedQuery: MessageFns<WeightedQuery>;
814
+ export declare const FusionQuery: MessageFns<FusionQuery>;
815
+ export declare const L1Ranking: MessageFns<L1Ranking>;
816
+ export declare const L1Ranking_MissingValuesEntry: MessageFns<L1Ranking_MissingValuesEntry>;
817
+ export declare const ScoreExport: MessageFns<ScoreExport>;
818
+ export declare const SparseVectorQuery: MessageFns<SparseVectorQuery>;
819
+ export declare const DenseVectorQuery: MessageFns<DenseVectorQuery>;
820
+ export declare const BinaryDenseVectorQuery: MessageFns<BinaryDenseVectorQuery>;
821
+ export declare const TermQuery: MessageFns<TermQuery>;
822
+ export declare const BooleanQuery: MessageFns<BooleanQuery>;
823
+ export declare const BoostQuery: MessageFns<BoostQuery>;
824
+ export declare const AllQuery: MessageFns<AllQuery>;
825
+ export declare const RangeQuery: MessageFns<RangeQuery>;
826
+ export declare const MatchQuery: MessageFns<MatchQuery>;
827
+ export declare const PhraseQuery: MessageFns<PhraseQuery>;
828
+ export declare const PrefixQuery: MessageFns<PrefixQuery>;
829
+ export declare const Reranker: MessageFns<Reranker>;
830
+ export declare const SearchRequest: MessageFns<SearchRequest>;
831
+ export declare const GetTextStatsRequest: MessageFns<GetTextStatsRequest>;
832
+ export declare const GetTextStatsResponse: MessageFns<GetTextStatsResponse>;
833
+ export declare const TextStats: MessageFns<TextStats>;
834
+ export declare const TextFieldStats: MessageFns<TextFieldStats>;
835
+ export declare const TermDocFreq: MessageFns<TermDocFreq>;
836
+ export declare const DocAddress: MessageFns<DocAddress>;
837
+ export declare const SearchHit: MessageFns<SearchHit>;
838
+ export declare const SearchHit_FieldsEntry: MessageFns<SearchHit_FieldsEntry>;
839
+ export declare const RrfContribution: MessageFns<RrfContribution>;
840
+ export declare const CandidateScores: MessageFns<CandidateScores>;
841
+ export declare const CandidateScores_DocumentEntry: MessageFns<CandidateScores_DocumentEntry>;
842
+ export declare const PassageScores: MessageFns<PassageScores>;
843
+ export declare const PassageScores_ScoresEntry: MessageFns<PassageScores_ScoresEntry>;
844
+ export declare const FieldValueList: MessageFns<FieldValueList>;
845
+ export declare const OrdinalScore: MessageFns<OrdinalScore>;
846
+ export declare const FieldValue: MessageFns<FieldValue>;
847
+ export declare const SparseVector: MessageFns<SparseVector>;
848
+ export declare const DenseVector: MessageFns<DenseVector>;
849
+ export declare const SearchResponse: MessageFns<SearchResponse>;
850
+ export declare const SearchTrace: MessageFns<SearchTrace>;
851
+ export declare const ShardSearchTrace: MessageFns<ShardSearchTrace>;
852
+ export declare const QueryTrace: MessageFns<QueryTrace>;
853
+ export declare const FusionCandidateList: MessageFns<FusionCandidateList>;
854
+ export declare const FusionCandidate: MessageFns<FusionCandidate>;
855
+ export declare const SearchTimings: MessageFns<SearchTimings>;
856
+ export declare const GetDocumentRequest: MessageFns<GetDocumentRequest>;
857
+ export declare const GetDocumentResponse: MessageFns<GetDocumentResponse>;
858
+ export declare const GetDocumentResponse_FieldsEntry: MessageFns<GetDocumentResponse_FieldsEntry>;
859
+ export declare const GetIndexInfoRequest: MessageFns<GetIndexInfoRequest>;
860
+ export declare const GetIndexInfoResponse: MessageFns<GetIndexInfoResponse>;
861
+ export declare const TextFieldInfo: MessageFns<TextFieldInfo>;
862
+ export declare const VectorFieldStats: MessageFns<VectorFieldStats>;
863
+ export declare const MemoryStats: MessageFns<MemoryStats>;
864
+ export declare const IndexingBufferStats: MessageFns<IndexingBufferStats>;
865
+ export declare const SegmentReaderStats: MessageFns<SegmentReaderStats>;
866
+ export declare const CreateIndexRequest: MessageFns<CreateIndexRequest>;
867
+ export declare const CreateIndexResponse: MessageFns<CreateIndexResponse>;
868
+ export declare const FieldEntry: MessageFns<FieldEntry>;
869
+ export declare const NamedDocument: MessageFns<NamedDocument>;
870
+ export declare const BatchIndexDocumentsRequest: MessageFns<BatchIndexDocumentsRequest>;
871
+ export declare const BatchIndexDocumentsResponse: MessageFns<BatchIndexDocumentsResponse>;
872
+ export declare const DeleteDocumentsRequest: MessageFns<DeleteDocumentsRequest>;
873
+ export declare const UpsertDocumentsRequest: MessageFns<UpsertDocumentsRequest>;
874
+ export declare const DocumentMutationResponse: MessageFns<DocumentMutationResponse>;
875
+ export declare const DocumentError: MessageFns<DocumentError>;
876
+ export declare const IndexDocumentRequest: MessageFns<IndexDocumentRequest>;
877
+ export declare const IndexDocumentsResponse: MessageFns<IndexDocumentsResponse>;
878
+ export declare const CommitRequest: MessageFns<CommitRequest>;
879
+ export declare const CommitResponse: MessageFns<CommitResponse>;
880
+ export declare const ForceMergeRequest: MessageFns<ForceMergeRequest>;
881
+ export declare const ForceMergeResponse: MessageFns<ForceMergeResponse>;
882
+ export declare const DeleteIndexRequest: MessageFns<DeleteIndexRequest>;
883
+ export declare const DeleteIndexResponse: MessageFns<DeleteIndexResponse>;
884
+ export declare const ListIndexesRequest: MessageFns<ListIndexesRequest>;
885
+ export declare const ListIndexesResponse: MessageFns<ListIndexesResponse>;
886
+ export declare const RetrainVectorIndexRequest: MessageFns<RetrainVectorIndexRequest>;
887
+ export declare const RetrainVectorIndexResponse: MessageFns<RetrainVectorIndexResponse>;
888
+ export declare const AlterVectorIndexRequest: MessageFns<AlterVectorIndexRequest>;
889
+ export declare const AlterVectorIndexResponse: MessageFns<AlterVectorIndexResponse>;
890
+ export declare const ReorderRequest: MessageFns<ReorderRequest>;
891
+ export declare const ReorderResponse: MessageFns<ReorderResponse>;
892
+ /** Search service */
893
+ export type SearchServiceDefinition = typeof SearchServiceDefinition;
894
+ export declare const SearchServiceDefinition: {
895
+ readonly name: "SearchService";
896
+ readonly fullName: "summa.SearchService";
897
+ readonly methods: {
898
+ /** Search for documents */
899
+ readonly search: {
900
+ readonly name: "Search";
901
+ readonly requestType: MessageFns<SearchRequest>;
902
+ readonly requestStream: false;
903
+ readonly responseType: MessageFns<SearchResponse>;
904
+ readonly responseStream: false;
905
+ readonly options: {};
906
+ };
907
+ /** Get document by ID */
908
+ readonly getDocument: {
909
+ readonly name: "GetDocument";
910
+ readonly requestType: MessageFns<GetDocumentRequest>;
911
+ readonly requestStream: false;
912
+ readonly responseType: MessageFns<GetDocumentResponse>;
913
+ readonly responseStream: false;
914
+ readonly options: {};
915
+ };
916
+ /** Get index info */
917
+ readonly getIndexInfo: {
918
+ readonly name: "GetIndexInfo";
919
+ readonly requestType: MessageFns<GetIndexInfoRequest>;
920
+ readonly requestStream: false;
921
+ readonly responseType: MessageFns<GetIndexInfoResponse>;
922
+ readonly responseStream: false;
923
+ readonly options: {};
924
+ };
925
+ /**
926
+ * Text statistics (document frequencies, corpus sizes, average lengths)
927
+ * of the BM25 terms of a query over this backend's index. A broker that
928
+ * scatters one index over several shards sums the responses and sends the
929
+ * total back as `SearchRequest.text_stats`, so every shard scores with
930
+ * the same IDF.
931
+ */
932
+ readonly getTextStats: {
933
+ readonly name: "GetTextStats";
934
+ readonly requestType: MessageFns<GetTextStatsRequest>;
935
+ readonly requestStream: false;
936
+ readonly responseType: MessageFns<GetTextStatsResponse>;
937
+ readonly responseStream: false;
938
+ readonly options: {};
939
+ };
940
+ };
941
+ };
942
+ /** Index service */
943
+ export type IndexServiceDefinition = typeof IndexServiceDefinition;
944
+ export declare const IndexServiceDefinition: {
945
+ readonly name: "IndexService";
946
+ readonly fullName: "summa.IndexService";
947
+ readonly methods: {
948
+ /** Create a new index (supports both structured schema and SDL string) */
949
+ readonly createIndex: {
950
+ readonly name: "CreateIndex";
951
+ readonly requestType: MessageFns<CreateIndexRequest>;
952
+ readonly requestStream: false;
953
+ readonly responseType: MessageFns<CreateIndexResponse>;
954
+ readonly responseStream: false;
955
+ readonly options: {};
956
+ };
957
+ /** Add documents to index (streaming) */
958
+ readonly indexDocuments: {
959
+ readonly name: "IndexDocuments";
960
+ readonly requestType: MessageFns<IndexDocumentRequest>;
961
+ readonly requestStream: true;
962
+ readonly responseType: MessageFns<IndexDocumentsResponse>;
963
+ readonly responseStream: false;
964
+ readonly options: {};
965
+ };
966
+ /** Add documents in batch */
967
+ readonly batchIndexDocuments: {
968
+ readonly name: "BatchIndexDocuments";
969
+ readonly requestType: MessageFns<BatchIndexDocumentsRequest>;
970
+ readonly requestStream: false;
971
+ readonly responseType: MessageFns<BatchIndexDocumentsResponse>;
972
+ readonly responseStream: false;
973
+ readonly options: {};
974
+ };
975
+ /** Stage whole-document deletions by exact primary key, including every chunk. */
976
+ readonly deleteDocuments: {
977
+ readonly name: "DeleteDocuments";
978
+ readonly requestType: MessageFns<DeleteDocumentsRequest>;
979
+ readonly requestStream: false;
980
+ readonly responseType: MessageFns<DocumentMutationResponse>;
981
+ readonly responseStream: false;
982
+ readonly options: {};
983
+ };
984
+ /** Stage complete replacements (inserts if absent). Commit publishes them. */
985
+ readonly upsertDocuments: {
986
+ readonly name: "UpsertDocuments";
987
+ readonly requestType: MessageFns<UpsertDocumentsRequest>;
988
+ readonly requestStream: false;
989
+ readonly responseType: MessageFns<DocumentMutationResponse>;
990
+ readonly responseStream: false;
991
+ readonly options: {};
992
+ };
993
+ /** Commit pending changes */
994
+ readonly commit: {
995
+ readonly name: "Commit";
996
+ readonly requestType: MessageFns<CommitRequest>;
997
+ readonly requestStream: false;
998
+ readonly responseType: MessageFns<CommitResponse>;
999
+ readonly responseStream: false;
1000
+ readonly options: {};
1001
+ };
1002
+ /** Force merge segments */
1003
+ readonly forceMerge: {
1004
+ readonly name: "ForceMerge";
1005
+ readonly requestType: MessageFns<ForceMergeRequest>;
1006
+ readonly requestStream: false;
1007
+ readonly responseType: MessageFns<ForceMergeResponse>;
1008
+ readonly responseStream: false;
1009
+ readonly options: {};
1010
+ };
1011
+ /** Run bounded text, BMP, Seismic, and binary ANN layout maintenance */
1012
+ readonly reorder: {
1013
+ readonly name: "Reorder";
1014
+ readonly requestType: MessageFns<ReorderRequest>;
1015
+ readonly requestStream: false;
1016
+ readonly responseType: MessageFns<ReorderResponse>;
1017
+ readonly responseStream: false;
1018
+ readonly options: {};
1019
+ };
1020
+ /** Delete an index */
1021
+ readonly deleteIndex: {
1022
+ readonly name: "DeleteIndex";
1023
+ readonly requestType: MessageFns<DeleteIndexRequest>;
1024
+ readonly requestStream: false;
1025
+ readonly responseType: MessageFns<DeleteIndexResponse>;
1026
+ readonly responseStream: false;
1027
+ readonly options: {};
1028
+ };
1029
+ /** List all indexes */
1030
+ readonly listIndexes: {
1031
+ readonly name: "ListIndexes";
1032
+ readonly requestType: MessageFns<ListIndexesRequest>;
1033
+ readonly requestStream: false;
1034
+ readonly responseType: MessageFns<ListIndexesResponse>;
1035
+ readonly responseStream: false;
1036
+ readonly options: {};
1037
+ };
1038
+ /** Retrain global vector codebooks and atomically rebuild every ANN segment */
1039
+ readonly retrainVectorIndex: {
1040
+ readonly name: "RetrainVectorIndex";
1041
+ readonly requestType: MessageFns<RetrainVectorIndexRequest>;
1042
+ readonly requestStream: false;
1043
+ readonly responseType: MessageFns<RetrainVectorIndexResponse>;
1044
+ readonly responseStream: false;
1045
+ readonly options: {};
1046
+ };
1047
+ /** Atomically replace one vector field's IVF/ScaNN algorithm or parameters */
1048
+ readonly alterVectorIndex: {
1049
+ readonly name: "AlterVectorIndex";
1050
+ readonly requestType: MessageFns<AlterVectorIndexRequest>;
1051
+ readonly requestStream: false;
1052
+ readonly responseType: MessageFns<AlterVectorIndexResponse>;
1053
+ readonly responseStream: false;
1054
+ readonly options: {};
1055
+ };
1056
+ };
1057
+ };
1058
+ type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
1059
+ export type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
1060
+ [K in keyof T]?: DeepPartial<T[K]>;
1061
+ } : Partial<T>;
1062
+ export interface MessageFns<T> {
1063
+ encode(message: T, writer?: BinaryWriter): BinaryWriter;
1064
+ decode(input: BinaryReader | Uint8Array, length?: number): T;
1065
+ fromJSON(object: any): T;
1066
+ toJSON(message: T): unknown;
1067
+ create(base?: DeepPartial<T>): T;
1068
+ fromPartial(object: DeepPartial<T>): T;
1069
+ }
1070
+ export {};
1071
+ //# sourceMappingURL=summa.d.ts.map