@exulu/backend 1.53.1 → 1.54.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
@@ -65,6 +65,7 @@ interface ExuluAgent {
65
65
  source: "code" | "database";
66
66
  memory?: string;
67
67
  welcomemessage?: string;
68
+ defaultagent?: boolean;
68
69
  type: "agent";
69
70
  name: string;
70
71
  image?: string;
@@ -752,12 +753,14 @@ declare class ExuluProvider {
752
753
  get providerName(): string;
753
754
  get modelName(): string;
754
755
  tool: (instance: string, providers: ExuluProvider[], contexts: ExuluContext[], rerankers: ExuluReranker[]) => Promise<ExuluTool | null>;
755
- generateSync: ({ prompt, req, user, session, inputMessages, currentTools, allExuluTools, statistics, toolConfigs, providerapikey, contexts, rerankers, exuluConfig, outputSchema, agent, instructions, }: {
756
+ generateSync: ({ prompt, req, user, session, inputMessages, approvedTools, currentTools, allExuluTools, statistics, toolConfigs, providerapikey, contexts, rerankers, exuluConfig, outputSchema, agent, instructions, maxStepCount, }: {
756
757
  prompt?: string;
757
758
  user?: User;
759
+ maxStepCount?: number;
758
760
  req?: Request;
759
761
  session?: string;
760
762
  agent?: ExuluAgent;
763
+ approvedTools?: string[];
761
764
  inputMessages?: UIMessage[];
762
765
  currentTools?: ExuluTool[];
763
766
  allExuluTools?: ExuluTool[];
@@ -778,10 +781,11 @@ declare class ExuluProvider {
778
781
  * - Image files -> image parts (which ARE supported by Responses API)
779
782
  */
780
783
  private processFilePartsInMessages;
781
- generateStream: ({ user, session, agent, message, previousMessages, currentTools, approvedTools, allExuluTools, toolConfigs, providerapikey, contexts, rerankers, exuluConfig, instructions, req, }: {
784
+ generateStream: ({ user, session, agent, message, previousMessages, currentTools, approvedTools, allExuluTools, toolConfigs, providerapikey, contexts, rerankers, exuluConfig, instructions, req, maxStepCount }: {
782
785
  user?: User;
783
786
  session?: string;
784
787
  agent?: ExuluAgent;
788
+ maxStepCount?: number;
785
789
  message?: UIMessage;
786
790
  previousMessages?: UIMessage[];
787
791
  currentTools?: ExuluTool[];
@@ -988,6 +992,15 @@ declare class ExuluQueues {
988
992
  }
989
993
  declare const queues: ExuluQueues;
990
994
 
995
+ /**
996
+ * Module-level registry so external callers (e.g. test scripts) can read
997
+ * the path of the most recently saved trajectory file.
998
+ * Works because both the trajectory logger and the test run in the same process.
999
+ */
1000
+ declare const trajectoryRegistry: {
1001
+ lastFile: string | undefined;
1002
+ };
1003
+
991
1004
  /**
992
1005
  * Represents the data structure for a chunk object.
993
1006
  *
@@ -1899,7 +1912,9 @@ declare class MarkdownChunker {
1899
1912
  */
1900
1913
  private findLogicalBreakpoint;
1901
1914
  private headers;
1902
- chunk(text: string, chunkSize: number, prefix?: string): Promise<{
1915
+ chunk(text: string, chunkSize: number, prefix?: string, config?: {
1916
+ pageBreakTags?: boolean;
1917
+ }): Promise<{
1903
1918
  text: string;
1904
1919
  page: number;
1905
1920
  }[]>;
@@ -2024,6 +2039,43 @@ declare function documentProcessor({ file, name, config }: {
2024
2039
  config?: DocumentProcessorConfig;
2025
2040
  }): Promise<ProcessedDocument | undefined>;
2026
2041
 
2042
+ /**
2043
+ * Creates the v3 ExuluTool for agentic context retrieval.
2044
+ *
2045
+ * Compared to v2:
2046
+ * - Single LLM call per step (vs two in v2)
2047
+ * - Query classification upfront → strategy-based step budget (1–3 vs hardcoded 2)
2048
+ * - Context example records sampled at init and cached
2049
+ * - Strategy-specific instructions and tool sets
2050
+ */
2051
+ declare function createAgenticRetrievalToolV3({ contexts, instructions: adminInstructions, rerankers, user, role, model, }: {
2052
+ contexts: ExuluContext[];
2053
+ rerankers: ExuluReranker[];
2054
+ user?: User;
2055
+ role?: string;
2056
+ model?: LanguageModel;
2057
+ instructions?: string;
2058
+ }): ExuluTool | undefined;
2059
+
2060
+ /**
2061
+ * Creates the V4 ExuluTool for agentic context retrieval.
2062
+ *
2063
+ * V4 uses an observe-infer-act loop with two primitive tools:
2064
+ * - execute_query: raw PostgreSQL SELECT via db.raw (with embed() helper for semantic search)
2065
+ * - grep: iterative search on large result files
2066
+ *
2067
+ * Unlike V3, there is no upfront query classification or strategy routing.
2068
+ * The agent writes its own SQL and decides when it has found enough information.
2069
+ */
2070
+ declare function createAgenticRetrievalToolV4({ contexts, instructions: adminInstructions, rerankers, user, role, model, }: {
2071
+ contexts: ExuluContext[];
2072
+ rerankers: ExuluReranker[];
2073
+ user?: User;
2074
+ role?: string;
2075
+ model?: LanguageModel;
2076
+ instructions?: string;
2077
+ }): ExuluTool | undefined;
2078
+
2027
2079
  type JOB_STATUS = "completed" | "failed" | "delayed" | "active" | "waiting" | "paused" | "stuck";
2028
2080
  declare const JOB_STATUS_ENUM: {
2029
2081
  completed: string;
@@ -2038,6 +2090,16 @@ declare const JOB_STATUS_ENUM: {
2038
2090
  declare const ExuluJobs: {
2039
2091
  redis: typeof redisClient;
2040
2092
  };
2093
+ declare const ExuluDefaultTools: {
2094
+ agentic: {
2095
+ retrieval: {
2096
+ create: {
2097
+ v3: typeof createAgenticRetrievalToolV3;
2098
+ v4: typeof createAgenticRetrievalToolV4;
2099
+ };
2100
+ };
2101
+ };
2102
+ };
2041
2103
  declare const ExuluDefaultProviders: {
2042
2104
  anthropic: {
2043
2105
  opus4: ExuluProvider;
@@ -2123,4 +2185,4 @@ declare const ExuluPython: {
2123
2185
  instructions: typeof getPythonSetupInstructions;
2124
2186
  };
2125
2187
 
2126
- 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, type ExuluAgent, ExuluApp, ExuluAuthentication, ExuluChunkers, ExuluContext, ExuluDatabase, ExuluDefaultProviders, ExuluDocumentProcessor, ExuluEmbedder, ExuluEval, type Item as ExuluItem, ExuluJobs, ExuluOtel, ExuluProvider, ExuluPython, queues as ExuluQueues, ExuluReranker, ExuluTool, ExuluVariables };
2188
+ 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, type ExuluAgent, ExuluApp, ExuluAuthentication, ExuluChunkers, ExuluContext, ExuluDatabase, ExuluDefaultProviders, ExuluDefaultTools, ExuluDocumentProcessor, ExuluEmbedder, ExuluEval, type Item as ExuluItem, ExuluJobs, ExuluOtel, ExuluProvider, ExuluPython, queues as ExuluQueues, ExuluReranker, ExuluTool, trajectoryRegistry as ExuluTrajectoryRegistry, ExuluVariables };
package/dist/index.d.ts CHANGED
@@ -65,6 +65,7 @@ interface ExuluAgent {
65
65
  source: "code" | "database";
66
66
  memory?: string;
67
67
  welcomemessage?: string;
68
+ defaultagent?: boolean;
68
69
  type: "agent";
69
70
  name: string;
70
71
  image?: string;
@@ -752,12 +753,14 @@ declare class ExuluProvider {
752
753
  get providerName(): string;
753
754
  get modelName(): string;
754
755
  tool: (instance: string, providers: ExuluProvider[], contexts: ExuluContext[], rerankers: ExuluReranker[]) => Promise<ExuluTool | null>;
755
- generateSync: ({ prompt, req, user, session, inputMessages, currentTools, allExuluTools, statistics, toolConfigs, providerapikey, contexts, rerankers, exuluConfig, outputSchema, agent, instructions, }: {
756
+ generateSync: ({ prompt, req, user, session, inputMessages, approvedTools, currentTools, allExuluTools, statistics, toolConfigs, providerapikey, contexts, rerankers, exuluConfig, outputSchema, agent, instructions, maxStepCount, }: {
756
757
  prompt?: string;
757
758
  user?: User;
759
+ maxStepCount?: number;
758
760
  req?: Request;
759
761
  session?: string;
760
762
  agent?: ExuluAgent;
763
+ approvedTools?: string[];
761
764
  inputMessages?: UIMessage[];
762
765
  currentTools?: ExuluTool[];
763
766
  allExuluTools?: ExuluTool[];
@@ -778,10 +781,11 @@ declare class ExuluProvider {
778
781
  * - Image files -> image parts (which ARE supported by Responses API)
779
782
  */
780
783
  private processFilePartsInMessages;
781
- generateStream: ({ user, session, agent, message, previousMessages, currentTools, approvedTools, allExuluTools, toolConfigs, providerapikey, contexts, rerankers, exuluConfig, instructions, req, }: {
784
+ generateStream: ({ user, session, agent, message, previousMessages, currentTools, approvedTools, allExuluTools, toolConfigs, providerapikey, contexts, rerankers, exuluConfig, instructions, req, maxStepCount }: {
782
785
  user?: User;
783
786
  session?: string;
784
787
  agent?: ExuluAgent;
788
+ maxStepCount?: number;
785
789
  message?: UIMessage;
786
790
  previousMessages?: UIMessage[];
787
791
  currentTools?: ExuluTool[];
@@ -988,6 +992,15 @@ declare class ExuluQueues {
988
992
  }
989
993
  declare const queues: ExuluQueues;
990
994
 
995
+ /**
996
+ * Module-level registry so external callers (e.g. test scripts) can read
997
+ * the path of the most recently saved trajectory file.
998
+ * Works because both the trajectory logger and the test run in the same process.
999
+ */
1000
+ declare const trajectoryRegistry: {
1001
+ lastFile: string | undefined;
1002
+ };
1003
+
991
1004
  /**
992
1005
  * Represents the data structure for a chunk object.
993
1006
  *
@@ -1899,7 +1912,9 @@ declare class MarkdownChunker {
1899
1912
  */
1900
1913
  private findLogicalBreakpoint;
1901
1914
  private headers;
1902
- chunk(text: string, chunkSize: number, prefix?: string): Promise<{
1915
+ chunk(text: string, chunkSize: number, prefix?: string, config?: {
1916
+ pageBreakTags?: boolean;
1917
+ }): Promise<{
1903
1918
  text: string;
1904
1919
  page: number;
1905
1920
  }[]>;
@@ -2024,6 +2039,43 @@ declare function documentProcessor({ file, name, config }: {
2024
2039
  config?: DocumentProcessorConfig;
2025
2040
  }): Promise<ProcessedDocument | undefined>;
2026
2041
 
2042
+ /**
2043
+ * Creates the v3 ExuluTool for agentic context retrieval.
2044
+ *
2045
+ * Compared to v2:
2046
+ * - Single LLM call per step (vs two in v2)
2047
+ * - Query classification upfront → strategy-based step budget (1–3 vs hardcoded 2)
2048
+ * - Context example records sampled at init and cached
2049
+ * - Strategy-specific instructions and tool sets
2050
+ */
2051
+ declare function createAgenticRetrievalToolV3({ contexts, instructions: adminInstructions, rerankers, user, role, model, }: {
2052
+ contexts: ExuluContext[];
2053
+ rerankers: ExuluReranker[];
2054
+ user?: User;
2055
+ role?: string;
2056
+ model?: LanguageModel;
2057
+ instructions?: string;
2058
+ }): ExuluTool | undefined;
2059
+
2060
+ /**
2061
+ * Creates the V4 ExuluTool for agentic context retrieval.
2062
+ *
2063
+ * V4 uses an observe-infer-act loop with two primitive tools:
2064
+ * - execute_query: raw PostgreSQL SELECT via db.raw (with embed() helper for semantic search)
2065
+ * - grep: iterative search on large result files
2066
+ *
2067
+ * Unlike V3, there is no upfront query classification or strategy routing.
2068
+ * The agent writes its own SQL and decides when it has found enough information.
2069
+ */
2070
+ declare function createAgenticRetrievalToolV4({ contexts, instructions: adminInstructions, rerankers, user, role, model, }: {
2071
+ contexts: ExuluContext[];
2072
+ rerankers: ExuluReranker[];
2073
+ user?: User;
2074
+ role?: string;
2075
+ model?: LanguageModel;
2076
+ instructions?: string;
2077
+ }): ExuluTool | undefined;
2078
+
2027
2079
  type JOB_STATUS = "completed" | "failed" | "delayed" | "active" | "waiting" | "paused" | "stuck";
2028
2080
  declare const JOB_STATUS_ENUM: {
2029
2081
  completed: string;
@@ -2038,6 +2090,16 @@ declare const JOB_STATUS_ENUM: {
2038
2090
  declare const ExuluJobs: {
2039
2091
  redis: typeof redisClient;
2040
2092
  };
2093
+ declare const ExuluDefaultTools: {
2094
+ agentic: {
2095
+ retrieval: {
2096
+ create: {
2097
+ v3: typeof createAgenticRetrievalToolV3;
2098
+ v4: typeof createAgenticRetrievalToolV4;
2099
+ };
2100
+ };
2101
+ };
2102
+ };
2041
2103
  declare const ExuluDefaultProviders: {
2042
2104
  anthropic: {
2043
2105
  opus4: ExuluProvider;
@@ -2123,4 +2185,4 @@ declare const ExuluPython: {
2123
2185
  instructions: typeof getPythonSetupInstructions;
2124
2186
  };
2125
2187
 
2126
- 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, type ExuluAgent, ExuluApp, ExuluAuthentication, ExuluChunkers, ExuluContext, ExuluDatabase, ExuluDefaultProviders, ExuluDocumentProcessor, ExuluEmbedder, ExuluEval, type Item as ExuluItem, ExuluJobs, ExuluOtel, ExuluProvider, ExuluPython, queues as ExuluQueues, ExuluReranker, ExuluTool, ExuluVariables };
2188
+ 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, type ExuluAgent, ExuluApp, ExuluAuthentication, ExuluChunkers, ExuluContext, ExuluDatabase, ExuluDefaultProviders, ExuluDefaultTools, ExuluDocumentProcessor, ExuluEmbedder, ExuluEval, type Item as ExuluItem, ExuluJobs, ExuluOtel, ExuluProvider, ExuluPython, queues as ExuluQueues, ExuluReranker, ExuluTool, trajectoryRegistry as ExuluTrajectoryRegistry, ExuluVariables };