@exulu/backend 1.69.3 → 2.0.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.
Files changed (47) hide show
  1. package/dist/{catalog-TBSPSN2N.js → catalog-UGTDNMDM.js} +2 -1
  2. package/dist/{chunk-YCE44CMU.js → chunk-7CCMW3IW.js} +2 -0
  3. package/dist/chunk-IJ4HNHOT.js +6416 -0
  4. package/dist/{chunk-IDHS2BZO.js → chunk-T6JVFT7L.js} +2 -0
  5. package/dist/cli/start-whisper.cjs +1 -0
  6. package/dist/cli/start-whisper.js +2 -1
  7. package/dist/convert-exulu-tools-to-ai-sdk-tools-2PEDFZ2X.js +9 -0
  8. package/dist/index.cjs +9558 -9262
  9. package/dist/index.d.cts +46 -29
  10. package/dist/index.d.ts +46 -29
  11. package/dist/index.js +4989 -548
  12. package/ee/agentic-retrieval/pipeline/config.test.ts +81 -0
  13. package/ee/agentic-retrieval/pipeline/config.ts +189 -0
  14. package/ee/agentic-retrieval/pipeline/hyde.test.ts +55 -0
  15. package/ee/agentic-retrieval/pipeline/hyde.ts +133 -0
  16. package/ee/agentic-retrieval/pipeline/index.test.ts +140 -0
  17. package/ee/agentic-retrieval/pipeline/index.ts +638 -0
  18. package/ee/agentic-retrieval/pipeline/memory.test.ts +101 -0
  19. package/ee/agentic-retrieval/pipeline/memory.ts +566 -0
  20. package/ee/agentic-retrieval/pipeline/multi-query.test.ts +51 -0
  21. package/ee/agentic-retrieval/pipeline/multi-query.ts +158 -0
  22. package/ee/agentic-retrieval/pipeline/prefilter.test.ts +93 -0
  23. package/ee/agentic-retrieval/pipeline/prefilter.ts +389 -0
  24. package/ee/agentic-retrieval/pipeline/rerank.test.ts +128 -0
  25. package/ee/agentic-retrieval/pipeline/rerank.ts +178 -0
  26. package/ee/agentic-retrieval/pipeline/routing.test.ts +144 -0
  27. package/ee/agentic-retrieval/pipeline/routing.ts +343 -0
  28. package/ee/agentic-retrieval/pipeline/search.test.ts +149 -0
  29. package/ee/agentic-retrieval/pipeline/search.ts +180 -0
  30. package/ee/agentic-retrieval/pipeline/text-utils.test.ts +43 -0
  31. package/ee/agentic-retrieval/pipeline/text-utils.ts +85 -0
  32. package/ee/agentic-retrieval/pipeline/types.ts +59 -0
  33. package/ee/python/documents/processing/doc_processor.ts +1 -1
  34. package/ee/python/documents/processing/split_pdf.py +78 -24
  35. package/package.json +2 -1
  36. package/dist/chunk-WCP3WZM3.js +0 -10391
  37. package/dist/convert-exulu-tools-to-ai-sdk-tools-GQ3UIYP7.js +0 -6
  38. package/ee/agentic-retrieval/v3/agent-loop.ts +0 -288
  39. package/ee/agentic-retrieval/v3/classifier.ts +0 -92
  40. package/ee/agentic-retrieval/v3/context-sampler.ts +0 -79
  41. package/ee/agentic-retrieval/v3/dynamic-tools.ts +0 -115
  42. package/ee/agentic-retrieval/v3/index.ts +0 -471
  43. package/ee/agentic-retrieval/v3/session-tools-registry.ts +0 -20
  44. package/ee/agentic-retrieval/v3/strategies.ts +0 -171
  45. package/ee/agentic-retrieval/v3/tools.ts +0 -558
  46. package/ee/agentic-retrieval/v3/trajectory.ts +0 -309
  47. package/ee/agentic-retrieval/v3/types.ts +0 -59
package/dist/index.d.cts CHANGED
@@ -157,7 +157,7 @@ interface ExuluAgent {
157
157
  config: {
158
158
  name: string;
159
159
  variable: string;
160
- type: "boolean" | "string" | "number" | "variable";
160
+ type: "boolean" | "string" | "number" | "variable" | "json";
161
161
  }[];
162
162
  name: string;
163
163
  description: string;
@@ -222,16 +222,25 @@ interface Item {
222
222
  /**
223
223
  * OAuth 2.0 configuration for an {@link ExuluTool}. When a tool is constructed
224
224
  * with an `oauth` property, Exulu wraps its `execute` so it only runs when a
225
- * valid access token exists for the calling (toolId, userId) pair. When no
226
- * valid token exists the tool short-circuits and returns an authorization URL
227
- * the agent can show the user; the generic /oauth/callback route completes the
228
- * flow and persists the tokens.
225
+ * valid access token exists for the calling (providerKey, userId) pair where
226
+ * providerKey defaults to the tool's id but can be shared across tools by
227
+ * setting the "provider" field below. When no valid token exists the tool
228
+ * short-circuits and returns an authorization URL the agent can show the user;
229
+ * the generic /oauth/callback route completes the flow and persists the tokens.
229
230
  *
230
231
  * Only the standard authorization-code grant is supported. All values are
231
232
  * declared in code (source them from env vars or however you like) — none of
232
233
  * them are exposed as admin-configurable tool config.
233
234
  */
234
235
  type ExuluOauthConfig = {
236
+ /**
237
+ * Identifier for the OAuth provider (e.g., "google", "jira", "github").
238
+ * Tools sharing the same provider share tokens under (provider, userId) —
239
+ * one consent screen per provider per user instead of per tool. When
240
+ * omitted, defaults to the tool's `id`, preserving per-tool behavior for
241
+ * tools that don't opt in.
242
+ */
243
+ provider?: string;
235
244
  /** The provider's authorization endpoint, e.g. https://app.hubspot.com/oauth/authorize */
236
245
  authorizationUrl: string;
237
246
  /** The provider's token endpoint, e.g. https://api.hubapi.com/oauth/v1/token */
@@ -275,8 +284,8 @@ declare class ExuluTool {
275
284
  config: {
276
285
  name: string;
277
286
  description: string;
278
- type: "boolean" | "string" | "number" | "variable";
279
- default?: string | boolean | number;
287
+ type: "boolean" | "string" | "number" | "variable" | "json";
288
+ default?: string | boolean | number | object;
280
289
  }[];
281
290
  constructor({ id, name, description, category, inputSchema, type, execute, config, needsApproval, oauth, }: {
282
291
  id: string;
@@ -288,8 +297,8 @@ declare class ExuluTool {
288
297
  config: {
289
298
  name: string;
290
299
  description: string;
291
- type: "boolean" | "string" | "number" | "variable";
292
- default?: string | boolean | number;
300
+ type: "boolean" | "string" | "number" | "variable" | "json";
301
+ default?: string | boolean | number | object;
293
302
  }[];
294
303
  needsApproval?: boolean;
295
304
  oauth?: ExuluOauthConfig;
@@ -903,10 +912,10 @@ type ExuluAgentToolConfig = {
903
912
  type: string;
904
913
  config: {
905
914
  name: string;
906
- variable: string | boolean | number;
907
- type: "boolean" | "string" | "number" | "variable";
915
+ variable: string | boolean | number | object;
916
+ type: "boolean" | "string" | "number" | "variable" | "json";
908
917
  value?: any;
909
- default?: string | boolean | number;
918
+ default?: string | boolean | number | object;
910
919
  }[];
911
920
  };
912
921
 
@@ -1227,10 +1236,6 @@ declare class ExuluQueues {
1227
1236
  }
1228
1237
  declare const queues: ExuluQueues;
1229
1238
 
1230
- declare const trajectoryRegistry: {
1231
- lastFile: string | undefined;
1232
- };
1233
-
1234
1239
  /**
1235
1240
  * Represents the data structure for a chunk object.
1236
1241
  *
@@ -1855,6 +1860,26 @@ declare function postgresClient(): Promise<{
1855
1860
  db: Knex;
1856
1861
  }>;
1857
1862
 
1863
+ /**
1864
+ * Switch this process into LiteLLM *client* mode: it connects to an
1865
+ * externally-managed proxy (spawned by the Exulu HTTP server process, or a
1866
+ * standalone proxy) rather than spawning and supervising its own.
1867
+ *
1868
+ * This is the correct mode for worker processes. The supervisor's `internal`
1869
+ * state is per-process; a worker runs as a separate Node process from the
1870
+ * server and never goes through express.init() (where the supervisor is
1871
+ * started), so without this it would try to spawn its own proxy — colliding
1872
+ * with the server's on LITELLM_PORT — or, lacking a package root, fail with
1873
+ * "package root not set" even though a healthy proxy is already running.
1874
+ *
1875
+ * No-op if this process has already started its own supervisor (e.g. a
1876
+ * combined server+worker process): that process owns a proxy and keeps using
1877
+ * it. Idempotent. Readiness is resolved lazily by waitForLiteLLMReady() via a
1878
+ * health probe, so this never blocks boot and tolerates the proxy coming up
1879
+ * after the worker.
1880
+ */
1881
+ declare const enableLiteLLMClientMode: () => void;
1882
+
1858
1883
  /**
1859
1884
  * Represents the essential data for a sentence within a text.
1860
1885
  *
@@ -2447,23 +2472,15 @@ declare function rerank<T extends RerankableChunk>(input: ExuluRerankInput<T>):
2447
2472
  rerank_score: number;
2448
2473
  })[]>;
2449
2474
 
2450
- /**
2451
- * Creates the v3 ExuluTool for agentic context retrieval.
2452
- *
2453
- * Compared to v2:
2454
- * - Single LLM call per step (vs two in v2)
2455
- * - Query classification upfront → strategy-based step budget (1–3 vs hardcoded 2)
2456
- * - Context example records sampled at init and cached
2457
- * - Strategy-specific instructions and tool sets
2458
- */
2459
- declare function createAgenticRetrievalToolV3({ contexts, instructions: adminInstructions, user, role, model, preselected, memoryItems }: {
2475
+ declare function createAgenticRetrievalTool(opts: {
2460
2476
  contexts: ExuluContext[];
2477
+ memoryContext?: ExuluContext;
2461
2478
  user?: User;
2462
2479
  role?: string;
2463
2480
  model?: LanguageModel;
2464
2481
  instructions?: string;
2465
2482
  preselected?: string[];
2466
- memoryItems?: Item[];
2483
+ memoryItems?: VectorSearchChunkResult[];
2467
2484
  }): ExuluTool | undefined;
2468
2485
 
2469
2486
  type JOB_STATUS = "completed" | "failed" | "delayed" | "active" | "waiting" | "paused" | "stuck";
@@ -2484,7 +2501,7 @@ declare const ExuluDefaultTools: {
2484
2501
  agentic: {
2485
2502
  retrieval: {
2486
2503
  create: {
2487
- v3: typeof createAgenticRetrievalToolV3;
2504
+ pipeline: typeof createAgenticRetrievalTool;
2488
2505
  };
2489
2506
  };
2490
2507
  };
@@ -2580,4 +2597,4 @@ declare const ExuluPython: {
2580
2597
  instructions: typeof getPythonSetupInstructions;
2581
2598
  };
2582
2599
 
2583
- 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, ExuluDatabase, ExuluDefaultProviders, ExuluDefaultTools, ExuluDocumentProcessor, ExuluEval, type Item as ExuluItem, ExuluJobs, type ExuluOauthConfig, type ExuluOauthToolContext, ExuluOtel, ExuluProvider, ExuluPython, queues as ExuluQueues, ExuluReadApi, ExuluReranker, ExuluTool, trajectoryRegistry as ExuluTrajectoryRegistry, ExuluVariables, type VectorSearchChunkResult, defaultChunker, postgresClient };
2600
+ 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, ExuluDatabase, ExuluDefaultProviders, ExuluDefaultTools, ExuluDocumentProcessor, ExuluEval, type Item as ExuluItem, ExuluJobs, type ExuluOauthConfig, type ExuluOauthToolContext, ExuluOtel, ExuluProvider, ExuluPython, queues as ExuluQueues, ExuluReadApi, ExuluReranker, ExuluTool, ExuluVariables, type VectorSearchChunkResult, defaultChunker, enableLiteLLMClientMode, postgresClient };
package/dist/index.d.ts CHANGED
@@ -157,7 +157,7 @@ interface ExuluAgent {
157
157
  config: {
158
158
  name: string;
159
159
  variable: string;
160
- type: "boolean" | "string" | "number" | "variable";
160
+ type: "boolean" | "string" | "number" | "variable" | "json";
161
161
  }[];
162
162
  name: string;
163
163
  description: string;
@@ -222,16 +222,25 @@ interface Item {
222
222
  /**
223
223
  * OAuth 2.0 configuration for an {@link ExuluTool}. When a tool is constructed
224
224
  * with an `oauth` property, Exulu wraps its `execute` so it only runs when a
225
- * valid access token exists for the calling (toolId, userId) pair. When no
226
- * valid token exists the tool short-circuits and returns an authorization URL
227
- * the agent can show the user; the generic /oauth/callback route completes the
228
- * flow and persists the tokens.
225
+ * valid access token exists for the calling (providerKey, userId) pair where
226
+ * providerKey defaults to the tool's id but can be shared across tools by
227
+ * setting the "provider" field below. When no valid token exists the tool
228
+ * short-circuits and returns an authorization URL the agent can show the user;
229
+ * the generic /oauth/callback route completes the flow and persists the tokens.
229
230
  *
230
231
  * Only the standard authorization-code grant is supported. All values are
231
232
  * declared in code (source them from env vars or however you like) — none of
232
233
  * them are exposed as admin-configurable tool config.
233
234
  */
234
235
  type ExuluOauthConfig = {
236
+ /**
237
+ * Identifier for the OAuth provider (e.g., "google", "jira", "github").
238
+ * Tools sharing the same provider share tokens under (provider, userId) —
239
+ * one consent screen per provider per user instead of per tool. When
240
+ * omitted, defaults to the tool's `id`, preserving per-tool behavior for
241
+ * tools that don't opt in.
242
+ */
243
+ provider?: string;
235
244
  /** The provider's authorization endpoint, e.g. https://app.hubspot.com/oauth/authorize */
236
245
  authorizationUrl: string;
237
246
  /** The provider's token endpoint, e.g. https://api.hubapi.com/oauth/v1/token */
@@ -275,8 +284,8 @@ declare class ExuluTool {
275
284
  config: {
276
285
  name: string;
277
286
  description: string;
278
- type: "boolean" | "string" | "number" | "variable";
279
- default?: string | boolean | number;
287
+ type: "boolean" | "string" | "number" | "variable" | "json";
288
+ default?: string | boolean | number | object;
280
289
  }[];
281
290
  constructor({ id, name, description, category, inputSchema, type, execute, config, needsApproval, oauth, }: {
282
291
  id: string;
@@ -288,8 +297,8 @@ declare class ExuluTool {
288
297
  config: {
289
298
  name: string;
290
299
  description: string;
291
- type: "boolean" | "string" | "number" | "variable";
292
- default?: string | boolean | number;
300
+ type: "boolean" | "string" | "number" | "variable" | "json";
301
+ default?: string | boolean | number | object;
293
302
  }[];
294
303
  needsApproval?: boolean;
295
304
  oauth?: ExuluOauthConfig;
@@ -903,10 +912,10 @@ type ExuluAgentToolConfig = {
903
912
  type: string;
904
913
  config: {
905
914
  name: string;
906
- variable: string | boolean | number;
907
- type: "boolean" | "string" | "number" | "variable";
915
+ variable: string | boolean | number | object;
916
+ type: "boolean" | "string" | "number" | "variable" | "json";
908
917
  value?: any;
909
- default?: string | boolean | number;
918
+ default?: string | boolean | number | object;
910
919
  }[];
911
920
  };
912
921
 
@@ -1227,10 +1236,6 @@ declare class ExuluQueues {
1227
1236
  }
1228
1237
  declare const queues: ExuluQueues;
1229
1238
 
1230
- declare const trajectoryRegistry: {
1231
- lastFile: string | undefined;
1232
- };
1233
-
1234
1239
  /**
1235
1240
  * Represents the data structure for a chunk object.
1236
1241
  *
@@ -1855,6 +1860,26 @@ declare function postgresClient(): Promise<{
1855
1860
  db: Knex;
1856
1861
  }>;
1857
1862
 
1863
+ /**
1864
+ * Switch this process into LiteLLM *client* mode: it connects to an
1865
+ * externally-managed proxy (spawned by the Exulu HTTP server process, or a
1866
+ * standalone proxy) rather than spawning and supervising its own.
1867
+ *
1868
+ * This is the correct mode for worker processes. The supervisor's `internal`
1869
+ * state is per-process; a worker runs as a separate Node process from the
1870
+ * server and never goes through express.init() (where the supervisor is
1871
+ * started), so without this it would try to spawn its own proxy — colliding
1872
+ * with the server's on LITELLM_PORT — or, lacking a package root, fail with
1873
+ * "package root not set" even though a healthy proxy is already running.
1874
+ *
1875
+ * No-op if this process has already started its own supervisor (e.g. a
1876
+ * combined server+worker process): that process owns a proxy and keeps using
1877
+ * it. Idempotent. Readiness is resolved lazily by waitForLiteLLMReady() via a
1878
+ * health probe, so this never blocks boot and tolerates the proxy coming up
1879
+ * after the worker.
1880
+ */
1881
+ declare const enableLiteLLMClientMode: () => void;
1882
+
1858
1883
  /**
1859
1884
  * Represents the essential data for a sentence within a text.
1860
1885
  *
@@ -2447,23 +2472,15 @@ declare function rerank<T extends RerankableChunk>(input: ExuluRerankInput<T>):
2447
2472
  rerank_score: number;
2448
2473
  })[]>;
2449
2474
 
2450
- /**
2451
- * Creates the v3 ExuluTool for agentic context retrieval.
2452
- *
2453
- * Compared to v2:
2454
- * - Single LLM call per step (vs two in v2)
2455
- * - Query classification upfront → strategy-based step budget (1–3 vs hardcoded 2)
2456
- * - Context example records sampled at init and cached
2457
- * - Strategy-specific instructions and tool sets
2458
- */
2459
- declare function createAgenticRetrievalToolV3({ contexts, instructions: adminInstructions, user, role, model, preselected, memoryItems }: {
2475
+ declare function createAgenticRetrievalTool(opts: {
2460
2476
  contexts: ExuluContext[];
2477
+ memoryContext?: ExuluContext;
2461
2478
  user?: User;
2462
2479
  role?: string;
2463
2480
  model?: LanguageModel;
2464
2481
  instructions?: string;
2465
2482
  preselected?: string[];
2466
- memoryItems?: Item[];
2483
+ memoryItems?: VectorSearchChunkResult[];
2467
2484
  }): ExuluTool | undefined;
2468
2485
 
2469
2486
  type JOB_STATUS = "completed" | "failed" | "delayed" | "active" | "waiting" | "paused" | "stuck";
@@ -2484,7 +2501,7 @@ declare const ExuluDefaultTools: {
2484
2501
  agentic: {
2485
2502
  retrieval: {
2486
2503
  create: {
2487
- v3: typeof createAgenticRetrievalToolV3;
2504
+ pipeline: typeof createAgenticRetrievalTool;
2488
2505
  };
2489
2506
  };
2490
2507
  };
@@ -2580,4 +2597,4 @@ declare const ExuluPython: {
2580
2597
  instructions: typeof getPythonSetupInstructions;
2581
2598
  };
2582
2599
 
2583
- 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, ExuluDatabase, ExuluDefaultProviders, ExuluDefaultTools, ExuluDocumentProcessor, ExuluEval, type Item as ExuluItem, ExuluJobs, type ExuluOauthConfig, type ExuluOauthToolContext, ExuluOtel, ExuluProvider, ExuluPython, queues as ExuluQueues, ExuluReadApi, ExuluReranker, ExuluTool, trajectoryRegistry as ExuluTrajectoryRegistry, ExuluVariables, type VectorSearchChunkResult, defaultChunker, postgresClient };
2600
+ 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, ExuluDatabase, ExuluDefaultProviders, ExuluDefaultTools, ExuluDocumentProcessor, ExuluEval, type Item as ExuluItem, ExuluJobs, type ExuluOauthConfig, type ExuluOauthToolContext, ExuluOtel, ExuluProvider, ExuluPython, queues as ExuluQueues, ExuluReadApi, ExuluReranker, ExuluTool, ExuluVariables, type VectorSearchChunkResult, defaultChunker, enableLiteLLMClientMode, postgresClient };