@exulu/backend 1.17.0 → 1.19.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
@@ -1,6 +1,6 @@
1
1
  import * as _opentelemetry_sdk_node from '@opentelemetry/sdk-node';
2
2
  import * as bullmq from 'bullmq';
3
- import { Queue, Job } from 'bullmq';
3
+ import { Queue } from 'bullmq';
4
4
  import { RedisClientType } from 'redis';
5
5
  import { ZodSchema, z } from 'zod';
6
6
  import { Tool, LanguageModel, UIMessage } from 'ai';
@@ -37,7 +37,7 @@ interface Item {
37
37
  external_id?: string;
38
38
  source?: string;
39
39
  tags?: string[];
40
- textLength?: number;
40
+ textlength?: number;
41
41
  chunks?: {
42
42
  id: string;
43
43
  index: number;
@@ -52,11 +52,8 @@ interface Item {
52
52
 
53
53
  declare const VectorMethodEnum: {
54
54
  readonly cosineDistance: "cosineDistance";
55
- readonly l1Distance: "l1Distance";
56
- readonly l2Distance: "l2Distance";
57
- readonly hammingDistance: "hammingDistance";
58
- readonly jaccardDistance: "jaccardDistance";
59
- readonly maxInnerProduct: "maxInnerProduct";
55
+ readonly hybridSearch: "hybridSearch";
56
+ readonly tsvector: "tsvector";
60
57
  };
61
58
  type VectorMethod = (typeof VectorMethodEnum)[keyof typeof VectorMethodEnum];
62
59
 
@@ -229,13 +226,6 @@ declare class ExuluEmbedder {
229
226
  generateFromQuery(query: string, statistics?: ExuluStatisticParams, user?: string, role?: string): VectorGenerationResponse;
230
227
  generateFromDocument(input: Item, statistics?: ExuluStatisticParams, user?: string, role?: string): VectorGenerationResponse;
231
228
  }
232
- declare class ExuluLogger {
233
- private readonly logPath?;
234
- private readonly job?;
235
- constructor(job?: Job, logsDir?: string);
236
- write(message: string, level: "INFO" | "ERROR" | "WARNING"): Promise<void>;
237
- }
238
- type AddSourceArgs = Omit<ExuluSourceConstructorArgs, "context">;
239
229
  interface WorkflowVariable {
240
230
  name: string;
241
231
  description?: string;
@@ -347,6 +337,7 @@ type ExuluContextFieldDefinition = {
347
337
  type: ExuluFieldTypes;
348
338
  unique?: boolean;
349
339
  };
340
+ type ExuluRightsMode = "private" | "users" | "roles" | "public" | "projects";
350
341
  declare class ExuluContext {
351
342
  id: string;
352
343
  name: string;
@@ -354,40 +345,57 @@ declare class ExuluContext {
354
345
  fields: ExuluContextFieldDefinition[];
355
346
  rateLimit?: RateLimiterRule;
356
347
  description: string;
357
- embedder: ExuluEmbedder;
348
+ embedder?: ExuluEmbedder;
358
349
  queryRewriter?: (query: string) => Promise<string>;
359
350
  resultReranker?: (results: any[]) => Promise<any[]>;
360
- private _sources;
361
351
  configuration: {
362
- calculateVectors: "manual" | "onUpdate" | "onInsert" | "always";
352
+ calculateVectors?: "manual" | "onUpdate" | "onInsert" | "always";
353
+ defaultRightsMode?: ExuluRightsMode;
354
+ language?: "german" | "english";
363
355
  };
364
356
  constructor({ id, name, description, embedder, active, rateLimit, fields, queryRewriter, resultReranker, configuration }: {
365
357
  id: string;
366
358
  name: string;
367
359
  fields: ExuluContextFieldDefinition[];
368
360
  description: string;
369
- embedder: ExuluEmbedder;
361
+ embedder?: ExuluEmbedder;
370
362
  active: boolean;
371
363
  rateLimit?: RateLimiterRule;
372
364
  queryRewriter?: (query: string) => Promise<string>;
373
365
  resultReranker?: (results: any[]) => Promise<any[]>;
374
366
  configuration?: {
375
- calculateVectors: "manual" | "onUpdate" | "onInsert" | "always";
367
+ calculateVectors?: "manual" | "onUpdate" | "onInsert" | "always";
368
+ defaultRightsMode?: ExuluRightsMode;
369
+ language?: "german" | "english";
376
370
  };
377
371
  });
378
- deleteOne: (id: string) => VectorOperationResponse;
379
- deleteAll: () => VectorOperationResponse;
380
- getTableName: () => string;
381
- getChunksTableName: () => string;
372
+ deleteAll: () => Promise<VectorOperationResponse>;
382
373
  tableExists: () => Promise<boolean>;
383
- createAndUpsertEmbeddings: (item: Item, user: string, statistics: ExuluStatisticParams, role?: string) => Promise<{
384
- id: string | undefined;
385
- chunks: number;
374
+ chunksTableExists: () => Promise<boolean>;
375
+ createAndUpsertEmbeddings: (item: Item, user?: string, statistics?: ExuluStatisticParams, role?: string, job?: string) => Promise<{
376
+ id: string;
377
+ chunks?: number;
378
+ job?: string;
386
379
  }>;
387
380
  updateItem(user: string, item: Item, role?: string, trigger?: STATISTICS_LABELS): Promise<{
388
381
  id: string;
389
382
  job?: string;
390
383
  }>;
384
+ embeddings: {
385
+ generate: {
386
+ one: ({ item, user, role, trigger }: {
387
+ item: Item;
388
+ user?: string;
389
+ role?: string;
390
+ trigger: STATISTICS_LABELS;
391
+ }) => Promise<{
392
+ id: string;
393
+ job?: string;
394
+ chunks?: number;
395
+ }>;
396
+ all: (context: ExuluContext, userId?: string, roleId?: string) => Promise<string[]>;
397
+ };
398
+ };
391
399
  insertItem(user: string, item: Item, upsert?: boolean, role?: string, trigger?: STATISTICS_LABELS): Promise<{
392
400
  id: string;
393
401
  job?: string;
@@ -424,7 +432,7 @@ declare class ExuluContext {
424
432
  context: {
425
433
  name: string;
426
434
  id: string;
427
- embedder: string;
435
+ embedder: string | undefined;
428
436
  };
429
437
  items: any[];
430
438
  } | {
@@ -444,43 +452,7 @@ declare class ExuluContext {
444
452
  createItemsTable: () => Promise<void>;
445
453
  createChunksTable: () => Promise<void>;
446
454
  tool: () => ExuluTool;
447
- sources: {
448
- add: (inputs: AddSourceArgs) => ExuluSource;
449
- get: (id?: string) => ExuluSource[] | (ExuluSource | undefined);
450
- };
451
455
  }
452
- /**
453
- * @param updaters - Defines how this source decides when and which data to send to the embedder for updating vectors
454
- * @param updaters.type - The type of update mechanism:
455
- * - "manual": Will be shown in the Exulu frontend UI via a Button for manual triggering
456
- * - "cron": Will automatically update on a schedule
457
- * - "webhook": Will update when triggered by an external webhook
458
- * @param updaters.fn - The function that handles the update logic
459
- * @param configuration - Defines fields shown in the UI that admins can set for each instance of the Source
460
- * This allows reusing logic while exposing configurable variables (e.g. a "query" field)
461
- * that admins can set differently for different instances in the UI
462
- */
463
- type ExuluSourceConstructorArgs = {
464
- id: string;
465
- name: string;
466
- description: string;
467
- updaters: ExuluSourceUpdaterArgs[];
468
- context: string;
469
- };
470
- type SourceDocument = {
471
- id: string;
472
- content: string;
473
- metadata?: Record<string, any>;
474
- };
475
- type ExuluSourceUpdaterArgs = {
476
- id: string;
477
- type: "manual" | "cron" | "webhook";
478
- fn: (configuration: Record<string, any>) => Promise<SourceDocument[]>;
479
- configuration: Record<string, {
480
- type: "string" | "number" | "query";
481
- example: string;
482
- }>;
483
- };
484
456
  type STATISTICS_LABELS = "tool" | "agent" | "flow" | "api" | "claude-code" | "user";
485
457
  type ExuluStatistic = {
486
458
  name: string;
@@ -490,17 +462,6 @@ type ExuluStatistic = {
490
462
  total: number;
491
463
  };
492
464
  type ExuluStatisticParams = Omit<ExuluStatistic, "total" | "name" | "type">;
493
- type ExuluSourceUpdater = ExuluSourceUpdaterArgs & {
494
- slug?: string;
495
- };
496
- declare class ExuluSource {
497
- id: string;
498
- name: string;
499
- description: string;
500
- updaters: ExuluSourceUpdater[];
501
- context: string;
502
- constructor({ id, name, description, updaters, context }: ExuluSourceConstructorArgs);
503
- }
504
465
 
505
466
  type ExuluConfig = {
506
467
  telemetry?: {
@@ -538,6 +499,21 @@ declare class ExuluApp {
538
499
  agent(id: string): ExuluAgent | undefined;
539
500
  get contexts(): ExuluContext[];
540
501
  get agents(): ExuluAgent[];
502
+ embeddings: {
503
+ generate: {
504
+ one: ({ context: contextId, item: itemId }: {
505
+ context: string;
506
+ item: string;
507
+ }) => Promise<{
508
+ id: string;
509
+ job?: string;
510
+ chunks?: number;
511
+ }>;
512
+ all: ({ context: contextId }: {
513
+ context: string;
514
+ }) => Promise<string[]>;
515
+ };
516
+ };
541
517
  bullmq: {
542
518
  workers: {
543
519
  create: () => Promise<bullmq.Worker<any, any, string>[]>;
@@ -1482,4 +1458,4 @@ declare const ExuluChunkers: {
1482
1458
  };
1483
1459
  };
1484
1460
 
1485
- export { type JOB_STATUS as EXULU_JOB_STATUS, JOB_STATUS_ENUM as EXULU_JOB_STATUS_ENUM, type STATISTICS_TYPE as EXULU_STATISTICS_TYPE, STATISTICS_TYPE_ENUM as EXULU_STATISTICS_TYPE_ENUM, ExuluAgent, ExuluApp, authentication as ExuluAuthentication, ExuluChunkers, ExuluContext, ExuluEmbedder, ExuluEval, ExuluJobs, ExuluLogger, ExuluOtel, queues as ExuluQueues, ExuluSource, ExuluTool, ExuluZodFileType, db };
1461
+ export { type JOB_STATUS as EXULU_JOB_STATUS, JOB_STATUS_ENUM as EXULU_JOB_STATUS_ENUM, type STATISTICS_TYPE as EXULU_STATISTICS_TYPE, STATISTICS_TYPE_ENUM as EXULU_STATISTICS_TYPE_ENUM, ExuluAgent, ExuluApp, authentication as ExuluAuthentication, ExuluChunkers, ExuluContext, ExuluEmbedder, ExuluEval, ExuluJobs, ExuluOtel, queues as ExuluQueues, ExuluTool, ExuluZodFileType, db };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as _opentelemetry_sdk_node from '@opentelemetry/sdk-node';
2
2
  import * as bullmq from 'bullmq';
3
- import { Queue, Job } from 'bullmq';
3
+ import { Queue } from 'bullmq';
4
4
  import { RedisClientType } from 'redis';
5
5
  import { ZodSchema, z } from 'zod';
6
6
  import { Tool, LanguageModel, UIMessage } from 'ai';
@@ -37,7 +37,7 @@ interface Item {
37
37
  external_id?: string;
38
38
  source?: string;
39
39
  tags?: string[];
40
- textLength?: number;
40
+ textlength?: number;
41
41
  chunks?: {
42
42
  id: string;
43
43
  index: number;
@@ -52,11 +52,8 @@ interface Item {
52
52
 
53
53
  declare const VectorMethodEnum: {
54
54
  readonly cosineDistance: "cosineDistance";
55
- readonly l1Distance: "l1Distance";
56
- readonly l2Distance: "l2Distance";
57
- readonly hammingDistance: "hammingDistance";
58
- readonly jaccardDistance: "jaccardDistance";
59
- readonly maxInnerProduct: "maxInnerProduct";
55
+ readonly hybridSearch: "hybridSearch";
56
+ readonly tsvector: "tsvector";
60
57
  };
61
58
  type VectorMethod = (typeof VectorMethodEnum)[keyof typeof VectorMethodEnum];
62
59
 
@@ -229,13 +226,6 @@ declare class ExuluEmbedder {
229
226
  generateFromQuery(query: string, statistics?: ExuluStatisticParams, user?: string, role?: string): VectorGenerationResponse;
230
227
  generateFromDocument(input: Item, statistics?: ExuluStatisticParams, user?: string, role?: string): VectorGenerationResponse;
231
228
  }
232
- declare class ExuluLogger {
233
- private readonly logPath?;
234
- private readonly job?;
235
- constructor(job?: Job, logsDir?: string);
236
- write(message: string, level: "INFO" | "ERROR" | "WARNING"): Promise<void>;
237
- }
238
- type AddSourceArgs = Omit<ExuluSourceConstructorArgs, "context">;
239
229
  interface WorkflowVariable {
240
230
  name: string;
241
231
  description?: string;
@@ -347,6 +337,7 @@ type ExuluContextFieldDefinition = {
347
337
  type: ExuluFieldTypes;
348
338
  unique?: boolean;
349
339
  };
340
+ type ExuluRightsMode = "private" | "users" | "roles" | "public" | "projects";
350
341
  declare class ExuluContext {
351
342
  id: string;
352
343
  name: string;
@@ -354,40 +345,57 @@ declare class ExuluContext {
354
345
  fields: ExuluContextFieldDefinition[];
355
346
  rateLimit?: RateLimiterRule;
356
347
  description: string;
357
- embedder: ExuluEmbedder;
348
+ embedder?: ExuluEmbedder;
358
349
  queryRewriter?: (query: string) => Promise<string>;
359
350
  resultReranker?: (results: any[]) => Promise<any[]>;
360
- private _sources;
361
351
  configuration: {
362
- calculateVectors: "manual" | "onUpdate" | "onInsert" | "always";
352
+ calculateVectors?: "manual" | "onUpdate" | "onInsert" | "always";
353
+ defaultRightsMode?: ExuluRightsMode;
354
+ language?: "german" | "english";
363
355
  };
364
356
  constructor({ id, name, description, embedder, active, rateLimit, fields, queryRewriter, resultReranker, configuration }: {
365
357
  id: string;
366
358
  name: string;
367
359
  fields: ExuluContextFieldDefinition[];
368
360
  description: string;
369
- embedder: ExuluEmbedder;
361
+ embedder?: ExuluEmbedder;
370
362
  active: boolean;
371
363
  rateLimit?: RateLimiterRule;
372
364
  queryRewriter?: (query: string) => Promise<string>;
373
365
  resultReranker?: (results: any[]) => Promise<any[]>;
374
366
  configuration?: {
375
- calculateVectors: "manual" | "onUpdate" | "onInsert" | "always";
367
+ calculateVectors?: "manual" | "onUpdate" | "onInsert" | "always";
368
+ defaultRightsMode?: ExuluRightsMode;
369
+ language?: "german" | "english";
376
370
  };
377
371
  });
378
- deleteOne: (id: string) => VectorOperationResponse;
379
- deleteAll: () => VectorOperationResponse;
380
- getTableName: () => string;
381
- getChunksTableName: () => string;
372
+ deleteAll: () => Promise<VectorOperationResponse>;
382
373
  tableExists: () => Promise<boolean>;
383
- createAndUpsertEmbeddings: (item: Item, user: string, statistics: ExuluStatisticParams, role?: string) => Promise<{
384
- id: string | undefined;
385
- chunks: number;
374
+ chunksTableExists: () => Promise<boolean>;
375
+ createAndUpsertEmbeddings: (item: Item, user?: string, statistics?: ExuluStatisticParams, role?: string, job?: string) => Promise<{
376
+ id: string;
377
+ chunks?: number;
378
+ job?: string;
386
379
  }>;
387
380
  updateItem(user: string, item: Item, role?: string, trigger?: STATISTICS_LABELS): Promise<{
388
381
  id: string;
389
382
  job?: string;
390
383
  }>;
384
+ embeddings: {
385
+ generate: {
386
+ one: ({ item, user, role, trigger }: {
387
+ item: Item;
388
+ user?: string;
389
+ role?: string;
390
+ trigger: STATISTICS_LABELS;
391
+ }) => Promise<{
392
+ id: string;
393
+ job?: string;
394
+ chunks?: number;
395
+ }>;
396
+ all: (context: ExuluContext, userId?: string, roleId?: string) => Promise<string[]>;
397
+ };
398
+ };
391
399
  insertItem(user: string, item: Item, upsert?: boolean, role?: string, trigger?: STATISTICS_LABELS): Promise<{
392
400
  id: string;
393
401
  job?: string;
@@ -424,7 +432,7 @@ declare class ExuluContext {
424
432
  context: {
425
433
  name: string;
426
434
  id: string;
427
- embedder: string;
435
+ embedder: string | undefined;
428
436
  };
429
437
  items: any[];
430
438
  } | {
@@ -444,43 +452,7 @@ declare class ExuluContext {
444
452
  createItemsTable: () => Promise<void>;
445
453
  createChunksTable: () => Promise<void>;
446
454
  tool: () => ExuluTool;
447
- sources: {
448
- add: (inputs: AddSourceArgs) => ExuluSource;
449
- get: (id?: string) => ExuluSource[] | (ExuluSource | undefined);
450
- };
451
455
  }
452
- /**
453
- * @param updaters - Defines how this source decides when and which data to send to the embedder for updating vectors
454
- * @param updaters.type - The type of update mechanism:
455
- * - "manual": Will be shown in the Exulu frontend UI via a Button for manual triggering
456
- * - "cron": Will automatically update on a schedule
457
- * - "webhook": Will update when triggered by an external webhook
458
- * @param updaters.fn - The function that handles the update logic
459
- * @param configuration - Defines fields shown in the UI that admins can set for each instance of the Source
460
- * This allows reusing logic while exposing configurable variables (e.g. a "query" field)
461
- * that admins can set differently for different instances in the UI
462
- */
463
- type ExuluSourceConstructorArgs = {
464
- id: string;
465
- name: string;
466
- description: string;
467
- updaters: ExuluSourceUpdaterArgs[];
468
- context: string;
469
- };
470
- type SourceDocument = {
471
- id: string;
472
- content: string;
473
- metadata?: Record<string, any>;
474
- };
475
- type ExuluSourceUpdaterArgs = {
476
- id: string;
477
- type: "manual" | "cron" | "webhook";
478
- fn: (configuration: Record<string, any>) => Promise<SourceDocument[]>;
479
- configuration: Record<string, {
480
- type: "string" | "number" | "query";
481
- example: string;
482
- }>;
483
- };
484
456
  type STATISTICS_LABELS = "tool" | "agent" | "flow" | "api" | "claude-code" | "user";
485
457
  type ExuluStatistic = {
486
458
  name: string;
@@ -490,17 +462,6 @@ type ExuluStatistic = {
490
462
  total: number;
491
463
  };
492
464
  type ExuluStatisticParams = Omit<ExuluStatistic, "total" | "name" | "type">;
493
- type ExuluSourceUpdater = ExuluSourceUpdaterArgs & {
494
- slug?: string;
495
- };
496
- declare class ExuluSource {
497
- id: string;
498
- name: string;
499
- description: string;
500
- updaters: ExuluSourceUpdater[];
501
- context: string;
502
- constructor({ id, name, description, updaters, context }: ExuluSourceConstructorArgs);
503
- }
504
465
 
505
466
  type ExuluConfig = {
506
467
  telemetry?: {
@@ -538,6 +499,21 @@ declare class ExuluApp {
538
499
  agent(id: string): ExuluAgent | undefined;
539
500
  get contexts(): ExuluContext[];
540
501
  get agents(): ExuluAgent[];
502
+ embeddings: {
503
+ generate: {
504
+ one: ({ context: contextId, item: itemId }: {
505
+ context: string;
506
+ item: string;
507
+ }) => Promise<{
508
+ id: string;
509
+ job?: string;
510
+ chunks?: number;
511
+ }>;
512
+ all: ({ context: contextId }: {
513
+ context: string;
514
+ }) => Promise<string[]>;
515
+ };
516
+ };
541
517
  bullmq: {
542
518
  workers: {
543
519
  create: () => Promise<bullmq.Worker<any, any, string>[]>;
@@ -1482,4 +1458,4 @@ declare const ExuluChunkers: {
1482
1458
  };
1483
1459
  };
1484
1460
 
1485
- export { type JOB_STATUS as EXULU_JOB_STATUS, JOB_STATUS_ENUM as EXULU_JOB_STATUS_ENUM, type STATISTICS_TYPE as EXULU_STATISTICS_TYPE, STATISTICS_TYPE_ENUM as EXULU_STATISTICS_TYPE_ENUM, ExuluAgent, ExuluApp, authentication as ExuluAuthentication, ExuluChunkers, ExuluContext, ExuluEmbedder, ExuluEval, ExuluJobs, ExuluLogger, ExuluOtel, queues as ExuluQueues, ExuluSource, ExuluTool, ExuluZodFileType, db };
1461
+ export { type JOB_STATUS as EXULU_JOB_STATUS, JOB_STATUS_ENUM as EXULU_JOB_STATUS_ENUM, type STATISTICS_TYPE as EXULU_STATISTICS_TYPE, STATISTICS_TYPE_ENUM as EXULU_STATISTICS_TYPE_ENUM, ExuluAgent, ExuluApp, authentication as ExuluAuthentication, ExuluChunkers, ExuluContext, ExuluEmbedder, ExuluEval, ExuluJobs, ExuluOtel, queues as ExuluQueues, ExuluTool, ExuluZodFileType, db };