@exulu/backend 1.39.3 → 1.41.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
@@ -40,12 +40,12 @@ interface Item {
40
40
  source?: string;
41
41
  tags?: string[];
42
42
  textlength?: number;
43
+ last_processed_at?: string;
43
44
  chunks?: {
44
45
  id: string;
45
46
  index: number;
46
47
  content: string;
47
48
  source: string;
48
- embedding_size: number;
49
49
  createdAt: string;
50
50
  updatedAt: string;
51
51
  }[];
@@ -160,6 +160,31 @@ type User = {
160
160
  };
161
161
  };
162
162
 
163
+ declare const VectorMethodEnum: {
164
+ readonly cosineDistance: "cosineDistance";
165
+ readonly hybridSearch: "hybridSearch";
166
+ readonly tsvector: "tsvector";
167
+ };
168
+ type VectorMethod = (typeof VectorMethodEnum)[keyof typeof VectorMethodEnum];
169
+
170
+ type VectorSearchChunkResult = {
171
+ chunk_content: string;
172
+ chunk_index: number;
173
+ chunk_id: string;
174
+ chunk_source: string;
175
+ chunk_metadata: Record<string, string>;
176
+ chunk_created_at: string;
177
+ chunk_updated_at: string;
178
+ item_id: string;
179
+ item_external_id: string;
180
+ item_name: string;
181
+ item_updated_at: string;
182
+ item_created_at: string;
183
+ chunk_cosine_distance?: number;
184
+ chunk_fts_rank?: number;
185
+ chunk_hybrid_score?: number;
186
+ };
187
+
163
188
  interface Agent {
164
189
  id: string;
165
190
  modelName?: string;
@@ -236,13 +261,6 @@ interface TestCase {
236
261
  updatedAt: string;
237
262
  }
238
263
 
239
- declare const VectorMethodEnum: {
240
- readonly cosineDistance: "cosineDistance";
241
- readonly hybridSearch: "hybridSearch";
242
- readonly tsvector: "tsvector";
243
- };
244
- type VectorMethod = (typeof VectorMethodEnum)[keyof typeof VectorMethodEnum];
245
-
246
264
  interface RateLimiterRule {
247
265
  name?: string;
248
266
  rate_limit: {
@@ -311,7 +329,10 @@ type ExuluQueueConfig = {
311
329
  queue: Queue;
312
330
  ratelimit: number;
313
331
  timeoutInSeconds?: number;
314
- concurrency: number;
332
+ concurrency: {
333
+ worker: number;
334
+ queue: number;
335
+ };
315
336
  retries?: number;
316
337
  backoff?: {
317
338
  type: 'exponential' | 'linear';
@@ -532,24 +553,18 @@ declare class ExuluTool {
532
553
  }>;
533
554
  });
534
555
  }
535
- type ExuluContextFieldProcessor = {
556
+ type ExuluContextProcessor = {
557
+ name: string;
536
558
  description: string;
537
559
  execute: ({ item, user, role, utils, exuluConfig }: {
538
- item: Item & {
539
- field: string;
540
- };
560
+ item: Item;
541
561
  user?: number;
542
562
  role?: string;
543
563
  utils: {
544
564
  storage: ExuluStorage;
545
- items: {
546
- update: ExuluContext['updateItem'];
547
- create: ExuluContext['createItem'];
548
- delete: ExuluContext['deleteItem'];
549
- };
550
565
  };
551
566
  exuluConfig: ExuluConfig;
552
- }) => Promise<string>;
567
+ }) => Promise<Item>;
553
568
  config?: {
554
569
  queue?: Promise<ExuluQueueConfig>;
555
570
  timeoutInSeconds?: number;
@@ -567,7 +582,6 @@ type ExuluContextFieldDefinition = {
567
582
  index?: boolean;
568
583
  enumValues?: string[];
569
584
  allowedFileTypes?: allFileTypes[];
570
- processor?: ExuluContextFieldProcessor;
571
585
  };
572
586
  type ExuluRightsMode = "private" | "users" | "roles" | "public";
573
587
  declare class ExuluStorage {
@@ -576,7 +590,7 @@ declare class ExuluStorage {
576
590
  config: ExuluConfig;
577
591
  });
578
592
  getPresignedUrl: (key: string) => Promise<string>;
579
- uploadFile: (file: Buffer | Uint8Array, key: string, type: string, user?: number, metadata?: Record<string, string>) => Promise<string>;
593
+ uploadFile: (file: Buffer | Uint8Array, fileName: string, type: string, user?: number, metadata?: Record<string, string>, customBucket?: string) => Promise<string>;
580
594
  }
581
595
  type ExuluContextSource = {
582
596
  id: string;
@@ -606,18 +620,43 @@ declare class ExuluContext {
606
620
  name: string;
607
621
  active: boolean;
608
622
  fields: ExuluContextFieldDefinition[];
623
+ processor?: ExuluContextProcessor;
609
624
  rateLimit?: RateLimiterRule;
610
625
  description: string;
611
626
  embedder?: ExuluEmbedder;
612
627
  queryRewriter?: (query: string) => Promise<string>;
613
- resultReranker?: (results: any[]) => Promise<any[]>;
628
+ resultReranker?: (results: {
629
+ chunk_content: string;
630
+ chunk_index: number;
631
+ chunk_id: string;
632
+ chunk_source: string;
633
+ chunk_metadata: Record<string, string>;
634
+ chunk_created_at: string;
635
+ chunk_updated_at: string;
636
+ item_id: string;
637
+ item_external_id: string;
638
+ item_name: string;
639
+ }[]) => Promise<{
640
+ chunk_content: string;
641
+ chunk_index: number;
642
+ chunk_id: string;
643
+ chunk_source: string;
644
+ chunk_metadata: Record<string, string>;
645
+ chunk_created_at: string;
646
+ chunk_updated_at: string;
647
+ item_id: string;
648
+ item_external_id: string;
649
+ item_name: string;
650
+ }[]>;
614
651
  configuration: {
615
652
  calculateVectors?: "manual" | "onUpdate" | "onInsert" | "always";
653
+ maxRetrievalResults?: number;
616
654
  defaultRightsMode?: ExuluRightsMode;
655
+ enableAsTool?: boolean;
617
656
  language?: "german" | "english";
618
657
  };
619
658
  sources: ExuluContextSource[];
620
- constructor({ id, name, description, embedder, active, rateLimit, fields, queryRewriter, resultReranker, configuration, sources }: {
659
+ constructor({ id, name, description, embedder, processor, active, rateLimit, fields, queryRewriter, resultReranker, configuration, sources }: {
621
660
  id: string;
622
661
  name: string;
623
662
  fields: ExuluContextFieldDefinition[];
@@ -626,19 +665,20 @@ declare class ExuluContext {
626
665
  sources: ExuluContextSource[];
627
666
  category?: string;
628
667
  active: boolean;
668
+ processor?: ExuluContextProcessor;
629
669
  rateLimit?: RateLimiterRule;
630
670
  queryRewriter?: (query: string) => Promise<string>;
631
671
  resultReranker?: (results: any[]) => Promise<any[]>;
632
672
  configuration?: {
633
673
  calculateVectors?: "manual" | "onUpdate" | "onInsert" | "always";
634
674
  defaultRightsMode?: ExuluRightsMode;
675
+ enableAsTool?: boolean;
635
676
  language?: "german" | "english";
677
+ maxRetrievalResults?: number;
636
678
  };
637
679
  });
638
- processField: (trigger: STATISTICS_LABELS, item: Item & {
639
- field: string;
640
- }, exuluConfig: ExuluConfig, user?: number, role?: string) => Promise<{
641
- result: string;
680
+ processField: (trigger: STATISTICS_LABELS, item: Item, exuluConfig: ExuluConfig, user?: number, role?: string) => Promise<{
681
+ result: Item | undefined;
642
682
  job?: string;
643
683
  }>;
644
684
  search: (options: {
@@ -660,7 +700,7 @@ declare class ExuluContext {
660
700
  id: string;
661
701
  embedder: string;
662
702
  };
663
- items: any[];
703
+ chunks: VectorSearchChunkResult[];
664
704
  }>;
665
705
  deleteAll: () => Promise<VectorOperationResponse>;
666
706
  executeSource: (source: ExuluContextSource, inputs: any, exuluConfig: ExuluConfig) => Promise<Item[]>;
@@ -711,9 +751,9 @@ declare class ExuluContext {
711
751
  };
712
752
  createItemsTable: () => Promise<void>;
713
753
  createChunksTable: () => Promise<void>;
714
- tool: () => ExuluTool;
754
+ tool: () => ExuluTool | null;
715
755
  }
716
- type STATISTICS_LABELS = "tool" | "agent" | "flow" | "api" | "claude-code" | "user";
756
+ type STATISTICS_LABELS = "tool" | "agent" | "flow" | "api" | "claude-code" | "user" | "processor";
717
757
  type ExuluStatistic = {
718
758
  name: string;
719
759
  label: string;
@@ -739,21 +779,35 @@ declare class ExuluQueues {
739
779
  queues: {
740
780
  queue: Queue;
741
781
  ratelimit: number;
742
- concurrency: number;
782
+ concurrency: {
783
+ worker: number;
784
+ queue: number;
785
+ };
786
+ timeoutInSeconds: number;
743
787
  }[];
744
788
  constructor();
745
789
  list: Map<string, {
746
790
  name: string;
747
- concurrency: number;
791
+ concurrency: {
792
+ worker: number;
793
+ queue: number;
794
+ };
748
795
  ratelimit: number;
796
+ timeoutInSeconds: number;
749
797
  use: () => Promise<ExuluQueueConfig>;
750
798
  }>;
751
799
  queue(name: string): {
752
800
  queue: Queue;
753
801
  ratelimit: number;
754
- concurrency: number;
802
+ concurrency: {
803
+ worker: number;
804
+ queue: number;
805
+ };
755
806
  } | undefined;
756
- register: (name: string, concurrency?: number, ratelimit?: number) => {
807
+ register: (name: string, concurrency: {
808
+ worker: number;
809
+ queue: number;
810
+ }, ratelimit?: number, timeoutInSeconds?: number) => {
757
811
  use: () => Promise<ExuluQueueConfig>;
758
812
  };
759
813
  }
package/dist/index.d.ts CHANGED
@@ -40,12 +40,12 @@ interface Item {
40
40
  source?: string;
41
41
  tags?: string[];
42
42
  textlength?: number;
43
+ last_processed_at?: string;
43
44
  chunks?: {
44
45
  id: string;
45
46
  index: number;
46
47
  content: string;
47
48
  source: string;
48
- embedding_size: number;
49
49
  createdAt: string;
50
50
  updatedAt: string;
51
51
  }[];
@@ -160,6 +160,31 @@ type User = {
160
160
  };
161
161
  };
162
162
 
163
+ declare const VectorMethodEnum: {
164
+ readonly cosineDistance: "cosineDistance";
165
+ readonly hybridSearch: "hybridSearch";
166
+ readonly tsvector: "tsvector";
167
+ };
168
+ type VectorMethod = (typeof VectorMethodEnum)[keyof typeof VectorMethodEnum];
169
+
170
+ type VectorSearchChunkResult = {
171
+ chunk_content: string;
172
+ chunk_index: number;
173
+ chunk_id: string;
174
+ chunk_source: string;
175
+ chunk_metadata: Record<string, string>;
176
+ chunk_created_at: string;
177
+ chunk_updated_at: string;
178
+ item_id: string;
179
+ item_external_id: string;
180
+ item_name: string;
181
+ item_updated_at: string;
182
+ item_created_at: string;
183
+ chunk_cosine_distance?: number;
184
+ chunk_fts_rank?: number;
185
+ chunk_hybrid_score?: number;
186
+ };
187
+
163
188
  interface Agent {
164
189
  id: string;
165
190
  modelName?: string;
@@ -236,13 +261,6 @@ interface TestCase {
236
261
  updatedAt: string;
237
262
  }
238
263
 
239
- declare const VectorMethodEnum: {
240
- readonly cosineDistance: "cosineDistance";
241
- readonly hybridSearch: "hybridSearch";
242
- readonly tsvector: "tsvector";
243
- };
244
- type VectorMethod = (typeof VectorMethodEnum)[keyof typeof VectorMethodEnum];
245
-
246
264
  interface RateLimiterRule {
247
265
  name?: string;
248
266
  rate_limit: {
@@ -311,7 +329,10 @@ type ExuluQueueConfig = {
311
329
  queue: Queue;
312
330
  ratelimit: number;
313
331
  timeoutInSeconds?: number;
314
- concurrency: number;
332
+ concurrency: {
333
+ worker: number;
334
+ queue: number;
335
+ };
315
336
  retries?: number;
316
337
  backoff?: {
317
338
  type: 'exponential' | 'linear';
@@ -532,24 +553,18 @@ declare class ExuluTool {
532
553
  }>;
533
554
  });
534
555
  }
535
- type ExuluContextFieldProcessor = {
556
+ type ExuluContextProcessor = {
557
+ name: string;
536
558
  description: string;
537
559
  execute: ({ item, user, role, utils, exuluConfig }: {
538
- item: Item & {
539
- field: string;
540
- };
560
+ item: Item;
541
561
  user?: number;
542
562
  role?: string;
543
563
  utils: {
544
564
  storage: ExuluStorage;
545
- items: {
546
- update: ExuluContext['updateItem'];
547
- create: ExuluContext['createItem'];
548
- delete: ExuluContext['deleteItem'];
549
- };
550
565
  };
551
566
  exuluConfig: ExuluConfig;
552
- }) => Promise<string>;
567
+ }) => Promise<Item>;
553
568
  config?: {
554
569
  queue?: Promise<ExuluQueueConfig>;
555
570
  timeoutInSeconds?: number;
@@ -567,7 +582,6 @@ type ExuluContextFieldDefinition = {
567
582
  index?: boolean;
568
583
  enumValues?: string[];
569
584
  allowedFileTypes?: allFileTypes[];
570
- processor?: ExuluContextFieldProcessor;
571
585
  };
572
586
  type ExuluRightsMode = "private" | "users" | "roles" | "public";
573
587
  declare class ExuluStorage {
@@ -576,7 +590,7 @@ declare class ExuluStorage {
576
590
  config: ExuluConfig;
577
591
  });
578
592
  getPresignedUrl: (key: string) => Promise<string>;
579
- uploadFile: (file: Buffer | Uint8Array, key: string, type: string, user?: number, metadata?: Record<string, string>) => Promise<string>;
593
+ uploadFile: (file: Buffer | Uint8Array, fileName: string, type: string, user?: number, metadata?: Record<string, string>, customBucket?: string) => Promise<string>;
580
594
  }
581
595
  type ExuluContextSource = {
582
596
  id: string;
@@ -606,18 +620,43 @@ declare class ExuluContext {
606
620
  name: string;
607
621
  active: boolean;
608
622
  fields: ExuluContextFieldDefinition[];
623
+ processor?: ExuluContextProcessor;
609
624
  rateLimit?: RateLimiterRule;
610
625
  description: string;
611
626
  embedder?: ExuluEmbedder;
612
627
  queryRewriter?: (query: string) => Promise<string>;
613
- resultReranker?: (results: any[]) => Promise<any[]>;
628
+ resultReranker?: (results: {
629
+ chunk_content: string;
630
+ chunk_index: number;
631
+ chunk_id: string;
632
+ chunk_source: string;
633
+ chunk_metadata: Record<string, string>;
634
+ chunk_created_at: string;
635
+ chunk_updated_at: string;
636
+ item_id: string;
637
+ item_external_id: string;
638
+ item_name: string;
639
+ }[]) => Promise<{
640
+ chunk_content: string;
641
+ chunk_index: number;
642
+ chunk_id: string;
643
+ chunk_source: string;
644
+ chunk_metadata: Record<string, string>;
645
+ chunk_created_at: string;
646
+ chunk_updated_at: string;
647
+ item_id: string;
648
+ item_external_id: string;
649
+ item_name: string;
650
+ }[]>;
614
651
  configuration: {
615
652
  calculateVectors?: "manual" | "onUpdate" | "onInsert" | "always";
653
+ maxRetrievalResults?: number;
616
654
  defaultRightsMode?: ExuluRightsMode;
655
+ enableAsTool?: boolean;
617
656
  language?: "german" | "english";
618
657
  };
619
658
  sources: ExuluContextSource[];
620
- constructor({ id, name, description, embedder, active, rateLimit, fields, queryRewriter, resultReranker, configuration, sources }: {
659
+ constructor({ id, name, description, embedder, processor, active, rateLimit, fields, queryRewriter, resultReranker, configuration, sources }: {
621
660
  id: string;
622
661
  name: string;
623
662
  fields: ExuluContextFieldDefinition[];
@@ -626,19 +665,20 @@ declare class ExuluContext {
626
665
  sources: ExuluContextSource[];
627
666
  category?: string;
628
667
  active: boolean;
668
+ processor?: ExuluContextProcessor;
629
669
  rateLimit?: RateLimiterRule;
630
670
  queryRewriter?: (query: string) => Promise<string>;
631
671
  resultReranker?: (results: any[]) => Promise<any[]>;
632
672
  configuration?: {
633
673
  calculateVectors?: "manual" | "onUpdate" | "onInsert" | "always";
634
674
  defaultRightsMode?: ExuluRightsMode;
675
+ enableAsTool?: boolean;
635
676
  language?: "german" | "english";
677
+ maxRetrievalResults?: number;
636
678
  };
637
679
  });
638
- processField: (trigger: STATISTICS_LABELS, item: Item & {
639
- field: string;
640
- }, exuluConfig: ExuluConfig, user?: number, role?: string) => Promise<{
641
- result: string;
680
+ processField: (trigger: STATISTICS_LABELS, item: Item, exuluConfig: ExuluConfig, user?: number, role?: string) => Promise<{
681
+ result: Item | undefined;
642
682
  job?: string;
643
683
  }>;
644
684
  search: (options: {
@@ -660,7 +700,7 @@ declare class ExuluContext {
660
700
  id: string;
661
701
  embedder: string;
662
702
  };
663
- items: any[];
703
+ chunks: VectorSearchChunkResult[];
664
704
  }>;
665
705
  deleteAll: () => Promise<VectorOperationResponse>;
666
706
  executeSource: (source: ExuluContextSource, inputs: any, exuluConfig: ExuluConfig) => Promise<Item[]>;
@@ -711,9 +751,9 @@ declare class ExuluContext {
711
751
  };
712
752
  createItemsTable: () => Promise<void>;
713
753
  createChunksTable: () => Promise<void>;
714
- tool: () => ExuluTool;
754
+ tool: () => ExuluTool | null;
715
755
  }
716
- type STATISTICS_LABELS = "tool" | "agent" | "flow" | "api" | "claude-code" | "user";
756
+ type STATISTICS_LABELS = "tool" | "agent" | "flow" | "api" | "claude-code" | "user" | "processor";
717
757
  type ExuluStatistic = {
718
758
  name: string;
719
759
  label: string;
@@ -739,21 +779,35 @@ declare class ExuluQueues {
739
779
  queues: {
740
780
  queue: Queue;
741
781
  ratelimit: number;
742
- concurrency: number;
782
+ concurrency: {
783
+ worker: number;
784
+ queue: number;
785
+ };
786
+ timeoutInSeconds: number;
743
787
  }[];
744
788
  constructor();
745
789
  list: Map<string, {
746
790
  name: string;
747
- concurrency: number;
791
+ concurrency: {
792
+ worker: number;
793
+ queue: number;
794
+ };
748
795
  ratelimit: number;
796
+ timeoutInSeconds: number;
749
797
  use: () => Promise<ExuluQueueConfig>;
750
798
  }>;
751
799
  queue(name: string): {
752
800
  queue: Queue;
753
801
  ratelimit: number;
754
- concurrency: number;
802
+ concurrency: {
803
+ worker: number;
804
+ queue: number;
805
+ };
755
806
  } | undefined;
756
- register: (name: string, concurrency?: number, ratelimit?: number) => {
807
+ register: (name: string, concurrency: {
808
+ worker: number;
809
+ queue: number;
810
+ }, ratelimit?: number, timeoutInSeconds?: number) => {
757
811
  use: () => Promise<ExuluQueueConfig>;
758
812
  };
759
813
  }