@exulu/backend 1.64.0 → 1.65.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.
@@ -5700,7 +5700,7 @@ function createAgenticRetrievalToolV3({
5700
5700
  return void 0;
5701
5701
  }
5702
5702
  const contextNames = contexts.map((c) => c.id).join(", ");
5703
- return new ExuluTool({
5703
+ return ExuluTool.internal({
5704
5704
  id: "agentic_context_search",
5705
5705
  name: "Context Search",
5706
5706
  description: `Intelligent context search with query classification, strategy-based retrieval, and virtual filesystem filtering. Searches: ${contextNames}`,
@@ -6040,7 +6040,7 @@ var createProjectItemsRetrievalTool = async ({
6040
6040
  if (!project.project_items?.length) {
6041
6041
  return;
6042
6042
  }
6043
- const projectRetrievalTool = new ExuluTool({
6043
+ const projectRetrievalTool = ExuluTool.internal({
6044
6044
  id: "context_search_in_knowledge_items_added_to_project_" + projectId,
6045
6045
  name: "context_search in knowledge items added to project " + project.name,
6046
6046
  description: "This tool retrieves information about a project from conversations and items that were added to the project " + project.name + ".",
@@ -12379,7 +12379,7 @@ var ExuluProvider = class {
12379
12379
  if (!license["multi-agent-tooling"]) {
12380
12380
  console.warn(`[EXULU] You are not licensed to use multi-agent tooling so cannot export this agent as a tool. Please set your EXULU_ENTERPRISE_LICENSE env variable.`);
12381
12381
  }
12382
- return new ExuluTool({
12382
+ return ExuluTool.internal({
12383
12383
  id: agent.id,
12384
12384
  name: `${agent.name}`,
12385
12385
  type: "agent",
@@ -18543,7 +18543,6 @@ var ResolveModelError = class extends Error {
18543
18543
  this.name = "ResolveModelError";
18544
18544
  }
18545
18545
  };
18546
- var _litellmProvider;
18547
18546
  var getLiteLLMProvider = ({
18548
18547
  user,
18549
18548
  role,
@@ -18551,7 +18550,6 @@ var getLiteLLMProvider = ({
18551
18550
  agent,
18552
18551
  team
18553
18552
  }) => {
18554
- if (_litellmProvider) return _litellmProvider;
18555
18553
  const host = process.env.LITELLM_HOST ?? "127.0.0.1";
18556
18554
  const port = process.env.LITELLM_PORT ?? "4000";
18557
18555
  const masterKey = process.env.LITELLM_MASTER_KEY;
@@ -18573,7 +18571,7 @@ var getLiteLLMProvider = ({
18573
18571
  "LITELLM_MASTER_KEY is required when EXULU_USE_LITELLM=true"
18574
18572
  );
18575
18573
  }
18576
- _litellmProvider = createOpenAICompatible({
18574
+ return createOpenAICompatible({
18577
18575
  name: "litellm",
18578
18576
  baseURL: `http://${host}:${port}/v1`,
18579
18577
  apiKey: masterKey,
@@ -18589,7 +18587,6 @@ var getLiteLLMProvider = ({
18589
18587
  // proxy contract.
18590
18588
  supportsStructuredOutputs: true
18591
18589
  });
18592
- return _litellmProvider;
18593
18590
  };
18594
18591
  async function resolveModel(input) {
18595
18592
  const { modelId, user, providers, agent, project, rbacBypass } = input;
@@ -18686,7 +18683,8 @@ async function resolveModel(input) {
18686
18683
  }
18687
18684
 
18688
18685
  // src/exulu/tool.ts
18689
- var ExuluTool = class {
18686
+ var PUBLIC_TOOL_TYPES = ["function", "web_search", "skill"];
18687
+ var ExuluTool = class _ExuluTool {
18690
18688
  // Must begin with a letter (a-z) or underscore (_). Subsequent characters in a name can be letters, digits (0-9), or
18691
18689
  // underscores and be a max length of 80 characters and at least 5 characters long.
18692
18690
  // The ID is used for storing references to tools so it is important it does not change.
@@ -18710,6 +18708,13 @@ var ExuluTool = class {
18710
18708
  config,
18711
18709
  needsApproval
18712
18710
  }) {
18711
+ if (!PUBLIC_TOOL_TYPES.includes(type)) {
18712
+ throw new Error(
18713
+ `ExuluTool "${id}": invalid type "${type}". Allowed types are ${PUBLIC_TOOL_TYPES.join(
18714
+ ", "
18715
+ )}. The "agent" and "context" types are managed by Exulu internally and cannot be set on a tool.`
18716
+ );
18717
+ }
18713
18718
  this.id = id;
18714
18719
  this.config = config;
18715
18720
  this.needsApproval = needsApproval ?? true;
@@ -18724,6 +18729,19 @@ var ExuluTool = class {
18724
18729
  execute
18725
18730
  });
18726
18731
  }
18732
+ /**
18733
+ * Framework-only factory for tools whose `type` is managed by Exulu itself —
18734
+ * "agent" (agent-as-tool instrumentation) and "context" (internal retrieval
18735
+ * tools). NOT part of the public API: package consumers must use
18736
+ * `new ExuluTool(...)`, which only accepts a {@link PublicToolType}. Building
18737
+ * the tool as a "function" and then setting the managed type bypasses the
18738
+ * constructor guard without weakening it for consumers.
18739
+ */
18740
+ static internal(params) {
18741
+ const instance2 = new _ExuluTool({ ...params, type: "function" });
18742
+ instance2.type = params.type;
18743
+ return instance2;
18744
+ }
18727
18745
  execute = async ({
18728
18746
  agent: agentId,
18729
18747
  config,
@@ -18756,7 +18774,7 @@ var ExuluTool = class {
18756
18774
  });
18757
18775
  providerapikey = resolved.apiKey;
18758
18776
  }
18759
- const { convertExuluToolsToAiSdkTools: convertExuluToolsToAiSdkTools2 } = await import("./convert-exulu-tools-to-ai-sdk-tools-D35XXTKW.js");
18777
+ const { convertExuluToolsToAiSdkTools: convertExuluToolsToAiSdkTools2 } = await import("./convert-exulu-tools-to-ai-sdk-tools-J7PNBC5K.js");
18760
18778
  const tools = await convertExuluToolsToAiSdkTools2(
18761
18779
  [this],
18762
18780
  [],
@@ -18816,7 +18834,7 @@ var createSessionItemsRetrievalTool = async ({
18816
18834
  items
18817
18835
  }) => {
18818
18836
  console.log("[EXULU] Session search tool created for session", items);
18819
- const sessionItemsRetrievalTool = new ExuluTool({
18837
+ const sessionItemsRetrievalTool = ExuluTool.internal({
18820
18838
  id: "session_items_information_context_search",
18821
18839
  name: "context_search in knowledge items added to session.",
18822
18840
  description: "Context search in knowledge items added to session.",
@@ -19252,9 +19270,10 @@ var convertExuluToolsToAiSdkTools = async (currentTools, currentSkills, approved
19252
19270
  if (!s3Client2) {
19253
19271
  throw new Error("S3 client not initialized");
19254
19272
  }
19255
- const response2 = await s3Client2.send(command);
19256
- console.log(response2);
19257
- return response2;
19273
+ await s3Client2.send(command);
19274
+ const bucket = exuluConfig?.fileUploads?.s3Bucket ?? "";
19275
+ const presignedUrl = await getPresignedUrl(bucket, key, exuluConfig);
19276
+ return { url: presignedUrl, key: `${bucket}/${key}` };
19258
19277
  } catch (caught) {
19259
19278
  if (caught instanceof S3ServiceException && caught.name === "EntityTooLarge") {
19260
19279
  throw new Error(`[EXULU] Error from S3 while uploading object to ${exuluConfig?.fileUploads?.s3Bucket}. The object was too large. To upload objects larger than 5GB, use the S3 console (160GB max) or the multipart upload API (5TB max).`);
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  convertExuluToolsToAiSdkTools
3
- } from "./chunk-A5AZEDLP.js";
3
+ } from "./chunk-DQR5LQOE.js";
4
4
  import "./chunk-YCE44CMU.js";
5
5
  export {
6
6
  convertExuluToolsToAiSdkTools
package/dist/index.cjs CHANGED
@@ -1695,7 +1695,7 @@ async function resolveModel(input) {
1695
1695
  });
1696
1696
  return { languageModel, model, exuluProvider, apiKey };
1697
1697
  }
1698
- var import_crypto_js, import_openai_compatible, LITELLM_PROVIDER_SENTINEL, ResolveModelError, _litellmProvider, getLiteLLMProvider;
1698
+ var import_crypto_js, import_openai_compatible, LITELLM_PROVIDER_SENTINEL, ResolveModelError, getLiteLLMProvider;
1699
1699
  var init_resolve_model = __esm({
1700
1700
  "src/exulu/resolve-model.ts"() {
1701
1701
  "use strict";
@@ -1736,7 +1736,6 @@ var init_resolve_model = __esm({
1736
1736
  agent,
1737
1737
  team
1738
1738
  }) => {
1739
- if (_litellmProvider) return _litellmProvider;
1740
1739
  const host = process.env.LITELLM_HOST ?? "127.0.0.1";
1741
1740
  const port = process.env.LITELLM_PORT ?? "4000";
1742
1741
  const masterKey = process.env.LITELLM_MASTER_KEY;
@@ -1758,7 +1757,7 @@ var init_resolve_model = __esm({
1758
1757
  "LITELLM_MASTER_KEY is required when EXULU_USE_LITELLM=true"
1759
1758
  );
1760
1759
  }
1761
- _litellmProvider = (0, import_openai_compatible.createOpenAICompatible)({
1760
+ return (0, import_openai_compatible.createOpenAICompatible)({
1762
1761
  name: "litellm",
1763
1762
  baseURL: `http://${host}:${port}/v1`,
1764
1763
  apiKey: masterKey,
@@ -1774,7 +1773,6 @@ var init_resolve_model = __esm({
1774
1773
  // proxy contract.
1775
1774
  supportsStructuredOutputs: true
1776
1775
  });
1777
- return _litellmProvider;
1778
1776
  };
1779
1777
  }
1780
1778
  });
@@ -1845,7 +1843,7 @@ var init_project_retrieval_tool = __esm({
1845
1843
  if (!project.project_items?.length) {
1846
1844
  return;
1847
1845
  }
1848
- const projectRetrievalTool = new ExuluTool({
1846
+ const projectRetrievalTool = ExuluTool.internal({
1849
1847
  id: "context_search_in_knowledge_items_added_to_project_" + projectId,
1850
1848
  name: "context_search in knowledge items added to project " + project.name,
1851
1849
  description: "This tool retrieves information about a project from conversations and items that were added to the project " + project.name + ".",
@@ -1947,7 +1945,7 @@ var init_session_items_retrieval_tool = __esm({
1947
1945
  items
1948
1946
  }) => {
1949
1947
  console.log("[EXULU] Session search tool created for session", items);
1950
- const sessionItemsRetrievalTool = new ExuluTool({
1948
+ const sessionItemsRetrievalTool = ExuluTool.internal({
1951
1949
  id: "session_items_information_context_search",
1952
1950
  name: "context_search in knowledge items added to session.",
1953
1951
  description: "Context search in knowledge items added to session.",
@@ -3893,9 +3891,10 @@ var init_convert_exulu_tools_to_ai_sdk_tools = __esm({
3893
3891
  if (!s3Client2) {
3894
3892
  throw new Error("S3 client not initialized");
3895
3893
  }
3896
- const response2 = await s3Client2.send(command);
3897
- console.log(response2);
3898
- return response2;
3894
+ await s3Client2.send(command);
3895
+ const bucket = exuluConfig?.fileUploads?.s3Bucket ?? "";
3896
+ const presignedUrl = await getPresignedUrl(bucket, key, exuluConfig);
3897
+ return { url: presignedUrl, key: `${bucket}/${key}` };
3899
3898
  } catch (caught) {
3900
3899
  if (caught instanceof import_client_s32.S3ServiceException && caught.name === "EntityTooLarge") {
3901
3900
  throw new Error(`[EXULU] Error from S3 while uploading object to ${exuluConfig?.fileUploads?.s3Bucket}. The object was too large. To upload objects larger than 5GB, use the S3 console (160GB max) or the multipart upload API (5TB max).`);
@@ -3970,7 +3969,7 @@ var init_convert_exulu_tools_to_ai_sdk_tools = __esm({
3970
3969
  });
3971
3970
 
3972
3971
  // src/exulu/tool.ts
3973
- var import_ai2, import_zod5, import_node_crypto3, ExuluTool;
3972
+ var import_ai2, import_zod5, import_node_crypto3, PUBLIC_TOOL_TYPES, ExuluTool;
3974
3973
  var init_tool = __esm({
3975
3974
  "src/exulu/tool.ts"() {
3976
3975
  "use strict";
@@ -3982,7 +3981,8 @@ var init_tool = __esm({
3982
3981
  import_node_crypto3 = require("crypto");
3983
3982
  init_singleton();
3984
3983
  init_resolve_model();
3985
- ExuluTool = class {
3984
+ PUBLIC_TOOL_TYPES = ["function", "web_search", "skill"];
3985
+ ExuluTool = class _ExuluTool {
3986
3986
  // Must begin with a letter (a-z) or underscore (_). Subsequent characters in a name can be letters, digits (0-9), or
3987
3987
  // underscores and be a max length of 80 characters and at least 5 characters long.
3988
3988
  // The ID is used for storing references to tools so it is important it does not change.
@@ -4006,6 +4006,13 @@ var init_tool = __esm({
4006
4006
  config,
4007
4007
  needsApproval
4008
4008
  }) {
4009
+ if (!PUBLIC_TOOL_TYPES.includes(type)) {
4010
+ throw new Error(
4011
+ `ExuluTool "${id}": invalid type "${type}". Allowed types are ${PUBLIC_TOOL_TYPES.join(
4012
+ ", "
4013
+ )}. The "agent" and "context" types are managed by Exulu internally and cannot be set on a tool.`
4014
+ );
4015
+ }
4009
4016
  this.id = id;
4010
4017
  this.config = config;
4011
4018
  this.needsApproval = needsApproval ?? true;
@@ -4020,6 +4027,19 @@ var init_tool = __esm({
4020
4027
  execute: execute2
4021
4028
  });
4022
4029
  }
4030
+ /**
4031
+ * Framework-only factory for tools whose `type` is managed by Exulu itself —
4032
+ * "agent" (agent-as-tool instrumentation) and "context" (internal retrieval
4033
+ * tools). NOT part of the public API: package consumers must use
4034
+ * `new ExuluTool(...)`, which only accepts a {@link PublicToolType}. Building
4035
+ * the tool as a "function" and then setting the managed type bypasses the
4036
+ * constructor guard without weakening it for consumers.
4037
+ */
4038
+ static internal(params) {
4039
+ const instance2 = new _ExuluTool({ ...params, type: "function" });
4040
+ instance2.type = params.type;
4041
+ return instance2;
4042
+ }
4023
4043
  execute = async ({
4024
4044
  agent: agentId,
4025
4045
  config,
@@ -8305,7 +8325,7 @@ function createAgenticRetrievalToolV3({
8305
8325
  return void 0;
8306
8326
  }
8307
8327
  const contextNames = contexts.map((c) => c.id).join(", ");
8308
- return new ExuluTool({
8328
+ return ExuluTool.internal({
8309
8329
  id: "agentic_context_search",
8310
8330
  name: "Context Search",
8311
8331
  description: `Intelligent context search with query classification, strategy-based retrieval, and virtual filesystem filtering. Searches: ${contextNames}`,
@@ -14179,7 +14199,7 @@ var init_provider = __esm({
14179
14199
  if (!license["multi-agent-tooling"]) {
14180
14200
  console.warn(`[EXULU] You are not licensed to use multi-agent tooling so cannot export this agent as a tool. Please set your EXULU_ENTERPRISE_LICENSE env variable.`);
14181
14201
  }
14182
- return new ExuluTool({
14202
+ return ExuluTool.internal({
14183
14203
  id: agent.id,
14184
14204
  name: `${agent.name}`,
14185
14205
  type: "agent",
package/dist/index.d.cts CHANGED
@@ -184,13 +184,16 @@ interface Item {
184
184
  [key: string]: any;
185
185
  }
186
186
 
187
+ declare const PUBLIC_TOOL_TYPES: readonly ["function", "web_search", "skill"];
188
+ type PublicToolType = (typeof PUBLIC_TOOL_TYPES)[number];
189
+ type ToolType = PublicToolType | "agent" | "context";
187
190
  declare class ExuluTool {
188
191
  id: string;
189
192
  name: string;
190
193
  description: string;
191
194
  category: string;
192
195
  inputSchema?: z.ZodType;
193
- type: "context" | "function" | "agent" | "web_search" | "skill";
196
+ type: ToolType;
194
197
  tool: Tool;
195
198
  needsApproval: boolean;
196
199
  config: {
@@ -205,7 +208,7 @@ declare class ExuluTool {
205
208
  description: string;
206
209
  category?: string;
207
210
  inputSchema?: z.ZodType;
208
- type: "context" | "function" | "agent" | "web_search" | "skill";
211
+ type: PublicToolType;
209
212
  config: {
210
213
  name: string;
211
214
  description: string;
@@ -223,6 +226,17 @@ declare class ExuluTool {
223
226
  items?: Item[];
224
227
  }>;
225
228
  });
229
+ /**
230
+ * Framework-only factory for tools whose `type` is managed by Exulu itself —
231
+ * "agent" (agent-as-tool instrumentation) and "context" (internal retrieval
232
+ * tools). NOT part of the public API: package consumers must use
233
+ * `new ExuluTool(...)`, which only accepts a {@link PublicToolType}. Building
234
+ * the tool as a "function" and then setting the managed type bypasses the
235
+ * constructor guard without weakening it for consumers.
236
+ */
237
+ static internal(params: Omit<ConstructorParameters<typeof ExuluTool>[0], "type"> & {
238
+ type: ToolType;
239
+ }): ExuluTool;
226
240
  execute: ({ agent: agentId, config, user, inputs, project, items, }: {
227
241
  agent: string;
228
242
  config: ExuluConfig;
package/dist/index.d.ts CHANGED
@@ -184,13 +184,16 @@ interface Item {
184
184
  [key: string]: any;
185
185
  }
186
186
 
187
+ declare const PUBLIC_TOOL_TYPES: readonly ["function", "web_search", "skill"];
188
+ type PublicToolType = (typeof PUBLIC_TOOL_TYPES)[number];
189
+ type ToolType = PublicToolType | "agent" | "context";
187
190
  declare class ExuluTool {
188
191
  id: string;
189
192
  name: string;
190
193
  description: string;
191
194
  category: string;
192
195
  inputSchema?: z.ZodType;
193
- type: "context" | "function" | "agent" | "web_search" | "skill";
196
+ type: ToolType;
194
197
  tool: Tool;
195
198
  needsApproval: boolean;
196
199
  config: {
@@ -205,7 +208,7 @@ declare class ExuluTool {
205
208
  description: string;
206
209
  category?: string;
207
210
  inputSchema?: z.ZodType;
208
- type: "context" | "function" | "agent" | "web_search" | "skill";
211
+ type: PublicToolType;
209
212
  config: {
210
213
  name: string;
211
214
  description: string;
@@ -223,6 +226,17 @@ declare class ExuluTool {
223
226
  items?: Item[];
224
227
  }>;
225
228
  });
229
+ /**
230
+ * Framework-only factory for tools whose `type` is managed by Exulu itself —
231
+ * "agent" (agent-as-tool instrumentation) and "context" (internal retrieval
232
+ * tools). NOT part of the public API: package consumers must use
233
+ * `new ExuluTool(...)`, which only accepts a {@link PublicToolType}. Building
234
+ * the tool as a "function" and then setting the managed type bypasses the
235
+ * constructor guard without weakening it for consumers.
236
+ */
237
+ static internal(params: Omit<ConstructorParameters<typeof ExuluTool>[0], "type"> & {
238
+ type: ToolType;
239
+ }): ExuluTool;
226
240
  execute: ({ agent: agentId, config, user, inputs, project, items, }: {
227
241
  agent: string;
228
242
  config: ExuluConfig;
package/dist/index.js CHANGED
@@ -53,7 +53,7 @@ import {
53
53
  uploadFile,
54
54
  validateHermesAtBoot,
55
55
  withRetry
56
- } from "./chunk-A5AZEDLP.js";
56
+ } from "./chunk-DQR5LQOE.js";
57
57
  import "./chunk-YCE44CMU.js";
58
58
 
59
59
  // src/index.ts
@@ -213,7 +213,7 @@ export function createAgenticRetrievalToolV3({
213
213
 
214
214
  const contextNames = contexts.map((c) => c.id).join(", ");
215
215
 
216
- return new ExuluTool({
216
+ return ExuluTool.internal({
217
217
  id: "agentic_context_search",
218
218
  name: "Context Search",
219
219
  description: `Intelligent context search with query classification, strategy-based retrieval, and virtual filesystem filtering. Searches: ${contextNames}`,
@@ -152,7 +152,7 @@ export function createAgenticRetrievalToolV4({
152
152
 
153
153
  const contextNames = contexts.map((c) => c.id).join(", ");
154
154
 
155
- return new ExuluTool({
155
+ return ExuluTool.internal({
156
156
  id: "agentic_context_search",
157
157
  name: "Context Search",
158
158
  description: `Intelligent context search with query classification, strategy-based retrieval, and virtual filesystem filtering. Searches: ${contextNames}`,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@exulu/backend",
3
3
  "author": "Qventu Bv.",
4
- "version": "1.64.0",
4
+ "version": "1.65.0",
5
5
  "main": "./dist/index.js",
6
6
  "private": false,
7
7
  "publishConfig": {