@flutchai/flutch-sdk 0.1.7 → 0.1.8

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
@@ -1162,9 +1162,9 @@ declare class EventProcessor {
1162
1162
 
1163
1163
  declare class LangGraphEngine implements IGraphEngine {
1164
1164
  private readonly eventProcessor;
1165
- private readonly configService;
1165
+ private readonly configService?;
1166
1166
  private readonly logger;
1167
- constructor(eventProcessor: EventProcessor, configService: ConfigService);
1167
+ constructor(eventProcessor: EventProcessor, configService?: ConfigService);
1168
1168
  invokeGraph(graph: any, config: any, signal?: AbortSignal): Promise<any>;
1169
1169
  streamGraph(graph: any, config: any, onPartial: (chunk: string) => void, signal?: AbortSignal): Promise<any>;
1170
1170
  private sendMetricsWebhook;
package/dist/index.d.ts CHANGED
@@ -1162,9 +1162,9 @@ declare class EventProcessor {
1162
1162
 
1163
1163
  declare class LangGraphEngine implements IGraphEngine {
1164
1164
  private readonly eventProcessor;
1165
- private readonly configService;
1165
+ private readonly configService?;
1166
1166
  private readonly logger;
1167
- constructor(eventProcessor: EventProcessor, configService: ConfigService);
1167
+ constructor(eventProcessor: EventProcessor, configService?: ConfigService);
1168
1168
  invokeGraph(graph: any, config: any, signal?: AbortSignal): Promise<any>;
1169
1169
  streamGraph(graph: any, config: any, onPartial: (chunk: string) => void, signal?: AbortSignal): Promise<any>;
1170
1170
  private sendMetricsWebhook;
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import 'reflect-metadata';
2
- import { Injectable, Post, UseGuards, Req, Controller, Inject, Get, Body, Res, Param, Logger, Module, UnauthorizedException, Optional, Headers, NotFoundException, InternalServerErrorException, ForbiddenException, ValidationPipe, HttpException, HttpStatus } from '@nestjs/common';
2
+ import { Injectable, Post, UseGuards, Req, Controller, Inject, Get, Body, Res, Param, Logger, Optional, Module, UnauthorizedException, Headers, NotFoundException, InternalServerErrorException, ForbiddenException, ValidationPipe, HttpException, HttpStatus } from '@nestjs/common';
3
3
  import { ApiOperation, ApiResponse, ApiTags, ApiParam, DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
4
4
  import * as fs from 'fs';
5
5
  import * as path2 from 'path';
@@ -3047,9 +3047,6 @@ var _AbstractGraphBuilder = class _AbstractGraphBuilder {
3047
3047
  if (this.manifest?.companySlug && this.manifest?.name) {
3048
3048
  return `${this.manifest.companySlug}.${this.manifest.name}::${this.version}`;
3049
3049
  }
3050
- console.log(
3051
- `DEBUG graphType: manifest=${!!this.manifest}, companySlug=${this.manifest?.companySlug}, name=${this.manifest?.name}, version=${this.version}`
3052
- );
3053
3050
  return `unknown::${this.version}`;
3054
3051
  }
3055
3052
  /**
@@ -3381,6 +3378,9 @@ var UniversalGraphService = class {
3381
3378
  this.engine = engine;
3382
3379
  this.endpointRegistry = endpointRegistry;
3383
3380
  this.logger.log("UniversalGraphService initialized");
3381
+ if (!this.engine) {
3382
+ this.logger.error("GRAPH_ENGINE is not properly injected!");
3383
+ }
3384
3384
  }
3385
3385
  logger = new Logger(UniversalGraphService.name);
3386
3386
  /**
@@ -4376,11 +4376,11 @@ function sanitizeTraceError(error, options) {
4376
4376
  raw: sanitizeTraceData(error, 0, /* @__PURE__ */ new WeakSet(), options)
4377
4377
  };
4378
4378
  }
4379
- var GraphEngineType = /* @__PURE__ */ ((GraphEngineType2) => {
4380
- GraphEngineType2["LANGGRAPH"] = "langgraph";
4381
- GraphEngineType2["LANGFLOW"] = "langflow";
4382
- GraphEngineType2["FLOWISE"] = "flowise";
4383
- return GraphEngineType2;
4379
+ var GraphEngineType = /* @__PURE__ */ ((GraphEngineType3) => {
4380
+ GraphEngineType3["LANGGRAPH"] = "langgraph";
4381
+ GraphEngineType3["LANGFLOW"] = "langflow";
4382
+ GraphEngineType3["FLOWISE"] = "flowise";
4383
+ return GraphEngineType3;
4384
4384
  })(GraphEngineType || {});
4385
4385
  var GraphEngineFactory = class {
4386
4386
  constructor(langgraph) {
@@ -4826,6 +4826,9 @@ var LangGraphEngine = class {
4826
4826
  constructor(eventProcessor, configService) {
4827
4827
  this.eventProcessor = eventProcessor;
4828
4828
  this.configService = configService;
4829
+ if (!eventProcessor) {
4830
+ this.logger.error("EventProcessor is undefined/null!");
4831
+ }
4829
4832
  }
4830
4833
  logger = new Logger(LangGraphEngine.name);
4831
4834
  /**
@@ -4928,8 +4931,8 @@ var LangGraphEngine = class {
4928
4931
  */
4929
4932
  async sendMetricsWebhook(payload) {
4930
4933
  try {
4931
- const backendUrl = this.configService.get("API_URL") || "http://amelie-service";
4932
- const internalToken = this.configService.get("INTERNAL_API_TOKEN");
4934
+ const backendUrl = this.configService?.get("API_URL") || "http://amelie-service";
4935
+ const internalToken = this.configService?.get("INTERNAL_API_TOKEN");
4933
4936
  if (!internalToken) {
4934
4937
  this.logger.warn(
4935
4938
  "[METRICS-WEBHOOK] INTERNAL_API_TOKEN not configured, skipping webhook"
@@ -4968,8 +4971,8 @@ var LangGraphEngine = class {
4968
4971
  }
4969
4972
  async sendTraceEventsBatch(payload) {
4970
4973
  try {
4971
- const backendUrl = this.configService.get("API_URL") || "http://amelie-service";
4972
- const internalToken = this.configService.get("INTERNAL_API_TOKEN");
4974
+ const backendUrl = this.configService?.get("API_URL") || "http://amelie-service";
4975
+ const internalToken = this.configService?.get("INTERNAL_API_TOKEN");
4973
4976
  if (!internalToken) {
4974
4977
  this.logger.warn(
4975
4978
  "[TRACE-EVENTS-BATCH] INTERNAL_API_TOKEN not configured, skipping batch webhook"
@@ -5051,7 +5054,8 @@ var LangGraphEngine = class {
5051
5054
  }
5052
5055
  };
5053
5056
  LangGraphEngine = __decorateClass([
5054
- Injectable()
5057
+ Injectable(),
5058
+ __decorateParam(1, Optional())
5055
5059
  ], LangGraphEngine);
5056
5060
 
5057
5061
  // src/core/universal-graph.module.ts
@@ -5127,9 +5131,16 @@ var UniversalGraphModule = class {
5127
5131
  // Discovery services from @nestjs/core
5128
5132
  MetadataScanner,
5129
5133
  // Event processor for stream handling
5130
- EventProcessor,
5134
+ {
5135
+ provide: EventProcessor,
5136
+ useFactory: () => new EventProcessor()
5137
+ },
5131
5138
  // Graph engines
5132
- LangGraphEngine,
5139
+ {
5140
+ provide: LangGraphEngine,
5141
+ useFactory: (eventProcessor) => new LangGraphEngine(eventProcessor, void 0),
5142
+ inject: [EventProcessor]
5143
+ },
5133
5144
  BuilderRegistryService,
5134
5145
  GraphEngineFactory,
5135
5146
  VersionedGraphService,
@@ -5235,12 +5246,8 @@ var UniversalGraphModule = class {
5235
5246
  },
5236
5247
  {
5237
5248
  provide: "GRAPH_ENGINE",
5238
- useFactory: (factory) => {
5239
- return factory.getEngine(
5240
- options.engineType || "langgraph" /* LANGGRAPH */
5241
- );
5242
- },
5243
- inject: [GraphEngineFactory]
5249
+ useFactory: (langGraphEngine) => langGraphEngine,
5250
+ inject: [LangGraphEngine]
5244
5251
  },
5245
5252
  {
5246
5253
  provide: "GRAPH_BUILDERS",