@absolutejs/absolute 0.19.0-beta.436 → 0.19.0-beta.437

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.
Files changed (42) hide show
  1. package/dist/ai/client/index.js +60 -1
  2. package/dist/ai/client/index.js.map +3 -3
  3. package/dist/ai/index.js +199 -2
  4. package/dist/ai/index.js.map +4 -4
  5. package/dist/ai-client/angular/ai/index.js +59 -0
  6. package/dist/ai-client/react/ai/index.js +346 -126
  7. package/dist/ai-client/vue/ai/index.js +59 -0
  8. package/dist/angular/ai/index.js +60 -1
  9. package/dist/angular/ai/index.js.map +3 -3
  10. package/dist/angular/index.js +4 -3
  11. package/dist/angular/index.js.map +4 -4
  12. package/dist/angular/server.js +2 -2
  13. package/dist/angular/server.js.map +1 -1
  14. package/dist/build.js +2 -2
  15. package/dist/build.js.map +1 -1
  16. package/dist/client/index.js +2 -1
  17. package/dist/client/index.js.map +3 -3
  18. package/dist/index.js +4 -3
  19. package/dist/index.js.map +4 -4
  20. package/dist/react/ai/index.js +600 -294
  21. package/dist/react/ai/index.js.map +12 -8
  22. package/dist/react/index.js +3 -2
  23. package/dist/react/index.js.map +4 -4
  24. package/dist/src/ai/client/ragClient.d.ts +7 -1
  25. package/dist/src/ai/rag/chat.d.ts +120 -2
  26. package/dist/src/react/ai/index.d.ts +3 -0
  27. package/dist/src/react/ai/useRAG.d.ts +31 -0
  28. package/dist/src/react/ai/useRAGChunkPreview.d.ts +11 -0
  29. package/dist/src/react/ai/useRAGDocuments.d.ts +10 -0
  30. package/dist/src/react/ai/useRAGIndexAdmin.d.ts +16 -0
  31. package/dist/svelte/ai/index.js +60 -1
  32. package/dist/svelte/ai/index.js.map +3 -3
  33. package/dist/svelte/index.js +3 -2
  34. package/dist/svelte/index.js.map +4 -4
  35. package/dist/types/ai.d.ts +73 -0
  36. package/dist/vue/ai/index.js +60 -1
  37. package/dist/vue/ai/index.js.map +3 -3
  38. package/dist/vue/components/index.js +11 -2
  39. package/dist/vue/components/index.js.map +3 -3
  40. package/dist/vue/index.js +13 -3
  41. package/dist/vue/index.js.map +5 -5
  42. package/package.json +1 -1
@@ -740,6 +740,65 @@ var createRAGClient = (options) => {
740
740
  }
741
741
  return parseJson(response);
742
742
  },
743
+ async documents(kind) {
744
+ const query = kind ? `?kind=${encodeURIComponent(kind)}` : "";
745
+ const response = await fetchImpl(`${basePath}/documents${query}`);
746
+ if (!response.ok) {
747
+ throw new Error(await toErrorMessage(response));
748
+ }
749
+ return parseJson(response);
750
+ },
751
+ async documentChunks(id) {
752
+ const response = await fetchImpl(`${basePath}/documents/${encodeURIComponent(id)}/chunks`);
753
+ if (!response.ok) {
754
+ const error = await toErrorMessage(response);
755
+ return { ok: false, error };
756
+ }
757
+ return parseJson(response);
758
+ },
759
+ async deleteDocument(id) {
760
+ const response = await fetchImpl(`${basePath}/documents/${encodeURIComponent(id)}`, {
761
+ method: "DELETE"
762
+ });
763
+ if (!response.ok) {
764
+ return {
765
+ ok: false,
766
+ error: await toErrorMessage(response)
767
+ };
768
+ }
769
+ return parseJson(response);
770
+ },
771
+ async reseed() {
772
+ const response = await fetchImpl(`${basePath}/reseed`, {
773
+ method: "POST"
774
+ });
775
+ if (!response.ok) {
776
+ return {
777
+ ok: false,
778
+ error: await toErrorMessage(response)
779
+ };
780
+ }
781
+ return parseJson(response);
782
+ },
783
+ async reset() {
784
+ const response = await fetchImpl(`${basePath}/reset`, {
785
+ method: "POST"
786
+ });
787
+ if (!response.ok) {
788
+ return {
789
+ ok: false,
790
+ error: await toErrorMessage(response)
791
+ };
792
+ }
793
+ return parseJson(response);
794
+ },
795
+ async backends() {
796
+ const response = await fetchImpl(`${basePath}/backends`);
797
+ if (!response.ok) {
798
+ throw new Error(await toErrorMessage(response));
799
+ }
800
+ return parseJson(response);
801
+ },
743
802
  async clearIndex() {
744
803
  const response = await fetchImpl(`${basePath}/index`, {
745
804
  method: "DELETE"
@@ -629,11 +629,192 @@ var useAIStream = (path, conversationId) => {
629
629
  send
630
630
  };
631
631
  };
632
+ // src/react/ai/useRAGChunkPreview.ts
633
+ import { useCallback as useCallback2, useMemo, useState } from "react";
634
+ // src/ai/client/ragClient.ts
635
+ var jsonHeaders = {
636
+ "Content-Type": "application/json"
637
+ };
638
+ var normalizeBasePath = (path) => path.endsWith("/") ? path.slice(0, -1) : path;
639
+ var parseJson = async (response) => {
640
+ const payload = await response.json();
641
+ return payload;
642
+ };
643
+ var toErrorMessage = async (response) => {
644
+ try {
645
+ const payload = await response.json();
646
+ if (typeof payload.error === "string" && payload.error) {
647
+ return payload.error;
648
+ }
649
+ } catch {}
650
+ return `Request failed with status ${response.status}`;
651
+ };
652
+ var createRAGClient = (options) => {
653
+ const basePath = normalizeBasePath(options.path);
654
+ const fetchImpl = options.fetch ?? fetch;
655
+ return {
656
+ async ingest(chunks) {
657
+ const response = await fetchImpl(`${basePath}/ingest`, {
658
+ body: JSON.stringify({ chunks }),
659
+ headers: jsonHeaders,
660
+ method: "POST"
661
+ });
662
+ if (!response.ok) {
663
+ return {
664
+ ok: false,
665
+ error: await toErrorMessage(response)
666
+ };
667
+ }
668
+ return parseJson(response);
669
+ },
670
+ async ingestDocuments(input) {
671
+ const response = await fetchImpl(`${basePath}/ingest`, {
672
+ body: JSON.stringify(input),
673
+ headers: jsonHeaders,
674
+ method: "POST"
675
+ });
676
+ if (!response.ok) {
677
+ return {
678
+ ok: false,
679
+ error: await toErrorMessage(response)
680
+ };
681
+ }
682
+ return parseJson(response);
683
+ },
684
+ async search(input) {
685
+ const response = await fetchImpl(`${basePath}/search`, {
686
+ body: JSON.stringify(input),
687
+ headers: jsonHeaders,
688
+ method: "POST"
689
+ });
690
+ if (!response.ok) {
691
+ throw new Error(await toErrorMessage(response));
692
+ }
693
+ const payload = await parseJson(response);
694
+ if (!payload.ok) {
695
+ throw new Error(payload.error ?? "RAG search failed");
696
+ }
697
+ return payload.results ?? [];
698
+ },
699
+ async status() {
700
+ const response = await fetchImpl(`${basePath}/status`);
701
+ if (!response.ok) {
702
+ throw new Error(await toErrorMessage(response));
703
+ }
704
+ return parseJson(response);
705
+ },
706
+ async documents(kind) {
707
+ const query = kind ? `?kind=${encodeURIComponent(kind)}` : "";
708
+ const response = await fetchImpl(`${basePath}/documents${query}`);
709
+ if (!response.ok) {
710
+ throw new Error(await toErrorMessage(response));
711
+ }
712
+ return parseJson(response);
713
+ },
714
+ async documentChunks(id) {
715
+ const response = await fetchImpl(`${basePath}/documents/${encodeURIComponent(id)}/chunks`);
716
+ if (!response.ok) {
717
+ const error = await toErrorMessage(response);
718
+ return { ok: false, error };
719
+ }
720
+ return parseJson(response);
721
+ },
722
+ async deleteDocument(id) {
723
+ const response = await fetchImpl(`${basePath}/documents/${encodeURIComponent(id)}`, {
724
+ method: "DELETE"
725
+ });
726
+ if (!response.ok) {
727
+ return {
728
+ ok: false,
729
+ error: await toErrorMessage(response)
730
+ };
731
+ }
732
+ return parseJson(response);
733
+ },
734
+ async reseed() {
735
+ const response = await fetchImpl(`${basePath}/reseed`, {
736
+ method: "POST"
737
+ });
738
+ if (!response.ok) {
739
+ return {
740
+ ok: false,
741
+ error: await toErrorMessage(response)
742
+ };
743
+ }
744
+ return parseJson(response);
745
+ },
746
+ async reset() {
747
+ const response = await fetchImpl(`${basePath}/reset`, {
748
+ method: "POST"
749
+ });
750
+ if (!response.ok) {
751
+ return {
752
+ ok: false,
753
+ error: await toErrorMessage(response)
754
+ };
755
+ }
756
+ return parseJson(response);
757
+ },
758
+ async backends() {
759
+ const response = await fetchImpl(`${basePath}/backends`);
760
+ if (!response.ok) {
761
+ throw new Error(await toErrorMessage(response));
762
+ }
763
+ return parseJson(response);
764
+ },
765
+ async clearIndex() {
766
+ const response = await fetchImpl(`${basePath}/index`, {
767
+ method: "DELETE"
768
+ });
769
+ if (!response.ok) {
770
+ throw new Error(await toErrorMessage(response));
771
+ }
772
+ return parseJson(response);
773
+ }
774
+ };
775
+ };
776
+ // src/react/ai/useRAGChunkPreview.ts
777
+ var useRAGChunkPreview = (path) => {
778
+ const client = useMemo(() => createRAGClient({ path }), [path]);
779
+ const [preview, setPreview] = useState(null);
780
+ const [isLoading, setIsLoading] = useState(false);
781
+ const [error, setError] = useState(null);
782
+ const inspect = useCallback2(async (id) => {
783
+ setIsLoading(true);
784
+ setError(null);
785
+ try {
786
+ const response = await client.documentChunks(id);
787
+ if (!response.ok) {
788
+ throw new Error(response.error);
789
+ }
790
+ setPreview(response);
791
+ return response;
792
+ } catch (err) {
793
+ const message = err instanceof Error ? err.message : "Failed to load RAG chunk preview";
794
+ setError(message);
795
+ throw err;
796
+ } finally {
797
+ setIsLoading(false);
798
+ }
799
+ }, [client]);
800
+ const clear = useCallback2(() => {
801
+ setPreview(null);
802
+ setError(null);
803
+ setIsLoading(false);
804
+ }, []);
805
+ return {
806
+ clear,
807
+ error,
808
+ inspect,
809
+ isLoading,
810
+ preview
811
+ };
812
+ };
632
813
  // src/react/ai/useRAG.ts
633
- import { useMemo as useMemo7 } from "react";
814
+ import { useMemo as useMemo10 } from "react";
634
815
 
635
816
  // src/react/ai/useRAGCitations.ts
636
- import { useMemo } from "react";
817
+ import { useMemo as useMemo2 } from "react";
637
818
 
638
819
  // src/ai/rag/presentation.ts
639
820
  var buildSourceGroupKey = (source) => source.source ?? source.title ?? source.chunkId;
@@ -727,8 +908,8 @@ var resolveRAGStreamStage = ({
727
908
 
728
909
  // src/react/ai/useRAGCitations.ts
729
910
  var useRAGCitations = (sources) => {
730
- const citations = useMemo(() => buildRAGCitations(sources), [sources]);
731
- const sourceGroups = useMemo(() => buildRAGSourceGroups(sources), [sources]);
911
+ const citations = useMemo2(() => buildRAGCitations(sources), [sources]);
912
+ const sourceGroups = useMemo2(() => buildRAGSourceGroups(sources), [sources]);
732
913
  return {
733
914
  citations,
734
915
  hasCitations: citations.length > 0,
@@ -736,102 +917,56 @@ var useRAGCitations = (sources) => {
736
917
  };
737
918
  };
738
919
 
739
- // src/react/ai/useRAGIngest.ts
740
- import { useCallback as useCallback2, useMemo as useMemo2, useState } from "react";
741
-
742
- // src/ai/client/ragClient.ts
743
- var jsonHeaders = {
744
- "Content-Type": "application/json"
745
- };
746
- var normalizeBasePath = (path) => path.endsWith("/") ? path.slice(0, -1) : path;
747
- var parseJson = async (response) => {
748
- const payload = await response.json();
749
- return payload;
750
- };
751
- var toErrorMessage = async (response) => {
752
- try {
753
- const payload = await response.json();
754
- if (typeof payload.error === "string" && payload.error) {
755
- return payload.error;
920
+ // src/react/ai/useRAGDocuments.ts
921
+ import { useCallback as useCallback3, useMemo as useMemo3, useState as useState2 } from "react";
922
+ var useRAGDocuments = (path) => {
923
+ const client = useMemo3(() => createRAGClient({ path }), [path]);
924
+ const [documents, setDocuments] = useState2([]);
925
+ const [isLoading, setIsLoading] = useState2(false);
926
+ const [error, setError] = useState2(null);
927
+ const [lastResponse, setLastResponse] = useState2(null);
928
+ const load = useCallback3(async (kind) => {
929
+ setIsLoading(true);
930
+ setError(null);
931
+ try {
932
+ const response = await client.documents(kind);
933
+ setDocuments(response.documents);
934
+ setLastResponse(response);
935
+ return response;
936
+ } catch (err) {
937
+ const message = err instanceof Error ? err.message : "Failed to load RAG documents";
938
+ setError(message);
939
+ throw err;
940
+ } finally {
941
+ setIsLoading(false);
756
942
  }
757
- } catch {}
758
- return `Request failed with status ${response.status}`;
759
- };
760
- var createRAGClient = (options) => {
761
- const basePath = normalizeBasePath(options.path);
762
- const fetchImpl = options.fetch ?? fetch;
943
+ }, [client]);
944
+ const reset = useCallback3(() => {
945
+ setDocuments([]);
946
+ setError(null);
947
+ setLastResponse(null);
948
+ setIsLoading(false);
949
+ }, []);
763
950
  return {
764
- async ingest(chunks) {
765
- const response = await fetchImpl(`${basePath}/ingest`, {
766
- body: JSON.stringify({ chunks }),
767
- headers: jsonHeaders,
768
- method: "POST"
769
- });
770
- if (!response.ok) {
771
- return {
772
- ok: false,
773
- error: await toErrorMessage(response)
774
- };
775
- }
776
- return parseJson(response);
777
- },
778
- async ingestDocuments(input) {
779
- const response = await fetchImpl(`${basePath}/ingest`, {
780
- body: JSON.stringify(input),
781
- headers: jsonHeaders,
782
- method: "POST"
783
- });
784
- if (!response.ok) {
785
- return {
786
- ok: false,
787
- error: await toErrorMessage(response)
788
- };
789
- }
790
- return parseJson(response);
791
- },
792
- async search(input) {
793
- const response = await fetchImpl(`${basePath}/search`, {
794
- body: JSON.stringify(input),
795
- headers: jsonHeaders,
796
- method: "POST"
797
- });
798
- if (!response.ok) {
799
- throw new Error(await toErrorMessage(response));
800
- }
801
- const payload = await parseJson(response);
802
- if (!payload.ok) {
803
- throw new Error(payload.error ?? "RAG search failed");
804
- }
805
- return payload.results ?? [];
806
- },
807
- async status() {
808
- const response = await fetchImpl(`${basePath}/status`);
809
- if (!response.ok) {
810
- throw new Error(await toErrorMessage(response));
811
- }
812
- return parseJson(response);
813
- },
814
- async clearIndex() {
815
- const response = await fetchImpl(`${basePath}/index`, {
816
- method: "DELETE"
817
- });
818
- if (!response.ok) {
819
- throw new Error(await toErrorMessage(response));
820
- }
821
- return parseJson(response);
822
- }
951
+ documents,
952
+ error,
953
+ isLoading,
954
+ lastResponse,
955
+ load,
956
+ reset
823
957
  };
824
958
  };
825
959
 
826
960
  // src/react/ai/useRAGIngest.ts
961
+ import { useCallback as useCallback4, useMemo as useMemo4, useState as useState3 } from "react";
827
962
  var useRAGIngest = (path) => {
828
- const client = useMemo2(() => createRAGClient({ path }), [path]);
829
- const [error, setError] = useState(null);
830
- const [isIngesting, setIsIngesting] = useState(false);
831
- const [lastIngestCount, setLastIngestCount] = useState(null);
832
- const [lastDocumentCount, setLastDocumentCount] = useState(null);
833
- const [lastResponse, setLastResponse] = useState(null);
834
- const ingestChunks = useCallback2(async (chunks) => {
963
+ const client = useMemo4(() => createRAGClient({ path }), [path]);
964
+ const [error, setError] = useState3(null);
965
+ const [isIngesting, setIsIngesting] = useState3(false);
966
+ const [lastIngestCount, setLastIngestCount] = useState3(null);
967
+ const [lastDocumentCount, setLastDocumentCount] = useState3(null);
968
+ const [lastResponse, setLastResponse] = useState3(null);
969
+ const ingestChunks = useCallback4(async (chunks) => {
835
970
  setIsIngesting(true);
836
971
  setError(null);
837
972
  try {
@@ -851,7 +986,7 @@ var useRAGIngest = (path) => {
851
986
  setIsIngesting(false);
852
987
  }
853
988
  }, [client]);
854
- const ingestDocuments = useCallback2(async (input) => {
989
+ const ingestDocuments = useCallback4(async (input) => {
855
990
  setIsIngesting(true);
856
991
  setError(null);
857
992
  try {
@@ -871,7 +1006,7 @@ var useRAGIngest = (path) => {
871
1006
  setIsIngesting(false);
872
1007
  }
873
1008
  }, [client]);
874
- const clearIndex = useCallback2(async () => {
1009
+ const clearIndex = useCallback4(async () => {
875
1010
  setIsIngesting(true);
876
1011
  setError(null);
877
1012
  try {
@@ -887,7 +1022,7 @@ var useRAGIngest = (path) => {
887
1022
  setIsIngesting(false);
888
1023
  }
889
1024
  }, [client]);
890
- const reset = useCallback2(() => {
1025
+ const reset = useCallback4(() => {
891
1026
  setError(null);
892
1027
  setLastDocumentCount(null);
893
1028
  setLastIngestCount(null);
@@ -907,16 +1042,92 @@ var useRAGIngest = (path) => {
907
1042
  };
908
1043
  };
909
1044
 
1045
+ // src/react/ai/useRAGIndexAdmin.ts
1046
+ import { useCallback as useCallback5, useMemo as useMemo5, useState as useState4 } from "react";
1047
+ var useRAGIndexAdmin = (path) => {
1048
+ const client = useMemo5(() => createRAGClient({ path }), [path]);
1049
+ const [isLoading, setIsLoading] = useState4(false);
1050
+ const [error, setError] = useState4(null);
1051
+ const [lastMutation, setLastMutation] = useState4(null);
1052
+ const [backends, setBackends] = useState4(null);
1053
+ const run = useCallback5(async (operation) => {
1054
+ setIsLoading(true);
1055
+ setError(null);
1056
+ try {
1057
+ return await operation();
1058
+ } catch (err) {
1059
+ const message = err instanceof Error ? err.message : "RAG index administration failed";
1060
+ setError(message);
1061
+ throw err;
1062
+ } finally {
1063
+ setIsLoading(false);
1064
+ }
1065
+ }, []);
1066
+ const deleteDocument = useCallback5(async (id) => run(async () => {
1067
+ const response = await client.deleteDocument(id);
1068
+ setLastMutation(response);
1069
+ if (!response.ok) {
1070
+ throw new Error(response.error ?? "Failed to delete document");
1071
+ }
1072
+ return response;
1073
+ }), [client, run]);
1074
+ const reseed = useCallback5(async () => run(async () => {
1075
+ const response = await client.reseed();
1076
+ setLastMutation(response);
1077
+ if (!response.ok) {
1078
+ throw new Error(response.error ?? "Failed to reseed index");
1079
+ }
1080
+ return response;
1081
+ }), [client, run]);
1082
+ const reset = useCallback5(async () => run(async () => {
1083
+ const response = await client.reset();
1084
+ setLastMutation(response);
1085
+ if (!response.ok) {
1086
+ throw new Error(response.error ?? "Failed to reset index");
1087
+ }
1088
+ return response;
1089
+ }), [client, run]);
1090
+ const loadBackends = useCallback5(async () => run(async () => {
1091
+ const response = await client.backends();
1092
+ setBackends(response);
1093
+ return response;
1094
+ }), [client, run]);
1095
+ const clearIndex = useCallback5(async () => run(async () => {
1096
+ const response = await client.clearIndex();
1097
+ const mutation = { ok: response.ok };
1098
+ setLastMutation(mutation);
1099
+ return mutation;
1100
+ }), [client, run]);
1101
+ const resetState = useCallback5(() => {
1102
+ setIsLoading(false);
1103
+ setError(null);
1104
+ setLastMutation(null);
1105
+ setBackends(null);
1106
+ }, []);
1107
+ return {
1108
+ backends,
1109
+ clearIndex,
1110
+ deleteDocument,
1111
+ error,
1112
+ isLoading,
1113
+ lastMutation,
1114
+ loadBackends,
1115
+ reseed,
1116
+ reset,
1117
+ resetState
1118
+ };
1119
+ };
1120
+
910
1121
  // src/react/ai/useRAGSearch.ts
911
- import { useCallback as useCallback3, useMemo as useMemo3, useState as useState2 } from "react";
1122
+ import { useCallback as useCallback6, useMemo as useMemo6, useState as useState5 } from "react";
912
1123
  var useRAGSearch = (path) => {
913
- const client = useMemo3(() => createRAGClient({ path }), [path]);
914
- const [results, setResults] = useState2([]);
915
- const [error, setError] = useState2(null);
916
- const [isSearching, setIsSearching] = useState2(false);
917
- const [hasSearched, setHasSearched] = useState2(false);
918
- const [lastRequest, setLastRequest] = useState2(null);
919
- const search = useCallback3(async (input) => {
1124
+ const client = useMemo6(() => createRAGClient({ path }), [path]);
1125
+ const [results, setResults] = useState5([]);
1126
+ const [error, setError] = useState5(null);
1127
+ const [isSearching, setIsSearching] = useState5(false);
1128
+ const [hasSearched, setHasSearched] = useState5(false);
1129
+ const [lastRequest, setLastRequest] = useState5(null);
1130
+ const search = useCallback6(async (input) => {
920
1131
  setIsSearching(true);
921
1132
  setError(null);
922
1133
  setLastRequest(input);
@@ -933,7 +1144,7 @@ var useRAGSearch = (path) => {
933
1144
  setIsSearching(false);
934
1145
  }
935
1146
  }, [client]);
936
- const reset = useCallback3(() => {
1147
+ const reset = useCallback6(() => {
937
1148
  setError(null);
938
1149
  setHasSearched(false);
939
1150
  setLastRequest(null);
@@ -952,11 +1163,11 @@ var useRAGSearch = (path) => {
952
1163
  };
953
1164
 
954
1165
  // src/react/ai/useRAGSources.ts
955
- import { useMemo as useMemo4 } from "react";
1166
+ import { useMemo as useMemo7 } from "react";
956
1167
  var useRAGSources = (messages) => {
957
- const latestAssistantMessage = useMemo4(() => getLatestAssistantMessage(messages), [messages]);
958
- const sources = useMemo4(() => getLatestRAGSources(messages), [messages]);
959
- const sourceGroups = useMemo4(() => buildRAGSourceGroups(sources), [sources]);
1168
+ const latestAssistantMessage = useMemo7(() => getLatestAssistantMessage(messages), [messages]);
1169
+ const sources = useMemo7(() => getLatestRAGSources(messages), [messages]);
1170
+ const sourceGroups = useMemo7(() => buildRAGSourceGroups(sources), [sources]);
960
1171
  return {
961
1172
  hasSources: sources.length > 0,
962
1173
  latestAssistantMessage,
@@ -966,14 +1177,14 @@ var useRAGSources = (messages) => {
966
1177
  };
967
1178
 
968
1179
  // src/react/ai/useRAGStatus.ts
969
- import { useCallback as useCallback4, useEffect as useEffect3, useMemo as useMemo5, useState as useState3 } from "react";
1180
+ import { useCallback as useCallback7, useEffect as useEffect3, useMemo as useMemo8, useState as useState6 } from "react";
970
1181
  var useRAGStatus = (path, autoLoad = true) => {
971
- const client = useMemo5(() => createRAGClient({ path }), [path]);
972
- const [status, setStatus] = useState3();
973
- const [capabilities, setCapabilities] = useState3();
974
- const [error, setError] = useState3(null);
975
- const [isLoading, setIsLoading] = useState3(autoLoad);
976
- const refresh = useCallback4(async () => {
1182
+ const client = useMemo8(() => createRAGClient({ path }), [path]);
1183
+ const [status, setStatus] = useState6();
1184
+ const [capabilities, setCapabilities] = useState6();
1185
+ const [error, setError] = useState6(null);
1186
+ const [isLoading, setIsLoading] = useState6(autoLoad);
1187
+ const refresh = useCallback7(async () => {
977
1188
  setIsLoading(true);
978
1189
  setError(null);
979
1190
  try {
@@ -989,7 +1200,7 @@ var useRAGStatus = (path, autoLoad = true) => {
989
1200
  setIsLoading(false);
990
1201
  }
991
1202
  }, [client]);
992
- const reset = useCallback4(() => {
1203
+ const reset = useCallback7(() => {
993
1204
  setCapabilities(undefined);
994
1205
  setError(null);
995
1206
  setIsLoading(false);
@@ -1013,19 +1224,19 @@ var useRAGStatus = (path, autoLoad = true) => {
1013
1224
  };
1014
1225
 
1015
1226
  // src/react/ai/useRAGStream.ts
1016
- import { useCallback as useCallback5, useMemo as useMemo6 } from "react";
1227
+ import { useCallback as useCallback8, useMemo as useMemo9 } from "react";
1017
1228
  var useRAGStream = (path, conversationId) => {
1018
1229
  const stream = useAIStream(path, conversationId);
1019
- const latestAssistantMessage = useMemo6(() => getLatestAssistantMessage(stream.messages), [stream.messages]);
1020
- const sources = useMemo6(() => getLatestRAGSources(stream.messages), [stream.messages]);
1021
- const sourceGroups = useMemo6(() => buildRAGSourceGroups(sources), [sources]);
1022
- const citations = useMemo6(() => buildRAGCitations(sources), [sources]);
1023
- const stage = useMemo6(() => resolveRAGStreamStage({
1230
+ const latestAssistantMessage = useMemo9(() => getLatestAssistantMessage(stream.messages), [stream.messages]);
1231
+ const sources = useMemo9(() => getLatestRAGSources(stream.messages), [stream.messages]);
1232
+ const sourceGroups = useMemo9(() => buildRAGSourceGroups(sources), [sources]);
1233
+ const citations = useMemo9(() => buildRAGCitations(sources), [sources]);
1234
+ const stage = useMemo9(() => resolveRAGStreamStage({
1024
1235
  error: stream.error,
1025
1236
  isStreaming: stream.isStreaming,
1026
1237
  messages: stream.messages
1027
1238
  }), [stream.error, stream.isStreaming, stream.messages]);
1028
- const query = useCallback5((content, attachments) => {
1239
+ const query = useCallback8((content, attachments) => {
1029
1240
  stream.send(content, attachments);
1030
1241
  }, [stream]);
1031
1242
  return {
@@ -1045,17 +1256,23 @@ var useRAG = (path, options = {}) => {
1045
1256
  const search = useRAGSearch(path);
1046
1257
  const ingest = useRAGIngest(path);
1047
1258
  const status = useRAGStatus(path, options.autoLoadStatus ?? true);
1259
+ const documents = useRAGDocuments(path);
1260
+ const chunkPreview = useRAGChunkPreview(path);
1261
+ const index = useRAGIndexAdmin(path);
1048
1262
  const stream = useRAGStream(options.streamPath ?? path, options.conversationId);
1049
1263
  const sources = useRAGSources(stream.messages);
1050
1264
  const citations = useRAGCitations(sources.sources);
1051
- return useMemo7(() => ({
1265
+ return useMemo10(() => ({
1052
1266
  citations,
1267
+ chunkPreview,
1268
+ documents,
1053
1269
  ingest,
1270
+ index,
1054
1271
  search,
1055
1272
  sources,
1056
1273
  status,
1057
1274
  stream
1058
- }), [citations, ingest, search, sources, status, stream]);
1275
+ }), [citations, chunkPreview, documents, ingest, index, search, sources, status, stream]);
1059
1276
  };
1060
1277
  export {
1061
1278
  useRAGStream,
@@ -1063,7 +1280,10 @@ export {
1063
1280
  useRAGSources,
1064
1281
  useRAGSearch,
1065
1282
  useRAGIngest,
1283
+ useRAGIndexAdmin,
1284
+ useRAGDocuments,
1066
1285
  useRAGCitations,
1286
+ useRAGChunkPreview,
1067
1287
  useRAG,
1068
1288
  useAIStream,
1069
1289
  AIStreamProvider