@exulu/backend 0.2.2 → 0.2.4
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.cjs +346 -142
- package/dist/index.d.cts +61 -9
- package/dist/index.d.ts +61 -9
- package/dist/index.js +338 -135
- package/package.json +10 -9
- package/types/enums/jobs.ts +11 -0
package/dist/index.d.cts
CHANGED
|
@@ -1,17 +1,26 @@
|
|
|
1
1
|
import * as bullmq from 'bullmq';
|
|
2
2
|
import { Queue } from 'bullmq';
|
|
3
3
|
import { RedisClientType } from 'redis';
|
|
4
|
-
import * as _mastra_core from '@mastra/core';
|
|
5
|
-
import { ToolAction, Workflow, Agent } from '@mastra/core';
|
|
6
4
|
import { ZodSchema, z } from 'zod';
|
|
5
|
+
import { ToolAction, Agent } from '@mastra/core';
|
|
7
6
|
import { LanguageModelV1 } from 'ai';
|
|
8
7
|
import { Express } from 'express';
|
|
9
8
|
import { Knex } from 'knex';
|
|
9
|
+
import { SentenceChunker } from 'chonkie';
|
|
10
10
|
|
|
11
11
|
declare function redisClient(): Promise<{
|
|
12
12
|
client: RedisClientType | null;
|
|
13
13
|
}>;
|
|
14
14
|
|
|
15
|
+
type Job = {
|
|
16
|
+
id: string;
|
|
17
|
+
name: string;
|
|
18
|
+
status: string;
|
|
19
|
+
result?: string;
|
|
20
|
+
date_done?: Date;
|
|
21
|
+
date_started?: Date;
|
|
22
|
+
};
|
|
23
|
+
|
|
15
24
|
type STATISTICS_TYPE = "context.retrieve" | "source.update" | "embedder.upsert" | "embedder.delete" | "workflow.run" | "context.upsert" | "tool.call" | "agent.run";
|
|
16
25
|
declare const STATISTICS_TYPE_ENUM: {
|
|
17
26
|
CONTEXT_RETRIEVE: string;
|
|
@@ -103,6 +112,7 @@ declare class ExuluAgent {
|
|
|
103
112
|
config: ExuluAgentConfig;
|
|
104
113
|
private memory;
|
|
105
114
|
tools?: ExuluTool[];
|
|
115
|
+
agent?: Agent;
|
|
106
116
|
capabilities: {
|
|
107
117
|
tools: boolean;
|
|
108
118
|
images: string[];
|
|
@@ -127,7 +137,7 @@ declare class ExuluAgent {
|
|
|
127
137
|
};
|
|
128
138
|
tools?: ExuluTool[];
|
|
129
139
|
});
|
|
130
|
-
chat: (
|
|
140
|
+
chat: () => Agent;
|
|
131
141
|
}
|
|
132
142
|
type VectorOperationResponse = Promise<{
|
|
133
143
|
count: number;
|
|
@@ -183,6 +193,19 @@ declare class ExuluEmbedder {
|
|
|
183
193
|
trigger: string;
|
|
184
194
|
}): VectorGenerationResponse;
|
|
185
195
|
}
|
|
196
|
+
type ExuluWorkflowStep = {
|
|
197
|
+
id: string;
|
|
198
|
+
name: string;
|
|
199
|
+
description: string;
|
|
200
|
+
inputSchema: ZodSchema;
|
|
201
|
+
retries?: number;
|
|
202
|
+
fn: ({ inputs, job, user, logger }: {
|
|
203
|
+
inputs: any;
|
|
204
|
+
user?: string;
|
|
205
|
+
logger: ExuluLogger;
|
|
206
|
+
job?: Job;
|
|
207
|
+
}) => Promise<any>;
|
|
208
|
+
};
|
|
186
209
|
declare class ExuluWorkflow {
|
|
187
210
|
id: string;
|
|
188
211
|
name: string;
|
|
@@ -190,17 +213,30 @@ declare class ExuluWorkflow {
|
|
|
190
213
|
enable_batch: boolean;
|
|
191
214
|
slug: string;
|
|
192
215
|
queue: Queue | undefined;
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
constructor({ id, name, description, workflow, queue, enable_batch, inputSchema }: {
|
|
216
|
+
steps: Array<ExuluWorkflowStep>;
|
|
217
|
+
constructor({ id, name, description, steps, queue, enable_batch }: {
|
|
196
218
|
id: string;
|
|
197
219
|
name: string;
|
|
198
220
|
description: string;
|
|
199
|
-
|
|
221
|
+
steps: Array<ExuluWorkflowStep>;
|
|
200
222
|
queue?: Queue;
|
|
201
|
-
inputSchema?: ZodSchema;
|
|
202
223
|
enable_batch: boolean;
|
|
203
224
|
});
|
|
225
|
+
start: ({ inputs: initialInputs, user, logger, job, session, agent, label }: {
|
|
226
|
+
inputs: any;
|
|
227
|
+
user?: string;
|
|
228
|
+
logger: ExuluLogger;
|
|
229
|
+
job?: Job;
|
|
230
|
+
session?: string;
|
|
231
|
+
agent?: string;
|
|
232
|
+
label?: string;
|
|
233
|
+
}) => Promise<any>;
|
|
234
|
+
}
|
|
235
|
+
declare class ExuluLogger {
|
|
236
|
+
private readonly logPath?;
|
|
237
|
+
private readonly job?;
|
|
238
|
+
constructor(job?: Job, logsDir?: string);
|
|
239
|
+
write(message: string, level: "INFO" | "ERROR" | "WARNING"): Promise<void>;
|
|
204
240
|
}
|
|
205
241
|
type AddSourceArgs = Omit<ExuluSourceConstructorArgs, "context">;
|
|
206
242
|
declare class ExuluTool {
|
|
@@ -440,6 +476,17 @@ declare class ExuluQueues {
|
|
|
440
476
|
}
|
|
441
477
|
declare const queues: ExuluQueues;
|
|
442
478
|
|
|
479
|
+
type JOB_STATUS = "completed" | "failed" | "delayed" | "active" | "waiting" | "paused" | "stuck";
|
|
480
|
+
declare const JOB_STATUS_ENUM: {
|
|
481
|
+
completed: string;
|
|
482
|
+
failed: string;
|
|
483
|
+
delayed: string;
|
|
484
|
+
active: string;
|
|
485
|
+
waiting: string;
|
|
486
|
+
paused: string;
|
|
487
|
+
stuck: string;
|
|
488
|
+
};
|
|
489
|
+
|
|
443
490
|
declare const ExuluJobs: {
|
|
444
491
|
redis: typeof redisClient;
|
|
445
492
|
jobs: {
|
|
@@ -447,6 +494,11 @@ declare const ExuluJobs: {
|
|
|
447
494
|
};
|
|
448
495
|
};
|
|
449
496
|
|
|
497
|
+
declare const ExuluChunkers: {
|
|
498
|
+
chonkie: {
|
|
499
|
+
sentence: typeof SentenceChunker;
|
|
500
|
+
};
|
|
501
|
+
};
|
|
450
502
|
declare const ExuluDatabase: {
|
|
451
503
|
init: () => Promise<void>;
|
|
452
504
|
generateApiKey: (name: string, email: string) => Promise<{
|
|
@@ -454,4 +506,4 @@ declare const ExuluDatabase: {
|
|
|
454
506
|
}>;
|
|
455
507
|
};
|
|
456
508
|
|
|
457
|
-
export { type STATISTICS_TYPE as EXULU_STATISTICS_TYPE, STATISTICS_TYPE_ENUM as EXULU_STATISTICS_TYPE_ENUM, ExuluAgent, ExuluApp, authentication as ExuluAuthentication, ExuluContext, ExuluDatabase, ExuluEmbedder, ExuluJobs, queues as ExuluQueues, ExuluSource, ExuluTool, ExuluWorkflow, ExuluZodFileType };
|
|
509
|
+
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, type Job as ExuluJob, ExuluJobs, ExuluLogger, queues as ExuluQueues, ExuluSource, ExuluTool, ExuluWorkflow, type ExuluWorkflowStep, ExuluZodFileType };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,17 +1,26 @@
|
|
|
1
1
|
import * as bullmq from 'bullmq';
|
|
2
2
|
import { Queue } from 'bullmq';
|
|
3
3
|
import { RedisClientType } from 'redis';
|
|
4
|
-
import * as _mastra_core from '@mastra/core';
|
|
5
|
-
import { ToolAction, Workflow, Agent } from '@mastra/core';
|
|
6
4
|
import { ZodSchema, z } from 'zod';
|
|
5
|
+
import { ToolAction, Agent } from '@mastra/core';
|
|
7
6
|
import { LanguageModelV1 } from 'ai';
|
|
8
7
|
import { Express } from 'express';
|
|
9
8
|
import { Knex } from 'knex';
|
|
9
|
+
import { SentenceChunker } from 'chonkie';
|
|
10
10
|
|
|
11
11
|
declare function redisClient(): Promise<{
|
|
12
12
|
client: RedisClientType | null;
|
|
13
13
|
}>;
|
|
14
14
|
|
|
15
|
+
type Job = {
|
|
16
|
+
id: string;
|
|
17
|
+
name: string;
|
|
18
|
+
status: string;
|
|
19
|
+
result?: string;
|
|
20
|
+
date_done?: Date;
|
|
21
|
+
date_started?: Date;
|
|
22
|
+
};
|
|
23
|
+
|
|
15
24
|
type STATISTICS_TYPE = "context.retrieve" | "source.update" | "embedder.upsert" | "embedder.delete" | "workflow.run" | "context.upsert" | "tool.call" | "agent.run";
|
|
16
25
|
declare const STATISTICS_TYPE_ENUM: {
|
|
17
26
|
CONTEXT_RETRIEVE: string;
|
|
@@ -103,6 +112,7 @@ declare class ExuluAgent {
|
|
|
103
112
|
config: ExuluAgentConfig;
|
|
104
113
|
private memory;
|
|
105
114
|
tools?: ExuluTool[];
|
|
115
|
+
agent?: Agent;
|
|
106
116
|
capabilities: {
|
|
107
117
|
tools: boolean;
|
|
108
118
|
images: string[];
|
|
@@ -127,7 +137,7 @@ declare class ExuluAgent {
|
|
|
127
137
|
};
|
|
128
138
|
tools?: ExuluTool[];
|
|
129
139
|
});
|
|
130
|
-
chat: (
|
|
140
|
+
chat: () => Agent;
|
|
131
141
|
}
|
|
132
142
|
type VectorOperationResponse = Promise<{
|
|
133
143
|
count: number;
|
|
@@ -183,6 +193,19 @@ declare class ExuluEmbedder {
|
|
|
183
193
|
trigger: string;
|
|
184
194
|
}): VectorGenerationResponse;
|
|
185
195
|
}
|
|
196
|
+
type ExuluWorkflowStep = {
|
|
197
|
+
id: string;
|
|
198
|
+
name: string;
|
|
199
|
+
description: string;
|
|
200
|
+
inputSchema: ZodSchema;
|
|
201
|
+
retries?: number;
|
|
202
|
+
fn: ({ inputs, job, user, logger }: {
|
|
203
|
+
inputs: any;
|
|
204
|
+
user?: string;
|
|
205
|
+
logger: ExuluLogger;
|
|
206
|
+
job?: Job;
|
|
207
|
+
}) => Promise<any>;
|
|
208
|
+
};
|
|
186
209
|
declare class ExuluWorkflow {
|
|
187
210
|
id: string;
|
|
188
211
|
name: string;
|
|
@@ -190,17 +213,30 @@ declare class ExuluWorkflow {
|
|
|
190
213
|
enable_batch: boolean;
|
|
191
214
|
slug: string;
|
|
192
215
|
queue: Queue | undefined;
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
constructor({ id, name, description, workflow, queue, enable_batch, inputSchema }: {
|
|
216
|
+
steps: Array<ExuluWorkflowStep>;
|
|
217
|
+
constructor({ id, name, description, steps, queue, enable_batch }: {
|
|
196
218
|
id: string;
|
|
197
219
|
name: string;
|
|
198
220
|
description: string;
|
|
199
|
-
|
|
221
|
+
steps: Array<ExuluWorkflowStep>;
|
|
200
222
|
queue?: Queue;
|
|
201
|
-
inputSchema?: ZodSchema;
|
|
202
223
|
enable_batch: boolean;
|
|
203
224
|
});
|
|
225
|
+
start: ({ inputs: initialInputs, user, logger, job, session, agent, label }: {
|
|
226
|
+
inputs: any;
|
|
227
|
+
user?: string;
|
|
228
|
+
logger: ExuluLogger;
|
|
229
|
+
job?: Job;
|
|
230
|
+
session?: string;
|
|
231
|
+
agent?: string;
|
|
232
|
+
label?: string;
|
|
233
|
+
}) => Promise<any>;
|
|
234
|
+
}
|
|
235
|
+
declare class ExuluLogger {
|
|
236
|
+
private readonly logPath?;
|
|
237
|
+
private readonly job?;
|
|
238
|
+
constructor(job?: Job, logsDir?: string);
|
|
239
|
+
write(message: string, level: "INFO" | "ERROR" | "WARNING"): Promise<void>;
|
|
204
240
|
}
|
|
205
241
|
type AddSourceArgs = Omit<ExuluSourceConstructorArgs, "context">;
|
|
206
242
|
declare class ExuluTool {
|
|
@@ -440,6 +476,17 @@ declare class ExuluQueues {
|
|
|
440
476
|
}
|
|
441
477
|
declare const queues: ExuluQueues;
|
|
442
478
|
|
|
479
|
+
type JOB_STATUS = "completed" | "failed" | "delayed" | "active" | "waiting" | "paused" | "stuck";
|
|
480
|
+
declare const JOB_STATUS_ENUM: {
|
|
481
|
+
completed: string;
|
|
482
|
+
failed: string;
|
|
483
|
+
delayed: string;
|
|
484
|
+
active: string;
|
|
485
|
+
waiting: string;
|
|
486
|
+
paused: string;
|
|
487
|
+
stuck: string;
|
|
488
|
+
};
|
|
489
|
+
|
|
443
490
|
declare const ExuluJobs: {
|
|
444
491
|
redis: typeof redisClient;
|
|
445
492
|
jobs: {
|
|
@@ -447,6 +494,11 @@ declare const ExuluJobs: {
|
|
|
447
494
|
};
|
|
448
495
|
};
|
|
449
496
|
|
|
497
|
+
declare const ExuluChunkers: {
|
|
498
|
+
chonkie: {
|
|
499
|
+
sentence: typeof SentenceChunker;
|
|
500
|
+
};
|
|
501
|
+
};
|
|
450
502
|
declare const ExuluDatabase: {
|
|
451
503
|
init: () => Promise<void>;
|
|
452
504
|
generateApiKey: (name: string, email: string) => Promise<{
|
|
@@ -454,4 +506,4 @@ declare const ExuluDatabase: {
|
|
|
454
506
|
}>;
|
|
455
507
|
};
|
|
456
508
|
|
|
457
|
-
export { type STATISTICS_TYPE as EXULU_STATISTICS_TYPE, STATISTICS_TYPE_ENUM as EXULU_STATISTICS_TYPE_ENUM, ExuluAgent, ExuluApp, authentication as ExuluAuthentication, ExuluContext, ExuluDatabase, ExuluEmbedder, ExuluJobs, queues as ExuluQueues, ExuluSource, ExuluTool, ExuluWorkflow, ExuluZodFileType };
|
|
509
|
+
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, type Job as ExuluJob, ExuluJobs, ExuluLogger, queues as ExuluQueues, ExuluSource, ExuluTool, ExuluWorkflow, type ExuluWorkflowStep, ExuluZodFileType };
|