@babav/knowledge-core-client 0.26.0 → 0.28.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 +10 -0
- package/package.json +1 -1
- package/src/index.ts +19 -1
package/dist/index.d.ts
CHANGED
|
@@ -90,6 +90,10 @@ export interface QueryRequest {
|
|
|
90
90
|
filter?: MetadataFilter;
|
|
91
91
|
visual?: VisualRequest;
|
|
92
92
|
}
|
|
93
|
+
/** The spatial arrangement a conceptual visual encodes (the geometry that carries the meaning).
|
|
94
|
+
* "free" = renderer's judgment / not a declared arrangement (also the value for non-conceptual
|
|
95
|
+
* registers). */
|
|
96
|
+
export type VisualLayout = "linear-flow" | "ring-cycle" | "nesting" | "radial-hub" | "side-by-side" | "stacked-layers" | "two-state" | "free";
|
|
93
97
|
/** A visual attached to a response, anchored by char offsets into `answer` (SAME coordinate
|
|
94
98
|
* system as citations). For delivery="svg", `rendered_svg` is set; scenic sets `image`. */
|
|
95
99
|
export interface Visual {
|
|
@@ -101,6 +105,8 @@ export interface Visual {
|
|
|
101
105
|
register: "chart" | "structural" | "conceptual" | "scenic";
|
|
102
106
|
priority: number;
|
|
103
107
|
payload: Record<string, unknown>;
|
|
108
|
+
/** Declared spatial arrangement (meaningful for `conceptual`; "free" otherwise). */
|
|
109
|
+
layout: VisualLayout;
|
|
104
110
|
rendered_svg?: string;
|
|
105
111
|
image?: {
|
|
106
112
|
url: string;
|
|
@@ -462,8 +468,12 @@ declare class HttpBase {
|
|
|
462
468
|
protected pageAll<T>(path: string, query?: RequestOpts["query"]): Promise<T[]>;
|
|
463
469
|
}
|
|
464
470
|
export interface StreamHandlers {
|
|
471
|
+
/** Retrieval milestone. `retrieval_contents` is the reranked top_k (unchanged).
|
|
472
|
+
* `retrieved_count` is the total distinct candidate chunks fetched across ALL corpora
|
|
473
|
+
* (and sub-queries) BEFORE reranking/truncation — i.e. the recall-net size. */
|
|
465
474
|
onSources?: (d: {
|
|
466
475
|
retrieval_contents: RetrievalContent[];
|
|
476
|
+
retrieved_count: number;
|
|
467
477
|
}) => void;
|
|
468
478
|
onToken?: (text: string) => void;
|
|
469
479
|
/** A citation, emitted inline as the answer streams (Claude/native path). Also
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@babav/knowledge-core-client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.28.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
|
@@ -115,6 +115,19 @@ export interface QueryRequest {
|
|
|
115
115
|
visual?: VisualRequest;
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
+
/** The spatial arrangement a conceptual visual encodes (the geometry that carries the meaning).
|
|
119
|
+
* "free" = renderer's judgment / not a declared arrangement (also the value for non-conceptual
|
|
120
|
+
* registers). */
|
|
121
|
+
export type VisualLayout =
|
|
122
|
+
| "linear-flow"
|
|
123
|
+
| "ring-cycle"
|
|
124
|
+
| "nesting"
|
|
125
|
+
| "radial-hub"
|
|
126
|
+
| "side-by-side"
|
|
127
|
+
| "stacked-layers"
|
|
128
|
+
| "two-state"
|
|
129
|
+
| "free";
|
|
130
|
+
|
|
118
131
|
/** A visual attached to a response, anchored by char offsets into `answer` (SAME coordinate
|
|
119
132
|
* system as citations). For delivery="svg", `rendered_svg` is set; scenic sets `image`. */
|
|
120
133
|
export interface Visual {
|
|
@@ -123,6 +136,8 @@ export interface Visual {
|
|
|
123
136
|
register: "chart" | "structural" | "conceptual" | "scenic";
|
|
124
137
|
priority: number;
|
|
125
138
|
payload: Record<string, unknown>; // {kind: "grammar"|"vega_lite"|"svg"|"image", ...}
|
|
139
|
+
/** Declared spatial arrangement (meaningful for `conceptual`; "free" otherwise). */
|
|
140
|
+
layout: VisualLayout;
|
|
126
141
|
rendered_svg?: string;
|
|
127
142
|
image?: { url: string; expires_at: number; width: number; height: number };
|
|
128
143
|
}
|
|
@@ -536,7 +551,10 @@ const MULTIPART_MAX_BYTES = 30 * 1024 * 1024;
|
|
|
536
551
|
// SSE handlers
|
|
537
552
|
// ---------------------------------------------------------------------------
|
|
538
553
|
export interface StreamHandlers {
|
|
539
|
-
|
|
554
|
+
/** Retrieval milestone. `retrieval_contents` is the reranked top_k (unchanged).
|
|
555
|
+
* `retrieved_count` is the total distinct candidate chunks fetched across ALL corpora
|
|
556
|
+
* (and sub-queries) BEFORE reranking/truncation — i.e. the recall-net size. */
|
|
557
|
+
onSources?: (d: { retrieval_contents: RetrievalContent[]; retrieved_count: number }) => void;
|
|
540
558
|
onToken?: (text: string) => void;
|
|
541
559
|
/** A citation, emitted inline as the answer streams (Claude/native path). Also
|
|
542
560
|
* present aggregated in the `final` event. */
|