@z3rno/sdk 0.2.0 → 0.4.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.cts CHANGED
@@ -38,6 +38,15 @@ type MemoryType = z.infer<typeof MemoryType>;
38
38
  declare const RelationshipType: z.ZodEnum<["derived_from", "contradicts", "supports", "supersedes", "related_to", "caused_by"]>;
39
39
  /** Relationship type between two memories. */
40
40
  type RelationshipType = z.infer<typeof RelationshipType>;
41
+ /**
42
+ * Retrieval strategy for `recall({ strategy: ... })` — Phase C.
43
+ *
44
+ * `AUTO` is the default; the server's LLM router picks one of the
45
+ * others when configured. Use an explicit value to bypass routing.
46
+ */
47
+ declare const RetrievalStrategy: z.ZodEnum<["AUTO", "VECTOR", "LEXICAL", "GRAPH", "TRIPLET", "TRACE", "TEMPORAL", "ASK", "CYPHER"]>;
48
+ /** Retrieval strategy enum (canonical UPPERCASE names). */
49
+ type RetrievalStrategy = z.infer<typeof RetrievalStrategy>;
41
50
  /**
42
51
  * Schema for storing a new memory.
43
52
  *
@@ -192,6 +201,11 @@ declare const RecallResultItem: z.ZodObject<{
192
201
  created_at: z.ZodString;
193
202
  /** Arbitrary metadata attached to the memory. */
194
203
  metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
204
+ /**
205
+ * Phase C per-source signals — e.g. `{ vector: 0.83, lexical: 0.61 }`.
206
+ * Optional so older servers (v0.7.x) keep parsing.
207
+ */
208
+ score_components: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodNumber>>;
195
209
  }, "strip", z.ZodTypeAny, {
196
210
  content: string;
197
211
  metadata: Record<string, unknown>;
@@ -202,6 +216,7 @@ declare const RecallResultItem: z.ZodObject<{
202
216
  memory_id: string;
203
217
  similarity_score: number;
204
218
  relevance_score: number;
219
+ score_components: Record<string, number>;
205
220
  summary?: string | null | undefined;
206
221
  }, {
207
222
  content: string;
@@ -214,6 +229,7 @@ declare const RecallResultItem: z.ZodObject<{
214
229
  relevance_score: number;
215
230
  metadata?: Record<string, unknown> | undefined;
216
231
  summary?: string | null | undefined;
232
+ score_components?: Record<string, number> | undefined;
217
233
  }>;
218
234
  /** Parsed type for a single recall result item. */
219
235
  type RecallResultItem = z.infer<typeof RecallResultItem>;
@@ -245,6 +261,11 @@ declare const RecallResponse: z.ZodObject<{
245
261
  created_at: z.ZodString;
246
262
  /** Arbitrary metadata attached to the memory. */
247
263
  metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
264
+ /**
265
+ * Phase C per-source signals — e.g. `{ vector: 0.83, lexical: 0.61 }`.
266
+ * Optional so older servers (v0.7.x) keep parsing.
267
+ */
268
+ score_components: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodNumber>>;
248
269
  }, "strip", z.ZodTypeAny, {
249
270
  content: string;
250
271
  metadata: Record<string, unknown>;
@@ -255,6 +276,7 @@ declare const RecallResponse: z.ZodObject<{
255
276
  memory_id: string;
256
277
  similarity_score: number;
257
278
  relevance_score: number;
279
+ score_components: Record<string, number>;
258
280
  summary?: string | null | undefined;
259
281
  }, {
260
282
  content: string;
@@ -267,11 +289,20 @@ declare const RecallResponse: z.ZodObject<{
267
289
  relevance_score: number;
268
290
  metadata?: Record<string, unknown> | undefined;
269
291
  summary?: string | null | undefined;
292
+ score_components?: Record<string, number> | undefined;
270
293
  }>, "many">;
271
294
  /** Total number of matches (may exceed `topK`). */
272
295
  total: z.ZodNumber;
273
296
  /** The query that was searched, if any. */
274
297
  query: z.ZodOptional<z.ZodNullable<z.ZodString>>;
298
+ /** Phase C: strategy that actually ran (after AUTO routing + re-rank). */
299
+ strategy_used: z.ZodDefault<z.ZodString>;
300
+ /** Phase C: AUTO's candidate list (e.g. `["AUTO->GRAPH"]`). */
301
+ strategies_considered: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
302
+ /** Phase C: whether the cross-encoder re-rank ran. */
303
+ reranked: z.ZodDefault<z.ZodBoolean>;
304
+ /** Phase C: end-to-end recall latency on the server (ms). */
305
+ elapsed_ms: z.ZodDefault<z.ZodNumber>;
275
306
  }, "strip", z.ZodTypeAny, {
276
307
  results: {
277
308
  content: string;
@@ -283,9 +314,14 @@ declare const RecallResponse: z.ZodObject<{
283
314
  memory_id: string;
284
315
  similarity_score: number;
285
316
  relevance_score: number;
317
+ score_components: Record<string, number>;
286
318
  summary?: string | null | undefined;
287
319
  }[];
288
320
  total: number;
321
+ strategy_used: string;
322
+ strategies_considered: string[];
323
+ reranked: boolean;
324
+ elapsed_ms: number;
289
325
  query?: string | null | undefined;
290
326
  }, {
291
327
  results: {
@@ -299,9 +335,14 @@ declare const RecallResponse: z.ZodObject<{
299
335
  relevance_score: number;
300
336
  metadata?: Record<string, unknown> | undefined;
301
337
  summary?: string | null | undefined;
338
+ score_components?: Record<string, number> | undefined;
302
339
  }[];
303
340
  total: number;
304
341
  query?: string | null | undefined;
342
+ strategy_used?: string | undefined;
343
+ strategies_considered?: string[] | undefined;
344
+ reranked?: boolean | undefined;
345
+ elapsed_ms?: number | undefined;
305
346
  }>;
306
347
  /** Parsed type for a recall response. */
307
348
  type RecallResponse = z.infer<typeof RecallResponse>;
@@ -714,6 +755,240 @@ declare const EndSessionResponse: z.ZodObject<{
714
755
  }>;
715
756
  /** Parsed type for an end-session response. */
716
757
  type EndSessionResponse = z.infer<typeof EndSessionResponse>;
758
+ /** Response to POST /v1/ingest — the enqueue ack. */
759
+ declare const IngestJobResponse: z.ZodObject<{
760
+ job_id: z.ZodString;
761
+ kind: z.ZodString;
762
+ status: z.ZodString;
763
+ dataset_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
764
+ enqueued_at: z.ZodString;
765
+ }, "strip", z.ZodTypeAny, {
766
+ status: string;
767
+ job_id: string;
768
+ kind: string;
769
+ enqueued_at: string;
770
+ dataset_id?: string | null | undefined;
771
+ }, {
772
+ status: string;
773
+ job_id: string;
774
+ kind: string;
775
+ enqueued_at: string;
776
+ dataset_id?: string | null | undefined;
777
+ }>;
778
+ type IngestJobResponse = z.infer<typeof IngestJobResponse>;
779
+ /** Full state from GET /v1/ingest/{job_id}. */
780
+ declare const IngestJobStatusResponse: z.ZodObject<{
781
+ job_id: z.ZodString;
782
+ agent_id: z.ZodString;
783
+ dataset_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
784
+ kind: z.ZodString;
785
+ status: z.ZodString;
786
+ source_uri: z.ZodOptional<z.ZodNullable<z.ZodString>>;
787
+ content_type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
788
+ filename: z.ZodOptional<z.ZodNullable<z.ZodString>>;
789
+ file_size: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
790
+ memory_ids: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
791
+ memos_written: z.ZodDefault<z.ZodNumber>;
792
+ distill_job_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
793
+ codegraph_memos_written: z.ZodDefault<z.ZodNumber>;
794
+ codegraph_edges_written: z.ZodDefault<z.ZodNumber>;
795
+ error: z.ZodOptional<z.ZodNullable<z.ZodString>>;
796
+ warnings: z.ZodDefault<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>, "many">>;
797
+ started_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
798
+ completed_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
799
+ created_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
800
+ updated_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
801
+ }, "strip", z.ZodTypeAny, {
802
+ status: string;
803
+ agent_id: string;
804
+ memory_ids: string[];
805
+ job_id: string;
806
+ kind: string;
807
+ memos_written: number;
808
+ codegraph_memos_written: number;
809
+ codegraph_edges_written: number;
810
+ warnings: Record<string, unknown>[];
811
+ created_at?: string | null | undefined;
812
+ started_at?: string | null | undefined;
813
+ dataset_id?: string | null | undefined;
814
+ source_uri?: string | null | undefined;
815
+ content_type?: string | null | undefined;
816
+ filename?: string | null | undefined;
817
+ file_size?: number | null | undefined;
818
+ distill_job_id?: string | null | undefined;
819
+ error?: string | null | undefined;
820
+ completed_at?: string | null | undefined;
821
+ updated_at?: string | null | undefined;
822
+ }, {
823
+ status: string;
824
+ agent_id: string;
825
+ job_id: string;
826
+ kind: string;
827
+ created_at?: string | null | undefined;
828
+ memory_ids?: string[] | undefined;
829
+ started_at?: string | null | undefined;
830
+ dataset_id?: string | null | undefined;
831
+ source_uri?: string | null | undefined;
832
+ content_type?: string | null | undefined;
833
+ filename?: string | null | undefined;
834
+ file_size?: number | null | undefined;
835
+ memos_written?: number | undefined;
836
+ distill_job_id?: string | null | undefined;
837
+ codegraph_memos_written?: number | undefined;
838
+ codegraph_edges_written?: number | undefined;
839
+ error?: string | null | undefined;
840
+ warnings?: Record<string, unknown>[] | undefined;
841
+ completed_at?: string | null | undefined;
842
+ updated_at?: string | null | undefined;
843
+ }>;
844
+ type IngestJobStatusResponse = z.infer<typeof IngestJobStatusResponse>;
845
+ /** Distill enqueue ack. */
846
+ declare const DistillJobResponse: z.ZodObject<{
847
+ job_id: z.ZodString;
848
+ status: z.ZodString;
849
+ memory_ids: z.ZodArray<z.ZodString, "many">;
850
+ enqueued_at: z.ZodString;
851
+ }, "strip", z.ZodTypeAny, {
852
+ status: string;
853
+ memory_ids: string[];
854
+ job_id: string;
855
+ enqueued_at: string;
856
+ }, {
857
+ status: string;
858
+ memory_ids: string[];
859
+ job_id: string;
860
+ enqueued_at: string;
861
+ }>;
862
+ type DistillJobResponse = z.infer<typeof DistillJobResponse>;
863
+ /** Full distill job state. */
864
+ declare const DistillJobStatusResponse: z.ZodObject<{
865
+ job_id: z.ZodString;
866
+ agent_id: z.ZodString;
867
+ status: z.ZodString;
868
+ model: z.ZodString;
869
+ memory_ids: z.ZodArray<z.ZodString, "many">;
870
+ chunk_size: z.ZodNumber;
871
+ chunk_overlap: z.ZodNumber;
872
+ max_concurrency: z.ZodNumber;
873
+ chunks_total: z.ZodNumber;
874
+ chunks_failed: z.ZodNumber;
875
+ entities_extracted: z.ZodNumber;
876
+ relationships_extracted: z.ZodNumber;
877
+ memos_written: z.ZodNumber;
878
+ error: z.ZodOptional<z.ZodNullable<z.ZodString>>;
879
+ started_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
880
+ completed_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
881
+ created_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
882
+ updated_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
883
+ }, "strip", z.ZodTypeAny, {
884
+ status: string;
885
+ agent_id: string;
886
+ memory_ids: string[];
887
+ job_id: string;
888
+ memos_written: number;
889
+ model: string;
890
+ chunk_size: number;
891
+ chunk_overlap: number;
892
+ max_concurrency: number;
893
+ chunks_total: number;
894
+ chunks_failed: number;
895
+ entities_extracted: number;
896
+ relationships_extracted: number;
897
+ created_at?: string | null | undefined;
898
+ started_at?: string | null | undefined;
899
+ error?: string | null | undefined;
900
+ completed_at?: string | null | undefined;
901
+ updated_at?: string | null | undefined;
902
+ }, {
903
+ status: string;
904
+ agent_id: string;
905
+ memory_ids: string[];
906
+ job_id: string;
907
+ memos_written: number;
908
+ model: string;
909
+ chunk_size: number;
910
+ chunk_overlap: number;
911
+ max_concurrency: number;
912
+ chunks_total: number;
913
+ chunks_failed: number;
914
+ entities_extracted: number;
915
+ relationships_extracted: number;
916
+ created_at?: string | null | undefined;
917
+ started_at?: string | null | undefined;
918
+ error?: string | null | undefined;
919
+ completed_at?: string | null | undefined;
920
+ updated_at?: string | null | undefined;
921
+ }>;
922
+ type DistillJobStatusResponse = z.infer<typeof DistillJobStatusResponse>;
923
+ /** Refine enqueue ack. */
924
+ declare const RefineJobResponse: z.ZodObject<{
925
+ job_id: z.ZodString;
926
+ status: z.ZodString;
927
+ dataset_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
928
+ enqueued_at: z.ZodString;
929
+ }, "strip", z.ZodTypeAny, {
930
+ status: string;
931
+ job_id: string;
932
+ enqueued_at: string;
933
+ dataset_id?: string | null | undefined;
934
+ }, {
935
+ status: string;
936
+ job_id: string;
937
+ enqueued_at: string;
938
+ dataset_id?: string | null | undefined;
939
+ }>;
940
+ type RefineJobResponse = z.infer<typeof RefineJobResponse>;
941
+ /** Full refine job state. */
942
+ declare const RefineJobStatusResponse: z.ZodObject<{
943
+ job_id: z.ZodString;
944
+ status: z.ZodString;
945
+ dataset_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
946
+ trigger: z.ZodString;
947
+ memos_scanned: z.ZodDefault<z.ZodNumber>;
948
+ memos_deduped: z.ZodDefault<z.ZodNumber>;
949
+ edges_reweighted: z.ZodDefault<z.ZodNumber>;
950
+ edges_pruned: z.ZodDefault<z.ZodNumber>;
951
+ feedback_drained: z.ZodDefault<z.ZodNumber>;
952
+ job_metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
953
+ error: z.ZodOptional<z.ZodNullable<z.ZodString>>;
954
+ started_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
955
+ completed_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
956
+ created_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
957
+ updated_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
958
+ }, "strip", z.ZodTypeAny, {
959
+ status: string;
960
+ job_id: string;
961
+ trigger: string;
962
+ memos_scanned: number;
963
+ memos_deduped: number;
964
+ edges_reweighted: number;
965
+ edges_pruned: number;
966
+ feedback_drained: number;
967
+ job_metadata: Record<string, unknown>;
968
+ created_at?: string | null | undefined;
969
+ started_at?: string | null | undefined;
970
+ dataset_id?: string | null | undefined;
971
+ error?: string | null | undefined;
972
+ completed_at?: string | null | undefined;
973
+ updated_at?: string | null | undefined;
974
+ }, {
975
+ status: string;
976
+ job_id: string;
977
+ trigger: string;
978
+ created_at?: string | null | undefined;
979
+ started_at?: string | null | undefined;
980
+ dataset_id?: string | null | undefined;
981
+ error?: string | null | undefined;
982
+ completed_at?: string | null | undefined;
983
+ updated_at?: string | null | undefined;
984
+ memos_scanned?: number | undefined;
985
+ memos_deduped?: number | undefined;
986
+ edges_reweighted?: number | undefined;
987
+ edges_pruned?: number | undefined;
988
+ feedback_drained?: number | undefined;
989
+ job_metadata?: Record<string, unknown> | undefined;
990
+ }>;
991
+ type RefineJobStatusResponse = z.infer<typeof RefineJobStatusResponse>;
717
992
 
718
993
  /**
719
994
  * Z3rno TypeScript SDK client.
@@ -910,6 +1185,18 @@ declare class Z3rnoClient {
910
1185
  filters?: Record<string, unknown>;
911
1186
  topK?: number;
912
1187
  similarityThreshold?: number;
1188
+ /**
1189
+ * Phase C: retrieval strategy. One of `AUTO | VECTOR | LEXICAL |
1190
+ * GRAPH | TRIPLET | TRACE | TEMPORAL | ASK | CYPHER`. Default
1191
+ * `"AUTO"` — server's LLM router picks per query.
1192
+ */
1193
+ strategy?: string;
1194
+ /**
1195
+ * Phase C: cross-encoder re-ranking. When `true`, the server
1196
+ * re-ranks the strategy's top results. Requires
1197
+ * `sentence-transformers` on the server side.
1198
+ */
1199
+ rerank?: boolean;
913
1200
  }): Promise<RecallResponse>;
914
1201
  /**
915
1202
  * Forgets (deletes) one or more memories.
@@ -1106,6 +1393,31 @@ declare class Z3rnoClient {
1106
1393
  page?: number;
1107
1394
  pageSize?: number;
1108
1395
  }): Promise<AuditPageResponse>;
1396
+ ingestText(params: {
1397
+ agentId: string;
1398
+ text: string;
1399
+ datasetId?: string;
1400
+ }): Promise<IngestJobResponse>;
1401
+ ingestUrl(params: {
1402
+ agentId: string;
1403
+ url: string;
1404
+ datasetId?: string;
1405
+ }): Promise<IngestJobResponse>;
1406
+ getIngestStatus(jobId: string): Promise<IngestJobStatusResponse>;
1407
+ distill(params: {
1408
+ agentId: string;
1409
+ memoryIds: string[];
1410
+ chunkSize?: number;
1411
+ chunkOverlap?: number;
1412
+ maxConcurrency?: number;
1413
+ summaryStyle?: string;
1414
+ includeSummary?: boolean;
1415
+ }): Promise<DistillJobResponse>;
1416
+ getDistillStatus(jobId: string): Promise<DistillJobStatusResponse>;
1417
+ refine(params?: {
1418
+ datasetId?: string;
1419
+ }): Promise<RefineJobResponse>;
1420
+ getRefineStatus(jobId: string): Promise<RefineJobStatusResponse>;
1109
1421
  private request;
1110
1422
  private sleep;
1111
1423
  private handleResponse;
@@ -1310,4 +1622,4 @@ declare class Z3rnoConnectionError extends Z3rnoError {
1310
1622
  constructor(message: string);
1311
1623
  }
1312
1624
 
1313
- export { AuditEntry, AuditPageResponse, AuthenticationError, BatchStoreResponse, EndSessionResponse, ForgetResponse, MemoryHistoryResponse, MemoryResponse, MemoryType, MemoryVersion, NotFoundError, RateLimitError, RecallResponse, RecallResultItem, RelationshipType, ServerError, SessionResponse, StoreMemoryRequest, ValidationError, Z3rnoClient, type Z3rnoClientConfig, Z3rnoConnectionError, Z3rnoError, Z3rnoTimeoutError };
1625
+ export { AuditEntry, AuditPageResponse, AuthenticationError, BatchStoreResponse, DistillJobResponse, DistillJobStatusResponse, EndSessionResponse, ForgetResponse, IngestJobResponse, IngestJobStatusResponse, MemoryHistoryResponse, MemoryResponse, MemoryType, MemoryVersion, NotFoundError, RateLimitError, RecallResponse, RecallResultItem, RefineJobResponse, RefineJobStatusResponse, RelationshipType, RetrievalStrategy, ServerError, SessionResponse, StoreMemoryRequest, ValidationError, Z3rnoClient, type Z3rnoClientConfig, Z3rnoConnectionError, Z3rnoError, Z3rnoTimeoutError };