@bitbitpress/client 1.1.0-alpha.1 → 1.1.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/README.md CHANGED
@@ -554,12 +554,12 @@ client.user.synthesizeItem(
554
554
 
555
555
  ##### Parameters
556
556
 
557
- - `item` (required): A single synthesize item (same shape as items in `synthesize`): `inputs`, `output` (schema as JSON string or Zod 4 schema), optional `configurationKeyName`, optional `limit` (number of results to return; defaults to `1`), optional `searchOptionsOverrides` (e.g. `{ lookbackMinutes: 1440 }` for 24-hour lookback)
557
+ - `item` (required): A single synthesize item (same shape as items in `synthesize`): `inputs`, `output` (schema as JSON string or Zod 4 schema), optional `configurationKeyName`, optional `synthesisHistoryLimit` (how many recent stored outputs to expose in `synthesisHistory`; defaults to `0` — no history emitted), optional `searchOptionsOverrides` (e.g. `{ lookbackMinutes: 1440 }` for 24-hour lookback)
558
558
  - `onStreamingData` (optional): Callback invoked with streaming data whenever a stream event has `complete: false` for this item. Type: `(data: unknown) => void`.
559
559
 
560
560
  ##### Returns
561
561
 
562
- - `Promise<SynthesizeItemResponse>`: Resolves with the final data event for this item — `data` is the synthesized object (keys match your output schema) when present; `error` is set on failure
562
+ - `Promise<SynthesizeItemResponse>`: Resolves with the final data event for this item — `data` is the synthesized object (keys match your output schema) when present; `synthesisHistory` is an array of recent stored `data` payloads when `synthesisHistoryLimit > 0` (most-recent first; the first entry is the current synthesis itself); `error` is set on failure
563
563
 
564
564
  ##### Behavior
565
565
 
@@ -614,7 +614,7 @@ client.user.synthesize(
614
614
  - `inputs` (optional): Context for synthesis — array of `{ type: "externalId" | "text" | "excludeExternalIds", value: string }` (article ID, freeform text, or comma-separated external IDs to exclude)
615
615
  - `output`: `{ schema: string | ZodType }` — output schema as a JSON string or Zod 4 schema (top-level type must be `"object"`; supports object, string, number, boolean, array, and enum)
616
616
  - `configurationKeyName` (optional): Key name for configuration
617
- - `limit` (optional): Number of results to return. Defaults to `1`.
617
+ - `synthesisHistoryLimit` (optional): How many recent stored synthesis outputs to expose in the final data event's `synthesisHistory` field. Defaults to `0` (no history emitted). When `> 0`, the final event includes a `synthesisHistory` array of up to N `data` payloads (most-recent first; first entry is the current synthesis itself).
618
618
  - `searchOptionsOverrides` (optional): Per-request overrides, e.g. `{ lookbackMinutes: 1440 }` for 24-hour lookback.
619
619
  - `options` (optional): `{ onStreamingData?: (index: number, data: unknown) => void }` — if provided, `onStreamingData` is called for each data event with `complete: false`, with the item's index and streaming data
620
620
 
@@ -626,7 +626,7 @@ client.user.synthesize(
626
626
 
627
627
  - `{ type: "connected" }`: Connection established
628
628
  - `{ type: "complete" }`: Stream complete
629
- - `{ index, data?, complete, error? }`: Data event for that item. Multiple events may be sent per index as partial updates; the final event has `complete: true` and the validated object. When `complete` is false, `data` is streaming data (partial object). `error` is set on failure.
629
+ - `{ index, data?, synthesisHistory?, complete, error? }`: Data event for that item. Multiple events may be sent per index as partial updates; the final event has `complete: true` and the validated object. When `complete` is false, `data` is streaming data (partial object). `synthesisHistory` (only on the final event, only when `synthesisHistoryLimit > 0`) is an array of recent stored `data` payloads, most-recent first. `error` is set on failure.
630
630
 
631
631
  ##### Example
632
632
 
@@ -995,13 +995,13 @@ type SignalResponse = {
995
995
 
996
996
  #### SynthesizeRequest
997
997
 
998
- Request body for POST `/v1/user/synthesize` (from OpenAPI). Each item has `inputs`, `output`, optional `configurationKeyName`, optional `limit` (defaults to `1`), and optional `searchOptionsOverrides`.
998
+ Request body for POST `/v1/user/synthesize` (from OpenAPI). Each item has `inputs`, `output`, optional `configurationKeyName`, optional `synthesisHistoryLimit` (defaults to `0`), and optional `searchOptionsOverrides`.
999
999
 
1000
1000
  ```typescript
1001
1001
  type SynthesizeRequest = {
1002
1002
  items: Array<{
1003
1003
  configurationKeyName?: string;
1004
- limit?: number; // number of results to return; defaults to 1
1004
+ synthesisHistoryLimit?: number; // how many recent stored outputs to include in synthesisHistory; defaults to 0 (no history emitted)
1005
1005
  searchOptionsOverrides?: { lookbackMinutes?: number };
1006
1006
  inputs?: Array<{ type: 'externalId' | 'text' | 'excludeExternalIds'; value: string }>;
1007
1007
  output: {
@@ -1027,10 +1027,10 @@ Stream events (SSE). Connection events use `type`; data events use `index`, opti
1027
1027
  type SynthesizeEvent =
1028
1028
  | { type: 'connected' }
1029
1029
  | { type: 'complete' }
1030
- | { index: number; data?: unknown; complete: boolean; error?: string };
1030
+ | { index: number; data?: unknown; synthesisHistory?: unknown[]; complete: boolean; error?: string };
1031
1031
  ```
1032
1032
 
1033
- When `complete` is true, `data` is the full synthesized object (keys match your output schema). When `complete` is false, `data` is streaming data (partial update). `error` is set on failure.
1033
+ When `complete` is true, `data` is the full synthesized object (keys match your output schema). When `complete` is false, `data` is streaming data (partial update). When the request set `synthesisHistoryLimit > 0`, the final event also includes `synthesisHistory`: an array of recent stored `data` payloads (most-recent first; first entry is the current synthesis itself — identical to `data` unless user reranking is configured server-side). `error` is set on failure.
1034
1034
 
1035
1035
  #### SynthesizeItemResponse
1036
1036
 
@@ -1038,8 +1038,9 @@ Return type of `synthesizeItem`. Same shape as a data event payload (without `in
1038
1038
 
1039
1039
  ```typescript
1040
1040
  type SynthesizeItemResponse = {
1041
- data?: unknown; // synthesized object when present
1042
- error?: string; // set on failure
1041
+ data?: unknown; // synthesized object when present
1042
+ synthesisHistory?: unknown[]; // recent stored outputs when synthesisHistoryLimit > 0; most-recent first
1043
+ error?: string; // set on failure
1043
1044
  };
1044
1045
  ```
1045
1046
 
@@ -683,8 +683,8 @@ export interface paths {
683
683
  items: {
684
684
  /** @description Optional configuration key name. Loads an existing synthesis config by this name; omit for default configuration. */
685
685
  configurationKeyName?: string;
686
- /** @description Number of results to return. Defaults to 1. */
687
- limit?: number;
686
+ /** @description How many recent stored synthesis outputs to expose in the streamed `synthesisHistory` field. Defaults to 0 (no history emitted). When > 0, the final data event includes a `synthesisHistory` array of up to N `data` payloads (most-recent first). The first entry is the current synthesis itself — the same payload `data` is derived from — and the remaining entries are older stored rows. */
687
+ synthesisHistoryLimit?: number;
688
688
  /** @description Per-request overrides for search options. */
689
689
  searchOptionsOverrides?: {
690
690
  /** @description Override for search lookback window in minutes (e.g. 1440 for last 24 hours). */
@@ -723,10 +723,13 @@ export interface paths {
723
723
  * {
724
724
  * "index": number,
725
725
  * "data": {...},
726
+ * "synthesisHistory"?: [{...}, ...],
726
727
  * "complete": false | true
727
728
  * }
728
729
  * ```
729
- * `data` is the synthesized object (keys match your output schema). `complete` is `false` for partial streaming updates and `true` for the final validated payload. When `limit` > 1 and user reranking is configured, items at the reranking field are pooled across the N stored outputs and the final object is capped at the original array size.
730
+ * `data` is always a single synthesized object (keys match your output schema). `complete` is `false` for partial streaming updates and `true` for the final validated payload.
731
+ *
732
+ * When `synthesisHistoryLimit > 0`, the final event additionally includes `synthesisHistory`: an array of up to N `data` payloads (most-recent first). The first entry is the current synthesis itself — the raw payload `data` is derived from (identical to `data` when reranking isn't configured; the unreranked source when it is) — and the remaining entries are older stored rows. The primary `data` field stays a single object — when user reranking is configured, it is built by pooling items at the reranking field across the fetched rows and scoring against the user profile.
730
733
  *
731
734
  * **Data Events (error):**
732
735
  * ```json
@@ -122,6 +122,7 @@ class StreamRouter {
122
122
  else {
123
123
  entry.resolve({
124
124
  data: event.data,
125
+ synthesisHistory: event.synthesisHistory,
125
126
  error: event.error,
126
127
  });
127
128
  this.resolvers.delete(event.index);
@@ -1 +1 @@
1
- {"version":3,"file":"synthesize-batch-manager.js","sourceRoot":"","sources":["../../src/user/synthesize-batch-manager.ts"],"names":[],"mappings":";;;AACA,mDAAgG;AAGhG,mDAAmD;AACnD,SAAS,aAAa;IACpB,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,SAAS,eAAe;IACtB,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,MAAM,QAAQ,GAAG,aAAa,EAAE,CAAC;AACjC,MAAM,UAAU,GAAG,eAAe,EAAE,CAAC;AASrC;;;GAGG;AACH,MAAa,sBAAsB;IACzB,KAAK,GA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H,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;oBACrC,CAAC;gBACH,CAAC;YACH,CAAC;YAED,sEAAsE;YACtE,KAAK,MAAM,EAAE,MAAM,EAAE,IAAI,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,EAAE,CAAC;gBACjD,MAAM,CAAC,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC,CAAC;YACrE,CAAC;YACD,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;QACzB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,+BAA+B;YAC/B,IAAI,CAAC,KAAK,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;YACvE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC5B,CAAC;IACH,CAAC;CACF"}
1
+ {"version":3,"file":"synthesize-batch-manager.js","sourceRoot":"","sources":["../../src/user/synthesize-batch-manager.ts"],"names":[],"mappings":";;;AACA,mDAAgG;AAGhG,mDAAmD;AACnD,SAAS,aAAa;IACpB,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,SAAS,eAAe;IACtB,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,MAAM,QAAQ,GAAG,aAAa,EAAE,CAAC;AACjC,MAAM,UAAU,GAAG,eAAe,EAAE,CAAC;AASrC;;;GAGG;AACH,MAAa,sBAAsB;IACzB,KAAK,GAKR,EAAE,CAAC;IACA,KAAK,GAAiB,IAAI,CAAC;IAC3B,SAAS,CAA+B;IACxC,YAAY,CAAS;IAE7B,YAAY,SAAuC,EAAE,YAAoB;QACvE,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;IAED;;OAEG;IACH,YAAY,CAAC,MAAqB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gBACjD,MAAM,CAAC,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC,CAAC;YACrE,CAAC;YACD,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;QACzB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,+BAA+B;YAC/B,IAAI,CAAC,KAAK,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;YACvE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC5B,CAAC;IACH,CAAC;CACF"}
@@ -2,14 +2,24 @@ import type { RequestConfig } from '../request.js';
2
2
  import type { SynthesizeItems } from './typeDefs.js';
3
3
  export type SynthesizeItemResponse = {
4
4
  data?: unknown;
5
+ /**
6
+ * Recent stored synthesis outputs when the request set `synthesisHistoryLimit > 0`,
7
+ * ordered most-recent first. The first entry is the current synthesis itself
8
+ * (identical to `data` unless user reranking is configured server-side).
9
+ */
10
+ synthesisHistory?: unknown[];
5
11
  error?: string;
6
12
  };
7
13
  /**
8
14
  * Synthesize stream event types (SSE). Per OpenAPI spec:
9
15
  * - Connection: `{ type: 'connected' | 'complete' }`
10
- * - Data: `{ index, data?, complete, error? }`.
16
+ * - Data: `{ index, data?, synthesisHistory?, complete, error? }`.
11
17
  * Multiple events may be sent for the same index as partial object updates; the final event
12
- * for that index has `complete: true` and contains the validated object.
18
+ * for that index has `complete: true` and contains the validated object. When the request
19
+ * set `synthesisHistoryLimit > 0`, the final event also includes `synthesisHistory`: an
20
+ * array of recent stored `data` payloads (most-recent first; the first entry is the current
21
+ * synthesis itself — identical to `data` unless user reranking is configured, in which case
22
+ * it is the unreranked source).
13
23
  */
14
24
  export type SynthesizeEvent = {
15
25
  type: 'connected';
@@ -18,6 +28,7 @@ export type SynthesizeEvent = {
18
28
  } | {
19
29
  index: number;
20
30
  data?: unknown;
31
+ synthesisHistory?: unknown[];
21
32
  complete: boolean;
22
33
  error?: string;
23
34
  };
@@ -30,7 +41,7 @@ export interface SynthesizeOptions {
30
41
  * Synthesize content items personalized to the user (streaming SSE).
31
42
  *
32
43
  * @param config - Request configuration with base URL, timeout, fetch, and optional token
33
- * @param items - Array of items: each has optional inputs (`type`: externalId | text | excludeExternalIds, `value`), output (schema as JSON string or Zod 4 schema), optional configurationKeyName, optional limit (number of results to return; defaults to 1), optional searchOptionsOverrides (e.g. lookbackMinutes)
44
+ * @param items - Array of items: each has optional inputs (`type`: externalId | text | excludeExternalIds, `value`), output (schema as JSON string or Zod 4 schema), optional configurationKeyName, optional synthesisHistoryLimit (how many recent stored outputs to expose in the final event's `synthesisHistory` array; defaults to 0 — no history emitted), optional searchOptionsOverrides (e.g. lookbackMinutes)
34
45
  * @param options - Optional: onStreamingData(index, data) called for each streaming data update per item index
35
46
  * @returns AsyncIterable yielding connection events (connected, complete) and data events (index, data?, complete, error?). Data may be partial until an event with complete: true for that index.
36
47
  */
@@ -1 +1 @@
1
- {"version":3,"file":"synthesize.d.ts","sourceRoot":"","sources":["../../src/user/synthesize.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,KAAK,EAAE,eAAe,EAAqB,MAAM,eAAe,CAAC;AAExE,MAAM,MAAM,sBAAsB,GAAG;IACnC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,eAAe,GACvB;IAAE,IAAI,EAAE,WAAW,CAAA;CAAE,GACrB;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,GACpB;IACE,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAsBN,kGAAkG;A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AC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;CAC1D;AAED;;;;;;;GAOG;AACH,wBAAsB,UAAU,CAC9B,MAAM,EAAE,aAAa,EACrB,KAAK,EAAE,eAAe,EACtB,OAAO,CAAC,EAAE,iBAAiB,GAC1B,OAAO,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC,CAsBzC;AAED,wEAAwE;AACxE,MAAM,MAAM,yBAAyB,GACnC,OAAO,CAAC,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC,SAAS,aAAa,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC"}
@@ -25,7 +25,7 @@ function normalizeSynthesizeItems(items) {
25
25
  * Synthesize content items personalized to the user (streaming SSE).
26
26
  *
27
27
  * @param config - Request configuration with base URL, timeout, fetch, and optional token
28
- * @param items - Array of items: each has optional inputs (`type`: externalId | text | excludeExternalIds, `value`), output (schema as JSON string or Zod 4 schema), optional configurationKeyName, optional limit (number of results to return; defaults to 1), optional searchOptionsOverrides (e.g. lookbackMinutes)
28
+ * @param items - Array of items: each has optional inputs (`type`: externalId | text | excludeExternalIds, `value`), output (schema as JSON string or Zod 4 schema), optional configurationKeyName, optional synthesisHistoryLimit (how many recent stored outputs to expose in the final event's `synthesisHistory` array; defaults to 0 — no history emitted), optional searchOptionsOverrides (e.g. lookbackMinutes)
29
29
  * @param options - Optional: onStreamingData(index, data) called for each streaming data update per item index
30
30
  * @returns AsyncIterable yielding connection events (connected, complete) and data events (index, data?, complete, error?). Data may be partial until an event with complete: true for that index.
31
31
  */
@@ -1 +1 @@
1
- {"version":3,"file":"synthesize.js","sourceRoot":"","sources":["../../src/user/synthesize.ts"],"names":[],"mappings":";;AA6DA,gCA0BC;AAvFD,6BAAmC;AAEnC,8CAA4C;AAyB5C,gDAAgD;AAChD,SAAS,WAAW,CAAC,KAAc;IACjC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAA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,GAAG,OAAO,EAAE,eAAe,CAAC;IACjD,IAAI,CAAC,eAAe;QAAE,OAAO,MAAM,CAAC;IACpC,OAAO,CAAC,KAAK,SAAS,CAAC,CAAC,IAAI;QAC1B,IAAI,KAAK,EAAE,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;YACjC,IACE,OAAO,IAAI,KAAK;gBAChB,OAAO,KAAK,CAAC,KAAK,KAAK,QAAQ;gBAC/B,KAAK,CAAC,QAAQ,KAAK,KAAK;gBACxB,KAAK,CAAC,KAAK,IAAI,IAAI,EACnB,CAAC;gBACD,eAAe,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;YAC3C,CAAC;YACD,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC,CAAC,EAAE,CAAC;AACP,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bitbitpress/client",
3
- "version": "1.1.0-alpha.1",
3
+ "version": "1.1.0",
4
4
  "description": "BitBitPress TypeScript client library",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",