@flutchai/flutch-sdk 0.1.11 → 0.1.13

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
@@ -3909,6 +3909,9 @@ var GraphServiceTokens = {
3909
3909
  CLIENT: "GRAPH_SERVICE_CLIENT",
3910
3910
  SETTINGS_REPOSITORY: "GRAPH_SERVICE_SETTINGS_REPOSITORY"
3911
3911
  };
3912
+
3913
+ // src/graph/graph.controller.ts
3914
+ init_builder_registry_service();
3912
3915
  exports.GraphController = class GraphController {
3913
3916
  constructor(graphService, builderRegistry) {
3914
3917
  this.graphService = graphService;
@@ -4071,7 +4074,8 @@ __decorateClass([
4071
4074
  exports.GraphController = __decorateClass([
4072
4075
  swagger.ApiTags("Graphs"),
4073
4076
  common.Controller(),
4074
- __decorateParam(0, common.Inject("GRAPH_SERVICE"))
4077
+ __decorateParam(0, common.Inject("GRAPH_SERVICE")),
4078
+ __decorateParam(1, common.Inject(exports.BuilderRegistryService))
4075
4079
  ], exports.GraphController);
4076
4080
 
4077
4081
  // src/graph/graph-manifest.schema.ts
@@ -4667,14 +4671,23 @@ exports.EventProcessor = class EventProcessor {
4667
4671
  if (channel === "text" /* TEXT */) {
4668
4672
  const output = event.data.output;
4669
4673
  if (output?.answer) {
4670
- acc.attachments = output.answer.attachments || [];
4671
- acc.metadata = output.answer.metadata || {};
4674
+ acc.attachments = [
4675
+ ...acc.attachments,
4676
+ ...output.answer.attachments || []
4677
+ ];
4678
+ acc.metadata = { ...acc.metadata, ...output.answer.metadata || {} };
4672
4679
  } else if (output?.generation) {
4673
- acc.attachments = output.generation.attachments || [];
4674
- acc.metadata = output.generation.metadata || {};
4675
- } else if (output) {
4676
- acc.attachments = output.attachments || [];
4677
- acc.metadata = output.metadata || {};
4680
+ acc.attachments = [
4681
+ ...acc.attachments,
4682
+ ...output.generation.attachments || []
4683
+ ];
4684
+ acc.metadata = {
4685
+ ...acc.metadata,
4686
+ ...output.generation.metadata || {}
4687
+ };
4688
+ } else if (output?.attachments || output?.metadata) {
4689
+ acc.attachments = [...acc.attachments, ...output.attachments || []];
4690
+ acc.metadata = { ...acc.metadata, ...output.metadata || {} };
4678
4691
  }
4679
4692
  }
4680
4693
  return;
@@ -4707,17 +4720,22 @@ exports.EventProcessor = class EventProcessor {
4707
4720
  durationMs: Math.max(0, completedAt - startedAt),
4708
4721
  totalEvents: acc.traceEvents.length
4709
4722
  } : null;
4723
+ const textChain = allChains.find((c) => c.channel === "text");
4724
+ const text = textChain ? textChain.steps.filter((step) => step.type === "text").map((step) => step.text || "").join("") : "";
4710
4725
  this.logger.log("\u{1F4CA} [EventProcessor] Final result assembled", {
4711
4726
  totalChains: allChains.length,
4712
4727
  textChains: allChains.filter((c) => c.channel === "text").length,
4713
4728
  processingChains: allChains.filter((c) => c.channel === "processing").length,
4714
- totalSteps: allChains.reduce((sum, c) => sum + c.steps.length, 0)
4729
+ totalSteps: allChains.reduce((sum, c) => sum + c.steps.length, 0),
4730
+ textLength: text.length
4715
4731
  });
4716
4732
  return {
4717
4733
  content: {
4718
4734
  contentChains: allChains.length > 0 ? allChains : void 0,
4719
4735
  attachments: acc.attachments,
4720
- metadata: acc.metadata
4736
+ metadata: acc.metadata,
4737
+ text
4738
+ // Add extracted text for backwards compatibility
4721
4739
  },
4722
4740
  trace
4723
4741
  };
@@ -6452,12 +6470,18 @@ var ModelInitializer = class _ModelInitializer {
6452
6470
  metadataKeys: Object.keys(model.metadata || {}),
6453
6471
  hasModelId: !!model.metadata?.modelId
6454
6472
  });
6455
- this.logger.debug(`[TOOLS CHECK] toolsConfig exists: ${!!config.toolsConfig}, customTools exists: ${!!config.customTools}`);
6473
+ this.logger.debug(
6474
+ `[TOOLS CHECK] toolsConfig exists: ${!!config.toolsConfig}, customTools exists: ${!!config.customTools}`
6475
+ );
6456
6476
  if (config.toolsConfig) {
6457
- this.logger.debug(`[TOOLS CHECK] toolsConfig length: ${config.toolsConfig.length}, content: ${JSON.stringify(config.toolsConfig)}`);
6477
+ this.logger.debug(
6478
+ `[TOOLS CHECK] toolsConfig length: ${config.toolsConfig.length}, content: ${JSON.stringify(config.toolsConfig)}`
6479
+ );
6458
6480
  }
6459
6481
  if (config.toolsConfig || config.customTools) {
6460
- this.logger.debug(`[TOOLS] Calling bindToolsToModel with toolsConfig: ${JSON.stringify(config.toolsConfig)}`);
6482
+ this.logger.debug(
6483
+ `[TOOLS] Calling bindToolsToModel with toolsConfig: ${JSON.stringify(config.toolsConfig)}`
6484
+ );
6461
6485
  const boundModel = await this.bindToolsToModel(
6462
6486
  model,
6463
6487
  config.toolsConfig,
@@ -6483,15 +6507,15 @@ var ModelInitializer = class _ModelInitializer {
6483
6507
  const allTools = [];
6484
6508
  if (toolsConfig && toolsConfig.length > 0) {
6485
6509
  try {
6486
- const enabledToolsConfig = toolsConfig.filter((tc) => tc.enabled !== false);
6510
+ const enabledToolsConfig = toolsConfig.filter(
6511
+ (tc) => tc.enabled !== false
6512
+ );
6487
6513
  if (enabledToolsConfig.length > 0) {
6488
6514
  this.logger.debug(
6489
6515
  `Fetching ${enabledToolsConfig.length} tools with dynamic schemas from MCP Runtime: ${enabledToolsConfig.map((tc) => tc.toolName).join(", ")}`
6490
6516
  );
6491
6517
  const mcpToolFilter = new McpToolFilter();
6492
- const mcpTools = await mcpToolFilter.getFilteredTools(
6493
- enabledToolsConfig
6494
- );
6518
+ const mcpTools = await mcpToolFilter.getFilteredTools(enabledToolsConfig);
6495
6519
  this.logger.debug(
6496
6520
  `Successfully fetched ${mcpTools.length} tools with dynamic schemas from MCP Runtime`
6497
6521
  );