pentesting 0.8.26 → 0.8.28
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.js +23 -16
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5087,31 +5087,38 @@ ${this.currentSpec.systemPrompt}`;
|
|
|
5087
5087
|
max_tokens: LLM_MAX_TOKENS,
|
|
5088
5088
|
system: systemPrompt,
|
|
5089
5089
|
tools: this.tools,
|
|
5090
|
-
messages
|
|
5091
|
-
|
|
5092
|
-
|
|
5093
|
-
stream.on("text", (text) => {
|
|
5094
|
-
streamBuffer += text;
|
|
5095
|
-
pendingText += text;
|
|
5096
|
-
if (pendingText.length >= 50 || /[.!?。\n]$/.test(pendingText)) {
|
|
5097
|
-
this.emit(AGENT_EVENT.THOUGHT, { type: "thinking", content: pendingText.trim() });
|
|
5098
|
-
pendingText = "";
|
|
5099
|
-
}
|
|
5100
|
-
});
|
|
5101
|
-
stream.on("end", () => {
|
|
5102
|
-
if (pendingText.trim()) {
|
|
5103
|
-
this.emit(AGENT_EVENT.THOUGHT, { type: "thinking", content: pendingText.trim() });
|
|
5104
|
-
}
|
|
5090
|
+
messages,
|
|
5091
|
+
// Enable extended thinking for GLM/Claude models
|
|
5092
|
+
thinking: { type: "enabled", budget_tokens: 4e3 }
|
|
5105
5093
|
});
|
|
5106
5094
|
stream.on("contentBlock", (block) => {
|
|
5107
|
-
if (block.type === "
|
|
5095
|
+
if (block.type === "thinking" && block.thinking) {
|
|
5096
|
+
this.emit(AGENT_EVENT.THOUGHT, {
|
|
5097
|
+
type: "reasoning",
|
|
5098
|
+
content: block.thinking.slice(0, 500)
|
|
5099
|
+
});
|
|
5100
|
+
} else if (block.type === "tool_use") {
|
|
5108
5101
|
this.emit(AGENT_EVENT.THOUGHT, {
|
|
5109
5102
|
type: "action",
|
|
5110
5103
|
content: `Calling: ${block.name}`
|
|
5111
5104
|
});
|
|
5112
5105
|
}
|
|
5113
5106
|
});
|
|
5107
|
+
stream.on("text", (text) => {
|
|
5108
|
+
streamBuffer += text;
|
|
5109
|
+
if (text.trim()) {
|
|
5110
|
+
this.emit(AGENT_EVENT.THOUGHT, { type: "thinking", content: text });
|
|
5111
|
+
}
|
|
5112
|
+
});
|
|
5114
5113
|
response = await stream.finalMessage();
|
|
5114
|
+
for (const block of response.content) {
|
|
5115
|
+
if (block.type === "thinking" && block.thinking) {
|
|
5116
|
+
this.emit(AGENT_EVENT.THOUGHT, {
|
|
5117
|
+
type: "reasoning",
|
|
5118
|
+
content: block.thinking
|
|
5119
|
+
});
|
|
5120
|
+
}
|
|
5121
|
+
}
|
|
5115
5122
|
} catch (error) {
|
|
5116
5123
|
response = await withRetry(
|
|
5117
5124
|
() => this.client.messages.create({
|