@saber2pr/ai-agent 0.0.62 → 0.0.64
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/lib/core/agent-graph.d.ts +1 -1
- package/lib/core/agent-graph.js +12 -8
- package/package.json +4 -3
|
@@ -71,7 +71,7 @@ export default class McpGraphAgent<T extends AgentGraphModel = any> {
|
|
|
71
71
|
messages: import("@langchain/langgraph").BinaryOperatorAggregate<BaseMessage[], BaseMessage[]>;
|
|
72
72
|
tokenUsage: import("@langchain/langgraph").BinaryOperatorAggregate<TokenUsage, TokenUsage>;
|
|
73
73
|
totalDuration: import("@langchain/langgraph").BinaryOperatorAggregate<number, number>;
|
|
74
|
-
}>, "tools" | "__start__" | "agent", {
|
|
74
|
+
}>, "tools" | "__start__" | "agent" | "interrupt", {
|
|
75
75
|
messages: import("@langchain/langgraph").BinaryOperatorAggregate<BaseMessage[], BaseMessage[]>;
|
|
76
76
|
tokenUsage: import("@langchain/langgraph").BinaryOperatorAggregate<TokenUsage, TokenUsage>;
|
|
77
77
|
totalDuration: import("@langchain/langgraph").BinaryOperatorAggregate<number, number>;
|
package/lib/core/agent-graph.js
CHANGED
|
@@ -602,6 +602,17 @@ ${(0, getSystemPromptTemplate_1.getSystemPromptTemplate)(this.targetDir)}
|
|
|
602
602
|
const workflow = new langgraph_1.StateGraph(AgentState)
|
|
603
603
|
.addNode('agent', state => this.callModel(state))
|
|
604
604
|
.addNode('tools', this.toolNode)
|
|
605
|
+
.addNode('interrupt', state => {
|
|
606
|
+
return {
|
|
607
|
+
messages: [new messages_1.AIMessage({
|
|
608
|
+
content: `Final Answer:\n💡 **嘿,我们已经聊了很多了!**
|
|
609
|
+
|
|
610
|
+
为了保证服务质量,我通常会在 50 步操作后停下来和您确认一下。这样可以避免我产生“幻觉”或者做一些无用功。
|
|
611
|
+
|
|
612
|
+
**任务还没完成吗?** 没关系,只要您回复“继续”,我马上就回来接着干!或者您有什么新的想法要告诉我?`
|
|
613
|
+
})]
|
|
614
|
+
};
|
|
615
|
+
})
|
|
605
616
|
.addEdge(langgraph_1.START, 'agent')
|
|
606
617
|
.addConditionalEdges('agent', state => {
|
|
607
618
|
const { messages } = state;
|
|
@@ -627,14 +638,7 @@ ${(0, getSystemPromptTemplate_1.getSystemPromptTemplate)(this.targetDir)}
|
|
|
627
638
|
return langgraph_1.END;
|
|
628
639
|
}
|
|
629
640
|
if (messages.length > 50) {
|
|
630
|
-
|
|
631
|
-
content: `💡 **嘿,我们已经聊了很多了!**
|
|
632
|
-
|
|
633
|
-
为了保证服务质量,我通常会在 50 步操作后停下来和您确认一下。这样可以避免我产生“幻觉”或者做一些无用功。
|
|
634
|
-
|
|
635
|
-
**任务还没完成吗?** 没关系,只要您回复“继续”,我马上就回来接着干!或者您有什么新的想法要告诉我?`
|
|
636
|
-
}));
|
|
637
|
-
return langgraph_1.END;
|
|
641
|
+
return 'interrupt';
|
|
638
642
|
}
|
|
639
643
|
return langgraph_1.END;
|
|
640
644
|
}).addEdge('tools', 'agent');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@saber2pr/ai-agent",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.64",
|
|
4
4
|
"description": "AI Assistant CLI.",
|
|
5
5
|
"author": "saber2pr",
|
|
6
6
|
"license": "ISC",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"@saber2pr/ts-context-mcp": "^0.0.10",
|
|
31
31
|
"diff": "^8.0.3",
|
|
32
32
|
"glob": "^10.5.0",
|
|
33
|
-
"minimatch": "
|
|
33
|
+
"minimatch": "9.0.5",
|
|
34
34
|
"openai": "^6.16.0",
|
|
35
35
|
"typescript": "^5.9.3",
|
|
36
36
|
"zod": "3.25",
|
|
@@ -39,7 +39,8 @@
|
|
|
39
39
|
},
|
|
40
40
|
"resolutions": {
|
|
41
41
|
"zod": "3.25",
|
|
42
|
-
"@langchain/core": "0.3.40"
|
|
42
|
+
"@langchain/core": "0.3.40",
|
|
43
|
+
"minimatch": "9.0.5"
|
|
43
44
|
},
|
|
44
45
|
"devDependencies": {
|
|
45
46
|
"@types/node": "^25.2.3",
|