@z3rno/sdk 0.3.0 → 0.5.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.cjs +374 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +509 -1
- package/dist/index.d.ts +509 -1
- package/dist/index.js +363 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -755,6 +755,354 @@ declare const EndSessionResponse: z.ZodObject<{
|
|
|
755
755
|
}>;
|
|
756
756
|
/** Parsed type for an end-session response. */
|
|
757
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>;
|
|
992
|
+
/** Conversation metadata. */
|
|
993
|
+
declare const ConversationResponse: z.ZodObject<{
|
|
994
|
+
id: z.ZodString;
|
|
995
|
+
agent_id: z.ZodString;
|
|
996
|
+
user_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
997
|
+
title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
998
|
+
summary_cadence: z.ZodNumber;
|
|
999
|
+
turn_count: z.ZodNumber;
|
|
1000
|
+
last_summary_turn: z.ZodNumber;
|
|
1001
|
+
metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1002
|
+
created_at: z.ZodString;
|
|
1003
|
+
updated_at: z.ZodString;
|
|
1004
|
+
}, "strip", z.ZodTypeAny, {
|
|
1005
|
+
metadata: Record<string, unknown>;
|
|
1006
|
+
id: string;
|
|
1007
|
+
agent_id: string;
|
|
1008
|
+
created_at: string;
|
|
1009
|
+
updated_at: string;
|
|
1010
|
+
summary_cadence: number;
|
|
1011
|
+
turn_count: number;
|
|
1012
|
+
last_summary_turn: number;
|
|
1013
|
+
user_id?: string | null | undefined;
|
|
1014
|
+
title?: string | null | undefined;
|
|
1015
|
+
}, {
|
|
1016
|
+
id: string;
|
|
1017
|
+
agent_id: string;
|
|
1018
|
+
created_at: string;
|
|
1019
|
+
updated_at: string;
|
|
1020
|
+
summary_cadence: number;
|
|
1021
|
+
turn_count: number;
|
|
1022
|
+
last_summary_turn: number;
|
|
1023
|
+
metadata?: Record<string, unknown> | undefined;
|
|
1024
|
+
user_id?: string | null | undefined;
|
|
1025
|
+
title?: string | null | undefined;
|
|
1026
|
+
}>;
|
|
1027
|
+
type ConversationResponse = z.infer<typeof ConversationResponse>;
|
|
1028
|
+
/** Result of POST /v1/conversations/{id}/turns. */
|
|
1029
|
+
declare const TurnAddResponse: z.ZodObject<{
|
|
1030
|
+
turn_index: z.ZodNumber;
|
|
1031
|
+
needs_summary: z.ZodBoolean;
|
|
1032
|
+
}, "strip", z.ZodTypeAny, {
|
|
1033
|
+
turn_index: number;
|
|
1034
|
+
needs_summary: boolean;
|
|
1035
|
+
}, {
|
|
1036
|
+
turn_index: number;
|
|
1037
|
+
needs_summary: boolean;
|
|
1038
|
+
}>;
|
|
1039
|
+
type TurnAddResponse = z.infer<typeof TurnAddResponse>;
|
|
1040
|
+
/** One turn within a conversation. */
|
|
1041
|
+
declare const TurnResponse: z.ZodObject<{
|
|
1042
|
+
memory_id: z.ZodString;
|
|
1043
|
+
turn_index: z.ZodNumber;
|
|
1044
|
+
turn_role: z.ZodString;
|
|
1045
|
+
content: z.ZodString;
|
|
1046
|
+
created_at: z.ZodString;
|
|
1047
|
+
}, "strip", z.ZodTypeAny, {
|
|
1048
|
+
content: string;
|
|
1049
|
+
created_at: string;
|
|
1050
|
+
memory_id: string;
|
|
1051
|
+
turn_index: number;
|
|
1052
|
+
turn_role: string;
|
|
1053
|
+
}, {
|
|
1054
|
+
content: string;
|
|
1055
|
+
created_at: string;
|
|
1056
|
+
memory_id: string;
|
|
1057
|
+
turn_index: number;
|
|
1058
|
+
turn_role: string;
|
|
1059
|
+
}>;
|
|
1060
|
+
type TurnResponse = z.infer<typeof TurnResponse>;
|
|
1061
|
+
/** Paginated turn list. */
|
|
1062
|
+
declare const TurnListResponse: z.ZodObject<{
|
|
1063
|
+
turns: z.ZodArray<z.ZodObject<{
|
|
1064
|
+
memory_id: z.ZodString;
|
|
1065
|
+
turn_index: z.ZodNumber;
|
|
1066
|
+
turn_role: z.ZodString;
|
|
1067
|
+
content: z.ZodString;
|
|
1068
|
+
created_at: z.ZodString;
|
|
1069
|
+
}, "strip", z.ZodTypeAny, {
|
|
1070
|
+
content: string;
|
|
1071
|
+
created_at: string;
|
|
1072
|
+
memory_id: string;
|
|
1073
|
+
turn_index: number;
|
|
1074
|
+
turn_role: string;
|
|
1075
|
+
}, {
|
|
1076
|
+
content: string;
|
|
1077
|
+
created_at: string;
|
|
1078
|
+
memory_id: string;
|
|
1079
|
+
turn_index: number;
|
|
1080
|
+
turn_role: string;
|
|
1081
|
+
}>, "many">;
|
|
1082
|
+
total: z.ZodNumber;
|
|
1083
|
+
conversation_id: z.ZodString;
|
|
1084
|
+
}, "strip", z.ZodTypeAny, {
|
|
1085
|
+
total: number;
|
|
1086
|
+
turns: {
|
|
1087
|
+
content: string;
|
|
1088
|
+
created_at: string;
|
|
1089
|
+
memory_id: string;
|
|
1090
|
+
turn_index: number;
|
|
1091
|
+
turn_role: string;
|
|
1092
|
+
}[];
|
|
1093
|
+
conversation_id: string;
|
|
1094
|
+
}, {
|
|
1095
|
+
total: number;
|
|
1096
|
+
turns: {
|
|
1097
|
+
content: string;
|
|
1098
|
+
created_at: string;
|
|
1099
|
+
memory_id: string;
|
|
1100
|
+
turn_index: number;
|
|
1101
|
+
turn_role: string;
|
|
1102
|
+
}[];
|
|
1103
|
+
conversation_id: string;
|
|
1104
|
+
}>;
|
|
1105
|
+
type TurnListResponse = z.infer<typeof TurnListResponse>;
|
|
758
1106
|
|
|
759
1107
|
/**
|
|
760
1108
|
* Z3rno TypeScript SDK client.
|
|
@@ -963,6 +1311,11 @@ declare class Z3rnoClient {
|
|
|
963
1311
|
* `sentence-transformers` on the server side.
|
|
964
1312
|
*/
|
|
965
1313
|
rerank?: boolean;
|
|
1314
|
+
/**
|
|
1315
|
+
* Phase G slice 2: scope recall to a single conversation. Older
|
|
1316
|
+
* servers ignore the field.
|
|
1317
|
+
*/
|
|
1318
|
+
conversationId?: string;
|
|
966
1319
|
}): Promise<RecallResponse>;
|
|
967
1320
|
/**
|
|
968
1321
|
* Forgets (deletes) one or more memories.
|
|
@@ -1159,6 +1512,58 @@ declare class Z3rnoClient {
|
|
|
1159
1512
|
page?: number;
|
|
1160
1513
|
pageSize?: number;
|
|
1161
1514
|
}): Promise<AuditPageResponse>;
|
|
1515
|
+
ingestText(params: {
|
|
1516
|
+
agentId: string;
|
|
1517
|
+
text: string;
|
|
1518
|
+
datasetId?: string;
|
|
1519
|
+
}): Promise<IngestJobResponse>;
|
|
1520
|
+
ingestUrl(params: {
|
|
1521
|
+
agentId: string;
|
|
1522
|
+
url: string;
|
|
1523
|
+
datasetId?: string;
|
|
1524
|
+
}): Promise<IngestJobResponse>;
|
|
1525
|
+
getIngestStatus(jobId: string): Promise<IngestJobStatusResponse>;
|
|
1526
|
+
distill(params: {
|
|
1527
|
+
agentId: string;
|
|
1528
|
+
memoryIds: string[];
|
|
1529
|
+
chunkSize?: number;
|
|
1530
|
+
chunkOverlap?: number;
|
|
1531
|
+
maxConcurrency?: number;
|
|
1532
|
+
summaryStyle?: string;
|
|
1533
|
+
includeSummary?: boolean;
|
|
1534
|
+
}): Promise<DistillJobResponse>;
|
|
1535
|
+
getDistillStatus(jobId: string): Promise<DistillJobStatusResponse>;
|
|
1536
|
+
refine(params?: {
|
|
1537
|
+
datasetId?: string;
|
|
1538
|
+
}): Promise<RefineJobResponse>;
|
|
1539
|
+
getRefineStatus(jobId: string): Promise<RefineJobStatusResponse>;
|
|
1540
|
+
/**
|
|
1541
|
+
* Open a new conversation. Returns the conversation row including
|
|
1542
|
+
* the assigned `id`, which subsequent `recall`s and `addTurn`s
|
|
1543
|
+
* reference. The `summaryCadence` controls how often the server
|
|
1544
|
+
* flags the conversation for summarization.
|
|
1545
|
+
*/
|
|
1546
|
+
createConversation(params: {
|
|
1547
|
+
agentId: string;
|
|
1548
|
+
userId?: string;
|
|
1549
|
+
title?: string;
|
|
1550
|
+
summaryCadence?: number;
|
|
1551
|
+
metadata?: Record<string, unknown>;
|
|
1552
|
+
}): Promise<ConversationResponse>;
|
|
1553
|
+
getConversation(conversationId: string): Promise<ConversationResponse>;
|
|
1554
|
+
/**
|
|
1555
|
+
* Stamp an existing Memo as the next turn of the conversation.
|
|
1556
|
+
* Returns the assigned `turn_index` plus `needs_summary` — when
|
|
1557
|
+
* `true`, the conversation has crossed its cadence threshold.
|
|
1558
|
+
*/
|
|
1559
|
+
addTurn(conversationId: string, params: {
|
|
1560
|
+
memoryId: string;
|
|
1561
|
+
turnRole: string;
|
|
1562
|
+
}): Promise<TurnAddResponse>;
|
|
1563
|
+
listTurns(conversationId: string, params?: {
|
|
1564
|
+
afterTurn?: number;
|
|
1565
|
+
limit?: number;
|
|
1566
|
+
}): Promise<TurnListResponse>;
|
|
1162
1567
|
private request;
|
|
1163
1568
|
private sleep;
|
|
1164
1569
|
private handleResponse;
|
|
@@ -1363,4 +1768,107 @@ declare class Z3rnoConnectionError extends Z3rnoError {
|
|
|
1363
1768
|
constructor(message: string);
|
|
1364
1769
|
}
|
|
1365
1770
|
|
|
1366
|
-
|
|
1771
|
+
/**
|
|
1772
|
+
* Vercel AI SDK adapter for Z3rno (Phase G slice 3).
|
|
1773
|
+
*
|
|
1774
|
+
* Vercel AI SDK accepts a plain `CoreMessage[]` history; this adapter
|
|
1775
|
+
* loads + persists that history through Z3rno conversations. Drop the
|
|
1776
|
+
* `messages` accessor straight into `streamText` / `generateText`,
|
|
1777
|
+
* call `appendUserMessage` / `appendAssistantMessage` after each turn,
|
|
1778
|
+
* and Z3rno handles ordering + recall.
|
|
1779
|
+
*
|
|
1780
|
+
* Zero hard dependency on the `ai` package — we duck-type on the
|
|
1781
|
+
* minimal `CoreMessage` shape (`{ role, content }`).
|
|
1782
|
+
*/
|
|
1783
|
+
|
|
1784
|
+
type Z3rnoMessageRole = "user" | "assistant" | "system" | "tool";
|
|
1785
|
+
/** Subset of Vercel `ai` `CoreMessage` the adapter needs. */
|
|
1786
|
+
interface CoreMessage {
|
|
1787
|
+
role: Z3rnoMessageRole;
|
|
1788
|
+
content: string;
|
|
1789
|
+
}
|
|
1790
|
+
interface Z3rnoVercelMemoryOptions {
|
|
1791
|
+
client: Z3rnoClient;
|
|
1792
|
+
agentId: string;
|
|
1793
|
+
/** When set, recall + persisted turns are scoped to this Z3rno conversation. */
|
|
1794
|
+
conversationId?: string;
|
|
1795
|
+
/** Max history slice to load. Default 50. */
|
|
1796
|
+
topK?: number;
|
|
1797
|
+
}
|
|
1798
|
+
/**
|
|
1799
|
+
* Lightweight history adapter you can hand straight to Vercel AI SDK
|
|
1800
|
+
* helpers. `await mem.messages()` returns a CoreMessage[] ready to
|
|
1801
|
+
* pass to `streamText({ messages: ... })`. After each turn, call
|
|
1802
|
+
* `appendUserMessage` / `appendAssistantMessage` so future recalls
|
|
1803
|
+
* see the latest state.
|
|
1804
|
+
*/
|
|
1805
|
+
declare class Z3rnoVercelMemory {
|
|
1806
|
+
private readonly client;
|
|
1807
|
+
private readonly agentId;
|
|
1808
|
+
private readonly conversationId;
|
|
1809
|
+
private readonly topK;
|
|
1810
|
+
constructor(options: Z3rnoVercelMemoryOptions);
|
|
1811
|
+
messages(): Promise<CoreMessage[]>;
|
|
1812
|
+
appendUserMessage(content: string): Promise<void>;
|
|
1813
|
+
appendAssistantMessage(content: string): Promise<void>;
|
|
1814
|
+
appendToolMessage(content: string): Promise<void>;
|
|
1815
|
+
private append;
|
|
1816
|
+
private normaliseRole;
|
|
1817
|
+
}
|
|
1818
|
+
|
|
1819
|
+
/**
|
|
1820
|
+
* Mastra adapter for Z3rno (Phase G slice 3).
|
|
1821
|
+
*
|
|
1822
|
+
* Mastra exposes a `MastraMemory`-shaped interface — see
|
|
1823
|
+
* https://mastra.ai/docs/agents/memory. This adapter implements
|
|
1824
|
+
* the same surface (`getMessages` / `addMessage` / `clear`) using
|
|
1825
|
+
* Z3rno conversations as the backing store.
|
|
1826
|
+
*
|
|
1827
|
+
* Zero hard dependency on the `@mastra/core` package — we provide
|
|
1828
|
+
* the typed surface and Mastra's runtime accepts any conforming
|
|
1829
|
+
* object.
|
|
1830
|
+
*/
|
|
1831
|
+
|
|
1832
|
+
type MastraRole = "user" | "assistant" | "system" | "tool";
|
|
1833
|
+
interface MastraMessage {
|
|
1834
|
+
role: MastraRole;
|
|
1835
|
+
content: string;
|
|
1836
|
+
threadId?: string;
|
|
1837
|
+
resourceId?: string;
|
|
1838
|
+
}
|
|
1839
|
+
interface Z3rnoMastraMemoryOptions {
|
|
1840
|
+
client: Z3rnoClient;
|
|
1841
|
+
agentId: string;
|
|
1842
|
+
/** Mastra's thread is Z3rno's conversation; supply or look up by threadId. */
|
|
1843
|
+
conversationId?: string;
|
|
1844
|
+
topK?: number;
|
|
1845
|
+
}
|
|
1846
|
+
/**
|
|
1847
|
+
* Mastra-compatible memory backed by Z3rno conversations. Plug into
|
|
1848
|
+
* a Mastra `Agent`:
|
|
1849
|
+
*
|
|
1850
|
+
* const memory = new Z3rnoMastraMemory({ client, agentId, conversationId });
|
|
1851
|
+
* const agent = new Agent({ name: "support", memory });
|
|
1852
|
+
*/
|
|
1853
|
+
declare class Z3rnoMastraMemory {
|
|
1854
|
+
private readonly client;
|
|
1855
|
+
private readonly agentId;
|
|
1856
|
+
private readonly conversationId;
|
|
1857
|
+
private readonly topK;
|
|
1858
|
+
constructor(options: Z3rnoMastraMemoryOptions);
|
|
1859
|
+
/** Mastra contract: return ordered prior messages for the thread. */
|
|
1860
|
+
getMessages(_args?: {
|
|
1861
|
+
limit?: number;
|
|
1862
|
+
}): Promise<MastraMessage[]>;
|
|
1863
|
+
/** Mastra contract: persist one message. */
|
|
1864
|
+
addMessage(message: MastraMessage): Promise<void>;
|
|
1865
|
+
/**
|
|
1866
|
+
* Mastra `clear()` — deliberate no-op. Z3rno keeps the source of
|
|
1867
|
+
* truth and recall is already scoped per conversation; flushing
|
|
1868
|
+
* the thread would risk losing audit-relevant history.
|
|
1869
|
+
*/
|
|
1870
|
+
clear(): Promise<void>;
|
|
1871
|
+
private normaliseRole;
|
|
1872
|
+
}
|
|
1873
|
+
|
|
1874
|
+
export { AuditEntry, AuditPageResponse, AuthenticationError, BatchStoreResponse, ConversationResponse, type CoreMessage, DistillJobResponse, DistillJobStatusResponse, EndSessionResponse, ForgetResponse, IngestJobResponse, IngestJobStatusResponse, type MastraMessage, type MastraRole, MemoryHistoryResponse, MemoryResponse, MemoryType, MemoryVersion, NotFoundError, RateLimitError, RecallResponse, RecallResultItem, RefineJobResponse, RefineJobStatusResponse, RelationshipType, RetrievalStrategy, ServerError, SessionResponse, StoreMemoryRequest, TurnAddResponse, TurnListResponse, TurnResponse, ValidationError, Z3rnoClient, type Z3rnoClientConfig, Z3rnoConnectionError, Z3rnoError, Z3rnoMastraMemory, type Z3rnoMastraMemoryOptions, type Z3rnoMessageRole, Z3rnoTimeoutError, Z3rnoVercelMemory, type Z3rnoVercelMemoryOptions };
|