@exulu/backend 3.0.0 → 3.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/README.md +37 -0
- package/dist/{chunk-KFL7HIID.js → chunk-CVQTDG37.js} +1738 -781
- package/dist/{convert-exulu-tools-to-ai-sdk-tools-YY2WIMMJ.js → convert-exulu-tools-to-ai-sdk-tools-QG7E6UX5.js} +1 -1
- package/dist/index.cjs +6947 -6530
- package/dist/index.d.cts +325 -369
- package/dist/index.d.ts +325 -369
- package/dist/index.js +3000 -3691
- package/ee/agentic-retrieval/pipeline/hyde.test.ts +1 -1
- package/ee/agentic-retrieval/pipeline/hyde.ts +6 -3
- package/ee/agentic-retrieval/pipeline/index.test.ts +1 -1
- package/ee/agentic-retrieval/pipeline/index.ts +0 -1
- package/ee/agentic-retrieval/pipeline/memory.test.ts +5 -1
- package/ee/agentic-retrieval/pipeline/memory.ts +71 -104
- package/ee/agentic-retrieval/pipeline/micro-call.test.ts +112 -0
- package/ee/agentic-retrieval/pipeline/micro-call.ts +98 -0
- package/ee/agentic-retrieval/pipeline/prefilter.test.ts +1 -0
- package/ee/agentic-retrieval/pipeline/prefilter.ts +11 -20
- package/ee/agentic-retrieval/pipeline/routing.test.ts +44 -1
- package/ee/agentic-retrieval/pipeline/routing.ts +31 -56
- package/ee/python/documents/processing/doc_processor.ts +0 -1
- package/ee/queues/queues.ts +13 -0
- package/ee/schemas.ts +11 -10
- package/ee/workers.ts +42 -56
- package/package.json +1 -1
- package/ee/workers.flow.test.ts +0 -236
package/dist/index.d.cts
CHANGED
|
@@ -4,9 +4,9 @@ import { Knex } from 'knex';
|
|
|
4
4
|
import { RedisClientType } from 'redis';
|
|
5
5
|
import * as bullmq from 'bullmq';
|
|
6
6
|
import { Queue } from 'bullmq';
|
|
7
|
-
import {
|
|
7
|
+
import { Express } from 'express';
|
|
8
8
|
import { transport } from 'winston';
|
|
9
|
-
import {
|
|
9
|
+
import { UIMessage, Tool, LanguageModel } from 'ai';
|
|
10
10
|
import { z } from 'zod';
|
|
11
11
|
import { Tiktoken } from 'tiktoken/lite';
|
|
12
12
|
import models from 'tiktoken/model_to_encoding.json';
|
|
@@ -92,37 +92,24 @@ declare function redisClient(): Promise<{
|
|
|
92
92
|
client: RedisClientType | null;
|
|
93
93
|
}>;
|
|
94
94
|
|
|
95
|
-
|
|
95
|
+
interface TestCase {
|
|
96
|
+
id: string;
|
|
96
97
|
name: string;
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
};
|
|
107
|
-
custom?: {
|
|
108
|
-
name: string;
|
|
109
|
-
description: string;
|
|
110
|
-
}[];
|
|
111
|
-
memory?: {
|
|
112
|
-
lastMessages: number;
|
|
113
|
-
vector: boolean;
|
|
114
|
-
semanticRecall: {
|
|
115
|
-
topK: number;
|
|
116
|
-
messageRange: number;
|
|
117
|
-
};
|
|
118
|
-
};
|
|
119
|
-
};
|
|
98
|
+
description?: string;
|
|
99
|
+
inputs: UIMessage[];
|
|
100
|
+
expected_output: string;
|
|
101
|
+
expected_tools?: string[];
|
|
102
|
+
expected_knowledge_sources?: string[];
|
|
103
|
+
expected_agent_tools?: string[];
|
|
104
|
+
createdAt: string;
|
|
105
|
+
updatedAt: string;
|
|
106
|
+
}
|
|
120
107
|
|
|
121
108
|
interface ExuluAgent {
|
|
122
109
|
id: string;
|
|
123
110
|
modelName?: string;
|
|
124
111
|
providerName?: string;
|
|
125
|
-
/** @deprecated Hydrated for read compatibility; the underlying DB column is gone. */
|
|
112
|
+
/** @deprecated Hydrated for read compatibility; the underlying DB column is gone. Use model instead */
|
|
126
113
|
provider?: string;
|
|
127
114
|
source: "code" | "database";
|
|
128
115
|
memory?: string;
|
|
@@ -133,7 +120,6 @@ interface ExuluAgent {
|
|
|
133
120
|
image?: string;
|
|
134
121
|
/** FK to models.id — replaces legacy provider + providerapikey columns. */
|
|
135
122
|
model?: string;
|
|
136
|
-
workflows?: ExuluProviderWorkflowConfig;
|
|
137
123
|
firewall?: {
|
|
138
124
|
enabled: boolean;
|
|
139
125
|
scanners?: {
|
|
@@ -198,6 +184,61 @@ type fileTypes$1 = '.pdf' | '.docx' | '.xlsx' | '.xls' | '.csv' | '.pptx' | '.pp
|
|
|
198
184
|
type audioTypes$1 = '.mp3' | '.wav' | '.m4a' | '.mp4' | '.mpeg';
|
|
199
185
|
type videoTypes$1 = '.mp4' | '.m4a' | '.mp3' | '.mpeg' | '.wav';
|
|
200
186
|
|
|
187
|
+
type ExuluQueueConfig = {
|
|
188
|
+
queue: Queue;
|
|
189
|
+
ratelimit: number;
|
|
190
|
+
timeoutInSeconds?: number;
|
|
191
|
+
concurrency: {
|
|
192
|
+
worker: number;
|
|
193
|
+
queue: number;
|
|
194
|
+
};
|
|
195
|
+
retries?: number;
|
|
196
|
+
backoff?: {
|
|
197
|
+
type: "exponential" | "linear";
|
|
198
|
+
delay: number;
|
|
199
|
+
};
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
interface ExuluEvalParams {
|
|
203
|
+
id: string;
|
|
204
|
+
name: string;
|
|
205
|
+
description: string;
|
|
206
|
+
llm: boolean;
|
|
207
|
+
execute: (params: {
|
|
208
|
+
agent: ExuluAgent;
|
|
209
|
+
messages: UIMessage[];
|
|
210
|
+
testCase: TestCase;
|
|
211
|
+
config?: Record<string, any>;
|
|
212
|
+
}) => Promise<number>;
|
|
213
|
+
config?: {
|
|
214
|
+
name: string;
|
|
215
|
+
description: string;
|
|
216
|
+
}[];
|
|
217
|
+
queue: Promise<ExuluQueueConfig>;
|
|
218
|
+
}
|
|
219
|
+
declare class ExuluEval {
|
|
220
|
+
id: string;
|
|
221
|
+
name: string;
|
|
222
|
+
description: string;
|
|
223
|
+
llm: boolean;
|
|
224
|
+
private execute;
|
|
225
|
+
config?: {
|
|
226
|
+
name: string;
|
|
227
|
+
description: string;
|
|
228
|
+
}[];
|
|
229
|
+
queue?: Promise<ExuluQueueConfig>;
|
|
230
|
+
constructor({ id, name, description, execute, config, queue, llm }: ExuluEvalParams);
|
|
231
|
+
run(agent: ExuluAgent, testCase: TestCase, messages: UIMessage[], config?: Record<string, any>): Promise<number>;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
type ExuluFieldTypes = "text" | "longText" | "shortText" | "number" | "boolean" | "code" | "json" | "enum" | "markdown" | "file" | "date" | "uuid";
|
|
235
|
+
|
|
236
|
+
type allFileTypes = imageTypes | fileTypes | audioTypes | videoTypes;
|
|
237
|
+
type audioTypes = ".mp3" | ".wav" | ".m4a" | ".mp4" | ".mpeg";
|
|
238
|
+
type videoTypes = ".mp4" | ".m4a" | ".mp3" | ".mpeg" | ".wav";
|
|
239
|
+
type imageTypes = ".png" | ".jpg" | ".jpeg" | ".gif" | ".webp";
|
|
240
|
+
type fileTypes = ".pdf" | ".docx" | ".doc" | ".xlsx" | ".xls" | ".csv" | ".pptx" | ".ppt" | ".txt" | ".md" | ".json" | ".srt" | ".html";
|
|
241
|
+
|
|
201
242
|
interface Item {
|
|
202
243
|
id?: string;
|
|
203
244
|
name?: string;
|
|
@@ -220,143 +261,6 @@ interface Item {
|
|
|
220
261
|
[key: string]: any;
|
|
221
262
|
}
|
|
222
263
|
|
|
223
|
-
/**
|
|
224
|
-
* OAuth 2.0 configuration for an {@link ExuluTool}. When a tool is constructed
|
|
225
|
-
* with an `oauth` property, Exulu wraps its `execute` so it only runs when a
|
|
226
|
-
* valid access token exists for the calling (providerKey, userId) pair — where
|
|
227
|
-
* providerKey defaults to the tool's id but can be shared across tools by
|
|
228
|
-
* setting the "provider" field below. When no valid token exists the tool
|
|
229
|
-
* short-circuits and returns an authorization URL the agent can show the user;
|
|
230
|
-
* the generic /oauth/callback route completes the flow and persists the tokens.
|
|
231
|
-
*
|
|
232
|
-
* Only the standard authorization-code grant is supported. All values are
|
|
233
|
-
* declared in code (source them from env vars or however you like) — none of
|
|
234
|
-
* them are exposed as admin-configurable tool config.
|
|
235
|
-
*/
|
|
236
|
-
type ExuluOauthConfig = {
|
|
237
|
-
/**
|
|
238
|
-
* Identifier for the OAuth provider (e.g., "google", "jira", "github").
|
|
239
|
-
* Tools sharing the same provider share tokens under (provider, userId) —
|
|
240
|
-
* one consent screen per provider per user instead of per tool. When
|
|
241
|
-
* omitted, defaults to the tool's `id`, preserving per-tool behavior for
|
|
242
|
-
* tools that don't opt in.
|
|
243
|
-
*/
|
|
244
|
-
provider?: string;
|
|
245
|
-
/** The provider's authorization endpoint, e.g. https://app.hubspot.com/oauth/authorize */
|
|
246
|
-
authorizationUrl: string;
|
|
247
|
-
/** The provider's token endpoint, e.g. https://api.hubapi.com/oauth/v1/token */
|
|
248
|
-
tokenUrl: string;
|
|
249
|
-
clientId: string;
|
|
250
|
-
/** Never leaves the server: used only in the server-side token exchange. */
|
|
251
|
-
clientSecret: string;
|
|
252
|
-
/** Scopes to request; joined with spaces in the authorization URL. */
|
|
253
|
-
scopes: string[];
|
|
254
|
-
/** PKCE (S256). Defaults to true; set false for providers that reject PKCE. */
|
|
255
|
-
pkce?: boolean;
|
|
256
|
-
/**
|
|
257
|
-
* Extra query params appended to the authorization URL, e.g.
|
|
258
|
-
* `{ access_type: "offline", prompt: "consent" }` to make Google return a
|
|
259
|
-
* refresh token.
|
|
260
|
-
*/
|
|
261
|
-
extraAuthParams?: Record<string, string>;
|
|
262
|
-
};
|
|
263
|
-
/** The oauth context injected into an oauth-enabled tool's execute inputs. */
|
|
264
|
-
type ExuluOauthToolContext = {
|
|
265
|
-
accessToken: string;
|
|
266
|
-
/** null when the provider did not report an expiry. */
|
|
267
|
-
expiresAt: Date | null;
|
|
268
|
-
/** Space-joined scopes the token was granted, when reported by the provider. */
|
|
269
|
-
scopes: string | null;
|
|
270
|
-
};
|
|
271
|
-
|
|
272
|
-
declare const PUBLIC_TOOL_TYPES: readonly ["function", "web_search", "skill", "context"];
|
|
273
|
-
type PublicToolType = (typeof PUBLIC_TOOL_TYPES)[number];
|
|
274
|
-
type ToolType = PublicToolType | "agent" | "context";
|
|
275
|
-
declare class ExuluTool {
|
|
276
|
-
id: string;
|
|
277
|
-
name: string;
|
|
278
|
-
description: string;
|
|
279
|
-
category: string;
|
|
280
|
-
inputSchema?: z.ZodType;
|
|
281
|
-
type: ToolType;
|
|
282
|
-
tool: Tool;
|
|
283
|
-
needsApproval: boolean;
|
|
284
|
-
oauth?: ExuluOauthConfig;
|
|
285
|
-
config: {
|
|
286
|
-
name: string;
|
|
287
|
-
description: string;
|
|
288
|
-
type: "boolean" | "string" | "number" | "variable" | "json";
|
|
289
|
-
default?: string | boolean | number | object;
|
|
290
|
-
}[];
|
|
291
|
-
constructor({ id, name, description, category, inputSchema, type, execute, config, needsApproval, oauth, }: {
|
|
292
|
-
id: string;
|
|
293
|
-
name: string;
|
|
294
|
-
description: string;
|
|
295
|
-
category?: string;
|
|
296
|
-
inputSchema?: z.ZodType;
|
|
297
|
-
type: PublicToolType;
|
|
298
|
-
config: {
|
|
299
|
-
name: string;
|
|
300
|
-
description: string;
|
|
301
|
-
type: "boolean" | "string" | "number" | "variable" | "json";
|
|
302
|
-
default?: string | boolean | number | object;
|
|
303
|
-
}[];
|
|
304
|
-
needsApproval?: boolean;
|
|
305
|
-
oauth?: ExuluOauthConfig;
|
|
306
|
-
execute: (inputs: any, options?: any) => Promise<{
|
|
307
|
-
result?: string;
|
|
308
|
-
job?: string;
|
|
309
|
-
items?: Item[];
|
|
310
|
-
}> | AsyncGenerator<{
|
|
311
|
-
result?: string;
|
|
312
|
-
job?: string;
|
|
313
|
-
items?: Item[];
|
|
314
|
-
}>;
|
|
315
|
-
});
|
|
316
|
-
/**
|
|
317
|
-
* Framework-only factory for tools whose `type` is managed by Exulu itself —
|
|
318
|
-
* "agent" (agent-as-tool instrumentation) and "context" (internal retrieval
|
|
319
|
-
* tools). NOT part of the public API: package consumers must use
|
|
320
|
-
* `new ExuluTool(...)`, which only accepts a {@link PublicToolType}. Building
|
|
321
|
-
* the tool as a "function" and then setting the managed type bypasses the
|
|
322
|
-
* constructor guard without weakening it for consumers.
|
|
323
|
-
*/
|
|
324
|
-
static internal(params: Omit<ConstructorParameters<typeof ExuluTool>[0], "type"> & {
|
|
325
|
-
type: ToolType;
|
|
326
|
-
}): ExuluTool;
|
|
327
|
-
execute: ({ agent: agentId, config, user, inputs, project, items, }: {
|
|
328
|
-
agent: string;
|
|
329
|
-
config: ExuluConfig;
|
|
330
|
-
user?: User;
|
|
331
|
-
inputs: any;
|
|
332
|
-
project?: string;
|
|
333
|
-
items?: string[];
|
|
334
|
-
}) => Promise<any>;
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
type ExuluFieldTypes = "text" | "longText" | "shortText" | "number" | "boolean" | "code" | "json" | "enum" | "markdown" | "file" | "date" | "uuid";
|
|
338
|
-
|
|
339
|
-
type allFileTypes = imageTypes | fileTypes | audioTypes | videoTypes;
|
|
340
|
-
type audioTypes = ".mp3" | ".wav" | ".m4a" | ".mp4" | ".mpeg";
|
|
341
|
-
type videoTypes = ".mp4" | ".m4a" | ".mp3" | ".mpeg" | ".wav";
|
|
342
|
-
type imageTypes = ".png" | ".jpg" | ".jpeg" | ".gif" | ".webp";
|
|
343
|
-
type fileTypes = ".pdf" | ".docx" | ".doc" | ".xlsx" | ".xls" | ".csv" | ".pptx" | ".ppt" | ".txt" | ".md" | ".json" | ".srt" | ".html";
|
|
344
|
-
|
|
345
|
-
type ExuluQueueConfig = {
|
|
346
|
-
queue: Queue;
|
|
347
|
-
ratelimit: number;
|
|
348
|
-
timeoutInSeconds?: number;
|
|
349
|
-
concurrency: {
|
|
350
|
-
worker: number;
|
|
351
|
-
queue: number;
|
|
352
|
-
};
|
|
353
|
-
retries?: number;
|
|
354
|
-
backoff?: {
|
|
355
|
-
type: "exponential" | "linear";
|
|
356
|
-
delay: number;
|
|
357
|
-
};
|
|
358
|
-
};
|
|
359
|
-
|
|
360
264
|
declare class ExuluStorage {
|
|
361
265
|
private config;
|
|
362
266
|
constructor({ config }: {
|
|
@@ -658,6 +562,13 @@ type ExuluContextFieldDefinition = {
|
|
|
658
562
|
index?: boolean;
|
|
659
563
|
enumValues?: string[];
|
|
660
564
|
allowedFileTypes?: allFileTypes[];
|
|
565
|
+
/**
|
|
566
|
+
* Write-only secret: excluded from the generated GraphQL object type, Filter
|
|
567
|
+
* type, SQL read selections, and all read payloads. Still accepted as
|
|
568
|
+
* mutation INPUT (the mutation layer hashes/stores it) unless additionally
|
|
569
|
+
* excluded by name in the input generator.
|
|
570
|
+
*/
|
|
571
|
+
hidden?: boolean;
|
|
661
572
|
};
|
|
662
573
|
type ExuluContextSource = {
|
|
663
574
|
id: string;
|
|
@@ -908,190 +819,252 @@ declare class ExuluContext {
|
|
|
908
819
|
createChunksTable: () => Promise<void>;
|
|
909
820
|
}
|
|
910
821
|
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
type ExuluProviderWorkflowConfig = {
|
|
935
|
-
enabled: boolean;
|
|
936
|
-
queue?: Promise<ExuluQueueConfig>;
|
|
937
|
-
};
|
|
938
|
-
interface ExuluProviderParams {
|
|
939
|
-
id: string;
|
|
940
|
-
name: string;
|
|
941
|
-
type: "agent";
|
|
942
|
-
description: string;
|
|
943
|
-
config?: ExuluProviderConfig | undefined;
|
|
944
|
-
queue?: ExuluQueueConfig;
|
|
945
|
-
maxContextLength?: number;
|
|
946
|
-
authenticationInformation?: string;
|
|
822
|
+
/**
|
|
823
|
+
* OAuth 2.0 configuration for an {@link ExuluTool}. When a tool is constructed
|
|
824
|
+
* with an `oauth` property, Exulu wraps its `execute` so it only runs when a
|
|
825
|
+
* valid access token exists for the calling (providerKey, userId) pair — where
|
|
826
|
+
* providerKey defaults to the tool's id but can be shared across tools by
|
|
827
|
+
* setting the "provider" field below. When no valid token exists the tool
|
|
828
|
+
* short-circuits and returns an authorization URL the agent can show the user;
|
|
829
|
+
* the generic /oauth/callback route completes the flow and persists the tokens.
|
|
830
|
+
*
|
|
831
|
+
* Only the standard authorization-code grant is supported. All values are
|
|
832
|
+
* declared in code (source them from env vars or however you like) — none of
|
|
833
|
+
* them are exposed as admin-configurable tool config.
|
|
834
|
+
*/
|
|
835
|
+
interface ExuluOauthConfig {
|
|
836
|
+
authType: "oauth";
|
|
837
|
+
/**
|
|
838
|
+
* Identifier for the OAuth provider (e.g., "google", "jira", "github").
|
|
839
|
+
* Tools sharing the same provider share tokens under (provider, userId) —
|
|
840
|
+
* one consent screen per provider per user instead of per tool. When
|
|
841
|
+
* omitted, defaults to the tool's `id`, preserving per-tool behavior for
|
|
842
|
+
* tools that don't opt in.
|
|
843
|
+
*/
|
|
947
844
|
provider: string;
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
845
|
+
/** The provider's authorization endpoint, e.g. https://app.hubspot.com/oauth/authorize */
|
|
846
|
+
authorizationUrl: string;
|
|
847
|
+
/** The provider's token endpoint, e.g. https://api.hubapi.com/oauth/v1/token */
|
|
848
|
+
tokenUrl: string;
|
|
849
|
+
clientId: string;
|
|
850
|
+
/** Never leaves the server: used only in the server-side token exchange. */
|
|
851
|
+
clientSecret: string;
|
|
852
|
+
/** Scopes to request; joined with spaces in the authorization URL. */
|
|
853
|
+
scopes: readonly string[];
|
|
854
|
+
/** PKCE (S256). Defaults to true; set false for providers that reject PKCE. */
|
|
855
|
+
pkce?: boolean;
|
|
856
|
+
/**
|
|
857
|
+
* Extra query params appended to the authorization URL, e.g.
|
|
858
|
+
* `{ access_type: "offline", prompt: "consent" }` to make Google return a
|
|
859
|
+
* refresh token.
|
|
860
|
+
*/
|
|
861
|
+
extraAuthParams?: Record<string, string>;
|
|
956
862
|
}
|
|
957
|
-
|
|
958
|
-
id: string;
|
|
863
|
+
interface CredentialField {
|
|
959
864
|
name: string;
|
|
865
|
+
label: string;
|
|
866
|
+
type: "text" | "password";
|
|
867
|
+
placeholder?: string;
|
|
868
|
+
help?: string;
|
|
869
|
+
}
|
|
870
|
+
interface ExuluUserCredentialsConfig {
|
|
871
|
+
authType: "user_credentials";
|
|
960
872
|
provider: string;
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
type: "agent";
|
|
964
|
-
streaming: boolean;
|
|
965
|
-
authenticationInformation?: string;
|
|
966
|
-
maxContextLength?: number;
|
|
967
|
-
workflows?: ExuluProviderWorkflowConfig;
|
|
968
|
-
queue?: ExuluQueueConfig;
|
|
969
|
-
config?: ExuluProviderConfig | undefined;
|
|
970
|
-
model?: {
|
|
971
|
-
create: ({ apiKey, user, role, project, agent }: {
|
|
972
|
-
apiKey?: string | undefined;
|
|
973
|
-
user?: number;
|
|
974
|
-
role?: string;
|
|
975
|
-
project?: string;
|
|
976
|
-
agent?: string;
|
|
977
|
-
}) => LanguageModel;
|
|
978
|
-
};
|
|
979
|
-
capabilities: {
|
|
980
|
-
text: boolean;
|
|
981
|
-
images: string[];
|
|
982
|
-
files: string[];
|
|
983
|
-
audio: string[];
|
|
984
|
-
video: string[];
|
|
985
|
-
};
|
|
986
|
-
constructor({ id, name, description, config, capabilities, type, maxContextLength, provider, queue, authenticationInformation, workflows, }: ExuluProviderParams);
|
|
987
|
-
get providerName(): string;
|
|
988
|
-
get modelName(): string;
|
|
989
|
-
tool: (instance: string, providers: ExuluProvider[], contexts: ExuluContext[]) => Promise<ExuluTool | null>;
|
|
990
|
-
generateSync: ({ prompt, req, user, session, inputMessages, approvedTools, currentTools, currentSkills, allExuluTools, statistics, toolConfigs, providerapikey, languageModel, contexts, exuluConfig, agent, instructions, maxStepCount, onTokenUsage, contextWindow, disabledTools, }: {
|
|
991
|
-
prompt?: string;
|
|
992
|
-
user?: User;
|
|
993
|
-
maxStepCount?: number;
|
|
994
|
-
req?: Request;
|
|
995
|
-
session?: string;
|
|
996
|
-
agent?: ExuluAgent;
|
|
997
|
-
approvedTools?: string[];
|
|
998
|
-
inputMessages?: UIMessage[];
|
|
999
|
-
currentTools?: ExuluTool[];
|
|
1000
|
-
currentSkills?: ExuluSkill[];
|
|
1001
|
-
allExuluTools?: ExuluTool[];
|
|
1002
|
-
statistics?: ExuluStatisticParams;
|
|
1003
|
-
toolConfigs?: ExuluAgentToolConfig[];
|
|
1004
|
-
providerapikey?: string | undefined;
|
|
1005
|
-
languageModel: LanguageModel;
|
|
1006
|
-
contexts?: ExuluContext[] | undefined;
|
|
1007
|
-
exuluConfig?: ExuluConfig;
|
|
1008
|
-
instructions?: string;
|
|
1009
|
-
onTokenUsage?: (usage: {
|
|
1010
|
-
inputTokens: number;
|
|
1011
|
-
outputTokens: number;
|
|
1012
|
-
}) => Promise<void> | void;
|
|
1013
|
-
contextWindow?: number;
|
|
1014
|
-
disabledTools?: string[];
|
|
1015
|
-
}) => Promise<any>;
|
|
1016
|
-
/**
|
|
1017
|
-
* Convert file parts in messages to OpenAI Responses API compatible format.
|
|
1018
|
-
* The OpenAI Responses API doesn't support inline file parts with type 'file'.
|
|
1019
|
-
* This function converts:
|
|
1020
|
-
* - Document files (PDF, DOCX, etc.) -> text parts with extracted content using officeparser
|
|
1021
|
-
* - Image files -> image parts (which ARE supported by Responses API)
|
|
1022
|
-
*/
|
|
1023
|
-
private processFilePartsInMessages;
|
|
1024
|
-
generateStream: ({ user, session, agent, message, previousMessages, currentTools, currentSkills, approvedTools, allExuluTools, toolConfigs, providerapikey, languageModel, contexts, exuluConfig, instructions, req, maxStepCount, contextWindow, disabledTools, }: {
|
|
1025
|
-
user?: User;
|
|
1026
|
-
session?: string;
|
|
1027
|
-
agent?: ExuluAgent;
|
|
1028
|
-
maxStepCount?: number;
|
|
1029
|
-
message?: UIMessage;
|
|
1030
|
-
previousMessages?: UIMessage[];
|
|
1031
|
-
currentTools?: ExuluTool[];
|
|
1032
|
-
currentSkills?: ExuluSkill[];
|
|
1033
|
-
approvedTools?: string[];
|
|
1034
|
-
allExuluTools?: ExuluTool[];
|
|
1035
|
-
toolConfigs?: ExuluAgentToolConfig[];
|
|
1036
|
-
providerapikey?: string | undefined;
|
|
1037
|
-
languageModel: LanguageModel;
|
|
1038
|
-
contexts?: ExuluContext[] | undefined;
|
|
1039
|
-
exuluConfig?: ExuluConfig;
|
|
1040
|
-
instructions?: string;
|
|
1041
|
-
req?: Request;
|
|
1042
|
-
contextWindow?: number;
|
|
1043
|
-
disabledTools?: string[];
|
|
1044
|
-
}) => Promise<{
|
|
1045
|
-
stream: ReturnType<typeof streamText>;
|
|
1046
|
-
originalMessages: UIMessage[];
|
|
1047
|
-
previousMessages: UIMessage[];
|
|
1048
|
-
}>;
|
|
873
|
+
fields: CredentialField[];
|
|
874
|
+
validate?: (values: Record<string, string>) => Promise<void>;
|
|
1049
875
|
}
|
|
1050
|
-
|
|
1051
|
-
interface
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
inputs: UIMessage[];
|
|
1056
|
-
expected_output: string;
|
|
1057
|
-
expected_tools?: string[];
|
|
1058
|
-
expected_knowledge_sources?: string[];
|
|
1059
|
-
expected_agent_tools?: string[];
|
|
1060
|
-
createdAt: string;
|
|
1061
|
-
updatedAt: string;
|
|
876
|
+
type ExuluAuthConfig = ExuluOauthConfig | ExuluUserCredentialsConfig;
|
|
877
|
+
interface ExuluCredentialsToolContext {
|
|
878
|
+
userId: string;
|
|
879
|
+
provider: string;
|
|
880
|
+
credentials: Record<string, string>;
|
|
1062
881
|
}
|
|
882
|
+
/** The oauth context injected into an oauth-enabled tool's execute inputs. */
|
|
883
|
+
type ExuluOauthToolContext = {
|
|
884
|
+
accessToken: string;
|
|
885
|
+
/** null when the provider did not report an expiry. */
|
|
886
|
+
expiresAt: Date | null;
|
|
887
|
+
/** Space-joined scopes the token was granted, when reported by the provider. */
|
|
888
|
+
scopes: string | null;
|
|
889
|
+
};
|
|
1063
890
|
|
|
1064
|
-
|
|
891
|
+
declare const PUBLIC_TOOL_TYPES: readonly ["function", "web_search", "skill", "context"];
|
|
892
|
+
type PublicToolType = (typeof PUBLIC_TOOL_TYPES)[number];
|
|
893
|
+
type ToolType = PublicToolType | "agent" | "context";
|
|
894
|
+
declare class ExuluTool {
|
|
1065
895
|
id: string;
|
|
1066
896
|
name: string;
|
|
1067
897
|
description: string;
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
}) => Promise<number>;
|
|
1076
|
-
config?: {
|
|
898
|
+
category: string;
|
|
899
|
+
inputSchema?: z.ZodType;
|
|
900
|
+
type: ToolType;
|
|
901
|
+
tool: Tool;
|
|
902
|
+
needsApproval: boolean;
|
|
903
|
+
authentication?: ExuluAuthConfig;
|
|
904
|
+
config: {
|
|
1077
905
|
name: string;
|
|
1078
906
|
description: string;
|
|
907
|
+
type: "boolean" | "string" | "number" | "variable" | "json";
|
|
908
|
+
default?: string | boolean | number | object;
|
|
1079
909
|
}[];
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
declare class ExuluEval {
|
|
1083
|
-
id: string;
|
|
1084
|
-
name: string;
|
|
1085
|
-
description: string;
|
|
1086
|
-
llm: boolean;
|
|
1087
|
-
private execute;
|
|
1088
|
-
config?: {
|
|
910
|
+
constructor({ id, name, description, category, inputSchema, type, execute, config, needsApproval, authentication, }: {
|
|
911
|
+
id: string;
|
|
1089
912
|
name: string;
|
|
1090
913
|
description: string;
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
914
|
+
category?: string;
|
|
915
|
+
inputSchema?: z.ZodType;
|
|
916
|
+
type: PublicToolType;
|
|
917
|
+
config: {
|
|
918
|
+
name: string;
|
|
919
|
+
description: string;
|
|
920
|
+
type: "boolean" | "string" | "number" | "variable" | "json";
|
|
921
|
+
default?: string | boolean | number | object;
|
|
922
|
+
}[];
|
|
923
|
+
needsApproval?: boolean;
|
|
924
|
+
authentication?: ExuluAuthConfig;
|
|
925
|
+
execute: (inputs: any, options?: any) => Promise<{
|
|
926
|
+
result?: string;
|
|
927
|
+
job?: string;
|
|
928
|
+
items?: Item[];
|
|
929
|
+
}> | AsyncGenerator<{
|
|
930
|
+
result?: string;
|
|
931
|
+
job?: string;
|
|
932
|
+
items?: Item[];
|
|
933
|
+
}>;
|
|
934
|
+
});
|
|
935
|
+
/**
|
|
936
|
+
* Framework-only factory for tools whose `type` is managed by Exulu itself —
|
|
937
|
+
* "agent" (agent-as-tool instrumentation) and "context" (internal retrieval
|
|
938
|
+
* tools). NOT part of the public API: package consumers must use
|
|
939
|
+
* `new ExuluTool(...)`, which only accepts a {@link PublicToolType}. Building
|
|
940
|
+
* the tool as a "function" and then setting the managed type bypasses the
|
|
941
|
+
* constructor guard without weakening it for consumers.
|
|
942
|
+
*/
|
|
943
|
+
static internal(params: Omit<ConstructorParameters<typeof ExuluTool>[0], "type"> & {
|
|
944
|
+
type: ToolType;
|
|
945
|
+
}): ExuluTool;
|
|
946
|
+
execute: ({ agent: agentId, config, user, inputs, project, items, }: {
|
|
947
|
+
agent: string;
|
|
948
|
+
config: ExuluConfig;
|
|
949
|
+
user?: User;
|
|
950
|
+
inputs: any;
|
|
951
|
+
project?: string;
|
|
952
|
+
items?: string[];
|
|
953
|
+
}) => Promise<any>;
|
|
954
|
+
}
|
|
955
|
+
|
|
956
|
+
type S3Target = {
|
|
957
|
+
s3region: string;
|
|
958
|
+
s3key: string;
|
|
959
|
+
s3secret: string;
|
|
960
|
+
s3Bucket: string;
|
|
961
|
+
s3endpoint?: string;
|
|
962
|
+
s3prefix?: string;
|
|
963
|
+
};
|
|
964
|
+
type AuditConfig = {
|
|
965
|
+
enabled: boolean;
|
|
966
|
+
s3?: S3Target;
|
|
967
|
+
retentionDays: number;
|
|
968
|
+
manageLifecycle?: boolean;
|
|
969
|
+
spoolDir?: string;
|
|
970
|
+
flush?: {
|
|
971
|
+
maxRecords?: number;
|
|
972
|
+
maxIntervalMs?: number;
|
|
973
|
+
};
|
|
974
|
+
payload?: {
|
|
975
|
+
maxBytes?: number;
|
|
976
|
+
captureOutput?: boolean;
|
|
977
|
+
redactKeys?: string[];
|
|
978
|
+
};
|
|
979
|
+
failureMode?: "open" | "closed";
|
|
980
|
+
sources?: {
|
|
981
|
+
toolCalls?: {
|
|
982
|
+
enabled?: boolean;
|
|
983
|
+
include?: string[];
|
|
984
|
+
exclude?: string[];
|
|
985
|
+
};
|
|
986
|
+
};
|
|
987
|
+
};
|
|
988
|
+
|
|
989
|
+
type AuditEvent = {
|
|
990
|
+
v: 1;
|
|
991
|
+
ts: string;
|
|
992
|
+
type: string;
|
|
993
|
+
actor: {
|
|
994
|
+
kind?: "user" | "agent" | "system";
|
|
995
|
+
userId?: string;
|
|
996
|
+
email?: string;
|
|
997
|
+
roleId?: string;
|
|
998
|
+
projectId?: string;
|
|
999
|
+
};
|
|
1000
|
+
context?: {
|
|
1001
|
+
sessionId?: string;
|
|
1002
|
+
agentId?: string;
|
|
1003
|
+
agentName?: string;
|
|
1004
|
+
toolCallId?: string;
|
|
1005
|
+
[k: string]: unknown;
|
|
1006
|
+
};
|
|
1007
|
+
target?: {
|
|
1008
|
+
kind?: string;
|
|
1009
|
+
id?: string;
|
|
1010
|
+
name?: string;
|
|
1011
|
+
[k: string]: unknown;
|
|
1012
|
+
};
|
|
1013
|
+
credential?: {
|
|
1014
|
+
provider: string;
|
|
1015
|
+
authType: "oauth" | "user_credentials";
|
|
1016
|
+
account?: string;
|
|
1017
|
+
scopes?: string[];
|
|
1018
|
+
expiresAt?: string | null;
|
|
1019
|
+
};
|
|
1020
|
+
status: "ok" | "error" | "denied" | "auth_required";
|
|
1021
|
+
error?: {
|
|
1022
|
+
name?: string;
|
|
1023
|
+
message: string;
|
|
1024
|
+
};
|
|
1025
|
+
data?: Record<string, unknown>;
|
|
1026
|
+
durationMs?: number;
|
|
1027
|
+
truncated?: Record<string, boolean>;
|
|
1028
|
+
};
|
|
1029
|
+
type AuditToolCallInput = {
|
|
1030
|
+
durationMs: number;
|
|
1031
|
+
agent?: {
|
|
1032
|
+
id?: string;
|
|
1033
|
+
name?: string;
|
|
1034
|
+
slug?: string;
|
|
1035
|
+
};
|
|
1036
|
+
tool: {
|
|
1037
|
+
id: string;
|
|
1038
|
+
name: string;
|
|
1039
|
+
category?: string;
|
|
1040
|
+
authentication?: ExuluAuthConfig;
|
|
1041
|
+
};
|
|
1042
|
+
builtin: boolean;
|
|
1043
|
+
user?: {
|
|
1044
|
+
id?: unknown;
|
|
1045
|
+
email?: string;
|
|
1046
|
+
role?: {
|
|
1047
|
+
id?: unknown;
|
|
1048
|
+
};
|
|
1049
|
+
};
|
|
1050
|
+
projectId?: string;
|
|
1051
|
+
sessionID?: string;
|
|
1052
|
+
toolCallId?: string;
|
|
1053
|
+
input: unknown;
|
|
1054
|
+
output: unknown;
|
|
1055
|
+
status: "ok" | "error" | "auth_required";
|
|
1056
|
+
error?: unknown;
|
|
1057
|
+
};
|
|
1058
|
+
|
|
1059
|
+
interface AuditLogger {
|
|
1060
|
+
enabled: boolean;
|
|
1061
|
+
failClosed: boolean;
|
|
1062
|
+
isBuiltin: (id: string) => boolean;
|
|
1063
|
+
shouldAuditTool: (id: string) => boolean;
|
|
1064
|
+
record: (event: AuditEvent) => void;
|
|
1065
|
+
recordToolCall: (ctx: AuditToolCallInput) => Promise<void>;
|
|
1066
|
+
flush: () => Promise<void>;
|
|
1067
|
+
close: () => Promise<void>;
|
|
1095
1068
|
}
|
|
1096
1069
|
|
|
1097
1070
|
type ExuluConfig = {
|
|
@@ -1128,6 +1101,12 @@ type ExuluConfig = {
|
|
|
1128
1101
|
privacy?: {
|
|
1129
1102
|
systemPromptPersonalization?: boolean;
|
|
1130
1103
|
};
|
|
1104
|
+
/**
|
|
1105
|
+
* Audit logging. When enabled, structured audit events (starting with one
|
|
1106
|
+
* per tool call) are batched to S3 as NDJSON with configurable retention.
|
|
1107
|
+
* Off by default. See docs/superpowers/specs/2026-07-28-tool-call-audit-layer-design.md.
|
|
1108
|
+
*/
|
|
1109
|
+
audit?: AuditConfig;
|
|
1131
1110
|
/**
|
|
1132
1111
|
* When true, ExuluApp.create() throws if any required system binary
|
|
1133
1112
|
* (pandoc / soffice / pdftoppm — needed by built-in skills like docx) is
|
|
@@ -1138,7 +1117,6 @@ type ExuluConfig = {
|
|
|
1138
1117
|
requireSystemDependencies?: boolean;
|
|
1139
1118
|
};
|
|
1140
1119
|
declare class ExuluApp {
|
|
1141
|
-
private _providers;
|
|
1142
1120
|
private _agents;
|
|
1143
1121
|
private _config?;
|
|
1144
1122
|
private _evals;
|
|
@@ -1146,14 +1124,15 @@ declare class ExuluApp {
|
|
|
1146
1124
|
private _contexts?;
|
|
1147
1125
|
private _tools;
|
|
1148
1126
|
private _expressApp;
|
|
1127
|
+
private _audit?;
|
|
1149
1128
|
constructor();
|
|
1150
|
-
create: ({ contexts,
|
|
1129
|
+
create: ({ contexts, config, agents, tools, evals, queues }: {
|
|
1151
1130
|
contexts?: Record<string, ExuluContext>;
|
|
1152
1131
|
config: ExuluConfig;
|
|
1153
1132
|
agents?: ExuluAgent[];
|
|
1154
|
-
providers?: ExuluProvider[];
|
|
1155
1133
|
evals?: ExuluEval[];
|
|
1156
1134
|
tools?: ExuluTool[];
|
|
1135
|
+
queues?: Promise<ExuluQueueConfig>[];
|
|
1157
1136
|
}) => Promise<ExuluApp>;
|
|
1158
1137
|
express: {
|
|
1159
1138
|
init: () => Promise<Express>;
|
|
@@ -1167,6 +1146,7 @@ declare class ExuluApp {
|
|
|
1167
1146
|
database: boolean;
|
|
1168
1147
|
};
|
|
1169
1148
|
}): Promise<ExuluAgent | undefined>;
|
|
1149
|
+
queues(): ExuluQueueConfig[];
|
|
1170
1150
|
agents(include?: {
|
|
1171
1151
|
source: {
|
|
1172
1152
|
code: boolean;
|
|
@@ -1174,9 +1154,8 @@ declare class ExuluApp {
|
|
|
1174
1154
|
};
|
|
1175
1155
|
}): Promise<ExuluAgent[]>;
|
|
1176
1156
|
context(id: string): ExuluContext | undefined;
|
|
1177
|
-
provider(id: string): ExuluProvider | undefined;
|
|
1178
1157
|
get contexts(): ExuluContext[];
|
|
1179
|
-
get
|
|
1158
|
+
get audit(): AuditLogger;
|
|
1180
1159
|
embeddings: {
|
|
1181
1160
|
generate: {
|
|
1182
1161
|
one: ({ context: contextId, item: itemId }: {
|
|
@@ -2532,6 +2511,12 @@ declare const JOB_STATUS_ENUM: {
|
|
|
2532
2511
|
cancelled: string;
|
|
2533
2512
|
};
|
|
2534
2513
|
|
|
2514
|
+
declare class CredentialInvalidError extends Error {
|
|
2515
|
+
readonly provider: string;
|
|
2516
|
+
readonly reason?: string;
|
|
2517
|
+
constructor(provider: string, reason?: string);
|
|
2518
|
+
}
|
|
2519
|
+
|
|
2535
2520
|
declare const ExuluJobs: {
|
|
2536
2521
|
redis: typeof redisClient;
|
|
2537
2522
|
};
|
|
@@ -2544,35 +2529,6 @@ declare const ExuluDefaultTools: {
|
|
|
2544
2529
|
};
|
|
2545
2530
|
};
|
|
2546
2531
|
};
|
|
2547
|
-
declare const ExuluDefaultProviders: {
|
|
2548
|
-
anthropic: {
|
|
2549
|
-
opus4: ExuluProvider;
|
|
2550
|
-
sonnet4: ExuluProvider;
|
|
2551
|
-
sonnet45: ExuluProvider;
|
|
2552
|
-
};
|
|
2553
|
-
cerebras: {
|
|
2554
|
-
gptOss120b: ExuluProvider;
|
|
2555
|
-
llama38b: ExuluProvider;
|
|
2556
|
-
llama3370b: ExuluProvider;
|
|
2557
|
-
};
|
|
2558
|
-
google: {
|
|
2559
|
-
vertexGemini25Flash: ExuluProvider;
|
|
2560
|
-
vertexGemini25Pro: ExuluProvider;
|
|
2561
|
-
vertexGemini3Pro: ExuluProvider;
|
|
2562
|
-
vertexLlamaScout4: ExuluProvider;
|
|
2563
|
-
};
|
|
2564
|
-
openai: {
|
|
2565
|
-
gpt5Mini: ExuluProvider;
|
|
2566
|
-
gpt5: ExuluProvider;
|
|
2567
|
-
gpt5pro: ExuluProvider;
|
|
2568
|
-
gpt5Codex: ExuluProvider;
|
|
2569
|
-
gpt5Nano: ExuluProvider;
|
|
2570
|
-
gpt41: ExuluProvider;
|
|
2571
|
-
gpt41Mini: ExuluProvider;
|
|
2572
|
-
gpt4o: ExuluProvider;
|
|
2573
|
-
gpt4oMini: ExuluProvider;
|
|
2574
|
-
};
|
|
2575
|
-
};
|
|
2576
2532
|
declare const ExuluVariables: {
|
|
2577
2533
|
get: (name: string) => Promise<string>;
|
|
2578
2534
|
};
|
|
@@ -2635,4 +2591,4 @@ declare const ExuluPython: {
|
|
|
2635
2591
|
instructions: typeof getPythonSetupInstructions;
|
|
2636
2592
|
};
|
|
2637
2593
|
|
|
2638
|
-
export { type ChunkerOperation, type ChunkerResponse, 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, type ExuluAgent, ExuluApp, ExuluAuthentication, ExuluChunkers, ExuluContext, type ExuluContextEmbedder,
|
|
2594
|
+
export { type AuditConfig, type AuditEvent, type AuditLogger, type ChunkerOperation, type ChunkerResponse, type CredentialField, CredentialInvalidError, 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, type ExuluAgent, ExuluApp, type ExuluAuthConfig, ExuluAuthentication, ExuluChunkers, ExuluContext, type ExuluContextEmbedder, type ExuluCredentialsToolContext, ExuluDatabase, ExuluDefaultTools, ExuluDocumentProcessor, ExuluEval, type Item as ExuluItem, ExuluJobs, type ExuluOauthConfig, type ExuluOauthToolContext, ExuluOtel, ExuluPython, queues as ExuluQueues, ExuluReadApi, ExuluReranker, ExuluTool, type ExuluUserCredentialsConfig, ExuluVariables, type VectorSearchChunkResult, defaultChunker, enableLiteLLMClientMode, postgresClient };
|