@absolutejs/rag 0.8.0 → 0.10.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.
Files changed (42) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/README.md +68 -0
  3. package/changelog.json +82 -0
  4. package/dist/adapter-kit/index.js +26 -17
  5. package/dist/adapter-kit/index.js.map +5 -5
  6. package/dist/angular/index.js +3 -3
  7. package/dist/angular/index.js.map +2 -2
  8. package/dist/client/index.js +7 -7
  9. package/dist/client/index.js.map +2 -2
  10. package/dist/client/ui.js +17 -17
  11. package/dist/client/ui.js.map +2 -2
  12. package/dist/index.js +587 -308
  13. package/dist/index.js.map +11 -8
  14. package/dist/manifest.js +127 -127
  15. package/dist/manifest.js.map +1 -1
  16. package/dist/presentation/ui.js +75 -75
  17. package/dist/presentation/ui.js.map +2 -2
  18. package/dist/quality/quality.js +130 -130
  19. package/dist/quality/quality.js.map +2 -2
  20. package/dist/react/index.js +15 -15
  21. package/dist/react/index.js.map +2 -2
  22. package/dist/src/angular/ai-rag-stream.service.d.ts +1 -0
  23. package/dist/src/angular/ai-rag-workflow.service.d.ts +1 -0
  24. package/dist/src/client/createRAGAnswerWorkflow.d.ts +1 -0
  25. package/dist/src/index.d.ts +3 -0
  26. package/dist/src/ingestion/originalText.d.ts +29 -0
  27. package/dist/src/react/useRAG.d.ts +2 -0
  28. package/dist/src/react/useRAGStream.d.ts +1 -0
  29. package/dist/src/react/useRAGWorkflow.d.ts +1 -0
  30. package/dist/src/retrieval/originalTextTools.d.ts +23 -0
  31. package/dist/src/retrieval/quoteReferences.d.ts +13 -0
  32. package/dist/src/svelte/createRAG.d.ts +2 -0
  33. package/dist/src/svelte/createRAGStream.d.ts +1 -0
  34. package/dist/src/svelte/createRAGWorkflow.d.ts +1 -0
  35. package/dist/src/vue/useRAG.d.ts +2 -0
  36. package/dist/src/vue/useRAGStream.d.ts +1 -0
  37. package/dist/src/vue/useRAGWorkflow.d.ts +1 -0
  38. package/dist/svelte/index.js +15 -15
  39. package/dist/svelte/index.js.map +2 -2
  40. package/dist/vue/index.js +15 -15
  41. package/dist/vue/index.js.map +2 -2
  42. package/package.json +14 -9
@@ -24,6 +24,7 @@ export declare class RAGStreamService extends AIStreamService {
24
24
  workflow: import("@angular/core").Signal<import("..").RAGAnswerWorkflowState>;
25
25
  branch: (messageId: string, content: string) => void;
26
26
  cancel: () => void;
27
+ edit: (messageId: string, content: string) => void;
27
28
  error: import("@angular/core").Signal<string | null>;
28
29
  isStreaming: import("@angular/core").Signal<boolean>;
29
30
  messages: import("@angular/core").Signal<import("@absolutejs/ai").AIMessage[]>;
@@ -25,6 +25,7 @@ export declare class RAGWorkflowService extends RAGStreamService {
25
25
  workflow: import("@angular/core").Signal<import("..").RAGAnswerWorkflowState>;
26
26
  branch: (messageId: string, content: string) => void;
27
27
  cancel: () => void;
28
+ edit: (messageId: string, content: string) => void;
28
29
  error: import("@angular/core").Signal<string | null>;
29
30
  isStreaming: import("@angular/core").Signal<boolean>;
30
31
  messages: import("@angular/core").Signal<import("@absolutejs/ai").AIMessage[]>;
@@ -24,6 +24,7 @@ export declare const createRAGAnswerWorkflow: (path: string, conversationId?: st
24
24
  branch: (messageId: string, content: string) => void;
25
25
  cancel: () => void;
26
26
  destroy: () => void;
27
+ edit: (messageId: string, content: string) => void;
27
28
  send: (content: string, attachments?: AIAttachment[]) => void;
28
29
  subscribe: (callback: () => void) => () => void;
29
30
  error: string | null;
@@ -32,3 +32,6 @@ export type * from "@absolutejs/ai";
32
32
  export type * from "../types/engine";
33
33
  export { corpusTextHash, planRAGCorpus, reconcileRAGCorpus, } from "./retrieval/corpus";
34
34
  export type { RAGCorpusApply, RAGCorpusDocument, RAGCorpusPlan, RAGCorpusRecord, RAGCorpusResult, RAGCorpusStore, } from "./retrieval/corpus";
35
+ export { chunkRAGOriginalText, readRAGOriginalText, type RAGOriginalText, type RAGOriginalTextLocator, } from "./ingestion/originalText";
36
+ export { createRAGOriginalTextTools, type RAGOriginalTextToolsOptions } from "./retrieval/originalTextTools";
37
+ export { createRAGQuoteReferences } from "./retrieval/quoteReferences";
@@ -0,0 +1,29 @@
1
+ import type { RAGDocumentChunk } from "../../types/engine";
2
+ /** Offsets are UTF-16 code units, as used by JavaScript String.slice. */
3
+ export type RAGOriginalTextLocator = {
4
+ sourceId: string;
5
+ version: string;
6
+ start: number;
7
+ end: number;
8
+ };
9
+ export type RAGOriginalText = {
10
+ sourceId: string;
11
+ version: string;
12
+ text: string;
13
+ title?: string;
14
+ };
15
+ /** Verifies identity/version and returns verbatim evidence; never normalizes it.
16
+ * The caller must authorize the source before loading it. Rejects invalid ranges
17
+ * instead of silently returning evidence with a different locator.
18
+ */
19
+ export declare const readRAGOriginalText: (source: RAGOriginalText, locator: RAGOriginalTextLocator, maxCharacters?: number) => string;
20
+ /** An opt-in ingestion path for citable text originals. Unlike format extraction,
21
+ * this preserves whitespace, repeated paragraphs and Unicode exactly. Prefer
22
+ * paragraph/line boundaries while retaining exact offsets and bounded overlap.
23
+ * Chunk size is an indexing choice, not a model context capacity limit.
24
+ */
25
+ export declare const chunkRAGOriginalText: (source: RAGOriginalText, options?: {
26
+ maxCharacters?: number;
27
+ overlapCharacters?: number;
28
+ metadata?: Record<string, unknown>;
29
+ }) => RAGDocumentChunk[];
@@ -290,6 +290,7 @@ export declare const useRAG: (path: string, options?: UseRAGOptions) => {
290
290
  workflow: import("..").RAGAnswerWorkflowState;
291
291
  branch: (messageId: string, content: string) => void;
292
292
  cancel: () => void;
293
+ edit: (messageId: string, content: string) => void;
293
294
  error: string | null;
294
295
  isStreaming: boolean;
295
296
  messages: import("@absolutejs/ai").AIMessage[];
@@ -344,6 +345,7 @@ export declare const useRAG: (path: string, options?: UseRAGOptions) => {
344
345
  workflow: import("..").RAGAnswerWorkflowState;
345
346
  branch: (messageId: string, content: string) => void;
346
347
  cancel: () => void;
348
+ edit: (messageId: string, content: string) => void;
347
349
  error: string | null;
348
350
  isStreaming: boolean;
349
351
  messages: import("@absolutejs/ai").AIMessage[];
@@ -47,6 +47,7 @@ export declare const useRAGStream: (path?: string, conversationId?: string) => {
47
47
  workflow: import("..").RAGAnswerWorkflowState;
48
48
  branch: (messageId: string, content: string) => void;
49
49
  cancel: () => void;
50
+ edit: (messageId: string, content: string) => void;
50
51
  error: string | null;
51
52
  isStreaming: boolean;
52
53
  messages: import("@absolutejs/ai").AIMessage[];
@@ -47,6 +47,7 @@ export declare const useRAGWorkflow: (path?: string, conversationId?: string) =>
47
47
  workflow: import("..").RAGAnswerWorkflowState;
48
48
  branch: (messageId: string, content: string) => void;
49
49
  cancel: () => void;
50
+ edit: (messageId: string, content: string) => void;
50
51
  error: string | null;
51
52
  isStreaming: boolean;
52
53
  messages: import("@absolutejs/ai").AIMessage[];
@@ -0,0 +1,23 @@
1
+ import type { AIToolMap } from "@absolutejs/ai";
2
+ import type { RAGCollection, RAGCollectionSearchResult } from "../../types/engine";
3
+ import { type RAGOriginalText } from "../ingestion/originalText";
4
+ export type RAGOriginalTextToolsOptions = {
5
+ collection: Pick<RAGCollection, "searchWithTrace">;
6
+ /** Server-owned authorization/version constraints. Tool input cannot replace them. */
7
+ filter: Record<string, unknown>;
8
+ /** Must reauthorize every read and return null for deleted/inaccessible versions. */
9
+ loadSource: (sourceId: string, version: string) => Promise<RAGOriginalText | null>;
10
+ /** Use the chosen model's tokenizer and a budget reserved by the AI context policy. */
11
+ budget: {
12
+ maxTokens: number;
13
+ countTokens: (serializedResult: string) => Promise<number>;
14
+ };
15
+ /** Server-selected result count; candidates are still ranked before budgeting. */
16
+ searchTopK?: number;
17
+ signal?: AbortSignal;
18
+ onTrace?: (trace: RAGCollectionSearchResult["trace"]) => void;
19
+ };
20
+ /** Hybrid retrieval plus independently authorized, verbatim source verification.
21
+ * Index text is never returned as evidence without resolving its original range.
22
+ */
23
+ export declare const createRAGOriginalTextTools: (options: RAGOriginalTextToolsOptions) => AIToolMap;
@@ -0,0 +1,13 @@
1
+ /** A request-scoped, reversible encoding of already-retrieved verbatim quotes.
2
+ * This is not an authorization mechanism: encode only server-owned tool results,
3
+ * and reauthorize/revalidate resolved quotes against originals before committing.
4
+ * Keep one registry across prefetch, subsequent lookups and completion. */
5
+ export declare const createRAGQuoteReferences: () => {
6
+ /** Accepts the JSON envelopes returned by original-text search/read tools.
7
+ * Unrecognized results and tool errors pass through unchanged. Source text
8
+ * is not interpreted as JSON or instructions. Caller retains the originals. */
9
+ encodeToolResult: (serialized: string) => string;
10
+ /** Resolve only a reference issued by this registry. A reference from another
11
+ * request is never loaded from a global cache or used to fetch a source. */
12
+ resolve: (reference: string) => string;
13
+ };
@@ -256,6 +256,7 @@ export declare const createRAG: (path: string, options?: CreateRAGOptions) => {
256
256
  branch: (messageId: string, content: string) => void;
257
257
  cancel: () => void;
258
258
  destroy: () => void;
259
+ edit: (messageId: string, content: string) => void;
259
260
  send: (content: string, attachments?: import("@absolutejs/ai").AIAttachment[]) => void;
260
261
  subscribe: (callback: () => void) => () => void;
261
262
  };
@@ -285,6 +286,7 @@ export declare const createRAG: (path: string, options?: CreateRAGOptions) => {
285
286
  branch: (messageId: string, content: string) => void;
286
287
  cancel: () => void;
287
288
  destroy: () => void;
289
+ edit: (messageId: string, content: string) => void;
288
290
  send: (content: string, attachments?: import("@absolutejs/ai").AIAttachment[]) => void;
289
291
  subscribe: (callback: () => void) => () => void;
290
292
  };
@@ -24,6 +24,7 @@ export declare const createRAGStream: (path: string, conversationId?: string) =>
24
24
  branch: (messageId: string, content: string) => void;
25
25
  cancel: () => void;
26
26
  destroy: () => void;
27
+ edit: (messageId: string, content: string) => void;
27
28
  send: (content: string, attachments?: AIAttachment[]) => void;
28
29
  subscribe: (callback: () => void) => () => void;
29
30
  };
@@ -24,6 +24,7 @@ export declare const createRAGWorkflow: (path: string, conversationId?: string)
24
24
  branch: (messageId: string, content: string) => void;
25
25
  cancel: () => void;
26
26
  destroy: () => void;
27
+ edit: (messageId: string, content: string) => void;
27
28
  send: (content: string, attachments?: import("@absolutejs/ai").AIAttachment[]) => void;
28
29
  subscribe: (callback: () => void) => () => void;
29
30
  };
@@ -2889,6 +2889,7 @@ export declare const useRAG: (path: string, options?: UseRAGOptions) => {
2889
2889
  branch: (messageId: string, content: string) => void;
2890
2890
  cancel: () => void;
2891
2891
  destroy: () => void;
2892
+ edit: (messageId: string, content: string) => void;
2892
2893
  error: import("vue").Ref<string | null, string | null>;
2893
2894
  isStreaming: import("vue").Ref<boolean, boolean>;
2894
2895
  messages: import("vue").ShallowRef<import("@absolutejs/ai").AIMessage[], import("@absolutejs/ai").AIMessage[]>;
@@ -2923,6 +2924,7 @@ export declare const useRAG: (path: string, options?: UseRAGOptions) => {
2923
2924
  branch: (messageId: string, content: string) => void;
2924
2925
  cancel: () => void;
2925
2926
  destroy: () => void;
2927
+ edit: (messageId: string, content: string) => void;
2926
2928
  error: import("vue").Ref<string | null, string | null>;
2927
2929
  isStreaming: import("vue").Ref<boolean, boolean>;
2928
2930
  messages: import("vue").ShallowRef<import("@absolutejs/ai").AIMessage[], import("@absolutejs/ai").AIMessage[]>;
@@ -27,6 +27,7 @@ export declare const useRAGStream: (path: string, conversationId?: string) => {
27
27
  branch: (messageId: string, content: string) => void;
28
28
  cancel: () => void;
29
29
  destroy: () => void;
30
+ edit: (messageId: string, content: string) => void;
30
31
  error: import("vue").Ref<string | null, string | null>;
31
32
  isStreaming: import("vue").Ref<boolean, boolean>;
32
33
  messages: import("vue").ShallowRef<import("@absolutejs/ai").AIMessage[], import("@absolutejs/ai").AIMessage[]>;
@@ -27,6 +27,7 @@ export declare const useRAGWorkflow: (path: string, conversationId?: string) =>
27
27
  branch: (messageId: string, content: string) => void;
28
28
  cancel: () => void;
29
29
  destroy: () => void;
30
+ edit: (messageId: string, content: string) => void;
30
31
  error: import("vue").Ref<string | null, string | null>;
31
32
  isStreaming: import("vue").Ref<boolean, boolean>;
32
33
  messages: import("vue").ShallowRef<import("@absolutejs/ai").AIMessage[], import("@absolutejs/ai").AIMessage[]>;
@@ -4984,22 +4984,22 @@ var createRAG = (path, options = {}) => {
4984
4984
  };
4985
4985
  };
4986
4986
  export {
4987
- createRAGWorkflow,
4988
- createRAGStreamProgress,
4989
- createRAGStream,
4990
- createRAGStatus,
4991
- createRAGSources,
4992
- createRAGSearch,
4993
- createRAGOps,
4994
- createRAGIngest,
4995
- createRAGIndexAdmin,
4996
- createRAGGrounding,
4997
- createRAGEvaluate,
4998
- createRAGDocuments,
4999
- createRAGCitations,
4987
+ createRAG,
5000
4988
  createRAGChunkPreview,
5001
- createRAG
4989
+ createRAGCitations,
4990
+ createRAGDocuments,
4991
+ createRAGEvaluate,
4992
+ createRAGGrounding,
4993
+ createRAGIndexAdmin,
4994
+ createRAGIngest,
4995
+ createRAGOps,
4996
+ createRAGSearch,
4997
+ createRAGSources,
4998
+ createRAGStatus,
4999
+ createRAGStream,
5000
+ createRAGStreamProgress,
5001
+ createRAGWorkflow
5002
5002
  };
5003
5003
 
5004
- //# debugId=0C820FFEEA16A64064756E2164756E21
5004
+ //# debugId=404BF31250240B0064756E2164756E21
5005
5005
  //# sourceMappingURL=index.js.map