@flutchai/flutch-sdk 0.1.19 → 0.1.20
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 +22 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +23 -11
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -3,7 +3,7 @@ import * as _nestjs_common from '@nestjs/common';
|
|
|
3
3
|
import { OnModuleInit, Logger, Type, CanActivate, ExecutionContext, DynamicModule } from '@nestjs/common';
|
|
4
4
|
import { ConfigService } from '@nestjs/config';
|
|
5
5
|
import { HumanMessage, AIMessageChunk } from '@langchain/core/messages';
|
|
6
|
-
import {
|
|
6
|
+
import { CompiledStateGraph, LangGraphRunnableConfig, BaseChannel } from '@langchain/langgraph';
|
|
7
7
|
import Redis from 'ioredis';
|
|
8
8
|
import { Registry } from 'prom-client';
|
|
9
9
|
import { Response, Request } from 'express';
|
|
@@ -1389,6 +1389,7 @@ interface IToolExecutionContext {
|
|
|
1389
1389
|
credentials: Record<string, string>;
|
|
1390
1390
|
agentId: string;
|
|
1391
1391
|
userId: string;
|
|
1392
|
+
threadId?: string;
|
|
1392
1393
|
}
|
|
1393
1394
|
|
|
1394
1395
|
interface McpTool {
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import * as _nestjs_common from '@nestjs/common';
|
|
|
3
3
|
import { OnModuleInit, Logger, Type, CanActivate, ExecutionContext, DynamicModule } from '@nestjs/common';
|
|
4
4
|
import { ConfigService } from '@nestjs/config';
|
|
5
5
|
import { HumanMessage, AIMessageChunk } from '@langchain/core/messages';
|
|
6
|
-
import {
|
|
6
|
+
import { CompiledStateGraph, LangGraphRunnableConfig, BaseChannel } from '@langchain/langgraph';
|
|
7
7
|
import Redis from 'ioredis';
|
|
8
8
|
import { Registry } from 'prom-client';
|
|
9
9
|
import { Response, Request } from 'express';
|
|
@@ -1389,6 +1389,7 @@ interface IToolExecutionContext {
|
|
|
1389
1389
|
credentials: Record<string, string>;
|
|
1390
1390
|
agentId: string;
|
|
1391
1391
|
userId: string;
|
|
1392
|
+
threadId?: string;
|
|
1392
1393
|
}
|
|
1393
1394
|
|
|
1394
1395
|
interface McpTool {
|
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, Optional, Module, UnauthorizedException,
|
|
2
|
+
import { Injectable, Post, UseGuards, Req, Controller, Inject, Get, Body, Res, Param, Logger, Optional, Module, UnauthorizedException, ForbiddenException, ValidationPipe, HttpException, HttpStatus, NotFoundException, InternalServerErrorException, Headers } 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';
|
|
@@ -148,8 +148,8 @@ function findCallbackMethod(target, handler) {
|
|
|
148
148
|
var CALLBACK_METADATA_KEY, CALLBACK_CLASS_METADATA_KEY;
|
|
149
149
|
var init_callback_decorators = __esm({
|
|
150
150
|
"src/callbacks/callback.decorators.ts"() {
|
|
151
|
-
CALLBACK_METADATA_KEY = Symbol("callbacks");
|
|
152
|
-
CALLBACK_CLASS_METADATA_KEY = Symbol("callback_class");
|
|
151
|
+
CALLBACK_METADATA_KEY = /* @__PURE__ */ Symbol("callbacks");
|
|
152
|
+
CALLBACK_CLASS_METADATA_KEY = /* @__PURE__ */ Symbol("callback_class");
|
|
153
153
|
}
|
|
154
154
|
});
|
|
155
155
|
var EndpointRegistry;
|
|
@@ -421,8 +421,8 @@ var ENDPOINT_METADATA_KEY, UI_ENDPOINT_CLASS_METADATA_KEY, UI_ENDPOINT_METHOD_ME
|
|
|
421
421
|
var init_endpoint_decorators = __esm({
|
|
422
422
|
"src/agent-ui/endpoint.decorators.ts"() {
|
|
423
423
|
ENDPOINT_METADATA_KEY = "graph:endpoints";
|
|
424
|
-
UI_ENDPOINT_CLASS_METADATA_KEY = Symbol("ui_endpoint_class");
|
|
425
|
-
UI_ENDPOINT_METHOD_METADATA_KEY = Symbol("ui_endpoint_methods");
|
|
424
|
+
UI_ENDPOINT_CLASS_METADATA_KEY = /* @__PURE__ */ Symbol("ui_endpoint_class");
|
|
425
|
+
UI_ENDPOINT_METHOD_METADATA_KEY = /* @__PURE__ */ Symbol("ui_endpoint_methods");
|
|
426
426
|
}
|
|
427
427
|
});
|
|
428
428
|
var UIEndpointsDiscoveryService;
|
|
@@ -5484,12 +5484,22 @@ ${paramDescriptions.join("\n")}`;
|
|
|
5484
5484
|
name: mcpTool.name,
|
|
5485
5485
|
description: enhancedDescription,
|
|
5486
5486
|
schema,
|
|
5487
|
-
func: async (input) => {
|
|
5487
|
+
func: async (input, _runManager, config) => {
|
|
5488
5488
|
logger2.log(`\u{1F527} [${mcpTool.name}] LLM INPUT: ${JSON.stringify(input)}`);
|
|
5489
|
+
const configurable = config?.configurable;
|
|
5490
|
+
const context = {
|
|
5491
|
+
agentId: configurable?.agentId,
|
|
5492
|
+
userId: configurable?.userId,
|
|
5493
|
+
threadId: configurable?.thread_id
|
|
5494
|
+
};
|
|
5495
|
+
logger2.debug(
|
|
5496
|
+
`\u{1F527} [${mcpTool.name}] Execution context: ${JSON.stringify(context)}`
|
|
5497
|
+
);
|
|
5489
5498
|
try {
|
|
5490
5499
|
const request = {
|
|
5491
5500
|
name: mcpTool.name,
|
|
5492
|
-
arguments: input ?? {}
|
|
5501
|
+
arguments: input ?? {},
|
|
5502
|
+
context
|
|
5493
5503
|
};
|
|
5494
5504
|
logger2.log(`\u{1F527} [${mcpTool.name}] Calling MCP Runtime...`);
|
|
5495
5505
|
const response = await axios2.post(
|
|
@@ -5610,13 +5620,14 @@ var McpToolFilter = class _McpToolFilter {
|
|
|
5610
5620
|
);
|
|
5611
5621
|
const mcpClient = {
|
|
5612
5622
|
getTools: async () => dynamicTools,
|
|
5613
|
-
executeTool: async (name, args) => {
|
|
5623
|
+
executeTool: async (name, args, context) => {
|
|
5614
5624
|
this.logger.debug(`[DEBUG] Executing tool ${name} with args:`, args);
|
|
5615
5625
|
const response2 = await axios2.post(
|
|
5616
5626
|
`${this.mcpRuntimeUrl}/tools/execute`,
|
|
5617
5627
|
{
|
|
5618
5628
|
name,
|
|
5619
|
-
arguments: args || {}
|
|
5629
|
+
arguments: args || {},
|
|
5630
|
+
context
|
|
5620
5631
|
}
|
|
5621
5632
|
);
|
|
5622
5633
|
return response2.data;
|
|
@@ -5659,12 +5670,13 @@ var McpToolFilter = class _McpToolFilter {
|
|
|
5659
5670
|
this.logger.debug(`Retrieved ${allTools.length} total MCP tools`);
|
|
5660
5671
|
const mcpClient = {
|
|
5661
5672
|
getTools: async () => allTools,
|
|
5662
|
-
executeTool: async (name, args) => {
|
|
5673
|
+
executeTool: async (name, args, context) => {
|
|
5663
5674
|
const response2 = await axios2.post(
|
|
5664
5675
|
`${this.mcpRuntimeUrl}/tools/execute`,
|
|
5665
5676
|
{
|
|
5666
5677
|
name,
|
|
5667
|
-
arguments: args || {}
|
|
5678
|
+
arguments: args || {},
|
|
5679
|
+
context
|
|
5668
5680
|
}
|
|
5669
5681
|
);
|
|
5670
5682
|
return response2.data;
|