@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.d.cts CHANGED
@@ -1635,6 +1635,7 @@ declare class UniversalGraphService implements IGraphService {
1635
1635
  declare function bootstrap(AppModule: any, options?: {
1636
1636
  port?: number;
1637
1637
  globalPrefix?: string;
1638
+ bodyLimit?: string;
1638
1639
  }): Promise<_nestjs_common.INestApplication<any>>;
1639
1640
 
1640
1641
  interface ApiCallTracerOptions {
package/dist/index.d.ts CHANGED
@@ -1635,6 +1635,7 @@ declare class UniversalGraphService implements IGraphService {
1635
1635
  declare function bootstrap(AppModule: any, options?: {
1636
1636
  port?: number;
1637
1637
  globalPrefix?: string;
1638
+ bodyLimit?: string;
1638
1639
  }): Promise<_nestjs_common.INestApplication<any>>;
1639
1640
 
1640
1641
  interface ApiCallTracerOptions {
package/dist/index.js CHANGED
@@ -6,10 +6,10 @@ import * as fs from 'fs';
6
6
  import * as path2 from 'path';
7
7
  import * as os from 'os';
8
8
  import { ConfigService, ConfigModule } from '@nestjs/config';
9
+ import { Response, json, urlencoded } from 'express';
9
10
  import * as net from 'net';
10
11
  import mongoose from 'mongoose';
11
12
  import { MongoDBSaver } from '@langchain/langgraph-checkpoint-mongodb';
12
- import { Response } from 'express';
13
13
  import * as crypto from 'crypto';
14
14
  import { randomUUID, createHash, randomBytes } from 'crypto';
15
15
  import { Registry, collectDefaultMetrics, Counter, Histogram, Gauge } from 'prom-client';
@@ -1960,6 +1960,14 @@ async function bootstrap(AppModule, options = {}) {
1960
1960
  setupRedisMock();
1961
1961
  const app = await NestFactory.create(AppModule);
1962
1962
  const logger3 = new Logger("Bootstrap");
1963
+ const bodyLimit = options.bodyLimit || process.env.GRAPH_BODY_LIMIT || "10mb";
1964
+ app.use(json({
1965
+ limit: bodyLimit
1966
+ }));
1967
+ app.use(urlencoded({
1968
+ limit: bodyLimit,
1969
+ extended: true
1970
+ }));
1963
1971
  const requestedPort = options.port || parseInt(process.env.PORT || "3100", 10);
1964
1972
  const port = await findAvailablePort(requestedPort);
1965
1973
  const globalPrefix = options.globalPrefix;
@@ -6814,6 +6822,7 @@ ${paramDescriptions.join("\n")}`;
6814
6822
  }
6815
6823
  }
6816
6824
  };
6825
+ var MCP_RUNTIME_TIMEOUT_MS = Number(process.env.MCP_RUNTIME_TIMEOUT_MS) || 2e4;
6817
6826
  var McpToolFilter = class _McpToolFilter {
6818
6827
  static {
6819
6828
  __name(this, "McpToolFilter");
@@ -6847,7 +6856,7 @@ var McpToolFilter = class _McpToolFilter {
6847
6856
  if (context) requestBody.context = context;
6848
6857
  this.logger.debug(`[DEBUG] Request body: ${JSON.stringify(requestBody)}`);
6849
6858
  const response = await axios2.post(`${this.mcpRuntimeUrl}/tools/schemas`, requestBody, {
6850
- timeout: 5e3,
6859
+ timeout: MCP_RUNTIME_TIMEOUT_MS,
6851
6860
  headers: {
6852
6861
  "Content-Type": "application/json"
6853
6862
  }
@@ -6890,7 +6899,7 @@ var McpToolFilter = class _McpToolFilter {
6890
6899
  async getAllTools() {
6891
6900
  try {
6892
6901
  const response = await axios2.get(`${this.mcpRuntimeUrl}/tools/list`, {
6893
- timeout: 5e3
6902
+ timeout: MCP_RUNTIME_TIMEOUT_MS
6894
6903
  });
6895
6904
  const allTools = Array.isArray(response.data) ? response.data : [];
6896
6905
  this.logger.debug(`Retrieved ${allTools.length} total MCP tools`);
@@ -6937,7 +6946,7 @@ var McpToolFilter = class _McpToolFilter {
6937
6946
  async getAvailableToolNames() {
6938
6947
  try {
6939
6948
  const response = await axios2.get(`${this.mcpRuntimeUrl}/tools/list`, {
6940
- timeout: 5e3
6949
+ timeout: MCP_RUNTIME_TIMEOUT_MS
6941
6950
  });
6942
6951
  const tools = Array.isArray(response.data) ? response.data : [];
6943
6952
  return tools.map((tool) => tool.name);
@@ -7121,8 +7130,8 @@ function toolSearchTerms(text) {
7121
7130
  }
7122
7131
  __name(toolSearchTerms, "toolSearchTerms");
7123
7132
  function schemaParams(schema) {
7124
- const json = schema;
7125
- const properties = json?.properties ?? json?.shape ?? {};
7133
+ const json2 = schema;
7134
+ const properties = json2?.properties ?? json2?.shape ?? {};
7126
7135
  return Object.entries(properties).flatMap(([name, property]) => property?.description ? [
7127
7136
  name,
7128
7137
  property.description
@@ -8837,8 +8846,8 @@ var IV_LENGTH = 16;
8837
8846
  function encryptTokens(tokens, key) {
8838
8847
  const iv = crypto.randomBytes(IV_LENGTH);
8839
8848
  const cipher = crypto.createCipheriv(ALGORITHM, Buffer.from(key), iv);
8840
- const json = JSON.stringify(tokens);
8841
- let encrypted = cipher.update(json, "utf8", "hex");
8849
+ const json2 = JSON.stringify(tokens);
8850
+ let encrypted = cipher.update(json2, "utf8", "hex");
8842
8851
  encrypted += cipher.final("hex");
8843
8852
  return iv.toString("hex") + ":" + encrypted;
8844
8853
  }