@exulu/backend 0.3.13 → 1.2.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,8 +1,9 @@
1
1
  import * as bullmq from 'bullmq';
2
2
  import { Queue } from 'bullmq';
3
3
  import { RedisClientType } from 'redis';
4
+ import * as ai from 'ai';
5
+ import { Tool, LanguageModelV1, Message } from 'ai';
4
6
  import { ZodSchema, z } from 'zod';
5
- import { Tool, LanguageModelV1 } from 'ai';
6
7
  import { Express } from 'express';
7
8
  import { Knex } from 'knex';
8
9
  import { Tiktoken } from 'tiktoken/lite';
@@ -108,17 +109,16 @@ type ExuluAgentEval = {
108
109
  interface ExuluAgentParams {
109
110
  id: string;
110
111
  name: string;
111
- type: "agent" | "workflow";
112
+ type: "agent" | "workflow" | "custom";
112
113
  description: string;
113
- config: ExuluAgentConfig;
114
- capabilities: {
114
+ config?: ExuluAgentConfig | undefined;
115
+ capabilities?: {
115
116
  tools: boolean;
116
117
  images: string[];
117
118
  files: string[];
118
119
  audio: string[];
119
120
  video: string[];
120
121
  };
121
- tools?: ExuluTool[];
122
122
  evals?: ExuluAgentEval[];
123
123
  outputSchema?: ZodSchema;
124
124
  rateLimit?: RateLimiterRule;
@@ -128,24 +128,32 @@ declare class ExuluAgent {
128
128
  name: string;
129
129
  description: string;
130
130
  slug: string;
131
+ type: "agent" | "workflow" | "custom";
131
132
  streaming: boolean;
132
133
  rateLimit?: RateLimiterRule;
133
- config: ExuluAgentConfig;
134
- tools?: ExuluTool[];
134
+ config?: ExuluAgentConfig | undefined;
135
135
  evals?: ExuluAgentEval[];
136
136
  model?: LanguageModelV1;
137
137
  capabilities: {
138
- tools: boolean;
139
138
  images: string[];
140
139
  files: string[];
141
140
  audio: string[];
142
141
  video: string[];
143
142
  };
144
- constructor({ id, name, description, config, rateLimit, capabilities, tools, evals }: ExuluAgentParams);
145
- generate: ({ prompt, stream }: {
146
- prompt: string;
147
- stream?: boolean;
148
- }) => Promise<any>;
143
+ constructor({ id, name, description, config, rateLimit, capabilities, type, evals }: ExuluAgentParams);
144
+ tool: () => ExuluTool;
145
+ generateSync: ({ messages, prompt, tools, statistics }: {
146
+ messages?: Message[];
147
+ prompt?: string;
148
+ tools?: ExuluTool[];
149
+ statistics?: ExuluStatisticParams;
150
+ }) => Promise<string>;
151
+ generateStream: ({ messages, prompt, tools, statistics }: {
152
+ messages?: Message[];
153
+ prompt?: string;
154
+ tools?: ExuluTool[];
155
+ statistics?: ExuluStatisticParams;
156
+ }) => ai.StreamTextResult<Record<string, Tool>, never>;
149
157
  }
150
158
  type VectorOperationResponse = Promise<{
151
159
  count: number;
@@ -192,14 +200,8 @@ declare class ExuluEmbedder {
192
200
  vectorDimensions: number;
193
201
  maxChunkSize: number;
194
202
  });
195
- generateFromQuery(query: string, statistics?: {
196
- label: string;
197
- trigger: string;
198
- }): VectorGenerationResponse;
199
- generateFromDocument(input: Item, statistics?: {
200
- label: string;
201
- trigger: string;
202
- }): VectorGenerationResponse;
203
+ generateFromQuery(query: string, statistics?: ExuluStatisticParams): VectorGenerationResponse;
204
+ generateFromDocument(input: Item, statistics?: ExuluStatisticParams): VectorGenerationResponse;
203
205
  }
204
206
  type ExuluWorkflowStep = {
205
207
  id: string;
@@ -298,15 +300,15 @@ declare class ExuluTool {
298
300
  id: string;
299
301
  name: string;
300
302
  description: string;
301
- parameters?: ZodSchema;
302
- type: "context" | "function";
303
+ inputSchema?: ZodSchema;
304
+ type: "context" | "function" | "agent";
303
305
  tool: Tool;
304
- constructor({ id, name, description, parameters, type, execute }: {
306
+ constructor({ id, name, description, inputSchema, type, execute }: {
305
307
  id: string;
306
308
  name: string;
307
309
  description: string;
308
- parameters: ZodSchema;
309
- type: "context" | "function";
310
+ inputSchema?: ZodSchema;
311
+ type: "context" | "function" | "agent";
310
312
  execute: (inputs: any) => Promise<any>;
311
313
  });
312
314
  }
@@ -325,7 +327,9 @@ declare class ExuluContext {
325
327
  queryRewriter?: (query: string) => Promise<string>;
326
328
  resultReranker?: (results: any[]) => Promise<any[]>;
327
329
  private _sources;
328
- private configuration;
330
+ configuration: {
331
+ calculateVectors: "manual" | "onUpdate" | "onInsert" | "always";
332
+ };
329
333
  constructor({ id, name, description, embedder, active, rateLimit, fields, queryRewriter, resultReranker, configuration }: {
330
334
  id: string;
331
335
  name: string;
@@ -353,12 +357,11 @@ declare class ExuluContext {
353
357
  id: string;
354
358
  job?: string;
355
359
  }>;
356
- getItems: ({ statistics, limit, page, name, archived, query, method }: {
357
- statistics?: {
358
- label: string;
359
- trigger: string;
360
- };
360
+ getItems: ({ statistics, limit, sort, order, page, name, archived, query, method }: {
361
+ statistics?: ExuluStatisticParams;
361
362
  page: number;
363
+ sort?: "created_at" | "embeddings_updated_at";
364
+ order?: "desc" | "asc";
362
365
  limit: number;
363
366
  name?: string;
364
367
  archived?: boolean;
@@ -441,6 +444,14 @@ type ExuluSourceUpdaterArgs = {
441
444
  example: string;
442
445
  }>;
443
446
  };
447
+ type ExuluStatistic = {
448
+ name: string;
449
+ label: string;
450
+ type: STATISTICS_TYPE;
451
+ trigger: "tool" | "agent" | "flow" | "api" | "claude-code";
452
+ total: number;
453
+ };
454
+ type ExuluStatisticParams = Omit<ExuluStatistic, "total" | "name" | "type">;
444
455
  type ExuluSourceUpdater = ExuluSourceUpdaterArgs & {
445
456
  slug?: string;
446
457
  };
@@ -466,28 +477,24 @@ declare class ExuluApp {
466
477
  private _agents;
467
478
  private _workflows;
468
479
  private _config?;
469
- private _embedders;
470
480
  private _queues;
471
481
  private _contexts?;
472
482
  private _tools;
473
483
  private _expressApp;
474
484
  constructor();
475
- create: ({ contexts, embedders, agents, workflows, config, tools }: {
485
+ create: ({ contexts, agents, workflows, config, tools }: {
476
486
  contexts?: Record<string, ExuluContext>;
477
487
  config: ExuluConfig;
478
- embedders?: ExuluEmbedder[];
479
488
  agents?: ExuluAgent[];
480
489
  workflows?: ExuluWorkflow[];
481
490
  tools?: ExuluTool[];
482
491
  }) => Promise<Express>;
483
492
  get expressApp(): Express;
484
- embedder(id: string): ExuluEmbedder | undefined;
485
493
  tool(id: string): ExuluTool | undefined;
486
494
  tools(): ExuluTool[];
487
495
  context(id: string): ExuluContext | undefined;
488
496
  agent(id: string): ExuluAgent | undefined;
489
497
  workflow(id: string): ExuluWorkflow | undefined;
490
- get embedders(): ExuluEmbedder[];
491
498
  get contexts(): ExuluContext[];
492
499
  get workflows(): ExuluWorkflow[];
493
500
  get agents(): ExuluAgent[];
@@ -504,6 +511,7 @@ type User = {
504
511
  email: string;
505
512
  emailVerified?: string;
506
513
  type?: "api" | "user";
514
+ anthropic_token?: string;
507
515
  roles?: {
508
516
  id: string;
509
517
  role: string;
@@ -1396,10 +1404,6 @@ declare const JOB_STATUS_ENUM: {
1396
1404
  stuck: string;
1397
1405
  };
1398
1406
 
1399
- declare const _default: {
1400
- run: (exulu: ExuluApp) => void;
1401
- };
1402
-
1403
1407
  declare const ExuluJobs: {
1404
1408
  redis: typeof redisClient;
1405
1409
  jobs: {
@@ -1421,4 +1425,4 @@ declare const ExuluDatabase: {
1421
1425
  }>;
1422
1426
  };
1423
1427
 
1424
- 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, _default as ExuluCli, ExuluContext, ExuluDatabase, ExuluEmbedder, ExuluEval, type Job as ExuluJob, ExuluJobs, ExuluLogger, queues as ExuluQueues, ExuluSource, ExuluTool, ExuluWorkflow, type ExuluWorkflowStep, ExuluZodFileType };
1428
+ 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, ExuluDatabase, ExuluEmbedder, ExuluEval, type Job as ExuluJob, ExuluJobs, ExuluLogger, queues as ExuluQueues, ExuluSource, ExuluTool, ExuluWorkflow, type ExuluWorkflowStep, ExuluZodFileType };
package/dist/index.d.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  import * as bullmq from 'bullmq';
2
2
  import { Queue } from 'bullmq';
3
3
  import { RedisClientType } from 'redis';
4
+ import * as ai from 'ai';
5
+ import { Tool, LanguageModelV1, Message } from 'ai';
4
6
  import { ZodSchema, z } from 'zod';
5
- import { Tool, LanguageModelV1 } from 'ai';
6
7
  import { Express } from 'express';
7
8
  import { Knex } from 'knex';
8
9
  import { Tiktoken } from 'tiktoken/lite';
@@ -108,17 +109,16 @@ type ExuluAgentEval = {
108
109
  interface ExuluAgentParams {
109
110
  id: string;
110
111
  name: string;
111
- type: "agent" | "workflow";
112
+ type: "agent" | "workflow" | "custom";
112
113
  description: string;
113
- config: ExuluAgentConfig;
114
- capabilities: {
114
+ config?: ExuluAgentConfig | undefined;
115
+ capabilities?: {
115
116
  tools: boolean;
116
117
  images: string[];
117
118
  files: string[];
118
119
  audio: string[];
119
120
  video: string[];
120
121
  };
121
- tools?: ExuluTool[];
122
122
  evals?: ExuluAgentEval[];
123
123
  outputSchema?: ZodSchema;
124
124
  rateLimit?: RateLimiterRule;
@@ -128,24 +128,32 @@ declare class ExuluAgent {
128
128
  name: string;
129
129
  description: string;
130
130
  slug: string;
131
+ type: "agent" | "workflow" | "custom";
131
132
  streaming: boolean;
132
133
  rateLimit?: RateLimiterRule;
133
- config: ExuluAgentConfig;
134
- tools?: ExuluTool[];
134
+ config?: ExuluAgentConfig | undefined;
135
135
  evals?: ExuluAgentEval[];
136
136
  model?: LanguageModelV1;
137
137
  capabilities: {
138
- tools: boolean;
139
138
  images: string[];
140
139
  files: string[];
141
140
  audio: string[];
142
141
  video: string[];
143
142
  };
144
- constructor({ id, name, description, config, rateLimit, capabilities, tools, evals }: ExuluAgentParams);
145
- generate: ({ prompt, stream }: {
146
- prompt: string;
147
- stream?: boolean;
148
- }) => Promise<any>;
143
+ constructor({ id, name, description, config, rateLimit, capabilities, type, evals }: ExuluAgentParams);
144
+ tool: () => ExuluTool;
145
+ generateSync: ({ messages, prompt, tools, statistics }: {
146
+ messages?: Message[];
147
+ prompt?: string;
148
+ tools?: ExuluTool[];
149
+ statistics?: ExuluStatisticParams;
150
+ }) => Promise<string>;
151
+ generateStream: ({ messages, prompt, tools, statistics }: {
152
+ messages?: Message[];
153
+ prompt?: string;
154
+ tools?: ExuluTool[];
155
+ statistics?: ExuluStatisticParams;
156
+ }) => ai.StreamTextResult<Record<string, Tool>, never>;
149
157
  }
150
158
  type VectorOperationResponse = Promise<{
151
159
  count: number;
@@ -192,14 +200,8 @@ declare class ExuluEmbedder {
192
200
  vectorDimensions: number;
193
201
  maxChunkSize: number;
194
202
  });
195
- generateFromQuery(query: string, statistics?: {
196
- label: string;
197
- trigger: string;
198
- }): VectorGenerationResponse;
199
- generateFromDocument(input: Item, statistics?: {
200
- label: string;
201
- trigger: string;
202
- }): VectorGenerationResponse;
203
+ generateFromQuery(query: string, statistics?: ExuluStatisticParams): VectorGenerationResponse;
204
+ generateFromDocument(input: Item, statistics?: ExuluStatisticParams): VectorGenerationResponse;
203
205
  }
204
206
  type ExuluWorkflowStep = {
205
207
  id: string;
@@ -298,15 +300,15 @@ declare class ExuluTool {
298
300
  id: string;
299
301
  name: string;
300
302
  description: string;
301
- parameters?: ZodSchema;
302
- type: "context" | "function";
303
+ inputSchema?: ZodSchema;
304
+ type: "context" | "function" | "agent";
303
305
  tool: Tool;
304
- constructor({ id, name, description, parameters, type, execute }: {
306
+ constructor({ id, name, description, inputSchema, type, execute }: {
305
307
  id: string;
306
308
  name: string;
307
309
  description: string;
308
- parameters: ZodSchema;
309
- type: "context" | "function";
310
+ inputSchema?: ZodSchema;
311
+ type: "context" | "function" | "agent";
310
312
  execute: (inputs: any) => Promise<any>;
311
313
  });
312
314
  }
@@ -325,7 +327,9 @@ declare class ExuluContext {
325
327
  queryRewriter?: (query: string) => Promise<string>;
326
328
  resultReranker?: (results: any[]) => Promise<any[]>;
327
329
  private _sources;
328
- private configuration;
330
+ configuration: {
331
+ calculateVectors: "manual" | "onUpdate" | "onInsert" | "always";
332
+ };
329
333
  constructor({ id, name, description, embedder, active, rateLimit, fields, queryRewriter, resultReranker, configuration }: {
330
334
  id: string;
331
335
  name: string;
@@ -353,12 +357,11 @@ declare class ExuluContext {
353
357
  id: string;
354
358
  job?: string;
355
359
  }>;
356
- getItems: ({ statistics, limit, page, name, archived, query, method }: {
357
- statistics?: {
358
- label: string;
359
- trigger: string;
360
- };
360
+ getItems: ({ statistics, limit, sort, order, page, name, archived, query, method }: {
361
+ statistics?: ExuluStatisticParams;
361
362
  page: number;
363
+ sort?: "created_at" | "embeddings_updated_at";
364
+ order?: "desc" | "asc";
362
365
  limit: number;
363
366
  name?: string;
364
367
  archived?: boolean;
@@ -441,6 +444,14 @@ type ExuluSourceUpdaterArgs = {
441
444
  example: string;
442
445
  }>;
443
446
  };
447
+ type ExuluStatistic = {
448
+ name: string;
449
+ label: string;
450
+ type: STATISTICS_TYPE;
451
+ trigger: "tool" | "agent" | "flow" | "api" | "claude-code";
452
+ total: number;
453
+ };
454
+ type ExuluStatisticParams = Omit<ExuluStatistic, "total" | "name" | "type">;
444
455
  type ExuluSourceUpdater = ExuluSourceUpdaterArgs & {
445
456
  slug?: string;
446
457
  };
@@ -466,28 +477,24 @@ declare class ExuluApp {
466
477
  private _agents;
467
478
  private _workflows;
468
479
  private _config?;
469
- private _embedders;
470
480
  private _queues;
471
481
  private _contexts?;
472
482
  private _tools;
473
483
  private _expressApp;
474
484
  constructor();
475
- create: ({ contexts, embedders, agents, workflows, config, tools }: {
485
+ create: ({ contexts, agents, workflows, config, tools }: {
476
486
  contexts?: Record<string, ExuluContext>;
477
487
  config: ExuluConfig;
478
- embedders?: ExuluEmbedder[];
479
488
  agents?: ExuluAgent[];
480
489
  workflows?: ExuluWorkflow[];
481
490
  tools?: ExuluTool[];
482
491
  }) => Promise<Express>;
483
492
  get expressApp(): Express;
484
- embedder(id: string): ExuluEmbedder | undefined;
485
493
  tool(id: string): ExuluTool | undefined;
486
494
  tools(): ExuluTool[];
487
495
  context(id: string): ExuluContext | undefined;
488
496
  agent(id: string): ExuluAgent | undefined;
489
497
  workflow(id: string): ExuluWorkflow | undefined;
490
- get embedders(): ExuluEmbedder[];
491
498
  get contexts(): ExuluContext[];
492
499
  get workflows(): ExuluWorkflow[];
493
500
  get agents(): ExuluAgent[];
@@ -504,6 +511,7 @@ type User = {
504
511
  email: string;
505
512
  emailVerified?: string;
506
513
  type?: "api" | "user";
514
+ anthropic_token?: string;
507
515
  roles?: {
508
516
  id: string;
509
517
  role: string;
@@ -1396,10 +1404,6 @@ declare const JOB_STATUS_ENUM: {
1396
1404
  stuck: string;
1397
1405
  };
1398
1406
 
1399
- declare const _default: {
1400
- run: (exulu: ExuluApp) => void;
1401
- };
1402
-
1403
1407
  declare const ExuluJobs: {
1404
1408
  redis: typeof redisClient;
1405
1409
  jobs: {
@@ -1421,4 +1425,4 @@ declare const ExuluDatabase: {
1421
1425
  }>;
1422
1426
  };
1423
1427
 
1424
- 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, _default as ExuluCli, ExuluContext, ExuluDatabase, ExuluEmbedder, ExuluEval, type Job as ExuluJob, ExuluJobs, ExuluLogger, queues as ExuluQueues, ExuluSource, ExuluTool, ExuluWorkflow, type ExuluWorkflowStep, ExuluZodFileType };
1428
+ 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, ExuluDatabase, ExuluEmbedder, ExuluEval, type Job as ExuluJob, ExuluJobs, ExuluLogger, queues as ExuluQueues, ExuluSource, ExuluTool, ExuluWorkflow, type ExuluWorkflowStep, ExuluZodFileType };