@flutchai/flutch-sdk 0.1.18 → 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 +32 -12
- 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 +33 -13
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -177,8 +177,8 @@ function findCallbackMethod(target, handler) {
|
|
|
177
177
|
var CALLBACK_METADATA_KEY, CALLBACK_CLASS_METADATA_KEY;
|
|
178
178
|
var init_callback_decorators = __esm({
|
|
179
179
|
"src/callbacks/callback.decorators.ts"() {
|
|
180
|
-
CALLBACK_METADATA_KEY = Symbol("callbacks");
|
|
181
|
-
CALLBACK_CLASS_METADATA_KEY = Symbol("callback_class");
|
|
180
|
+
CALLBACK_METADATA_KEY = /* @__PURE__ */ Symbol("callbacks");
|
|
181
|
+
CALLBACK_CLASS_METADATA_KEY = /* @__PURE__ */ Symbol("callback_class");
|
|
182
182
|
}
|
|
183
183
|
});
|
|
184
184
|
exports.EndpointRegistry = void 0;
|
|
@@ -450,8 +450,8 @@ exports.ENDPOINT_METADATA_KEY = void 0; var UI_ENDPOINT_CLASS_METADATA_KEY, UI_E
|
|
|
450
450
|
var init_endpoint_decorators = __esm({
|
|
451
451
|
"src/agent-ui/endpoint.decorators.ts"() {
|
|
452
452
|
exports.ENDPOINT_METADATA_KEY = "graph:endpoints";
|
|
453
|
-
UI_ENDPOINT_CLASS_METADATA_KEY = Symbol("ui_endpoint_class");
|
|
454
|
-
UI_ENDPOINT_METHOD_METADATA_KEY = Symbol("ui_endpoint_methods");
|
|
453
|
+
UI_ENDPOINT_CLASS_METADATA_KEY = /* @__PURE__ */ Symbol("ui_endpoint_class");
|
|
454
|
+
UI_ENDPOINT_METHOD_METADATA_KEY = /* @__PURE__ */ Symbol("ui_endpoint_methods");
|
|
455
455
|
}
|
|
456
456
|
});
|
|
457
457
|
exports.UIEndpointsDiscoveryService = void 0;
|
|
@@ -4812,6 +4812,7 @@ exports.EventProcessor = class EventProcessor {
|
|
|
4812
4812
|
exports.EventProcessor = __decorateClass([
|
|
4813
4813
|
common.Injectable()
|
|
4814
4814
|
], exports.EventProcessor);
|
|
4815
|
+
var DEFAULT_RECURSION_LIMIT = 40;
|
|
4815
4816
|
process.setMaxListeners(0);
|
|
4816
4817
|
exports.LangGraphEngine = class LangGraphEngine {
|
|
4817
4818
|
constructor(eventProcessor, configService) {
|
|
@@ -4829,7 +4830,11 @@ exports.LangGraphEngine = class LangGraphEngine {
|
|
|
4829
4830
|
if (signal) {
|
|
4830
4831
|
config.signal = signal;
|
|
4831
4832
|
}
|
|
4832
|
-
const
|
|
4833
|
+
const recursionLimit = config.recursionLimit ?? DEFAULT_RECURSION_LIMIT;
|
|
4834
|
+
const result = await graph.invoke(config.input || {}, {
|
|
4835
|
+
...config,
|
|
4836
|
+
recursionLimit
|
|
4837
|
+
});
|
|
4833
4838
|
return this.processGraphResult(result);
|
|
4834
4839
|
}
|
|
4835
4840
|
async streamGraph(graph, config, onPartial, signal) {
|
|
@@ -4839,10 +4844,13 @@ exports.LangGraphEngine = class LangGraphEngine {
|
|
|
4839
4844
|
if (signal) {
|
|
4840
4845
|
config.signal = signal;
|
|
4841
4846
|
}
|
|
4847
|
+
const recursionLimit = config.recursionLimit ?? DEFAULT_RECURSION_LIMIT;
|
|
4842
4848
|
const eventStream = await graph.streamEvents(config.input || {}, {
|
|
4843
4849
|
...config,
|
|
4844
|
-
version: "v2"
|
|
4850
|
+
version: "v2",
|
|
4845
4851
|
// Important for correct operation
|
|
4852
|
+
recursionLimit
|
|
4853
|
+
// Prevent GraphRecursionError (default is 25)
|
|
4846
4854
|
});
|
|
4847
4855
|
for await (const event of eventStream) {
|
|
4848
4856
|
try {
|
|
@@ -5505,12 +5513,22 @@ ${paramDescriptions.join("\n")}`;
|
|
|
5505
5513
|
name: mcpTool.name,
|
|
5506
5514
|
description: enhancedDescription,
|
|
5507
5515
|
schema,
|
|
5508
|
-
func: async (input) => {
|
|
5516
|
+
func: async (input, _runManager, config) => {
|
|
5509
5517
|
logger2.log(`\u{1F527} [${mcpTool.name}] LLM INPUT: ${JSON.stringify(input)}`);
|
|
5518
|
+
const configurable = config?.configurable;
|
|
5519
|
+
const context = {
|
|
5520
|
+
agentId: configurable?.agentId,
|
|
5521
|
+
userId: configurable?.userId,
|
|
5522
|
+
threadId: configurable?.thread_id
|
|
5523
|
+
};
|
|
5524
|
+
logger2.debug(
|
|
5525
|
+
`\u{1F527} [${mcpTool.name}] Execution context: ${JSON.stringify(context)}`
|
|
5526
|
+
);
|
|
5510
5527
|
try {
|
|
5511
5528
|
const request = {
|
|
5512
5529
|
name: mcpTool.name,
|
|
5513
|
-
arguments: input ?? {}
|
|
5530
|
+
arguments: input ?? {},
|
|
5531
|
+
context
|
|
5514
5532
|
};
|
|
5515
5533
|
logger2.log(`\u{1F527} [${mcpTool.name}] Calling MCP Runtime...`);
|
|
5516
5534
|
const response = await axios2__default.default.post(
|
|
@@ -5631,13 +5649,14 @@ var McpToolFilter = class _McpToolFilter {
|
|
|
5631
5649
|
);
|
|
5632
5650
|
const mcpClient = {
|
|
5633
5651
|
getTools: async () => dynamicTools,
|
|
5634
|
-
executeTool: async (name, args) => {
|
|
5652
|
+
executeTool: async (name, args, context) => {
|
|
5635
5653
|
this.logger.debug(`[DEBUG] Executing tool ${name} with args:`, args);
|
|
5636
5654
|
const response2 = await axios2__default.default.post(
|
|
5637
5655
|
`${this.mcpRuntimeUrl}/tools/execute`,
|
|
5638
5656
|
{
|
|
5639
5657
|
name,
|
|
5640
|
-
arguments: args || {}
|
|
5658
|
+
arguments: args || {},
|
|
5659
|
+
context
|
|
5641
5660
|
}
|
|
5642
5661
|
);
|
|
5643
5662
|
return response2.data;
|
|
@@ -5680,12 +5699,13 @@ var McpToolFilter = class _McpToolFilter {
|
|
|
5680
5699
|
this.logger.debug(`Retrieved ${allTools.length} total MCP tools`);
|
|
5681
5700
|
const mcpClient = {
|
|
5682
5701
|
getTools: async () => allTools,
|
|
5683
|
-
executeTool: async (name, args) => {
|
|
5702
|
+
executeTool: async (name, args, context) => {
|
|
5684
5703
|
const response2 = await axios2__default.default.post(
|
|
5685
5704
|
`${this.mcpRuntimeUrl}/tools/execute`,
|
|
5686
5705
|
{
|
|
5687
5706
|
name,
|
|
5688
|
-
arguments: args || {}
|
|
5707
|
+
arguments: args || {},
|
|
5708
|
+
context
|
|
5689
5709
|
}
|
|
5690
5710
|
);
|
|
5691
5711
|
return response2.data;
|