@flutchai/flutch-sdk 0.7.5 → 0.7.7

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 CHANGED
@@ -8,10 +8,10 @@ var fs = require('fs');
8
8
  var path2 = require('path');
9
9
  var os = require('os');
10
10
  var config = require('@nestjs/config');
11
+ var express = require('express');
11
12
  var net = require('net');
12
13
  var mongoose = require('mongoose');
13
14
  var langgraphCheckpointMongodb = require('@langchain/langgraph-checkpoint-mongodb');
14
- var express = require('express');
15
15
  var crypto = require('crypto');
16
16
  var promClient = require('prom-client');
17
17
  var messages = require('@langchain/core/messages');
@@ -1990,6 +1990,14 @@ async function bootstrap(AppModule, options = {}) {
1990
1990
  setupRedisMock();
1991
1991
  const app = await core.NestFactory.create(AppModule);
1992
1992
  const logger3 = new common.Logger("Bootstrap");
1993
+ const bodyLimit = options.bodyLimit || process.env.GRAPH_BODY_LIMIT || "10mb";
1994
+ app.use(express.json({
1995
+ limit: bodyLimit
1996
+ }));
1997
+ app.use(express.urlencoded({
1998
+ limit: bodyLimit,
1999
+ extended: true
2000
+ }));
1993
2001
  const requestedPort = options.port || parseInt(process.env.PORT || "3100", 10);
1994
2002
  const port = await findAvailablePort(requestedPort);
1995
2003
  const globalPrefix = options.globalPrefix;
@@ -6844,6 +6852,7 @@ ${paramDescriptions.join("\n")}`;
6844
6852
  }
6845
6853
  }
6846
6854
  };
6855
+ var MCP_RUNTIME_TIMEOUT_MS = Number(process.env.MCP_RUNTIME_TIMEOUT_MS) || 2e4;
6847
6856
  var McpToolFilter = class _McpToolFilter {
6848
6857
  static {
6849
6858
  __name(this, "McpToolFilter");
@@ -6877,7 +6886,7 @@ var McpToolFilter = class _McpToolFilter {
6877
6886
  if (context) requestBody.context = context;
6878
6887
  this.logger.debug(`[DEBUG] Request body: ${JSON.stringify(requestBody)}`);
6879
6888
  const response = await axios2__default.default.post(`${this.mcpRuntimeUrl}/tools/schemas`, requestBody, {
6880
- timeout: 5e3,
6889
+ timeout: MCP_RUNTIME_TIMEOUT_MS,
6881
6890
  headers: {
6882
6891
  "Content-Type": "application/json"
6883
6892
  }
@@ -6920,7 +6929,7 @@ var McpToolFilter = class _McpToolFilter {
6920
6929
  async getAllTools() {
6921
6930
  try {
6922
6931
  const response = await axios2__default.default.get(`${this.mcpRuntimeUrl}/tools/list`, {
6923
- timeout: 5e3
6932
+ timeout: MCP_RUNTIME_TIMEOUT_MS
6924
6933
  });
6925
6934
  const allTools = Array.isArray(response.data) ? response.data : [];
6926
6935
  this.logger.debug(`Retrieved ${allTools.length} total MCP tools`);
@@ -6967,7 +6976,7 @@ var McpToolFilter = class _McpToolFilter {
6967
6976
  async getAvailableToolNames() {
6968
6977
  try {
6969
6978
  const response = await axios2__default.default.get(`${this.mcpRuntimeUrl}/tools/list`, {
6970
- timeout: 5e3
6979
+ timeout: MCP_RUNTIME_TIMEOUT_MS
6971
6980
  });
6972
6981
  const tools = Array.isArray(response.data) ? response.data : [];
6973
6982
  return tools.map((tool) => tool.name);
@@ -7151,8 +7160,8 @@ function toolSearchTerms(text) {
7151
7160
  }
7152
7161
  __name(toolSearchTerms, "toolSearchTerms");
7153
7162
  function schemaParams(schema) {
7154
- const json = schema;
7155
- const properties = json?.properties ?? json?.shape ?? {};
7163
+ const json2 = schema;
7164
+ const properties = json2?.properties ?? json2?.shape ?? {};
7156
7165
  return Object.entries(properties).flatMap(([name, property]) => property?.description ? [
7157
7166
  name,
7158
7167
  property.description
@@ -8867,8 +8876,8 @@ var IV_LENGTH = 16;
8867
8876
  function encryptTokens(tokens, key) {
8868
8877
  const iv = crypto__namespace.randomBytes(IV_LENGTH);
8869
8878
  const cipher = crypto__namespace.createCipheriv(ALGORITHM, Buffer.from(key), iv);
8870
- const json = JSON.stringify(tokens);
8871
- let encrypted = cipher.update(json, "utf8", "hex");
8879
+ const json2 = JSON.stringify(tokens);
8880
+ let encrypted = cipher.update(json2, "utf8", "hex");
8872
8881
  encrypted += cipher.final("hex");
8873
8882
  return iv.toString("hex") + ":" + encrypted;
8874
8883
  }