pentesting 0.8.29 → 0.8.32

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.
Files changed (2) hide show
  1. package/dist/index.js +29 -21
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -5081,6 +5081,7 @@ ${this.currentSpec.systemPrompt}`;
5081
5081
  this.emit(AGENT_EVENT.LLM_START, { model: LLM_MODEL });
5082
5082
  let response;
5083
5083
  let streamBuffer = "";
5084
+ let thinkingBuffer = "";
5084
5085
  try {
5085
5086
  const stream = this.client.messages.stream({
5086
5087
  model: LLM_MODEL,
@@ -5091,13 +5092,20 @@ ${this.currentSpec.systemPrompt}`;
5091
5092
  // Enable extended thinking for GLM/Claude models
5092
5093
  thinking: { type: "enabled", budget_tokens: 16e3 }
5093
5094
  });
5095
+ stream.on("rawEvent", (event) => {
5096
+ if (event.type === "content_block_delta" && event.delta?.type === "thinking_delta") {
5097
+ const thinkingText = event.delta.thinking;
5098
+ if (thinkingText) {
5099
+ thinkingBuffer += thinkingText;
5100
+ this.emit(AGENT_EVENT.THOUGHT, {
5101
+ type: "reasoning",
5102
+ content: thinkingText
5103
+ });
5104
+ }
5105
+ }
5106
+ });
5094
5107
  stream.on("contentBlock", (block) => {
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
+ if (block.type === "tool_use") {
5101
5109
  this.emit(AGENT_EVENT.THOUGHT, {
5102
5110
  type: "action",
5103
5111
  content: `Calling: ${block.name}`
@@ -5106,19 +5114,8 @@ ${this.currentSpec.systemPrompt}`;
5106
5114
  });
5107
5115
  stream.on("text", (text) => {
5108
5116
  streamBuffer += text;
5109
- if (text.trim()) {
5110
- this.emit(AGENT_EVENT.THOUGHT, { type: "thinking", content: text });
5111
- }
5112
5117
  });
5113
5118
  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
- }
5122
5119
  } catch (error) {
5123
5120
  response = await withRetry(
5124
5121
  () => this.client.messages.create({
@@ -7134,9 +7131,14 @@ var App = ({ autoApprove = false, target }) => {
7134
7131
  });
7135
7132
  agent.on(AGENT_EVENT.THOUGHT, (thought) => {
7136
7133
  setCurrentStatus(thought.content.slice(0, 60));
7137
- const label = THOUGHT_LABELS[thought.type] || "";
7138
- addMessage(MESSAGE_TYPE.SYSTEM, `${label} ${thought.content}`);
7139
- wireLoggerRef.current?.contentPart(thought.content, thought.type === "thinking");
7134
+ const label = THOUGHT_LABELS[thought.type] || "[?]";
7135
+ if (thought.type === "reasoning") {
7136
+ addMessage(MESSAGE_TYPE.SYSTEM, `${label} ${thought.content}`);
7137
+ } else if (thought.type === "thinking") {
7138
+ } else {
7139
+ addMessage(MESSAGE_TYPE.SYSTEM, `${label} ${thought.content.slice(0, 200)}`);
7140
+ }
7141
+ wireLoggerRef.current?.contentPart(thought.content, thought.type === "thinking" || thought.type === "reasoning");
7140
7142
  });
7141
7143
  agent.on(AGENT_EVENT.TOOL_CALL, (data) => {
7142
7144
  const args = Object.entries(data.input).slice(0, 2).map(([k, v]) => `${k}=${typeof v === "string" ? v.slice(0, 30) : "..."}`).join(" ");
@@ -7205,7 +7207,6 @@ var App = ({ autoApprove = false, target }) => {
7205
7207
  agent.on(AGENT_EVENT.RESPONSE, (text) => {
7206
7208
  if (text && text.trim()) {
7207
7209
  setCurrentStatus("Responding...");
7208
- addMessage(MESSAGE_TYPE.ASSISTANT, text.trim());
7209
7210
  }
7210
7211
  });
7211
7212
  agent.on(AGENT_EVENT.COMPROMISED, (host) => {
@@ -7272,6 +7273,13 @@ var App = ({ autoApprove = false, target }) => {
7272
7273
  return;
7273
7274
  }
7274
7275
  }
7276
+ if (trimmed === "/exit" || trimmed === "/quit" || trimmed === "/q") {
7277
+ if (isProcessing && agent) {
7278
+ agent.pause();
7279
+ }
7280
+ exit();
7281
+ return;
7282
+ }
7275
7283
  if (isProcessing && !trimmed.startsWith("/")) return;
7276
7284
  setInput("");
7277
7285
  addMessage(MESSAGE_TYPE.USER, trimmed);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pentesting",
3
- "version": "0.8.29",
3
+ "version": "0.8.32",
4
4
  "description": "Autonomous Penetration Testing AI Agent",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",