Add files via upload

This commit is contained in:
公明
2026-03-27 22:41:23 +08:00
committed by GitHub
parent 0d262cb30b
commit 6c71c090b5
13 changed files with 57 additions and 3 deletions

View File

@@ -81,13 +81,21 @@ public class BurpExtender implements IBurpExtender, IContextMenuFactory {
tab.setRunStatus(runId, "error");
break;
case "thinking_stream_start":
if (tab.isShowDebugEvents()) {
tab.resetThinkingStream(runId);
}
break;
case "thinking_stream_delta":
case "tool_call":
case "tool_result":
case "tool_result_delta":
// debug; hide by default
if (tab.isShowDebugEvents() && message != null && !message.isEmpty()) {
tab.appendProgressToRun(runId, "\n[" + type + "] " + message + "\n");
if ("thinking_stream_delta".equals(type)) {
tab.appendThinkingDelta(runId, message);
} else {
tab.appendProgressToRun(runId, "\n[" + type + "] " + message + "\n");
}
}
break;
case "conversation":

View File

@@ -57,6 +57,7 @@ final class CyberStrikeAITab implements ITab {
final StringBuilder buffer = new StringBuilder();
final StringBuilder progressBuffer = new StringBuilder();
final StringBuilder finalBuffer = new StringBuilder();
final StringBuilder thinkingPending = new StringBuilder();
String status;
String conversationId;
String requestRaw;
@@ -568,6 +569,43 @@ final class CyberStrikeAITab implements ITab {
}
}
void resetThinkingStream(String runId) {
if (runId == null) return;
TestRun run = runs.get(runId);
if (run == null) return;
synchronized (run) {
run.thinkingPending.setLength(0);
}
appendProgressToRun(runId, "\n[thinking]\n");
}
void appendThinkingDelta(String runId, String delta) {
if (runId == null || delta == null) return;
TestRun run = runs.get(runId);
if (run == null) return;
StringBuilder toAppend = new StringBuilder();
synchronized (run) {
for (int i = 0; i < delta.length(); i++) {
char c = delta.charAt(i);
if (c == '\n') {
if (run.thinkingPending.length() > 0) {
toAppend.append(" ").append(run.thinkingPending).append("\n");
run.thinkingPending.setLength(0);
} else {
toAppend.append("\n");
}
} else if (c != '\r') {
run.thinkingPending.append(c);
}
}
}
if (toAppend.length() > 0) {
appendProgressToRun(runId, toAppend.toString());
}
}
void appendFinalToRun(String runId, String s) {
if (runId == null || s == null) return;
TestRun run = runs.get(runId);

View File

@@ -20,10 +20,18 @@ final class MarkdownRenderer {
StringBuilder out = new StringBuilder(4096);
out.append("<html><head><meta charset='utf-8'>")
.append("<style>")
.append("body{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Arial,sans-serif;font-size:12px;line-height:1.4;margin:10px;}")
// Swing's HTML renderer does not reliably apply default heading sizes,
// so we explicitly define font sizes to keep a clear hierarchy.
.append("body{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Arial,sans-serif;font-size:13px;line-height:1.45;margin:10px;color:#111;}")
.append("code,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;}")
.append("pre{background:#f6f8fa;border:1px solid #e5e7eb;border-radius:6px;padding:10px;overflow:auto;}")
.append("h1,h2,h3{margin:0.8em 0 0.4em 0;}")
.append("p{margin:0.55em 0;}")
.append("h1{font-size:20px;margin:0.85em 0 0.45em 0;}")
.append("h2{font-size:18px;margin:0.85em 0 0.45em 0;}")
.append("h3{font-size:16px;margin:0.8em 0 0.4em 0;}")
.append("h4{font-size:14px;margin:0.8em 0 0.4em 0;}")
.append("h5{font-size:13px;margin:0.75em 0 0.35em 0;}")
.append("h6{font-size:13px;margin:0.75em 0 0.35em 0;}")
.append("ul{margin:0.4em 0 0.6em 1.2em;padding:0;}")
.append("</style></head><body>");