@babav/knowledge-core-client 0.36.0 → 0.38.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.
package/dist/index.d.ts CHANGED
@@ -61,6 +61,8 @@ export interface QueryOverrides {
61
61
  max_reasoning_rounds?: number;
62
62
  decomposition_model?: string;
63
63
  reasoning_inspect_model?: string;
64
+ multi_query_model?: string;
65
+ citation_model?: string;
64
66
  groundedness_verifier_model?: string;
65
67
  groundedness_threshold?: number;
66
68
  grounding_enabled?: boolean;
@@ -323,6 +325,36 @@ export interface SectionsResponse {
323
325
  document_id: UUID;
324
326
  sections: SectionAnalytics[];
325
327
  }
328
+ /** One chunk's retrieval heat + where it sits in the document's view-PDF. `regions` are
329
+ * view-PDF points (origin bottom-left), possibly spanning pages; `method`/`regions` null (or
330
+ * method "unaligned") => no box to draw (heat still shown). retrieved=0 => never-retrieved. */
331
+ export interface ChunkHeat {
332
+ chunk_id: string;
333
+ seq: number;
334
+ parent_id: UUID | null;
335
+ retrieved: number;
336
+ reranked: number;
337
+ citation_count: number;
338
+ best_rerank_rank: number | null;
339
+ best_rerank_score: number | null;
340
+ method: string | null;
341
+ regions: {
342
+ page: number;
343
+ bbox: [number, number, number, number];
344
+ }[] | null;
345
+ }
346
+ /** Everything to overlay retrieval heat on the original document: a signed view-PDF URL
347
+ * (render with pdf.js), its per-page geometry, and every chunk's heat + boxes. */
348
+ export interface ChunkHeatmapResponse {
349
+ document_id: UUID;
350
+ view_pdf_url: string | null;
351
+ page_dims: {
352
+ w: number;
353
+ h: number;
354
+ rotation: number;
355
+ }[] | null;
356
+ chunks: ChunkHeat[];
357
+ }
326
358
  export interface MonthlyCorpus {
327
359
  corpus_id: UUID;
328
360
  yyyy_mm: string;
@@ -432,6 +464,8 @@ export interface Agent {
432
464
  max_reasoning_rounds: number | null;
433
465
  decomposition_model: string | null;
434
466
  reasoning_inspect_model: string | null;
467
+ multi_query_model: string | null;
468
+ citation_model: string | null;
435
469
  groundedness_verifier_model: string | null;
436
470
  groundedness_threshold: number | null;
437
471
  grounding_enabled: boolean | null;
@@ -929,6 +963,9 @@ export declare class KnowledgeCoreClient extends HttpBase {
929
963
  document: (documentId: UUID) => Promise<DocumentAnalytics>;
930
964
  /** Parent-section grain for a document (never exposes chunk ids). */
931
965
  documentSections: (documentId: UUID) => Promise<SectionsResponse>;
966
+ /** Per-chunk retrieval heat + position in the document's view-PDF, plus a signed
967
+ * view-PDF URL — everything to overlay heat on the ORIGINAL document with pdf.js. */
968
+ documentChunks: (documentId: UUID) => Promise<ChunkHeatmapResponse>;
932
969
  /** Whole-corpus scatter payload: every document with x=retrieved_reach, y=conversion,
933
970
  * bubble=chunk_count, and a server-computed quadrant. No pagination (`truncated` if capped). */
934
971
  corpusScatter: (corpusId: UUID) => Promise<ScatterResponse>;
package/dist/index.js CHANGED
@@ -468,6 +468,9 @@ export class KnowledgeCoreClient extends HttpBase {
468
468
  document: (documentId) => this.request("GET", `/v1/analytics/documents/${documentId}`),
469
469
  /** Parent-section grain for a document (never exposes chunk ids). */
470
470
  documentSections: (documentId) => this.request("GET", `/v1/analytics/documents/${documentId}/sections`),
471
+ /** Per-chunk retrieval heat + position in the document's view-PDF, plus a signed
472
+ * view-PDF URL — everything to overlay heat on the ORIGINAL document with pdf.js. */
473
+ documentChunks: (documentId) => this.request("GET", `/v1/analytics/documents/${documentId}/chunks`),
471
474
  /** Whole-corpus scatter payload: every document with x=retrieved_reach, y=conversion,
472
475
  * bubble=chunk_count, and a server-computed quadrant. No pagination (`truncated` if capped). */
473
476
  corpusScatter: (corpusId) => this.request("GET", `/v1/analytics/corpora/${corpusId}/scatter`),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@babav/knowledge-core-client",
3
- "version": "0.36.0",
3
+ "version": "0.38.0",
4
4
  "description": "TypeScript client for the Babav Knowledge Core API (Deno + Node 18+, zero deps). Includes the babav.visual grammar TYPES at the ./visual subpath (types only; all visual rendering is server-side).",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
package/src/index.ts CHANGED
@@ -82,6 +82,8 @@ export interface QueryOverrides {
82
82
  max_reasoning_rounds?: number; // iterative agentic-loop ceiling (1 = single pass; early-stops)
83
83
  decomposition_model?: string; // model for query decomposition
84
84
  reasoning_inspect_model?: string; // model for the per-round sufficiency / next-query decision
85
+ multi_query_model?: string; // model for multi-query expansion
86
+ citation_model?: string; // model for the citation pass (non-native-citation providers)
85
87
  groundedness_verifier_model?: string; // model for the groundedness LLM judge
86
88
  groundedness_threshold?: number;
87
89
  grounding_enabled?: boolean; // groundedness score (default off)
@@ -334,6 +336,24 @@ export interface SectionAnalytics {
334
336
  citation_count: number; best_rerank_score: number | null; band: AnalyticsBand;
335
337
  }
336
338
  export interface SectionsResponse { document_id: UUID; sections: SectionAnalytics[] }
339
+ /** One chunk's retrieval heat + where it sits in the document's view-PDF. `regions` are
340
+ * view-PDF points (origin bottom-left), possibly spanning pages; `method`/`regions` null (or
341
+ * method "unaligned") => no box to draw (heat still shown). retrieved=0 => never-retrieved. */
342
+ export interface ChunkHeat {
343
+ chunk_id: string; seq: number; parent_id: UUID | null;
344
+ retrieved: number; reranked: number; citation_count: number;
345
+ best_rerank_rank: number | null; best_rerank_score: number | null;
346
+ method: string | null;
347
+ regions: { page: number; bbox: [number, number, number, number] }[] | null;
348
+ }
349
+ /** Everything to overlay retrieval heat on the original document: a signed view-PDF URL
350
+ * (render with pdf.js), its per-page geometry, and every chunk's heat + boxes. */
351
+ export interface ChunkHeatmapResponse {
352
+ document_id: UUID;
353
+ view_pdf_url: string | null;
354
+ page_dims: { w: number; h: number; rotation: number }[] | null;
355
+ chunks: ChunkHeat[];
356
+ }
337
357
  export interface MonthlyCorpus {
338
358
  corpus_id: UUID; yyyy_mm: string; queries: number; documents_retrieved: number;
339
359
  chunks_retrieved: number; citations: number; revenue_share: number;
@@ -414,6 +434,8 @@ export interface Agent {
414
434
  max_reasoning_rounds: number | null;
415
435
  decomposition_model: string | null;
416
436
  reasoning_inspect_model: string | null;
437
+ multi_query_model: string | null;
438
+ citation_model: string | null;
417
439
  groundedness_verifier_model: string | null;
418
440
  groundedness_threshold: number | null;
419
441
  grounding_enabled: boolean | null;
@@ -1066,6 +1088,9 @@ export class KnowledgeCoreClient extends HttpBase {
1066
1088
  document: (documentId: UUID) => this.request<DocumentAnalytics>("GET", `/v1/analytics/documents/${documentId}`),
1067
1089
  /** Parent-section grain for a document (never exposes chunk ids). */
1068
1090
  documentSections: (documentId: UUID) => this.request<SectionsResponse>("GET", `/v1/analytics/documents/${documentId}/sections`),
1091
+ /** Per-chunk retrieval heat + position in the document's view-PDF, plus a signed
1092
+ * view-PDF URL — everything to overlay heat on the ORIGINAL document with pdf.js. */
1093
+ documentChunks: (documentId: UUID) => this.request<ChunkHeatmapResponse>("GET", `/v1/analytics/documents/${documentId}/chunks`),
1069
1094
  /** Whole-corpus scatter payload: every document with x=retrieved_reach, y=conversion,
1070
1095
  * bubble=chunk_count, and a server-computed quadrant. No pagination (`truncated` if capped). */
1071
1096
  corpusScatter: (corpusId: UUID) => this.request<ScatterResponse>("GET", `/v1/analytics/corpora/${corpusId}/scatter`),