@shakecodeslikecray/whiterose 0.2.4 → 0.2.6

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.d.ts CHANGED
@@ -982,6 +982,7 @@ declare class ClaudeCodeProvider implements LLMProvider {
982
982
  private fullResponseBuffer;
983
983
  private processTextContent;
984
984
  private tryExtractUnderstandingJson;
985
+ private tryExtractBugsJson;
985
986
  private runSimpleClaude;
986
987
  private parseBugData;
987
988
  private parseAdversarialResponse;
package/dist/index.js CHANGED
@@ -1042,8 +1042,13 @@ Set "survived": true if you CANNOT disprove it (it's a real bug).`;
1042
1042
  if (buffer.trim()) {
1043
1043
  this.processAgentOutput(buffer, callbacks);
1044
1044
  }
1045
- if (this.fullResponseBuffer && callbacks.onUnderstanding) {
1046
- this.tryExtractUnderstandingJson(this.fullResponseBuffer, callbacks);
1045
+ if (this.fullResponseBuffer) {
1046
+ if (callbacks.onUnderstanding) {
1047
+ this.tryExtractUnderstandingJson(this.fullResponseBuffer, callbacks);
1048
+ }
1049
+ if (callbacks.onBugFound) {
1050
+ this.tryExtractBugsJson(this.fullResponseBuffer, callbacks);
1051
+ }
1047
1052
  }
1048
1053
  this.currentProcess = void 0;
1049
1054
  }
@@ -1206,6 +1211,54 @@ Set "survived": true if you CANNOT disprove it (it's a real bug).`;
1206
1211
  }
1207
1212
  }
1208
1213
  }
1214
+ // Try to extract bug JSON objects from text without markers
1215
+ tryExtractBugsJson(text, callbacks) {
1216
+ const candidates = [];
1217
+ let depth = 0;
1218
+ let start = -1;
1219
+ let inString = false;
1220
+ let escapeNext = false;
1221
+ for (let i = 0; i < text.length; i++) {
1222
+ const char = text[i];
1223
+ if (escapeNext) {
1224
+ escapeNext = false;
1225
+ continue;
1226
+ }
1227
+ if (char === "\\" && inString) {
1228
+ escapeNext = true;
1229
+ continue;
1230
+ }
1231
+ if (char === '"' && !escapeNext) {
1232
+ inString = !inString;
1233
+ continue;
1234
+ }
1235
+ if (inString) continue;
1236
+ if (char === "{") {
1237
+ if (depth === 0) {
1238
+ start = i;
1239
+ }
1240
+ depth++;
1241
+ } else if (char === "}") {
1242
+ depth--;
1243
+ if (depth === 0 && start !== -1) {
1244
+ const candidate = text.slice(start, i + 1);
1245
+ if (candidate.includes('"file"') && candidate.includes('"line"') && candidate.includes('"title"')) {
1246
+ candidates.push(candidate);
1247
+ }
1248
+ start = -1;
1249
+ }
1250
+ }
1251
+ }
1252
+ for (const jsonStr of candidates) {
1253
+ try {
1254
+ const parsed = JSON.parse(jsonStr);
1255
+ if (parsed.file && parsed.line && parsed.title) {
1256
+ callbacks.onBugFound?.(jsonStr);
1257
+ }
1258
+ } catch {
1259
+ }
1260
+ }
1261
+ }
1209
1262
  // Simple non-agentic mode for short prompts (adversarial validation)
1210
1263
  async runSimpleClaude(prompt, cwd) {
1211
1264
  const claudeCommand = getProviderCommand("claude-code");