@babav/knowledge-core-client 0.22.1 → 0.22.2

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
@@ -107,6 +107,11 @@ export interface Visual {
107
107
  height: number;
108
108
  };
109
109
  }
110
+ /** First event of the visual stage (streaming): generation has started. `pending` = number of
111
+ * concepts about to be rendered, or null when not yet known. */
112
+ export interface VisualsPending {
113
+ pending: number | null;
114
+ }
110
115
  export interface VisualsMeta {
111
116
  count: number;
112
117
  dropped: number;
@@ -336,6 +341,10 @@ export interface StreamHandlers {
336
341
  * (native path). Also present in `final`. May be `{}` if scoring was unavailable. */
337
342
  onGroundedness?: (g: Groundedness | Record<string, never>) => void;
338
343
  onFinal?: (d: QueryResponse) => void;
344
+ /** First event of the trailing visual stage — visual generation has STARTED (fires after
345
+ * `final`/`groundedness`, before any `visual`). `pending` is how many concepts are about to be
346
+ * rendered (or null when not yet known). Use it to show a "generating visual(s)" state. */
347
+ onVisualsPending?: (p: VisualsPending) => void;
339
348
  /** A visual, emitted (out of anchor order) during the trailing visual stage when
340
349
  * visual.mode="on". Place by `anchor`, not arrival order. */
341
350
  onVisual?: (v: Visual) => void;
package/dist/index.js CHANGED
@@ -364,6 +364,9 @@ function dispatchSse(frame, h) {
364
364
  case "final":
365
365
  h.onFinal?.(data);
366
366
  break;
367
+ case "visuals_pending":
368
+ h.onVisualsPending?.(data);
369
+ break;
367
370
  case "visual":
368
371
  h.onVisual?.(data);
369
372
  break;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@babav/knowledge-core-client",
3
- "version": "0.22.1",
3
+ "version": "0.22.2",
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
@@ -125,6 +125,12 @@ export interface Visual {
125
125
  image?: { url: string; expires_at: number; width: number; height: number };
126
126
  }
127
127
 
128
+ /** First event of the visual stage (streaming): generation has started. `pending` = number of
129
+ * concepts about to be rendered, or null when not yet known. */
130
+ export interface VisualsPending {
131
+ pending: number | null;
132
+ }
133
+
128
134
  export interface VisualsMeta {
129
135
  count: number;
130
136
  dropped: number;
@@ -455,6 +461,10 @@ export interface StreamHandlers {
455
461
  * (native path). Also present in `final`. May be `{}` if scoring was unavailable. */
456
462
  onGroundedness?: (g: Groundedness | Record<string, never>) => void;
457
463
  onFinal?: (d: QueryResponse) => void;
464
+ /** First event of the trailing visual stage — visual generation has STARTED (fires after
465
+ * `final`/`groundedness`, before any `visual`). `pending` is how many concepts are about to be
466
+ * rendered (or null when not yet known). Use it to show a "generating visual(s)" state. */
467
+ onVisualsPending?: (p: VisualsPending) => void;
458
468
  /** A visual, emitted (out of anchor order) during the trailing visual stage when
459
469
  * visual.mode="on". Place by `anchor`, not arrival order. */
460
470
  onVisual?: (v: Visual) => void;
@@ -708,6 +718,7 @@ function dispatchSse(frame: string, h: StreamHandlers): void {
708
718
  case "citation": h.onCitation?.(data as Citation); break;
709
719
  case "groundedness": h.onGroundedness?.(data as never); break;
710
720
  case "final": h.onFinal?.(data as QueryResponse); break;
721
+ case "visuals_pending": h.onVisualsPending?.(data as VisualsPending); break;
711
722
  case "visual": h.onVisual?.(data as Visual); break;
712
723
  case "visuals_complete": h.onVisualsComplete?.(data as VisualsMeta); break;
713
724
  case "error": h.onError?.(data); break;