@babav/knowledge-core-client 0.22.0 → 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,10 +341,14 @@ 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;
339
- /** A visual, emitted (out of anchor order) during the trailing visual phase when
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;
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;
342
- /** Always emitted exactly once to close the visual phase (incl. count=0), before `done`. */
351
+ /** Always emitted exactly once to close the visual stage (incl. count=0), before `done`. */
343
352
  onVisualsComplete?: (m: VisualsMeta) => void;
344
353
  onError?: (d: unknown) => void;
345
354
  onDone?: () => 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;
@@ -90,7 +90,7 @@ export interface VisualPayload {
90
90
  composition?: VisualComposition[];
91
91
  layout?: LayoutIntent;
92
92
  }
93
- /** Per-element source provenance. Present from v1; populated in Phase 2. */
93
+ /** Per-element source provenance. Present from v1; populated later. */
94
94
  export interface VisualProvenance {
95
95
  [k: string]: unknown;
96
96
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@babav/knowledge-core-client",
3
- "version": "0.22.0",
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,10 +461,14 @@ 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;
458
- /** A visual, emitted (out of anchor order) during the trailing visual phase when
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;
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;
461
- /** Always emitted exactly once to close the visual phase (incl. count=0), before `done`. */
471
+ /** Always emitted exactly once to close the visual stage (incl. count=0), before `done`. */
462
472
  onVisualsComplete?: (m: VisualsMeta) => void;
463
473
  onError?: (d: unknown) => void;
464
474
  onDone?: () => 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;
@@ -116,7 +116,7 @@ export interface VisualPayload {
116
116
  layout?: LayoutIntent;
117
117
  }
118
118
 
119
- /** Per-element source provenance. Present from v1; populated in Phase 2. */
119
+ /** Per-element source provenance. Present from v1; populated later. */
120
120
  export interface VisualProvenance {
121
121
  [k: string]: unknown;
122
122
  }