pentesting 0.8.24 → 0.8.26
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 +20 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5080,6 +5080,7 @@ ${this.currentSpec.systemPrompt}`;
|
|
|
5080
5080
|
}
|
|
5081
5081
|
this.emit(AGENT_EVENT.LLM_START, { model: LLM_MODEL });
|
|
5082
5082
|
let response;
|
|
5083
|
+
let streamBuffer = "";
|
|
5083
5084
|
try {
|
|
5084
5085
|
const stream = this.client.messages.stream({
|
|
5085
5086
|
model: LLM_MODEL,
|
|
@@ -5088,9 +5089,26 @@ ${this.currentSpec.systemPrompt}`;
|
|
|
5088
5089
|
tools: this.tools,
|
|
5089
5090
|
messages
|
|
5090
5091
|
});
|
|
5092
|
+
let pendingText = "";
|
|
5091
5093
|
stream.on("text", (text) => {
|
|
5092
|
-
|
|
5093
|
-
|
|
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
|
+
}
|
|
5105
|
+
});
|
|
5106
|
+
stream.on("contentBlock", (block) => {
|
|
5107
|
+
if (block.type === "tool_use") {
|
|
5108
|
+
this.emit(AGENT_EVENT.THOUGHT, {
|
|
5109
|
+
type: "action",
|
|
5110
|
+
content: `Calling: ${block.name}`
|
|
5111
|
+
});
|
|
5094
5112
|
}
|
|
5095
5113
|
});
|
|
5096
5114
|
response = await stream.finalMessage();
|